diff options
author | Olof Johansson <olof@lixom.net> | 2013-01-08 00:09:17 -0500 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2013-01-08 00:11:12 -0500 |
commit | 5cf87a12cac05460666faa22711b655a327b2219 (patch) | |
tree | 123819235d0a5b6591ae79fe38fdb349dbd9ffcb | |
parent | 0e3a4a2eb67acdd710a833b767c20e9189cc3458 (diff) | |
parent | ba607b6238a1f418c45b9d7f73212bcc6922da53 (diff) |
Merge tag 'mvebu_fixes_for_v3.8' of git://git.infradead.org/users/jcooper/linux into fixes
From Jason Cooper:
fixes for mvebu/kirkwood v3.8
- use correct uart driver for mvebu boards
- add a missing DT clocks
- gpio-poweroff level vs. edge triggering, use gpio_is_valid()
- remove an inappropriate __init, modules need to access function.
- various DT fixes
- error handling in mv_xor
* tag 'mvebu_fixes_for_v3.8' of git://git.infradead.org/users/jcooper/linux:
pinctrl: mvebu: make pdma clock on dove mandatory
ARM: Dove: Add pinctrl clock to DT
dma: mv_xor: fix error handling for clocks
dma: mv_xor: fix error handling of mv_xor_channel_add()
arm: mvebu: Add missing ; for cpu node.
arm: mvebu: Armada XP MV78230 has only three Ethernet interfaces
arm: mvebu: Armada XP MV78230 has two cores, not one
clk: mvebu: Remove inappropriate __init tagging
ARM: Kirkwood: Use fixed-regulator instead of board gpio call
ARM: Kirkwood: Fix missing sdio clock
ARM: Kirkwood: Switch TWSI1 of 88f6282 to DT clock providers
Power: gpio-poweroff: Fix documentation and gpio_is_valid
ARM: Kirkwood: Fix missing clk for USB device.
arm: mvebu: Use dw-apb-uart instead of ns16650 as UART driver
Signed-off-by: Olof Johansson <olof@lixom.net>
-rw-r--r-- | Documentation/devicetree/bindings/gpio/gpio-poweroff.txt | 20 | ||||
-rw-r--r-- | arch/arm/boot/dts/armada-370-xp.dtsi | 6 | ||||
-rw-r--r-- | arch/arm/boot/dts/armada-xp-mv78230.dtsi | 9 | ||||
-rw-r--r-- | arch/arm/boot/dts/armada-xp-mv78260.dtsi | 8 | ||||
-rw-r--r-- | arch/arm/boot/dts/armada-xp-mv78460.dtsi | 8 | ||||
-rw-r--r-- | arch/arm/boot/dts/armada-xp.dtsi | 14 | ||||
-rw-r--r-- | arch/arm/boot/dts/dove.dtsi | 1 | ||||
-rw-r--r-- | arch/arm/boot/dts/kirkwood-6282.dtsi | 1 | ||||
-rw-r--r-- | arch/arm/boot/dts/kirkwood-topkick.dts | 17 | ||||
-rw-r--r-- | arch/arm/boot/dts/kirkwood.dtsi | 1 | ||||
-rw-r--r-- | arch/arm/configs/mvebu_defconfig | 4 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/board-dt.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-kirkwood/board-usi_topkick.c | 4 | ||||
-rw-r--r-- | drivers/clk/mvebu/clk-gating-ctrl.c | 2 | ||||
-rw-r--r-- | drivers/dma/mv_xor.c | 9 | ||||
-rw-r--r-- | drivers/pinctrl/mvebu/pinctrl-dove.c | 7 | ||||
-rw-r--r-- | drivers/power/reset/gpio-poweroff.c | 33 |
17 files changed, 101 insertions, 47 deletions
diff --git a/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt b/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt index 558cdf3c9ab..d4eab9227ea 100644 --- a/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt +++ b/Documentation/devicetree/bindings/gpio/gpio-poweroff.txt | |||
@@ -1,4 +1,19 @@ | |||
1 | GPIO line that should be set high/low to power off a device | 1 | Driver a GPIO line that can be used to turn the power off. |
2 | |||
3 | The driver supports both level triggered and edge triggered power off. | ||
4 | At driver load time, the driver will request the given gpio line and | ||
5 | install a pm_power_off handler. If the optional properties 'input' is | ||
6 | not found, the GPIO line will be driven in the inactive | ||
7 | state. Otherwise its configured as an input. | ||
8 | |||
9 | When the pm_power_off is called, the gpio is configured as an output, | ||
10 | and drive active, so triggering a level triggered power off | ||
11 | condition. This will also cause an inactive->active edge condition, so | ||
12 | triggering positive edge triggered power off. After a delay of 100ms, | ||
13 | the GPIO is set to inactive, thus causing an active->inactive edge, | ||
14 | triggering negative edge triggered power off. After another 100ms | ||
15 | delay the GPIO is driver active again. If the power is still on and | ||
16 | the CPU still running after a 3000ms delay, a WARN_ON(1) is emitted. | ||
2 | 17 | ||
3 | Required properties: | 18 | Required properties: |
4 | - compatible : should be "gpio-poweroff". | 19 | - compatible : should be "gpio-poweroff". |
@@ -13,10 +28,9 @@ Optional properties: | |||
13 | property is not specified, the GPIO is initialized as an output in its | 28 | property is not specified, the GPIO is initialized as an output in its |
14 | inactive state. | 29 | inactive state. |
15 | 30 | ||
16 | |||
17 | Examples: | 31 | Examples: |
18 | 32 | ||
19 | gpio-poweroff { | 33 | gpio-poweroff { |
20 | compatible = "gpio-poweroff"; | 34 | compatible = "gpio-poweroff"; |
21 | gpios = <&gpio 4 0>; /* GPIO 4 Active Low */ | 35 | gpios = <&gpio 4 0>; |
22 | }; | 36 | }; |
diff --git a/arch/arm/boot/dts/armada-370-xp.dtsi b/arch/arm/boot/dts/armada-370-xp.dtsi index cf6c48a09ea..4c0abe85405 100644 --- a/arch/arm/boot/dts/armada-370-xp.dtsi +++ b/arch/arm/boot/dts/armada-370-xp.dtsi | |||
@@ -50,17 +50,19 @@ | |||
50 | ranges; | 50 | ranges; |
51 | 51 | ||
52 | serial@d0012000 { | 52 | serial@d0012000 { |
53 | compatible = "ns16550"; | 53 | compatible = "snps,dw-apb-uart"; |
54 | reg = <0xd0012000 0x100>; | 54 | reg = <0xd0012000 0x100>; |
55 | reg-shift = <2>; | 55 | reg-shift = <2>; |
56 | interrupts = <41>; | 56 | interrupts = <41>; |
57 | reg-io-width = <4>; | ||
57 | status = "disabled"; | 58 | status = "disabled"; |
58 | }; | 59 | }; |
59 | serial@d0012100 { | 60 | serial@d0012100 { |
60 | compatible = "ns16550"; | 61 | compatible = "snps,dw-apb-uart"; |
61 | reg = <0xd0012100 0x100>; | 62 | reg = <0xd0012100 0x100>; |
62 | reg-shift = <2>; | 63 | reg-shift = <2>; |
63 | interrupts = <42>; | 64 | interrupts = <42>; |
65 | reg-io-width = <4>; | ||
64 | status = "disabled"; | 66 | status = "disabled"; |
65 | }; | 67 | }; |
66 | 68 | ||
diff --git a/arch/arm/boot/dts/armada-xp-mv78230.dtsi b/arch/arm/boot/dts/armada-xp-mv78230.dtsi index c45c7b4dc35..271855a6e22 100644 --- a/arch/arm/boot/dts/armada-xp-mv78230.dtsi +++ b/arch/arm/boot/dts/armada-xp-mv78230.dtsi | |||
@@ -34,7 +34,14 @@ | |||
34 | reg = <0>; | 34 | reg = <0>; |
35 | clocks = <&cpuclk 0>; | 35 | clocks = <&cpuclk 0>; |
36 | }; | 36 | }; |
37 | } | 37 | |
38 | cpu@1 { | ||
39 | device_type = "cpu"; | ||
40 | compatible = "marvell,sheeva-v7"; | ||
41 | reg = <1>; | ||
42 | clocks = <&cpuclk 1>; | ||
43 | }; | ||
44 | }; | ||
38 | 45 | ||
39 | soc { | 46 | soc { |
40 | pinctrl { | 47 | pinctrl { |
diff --git a/arch/arm/boot/dts/armada-xp-mv78260.dtsi b/arch/arm/boot/dts/armada-xp-mv78260.dtsi index a2aee570737..1c1937dbce7 100644 --- a/arch/arm/boot/dts/armada-xp-mv78260.dtsi +++ b/arch/arm/boot/dts/armada-xp-mv78260.dtsi | |||
@@ -85,5 +85,13 @@ | |||
85 | #interrupts-cells = <2>; | 85 | #interrupts-cells = <2>; |
86 | interrupts = <24>; | 86 | interrupts = <24>; |
87 | }; | 87 | }; |
88 | |||
89 | ethernet@d0034000 { | ||
90 | compatible = "marvell,armada-370-neta"; | ||
91 | reg = <0xd0034000 0x2500>; | ||
92 | interrupts = <14>; | ||
93 | clocks = <&gateclk 1>; | ||
94 | status = "disabled"; | ||
95 | }; | ||
88 | }; | 96 | }; |
89 | }; | 97 | }; |
diff --git a/arch/arm/boot/dts/armada-xp-mv78460.dtsi b/arch/arm/boot/dts/armada-xp-mv78460.dtsi index da03a129243..4905cf3a5ef 100644 --- a/arch/arm/boot/dts/armada-xp-mv78460.dtsi +++ b/arch/arm/boot/dts/armada-xp-mv78460.dtsi | |||
@@ -100,5 +100,13 @@ | |||
100 | #interrupts-cells = <2>; | 100 | #interrupts-cells = <2>; |
101 | interrupts = <24>; | 101 | interrupts = <24>; |
102 | }; | 102 | }; |
103 | |||
104 | ethernet@d0034000 { | ||
105 | compatible = "marvell,armada-370-neta"; | ||
106 | reg = <0xd0034000 0x2500>; | ||
107 | interrupts = <14>; | ||
108 | clocks = <&gateclk 1>; | ||
109 | status = "disabled"; | ||
110 | }; | ||
103 | }; | 111 | }; |
104 | }; | 112 | }; |
diff --git a/arch/arm/boot/dts/armada-xp.dtsi b/arch/arm/boot/dts/armada-xp.dtsi index 367aa3f9491..2e37ef101c9 100644 --- a/arch/arm/boot/dts/armada-xp.dtsi +++ b/arch/arm/boot/dts/armada-xp.dtsi | |||
@@ -42,17 +42,19 @@ | |||
42 | 42 | ||
43 | soc { | 43 | soc { |
44 | serial@d0012200 { | 44 | serial@d0012200 { |
45 | compatible = "ns16550"; | 45 | compatible = "snps,dw-apb-uart"; |
46 | reg = <0xd0012200 0x100>; | 46 | reg = <0xd0012200 0x100>; |
47 | reg-shift = <2>; | 47 | reg-shift = <2>; |
48 | interrupts = <43>; | 48 | interrupts = <43>; |
49 | reg-io-width = <4>; | ||
49 | status = "disabled"; | 50 | status = "disabled"; |
50 | }; | 51 | }; |
51 | serial@d0012300 { | 52 | serial@d0012300 { |
52 | compatible = "ns16550"; | 53 | compatible = "snps,dw-apb-uart"; |
53 | reg = <0xd0012300 0x100>; | 54 | reg = <0xd0012300 0x100>; |
54 | reg-shift = <2>; | 55 | reg-shift = <2>; |
55 | interrupts = <44>; | 56 | interrupts = <44>; |
57 | reg-io-width = <4>; | ||
56 | status = "disabled"; | 58 | status = "disabled"; |
57 | }; | 59 | }; |
58 | 60 | ||
@@ -93,14 +95,6 @@ | |||
93 | status = "disabled"; | 95 | status = "disabled"; |
94 | }; | 96 | }; |
95 | 97 | ||
96 | ethernet@d0034000 { | ||
97 | compatible = "marvell,armada-370-neta"; | ||
98 | reg = <0xd0034000 0x2500>; | ||
99 | interrupts = <14>; | ||
100 | clocks = <&gateclk 1>; | ||
101 | status = "disabled"; | ||
102 | }; | ||
103 | |||
104 | xor@d0060900 { | 98 | xor@d0060900 { |
105 | compatible = "marvell,orion-xor"; | 99 | compatible = "marvell,orion-xor"; |
106 | reg = <0xd0060900 0x100 | 100 | reg = <0xd0060900 0x100 |
diff --git a/arch/arm/boot/dts/dove.dtsi b/arch/arm/boot/dts/dove.dtsi index f3f7e9d8adc..42eac1ff3cc 100644 --- a/arch/arm/boot/dts/dove.dtsi +++ b/arch/arm/boot/dts/dove.dtsi | |||
@@ -117,6 +117,7 @@ | |||
117 | pinctrl: pinctrl@d0200 { | 117 | pinctrl: pinctrl@d0200 { |
118 | compatible = "marvell,dove-pinctrl"; | 118 | compatible = "marvell,dove-pinctrl"; |
119 | reg = <0xd0200 0x10>; | 119 | reg = <0xd0200 0x10>; |
120 | clocks = <&gate_clk 22>; | ||
120 | }; | 121 | }; |
121 | 122 | ||
122 | spi0: spi@10600 { | 123 | spi0: spi@10600 { |
diff --git a/arch/arm/boot/dts/kirkwood-6282.dtsi b/arch/arm/boot/dts/kirkwood-6282.dtsi index 9ae2004d567..4ccea2130a6 100644 --- a/arch/arm/boot/dts/kirkwood-6282.dtsi +++ b/arch/arm/boot/dts/kirkwood-6282.dtsi | |||
@@ -39,6 +39,7 @@ | |||
39 | #size-cells = <0>; | 39 | #size-cells = <0>; |
40 | interrupts = <32>; | 40 | interrupts = <32>; |
41 | clock-frequency = <100000>; | 41 | clock-frequency = <100000>; |
42 | clocks = <&gate_clk 7>; | ||
42 | status = "disabled"; | 43 | status = "disabled"; |
43 | }; | 44 | }; |
44 | }; | 45 | }; |
diff --git a/arch/arm/boot/dts/kirkwood-topkick.dts b/arch/arm/boot/dts/kirkwood-topkick.dts index c0de5a7f660..cd15452a52a 100644 --- a/arch/arm/boot/dts/kirkwood-topkick.dts +++ b/arch/arm/boot/dts/kirkwood-topkick.dts | |||
@@ -82,4 +82,21 @@ | |||
82 | gpios = <&gpio1 16 1>; | 82 | gpios = <&gpio1 16 1>; |
83 | }; | 83 | }; |
84 | }; | 84 | }; |
85 | regulators { | ||
86 | compatible = "simple-bus"; | ||
87 | #address-cells = <1>; | ||
88 | #size-cells = <0>; | ||
89 | |||
90 | sata0_power: regulator@1 { | ||
91 | compatible = "regulator-fixed"; | ||
92 | reg = <1>; | ||
93 | regulator-name = "SATA0 Power"; | ||
94 | regulator-min-microvolt = <5000000>; | ||
95 | regulator-max-microvolt = <5000000>; | ||
96 | enable-active-high; | ||
97 | regulator-always-on; | ||
98 | regulator-boot-on; | ||
99 | gpio = <&gpio1 4 0>; | ||
100 | }; | ||
101 | }; | ||
85 | }; | 102 | }; |
diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi index 7735cee4a9c..110d6cbb795 100644 --- a/arch/arm/boot/dts/kirkwood.dtsi +++ b/arch/arm/boot/dts/kirkwood.dtsi | |||
@@ -144,6 +144,7 @@ | |||
144 | compatible = "marvell,orion-ehci"; | 144 | compatible = "marvell,orion-ehci"; |
145 | reg = <0x50000 0x1000>; | 145 | reg = <0x50000 0x1000>; |
146 | interrupts = <19>; | 146 | interrupts = <19>; |
147 | clocks = <&gate_clk 3>; | ||
147 | status = "okay"; | 148 | status = "okay"; |
148 | }; | 149 | }; |
149 | 150 | ||
diff --git a/arch/arm/configs/mvebu_defconfig b/arch/arm/configs/mvebu_defconfig index a702fb345c0..b5bc96cb65a 100644 --- a/arch/arm/configs/mvebu_defconfig +++ b/arch/arm/configs/mvebu_defconfig | |||
@@ -33,9 +33,7 @@ CONFIG_MVNETA=y | |||
33 | CONFIG_MARVELL_PHY=y | 33 | CONFIG_MARVELL_PHY=y |
34 | CONFIG_SERIAL_8250=y | 34 | CONFIG_SERIAL_8250=y |
35 | CONFIG_SERIAL_8250_CONSOLE=y | 35 | CONFIG_SERIAL_8250_CONSOLE=y |
36 | CONFIG_SERIAL_OF_PLATFORM=y | 36 | CONFIG_SERIAL_8250_DW=y |
37 | CONFIG_I2C=y | ||
38 | CONFIG_I2C_MV64XXX=y | ||
39 | CONFIG_GPIOLIB=y | 37 | CONFIG_GPIOLIB=y |
40 | CONFIG_GPIO_SYSFS=y | 38 | CONFIG_GPIO_SYSFS=y |
41 | # CONFIG_USB_SUPPORT is not set | 39 | # CONFIG_USB_SUPPORT is not set |
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c index ff4150a2ad0..de4fd2bb1e2 100644 --- a/arch/arm/mach-kirkwood/board-dt.c +++ b/arch/arm/mach-kirkwood/board-dt.c | |||
@@ -67,6 +67,10 @@ static void __init kirkwood_legacy_clk_init(void) | |||
67 | orion_clkdev_add(NULL, "mv643xx_eth_port.1", | 67 | orion_clkdev_add(NULL, "mv643xx_eth_port.1", |
68 | of_clk_get_from_provider(&clkspec)); | 68 | of_clk_get_from_provider(&clkspec)); |
69 | 69 | ||
70 | clkspec.args[0] = CGC_BIT_SDIO; | ||
71 | orion_clkdev_add(NULL, "mvsdio", | ||
72 | of_clk_get_from_provider(&clkspec)); | ||
73 | |||
70 | } | 74 | } |
71 | 75 | ||
72 | static void __init kirkwood_of_clk_init(void) | 76 | static void __init kirkwood_of_clk_init(void) |
diff --git a/arch/arm/mach-kirkwood/board-usi_topkick.c b/arch/arm/mach-kirkwood/board-usi_topkick.c index 15e69fcde9f..23d2dd1b1b1 100644 --- a/arch/arm/mach-kirkwood/board-usi_topkick.c +++ b/arch/arm/mach-kirkwood/board-usi_topkick.c | |||
@@ -64,8 +64,6 @@ static unsigned int topkick_mpp_config[] __initdata = { | |||
64 | 0 | 64 | 0 |
65 | }; | 65 | }; |
66 | 66 | ||
67 | #define TOPKICK_SATA0_PWR_ENABLE 36 | ||
68 | |||
69 | void __init usi_topkick_init(void) | 67 | void __init usi_topkick_init(void) |
70 | { | 68 | { |
71 | /* | 69 | /* |
@@ -73,8 +71,6 @@ void __init usi_topkick_init(void) | |||
73 | */ | 71 | */ |
74 | kirkwood_mpp_conf(topkick_mpp_config); | 72 | kirkwood_mpp_conf(topkick_mpp_config); |
75 | 73 | ||
76 | /* SATA0 power enable */ | ||
77 | gpio_set_value(TOPKICK_SATA0_PWR_ENABLE, 1); | ||
78 | 74 | ||
79 | kirkwood_ge00_init(&topkick_ge00_data); | 75 | kirkwood_ge00_init(&topkick_ge00_data); |
80 | kirkwood_sdio_init(&topkick_mvsdio_data); | 76 | kirkwood_sdio_init(&topkick_mvsdio_data); |
diff --git a/drivers/clk/mvebu/clk-gating-ctrl.c b/drivers/clk/mvebu/clk-gating-ctrl.c index c6d3c263b07..8fa5408b6c7 100644 --- a/drivers/clk/mvebu/clk-gating-ctrl.c +++ b/drivers/clk/mvebu/clk-gating-ctrl.c | |||
@@ -32,7 +32,7 @@ struct mvebu_soc_descr { | |||
32 | 32 | ||
33 | #define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw) | 33 | #define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw) |
34 | 34 | ||
35 | static struct clk __init *mvebu_clk_gating_get_src( | 35 | static struct clk *mvebu_clk_gating_get_src( |
36 | struct of_phandle_args *clkspec, void *data) | 36 | struct of_phandle_args *clkspec, void *data) |
37 | { | 37 | { |
38 | struct mvebu_gating_ctrl *ctrl = (struct mvebu_gating_ctrl *)data; | 38 | struct mvebu_gating_ctrl *ctrl = (struct mvebu_gating_ctrl *)data; |
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c index ac71f555dd7..e17fad03cb8 100644 --- a/drivers/dma/mv_xor.c +++ b/drivers/dma/mv_xor.c | |||
@@ -1361,13 +1361,16 @@ static int mv_xor_probe(struct platform_device *pdev) | |||
1361 | err_channel_add: | 1361 | err_channel_add: |
1362 | for (i = 0; i < MV_XOR_MAX_CHANNELS; i++) | 1362 | for (i = 0; i < MV_XOR_MAX_CHANNELS; i++) |
1363 | if (xordev->channels[i]) { | 1363 | if (xordev->channels[i]) { |
1364 | mv_xor_channel_remove(xordev->channels[i]); | ||
1364 | if (pdev->dev.of_node) | 1365 | if (pdev->dev.of_node) |
1365 | irq_dispose_mapping(xordev->channels[i]->irq); | 1366 | irq_dispose_mapping(xordev->channels[i]->irq); |
1366 | mv_xor_channel_remove(xordev->channels[i]); | ||
1367 | } | 1367 | } |
1368 | 1368 | ||
1369 | clk_disable_unprepare(xordev->clk); | 1369 | if (!IS_ERR(xordev->clk)) { |
1370 | clk_put(xordev->clk); | 1370 | clk_disable_unprepare(xordev->clk); |
1371 | clk_put(xordev->clk); | ||
1372 | } | ||
1373 | |||
1371 | return ret; | 1374 | return ret; |
1372 | } | 1375 | } |
1373 | 1376 | ||
diff --git a/drivers/pinctrl/mvebu/pinctrl-dove.c b/drivers/pinctrl/mvebu/pinctrl-dove.c index 40c9c3eecd9..9cc219f6100 100644 --- a/drivers/pinctrl/mvebu/pinctrl-dove.c +++ b/drivers/pinctrl/mvebu/pinctrl-dove.c | |||
@@ -595,8 +595,11 @@ static int __devinit dove_pinctrl_probe(struct platform_device *pdev) | |||
595 | * grab clk to make sure it is ticking. | 595 | * grab clk to make sure it is ticking. |
596 | */ | 596 | */ |
597 | clk = devm_clk_get(&pdev->dev, NULL); | 597 | clk = devm_clk_get(&pdev->dev, NULL); |
598 | if (!IS_ERR(clk)) | 598 | if (IS_ERR(clk)) { |
599 | clk_prepare_enable(clk); | 599 | dev_err(&pdev->dev, "Unable to get pdma clock"); |
600 | return PTR_RET(clk); | ||
601 | } | ||
602 | clk_prepare_enable(clk); | ||
600 | 603 | ||
601 | return mvebu_pinctrl_probe(pdev); | 604 | return mvebu_pinctrl_probe(pdev); |
602 | } | 605 | } |
diff --git a/drivers/power/reset/gpio-poweroff.c b/drivers/power/reset/gpio-poweroff.c index 0491e5335d0..adc943b3fc3 100644 --- a/drivers/power/reset/gpio-poweroff.c +++ b/drivers/power/reset/gpio-poweroff.c | |||
@@ -29,15 +29,16 @@ static int gpio_active_low; | |||
29 | 29 | ||
30 | static void gpio_poweroff_do_poweroff(void) | 30 | static void gpio_poweroff_do_poweroff(void) |
31 | { | 31 | { |
32 | BUG_ON(gpio_num == -1); | 32 | BUG_ON(!gpio_is_valid(gpio_num)); |
33 | 33 | ||
34 | /* drive it active */ | 34 | /* drive it active, also inactive->active edge */ |
35 | gpio_direction_output(gpio_num, !gpio_active_low); | 35 | gpio_direction_output(gpio_num, !gpio_active_low); |
36 | mdelay(100); | 36 | mdelay(100); |
37 | /* rising edge or drive inactive */ | 37 | /* drive inactive, also active->inactive edge */ |
38 | gpio_set_value(gpio_num, gpio_active_low); | 38 | gpio_set_value(gpio_num, gpio_active_low); |
39 | mdelay(100); | 39 | mdelay(100); |
40 | /* falling edge */ | 40 | |
41 | /* drive it active, also inactive->active edge */ | ||
41 | gpio_set_value(gpio_num, !gpio_active_low); | 42 | gpio_set_value(gpio_num, !gpio_active_low); |
42 | 43 | ||
43 | /* give it some time */ | 44 | /* give it some time */ |
@@ -60,15 +61,12 @@ static int __devinit gpio_poweroff_probe(struct platform_device *pdev) | |||
60 | } | 61 | } |
61 | 62 | ||
62 | gpio_num = of_get_gpio_flags(pdev->dev.of_node, 0, &flags); | 63 | gpio_num = of_get_gpio_flags(pdev->dev.of_node, 0, &flags); |
63 | if (gpio_num < 0) { | 64 | if (!gpio_is_valid(gpio_num)) |
64 | pr_err("%s: Could not get GPIO configuration: %d", | 65 | return gpio_num; |
65 | __func__, gpio_num); | 66 | |
66 | return -ENODEV; | ||
67 | } | ||
68 | gpio_active_low = flags & OF_GPIO_ACTIVE_LOW; | 67 | gpio_active_low = flags & OF_GPIO_ACTIVE_LOW; |
69 | 68 | ||
70 | if (of_get_property(pdev->dev.of_node, "input", NULL)) | 69 | input = of_property_read_bool(pdev->dev.of_node, "input"); |
71 | input = true; | ||
72 | 70 | ||
73 | ret = gpio_request(gpio_num, "poweroff-gpio"); | 71 | ret = gpio_request(gpio_num, "poweroff-gpio"); |
74 | if (ret) { | 72 | if (ret) { |
@@ -98,8 +96,7 @@ err: | |||
98 | 96 | ||
99 | static int __devexit gpio_poweroff_remove(struct platform_device *pdev) | 97 | static int __devexit gpio_poweroff_remove(struct platform_device *pdev) |
100 | { | 98 | { |
101 | if (gpio_num != -1) | 99 | gpio_free(gpio_num); |
102 | gpio_free(gpio_num); | ||
103 | if (pm_power_off == &gpio_poweroff_do_poweroff) | 100 | if (pm_power_off == &gpio_poweroff_do_poweroff) |
104 | pm_power_off = NULL; | 101 | pm_power_off = NULL; |
105 | 102 | ||
@@ -115,15 +112,15 @@ static struct platform_driver gpio_poweroff_driver = { | |||
115 | .probe = gpio_poweroff_probe, | 112 | .probe = gpio_poweroff_probe, |
116 | .remove = __devexit_p(gpio_poweroff_remove), | 113 | .remove = __devexit_p(gpio_poweroff_remove), |
117 | .driver = { | 114 | .driver = { |
118 | .name = "poweroff-gpio", | 115 | .name = "poweroff-gpio", |
119 | .owner = THIS_MODULE, | 116 | .owner = THIS_MODULE, |
120 | .of_match_table = of_gpio_poweroff_match, | 117 | .of_match_table = of_gpio_poweroff_match, |
121 | }, | 118 | }, |
122 | }; | 119 | }; |
123 | 120 | ||
124 | module_platform_driver(gpio_poweroff_driver); | 121 | module_platform_driver(gpio_poweroff_driver); |
125 | 122 | ||
126 | MODULE_AUTHOR("Jamie Lentin <jm@lentin.co.uk>"); | 123 | MODULE_AUTHOR("Jamie Lentin <jm@lentin.co.uk>"); |
127 | MODULE_DESCRIPTION("GPIO poweroff driver"); | 124 | MODULE_DESCRIPTION("GPIO poweroff driver"); |
128 | MODULE_LICENSE("GPL"); | 125 | MODULE_LICENSE("GPL v2"); |
129 | MODULE_ALIAS("platform:poweroff-gpio"); | 126 | MODULE_ALIAS("platform:poweroff-gpio"); |