]> Pileus Git - ~andy/linux/commitdiff
Merge branch 'cleanup/dt-clock' into next/soc
authorOlof Johansson <olof@lixom.net>
Mon, 28 Oct 2013 17:11:42 +0000 (10:11 -0700)
committerOlof Johansson <olof@lixom.net>
Mon, 28 Oct 2013 17:11:42 +0000 (10:11 -0700)
Merging in dt clock cleanup as a pre-req with some of the later SoC branches.

There are a handful of conflicts here -- some of the already merged SoC
branches should have been based on the cleanup but weren't.

In particular, a remove/add of include on highbank and two remove/remove
conflicts on kirkwood were fixed up.

* cleanup/dt-clock: (28 commits)
  ARM: vt8500: remove custom .init_time hook
  ARM: vexpress: remove custom .init_time hook
  ARM: tegra: remove custom .init_time hook
  ARM: sunxi: remove custom .init_time hook
  ARM: sti: remove custom .init_time hook
  ARM: socfpga: remove custom .init_time hook
  ARM: rockchip: remove custom .init_time hook
  ARM: prima2: remove custom .init_time hook
  ARM: nspire: remove custom .init_time hook
  ARM: nomadik: remove custom .init_time hook
  ARM: mxs: remove custom .init_time hook
  ARM: kirkwood: remove custom .init_time hook
  ARM: imx: remove custom .init_time hook
  ARM: highbank: remove custom .init_time hook
  ARM: exynos: remove custom .init_time hook
  ARM: dove: remove custom .init_time hook
  ARM: bcm2835: remove custom .init_time hook
  ARM: bcm: provide common arch init for DT clocks
  ARM: call of_clk_init from default time_init handler
  ARM: vt8500: prepare for arch-wide .init_time callback
  ...

Signed-off-by: Olof Johansson <olof@lixom.net>
1  2 
arch/arm/mach-highbank/highbank.c
arch/arm/mach-imx/clk-imx51-imx53.c
arch/arm/mach-imx/mach-imx6q.c
arch/arm/mach-kirkwood/board-dt.c
arch/arm/mach-tegra/tegra.c

index 0c49beb37cee21fc9cabecf509fcc8a5639d5e18,e6d6eacea9d027d90ed35b9b057c62869cb2a181..b3d7e5634b83cb02ce568040099027007820a45b
  #include <linux/of_platform.h>
  #include <linux/of_address.h>
  #include <linux/amba/bus.h>
- #include <linux/clk-provider.h>
 +#include <linux/platform_device.h>
  
 -#include <asm/cacheflush.h>
 -#include <asm/cputype.h>
 -#include <asm/smp_plat.h>
 +#include <asm/psci.h>
  #include <asm/hardware/cache-l2x0.h>
  #include <asm/mach/arch.h>
  #include <asm/mach/map.h>
@@@ -48,6 -48,17 +47,6 @@@ static void __init highbank_scu_map_io(
        scu_base_addr = ioremap(base, SZ_4K);
  }
  
 -#define HB_JUMP_TABLE_PHYS(cpu)               (0x40 + (0x10 * (cpu)))
 -#define HB_JUMP_TABLE_VIRT(cpu)               phys_to_virt(HB_JUMP_TABLE_PHYS(cpu))
 -
 -void highbank_set_cpu_jump(int cpu, void *jump_addr)
 -{
 -      cpu = MPIDR_AFFINITY_LEVEL(cpu_logical_map(cpu), 0);
 -      writel(virt_to_phys(jump_addr), HB_JUMP_TABLE_VIRT(cpu));
 -      __cpuc_flush_dcache_area(HB_JUMP_TABLE_VIRT(cpu), 16);
 -      outer_clean_range(HB_JUMP_TABLE_PHYS(cpu),
 -                        HB_JUMP_TABLE_PHYS(cpu) + 15);
 -}
  
  static void highbank_l2x0_disable(void)
  {
@@@ -71,20 -82,6 +70,6 @@@ static void __init highbank_init_irq(vo
        }
  }
  
- static void __init highbank_timer_init(void)
- {
-       struct device_node *np;
-       /* Map system registers */
-       np = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs");
-       sregs_base = of_iomap(np, 0);
-       WARN_ON(!sregs_base);
-       of_clk_init(NULL);
-       clocksource_of_init();
- }
  static void highbank_power_off(void)
  {
        highbank_set_pwr_shutdown();
@@@ -141,12 -138,15 +126,19 @@@ static struct notifier_block highbank_p
        .notifier_call = highbank_platform_notifier,
  };
  
 +static struct platform_device highbank_cpuidle_device = {
 +      .name = "cpuidle-calxeda",
 +};
 +
  static void __init highbank_init(void)
  {
+       struct device_node *np;
+       /* Map system registers */
+       np = of_find_compatible_node(NULL, NULL, "calxeda,hb-sregs");
+       sregs_base = of_iomap(np, 0);
+       WARN_ON(!sregs_base);
        pm_power_off = highbank_power_off;
        highbank_pm_init();
  
        bus_register_notifier(&amba_bustype, &highbank_amba_nb);
  
        of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 +
 +      if (psci_ops.cpu_suspend)
 +              platform_device_register(&highbank_cpuidle_device);
  }
  
  static const char *highbank_match[] __initconst = {
@@@ -169,8 -166,8 +161,7 @@@ DT_MACHINE_START(HIGHBANK, "Highbank"
  #if defined(CONFIG_ZONE_DMA) && defined(CONFIG_ARM_LPAE)
        .dma_zone_size  = (4ULL * SZ_1G),
  #endif
 -      .smp            = smp_ops(highbank_smp_ops),
        .init_irq       = highbank_init_irq,
-       .init_time      = highbank_timer_init,
        .init_machine   = highbank_init,
        .dt_compat      = highbank_match,
        .restart        = highbank_restart,
index 7c0dc4540aa4785270784e3f62ce2b643fd95664,1b796db7652c34dfdc79df6a852441d56bca51b8..ceaac9cd7b4230859143d951af389908744b7cc2
@@@ -11,6 -11,7 +11,7 @@@
  #include <linux/clk.h>
  #include <linux/io.h>
  #include <linux/clkdev.h>
+ #include <linux/clk-provider.h>
  #include <linux/of.h>
  #include <linux/err.h>
  
@@@ -131,8 -132,6 +132,6 @@@ static void __init mx5_clocks_common_in
  {
        int i;
  
-       of_clk_init(NULL);
        clk[dummy] = imx_clk_fixed("dummy", 0);
        clk[ckil] = imx_obtain_fixed_clock("ckil", rate_ckil);
        clk[osc] = imx_obtain_fixed_clock("osc", rate_osc);
        clk_register_clkdev(clk[ssi2_ipg_gate], NULL, "imx-ssi.1");
        clk_register_clkdev(clk[ssi3_ipg_gate], NULL, "imx-ssi.2");
        clk_register_clkdev(clk[sdma_gate], NULL, "imx35-sdma");
 -      clk_register_clkdev(clk[cpu_podf], NULL, "cpufreq-cpu0.0");
 +      clk_register_clkdev(clk[cpu_podf], NULL, "cpu0");
        clk_register_clkdev(clk[iim_gate], "iim", NULL);
        clk_register_clkdev(clk[dummy], NULL, "imx2-wdt.0");
        clk_register_clkdev(clk[dummy], NULL, "imx2-wdt.1");
@@@ -397,7 -396,7 +396,7 @@@ int __init mx51_clocks_init(unsigned lo
                                mx51_spdif_xtal_sel, ARRAY_SIZE(mx51_spdif_xtal_sel));
        clk[spdif1_sel] = imx_clk_mux("spdif1_sel", MXC_CCM_CSCMR2, 2, 2,
                                spdif_sel, ARRAY_SIZE(spdif_sel));
 -      clk[spdif1_pred] = imx_clk_divider("spdif1_podf", "spdif1_sel", MXC_CCM_CDCDR, 16, 3);
 +      clk[spdif1_pred] = imx_clk_divider("spdif1_pred", "spdif1_sel", MXC_CCM_CDCDR, 16, 3);
        clk[spdif1_podf] = imx_clk_divider("spdif1_podf", "spdif1_pred", MXC_CCM_CDCDR, 9, 6);
        clk[spdif1_com_sel] = imx_clk_mux("spdif1_com_sel", MXC_CCM_CSCMR2, 5, 1,
                                mx51_spdif1_com_sel, ARRAY_SIZE(mx51_spdif1_com_sel));
        return 0;
  }
  
- int __init mx53_clocks_init(unsigned long rate_ckil, unsigned long rate_osc,
-                       unsigned long rate_ckih1, unsigned long rate_ckih2)
+ static void __init mx51_clocks_init_dt(struct device_node *np)
+ {
+       mx51_clocks_init(0, 0, 0, 0);
+ }
+ CLK_OF_DECLARE(imx51_ccm, "fsl,imx51-ccm", mx51_clocks_init_dt);
+ static void __init mx53_clocks_init(struct device_node *np)
  {
        int i;
        unsigned long r;
-       struct device_node *np;
  
        clk[pll1_sw] = imx_clk_pllv2("pll1_sw", "osc", MX53_DPLL1_BASE);
        clk[pll2_sw] = imx_clk_pllv2("pll2_sw", "osc", MX53_DPLL2_BASE);
                        pr_err("i.MX53 clk %d: register failed with %ld\n",
                                i, PTR_ERR(clk[i]));
  
-       np = of_find_compatible_node(NULL, NULL, "fsl,imx53-ccm");
        clk_data.clks = clk;
        clk_data.clk_num = ARRAY_SIZE(clk);
        of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
  
-       mx5_clocks_common_init(rate_ckil, rate_osc, rate_ckih1, rate_ckih2);
+       mx5_clocks_common_init(0, 0, 0, 0);
  
        clk_register_clkdev(clk[vpu_gate], NULL, "imx53-vpu.0");
        clk_register_clkdev(clk[i2c3_gate], NULL, "imx21-i2c.2");
  
        r = clk_round_rate(clk[usboh3_per_gate], 54000000);
        clk_set_rate(clk[usboh3_per_gate], r);
-       return 0;
- }
- int __init mx51_clocks_init_dt(void)
- {
-       return mx51_clocks_init(0, 0, 0, 0);
- }
- int __init mx53_clocks_init_dt(void)
- {
-       return mx53_clocks_init(0, 0, 0, 0);
  }
+ CLK_OF_DECLARE(imx53_ccm, "fsl,imx53-ccm", mx53_clocks_init);
index 90372a21087f9ef38535479ccc35aac9e37977dc,47ebc36636a71976de98b20c25ea75f027c18877..3be0fa0e979602580f5cf7639520a61c187cfceb
@@@ -11,9 -11,7 +11,7 @@@
   */
  
  #include <linux/clk.h>
- #include <linux/clk-provider.h>
  #include <linux/clkdev.h>
- #include <linux/clocksource.h>
  #include <linux/cpu.h>
  #include <linux/delay.h>
  #include <linux/export.h>
@@@ -192,6 -190,9 +190,9 @@@ static void __init imx6q_1588_init(void
  
  static void __init imx6q_init_machine(void)
  {
+       imx_print_silicon_rev(cpu_is_imx6dl() ? "i.MX6DL" : "i.MX6Q",
+                             imx6q_revision());
        imx6q_enet_phy_init();
  
        of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
@@@ -233,15 -234,10 +234,15 @@@ put_node
        of_node_put(np);
  }
  
 -static void __init imx6q_opp_init(struct device *cpu_dev)
 +static void __init imx6q_opp_init(void)
  {
        struct device_node *np;
 +      struct device *cpu_dev = get_cpu_device(0);
  
 +      if (!cpu_dev) {
 +              pr_warn("failed to get cpu0 device\n");
 +              return;
 +      }
        np = of_node_get(cpu_dev->of_node);
        if (!np) {
                pr_warn("failed to find cpu0 node\n");
@@@ -273,7 -269,7 +274,7 @@@ static void __init imx6q_init_late(void
                imx6q_cpuidle_init();
  
        if (IS_ENABLED(CONFIG_ARM_IMX6Q_CPUFREQ)) {
 -              imx6q_opp_init(&imx6q_cpufreq_pdev.dev);
 +              imx6q_opp_init();
                platform_device_register(&imx6q_cpufreq_pdev);
        }
  }
@@@ -293,14 -289,6 +294,6 @@@ static void __init imx6q_init_irq(void
        irqchip_init();
  }
  
- static void __init imx6q_timer_init(void)
- {
-       of_clk_init(NULL);
-       clocksource_of_init();
-       imx_print_silicon_rev(cpu_is_imx6dl() ? "i.MX6DL" : "i.MX6Q",
-                             imx6q_revision());
- }
  static const char *imx6q_dt_compat[] __initdata = {
        "fsl,imx6dl",
        "fsl,imx6q",
@@@ -311,7 -299,6 +304,6 @@@ DT_MACHINE_START(IMX6Q, "Freescale i.MX
        .smp            = smp_ops(imx_smp_ops),
        .map_io         = imx6q_map_io,
        .init_irq       = imx6q_init_irq,
-       .init_time      = imx6q_timer_init,
        .init_machine   = imx6q_init_machine,
        .init_late      = imx6q_init_late,
        .dt_compat      = imx6q_dt_compat,
index 27c1877e6ddababc2826abc1840363fa78ec39e9,a32a3e507a9d4fc3a96c35b7c7ddbdfe93f57e0e..c9f6fd2d90f54fae5db9ef58f6ea21acdd8b6a0f
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/of.h>
 +#include <linux/of_address.h>
 +#include <linux/of_net.h>
  #include <linux/of_platform.h>
  #include <linux/clk-provider.h>
- #include <linux/clocksource.h>
  #include <linux/dma-mapping.h>
  #include <linux/irqchip.h>
  #include <linux/kexec.h>
@@@ -46,6 -43,14 +45,6 @@@ static void __init kirkwood_legacy_clk_
        clkspec.np = np;
        clkspec.args_count = 1;
  
 -      clkspec.args[0] = CGC_BIT_PEX0;
 -      orion_clkdev_add("0", "pcie",
 -                       of_clk_get_from_provider(&clkspec));
 -
 -      clkspec.args[0] = CGC_BIT_PEX1;
 -      orion_clkdev_add("1", "pcie",
 -                       of_clk_get_from_provider(&clkspec));
 -
        /*
         * The ethernet interfaces forget the MAC address assigned by
         * u-boot if the clocks are turned off. Until proper DT support
        clk_prepare_enable(clk);
  }
  
 -static void __init kirkwood_dt_init_early(void)
 +#define MV643XX_ETH_MAC_ADDR_LOW      0x0414
 +#define MV643XX_ETH_MAC_ADDR_HIGH     0x0418
 +
 +static void __init kirkwood_dt_eth_fixup(void)
  {
 -      mvebu_mbus_init("marvell,kirkwood-mbus",
 -                      BRIDGE_WINS_BASE, BRIDGE_WINS_SZ,
 -                      DDR_WINDOW_CPU_BASE, DDR_WINDOW_CPU_SZ);
 +      struct device_node *np;
 +
 +      /*
 +       * The ethernet interfaces forget the MAC address assigned by u-boot
 +       * if the clocks are turned off. Usually, u-boot on kirkwood boards
 +       * has no DT support to properly set local-mac-address property.
 +       * As a workaround, we get the MAC address from mv643xx_eth registers
 +       * and update the port device node if no valid MAC address is set.
 +       */
 +      for_each_compatible_node(np, NULL, "marvell,kirkwood-eth-port") {
 +              struct device_node *pnp = of_get_parent(np);
 +              struct clk *clk;
 +              struct property *pmac;
 +              void __iomem *io;
 +              u8 *macaddr;
 +              u32 reg;
 +
 +              if (!pnp)
 +                      continue;
 +
 +              /* skip disabled nodes or nodes with valid MAC address*/
 +              if (!of_device_is_available(pnp) || of_get_mac_address(np))
 +                      goto eth_fixup_skip;
 +
 +              clk = of_clk_get(pnp, 0);
 +              if (IS_ERR(clk))
 +                      goto eth_fixup_skip;
 +
 +              io = of_iomap(pnp, 0);
 +              if (!io)
 +                      goto eth_fixup_no_map;
 +
 +              /* ensure port clock is not gated to not hang CPU */
 +              clk_prepare_enable(clk);
 +
 +              /* store MAC address register contents in local-mac-address */
 +              pr_err(FW_INFO "%s: local-mac-address is not set\n",
 +                     np->full_name);
 +
 +              pmac = kzalloc(sizeof(*pmac) + 6, GFP_KERNEL);
 +              if (!pmac)
 +                      goto eth_fixup_no_mem;
 +
 +              pmac->value = pmac + 1;
 +              pmac->length = 6;
 +              pmac->name = kstrdup("local-mac-address", GFP_KERNEL);
 +              if (!pmac->name) {
 +                      kfree(pmac);
 +                      goto eth_fixup_no_mem;
 +              }
 +
 +              macaddr = pmac->value;
 +              reg = readl(io + MV643XX_ETH_MAC_ADDR_HIGH);
 +              macaddr[0] = (reg >> 24) & 0xff;
 +              macaddr[1] = (reg >> 16) & 0xff;
 +              macaddr[2] = (reg >> 8) & 0xff;
 +              macaddr[3] = reg & 0xff;
 +
 +              reg = readl(io + MV643XX_ETH_MAC_ADDR_LOW);
 +              macaddr[4] = (reg >> 8) & 0xff;
 +              macaddr[5] = reg & 0xff;
 +
 +              of_update_property(np, pmac);
 +
 +eth_fixup_no_mem:
 +              iounmap(io);
 +              clk_disable_unprepare(clk);
 +eth_fixup_no_map:
 +              clk_put(clk);
 +eth_fixup_skip:
 +              of_node_put(pnp);
 +      }
  }
  
- static void __init kirkwood_dt_time_init(void)
- {
-       of_clk_init(NULL);
-       clocksource_of_init();
- }
  static void __init kirkwood_dt_init(void)
  {
        pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk);
        kirkwood_l2_init();
  
        kirkwood_cpufreq_init();
 -
 +      kirkwood_cpuidle_init();
        /* Setup clocks for legacy devices */
        kirkwood_legacy_clk_init();
  
 -      kirkwood_cpuidle_init();
 +      kirkwood_pm_init();
 +      kirkwood_dt_eth_fixup();
  
  #ifdef CONFIG_KEXEC
        kexec_reinit = kirkwood_enable_pcie;
@@@ -188,7 -114,7 +181,6 @@@ static const char * const kirkwood_dt_b
  DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
        /* Maintainer: Jason Cooper <jason@lakedaemon.net> */
        .map_io         = kirkwood_map_io,
-       .init_time      = kirkwood_dt_time_init,
 -      .init_early     = kirkwood_dt_init_early,
        .init_machine   = kirkwood_dt_init,
        .restart        = kirkwood_restart,
        .dt_compat      = kirkwood_dt_board_compat,
index 80b801a94677aaf71e725ba5908eb825e06a6567,2e2192807830c2a076ead399a5fb4c4fdf9b9aff..ce553d557c31caf1670e50ceadad19c067d2864c
@@@ -16,7 -16,6 +16,6 @@@
   *
   */
  
- #include <linux/clocksource.h>
  #include <linux/kernel.h>
  #include <linux/init.h>
  #include <linux/platform_device.h>
  #include <linux/slab.h>
  #include <linux/sys_soc.h>
  #include <linux/usb/tegra_usb_phy.h>
- #include <linux/clk-provider.h>
  #include <linux/clk/tegra.h>
 +#include <linux/irqchip.h>
  
 +#include <asm/hardware/cache-l2x0.h>
  #include <asm/mach-types.h>
  #include <asm/mach/arch.h>
  #include <asm/mach/time.h>
  #include <asm/setup.h>
  
 +#include "apbio.h"
  #include "board.h"
  #include "common.h"
 +#include "cpuidle.h"
  #include "fuse.h"
  #include "iomap.h"
 +#include "irq.h"
  #include "pmc.h"
 +#include "pm.h"
 +#include "reset.h"
 +#include "sleep.h"
 +
 +/*
 + * Storage for debug-macro.S's state.
 + *
 + * This must be in .data not .bss so that it gets initialized each time the
 + * kernel is loaded. The data is declared here rather than debug-macro.S so
 + * that multiple inclusions of debug-macro.S point at the same data.
 + */
 +u32 tegra_uart_config[4] = {
 +      /* Debug UART initialization required */
 +      1,
 +      /* Debug UART physical address */
 +      0,
 +      /* Debug UART virtual address */
 +      0,
 +      /* Scratch space for debug macro */
 +      0,
 +};
 +
 +static void __init tegra_init_cache(void)
 +{
 +#ifdef CONFIG_CACHE_L2X0
 +      int ret;
 +      void __iomem *p = IO_ADDRESS(TEGRA_ARM_PERIF_BASE) + 0x3000;
 +      u32 aux_ctrl, cache_type;
 +
 +      cache_type = readl(p + L2X0_CACHE_TYPE);
 +      aux_ctrl = (cache_type & 0x700) << (17-8);
 +      aux_ctrl |= 0x7C400001;
 +
 +      ret = l2x0_of_init(aux_ctrl, 0x8200c3fe);
 +      if (!ret)
 +              l2x0_saved_regs_addr = virt_to_phys(&l2x0_saved_regs);
 +#endif
 +}
 +
 +static void __init tegra_init_early(void)
 +{
 +      tegra_cpu_reset_handler_init();
 +      tegra_apb_io_init();
 +      tegra_init_fuse();
 +      tegra_init_cache();
 +      tegra_powergate_init();
 +      tegra_hotplug_init();
 +}
 +
 +static void __init tegra_dt_init_irq(void)
 +{
 +      tegra_pmc_init_irq();
 +      tegra_init_irq();
 +      irqchip_init();
 +      tegra_legacy_irq_syscore_init();
 +}
  
  static void __init tegra_dt_init(void)
  {
@@@ -145,12 -82,6 +143,6 @@@ out
        of_platform_populate(NULL, of_default_bus_match_table, NULL, parent);
  }
  
- static void __init tegra_dt_init_time(void)
- {
-       of_clk_init(NULL);
-       clocksource_of_init();
- }
  static void __init paz00_init(void)
  {
        if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC))
@@@ -168,9 -99,7 +160,9 @@@ static void __init tegra_dt_init_late(v
  {
        int i;
  
 -      tegra_init_late();
 +      tegra_init_suspend();
 +      tegra_cpuidle_init();
 +      tegra_powergate_debugfs_init();
  
        for (i = 0; i < ARRAY_SIZE(board_init_funcs); i++) {
                if (of_machine_is_compatible(board_init_funcs[i].machine)) {
  }
  
  static const char * const tegra_dt_board_compat[] = {
 +      "nvidia,tegra124",
        "nvidia,tegra114",
        "nvidia,tegra30",
        "nvidia,tegra20",
@@@ -193,9 -121,8 +185,8 @@@ DT_MACHINE_START(TEGRA_DT, "NVIDIA Tegr
        .smp            = smp_ops(tegra_smp_ops),
        .init_early     = tegra_init_early,
        .init_irq       = tegra_dt_init_irq,
-       .init_time      = tegra_dt_init_time,
        .init_machine   = tegra_dt_init,
        .init_late      = tegra_dt_init_late,
 -      .restart        = tegra_assert_system_reset,
 +      .restart        = tegra_pmc_restart,
        .dt_compat      = tegra_dt_board_compat,
  MACHINE_END