Skip to contentSkip to conversation

ARM: iop32x: fix reset handling for the EM7210 board

PATCH New Linus Walleij 3 participants 4 messages Jan 29, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: iop32x: fix reset handling for the EM7210 board

This board was missed when converting all the others to proper abstracted GPIO handling. Fix it up the right way by requesting and driving GPIO line 0 high through gpiolib to reset the machine.

---
ARM SoC folks, if you're happy with this fix, please apply it directly to fixes in the ARM SoC tree.

---
 arch/arm/mach-iop32x/em7210.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
arch/arm/mach-iop32x/em7210.c +13 -3
index 177cd073a83b..e0c4187f3799 100644
@@ -23,6 +23,7 @@
 #include <linux/mtd/physmap.h>
 #include <linux/platform_device.h>
 #include <linux/i2c.h>
+#include <linux/gpio.h>
 #include <mach/hardware.h>
 #include <linux/io.h>
 #include <linux/irq.h>
@@ -176,14 +177,21 @@ static struct platform_device em7210_serial_device = {
 	.resource	= &em7210_uart_resource,
 };
 
+#define EM7210_HARDWARE_RESET 0
+
 void em7210_power_off(void)
 {
-	*IOP3XX_GPOE &= 0xfe;
-	*IOP3XX_GPOD |= 0x01;
+	int ret;
+
+	ret = gpio_direction_output(EM7210_HARDWARE_RESET, 1);
+	if (ret)
+		pr_crit("could not drive reset GPIO high\n");
 }
 
 static void __init em7210_init_machine(void)
 {
+	int ret;
+
 	register_iop32x_gpio();
 	platform_device_register(&em7210_serial_device);
 	platform_device_register(&iop3xx_i2c0_device);
@@ -194,7 +202,9 @@ static void __init em7210_init_machine(void)
 
 	i2c_register_board_info(0, em7210_i2c_devices,
 		ARRAY_SIZE(em7210_i2c_devices));
-
+	ret = gpio_request(EM7210_HARDWARE_RESET, "reset");
+	if (ret)
+		pr_err("could not request reset GPIO\n");
 
 	pm_power_off = em7210_power_off;
 }
Signature · 1 line
1.8.5.3
#1 lore raw

PATCH 1/1 ARM: iop32x: fix reset handling for the EM7210 board

Linus Walleij <[email protected]> writes:

Hi,

don't know how to comment about the subjet but it's _not_ about resetting the board but about powering it off.

Quoted 26 lines

This board was missed when converting all the others to proper abstracted GPIO handling. Fix it up the right way by requesting and driving GPIO line 0 high through gpiolib to reset the machine.

---
ARM SoC folks, if you're happy with this fix, please apply it directly to fixes in the ARM SoC tree.

---
 arch/arm/mach-iop32x/em7210.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
arch/arm/mach-iop32x/em7210.c +1 -0
index 177cd073a83b..e0c4187f3799 100644
@@ -23,6 +23,7 @@
 #include <linux/mtd/physmap.h>
 #include <linux/platform_device.h>
 #include <linux/i2c.h>
+#include <linux/gpio.h>
 #include <mach/hardware.h>
 #include <linux/io.h>
 #include <linux/irq.h>

arch/arm/mach-iop32x/em7210.c static struct platform_device em7210_serial_device = { · line 181

Quoted 5 lines
arch/arm/mach-iop32x/em7210.c +2 -0
@@ -176,14 +177,21 @@ static struct platform_device em7210_serial_device = {
 	.resource	= &em7210_uart_resource,
 };
 
+#define EM7210_HARDWARE_RESET 0
+

please fix accoring to my previous comment.

Quoted 19 lines
arch/arm/mach-iop32x/em7210.c +7 -2
 void em7210_power_off(void)
 {
-	*IOP3XX_GPOE &= 0xfe;
-	*IOP3XX_GPOD |= 0x01;
+	int ret;
+
+	ret = gpio_direction_output(EM7210_HARDWARE_RESET, 1);
+	if (ret)
+		pr_crit("could not drive reset GPIO high\n");
 }
 
 static void __init em7210_init_machine(void)
 {
+	int ret;
+
 	register_iop32x_gpio();
 	platform_device_register(&em7210_serial_device);
 	platform_device_register(&iop3xx_i2c0_device);

arch/arm/mach-iop32x/em7210.c static void __init em7210_init_machine(void) · line 207

Quoted 7 lines
arch/arm/mach-iop32x/em7210.c +3 -1
@@ -194,7 +202,9 @@ static void __init em7210_init_machine(void)
 
 	i2c_register_board_info(0, em7210_i2c_devices,
 		ARRAY_SIZE(em7210_i2c_devices));
-
+	ret = gpio_request(EM7210_HARDWARE_RESET, "reset");
+	if (ret)
+		pr_err("could not request reset GPIO\n");

no chance to work. too early. you'll get a -EPROBE_DEFER.

Arnaud

#2 lore raw

PATCH 1/1 ARM: iop32x: fix reset handling for the EM7210 board

Quoted 4 lines · Arnaud Patard

Linus Walleij <[email protected]> writes:

don't know how to comment about the subjet but it's _not_ about resetting the board but about powering it off.

Aha sorry I'll respin with updated text.

Quoted 5 lines
Quoted 5 lines
      register_iop32x_gpio();
      platform_device_register(&em7210_serial_device);
      platform_device_register(&iop3xx_i2c0_device);
(quoted diff) +0 -0
@@ -194,7 +202,9 @@ static void __init em7210_init_machine(void)
 
Quoted 8 lines

arch/arm/mach-iop32x/em7210.c static void __init em7210_init_machine(void) · line 207

Quoted 6 lines
arch/arm/mach-iop32x/em7210.c +3 -1
      i2c_register_board_info(0, em7210_i2c_devices,
              ARRAY_SIZE(em7210_i2c_devices));
-
+     ret = gpio_request(EM7210_HARDWARE_RESET, "reset");
+     if (ret)
+             pr_err("could not request reset GPIO\n");

no chance to work. too early. you'll get a -EPROBE_DEFER.

Yeah that's right, I remember now that I added a separate device_initcall() on the N2100 for this. Thanks, I'll respin that.

Yours,
Linus Walleij

#3 lore raw

PATCH 1/1 ARM: iop32x: fix reset handling for the EM7210 board

In reply to Linus Walleij
Quoted 6 lines · Linus Walleij

This board was missed when converting all the others to proper abstracted GPIO handling. Fix it up the right way by requesting and driving GPIO line 0 high through gpiolib to reset the machine.

Thanks for the prompt resolution. Aside from what Arnaud mentioned,