Convert power recovery pin to a fixed regulator
Subsystems (3)
cover Convert power recovery pin to a fixed regulator
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
Signature · 1 line
1.8.3.1
PATCH 1/2 Convert power recovery pin to a fixed regulator
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.
--- arch/arm/boot/dts/kirkwood-dnskw.dtsi | 13 +++++++++++++ arch/arm/mach-kirkwood/board-dnskw.c | 15 --------------- 2 files changed, 13 insertions(+), 15 deletions(-)
arch/arm/boot/dts/kirkwood-dnskw.dtsi +13 -0
@@ -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; + }; }; };
arch/arm/mach-kirkwood/board-dnskw.c +0 -15
@@ -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 ); }
Signature · 1 line
1.8.3.1
PATCH 1/2 Convert power recovery pin to a fixed regulator
Quoted 4 lines · Jamie Lentin
dnskw_gpio_register()is broken, and probably has been for a while, sincednskw_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>
PATCH 1/2 Convert power recovery pin to a fixed regulator
Quoted 9 lines · Mark Brown
Quoted 4 lines · Jamie Lentin
dnskw_gpio_register()is broken, and probably has been for a while, sincednskw_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.
PATCH 1/2 Convert power recovery pin to a fixed regulator
Quoted 7 lines · Jason Cooper
Quoted 6 lines · Mark Brown
Quoted 4 lines · Jamie Lentin
dnskw_gpio_register()is broken, and probably has been for a while, sincednskw_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.
Quoted 5 lines
Quoted 3 lines
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!
Quoted 6 lines
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.
Quoted 4 lines
thx,
Jason.
Signature · 1 line
Jamie Lentin
PATCH 2/2 Remove all remaining trace of DNS-320/325 platform code
In reply to Jamie LentinNo platform code left now, so remove all references to it.
--- 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
arch/arm/configs/kirkwood_defconfig +0 -1
@@ -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
arch/arm/mach-kirkwood/Kconfig +0 -8
@@ -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
arch/arm/mach-kirkwood/Makefile +0 -1
@@ -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
arch/arm/mach-kirkwood/board-dnskw.c deleted +0 -21
@@ -1,21 +0,0 @@ -/* -* Copyright 2012 (C), Jamie Lentin <[email protected]> -* -* 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 ) -{ -}
arch/arm/mach-kirkwood/board-dt.c +0 -3
@@ -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 ();
arch/arm/mach-kirkwood/common.h +0 -6
@@ -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
Signature · 1 line
1.8.3.1
Jason Cooper
AppliedPATCH 2/2 Remove all remaining trace of DNS-320/325 platform code
Quoted 12 lines · Jamie Lentin
No platform code left now, so remove all references to it.
Signed-off-by Jamie Lentin <[email protected]>--- 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.
PATCH 1/1 ARM: kirkwood: fix DT building and update defconfig
In reply to Jamie Lentincommit
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.
---
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(-)
arch/arm/configs/kirkwood_defconfig +4 -13
@@ -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
arch/arm/mach-kirkwood/Kconfig +2 -1
@@ -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).
Signature · 1 line
1.8.3.2