Skip to contentSkip to conversation

Fixes for 3.8-rc

PATCH New Andrew Lunn 3 participants 16 messages Jan 6, 2013 – Jan 7, 2013

Subsystems (8)
lore
Share & tools
lore

Andrew Lunn

author maintainer
#0 lore raw

cover Fixes for 3.8-rc

This patchset is a collection of fixes for 3.8-rc for Marvell SoCs and drivers.

If nobody objects, i will send Olof and Arnd a pull request sometime Monday.

Andrew Lunn (5):
ARM: Kirkwood: Fix missing clk for USB device.
Power: gpio-poweroff: Fix documentation and gpio_is_valid
ARM: Kirkwood: Fix missing sdio clock
ARM: Kirkwood: Use fixed-regulator instead of board gpio call
arm: mvebu: Add missing ; for cpu node.

Joshua Coombs (1):
clk: mvebu: Remove inappropriate __init tagging

Nobuhiro Iwamatsu (1):
ARM: Kirkwood: Switch TWSI1 of 88f6282 to DT clock providers

Thomas Petazzoni (4):
arm: mvebu: Armada XP MV78230 has two cores, not one
arm: mvebu: Armada XP MV78230 has only three Ethernet interfaces
dma: mv_xor: fix error handling of mv_xor_channel_add()
dma: mv_xor: fix error handling for clocks

 .../devicetree/bindings/gpio/gpio-poweroff.txt     |   20 ++++++++++--
 arch/arm/boot/dts/armada-xp-mv78230.dtsi           |    9 +++++-
 arch/arm/boot/dts/armada-xp-mv78260.dtsi           |    8 +++++
 arch/arm/boot/dts/armada-xp-mv78460.dtsi           |    8 +++++
 arch/arm/boot/dts/armada-xp.dtsi                   |    8 -----
 arch/arm/boot/dts/kirkwood-6282.dtsi               |    1 +
 arch/arm/boot/dts/kirkwood-topkick.dts             |   17 ++++++++++
 arch/arm/boot/dts/kirkwood.dtsi                    |    1 +
 arch/arm/mach-kirkwood/board-dt.c                  |    4 +++
 arch/arm/mach-kirkwood/board-usi_topkick.c         |    4 ---
 drivers/clk/mvebu/clk-gating-ctrl.c                |    2 +-
 drivers/dma/mv_xor.c                               |    9 ++++--
 drivers/power/reset/gpio-poweroff.c                |   33 +++++++++-----------
 13 files changed, 86 insertions(+), 38 deletions(-)
Signature · 1 line
1.7.10.4
author maintainer
#1 lore raw

PATCH 1/11 ARM: Kirkwood: Fix missing clk for USB device.

Without the clock being held by a driver, it gets turned off at a bad time causing the SoC to lockup. This is often during reboot.

---
 arch/arm/boot/dts/kirkwood.dtsi |    1 +
 1 file changed, 1 insertion(+)
arch/arm/boot/dts/kirkwood.dtsi +1 -0
index 7735cee..110d6cb 100644
@@ -144,6 +144,7 @@
 			compatible = "marvell,orion-ehci";
 			reg = <0x50000 0x1000>;
 			interrupts = <19>;
+			clocks = <&gate_clk 3>;
 			status = "okay";
 		};
 
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 1/11 ARM: Kirkwood: Fix missing clk for USB device.

Quoted 14 lines · Andrew Lunn

Without the clock being held by a driver, it gets turned off at a bad time causing the SoC to lockup. This is often during reboot.

---
 arch/arm/boot/dts/kirkwood.dtsi |    1 +
 1 file changed, 1 insertion(+)
arch/arm/boot/dts/kirkwood.dtsi +0 -0
index 7735cee..110d6cb 100644

arch/arm/boot/dts/kirkwood.dtsi line 149

Quoted 6 lines
arch/arm/boot/dts/kirkwood.dtsi +1 -0
@@ -144,6 +144,7 @@
 			compatible = "marvell,orion-ehci";
 			reg = <0x50000 0x1000>;
 			interrupts = <19>;
+			clocks = <&gate_clk 3>;
 			status = "okay";
 		};

Hi Andrew,

Maybe you also want to remove the clock alias workaround from kirkwood_legacy_clk_init() ?

Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130107/cb765a85/attachment.sig>

author maintainer
#3 lore raw

PATCH 1/11 ARM: Kirkwood: Fix missing clk for USB device.

Quoted 24 lines · Simon Guinot
Quoted 14 lines · Andrew Lunn

Without the clock being held by a driver, it gets turned off at a bad time causing the SoC to lockup. This is often during reboot.

---
 arch/arm/boot/dts/kirkwood.dtsi |    1 +
 1 file changed, 1 insertion(+)
arch/arm/boot/dts/kirkwood.dtsi +0 -0
index 7735cee..110d6cb 100644

arch/arm/boot/dts/kirkwood.dtsi line 149

Quoted 6 lines
arch/arm/boot/dts/kirkwood.dtsi +1 -0
@@ -144,6 +144,7 @@
 			compatible = "marvell,orion-ehci";
 			reg = <0x50000 0x1000>;
 			interrupts = <19>;
+			clocks = <&gate_clk 3>;
 			status = "okay";
 		};

Hi Andrew,

Quoted 2 lines

Maybe you also want to remove the clock alias workaround from kirkwood_legacy_clk_init() ?

Hi Simon

That is not really a fix. It does no harm being there.

We will remove it as a cleanup in 3.9. We can also remove the SDIO legacy clock as well, since Thomas has patches to convert that driver to DT.

Andrew

author maintainer
#4 lore raw

PATCH 2/11 Power: gpio-poweroff: Fix documentation and gpio_is_valid

In reply to Andrew Lunn

Improve the documentation to clarify level vs edge triggered power off. Improve the comments for level vs edge triggered power off. Make use of gpio_is_valid().

---
 .../devicetree/bindings/gpio/gpio-poweroff.txt     |   20 ++++++++++--
 drivers/power/reset/gpio-poweroff.c                |   33 +++++++++-----------
 2 files changed, 32 insertions(+), 21 deletions(-)
Documentation/devicetree/bindings/gpio/gpio-poweroff.txt +17 -3
index 558cdf3..d4eab92 100644
@@ -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".
@@ -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>;
 };
drivers/power/reset/gpio-poweroff.c +15 -18
index 0491e53..adc943b 100644
@@ -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 */
@@ -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) {
@@ -98,8 +96,7 @@ err:
 
 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;
 
@@ -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 <[email protected]>");
 MODULE_DESCRIPTION("GPIO poweroff driver");
-MODULE_LICENSE("GPL");
+MODULE_LICENSE("GPL v2");
 MODULE_ALIAS("platform:poweroff-gpio");
Signature · 1 line
1.7.10.4
author maintainer
#5 lore raw

PATCH 3/11 ARM: Kirkwood: Switch TWSI1 of 88f6282 to DT clock providers

In reply to Andrew Lunn

From: Nobuhiro Iwamatsu <[email protected]>

Clock Management of kirkwood has moved to DT clock providers. However, TWSI1 has not yet been done.
This switches TWSI1 of 88f6282 to DT clock providers.

---
 arch/arm/boot/dts/kirkwood-6282.dtsi |    1 +
 1 file changed, 1 insertion(+)
arch/arm/boot/dts/kirkwood-6282.dtsi +1 -0
index 9ae2004..4ccea21 100644
@@ -39,6 +39,7 @@
 			#size-cells = <0>;
 			interrupts = <32>;
 			clock-frequency = <100000>;
+			clocks = <&gate_clk 7>;
 			status = "disabled";
 		};
 	};
Signature · 1 line
1.7.10.4
author maintainer
#6 lore raw

PATCH 4/11 ARM: Kirkwood: Fix missing sdio clock

In reply to Andrew Lunn

We moved to declaring clk gates in DT. However, device which do not yet have a DT binding need to have a clkdev alias. This was missing for SDIO.

---
 arch/arm/mach-kirkwood/board-dt.c |    4 ++++
 1 file changed, 4 insertions(+)
arch/arm/mach-kirkwood/board-dt.c +4 -0
index ff4150a..de4fd2b 100644
@@ -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)
Signature · 1 line
1.7.10.4
author maintainer
#7 lore raw

PATCH 5/11 ARM: Kirkwood: Use fixed-regulator instead of board gpio call

In reply to Andrew Lunn

With the change to a DT based pinctrl/gpio driver, using gpio API calls in board-*.c files no longer works, a dereferenced NULL pointer exception occurs instead. By converting the GPIO code into a fixed-regulator which gets probed later once pinctrl/gpio is available, we avoid the exception.

---
 arch/arm/boot/dts/kirkwood-topkick.dts     |   17 +++++++++++++++++
 arch/arm/mach-kirkwood/board-usi_topkick.c |    4 ----
 2 files changed, 17 insertions(+), 4 deletions(-)
arch/arm/boot/dts/kirkwood-topkick.dts +17 -0
index c0de5a7..cd15452 100644
@@ -82,4 +82,21 @@
 			gpios = <&gpio1 16 1>;
 		};
 	};
+	regulators {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		sata0_power: regulator at 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>;
+		};
+	};
 };
arch/arm/mach-kirkwood/board-usi_topkick.c +0 -4
index 15e69fc..23d2dd1 100644
@@ -64,8 +64,6 @@ static unsigned int topkick_mpp_config[] __initdata = {
 	0
 };
 
-#define TOPKICK_SATA0_PWR_ENABLE 36
-
 void __init usi_topkick_init(void)
 {
 	/*
@@ -73,8 +71,6 @@ void __init usi_topkick_init(void)
 	 */
 	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);
Signature · 1 line
1.7.10.4
author maintainer
#8 lore raw

PATCH 6/11 clk: mvebu: Remove inappropriate __init tagging

In reply to Andrew Lunn

From: Joshua Coombs <[email protected]>

If the Orion WDT driver is built as a module, an opps occurs during clk lookup when calling mvebu_clk_gating_get_src(). Remove the inappropriate __init tag so the function is available for modules after kernel init.

---
 drivers/clk/mvebu/clk-gating-ctrl.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/mvebu/clk-gating-ctrl.c +1 -1
index c6d3c26..8fa5408 100644
@@ -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;
Signature · 1 line
1.7.10.4
author maintainer
#9 lore raw

PATCH 7/11 arm: mvebu: Armada XP MV78230 has two cores, not one

In reply to Andrew Lunn

From: Thomas Petazzoni <[email protected]>

Contrary to our understanding at the time armada-xp-mv78230.dtsi was written, the MV78230 variant of the Armada XP SoC has two cores and not one. This patch updates the .dtsi file to take into account this reality.

---
 arch/arm/boot/dts/armada-xp-mv78230.dtsi |    7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/boot/dts/armada-xp-mv78230.dtsi +7 -0
index c45c7b4..8f90fac 100644
@@ -34,6 +34,13 @@
 		reg = <0>;
 		clocks = <&cpuclk 0>;
 	    };
+
+	    cpu at 1 {
+		device_type = "cpu";
+		compatible = "marvell,sheeva-v7";
+		reg = <1>;
+		clocks = <&cpuclk 1>;
+	    };
 	}
 
 	soc {
Signature · 1 line
1.7.10.4
author maintainer
#10 lore raw

PATCH 8/11 arm: mvebu: Armada XP MV78230 has only three Ethernet interfaces

In reply to Andrew Lunn

From: Thomas Petazzoni <[email protected]>

We originally thought that the MV78230 variant of the Armada XP had four Ethernet interfaces, like the other variants MV78260 and MV78460. In fact, this is not true, and the MV78230 has only three Ethernet interfaces.

So, the definitions of the Ethernet interfaces is now done as follows:

* armada-370-xp.dtsi: definitions of the first two interfaces, that are common to Armada 370 and Armada XP

* armada-xp.dtsi: definition of the third interface, common to all Armada XP variants.

* armada-xp-mv78260.dtsi and armada-xp-mv78460.dtsi: definition of the fourth interface.

---
 arch/arm/boot/dts/armada-xp-mv78260.dtsi |    8 ++++++++
 arch/arm/boot/dts/armada-xp-mv78460.dtsi |    8 ++++++++
 arch/arm/boot/dts/armada-xp.dtsi         |    8 --------
 3 files changed, 16 insertions(+), 8 deletions(-)
arch/arm/boot/dts/armada-xp-mv78260.dtsi +8 -0
index a2aee57..1c1937d 100644
@@ -85,5 +85,13 @@
 			#interrupts-cells = <2>;
 			interrupts = <24>;
 		};
+
+		ethernet at d0034000 {
+				compatible = "marvell,armada-370-neta";
+				reg = <0xd0034000 0x2500>;
+				interrupts = <14>;
+				clocks = <&gateclk 1>;
+				status = "disabled";
+		};
 	};
 };
arch/arm/boot/dts/armada-xp-mv78460.dtsi +8 -0
index da03a12..4905cf3 100644
@@ -100,5 +100,13 @@
 			#interrupts-cells = <2>;
 			interrupts = <24>;
 		};
+
+		ethernet at d0034000 {
+				compatible = "marvell,armada-370-neta";
+				reg = <0xd0034000 0x2500>;
+				interrupts = <14>;
+				clocks = <&gateclk 1>;
+				status = "disabled";
+		};
 	};
  };
arch/arm/boot/dts/armada-xp.dtsi +0 -8
index 367aa3f..2a98e12 100644
@@ -93,14 +93,6 @@
 				status = "disabled";
 		};
 
-		ethernet at d0034000 {
-				compatible = "marvell,armada-370-neta";
-				reg = <0xd0034000 0x2500>;
-				interrupts = <14>;
-				clocks = <&gateclk 1>;
-				status = "disabled";
-		};
-
 		xor at d0060900 {
 			compatible = "marvell,orion-xor";
 			reg = <0xd0060900 0x100
Signature · 1 line
1.7.10.4
author maintainer
#11 lore raw

PATCH 9/11 arm: mvebu: Add missing ; for cpu node.

In reply to Andrew Lunn

The Armada XP MV78230 DT include file is missing a ; at the end of the cpu node.

---
 arch/arm/boot/dts/armada-xp-mv78230.dtsi |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/armada-xp-mv78230.dtsi +1 -1
index 8f90fac..271855a 100644
@@ -41,7 +41,7 @@
 		reg = <1>;
 		clocks = <&cpuclk 1>;
 	    };
-	}
+	};
 
 	soc {
 		pinctrl {
Signature · 1 line
1.7.10.4
author maintainer
#12 lore raw

PATCH 10/11 dma: mv_xor: fix error handling of mv_xor_channel_add()

In reply to Andrew Lunn

From: Thomas Petazzoni <[email protected]>

When mv_xor_channel_add() fails for one XOR channel, we jump to the err_channel_add label to clean up all previous channels that had been initialized correctly. Unfortunately, while handling this error condition, we were disposing the IRQ mapping before calling mv_xor_channel_remove() (which does the free_irq()), which is incorrect.

Instead, do things properly in the reverse order of the
initialization: first remove the XOR channel (so that free_irq() is done), and then dispose the IRQ mapping.

This avoids ugly warnings when for some reason one of the XOR channel fails to initialize.

---
 drivers/dma/mv_xor.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/mv_xor.c +1 -1
index ac71f55..cc5d23d 100644
@@ -1361,9 +1361,9 @@ 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);
Signature · 1 line
1.7.10.4
author maintainer
#13 lore raw

PATCH 11/11 dma: mv_xor: fix error handling for clocks

In reply to Andrew Lunn

From: Thomas Petazzoni <[email protected]>

When a channel fails to initialize, we release all ressources, including clocks. However, a XOR unit is not necessarily associated to a clock (some variants of Marvell SoCs have a clock for XOR units, some don't), so we shouldn't unconditionally be releasing the clock.

Instead, just like we do in the mv_xor_remove() function, we should check if one clock was found before releasing it.

---
 drivers/dma/mv_xor.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/dma/mv_xor.c +5 -2
index cc5d23d..e17fad0 100644
@@ -1366,8 +1366,11 @@ err_channel_add:
 				irq_dispose_mapping(xordev->channels[i]->irq);
 		}
 
-	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;
 }
 
Signature · 1 line
1.7.10.4
#14 lore raw

cover Fixes for 3.8-rc

In reply to Andrew Lunn
Quoted 5 lines · Andrew Lunn

This patchset is a collection of fixes for 3.8-rc for Marvell SoCs and drivers.

If nobody objects, i will send Olof and Arnd a pull request sometime Monday.

The patches all look good to me.

Arnd

author maintainer
#15 lore raw

cover Fixes for 3.8-rc

Quoted 8 lines · Arnd Bergmann
Quoted 5 lines · Andrew Lunn

This patchset is a collection of fixes for 3.8-rc for Marvell SoCs and drivers.

If nobody objects, i will send Olof and Arnd a pull request sometime Monday.

The patches all look good to me.

Hi Arnd

Thanks for the review. Jason sent a pull request yesterday for these patches, plus one more for the UART on 370/XP.

Andrew