Commit 5cf87a12 authored by Olof Johansson's avatar Olof Johansson

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: default avatarOlof Johansson <olof@lixom.net>
parents 0e3a4a2e ba607b62
GPIO line that should be set high/low to power off a device Driver a GPIO line that can be used to turn the power off.
The driver supports both level triggered and edge triggered power off.
At driver load time, the driver will request the given gpio line and
install a pm_power_off handler. If the optional properties 'input' is
not found, the GPIO line will be driven in the inactive
state. Otherwise its configured as an input.
When the pm_power_off is called, the gpio is configured as an output,
and drive active, so triggering a level triggered power off
condition. This will also cause an inactive->active edge condition, so
triggering positive edge triggered power off. After a delay of 100ms,
the GPIO is set to inactive, thus causing an active->inactive edge,
triggering negative edge triggered power off. After another 100ms
delay the GPIO is driver active again. If the power is still on and
the CPU still running after a 3000ms delay, a WARN_ON(1) is emitted.
Required properties: Required properties:
- compatible : should be "gpio-poweroff". - compatible : should be "gpio-poweroff".
...@@ -13,10 +28,9 @@ Optional properties: ...@@ -13,10 +28,9 @@ Optional properties:
property is not specified, the GPIO is initialized as an output in its property is not specified, the GPIO is initialized as an output in its
inactive state. inactive state.
Examples: Examples:
gpio-poweroff { gpio-poweroff {
compatible = "gpio-poweroff"; compatible = "gpio-poweroff";
gpios = <&gpio 4 0>; /* GPIO 4 Active Low */ gpios = <&gpio 4 0>;
}; };
...@@ -50,17 +50,19 @@ soc { ...@@ -50,17 +50,19 @@ soc {
ranges; ranges;
serial@d0012000 { serial@d0012000 {
compatible = "ns16550"; compatible = "snps,dw-apb-uart";
reg = <0xd0012000 0x100>; reg = <0xd0012000 0x100>;
reg-shift = <2>; reg-shift = <2>;
interrupts = <41>; interrupts = <41>;
reg-io-width = <4>;
status = "disabled"; status = "disabled";
}; };
serial@d0012100 { serial@d0012100 {
compatible = "ns16550"; compatible = "snps,dw-apb-uart";
reg = <0xd0012100 0x100>; reg = <0xd0012100 0x100>;
reg-shift = <2>; reg-shift = <2>;
interrupts = <42>; interrupts = <42>;
reg-io-width = <4>;
status = "disabled"; status = "disabled";
}; };
......
...@@ -34,7 +34,14 @@ cpu@0 { ...@@ -34,7 +34,14 @@ cpu@0 {
reg = <0>; reg = <0>;
clocks = <&cpuclk 0>; clocks = <&cpuclk 0>;
}; };
}
cpu@1 {
device_type = "cpu";
compatible = "marvell,sheeva-v7";
reg = <1>;
clocks = <&cpuclk 1>;
};
};
soc { soc {
pinctrl { pinctrl {
......
...@@ -85,5 +85,13 @@ gpio2: gpio@d0018180 { ...@@ -85,5 +85,13 @@ gpio2: gpio@d0018180 {
#interrupts-cells = <2>; #interrupts-cells = <2>;
interrupts = <24>; interrupts = <24>;
}; };
ethernet@d0034000 {
compatible = "marvell,armada-370-neta";
reg = <0xd0034000 0x2500>;
interrupts = <14>;
clocks = <&gateclk 1>;
status = "disabled";
};
}; };
}; };
...@@ -100,5 +100,13 @@ gpio2: gpio@d0018180 { ...@@ -100,5 +100,13 @@ gpio2: gpio@d0018180 {
#interrupts-cells = <2>; #interrupts-cells = <2>;
interrupts = <24>; interrupts = <24>;
}; };
ethernet@d0034000 {
compatible = "marvell,armada-370-neta";
reg = <0xd0034000 0x2500>;
interrupts = <14>;
clocks = <&gateclk 1>;
status = "disabled";
};
}; };
}; };
...@@ -42,17 +42,19 @@ armada-370-xp-pmsu@d0022000 { ...@@ -42,17 +42,19 @@ armada-370-xp-pmsu@d0022000 {
soc { soc {
serial@d0012200 { serial@d0012200 {
compatible = "ns16550"; compatible = "snps,dw-apb-uart";
reg = <0xd0012200 0x100>; reg = <0xd0012200 0x100>;
reg-shift = <2>; reg-shift = <2>;
interrupts = <43>; interrupts = <43>;
reg-io-width = <4>;
status = "disabled"; status = "disabled";
}; };
serial@d0012300 { serial@d0012300 {
compatible = "ns16550"; compatible = "snps,dw-apb-uart";
reg = <0xd0012300 0x100>; reg = <0xd0012300 0x100>;
reg-shift = <2>; reg-shift = <2>;
interrupts = <44>; interrupts = <44>;
reg-io-width = <4>;
status = "disabled"; status = "disabled";
}; };
...@@ -93,14 +95,6 @@ ethernet@d0030000 { ...@@ -93,14 +95,6 @@ ethernet@d0030000 {
status = "disabled"; status = "disabled";
}; };
ethernet@d0034000 {
compatible = "marvell,armada-370-neta";
reg = <0xd0034000 0x2500>;
interrupts = <14>;
clocks = <&gateclk 1>;
status = "disabled";
};
xor@d0060900 { xor@d0060900 {
compatible = "marvell,orion-xor"; compatible = "marvell,orion-xor";
reg = <0xd0060900 0x100 reg = <0xd0060900 0x100
......
...@@ -117,6 +117,7 @@ gpio2: gpio@e8400 { ...@@ -117,6 +117,7 @@ gpio2: gpio@e8400 {
pinctrl: pinctrl@d0200 { pinctrl: pinctrl@d0200 {
compatible = "marvell,dove-pinctrl"; compatible = "marvell,dove-pinctrl";
reg = <0xd0200 0x10>; reg = <0xd0200 0x10>;
clocks = <&gate_clk 22>;
}; };
spi0: spi@10600 { spi0: spi@10600 {
......
...@@ -39,6 +39,7 @@ i2c@11100 { ...@@ -39,6 +39,7 @@ i2c@11100 {
#size-cells = <0>; #size-cells = <0>;
interrupts = <32>; interrupts = <32>;
clock-frequency = <100000>; clock-frequency = <100000>;
clocks = <&gate_clk 7>;
status = "disabled"; status = "disabled";
}; };
}; };
......
...@@ -82,4 +82,21 @@ wifi2 { ...@@ -82,4 +82,21 @@ wifi2 {
gpios = <&gpio1 16 1>; gpios = <&gpio1 16 1>;
}; };
}; };
regulators {
compatible = "simple-bus";
#address-cells = <1>;
#size-cells = <0>;
sata0_power: regulator@1 {
compatible = "regulator-fixed";
reg = <1>;
regulator-name = "SATA0 Power";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
enable-active-high;
regulator-always-on;
regulator-boot-on;
gpio = <&gpio1 4 0>;
};
};
}; };
...@@ -144,6 +144,7 @@ ehci@50000 { ...@@ -144,6 +144,7 @@ ehci@50000 {
compatible = "marvell,orion-ehci"; compatible = "marvell,orion-ehci";
reg = <0x50000 0x1000>; reg = <0x50000 0x1000>;
interrupts = <19>; interrupts = <19>;
clocks = <&gate_clk 3>;
status = "okay"; status = "okay";
}; };
......
...@@ -33,9 +33,7 @@ CONFIG_MVNETA=y ...@@ -33,9 +33,7 @@ CONFIG_MVNETA=y
CONFIG_MARVELL_PHY=y CONFIG_MARVELL_PHY=y
CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_OF_PLATFORM=y CONFIG_SERIAL_8250_DW=y
CONFIG_I2C=y
CONFIG_I2C_MV64XXX=y
CONFIG_GPIOLIB=y CONFIG_GPIOLIB=y
CONFIG_GPIO_SYSFS=y CONFIG_GPIO_SYSFS=y
# CONFIG_USB_SUPPORT is not set # CONFIG_USB_SUPPORT is not set
......
...@@ -67,6 +67,10 @@ static void __init kirkwood_legacy_clk_init(void) ...@@ -67,6 +67,10 @@ static void __init kirkwood_legacy_clk_init(void)
orion_clkdev_add(NULL, "mv643xx_eth_port.1", orion_clkdev_add(NULL, "mv643xx_eth_port.1",
of_clk_get_from_provider(&clkspec)); of_clk_get_from_provider(&clkspec));
clkspec.args[0] = CGC_BIT_SDIO;
orion_clkdev_add(NULL, "mvsdio",
of_clk_get_from_provider(&clkspec));
} }
static void __init kirkwood_of_clk_init(void) static void __init kirkwood_of_clk_init(void)
......
...@@ -64,8 +64,6 @@ static unsigned int topkick_mpp_config[] __initdata = { ...@@ -64,8 +64,6 @@ static unsigned int topkick_mpp_config[] __initdata = {
0 0
}; };
#define TOPKICK_SATA0_PWR_ENABLE 36
void __init usi_topkick_init(void) void __init usi_topkick_init(void)
{ {
/* /*
...@@ -73,8 +71,6 @@ void __init usi_topkick_init(void) ...@@ -73,8 +71,6 @@ void __init usi_topkick_init(void)
*/ */
kirkwood_mpp_conf(topkick_mpp_config); kirkwood_mpp_conf(topkick_mpp_config);
/* SATA0 power enable */
gpio_set_value(TOPKICK_SATA0_PWR_ENABLE, 1);
kirkwood_ge00_init(&topkick_ge00_data); kirkwood_ge00_init(&topkick_ge00_data);
kirkwood_sdio_init(&topkick_mvsdio_data); kirkwood_sdio_init(&topkick_mvsdio_data);
......
...@@ -32,7 +32,7 @@ struct mvebu_soc_descr { ...@@ -32,7 +32,7 @@ struct mvebu_soc_descr {
#define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw) #define to_clk_gate(_hw) container_of(_hw, struct clk_gate, hw)
static struct clk __init *mvebu_clk_gating_get_src( static struct clk *mvebu_clk_gating_get_src(
struct of_phandle_args *clkspec, void *data) struct of_phandle_args *clkspec, void *data)
{ {
struct mvebu_gating_ctrl *ctrl = (struct mvebu_gating_ctrl *)data; struct mvebu_gating_ctrl *ctrl = (struct mvebu_gating_ctrl *)data;
......
...@@ -1361,13 +1361,16 @@ static int mv_xor_probe(struct platform_device *pdev) ...@@ -1361,13 +1361,16 @@ static int mv_xor_probe(struct platform_device *pdev)
err_channel_add: err_channel_add:
for (i = 0; i < MV_XOR_MAX_CHANNELS; i++) for (i = 0; i < MV_XOR_MAX_CHANNELS; i++)
if (xordev->channels[i]) { if (xordev->channels[i]) {
mv_xor_channel_remove(xordev->channels[i]);
if (pdev->dev.of_node) if (pdev->dev.of_node)
irq_dispose_mapping(xordev->channels[i]->irq); irq_dispose_mapping(xordev->channels[i]->irq);
mv_xor_channel_remove(xordev->channels[i]);
} }
clk_disable_unprepare(xordev->clk); if (!IS_ERR(xordev->clk)) {
clk_put(xordev->clk); clk_disable_unprepare(xordev->clk);
clk_put(xordev->clk);
}
return ret; return ret;
} }
......
...@@ -595,8 +595,11 @@ static int __devinit dove_pinctrl_probe(struct platform_device *pdev) ...@@ -595,8 +595,11 @@ static int __devinit dove_pinctrl_probe(struct platform_device *pdev)
* grab clk to make sure it is ticking. * grab clk to make sure it is ticking.
*/ */
clk = devm_clk_get(&pdev->dev, NULL); clk = devm_clk_get(&pdev->dev, NULL);
if (!IS_ERR(clk)) if (IS_ERR(clk)) {
clk_prepare_enable(clk); dev_err(&pdev->dev, "Unable to get pdma clock");
return PTR_RET(clk);
}
clk_prepare_enable(clk);
return mvebu_pinctrl_probe(pdev); return mvebu_pinctrl_probe(pdev);
} }
......
...@@ -29,15 +29,16 @@ static int gpio_active_low; ...@@ -29,15 +29,16 @@ static int gpio_active_low;
static void gpio_poweroff_do_poweroff(void) static void gpio_poweroff_do_poweroff(void)
{ {
BUG_ON(gpio_num == -1); BUG_ON(!gpio_is_valid(gpio_num));
/* drive it active */ /* drive it active, also inactive->active edge */
gpio_direction_output(gpio_num, !gpio_active_low); gpio_direction_output(gpio_num, !gpio_active_low);
mdelay(100); mdelay(100);
/* rising edge or drive inactive */ /* drive inactive, also active->inactive edge */
gpio_set_value(gpio_num, gpio_active_low); gpio_set_value(gpio_num, gpio_active_low);
mdelay(100); mdelay(100);
/* falling edge */
/* drive it active, also inactive->active edge */
gpio_set_value(gpio_num, !gpio_active_low); gpio_set_value(gpio_num, !gpio_active_low);
/* give it some time */ /* give it some time */
...@@ -60,15 +61,12 @@ static int __devinit gpio_poweroff_probe(struct platform_device *pdev) ...@@ -60,15 +61,12 @@ static int __devinit gpio_poweroff_probe(struct platform_device *pdev)
} }
gpio_num = of_get_gpio_flags(pdev->dev.of_node, 0, &flags); gpio_num = of_get_gpio_flags(pdev->dev.of_node, 0, &flags);
if (gpio_num < 0) { if (!gpio_is_valid(gpio_num))
pr_err("%s: Could not get GPIO configuration: %d", return gpio_num;
__func__, gpio_num);
return -ENODEV;
}
gpio_active_low = flags & OF_GPIO_ACTIVE_LOW; gpio_active_low = flags & OF_GPIO_ACTIVE_LOW;
if (of_get_property(pdev->dev.of_node, "input", NULL)) input = of_property_read_bool(pdev->dev.of_node, "input");
input = true;
ret = gpio_request(gpio_num, "poweroff-gpio"); ret = gpio_request(gpio_num, "poweroff-gpio");
if (ret) { if (ret) {
...@@ -98,8 +96,7 @@ static int __devinit gpio_poweroff_probe(struct platform_device *pdev) ...@@ -98,8 +96,7 @@ static int __devinit gpio_poweroff_probe(struct platform_device *pdev)
static int __devexit gpio_poweroff_remove(struct platform_device *pdev) static int __devexit gpio_poweroff_remove(struct platform_device *pdev)
{ {
if (gpio_num != -1) gpio_free(gpio_num);
gpio_free(gpio_num);
if (pm_power_off == &gpio_poweroff_do_poweroff) if (pm_power_off == &gpio_poweroff_do_poweroff)
pm_power_off = NULL; pm_power_off = NULL;
...@@ -115,15 +112,15 @@ static struct platform_driver gpio_poweroff_driver = { ...@@ -115,15 +112,15 @@ static struct platform_driver gpio_poweroff_driver = {
.probe = gpio_poweroff_probe, .probe = gpio_poweroff_probe,
.remove = __devexit_p(gpio_poweroff_remove), .remove = __devexit_p(gpio_poweroff_remove),
.driver = { .driver = {
.name = "poweroff-gpio", .name = "poweroff-gpio",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.of_match_table = of_gpio_poweroff_match, .of_match_table = of_gpio_poweroff_match,
}, },
}; };
module_platform_driver(gpio_poweroff_driver); module_platform_driver(gpio_poweroff_driver);
MODULE_AUTHOR("Jamie Lentin <jm@lentin.co.uk>"); MODULE_AUTHOR("Jamie Lentin <jm@lentin.co.uk>");
MODULE_DESCRIPTION("GPIO poweroff driver"); MODULE_DESCRIPTION("GPIO poweroff driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL v2");
MODULE_ALIAS("platform:poweroff-gpio"); MODULE_ALIAS("platform:poweroff-gpio");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment