linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Convert power recovery pin to a fixed regulator
@ 2013-08-11 14:26 Jamie Lentin
  2013-08-11 14:26 ` [PATCH 1/2] " Jamie Lentin
  2013-08-11 14:26 ` [PATCH 2/2] Remove all remaining trace of DNS-320/325 platform code Jamie Lentin
  0 siblings, 2 replies; 8+ messages in thread
From: Jamie Lentin @ 2013-08-11 14:26 UTC (permalink / raw)
  To: linux-arm-kernel

The platform code to pull the power recovery pin high is broken, since
it's called too early for to register the GPIO. This has probably been
the case for some time and I'd not noticed.

This was the last bit of platform-specific code, so the second patch
tidies up.

I don't really like using a regulator for this, it's a configuration
option that's only vaguely related to power. However, this does at
least work. A separate driver could be written, but the code noise that
generates seems even worse.

This is based on mevbu's for-next (git://git.infradead.org/linux-mvebu.git
for-next), and tested on a DNS-320.

Jamie Lentin (2):
  Convert power recovery pin to a fixed regulator
  Remove all remaining trace of DNS-320/325 platform code

 arch/arm/boot/dts/kirkwood-dnskw.dtsi | 13 +++++++++++++
 arch/arm/configs/kirkwood_defconfig   |  1 -
 arch/arm/mach-kirkwood/Kconfig        |  8 --------
 arch/arm/mach-kirkwood/Makefile       |  1 -
 arch/arm/mach-kirkwood/board-dnskw.c  | 36 -----------------------------------
 arch/arm/mach-kirkwood/board-dt.c     |  3 ---
 arch/arm/mach-kirkwood/common.h       |  6 ------
 7 files changed, 13 insertions(+), 55 deletions(-)
 delete mode 100644 arch/arm/mach-kirkwood/board-dnskw.c

-- 
1.8.3.1

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

* [PATCH 1/2] Convert power recovery pin to a fixed regulator
  2013-08-11 14:26 [PATCH 0/2] Convert power recovery pin to a fixed regulator Jamie Lentin
@ 2013-08-11 14:26 ` Jamie Lentin
  2013-08-11 18:24   ` Mark Brown
  2013-08-11 14:26 ` [PATCH 2/2] Remove all remaining trace of DNS-320/325 platform code Jamie Lentin
  1 sibling, 1 reply; 8+ messages in thread
From: Jamie Lentin @ 2013-08-11 14:26 UTC (permalink / raw)
  To: linux-arm-kernel

dnskw_gpio_register() is broken, and probably has been for a while,
since dnskw_init() is called too early to register GPIOs. Instead use a
fixed regulator to turn the pin high, which knows to defer the
registration until later.

Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
---
 arch/arm/boot/dts/kirkwood-dnskw.dtsi | 13 +++++++++++++
 arch/arm/mach-kirkwood/board-dnskw.c  | 15 ---------------
 2 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/arch/arm/boot/dts/kirkwood-dnskw.dtsi b/arch/arm/boot/dts/kirkwood-dnskw.dtsi
index d544f77..9e74127 100644
--- a/arch/arm/boot/dts/kirkwood-dnskw.dtsi
+++ b/arch/arm/boot/dts/kirkwood-dnskw.dtsi
@@ -217,6 +217,19 @@
 			regulator-boot-on;
 			gpio = <&gpio1 8 0>;
 		};
+		power_back_on: regulator at 3 {
+			/* Turning this pin high means the NAS will turn on
+			immediately after a power failure. */
+			compatible = "regulator-fixed";
+			reg = <3>;
+			regulator-name = "Recover after power failure";
+			regulator-min-microvolt = <5000000>;
+			regulator-max-microvolt = <5000000>;
+			regulator-always-on;
+			regulator-boot-on;
+			gpio = <&gpio1 5 0>;
+			enable-active-high;
+		};
 	};
 };
 
diff --git a/arch/arm/mach-kirkwood/board-dnskw.c b/arch/arm/mach-kirkwood/board-dnskw.c
index 2af7a95..0b441b9 100644
--- a/arch/arm/mach-kirkwood/board-dnskw.c
+++ b/arch/arm/mach-kirkwood/board-dnskw.c
@@ -14,23 +14,8 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/gpio.h>
 #include "common.h"
 
-/* Register any GPIO for output and set the value */
-static void __init dnskw_gpio_register(unsigned gpio, char *name, int def)
-{
-	if (gpio_request(gpio, name) == 0 &&
-	    gpio_direction_output(gpio, 0) == 0) {
-		gpio_set_value(gpio, def);
-		if (gpio_export(gpio, 0) != 0)
-			pr_err("dnskw: Failed to export GPIO %s\n", name);
-	} else
-		pr_err("dnskw: Failed to register %s\n", name);
-}
-
 void __init dnskw_init(void)
 {
-	/* Set NAS to turn back on after a power failure */
-	dnskw_gpio_register(37, "dnskw:power:recover", 1);
 }
-- 
1.8.3.1

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

* [PATCH 2/2] Remove all remaining trace of DNS-320/325 platform code
  2013-08-11 14:26 [PATCH 0/2] Convert power recovery pin to a fixed regulator Jamie Lentin
  2013-08-11 14:26 ` [PATCH 1/2] " Jamie Lentin
@ 2013-08-11 14:26 ` Jamie Lentin
  2013-08-12 17:38   ` Jason Cooper
  2013-08-12 18:51   ` [PATCH] ARM: kirkwood: fix DT building and update defconfig Jason Cooper
  1 sibling, 2 replies; 8+ messages in thread
From: Jamie Lentin @ 2013-08-11 14:26 UTC (permalink / raw)
  To: linux-arm-kernel

No platform code left now, so remove all references to it.

Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
---
 arch/arm/configs/kirkwood_defconfig  |  1 -
 arch/arm/mach-kirkwood/Kconfig       |  8 --------
 arch/arm/mach-kirkwood/Makefile      |  1 -
 arch/arm/mach-kirkwood/board-dnskw.c | 21 ---------------------
 arch/arm/mach-kirkwood/board-dt.c    |  3 ---
 arch/arm/mach-kirkwood/common.h      |  6 ------
 6 files changed, 40 deletions(-)
 delete mode 100644 arch/arm/mach-kirkwood/board-dnskw.c

diff --git a/arch/arm/configs/kirkwood_defconfig b/arch/arm/configs/kirkwood_defconfig
index 19e0f2f..71bb429 100644
--- a/arch/arm/configs/kirkwood_defconfig
+++ b/arch/arm/configs/kirkwood_defconfig
@@ -29,7 +29,6 @@ CONFIG_MACH_SHEEVAPLUG=y
 CONFIG_MACH_T5325=y
 CONFIG_MACH_TS219=y
 CONFIG_MACH_TS41X=y
-CONFIG_MACH_DLINK_KIRKWOOD_DT=y
 # CONFIG_CPU_FEROCEON_OLD_ID is not set
 CONFIG_PCI_MVEBU=y
 CONFIG_PREEMPT=y
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index 780bca0..94540d5 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -105,14 +105,6 @@ config ARCH_KIRKWOOD_DT
 	  Say 'Y' here if you want your kernel to support the
 	  Marvell Kirkwood using flattened device tree.
 
-config MACH_DLINK_KIRKWOOD_DT
-	bool "D-Link Kirkwood-based NAS (Flattened Device Tree)"
-	select ARCH_KIRKWOOD_DT
-	help
-	  Say 'Y' here if you want your kernel to support the
-	  Kirkwood-based D-Link NASes such as DNS-320 & DNS-325,
-	  using Flattened Device Tree.
-
 config MACH_MV88F6281GTW_GE_DT
 	bool "Marvell 88F6281 GTW GE Board (Flattened Device Tree)"
 	select ARCH_KIRKWOOD_DT
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index 937d4e1..d1f8e3d 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -11,5 +11,4 @@ obj-$(CONFIG_MACH_TS219)		+= ts219-setup.o tsx1x-common.o
 obj-$(CONFIG_MACH_TS41X)		+= ts41x-setup.o tsx1x-common.o
 
 obj-$(CONFIG_ARCH_KIRKWOOD_DT)		+= board-dt.o
-obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT)	+= board-dnskw.o
 obj-$(CONFIG_MACH_MV88F6281GTW_GE_DT)	+= board-mv88f6281gtw_ge.o
diff --git a/arch/arm/mach-kirkwood/board-dnskw.c b/arch/arm/mach-kirkwood/board-dnskw.c
deleted file mode 100644
index 0b441b9..0000000
--- a/arch/arm/mach-kirkwood/board-dnskw.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright 2012 (C), Jamie Lentin <jm@lentin.co.uk>
- *
- * arch/arm/mach-kirkwood/board-dnskw.c
- *
- * D-link DNS-320 & DNS-325 NAS Init for drivers not converted to
- * flattened device tree yet.
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2.  This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include "common.h"
-
-void __init dnskw_init(void)
-{
-}
diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
index 713be4f..82d3ad8 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -107,9 +107,6 @@ static void __init kirkwood_dt_init(void)
 	kexec_reinit = kirkwood_enable_pcie;
 #endif
 
-	if (of_machine_is_compatible("dlink,dns-kirkwood"))
-		dnskw_init();
-
 	if (of_machine_is_compatible("marvell,mv88f6281gtw-ge"))
 		mv88f6281gtw_ge_init();
 
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index cc639bb..1296de9 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -59,12 +59,6 @@ void kirkwood_restart(enum reboot_mode, const char *);
 void kirkwood_clk_init(void);
 
 /* board init functions for boards not fully converted to fdt */
-#ifdef CONFIG_MACH_DLINK_KIRKWOOD_DT
-void dnskw_init(void);
-#else
-static inline void dnskw_init(void) {};
-#endif
-
 #ifdef CONFIG_MACH_MV88F6281GTW_GE_DT
 void mv88f6281gtw_ge_init(void);
 #else
-- 
1.8.3.1

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

* [PATCH 1/2] Convert power recovery pin to a fixed regulator
  2013-08-11 14:26 ` [PATCH 1/2] " Jamie Lentin
@ 2013-08-11 18:24   ` Mark Brown
  2013-08-12 16:51     ` Jason Cooper
  0 siblings, 1 reply; 8+ messages in thread
From: Mark Brown @ 2013-08-11 18:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Aug 11, 2013 at 03:26:49PM +0100, Jamie Lentin wrote:
> dnskw_gpio_register() is broken, and probably has been for a while,
> since dnskw_init() is called too early to register GPIOs. Instead use a
> fixed regulator to turn the pin high, which knows to defer the
> registration until later.

So, this is really abuse of the regulator API since it knows how to set
a GPIO.  Perhaps the reset controller might be a better fit, or pinctrl
defaults?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130811/d37d8977/attachment.sig>

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

* [PATCH 1/2] Convert power recovery pin to a fixed regulator
  2013-08-11 18:24   ` Mark Brown
@ 2013-08-12 16:51     ` Jason Cooper
  2013-08-12 17:03       ` Jamie Lentin
  0 siblings, 1 reply; 8+ messages in thread
From: Jason Cooper @ 2013-08-12 16:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Aug 11, 2013 at 07:24:44PM +0100, Mark Brown wrote:
> On Sun, Aug 11, 2013 at 03:26:49PM +0100, Jamie Lentin wrote:
> > dnskw_gpio_register() is broken, and probably has been for a while,
> > since dnskw_init() is called too early to register GPIOs. Instead use a
> > fixed regulator to turn the pin high, which knows to defer the
> > registration until later.
> 
> So, this is really abuse of the regulator API since it knows how to set
> a GPIO.  Perhaps the reset controller might be a better fit, or pinctrl
> defaults?

I vote for the reset controller.

Jamie, I'm taking the deletion part of both of these patches since it
didn't work any way and it's the last holdout of DT platform code in
kirkwood.

Once you get the DT node nailed down for the reset pin, just submit it
by itself.

thx,

Jason.

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

* [PATCH 1/2] Convert power recovery pin to a fixed regulator
  2013-08-12 16:51     ` Jason Cooper
@ 2013-08-12 17:03       ` Jamie Lentin
  0 siblings, 0 replies; 8+ messages in thread
From: Jamie Lentin @ 2013-08-12 17:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 12 Aug 2013, Jason Cooper wrote:

> On Sun, Aug 11, 2013 at 07:24:44PM +0100, Mark Brown wrote:
>> On Sun, Aug 11, 2013 at 03:26:49PM +0100, Jamie Lentin wrote:
>>> dnskw_gpio_register() is broken, and probably has been for a while,
>>> since dnskw_init() is called too early to register GPIOs. Instead use a
>>> fixed regulator to turn the pin high, which knows to defer the
>>> registration until later.
>>
>> So, this is really abuse of the regulator API since it knows how to set
>> a GPIO.  Perhaps the reset controller might be a better fit, or pinctrl
>> defaults?
>
> I vote for the reset controller.

Okay, will rummage and come back with a separate patch. Thanks for your 
suggestions!

> Jamie, I'm taking the deletion part of both of these patches since it
> didn't work any way and it's the last holdout of DT platform code in
> kirkwood.
>
> Once you get the DT node nailed down for the reset pin, just submit it
> by itself.

Please do, the code isn't in any way useful.

> thx,
>
> Jason.
>

-- 
Jamie Lentin

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

* [PATCH 2/2] Remove all remaining trace of DNS-320/325 platform code
  2013-08-11 14:26 ` [PATCH 2/2] Remove all remaining trace of DNS-320/325 platform code Jamie Lentin
@ 2013-08-12 17:38   ` Jason Cooper
  2013-08-12 18:51   ` [PATCH] ARM: kirkwood: fix DT building and update defconfig Jason Cooper
  1 sibling, 0 replies; 8+ messages in thread
From: Jason Cooper @ 2013-08-12 17:38 UTC (permalink / raw)
  To: linux-arm-kernel

On Sun, Aug 11, 2013 at 03:26:50PM +0100, Jamie Lentin wrote:
> No platform code left now, so remove all references to it.
> 
> Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
> ---
>  arch/arm/configs/kirkwood_defconfig  |  1 -
>  arch/arm/mach-kirkwood/Kconfig       |  8 --------
>  arch/arm/mach-kirkwood/Makefile      |  1 -
>  arch/arm/mach-kirkwood/board-dnskw.c | 21 ---------------------
>  arch/arm/mach-kirkwood/board-dt.c    |  3 ---
>  arch/arm/mach-kirkwood/common.h      |  6 ------
>  6 files changed, 40 deletions(-)
>  delete mode 100644 arch/arm/mach-kirkwood/board-dnskw.c

Applied to mvebu/boards without patch #1.  Added a note to the commit re
the reset gpio never working.

thx,

Jason.

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

* [PATCH] ARM: kirkwood: fix DT building and update defconfig
  2013-08-11 14:26 ` [PATCH 2/2] Remove all remaining trace of DNS-320/325 platform code Jamie Lentin
  2013-08-12 17:38   ` Jason Cooper
@ 2013-08-12 18:51   ` Jason Cooper
  1 sibling, 0 replies; 8+ messages in thread
From: Jason Cooper @ 2013-08-12 18:51 UTC (permalink / raw)
  To: linux-arm-kernel

commit

  844703c ARM: kirkwood: Remove all remaining trace of DNS-320/325 platform code

removed the last kirkwood DT/platform board in kirkwood_defconfig, this
triggered a rescan of the config symbols, the result of which breaks the
build because KIRKWOOD_DT does not select OF_IRQ.

This commit fixes the regression and updates the defconfig to
explicitly enable SERIAL_OF_PLATFORM and KIRWOOD_DT.

Signed-off-by: Jason Cooper <jason@lakedaemon.net>
---
Note: I switch the one remaining DT board to 'depends on' so that once it's
removed, KIRKWOOD_DT will still be in the defconfig.  With 'select', the board
is there, but not KIRKWOOD_DT as it's implied.

 arch/arm/configs/kirkwood_defconfig | 17 ++++-------------
 arch/arm/mach-kirkwood/Kconfig      |  3 ++-
 2 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/arch/arm/configs/kirkwood_defconfig b/arch/arm/configs/kirkwood_defconfig
index d9ea71f..e3f667a 100644
--- a/arch/arm/configs/kirkwood_defconfig
+++ b/arch/arm/configs/kirkwood_defconfig
@@ -10,25 +10,18 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_BLK_DEV_BSG is not set
 CONFIG_ARCH_KIRKWOOD=y
 CONFIG_MACH_D2NET_V2=y
-CONFIG_MACH_DB88F6281_BP=y
-CONFIG_MACH_DOCKSTAR=y
-CONFIG_MACH_ESATA_SHEEVAPLUG=y
-CONFIG_MACH_GURUPLUG=y
-CONFIG_MACH_INETSPACE_V2=y
-CONFIG_MACH_MV88F6281GTW_GE=y
 CONFIG_MACH_NET2BIG_V2=y
 CONFIG_MACH_NET5BIG_V2=y
-CONFIG_MACH_NETSPACE_MAX_V2=y
-CONFIG_MACH_NETSPACE_V2=y
 CONFIG_MACH_OPENRD_BASE=y
 CONFIG_MACH_OPENRD_CLIENT=y
 CONFIG_MACH_OPENRD_ULTIMATE=y
 CONFIG_MACH_RD88F6192_NAS=y
 CONFIG_MACH_RD88F6281=y
-CONFIG_MACH_SHEEVAPLUG=y
 CONFIG_MACH_T5325=y
 CONFIG_MACH_TS219=y
 CONFIG_MACH_TS41X=y
+CONFIG_ARCH_KIRKWOOD_DT=y
+CONFIG_MACH_MV88F6281GTW_GE_DT=y
 # CONFIG_CPU_FEROCEON_OLD_ID is not set
 CONFIG_PCI_MVEBU=y
 CONFIG_PREEMPT=y
@@ -76,7 +69,6 @@ CONFIG_ATA=y
 CONFIG_SATA_AHCI=y
 CONFIG_SATA_MV=y
 CONFIG_NETDEVICES=y
-CONFIG_MII=y
 CONFIG_NET_DSA_MV88E6123_61_65=y
 CONFIG_MV643XX_ETH=y
 CONFIG_MARVELL_PHY=y
@@ -101,7 +93,6 @@ CONFIG_SPI_ORION=y
 CONFIG_GPIO_SYSFS=y
 # CONFIG_HWMON is not set
 CONFIG_THERMAL=y
-CONFIG_KIRKWOOD_THERMAL=y
 CONFIG_WATCHDOG=y
 CONFIG_ORION_WATCHDOG=y
 CONFIG_HID_DRAGONRISE=y
@@ -162,12 +153,12 @@ CONFIG_NLS_CODEPAGE_850=y
 CONFIG_NLS_ISO8859_1=y
 CONFIG_NLS_ISO8859_2=y
 CONFIG_NLS_UTF8=y
-CONFIG_MAGIC_SYSRQ=y
+CONFIG_DEBUG_INFO=y
 CONFIG_DEBUG_FS=y
+CONFIG_MAGIC_SYSRQ=y
 CONFIG_DEBUG_KERNEL=y
 # CONFIG_SCHED_DEBUG is not set
 # CONFIG_DEBUG_PREEMPT is not set
-CONFIG_DEBUG_INFO=y
 # CONFIG_FTRACE is not set
 CONFIG_DEBUG_USER=y
 CONFIG_DEBUG_LL=y
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index 94540d5..fe8319a 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -93,6 +93,7 @@ comment "Device tree entries"
 config ARCH_KIRKWOOD_DT
 	bool "Marvell Kirkwood Flattened Device Tree"
 	select KIRKWOOD_CLK
+	select OF_IRQ
 	select ORION_IRQCHIP
 	select ORION_TIMER
 	select POWER_SUPPLY
@@ -107,7 +108,7 @@ config ARCH_KIRKWOOD_DT
 
 config MACH_MV88F6281GTW_GE_DT
 	bool "Marvell 88F6281 GTW GE Board (Flattened Device Tree)"
-	select ARCH_KIRKWOOD_DT
+	depends on ARCH_KIRKWOOD_DT
 	help
 	  Say 'Y' here if you want your kernel to support the
 	  Marvell 88F6281 GTW GE Board (Flattened Device Tree).
-- 
1.8.3.2

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

end of thread, other threads:[~2013-08-12 18:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-11 14:26 [PATCH 0/2] Convert power recovery pin to a fixed regulator Jamie Lentin
2013-08-11 14:26 ` [PATCH 1/2] " Jamie Lentin
2013-08-11 18:24   ` Mark Brown
2013-08-12 16:51     ` Jason Cooper
2013-08-12 17:03       ` Jamie Lentin
2013-08-11 14:26 ` [PATCH 2/2] Remove all remaining trace of DNS-320/325 platform code Jamie Lentin
2013-08-12 17:38   ` Jason Cooper
2013-08-12 18:51   ` [PATCH] ARM: kirkwood: fix DT building and update defconfig Jason Cooper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).