diff options
author | Olof Johansson <olof@lixom.net> | 2015-10-25 20:58:26 -0400 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2015-10-25 20:58:26 -0400 |
commit | a5ac4a66c6d897720bc6e8f332650630b1ff38ee (patch) | |
tree | dc69974113c3fb026779dc57e956fa7cc5e832fb | |
parent | c2c2b3d35706e4d4b481757a4cb6a2462f847db5 (diff) | |
parent | 9d2ea95a599a80b08cc802f044626ea2701aade9 (diff) |
Merge tag 'mvebu-soc-4.4-2' of git://git.infradead.org/linux-mvebu into next/soc
mvebu soc for 4.4 (part 2)
- Use mac_pton() helper in the oropn5x board instead of duplicating it
- Add the broken-idle option allowing to boot boards with a mistake in
the hardware design
* tag 'mvebu-soc-4.4-2' of git://git.infradead.org/linux-mvebu:
ARM: mvebu: add broken-idle option
ARM: orion5x: use mac_pton() helper
Signed-off-by: Olof Johansson <olof@lixom.net>
-rw-r--r-- | Documentation/devicetree/bindings/arm/coherency-fabric.txt | 5 | ||||
-rw-r--r-- | arch/arm/mach-mvebu/pmsu.c | 29 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/Kconfig | 3 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/dns323-setup.c | 53 | ||||
-rw-r--r-- | arch/arm/mach-orion5x/tsx09-common.c | 49 |
5 files changed, 41 insertions, 98 deletions
diff --git a/Documentation/devicetree/bindings/arm/coherency-fabric.txt b/Documentation/devicetree/bindings/arm/coherency-fabric.txt index 8dd46617c889..9b5c3f620e65 100644 --- a/Documentation/devicetree/bindings/arm/coherency-fabric.txt +++ b/Documentation/devicetree/bindings/arm/coherency-fabric.txt | |||
@@ -27,6 +27,11 @@ Required properties: | |||
27 | * For "marvell,armada-380-coherency-fabric", only one pair is needed | 27 | * For "marvell,armada-380-coherency-fabric", only one pair is needed |
28 | for the per-CPU fabric registers. | 28 | for the per-CPU fabric registers. |
29 | 29 | ||
30 | Optional properties: | ||
31 | |||
32 | - broken-idle: boolean to set when the Idle mode is not supported by the | ||
33 | hardware. | ||
34 | |||
30 | Examples: | 35 | Examples: |
31 | 36 | ||
32 | coherency-fabric@d0020200 { | 37 | coherency-fabric@d0020200 { |
diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c index e8fdb9ceedf0..867ec3385eb5 100644 --- a/arch/arm/mach-mvebu/pmsu.c +++ b/arch/arm/mach-mvebu/pmsu.c | |||
@@ -379,6 +379,16 @@ static struct notifier_block mvebu_v7_cpu_pm_notifier = { | |||
379 | 379 | ||
380 | static struct platform_device mvebu_v7_cpuidle_device; | 380 | static struct platform_device mvebu_v7_cpuidle_device; |
381 | 381 | ||
382 | static int broken_idle(struct device_node *np) | ||
383 | { | ||
384 | if (of_property_read_bool(np, "broken-idle")) { | ||
385 | pr_warn("CPU idle is currently broken: disabling\n"); | ||
386 | return 1; | ||
387 | } | ||
388 | |||
389 | return 0; | ||
390 | } | ||
391 | |||
382 | static __init int armada_370_cpuidle_init(void) | 392 | static __init int armada_370_cpuidle_init(void) |
383 | { | 393 | { |
384 | struct device_node *np; | 394 | struct device_node *np; |
@@ -387,7 +397,9 @@ static __init int armada_370_cpuidle_init(void) | |||
387 | np = of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric"); | 397 | np = of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric"); |
388 | if (!np) | 398 | if (!np) |
389 | return -ENODEV; | 399 | return -ENODEV; |
390 | of_node_put(np); | 400 | |
401 | if (broken_idle(np)) | ||
402 | goto end; | ||
391 | 403 | ||
392 | /* | 404 | /* |
393 | * On Armada 370, there is "a slow exit process from the deep | 405 | * On Armada 370, there is "a slow exit process from the deep |
@@ -406,6 +418,8 @@ static __init int armada_370_cpuidle_init(void) | |||
406 | mvebu_v7_cpuidle_device.dev.platform_data = armada_370_xp_cpu_suspend; | 418 | mvebu_v7_cpuidle_device.dev.platform_data = armada_370_xp_cpu_suspend; |
407 | mvebu_v7_cpuidle_device.name = "cpuidle-armada-370"; | 419 | mvebu_v7_cpuidle_device.name = "cpuidle-armada-370"; |
408 | 420 | ||
421 | end: | ||
422 | of_node_put(np); | ||
409 | return 0; | 423 | return 0; |
410 | } | 424 | } |
411 | 425 | ||
@@ -422,6 +436,10 @@ static __init int armada_38x_cpuidle_init(void) | |||
422 | "marvell,armada-380-coherency-fabric"); | 436 | "marvell,armada-380-coherency-fabric"); |
423 | if (!np) | 437 | if (!np) |
424 | return -ENODEV; | 438 | return -ENODEV; |
439 | |||
440 | if (broken_idle(np)) | ||
441 | goto end; | ||
442 | |||
425 | of_node_put(np); | 443 | of_node_put(np); |
426 | 444 | ||
427 | np = of_find_compatible_node(NULL, NULL, | 445 | np = of_find_compatible_node(NULL, NULL, |
@@ -430,7 +448,6 @@ static __init int armada_38x_cpuidle_init(void) | |||
430 | return -ENODEV; | 448 | return -ENODEV; |
431 | mpsoc_base = of_iomap(np, 0); | 449 | mpsoc_base = of_iomap(np, 0); |
432 | BUG_ON(!mpsoc_base); | 450 | BUG_ON(!mpsoc_base); |
433 | of_node_put(np); | ||
434 | 451 | ||
435 | /* Set up reset mask when powering down the cpus */ | 452 | /* Set up reset mask when powering down the cpus */ |
436 | reg = readl(mpsoc_base + MPCORE_RESET_CTL); | 453 | reg = readl(mpsoc_base + MPCORE_RESET_CTL); |
@@ -450,6 +467,8 @@ static __init int armada_38x_cpuidle_init(void) | |||
450 | mvebu_v7_cpuidle_device.dev.platform_data = armada_38x_cpu_suspend; | 467 | mvebu_v7_cpuidle_device.dev.platform_data = armada_38x_cpu_suspend; |
451 | mvebu_v7_cpuidle_device.name = "cpuidle-armada-38x"; | 468 | mvebu_v7_cpuidle_device.name = "cpuidle-armada-38x"; |
452 | 469 | ||
470 | end: | ||
471 | of_node_put(np); | ||
453 | return 0; | 472 | return 0; |
454 | } | 473 | } |
455 | 474 | ||
@@ -460,12 +479,16 @@ static __init int armada_xp_cpuidle_init(void) | |||
460 | np = of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric"); | 479 | np = of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric"); |
461 | if (!np) | 480 | if (!np) |
462 | return -ENODEV; | 481 | return -ENODEV; |
463 | of_node_put(np); | 482 | |
483 | if (broken_idle(np)) | ||
484 | goto end; | ||
464 | 485 | ||
465 | mvebu_cpu_resume = armada_370_xp_cpu_resume; | 486 | mvebu_cpu_resume = armada_370_xp_cpu_resume; |
466 | mvebu_v7_cpuidle_device.dev.platform_data = armada_370_xp_cpu_suspend; | 487 | mvebu_v7_cpuidle_device.dev.platform_data = armada_370_xp_cpu_suspend; |
467 | mvebu_v7_cpuidle_device.name = "cpuidle-armada-xp"; | 488 | mvebu_v7_cpuidle_device.name = "cpuidle-armada-xp"; |
468 | 489 | ||
490 | end: | ||
491 | of_node_put(np); | ||
469 | return 0; | 492 | return 0; |
470 | } | 493 | } |
471 | 494 | ||
diff --git a/arch/arm/mach-orion5x/Kconfig b/arch/arm/mach-orion5x/Kconfig index 08d2be2ea41f..66f1c952c048 100644 --- a/arch/arm/mach-orion5x/Kconfig +++ b/arch/arm/mach-orion5x/Kconfig | |||
@@ -45,6 +45,7 @@ config MACH_KUROBOX_PRO | |||
45 | 45 | ||
46 | config MACH_DNS323 | 46 | config MACH_DNS323 |
47 | bool "D-Link DNS-323" | 47 | bool "D-Link DNS-323" |
48 | select GENERIC_NET_UTILS | ||
48 | select I2C_BOARDINFO | 49 | select I2C_BOARDINFO |
49 | help | 50 | help |
50 | Say 'Y' here if you want your kernel to support the | 51 | Say 'Y' here if you want your kernel to support the |
@@ -52,6 +53,7 @@ config MACH_DNS323 | |||
52 | 53 | ||
53 | config MACH_TS209 | 54 | config MACH_TS209 |
54 | bool "QNAP TS-109/TS-209" | 55 | bool "QNAP TS-109/TS-209" |
56 | select GENERIC_NET_UTILS | ||
55 | help | 57 | help |
56 | Say 'Y' here if you want your kernel to support the | 58 | Say 'Y' here if you want your kernel to support the |
57 | QNAP TS-109/TS-209 platform. | 59 | QNAP TS-109/TS-209 platform. |
@@ -93,6 +95,7 @@ config MACH_LINKSTATION_LS_HGL | |||
93 | 95 | ||
94 | config MACH_TS409 | 96 | config MACH_TS409 |
95 | bool "QNAP TS-409" | 97 | bool "QNAP TS-409" |
98 | select GENERIC_NET_UTILS | ||
96 | help | 99 | help |
97 | Say 'Y' here if you want your kernel to support the | 100 | Say 'Y' here if you want your kernel to support the |
98 | QNAP TS-409 platform. | 101 | QNAP TS-409 platform. |
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c index f267e58a8283..bc279a853075 100644 --- a/arch/arm/mach-orion5x/dns323-setup.c +++ b/arch/arm/mach-orion5x/dns323-setup.c | |||
@@ -173,42 +173,10 @@ static struct mv643xx_eth_platform_data dns323_eth_data = { | |||
173 | .phy_addr = MV643XX_ETH_PHY_ADDR(8), | 173 | .phy_addr = MV643XX_ETH_PHY_ADDR(8), |
174 | }; | 174 | }; |
175 | 175 | ||
176 | /* dns323_parse_hex_*() taken from tsx09-common.c; should a common copy of these | ||
177 | * functions be kept somewhere? | ||
178 | */ | ||
179 | static int __init dns323_parse_hex_nibble(char n) | ||
180 | { | ||
181 | if (n >= '0' && n <= '9') | ||
182 | return n - '0'; | ||
183 | |||
184 | if (n >= 'A' && n <= 'F') | ||
185 | return n - 'A' + 10; | ||
186 | |||
187 | if (n >= 'a' && n <= 'f') | ||
188 | return n - 'a' + 10; | ||
189 | |||
190 | return -1; | ||
191 | } | ||
192 | |||
193 | static int __init dns323_parse_hex_byte(const char *b) | ||
194 | { | ||
195 | int hi; | ||
196 | int lo; | ||
197 | |||
198 | hi = dns323_parse_hex_nibble(b[0]); | ||
199 | lo = dns323_parse_hex_nibble(b[1]); | ||
200 | |||
201 | if (hi < 0 || lo < 0) | ||
202 | return -1; | ||
203 | |||
204 | return (hi << 4) | lo; | ||
205 | } | ||
206 | |||
207 | static int __init dns323_read_mac_addr(void) | 176 | static int __init dns323_read_mac_addr(void) |
208 | { | 177 | { |
209 | u_int8_t addr[6]; | 178 | u_int8_t addr[6]; |
210 | int i; | 179 | void __iomem *mac_page; |
211 | char *mac_page; | ||
212 | 180 | ||
213 | /* MAC address is stored as a regular ol' string in /dev/mtdblock4 | 181 | /* MAC address is stored as a regular ol' string in /dev/mtdblock4 |
214 | * (0x007d0000-0x00800000) starting at offset 196480 (0x2ff80). | 182 | * (0x007d0000-0x00800000) starting at offset 196480 (0x2ff80). |
@@ -217,23 +185,8 @@ static int __init dns323_read_mac_addr(void) | |||
217 | if (!mac_page) | 185 | if (!mac_page) |
218 | return -ENOMEM; | 186 | return -ENOMEM; |
219 | 187 | ||
220 | /* Sanity check the string we're looking at */ | 188 | if (!mac_pton((__force const char *) mac_page, addr)) |
221 | for (i = 0; i < 5; i++) { | 189 | goto error_fail; |
222 | if (*(mac_page + (i * 3) + 2) != ':') { | ||
223 | goto error_fail; | ||
224 | } | ||
225 | } | ||
226 | |||
227 | for (i = 0; i < 6; i++) { | ||
228 | int byte; | ||
229 | |||
230 | byte = dns323_parse_hex_byte(mac_page + (i * 3)); | ||
231 | if (byte < 0) { | ||
232 | goto error_fail; | ||
233 | } | ||
234 | |||
235 | addr[i] = byte; | ||
236 | } | ||
237 | 190 | ||
238 | iounmap(mac_page); | 191 | iounmap(mac_page); |
239 | printk("DNS-323: Found ethernet MAC address: %pM\n", addr); | 192 | printk("DNS-323: Found ethernet MAC address: %pM\n", addr); |
diff --git a/arch/arm/mach-orion5x/tsx09-common.c b/arch/arm/mach-orion5x/tsx09-common.c index 24b2959719fa..d42e006597c7 100644 --- a/arch/arm/mach-orion5x/tsx09-common.c +++ b/arch/arm/mach-orion5x/tsx09-common.c | |||
@@ -53,53 +53,12 @@ struct mv643xx_eth_platform_data qnap_tsx09_eth_data = { | |||
53 | .phy_addr = MV643XX_ETH_PHY_ADDR(8), | 53 | .phy_addr = MV643XX_ETH_PHY_ADDR(8), |
54 | }; | 54 | }; |
55 | 55 | ||
56 | static int __init qnap_tsx09_parse_hex_nibble(char n) | ||
57 | { | ||
58 | if (n >= '0' && n <= '9') | ||
59 | return n - '0'; | ||
60 | |||
61 | if (n >= 'A' && n <= 'F') | ||
62 | return n - 'A' + 10; | ||
63 | |||
64 | if (n >= 'a' && n <= 'f') | ||
65 | return n - 'a' + 10; | ||
66 | |||
67 | return -1; | ||
68 | } | ||
69 | |||
70 | static int __init qnap_tsx09_parse_hex_byte(const char *b) | ||
71 | { | ||
72 | int hi; | ||
73 | int lo; | ||
74 | |||
75 | hi = qnap_tsx09_parse_hex_nibble(b[0]); | ||
76 | lo = qnap_tsx09_parse_hex_nibble(b[1]); | ||
77 | |||
78 | if (hi < 0 || lo < 0) | ||
79 | return -1; | ||
80 | |||
81 | return (hi << 4) | lo; | ||
82 | } | ||
83 | |||
84 | static int __init qnap_tsx09_check_mac_addr(const char *addr_str) | 56 | static int __init qnap_tsx09_check_mac_addr(const char *addr_str) |
85 | { | 57 | { |
86 | u_int8_t addr[6]; | 58 | u_int8_t addr[6]; |
87 | int i; | ||
88 | 59 | ||
89 | for (i = 0; i < 6; i++) { | 60 | if (!mac_pton(addr_str, addr)) |
90 | int byte; | 61 | return -1; |
91 | |||
92 | /* | ||
93 | * Enforce "xx:xx:xx:xx:xx:xx\n" format. | ||
94 | */ | ||
95 | if (addr_str[(i * 3) + 2] != ((i < 5) ? ':' : '\n')) | ||
96 | return -1; | ||
97 | |||
98 | byte = qnap_tsx09_parse_hex_byte(addr_str + (i * 3)); | ||
99 | if (byte < 0) | ||
100 | return -1; | ||
101 | addr[i] = byte; | ||
102 | } | ||
103 | 62 | ||
104 | printk(KERN_INFO "tsx09: found ethernet mac address %pM\n", addr); | 63 | printk(KERN_INFO "tsx09: found ethernet mac address %pM\n", addr); |
105 | 64 | ||
@@ -118,12 +77,12 @@ void __init qnap_tsx09_find_mac_addr(u32 mem_base, u32 size) | |||
118 | unsigned long addr; | 77 | unsigned long addr; |
119 | 78 | ||
120 | for (addr = mem_base; addr < (mem_base + size); addr += 1024) { | 79 | for (addr = mem_base; addr < (mem_base + size); addr += 1024) { |
121 | char *nor_page; | 80 | void __iomem *nor_page; |
122 | int ret = 0; | 81 | int ret = 0; |
123 | 82 | ||
124 | nor_page = ioremap(addr, 1024); | 83 | nor_page = ioremap(addr, 1024); |
125 | if (nor_page != NULL) { | 84 | if (nor_page != NULL) { |
126 | ret = qnap_tsx09_check_mac_addr(nor_page); | 85 | ret = qnap_tsx09_check_mac_addr((__force const char *)nor_page); |
127 | iounmap(nor_page); | 86 | iounmap(nor_page); |
128 | } | 87 | } |
129 | 88 | ||