OSDN Git Service

sh: Device Treee support update.
authorYoshinori Sato <ysato@users.sourceforge.jp>
Thu, 14 Apr 2016 07:59:25 +0000 (16:59 +0900)
committerYoshinori Sato <ysato@users.sourceforge.jp>
Thu, 14 Apr 2016 08:05:54 +0000 (17:05 +0900)
Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp>
arch/sh/Makefile
arch/sh/boards/Kconfig
arch/sh/boards/of-generic.c
arch/sh/kernel/setup.c

index bf5b3f5..8ff943b 100644 (file)
@@ -130,6 +130,9 @@ head-y      := arch/sh/kernel/head_$(BITS).o
 core-y                         += arch/sh/kernel/ arch/sh/mm/ arch/sh/boards/
 core-$(CONFIG_SH_FPU_EMU)      += arch/sh/math-emu/
 
+core-$(CONFIG_USE_BUILTIN_DTB) += arch/sh/boot/dts/
+
+ifneq ($(CONFIG_SH_DEVICE_TREE),y)
 # Mach groups
 machdir-$(CONFIG_SOLUTION_ENGINE)              += mach-se
 machdir-$(CONFIG_SH_HP6XX)                     += mach-hp6xx
@@ -150,6 +153,7 @@ machdir-$(CONFIG_SH_LANDISK)                        += mach-landisk
 machdir-$(CONFIG_SH_LBOX_RE2)                  += mach-lboxre2
 machdir-$(CONFIG_SH_CAYMAN)                    += mach-cayman
 machdir-$(CONFIG_SH_RSK)                       += mach-rsk
+endif
 
 ifneq ($(machdir-y),)
 core-y += $(addprefix arch/sh/boards/, \
@@ -222,6 +226,13 @@ archclean:
        $(Q)$(MAKE) $(clean)=$(boot)
        $(Q)$(MAKE) $(clean)=arch/sh/kernel/vsyscall
 
+%.dtb %.dtb.S %.dtb.o: | scripts
+       $(Q)$(MAKE) $(build)=arch/sh/boot/dts arch/sh/boot/dts/$@
+
+PHONY += dtbs
+dtbs: scripts
+       $(Q)$(MAKE) $(build)=arch/sh/boot/dts
+
 define archhelp
        @echo '  zImage                    - Compressed kernel image'
        @echo '  romImage                  - Compressed ROM image, if supported'
index 5e52d53..71db753 100644 (file)
@@ -12,6 +12,7 @@ config SH_DEVICE_TREE
        select OF_EARLY_FLATTREE
        select CLKSRC_OF
        select GENERIC_CALIBRATE_DELAY
+       select COMMON_CLK
        help
          Select Board Described by Device Tree to build a kernel that
          does not hard-code any board-specific knowledge but instead uses
@@ -292,6 +293,7 @@ config SH_LANDISK
        bool "LANDISK"
        depends on CPU_SUBTYPE_SH7751R
        select SYS_SUPPORTS_PCI
+       select SH_DEVICE_TREE
        help
          I-O DATA DEVICE, INC. "LANDISK Series" support.
 
index ad76982..6a8d028 100644 (file)
@@ -118,23 +118,19 @@ static void __init sh_of_mem_reserve(void)
        early_init_fdt_scan_reserved_mem();
 }
 
-static void __init sh_of_time_init(void)
-{
-       pr_info("SH generic board support: scanning for clocksource devices\n");
-       clocksource_probe();
-}
-
 static void __init sh_of_setup(char **cmdline_p)
 {
-       unflatten_device_tree();
-
-       board_time_init = sh_of_time_init;
+       struct device_node *cpu;
+       int freq;
 
        sh_mv.mv_name = of_flat_dt_get_machine_name();
        if (!sh_mv.mv_name)
                sh_mv.mv_name = "Unknown SH model";
 
        sh_of_smp_probe();
+       cpu = of_find_node_by_name(NULL, "cpu");
+       if (!of_property_read_u32(cpu, "clock-frequency", &freq))
+               preset_lpj = freq / 500;
 }
 
 static int sh_of_irq_demux(int irq)
index 5d34605..c04add3 100644 (file)
@@ -177,7 +177,12 @@ disable:
 #ifndef CONFIG_GENERIC_CALIBRATE_DELAY
 void calibrate_delay(void)
 {
+#ifndef CONFIG_OF
        struct clk *clk = clk_get(NULL, "cpu_clk");
+#else
+       struct device_node *cpu = of_find_node_by_name(NULL, "cpu");
+       struct clk *clk = of_clk_get_by_name(cpu, NULL);
+#endif
 
        if (IS_ERR(clk))
                panic("Need a sane CPU clock definition!");
@@ -251,7 +256,11 @@ void __ref sh_fdt_init(phys_addr_t dt_phys)
        /* Avoid calling an __init function on secondary cpus. */
        if (done) return;
 
+#ifdef CONFIG_USE_BUILTIN_DTB
+       dt_virt = __dtb_start;
+#else
        dt_virt = phys_to_virt(dt_phys);
+#endif
 
        if (!dt_virt || !early_init_dt_scan(dt_virt)) {
                pr_crit("Error: invalid device tree blob"
@@ -267,6 +276,9 @@ void __ref sh_fdt_init(phys_addr_t dt_phys)
 
 void __init setup_arch(char **cmdline_p)
 {
+#ifdef CONFIG_OF
+       unflatten_and_copy_device_tree();
+#endif
        enable_mmu();
 
        ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);