diff options
author | Kevin Hilman <khilman@linaro.org> | 2013-10-17 18:05:07 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@linaro.org> | 2013-10-17 18:05:15 -0400 |
commit | 0d481d4187d05b253374bda9e146fa3bc17a9244 (patch) | |
tree | 5775d9734fe8cde9a20a0a3e44f162449589120c | |
parent | 7bc13d78c647979abd6632d95fefd0b353122b0c (diff) | |
parent | d7f5baeedbdb48d4f5bb2b4f6f56f32b7f2f7aff (diff) |
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>
-rw-r--r-- | Documentation/arm/Marvell/README | 1 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/board-dt.c | 102 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/common.c | 1 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/common.h | 6 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/include/mach/bridge-regs.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/pm.c | 73 |
7 files changed, 169 insertions, 18 deletions
diff --git a/Documentation/arm/Marvell/README b/Documentation/arm/Marvell/README index 8f08a86e03b7..da0151db9964 100644 --- a/Documentation/arm/Marvell/README +++ b/Documentation/arm/Marvell/README | |||
@@ -88,6 +88,7 @@ EBU Armada family | |||
88 | MV78230 | 88 | MV78230 |
89 | MV78260 | 89 | MV78260 |
90 | MV78460 | 90 | MV78460 |
91 | NOTE: not to be confused with the non-SMP 78xx0 SoCs | ||
91 | 92 | ||
92 | Product Brief: http://www.marvell.com/embedded-processors/armada-xp/assets/Marvell-ArmadaXP-SoC-product%20brief.pdf | 93 | Product Brief: http://www.marvell.com/embedded-processors/armada-xp/assets/Marvell-ArmadaXP-SoC-product%20brief.pdf |
93 | No public datasheet available. | 94 | No public datasheet available. |
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile index d1f8e3d0793b..144b51102939 100644 --- a/arch/arm/mach-kirkwood/Makefile +++ b/arch/arm/mach-kirkwood/Makefile | |||
@@ -1,5 +1,7 @@ | |||
1 | obj-y += common.o pcie.o | 1 | obj-y += common.o pcie.o |
2 | obj-$(CONFIG_KIRKWOOD_LEGACY) += irq.o mpp.o | 2 | obj-$(CONFIG_KIRKWOOD_LEGACY) += irq.o mpp.o |
3 | obj-$(CONFIG_PM) += pm.o | ||
4 | |||
3 | obj-$(CONFIG_MACH_D2NET_V2) += d2net_v2-setup.o lacie_v2-common.o | 5 | obj-$(CONFIG_MACH_D2NET_V2) += d2net_v2-setup.o lacie_v2-common.o |
4 | obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o | 6 | obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o |
5 | obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o | 7 | obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o |
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c index 82d3ad8e87cf..27c1877e6dda 100644 --- a/arch/arm/mach-kirkwood/board-dt.c +++ b/arch/arm/mach-kirkwood/board-dt.c | |||
@@ -13,6 +13,8 @@ | |||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/of.h> | 15 | #include <linux/of.h> |
16 | #include <linux/of_address.h> | ||
17 | #include <linux/of_net.h> | ||
16 | #include <linux/of_platform.h> | 18 | #include <linux/of_platform.h> |
17 | #include <linux/clk-provider.h> | 19 | #include <linux/clk-provider.h> |
18 | #include <linux/clocksource.h> | 20 | #include <linux/clocksource.h> |
@@ -44,14 +46,6 @@ static void __init kirkwood_legacy_clk_init(void) | |||
44 | clkspec.np = np; | 46 | clkspec.np = np; |
45 | clkspec.args_count = 1; | 47 | clkspec.args_count = 1; |
46 | 48 | ||
47 | clkspec.args[0] = CGC_BIT_PEX0; | ||
48 | orion_clkdev_add("0", "pcie", | ||
49 | of_clk_get_from_provider(&clkspec)); | ||
50 | |||
51 | clkspec.args[0] = CGC_BIT_PEX1; | ||
52 | orion_clkdev_add("1", "pcie", | ||
53 | of_clk_get_from_provider(&clkspec)); | ||
54 | |||
55 | /* | 49 | /* |
56 | * The ethernet interfaces forget the MAC address assigned by | 50 | * The ethernet interfaces forget the MAC address assigned by |
57 | * u-boot if the clocks are turned off. Until proper DT support | 51 | * u-boot if the clocks are turned off. Until proper DT support |
@@ -66,17 +60,89 @@ static void __init kirkwood_legacy_clk_init(void) | |||
66 | clk_prepare_enable(clk); | 60 | clk_prepare_enable(clk); |
67 | } | 61 | } |
68 | 62 | ||
69 | static void __init kirkwood_dt_time_init(void) | 63 | #define MV643XX_ETH_MAC_ADDR_LOW 0x0414 |
64 | #define MV643XX_ETH_MAC_ADDR_HIGH 0x0418 | ||
65 | |||
66 | static void __init kirkwood_dt_eth_fixup(void) | ||
70 | { | 67 | { |
71 | of_clk_init(NULL); | 68 | struct device_node *np; |
72 | clocksource_of_init(); | 69 | |
70 | /* | ||
71 | * The ethernet interfaces forget the MAC address assigned by u-boot | ||
72 | * if the clocks are turned off. Usually, u-boot on kirkwood boards | ||
73 | * has no DT support to properly set local-mac-address property. | ||
74 | * As a workaround, we get the MAC address from mv643xx_eth registers | ||
75 | * and update the port device node if no valid MAC address is set. | ||
76 | */ | ||
77 | for_each_compatible_node(np, NULL, "marvell,kirkwood-eth-port") { | ||
78 | struct device_node *pnp = of_get_parent(np); | ||
79 | struct clk *clk; | ||
80 | struct property *pmac; | ||
81 | void __iomem *io; | ||
82 | u8 *macaddr; | ||
83 | u32 reg; | ||
84 | |||
85 | if (!pnp) | ||
86 | continue; | ||
87 | |||
88 | /* skip disabled nodes or nodes with valid MAC address*/ | ||
89 | if (!of_device_is_available(pnp) || of_get_mac_address(np)) | ||
90 | goto eth_fixup_skip; | ||
91 | |||
92 | clk = of_clk_get(pnp, 0); | ||
93 | if (IS_ERR(clk)) | ||
94 | goto eth_fixup_skip; | ||
95 | |||
96 | io = of_iomap(pnp, 0); | ||
97 | if (!io) | ||
98 | goto eth_fixup_no_map; | ||
99 | |||
100 | /* ensure port clock is not gated to not hang CPU */ | ||
101 | clk_prepare_enable(clk); | ||
102 | |||
103 | /* store MAC address register contents in local-mac-address */ | ||
104 | pr_err(FW_INFO "%s: local-mac-address is not set\n", | ||
105 | np->full_name); | ||
106 | |||
107 | pmac = kzalloc(sizeof(*pmac) + 6, GFP_KERNEL); | ||
108 | if (!pmac) | ||
109 | goto eth_fixup_no_mem; | ||
110 | |||
111 | pmac->value = pmac + 1; | ||
112 | pmac->length = 6; | ||
113 | pmac->name = kstrdup("local-mac-address", GFP_KERNEL); | ||
114 | if (!pmac->name) { | ||
115 | kfree(pmac); | ||
116 | goto eth_fixup_no_mem; | ||
117 | } | ||
118 | |||
119 | macaddr = pmac->value; | ||
120 | reg = readl(io + MV643XX_ETH_MAC_ADDR_HIGH); | ||
121 | macaddr[0] = (reg >> 24) & 0xff; | ||
122 | macaddr[1] = (reg >> 16) & 0xff; | ||
123 | macaddr[2] = (reg >> 8) & 0xff; | ||
124 | macaddr[3] = reg & 0xff; | ||
125 | |||
126 | reg = readl(io + MV643XX_ETH_MAC_ADDR_LOW); | ||
127 | macaddr[4] = (reg >> 8) & 0xff; | ||
128 | macaddr[5] = reg & 0xff; | ||
129 | |||
130 | of_update_property(np, pmac); | ||
131 | |||
132 | eth_fixup_no_mem: | ||
133 | iounmap(io); | ||
134 | clk_disable_unprepare(clk); | ||
135 | eth_fixup_no_map: | ||
136 | clk_put(clk); | ||
137 | eth_fixup_skip: | ||
138 | of_node_put(pnp); | ||
139 | } | ||
73 | } | 140 | } |
74 | 141 | ||
75 | static void __init kirkwood_dt_init_early(void) | 142 | static void __init kirkwood_dt_time_init(void) |
76 | { | 143 | { |
77 | mvebu_mbus_init("marvell,kirkwood-mbus", | 144 | of_clk_init(NULL); |
78 | BRIDGE_WINS_BASE, BRIDGE_WINS_SZ, | 145 | clocksource_of_init(); |
79 | DDR_WINDOW_CPU_BASE, DDR_WINDOW_CPU_SZ); | ||
80 | } | 146 | } |
81 | 147 | ||
82 | static void __init kirkwood_dt_init(void) | 148 | static void __init kirkwood_dt_init(void) |
@@ -97,11 +163,12 @@ static void __init kirkwood_dt_init(void) | |||
97 | kirkwood_l2_init(); | 163 | kirkwood_l2_init(); |
98 | 164 | ||
99 | kirkwood_cpufreq_init(); | 165 | kirkwood_cpufreq_init(); |
100 | 166 | kirkwood_cpuidle_init(); | |
101 | /* Setup clocks for legacy devices */ | 167 | /* Setup clocks for legacy devices */ |
102 | kirkwood_legacy_clk_init(); | 168 | kirkwood_legacy_clk_init(); |
103 | 169 | ||
104 | kirkwood_cpuidle_init(); | 170 | kirkwood_pm_init(); |
171 | kirkwood_dt_eth_fixup(); | ||
105 | 172 | ||
106 | #ifdef CONFIG_KEXEC | 173 | #ifdef CONFIG_KEXEC |
107 | kexec_reinit = kirkwood_enable_pcie; | 174 | kexec_reinit = kirkwood_enable_pcie; |
@@ -121,7 +188,6 @@ static const char * const kirkwood_dt_board_compat[] = { | |||
121 | DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)") | 188 | DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)") |
122 | /* Maintainer: Jason Cooper <jason@lakedaemon.net> */ | 189 | /* Maintainer: Jason Cooper <jason@lakedaemon.net> */ |
123 | .map_io = kirkwood_map_io, | 190 | .map_io = kirkwood_map_io, |
124 | .init_early = kirkwood_dt_init_early, | ||
125 | .init_time = kirkwood_dt_time_init, | 191 | .init_time = kirkwood_dt_time_init, |
126 | .init_machine = kirkwood_dt_init, | 192 | .init_machine = kirkwood_dt_init, |
127 | .restart = kirkwood_restart, | 193 | .restart = kirkwood_restart, |
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c index 176761134a66..f3407a5db216 100644 --- a/arch/arm/mach-kirkwood/common.c +++ b/arch/arm/mach-kirkwood/common.c | |||
@@ -721,6 +721,7 @@ void __init kirkwood_init(void) | |||
721 | kirkwood_xor1_init(); | 721 | kirkwood_xor1_init(); |
722 | kirkwood_crypto_init(); | 722 | kirkwood_crypto_init(); |
723 | 723 | ||
724 | kirkwood_pm_init(); | ||
724 | kirkwood_cpuidle_init(); | 725 | kirkwood_cpuidle_init(); |
725 | #ifdef CONFIG_KEXEC | 726 | #ifdef CONFIG_KEXEC |
726 | kexec_reinit = kirkwood_enable_pcie; | 727 | kexec_reinit = kirkwood_enable_pcie; |
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h index 1296de94febf..05fd648df543 100644 --- a/arch/arm/mach-kirkwood/common.h +++ b/arch/arm/mach-kirkwood/common.h | |||
@@ -58,6 +58,12 @@ void kirkwood_cpufreq_init(void); | |||
58 | void kirkwood_restart(enum reboot_mode, const char *); | 58 | void kirkwood_restart(enum reboot_mode, const char *); |
59 | void kirkwood_clk_init(void); | 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 | /* board init functions for boards not fully converted to fdt */ | 67 | /* board init functions for boards not fully converted to fdt */ |
62 | #ifdef CONFIG_MACH_MV88F6281GTW_GE_DT | 68 | #ifdef CONFIG_MACH_MV88F6281GTW_GE_DT |
63 | void mv88f6281gtw_ge_init(void); | 69 | void mv88f6281gtw_ge_init(void); |
diff --git a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h index 91242c944d7a..8b9d1c9ff199 100644 --- a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h +++ b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h | |||
@@ -78,4 +78,6 @@ | |||
78 | #define CGC_TDM (1 << 20) | 78 | #define CGC_TDM (1 << 20) |
79 | #define CGC_RESERVED (0x6 << 21) | 79 | #define CGC_RESERVED (0x6 << 21) |
80 | 80 | ||
81 | #define MEMORY_PM_CTRL (BRIDGE_VIRT_BASE + 0x118) | ||
82 | |||
81 | #endif | 83 | #endif |
diff --git a/arch/arm/mach-kirkwood/pm.c b/arch/arm/mach-kirkwood/pm.c new file mode 100644 index 000000000000..8783a7184e73 --- /dev/null +++ b/arch/arm/mach-kirkwood/pm.c | |||
@@ -0,0 +1,73 @@ | |||
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 | } | ||