All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] ARM: Kirkwood: Use fixed regulators
@ 2012-11-17 14:46 Andrew Lunn
  2012-11-17 14:46 ` [PATCH 1/5] ARM: Kirkwood: Enable regulator and " Andrew Lunn
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Andrew Lunn @ 2012-11-17 14:46 UTC (permalink / raw)
  To: linux-arm-kernel

A few Kirkwood boards use a GPIO line to enable power to subsystems,
eg USB or SATA devices. Use the regulator framework to control these
GPIO lines, and describe them in DT rather than C code in the board
files.

Posted before as part of the bigger patchset.

Andrew Lunn (5):
  ARM: Kirkwood: Enable regulator and fixed regulators.
  ARM: Kirkwood: Convert DNSKW to use regulators
  ARM: Kirkwood: Convert Dockstar to use regulators
  ARM: Kirkwood: Convert GoFlexNet to use regulators
  ARM: Kirkwood: Convert LSXL to use regulators

 arch/arm/boot/dts/kirkwood-dnskw.dtsi    |   29 +++++++++++++++++++++++++++++
 arch/arm/boot/dts/kirkwood-dockstar.dts  |   17 +++++++++++++++++
 arch/arm/boot/dts/kirkwood-goflexnet.dts |   17 +++++++++++++++++
 arch/arm/boot/dts/kirkwood-lsxl.dtsi     |   29 +++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/Kconfig           |    3 ++-
 arch/arm/mach-kirkwood/board-dnskw.c     |    4 ----
 arch/arm/mach-kirkwood/board-dockstar.c  |    4 ----
 arch/arm/mach-kirkwood/board-goflexnet.c |    4 ----
 arch/arm/mach-kirkwood/board-lsxl.c      |    8 --------
 9 files changed, 94 insertions(+), 21 deletions(-)

-- 
1.7.10.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/5] ARM: Kirkwood: Enable regulator and fixed regulators.
  2012-11-17 14:46 [PATCH 0/5] ARM: Kirkwood: Use fixed regulators Andrew Lunn
@ 2012-11-17 14:46 ` Andrew Lunn
  2012-11-17 14:46 ` [PATCH 2/5] ARM: Kirkwood: Convert DNSKW to use regulators Andrew Lunn
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Andrew Lunn @ 2012-11-17 14:46 UTC (permalink / raw)
  To: linux-arm-kernel

A few boards use a GPIO line to enable power to subsystems, eg USB or
SATA devices. Pull in the regulator framework as the first step to
controlling these GPIO lines are regulators.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 arch/arm/mach-kirkwood/Kconfig |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index e0d26fe..b8e96f3 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -49,8 +49,9 @@ config ARCH_KIRKWOOD_DT
 	select POWER_SUPPLY
 	select POWER_RESET
 	select POWER_RESET_GPIO
+	select REGULATOR
+	select REGULATOR_FIXED_VOLTAGE
 	select USE_OF
-
 	help
 	  Say 'Y' here if you want your kernel to support the
 	  Marvell Kirkwood using flattened device tree.
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/5] ARM: Kirkwood: Convert DNSKW to use regulators
  2012-11-17 14:46 [PATCH 0/5] ARM: Kirkwood: Use fixed regulators Andrew Lunn
  2012-11-17 14:46 ` [PATCH 1/5] ARM: Kirkwood: Enable regulator and " Andrew Lunn
@ 2012-11-17 14:46 ` Andrew Lunn
  2012-11-17 14:46 ` [PATCH 3/5] ARM: Kirkwood: Convert Dockstar " Andrew Lunn
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Andrew Lunn @ 2012-11-17 14:46 UTC (permalink / raw)
  To: linux-arm-kernel

Control the power to SATA0 and SATA1 using a fixed regulator.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Jamie Lentin <jm@lentin.co.uk>
---
 arch/arm/boot/dts/kirkwood-dnskw.dtsi |   29 +++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-dnskw.c  |    4 ----
 2 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/kirkwood-dnskw.dtsi b/arch/arm/boot/dts/kirkwood-dnskw.dtsi
index 22aa07a..b6aeb4f 100644
--- a/arch/arm/boot/dts/kirkwood-dnskw.dtsi
+++ b/arch/arm/boot/dts/kirkwood-dnskw.dtsi
@@ -81,4 +81,33 @@
 			};
 		};
 	};
+
+	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 7 0>;
+		};
+		sata1_power: regulator at 2 {
+			compatible = "regulator-fixed";
+			reg = <2>;
+			regulator-name = "SATA1 Power";
+			regulator-min-microvolt = <5000000>;
+			regulator-max-microvolt = <5000000>;
+			enable-active-high;
+			regulator-always-on;
+			regulator-boot-on;
+			gpio = <&gpio1 8 0>;
+		};
+	};
 };
diff --git a/arch/arm/mach-kirkwood/board-dnskw.c b/arch/arm/mach-kirkwood/board-dnskw.c
index 549369e..653bbbe 100644
--- a/arch/arm/mach-kirkwood/board-dnskw.c
+++ b/arch/arm/mach-kirkwood/board-dnskw.c
@@ -76,10 +76,6 @@ void __init dnskw_init(void)
 	kirkwood_ehci_init();
 	kirkwood_ge00_init(&dnskw_ge00_data);
 
-	/* Ensure power is supplied to both HDDs */
-	dnskw_gpio_register(39, "dnskw:power:sata0", 1);
-	dnskw_gpio_register(40, "dnskw:power:sata1", 1);
-
 	/* Set NAS to turn back on after a power failure */
 	dnskw_gpio_register(37, "dnskw:power:recover", 1);
 }
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/5] ARM: Kirkwood: Convert Dockstar to use regulators
  2012-11-17 14:46 [PATCH 0/5] ARM: Kirkwood: Use fixed regulators Andrew Lunn
  2012-11-17 14:46 ` [PATCH 1/5] ARM: Kirkwood: Enable regulator and " Andrew Lunn
  2012-11-17 14:46 ` [PATCH 2/5] ARM: Kirkwood: Convert DNSKW to use regulators Andrew Lunn
@ 2012-11-17 14:46 ` Andrew Lunn
  2012-11-17 14:46 ` [PATCH 4/5] ARM: Kirkwood: Convert GoFlexNet " Andrew Lunn
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Andrew Lunn @ 2012-11-17 14:46 UTC (permalink / raw)
  To: linux-arm-kernel

Control the power to USB using a fixed regulator.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 arch/arm/boot/dts/kirkwood-dockstar.dts |   17 +++++++++++++++++
 arch/arm/mach-kirkwood/board-dockstar.c |    4 ----
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/kirkwood-dockstar.dts b/arch/arm/boot/dts/kirkwood-dockstar.dts
index 08a5824..c0fbfdc 100644
--- a/arch/arm/boot/dts/kirkwood-dockstar.dts
+++ b/arch/arm/boot/dts/kirkwood-dockstar.dts
@@ -54,4 +54,21 @@
 			gpios = <&gpio1 15 1>;
 		};
 	};
+	regulators {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		usb_power: regulator at 1 {
+			compatible = "regulator-fixed";
+			reg = <1>;
+			regulator-name = "USB Power";
+			regulator-min-microvolt = <5000000>;
+			regulator-max-microvolt = <5000000>;
+			enable-active-high;
+			regulator-always-on;
+			regulator-boot-on;
+			gpio = <&gpio0 29 0>;
+		};
+	};
 };
diff --git a/arch/arm/mach-kirkwood/board-dockstar.c b/arch/arm/mach-kirkwood/board-dockstar.c
index f2fbb02..5c60fa1 100644
--- a/arch/arm/mach-kirkwood/board-dockstar.c
+++ b/arch/arm/mach-kirkwood/board-dockstar.c
@@ -24,7 +24,6 @@
 #include <linux/of_fdt.h>
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
-#include <linux/gpio.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
@@ -52,9 +51,6 @@ void __init dockstar_dt_init(void)
 	 */
 	kirkwood_mpp_conf(dockstar_mpp_config);
 
-	if (gpio_request(29, "USB Power Enable") != 0 ||
-	    gpio_direction_output(29, 1) != 0)
-		pr_err("can't setup GPIO 29 (USB Power Enable)\n");
 	kirkwood_ehci_init();
 
 	kirkwood_ge00_init(&dockstar_ge00_data);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/5] ARM: Kirkwood: Convert GoFlexNet to use regulators
  2012-11-17 14:46 [PATCH 0/5] ARM: Kirkwood: Use fixed regulators Andrew Lunn
                   ` (2 preceding siblings ...)
  2012-11-17 14:46 ` [PATCH 3/5] ARM: Kirkwood: Convert Dockstar " Andrew Lunn
@ 2012-11-17 14:46 ` Andrew Lunn
  2012-11-17 14:46 ` [PATCH 5/5] ARM: Kirkwood: Convert LSXL " Andrew Lunn
  2012-11-17 15:00 ` [PATCH 0/5] ARM: Kirkwood: Use fixed regulators Andrew Lunn
  5 siblings, 0 replies; 7+ messages in thread
From: Andrew Lunn @ 2012-11-17 14:46 UTC (permalink / raw)
  To: linux-arm-kernel

Control the power to USB using a fixed regulator.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Josh Coombs <josh.coombs@gmail.com>
---
 arch/arm/boot/dts/kirkwood-goflexnet.dts |   17 +++++++++++++++++
 arch/arm/mach-kirkwood/board-goflexnet.c |    4 ----
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/kirkwood-goflexnet.dts b/arch/arm/boot/dts/kirkwood-goflexnet.dts
index 7c8238f..84de887 100644
--- a/arch/arm/boot/dts/kirkwood-goflexnet.dts
+++ b/arch/arm/boot/dts/kirkwood-goflexnet.dts
@@ -96,4 +96,21 @@
 			gpios = <&gpio1 9 0>;
 		};
 	};
+	regulators {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		usb_power: regulator at 1 {
+			compatible = "regulator-fixed";
+			reg = <1>;
+			regulator-name = "USB Power";
+			regulator-min-microvolt = <5000000>;
+			regulator-max-microvolt = <5000000>;
+			enable-active-high;
+			regulator-always-on;
+			regulator-boot-on;
+			gpio = <&gpio0 29 0>;
+		};
+	};
 };
diff --git a/arch/arm/mach-kirkwood/board-goflexnet.c b/arch/arm/mach-kirkwood/board-goflexnet.c
index 001ca8c..7257a35 100644
--- a/arch/arm/mach-kirkwood/board-goflexnet.c
+++ b/arch/arm/mach-kirkwood/board-goflexnet.c
@@ -26,7 +26,6 @@
 #include <linux/of_fdt.h>
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
-#include <linux/gpio.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
@@ -62,9 +61,6 @@ void __init goflexnet_init(void)
 	 */
 	kirkwood_mpp_conf(goflexnet_mpp_config);
 
-	if (gpio_request(29, "USB Power Enable") != 0 ||
-	    gpio_direction_output(29, 1) != 0)
-		pr_err("can't setup GPIO 29 (USB Power Enable)\n");
 	kirkwood_ehci_init();
 
 	kirkwood_ge00_init(&goflexnet_ge00_data);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/5] ARM: Kirkwood: Convert LSXL to use regulators
  2012-11-17 14:46 [PATCH 0/5] ARM: Kirkwood: Use fixed regulators Andrew Lunn
                   ` (3 preceding siblings ...)
  2012-11-17 14:46 ` [PATCH 4/5] ARM: Kirkwood: Convert GoFlexNet " Andrew Lunn
@ 2012-11-17 14:46 ` Andrew Lunn
  2012-11-17 15:00 ` [PATCH 0/5] ARM: Kirkwood: Use fixed regulators Andrew Lunn
  5 siblings, 0 replies; 7+ messages in thread
From: Andrew Lunn @ 2012-11-17 14:46 UTC (permalink / raw)
  To: linux-arm-kernel

Control the power to USB and HDD using a fixed regulator.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Michael Walle <michael@walle.cc>
---
 arch/arm/boot/dts/kirkwood-lsxl.dtsi |   29 +++++++++++++++++++++++++++++
 arch/arm/mach-kirkwood/board-lsxl.c  |    8 --------
 2 files changed, 29 insertions(+), 8 deletions(-)

diff --git a/arch/arm/boot/dts/kirkwood-lsxl.dtsi b/arch/arm/boot/dts/kirkwood-lsxl.dtsi
index 8fea375..65a8c52 100644
--- a/arch/arm/boot/dts/kirkwood-lsxl.dtsi
+++ b/arch/arm/boot/dts/kirkwood-lsxl.dtsi
@@ -94,4 +94,33 @@
 			gpios = <&gpio1 16 1>;
 		};
 	};
+
+	regulators {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		usb_power: regulator at 1 {
+			compatible = "regulator-fixed";
+			reg = <1>;
+			regulator-name = "USB Power";
+			regulator-min-microvolt = <5000000>;
+			regulator-max-microvolt = <5000000>;
+			enable-active-high;
+			regulator-always-on;
+			regulator-boot-on;
+			gpio = <&gpio0 11 0>;
+		};
+		hdd_power: regulator at 2 {
+			compatible = "regulator-fixed";
+			reg = <2>;
+			regulator-name = "HDD Power";
+			regulator-min-microvolt = <5000000>;
+			regulator-max-microvolt = <5000000>;
+			enable-active-high;
+			regulator-always-on;
+			regulator-boot-on;
+			gpio = <&gpio0 10 0>;
+		};
+	};
 };
diff --git a/arch/arm/mach-kirkwood/board-lsxl.c b/arch/arm/mach-kirkwood/board-lsxl.c
index 83d8975..b9845c0 100644
--- a/arch/arm/mach-kirkwood/board-lsxl.c
+++ b/arch/arm/mach-kirkwood/board-lsxl.c
@@ -19,7 +19,6 @@
 #include <linux/spi/flash.h>
 #include <linux/spi/spi.h>
 #include <linux/mv643xx_eth.h>
-#include <linux/gpio.h>
 #include <linux/gpio-fan.h>
 #include <linux/input.h>
 #include <asm/mach-types.h>
@@ -111,9 +110,6 @@ static void lsxl_power_off(void)
 	kirkwood_restart('h', NULL);
 }
 
-#define LSXL_GPIO_HDD_POWER 10
-#define LSXL_GPIO_USB_POWER 11
-
 void __init lsxl_init(void)
 {
 	/*
@@ -121,10 +117,6 @@ void __init lsxl_init(void)
 	 */
 	kirkwood_mpp_conf(lsxl_mpp_config);
 
-	/* usb and sata power on */
-	gpio_set_value(LSXL_GPIO_USB_POWER, 1);
-	gpio_set_value(LSXL_GPIO_HDD_POWER, 1);
-
 	kirkwood_ehci_init();
 	kirkwood_ge00_init(&lsxl_ge00_data);
 	kirkwood_ge01_init(&lsxl_ge01_data);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 0/5] ARM: Kirkwood: Use fixed regulators
  2012-11-17 14:46 [PATCH 0/5] ARM: Kirkwood: Use fixed regulators Andrew Lunn
                   ` (4 preceding siblings ...)
  2012-11-17 14:46 ` [PATCH 5/5] ARM: Kirkwood: Convert LSXL " Andrew Lunn
@ 2012-11-17 15:00 ` Andrew Lunn
  5 siblings, 0 replies; 7+ messages in thread
From: Andrew Lunn @ 2012-11-17 15:00 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Folks

Forgot to mention, these patches apply on top of the gpio-poweroff
patches, which has been ACKed by the appropriate maintainer.

	Andrew

On Sat, Nov 17, 2012 at 03:46:09PM +0100, Andrew Lunn wrote:
> A few Kirkwood boards use a GPIO line to enable power to subsystems,
> eg USB or SATA devices. Use the regulator framework to control these
> GPIO lines, and describe them in DT rather than C code in the board
> files.
> 
> Posted before as part of the bigger patchset.
> 
> Andrew Lunn (5):
>   ARM: Kirkwood: Enable regulator and fixed regulators.
>   ARM: Kirkwood: Convert DNSKW to use regulators
>   ARM: Kirkwood: Convert Dockstar to use regulators
>   ARM: Kirkwood: Convert GoFlexNet to use regulators
>   ARM: Kirkwood: Convert LSXL to use regulators
> 
>  arch/arm/boot/dts/kirkwood-dnskw.dtsi    |   29 +++++++++++++++++++++++++++++
>  arch/arm/boot/dts/kirkwood-dockstar.dts  |   17 +++++++++++++++++
>  arch/arm/boot/dts/kirkwood-goflexnet.dts |   17 +++++++++++++++++
>  arch/arm/boot/dts/kirkwood-lsxl.dtsi     |   29 +++++++++++++++++++++++++++++
>  arch/arm/mach-kirkwood/Kconfig           |    3 ++-
>  arch/arm/mach-kirkwood/board-dnskw.c     |    4 ----
>  arch/arm/mach-kirkwood/board-dockstar.c  |    4 ----
>  arch/arm/mach-kirkwood/board-goflexnet.c |    4 ----
>  arch/arm/mach-kirkwood/board-lsxl.c      |    8 --------
>  9 files changed, 94 insertions(+), 21 deletions(-)
> 
> -- 
> 1.7.10.4
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-11-17 15:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-17 14:46 [PATCH 0/5] ARM: Kirkwood: Use fixed regulators Andrew Lunn
2012-11-17 14:46 ` [PATCH 1/5] ARM: Kirkwood: Enable regulator and " Andrew Lunn
2012-11-17 14:46 ` [PATCH 2/5] ARM: Kirkwood: Convert DNSKW to use regulators Andrew Lunn
2012-11-17 14:46 ` [PATCH 3/5] ARM: Kirkwood: Convert Dockstar " Andrew Lunn
2012-11-17 14:46 ` [PATCH 4/5] ARM: Kirkwood: Convert GoFlexNet " Andrew Lunn
2012-11-17 14:46 ` [PATCH 5/5] ARM: Kirkwood: Convert LSXL " Andrew Lunn
2012-11-17 15:00 ` [PATCH 0/5] ARM: Kirkwood: Use fixed regulators Andrew Lunn

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.