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>
@@@ -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();
  
@@@ -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,
Simple merge
Simple merge
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>
@@@ -60,91 -65,13 +59,85 @@@ static void __init kirkwood_legacy_clk_
        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);
@@@ -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
  #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>
@@@ -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