Skip to content

Commit

Permalink
Merge tag 'mvebu_fixes_for_v3.8' of git://git.infradead.org/users/jco…
Browse files Browse the repository at this point in the history
…oper/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>
  • Loading branch information
olofj committed Jan 8, 2013
2 parents 0e3a4a2 + ba607b6 commit 5cf87a1
Show file tree
Hide file tree
Showing 17 changed files with 101 additions and 47 deletions.
20 changes: 17 additions & 3 deletions Documentation/devicetree/bindings/gpio/gpio-poweroff.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
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:
- compatible : should be "gpio-poweroff".
Expand All @@ -13,10 +28,9 @@ Optional properties:
property is not specified, the GPIO is initialized as an output in its
inactive state.


Examples:

gpio-poweroff {
compatible = "gpio-poweroff";
gpios = <&gpio 4 0>; /* GPIO 4 Active Low */
gpios = <&gpio 4 0>;
};
6 changes: 4 additions & 2 deletions arch/arm/boot/dts/armada-370-xp.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,19 @@
ranges;

serial@d0012000 {
compatible = "ns16550";
compatible = "snps,dw-apb-uart";
reg = <0xd0012000 0x100>;
reg-shift = <2>;
interrupts = <41>;
reg-io-width = <4>;
status = "disabled";
};
serial@d0012100 {
compatible = "ns16550";
compatible = "snps,dw-apb-uart";
reg = <0xd0012100 0x100>;
reg-shift = <2>;
interrupts = <42>;
reg-io-width = <4>;
status = "disabled";
};

Expand Down
9 changes: 8 additions & 1 deletion arch/arm/boot/dts/armada-xp-mv78230.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,14 @@
reg = <0>;
clocks = <&cpuclk 0>;
};
}

cpu@1 {
device_type = "cpu";
compatible = "marvell,sheeva-v7";
reg = <1>;
clocks = <&cpuclk 1>;
};
};

soc {
pinctrl {
Expand Down
8 changes: 8 additions & 0 deletions arch/arm/boot/dts/armada-xp-mv78260.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,13 @@
#interrupts-cells = <2>;
interrupts = <24>;
};

ethernet@d0034000 {
compatible = "marvell,armada-370-neta";
reg = <0xd0034000 0x2500>;
interrupts = <14>;
clocks = <&gateclk 1>;
status = "disabled";
};
};
};
8 changes: 8 additions & 0 deletions arch/arm/boot/dts/armada-xp-mv78460.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,13 @@
#interrupts-cells = <2>;
interrupts = <24>;
};

ethernet@d0034000 {
compatible = "marvell,armada-370-neta";
reg = <0xd0034000 0x2500>;
interrupts = <14>;
clocks = <&gateclk 1>;
status = "disabled";
};
};
};
14 changes: 4 additions & 10 deletions arch/arm/boot/dts/armada-xp.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,19 @@

soc {
serial@d0012200 {
compatible = "ns16550";
compatible = "snps,dw-apb-uart";
reg = <0xd0012200 0x100>;
reg-shift = <2>;
interrupts = <43>;
reg-io-width = <4>;
status = "disabled";
};
serial@d0012300 {
compatible = "ns16550";
compatible = "snps,dw-apb-uart";
reg = <0xd0012300 0x100>;
reg-shift = <2>;
interrupts = <44>;
reg-io-width = <4>;
status = "disabled";
};

Expand Down Expand Up @@ -93,14 +95,6 @@
status = "disabled";
};

ethernet@d0034000 {
compatible = "marvell,armada-370-neta";
reg = <0xd0034000 0x2500>;
interrupts = <14>;
clocks = <&gateclk 1>;
status = "disabled";
};

xor@d0060900 {
compatible = "marvell,orion-xor";
reg = <0xd0060900 0x100
Expand Down
1 change: 1 addition & 0 deletions arch/arm/boot/dts/dove.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@
pinctrl: pinctrl@d0200 {
compatible = "marvell,dove-pinctrl";
reg = <0xd0200 0x10>;
clocks = <&gate_clk 22>;
};

spi0: spi@10600 {
Expand Down
1 change: 1 addition & 0 deletions arch/arm/boot/dts/kirkwood-6282.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#size-cells = <0>;
interrupts = <32>;
clock-frequency = <100000>;
clocks = <&gate_clk 7>;
status = "disabled";
};
};
Expand Down
17 changes: 17 additions & 0 deletions arch/arm/boot/dts/kirkwood-topkick.dts
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,21 @@
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>;
};
};
};
1 change: 1 addition & 0 deletions arch/arm/boot/dts/kirkwood.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
compatible = "marvell,orion-ehci";
reg = <0x50000 0x1000>;
interrupts = <19>;
clocks = <&gate_clk 3>;
status = "okay";
};

Expand Down
4 changes: 1 addition & 3 deletions arch/arm/configs/mvebu_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ CONFIG_MVNETA=y
CONFIG_MARVELL_PHY=y
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_OF_PLATFORM=y
CONFIG_I2C=y
CONFIG_I2C_MV64XXX=y
CONFIG_SERIAL_8250_DW=y
CONFIG_GPIOLIB=y
CONFIG_GPIO_SYSFS=y
# CONFIG_USB_SUPPORT is not set
Expand Down
4 changes: 4 additions & 0 deletions arch/arm/mach-kirkwood/board-dt.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ static void __init kirkwood_legacy_clk_init(void)
orion_clkdev_add(NULL, "mv643xx_eth_port.1",
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)
Expand Down
4 changes: 0 additions & 4 deletions arch/arm/mach-kirkwood/board-usi_topkick.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,17 +64,13 @@ static unsigned int topkick_mpp_config[] __initdata = {
0
};

#define TOPKICK_SATA0_PWR_ENABLE 36

void __init usi_topkick_init(void)
{
/*
* Basic setup. Needs to be called early.
*/
kirkwood_mpp_conf(topkick_mpp_config);

/* SATA0 power enable */
gpio_set_value(TOPKICK_SATA0_PWR_ENABLE, 1);

kirkwood_ge00_init(&topkick_ge00_data);
kirkwood_sdio_init(&topkick_mvsdio_data);
Expand Down
2 changes: 1 addition & 1 deletion drivers/clk/mvebu/clk-gating-ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct mvebu_soc_descr {

#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 mvebu_gating_ctrl *ctrl = (struct mvebu_gating_ctrl *)data;
Expand Down
9 changes: 6 additions & 3 deletions drivers/dma/mv_xor.c
Original file line number Diff line number Diff line change
Expand Up @@ -1361,13 +1361,16 @@ static int mv_xor_probe(struct platform_device *pdev)
err_channel_add:
for (i = 0; i < MV_XOR_MAX_CHANNELS; i++)
if (xordev->channels[i]) {
mv_xor_channel_remove(xordev->channels[i]);
if (pdev->dev.of_node)
irq_dispose_mapping(xordev->channels[i]->irq);
mv_xor_channel_remove(xordev->channels[i]);
}

clk_disable_unprepare(xordev->clk);
clk_put(xordev->clk);
if (!IS_ERR(xordev->clk)) {
clk_disable_unprepare(xordev->clk);
clk_put(xordev->clk);
}

return ret;
}

Expand Down
7 changes: 5 additions & 2 deletions drivers/pinctrl/mvebu/pinctrl-dove.c
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,11 @@ static int __devinit dove_pinctrl_probe(struct platform_device *pdev)
* grab clk to make sure it is ticking.
*/
clk = devm_clk_get(&pdev->dev, NULL);
if (!IS_ERR(clk))
clk_prepare_enable(clk);
if (IS_ERR(clk)) {
dev_err(&pdev->dev, "Unable to get pdma clock");
return PTR_RET(clk);
}
clk_prepare_enable(clk);

return mvebu_pinctrl_probe(pdev);
}
Expand Down
33 changes: 15 additions & 18 deletions drivers/power/reset/gpio-poweroff.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,16 @@ static int gpio_active_low;

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);
mdelay(100);
/* rising edge or drive inactive */
/* drive inactive, also active->inactive edge */
gpio_set_value(gpio_num, gpio_active_low);
mdelay(100);
/* falling edge */

/* drive it active, also inactive->active edge */
gpio_set_value(gpio_num, !gpio_active_low);

/* give it some time */
Expand All @@ -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);
if (gpio_num < 0) {
pr_err("%s: Could not get GPIO configuration: %d",
__func__, gpio_num);
return -ENODEV;
}
if (!gpio_is_valid(gpio_num))
return gpio_num;

gpio_active_low = flags & OF_GPIO_ACTIVE_LOW;

if (of_get_property(pdev->dev.of_node, "input", NULL))
input = true;
input = of_property_read_bool(pdev->dev.of_node, "input");

ret = gpio_request(gpio_num, "poweroff-gpio");
if (ret) {
Expand Down Expand Up @@ -98,8 +96,7 @@ static int __devinit gpio_poweroff_probe(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)
pm_power_off = NULL;

Expand All @@ -115,15 +112,15 @@ static struct platform_driver gpio_poweroff_driver = {
.probe = gpio_poweroff_probe,
.remove = __devexit_p(gpio_poweroff_remove),
.driver = {
.name = "poweroff-gpio",
.owner = THIS_MODULE,
.of_match_table = of_gpio_poweroff_match,
},
.name = "poweroff-gpio",
.owner = THIS_MODULE,
.of_match_table = of_gpio_poweroff_match,
},
};

module_platform_driver(gpio_poweroff_driver);

MODULE_AUTHOR("Jamie Lentin <jm@lentin.co.uk>");
MODULE_DESCRIPTION("GPIO poweroff driver");
MODULE_LICENSE("GPL");
MODULE_LICENSE("GPL v2");
MODULE_ALIAS("platform:poweroff-gpio");

0 comments on commit 5cf87a1

Please sign in to comment.