Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'soc-3.13-2' of git://git.infradead.org/linux-mvebu into next/soc

From Jason Cooper:
mvebu soc changes for v3.13 (round 2)

- kirkwood
- remove mbus init, pcie clk init
- retain MAC addr for DT ethernet (work around broken IP)
- docs: clarify Armada SoCs

* tag 'soc-3.13-2' of git://git.infradead.org/linux-mvebu:
Documentation: arm/Marvell: clarify Armada SoCs that match 78xx0 pattern
ARM: kirkwood: retain MAC address for DT ethernet
ARM: kirkwood: Remove unneeded PCIe clock adding
ARM: kirkwood: Remove unneeded MBus initialization
ARM: kirkwood: Add standby support

Signed-off-by: Kevin Hilman <khilman@linaro.org>

+169 -18
+1
Documentation/arm/Marvell/README
··· 88 88 MV78230 89 89 MV78260 90 90 MV78460 91 + NOTE: not to be confused with the non-SMP 78xx0 SoCs 91 92 92 93 Product Brief: http://www.marvell.com/embedded-processors/armada-xp/assets/Marvell-ArmadaXP-SoC-product%20brief.pdf 93 94 No public datasheet available.
+2
arch/arm/mach-kirkwood/Makefile
··· 1 1 obj-y += common.o pcie.o 2 2 obj-$(CONFIG_KIRKWOOD_LEGACY) += irq.o mpp.o 3 + obj-$(CONFIG_PM) += pm.o 4 + 3 5 obj-$(CONFIG_MACH_D2NET_V2) += d2net_v2-setup.o lacie_v2-common.o 4 6 obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o 5 7 obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
+84 -18
arch/arm/mach-kirkwood/board-dt.c
··· 13 13 #include <linux/kernel.h> 14 14 #include <linux/init.h> 15 15 #include <linux/of.h> 16 + #include <linux/of_address.h> 17 + #include <linux/of_net.h> 16 18 #include <linux/of_platform.h> 17 19 #include <linux/clk-provider.h> 18 20 #include <linux/clocksource.h> ··· 46 44 clkspec.np = np; 47 45 clkspec.args_count = 1; 48 46 49 - clkspec.args[0] = CGC_BIT_PEX0; 50 - orion_clkdev_add("0", "pcie", 51 - of_clk_get_from_provider(&clkspec)); 52 - 53 - clkspec.args[0] = CGC_BIT_PEX1; 54 - orion_clkdev_add("1", "pcie", 55 - of_clk_get_from_provider(&clkspec)); 56 - 57 47 /* 58 48 * The ethernet interfaces forget the MAC address assigned by 59 49 * u-boot if the clocks are turned off. Until proper DT support ··· 60 66 clk_prepare_enable(clk); 61 67 } 62 68 69 + #define MV643XX_ETH_MAC_ADDR_LOW 0x0414 70 + #define MV643XX_ETH_MAC_ADDR_HIGH 0x0418 71 + 72 + static void __init kirkwood_dt_eth_fixup(void) 73 + { 74 + struct device_node *np; 75 + 76 + /* 77 + * The ethernet interfaces forget the MAC address assigned by u-boot 78 + * if the clocks are turned off. Usually, u-boot on kirkwood boards 79 + * has no DT support to properly set local-mac-address property. 80 + * As a workaround, we get the MAC address from mv643xx_eth registers 81 + * and update the port device node if no valid MAC address is set. 82 + */ 83 + for_each_compatible_node(np, NULL, "marvell,kirkwood-eth-port") { 84 + struct device_node *pnp = of_get_parent(np); 85 + struct clk *clk; 86 + struct property *pmac; 87 + void __iomem *io; 88 + u8 *macaddr; 89 + u32 reg; 90 + 91 + if (!pnp) 92 + continue; 93 + 94 + /* skip disabled nodes or nodes with valid MAC address*/ 95 + if (!of_device_is_available(pnp) || of_get_mac_address(np)) 96 + goto eth_fixup_skip; 97 + 98 + clk = of_clk_get(pnp, 0); 99 + if (IS_ERR(clk)) 100 + goto eth_fixup_skip; 101 + 102 + io = of_iomap(pnp, 0); 103 + if (!io) 104 + goto eth_fixup_no_map; 105 + 106 + /* ensure port clock is not gated to not hang CPU */ 107 + clk_prepare_enable(clk); 108 + 109 + /* store MAC address register contents in local-mac-address */ 110 + pr_err(FW_INFO "%s: local-mac-address is not set\n", 111 + np->full_name); 112 + 113 + pmac = kzalloc(sizeof(*pmac) + 6, GFP_KERNEL); 114 + if (!pmac) 115 + goto eth_fixup_no_mem; 116 + 117 + pmac->value = pmac + 1; 118 + pmac->length = 6; 119 + pmac->name = kstrdup("local-mac-address", GFP_KERNEL); 120 + if (!pmac->name) { 121 + kfree(pmac); 122 + goto eth_fixup_no_mem; 123 + } 124 + 125 + macaddr = pmac->value; 126 + reg = readl(io + MV643XX_ETH_MAC_ADDR_HIGH); 127 + macaddr[0] = (reg >> 24) & 0xff; 128 + macaddr[1] = (reg >> 16) & 0xff; 129 + macaddr[2] = (reg >> 8) & 0xff; 130 + macaddr[3] = reg & 0xff; 131 + 132 + reg = readl(io + MV643XX_ETH_MAC_ADDR_LOW); 133 + macaddr[4] = (reg >> 8) & 0xff; 134 + macaddr[5] = reg & 0xff; 135 + 136 + of_update_property(np, pmac); 137 + 138 + eth_fixup_no_mem: 139 + iounmap(io); 140 + clk_disable_unprepare(clk); 141 + eth_fixup_no_map: 142 + clk_put(clk); 143 + eth_fixup_skip: 144 + of_node_put(pnp); 145 + } 146 + } 147 + 63 148 static void __init kirkwood_dt_time_init(void) 64 149 { 65 150 of_clk_init(NULL); 66 151 clocksource_of_init(); 67 - } 68 - 69 - static void __init kirkwood_dt_init_early(void) 70 - { 71 - mvebu_mbus_init("marvell,kirkwood-mbus", 72 - BRIDGE_WINS_BASE, BRIDGE_WINS_SZ, 73 - DDR_WINDOW_CPU_BASE, DDR_WINDOW_CPU_SZ); 74 152 } 75 153 76 154 static void __init kirkwood_dt_init(void) ··· 163 97 kirkwood_l2_init(); 164 98 165 99 kirkwood_cpufreq_init(); 166 - 100 + kirkwood_cpuidle_init(); 167 101 /* Setup clocks for legacy devices */ 168 102 kirkwood_legacy_clk_init(); 169 103 170 - kirkwood_cpuidle_init(); 104 + kirkwood_pm_init(); 105 + kirkwood_dt_eth_fixup(); 171 106 172 107 #ifdef CONFIG_KEXEC 173 108 kexec_reinit = kirkwood_enable_pcie; ··· 188 121 DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)") 189 122 /* Maintainer: Jason Cooper <jason@lakedaemon.net> */ 190 123 .map_io = kirkwood_map_io, 191 - .init_early = kirkwood_dt_init_early, 192 124 .init_time = kirkwood_dt_time_init, 193 125 .init_machine = kirkwood_dt_init, 194 126 .restart = kirkwood_restart,
+1
arch/arm/mach-kirkwood/common.c
··· 721 721 kirkwood_xor1_init(); 722 722 kirkwood_crypto_init(); 723 723 724 + kirkwood_pm_init(); 724 725 kirkwood_cpuidle_init(); 725 726 #ifdef CONFIG_KEXEC 726 727 kexec_reinit = kirkwood_enable_pcie;
+6
arch/arm/mach-kirkwood/common.h
··· 58 58 void kirkwood_restart(enum reboot_mode, const char *); 59 59 void kirkwood_clk_init(void); 60 60 61 + #ifdef CONFIG_PM 62 + void kirkwood_pm_init(void); 63 + #else 64 + static inline void kirkwood_pm_init(void) {}; 65 + #endif 66 + 61 67 /* board init functions for boards not fully converted to fdt */ 62 68 #ifdef CONFIG_MACH_MV88F6281GTW_GE_DT 63 69 void mv88f6281gtw_ge_init(void);
+2
arch/arm/mach-kirkwood/include/mach/bridge-regs.h
··· 78 78 #define CGC_TDM (1 << 20) 79 79 #define CGC_RESERVED (0x6 << 21) 80 80 81 + #define MEMORY_PM_CTRL (BRIDGE_VIRT_BASE + 0x118) 82 + 81 83 #endif
+73
arch/arm/mach-kirkwood/pm.c
··· 1 + /* 2 + * Power Management driver for Marvell Kirkwood SoCs 3 + * 4 + * Copyright (C) 2013 Ezequiel Garcia <ezequiel@free-electrons.com> 5 + * Copyright (C) 2010 Simon Guinot <sguinot@lacie.com> 6 + * 7 + * This program is free software; you can redistribute it and/or modify 8 + * it under the terms of the GNU General Public License, 9 + * version 2 of the License. 10 + * 11 + * This program is distributed in the hope that it will be useful, 12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + * GNU General Public License for more details. 15 + */ 16 + 17 + #include <linux/kernel.h> 18 + #include <linux/suspend.h> 19 + #include <linux/io.h> 20 + #include <mach/bridge-regs.h> 21 + 22 + static void __iomem *ddr_operation_base; 23 + 24 + static void kirkwood_low_power(void) 25 + { 26 + u32 mem_pm_ctrl; 27 + 28 + mem_pm_ctrl = readl(MEMORY_PM_CTRL); 29 + 30 + /* Set peripherals to low-power mode */ 31 + writel_relaxed(~0, MEMORY_PM_CTRL); 32 + 33 + /* Set DDR in self-refresh */ 34 + writel_relaxed(0x7, ddr_operation_base); 35 + 36 + /* 37 + * Set CPU in wait-for-interrupt state. 38 + * This disables the CPU core clocks, 39 + * the array clocks, and also the L2 controller. 40 + */ 41 + cpu_do_idle(); 42 + 43 + writel_relaxed(mem_pm_ctrl, MEMORY_PM_CTRL); 44 + } 45 + 46 + static int kirkwood_suspend_enter(suspend_state_t state) 47 + { 48 + switch (state) { 49 + case PM_SUSPEND_STANDBY: 50 + kirkwood_low_power(); 51 + break; 52 + default: 53 + return -EINVAL; 54 + } 55 + return 0; 56 + } 57 + 58 + static int kirkwood_pm_valid_standby(suspend_state_t state) 59 + { 60 + return state == PM_SUSPEND_STANDBY; 61 + } 62 + 63 + static const struct platform_suspend_ops kirkwood_suspend_ops = { 64 + .enter = kirkwood_suspend_enter, 65 + .valid = kirkwood_pm_valid_standby, 66 + }; 67 + 68 + int __init kirkwood_pm_init(void) 69 + { 70 + ddr_operation_base = ioremap(DDR_OPERATION_BASE, 4); 71 + suspend_set_ops(&kirkwood_suspend_ops); 72 + return 0; 73 + }