diff mbox

[U-Boot,PATCHv2,2/5] igep00x0: Cleanup ethernet support

Message ID 1451945282-7600-3-git-send-email-enric.balletbo@collabora.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Enric Balletbo Serra Jan. 4, 2016, 10:07 p.m. UTC
From: Ladislav Michl <ladis@linux-mips.org>

- move chip reset to separate function
- use CONFIG_SMC911X_BASE instead of hardcoded value
- remove unneeded local variable from board_eth_init.

Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Acked-by: Enric Balletbo Serra <enric.balletbo@collabora.com>
---
 board/isee/igep00x0/igep00x0.c | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

Comments

Heiko Schocher Jan. 20, 2016, 5:24 a.m. UTC | #1
Hello Tom,

Am 04.01.2016 um 23:07 schrieb Enric Balletbò i Serra:
> From: Ladislav Michl <ladis@linux-mips.org>
>
> - move chip reset to separate function
> - use CONFIG_SMC911X_BASE instead of hardcoded value
> - remove unneeded local variable from board_eth_init.
>
> Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
> Reviewed-by: Tom Rini <trini@konsulko.com>
> Acked-by: Enric Balletbo Serra <enric.balletbo@collabora.com>
> ---
>   board/isee/igep00x0/igep00x0.c | 33 +++++++++++++++++++--------------
>   1 file changed, 19 insertions(+), 14 deletions(-)

Reviewed-by: Heiko Schocher <hs@denx.de>

Tom? Is it OK if I apply this patch to u-boot-ubi.git, as the SPL ubi
patches depend on this series?

bye,
Heiko
Tom Rini Jan. 20, 2016, 3:02 p.m. UTC | #2
On Wed, Jan 20, 2016 at 06:24:40AM +0100, Heiko Schocher wrote:
> Hello Tom,
> 
> Am 04.01.2016 um 23:07 schrieb Enric Balletbò i Serra:
> >From: Ladislav Michl <ladis@linux-mips.org>
> >
> >- move chip reset to separate function
> >- use CONFIG_SMC911X_BASE instead of hardcoded value
> >- remove unneeded local variable from board_eth_init.
> >
> >Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
> >Reviewed-by: Tom Rini <trini@konsulko.com>
> >Acked-by: Enric Balletbo Serra <enric.balletbo@collabora.com>
> >---
> >  board/isee/igep00x0/igep00x0.c | 33 +++++++++++++++++++--------------
> >  1 file changed, 19 insertions(+), 14 deletions(-)
> 
> Reviewed-by: Heiko Schocher <hs@denx.de>
> 
> Tom? Is it OK if I apply this patch to u-boot-ubi.git, as the SPL ubi
> patches depend on this series?

I'll pick up this series (and some other TI platform stuff) in the next
day or two, thanks!
Tom Rini Jan. 20, 2016, 9:01 p.m. UTC | #3
On Mon, Jan 04, 2016 at 11:07:59PM +0100, Enric Balletbò i Serra wrote:

> From: Ladislav Michl <ladis@linux-mips.org>
> 
> - move chip reset to separate function
> - use CONFIG_SMC911X_BASE instead of hardcoded value
> - remove unneeded local variable from board_eth_init.
> 
> Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
> Reviewed-by: Tom Rini <trini@konsulko.com>
> Acked-by: Enric Balletbo Serra <enric.balletbo@collabora.com>
> Reviewed-by: Heiko Schocher <hs@denx.de>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/board/isee/igep00x0/igep00x0.c b/board/isee/igep00x0/igep00x0.c
index 57b89e0..e2fce50 100644
--- a/board/isee/igep00x0/igep00x0.c
+++ b/board/isee/igep00x0/igep00x0.c
@@ -101,6 +101,19 @@  void get_board_mem_timings(struct board_sdrc_timings *timings)
 #endif
 
 #if defined(CONFIG_CMD_NET)
+
+static void reset_net_chip(int gpio)
+{
+	if (!gpio_request(gpio, "eth nrst")) {
+		gpio_direction_output(gpio, 1);
+		udelay(1);
+		gpio_set_value(gpio, 0);
+		udelay(40);
+		gpio_set_value(gpio, 1);
+		mdelay(10);
+	}
+}
+
 /*
  * Routine: setup_net_chip
  * Description: Setting up the configuration GPMC registers specific to the
@@ -110,8 +123,8 @@  static void setup_net_chip(void)
 {
 	struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE;
 
-	enable_gpmc_cs_config(gpmc_lan_config, &gpmc_cfg->cs[5], 0x2C000000,
-			GPMC_SIZE_16M);
+	enable_gpmc_cs_config(gpmc_lan_config, &gpmc_cfg->cs[5],
+			CONFIG_SMC911X_BASE, GPMC_SIZE_16M);
 
 	/* Enable off mode for NWE in PADCONF_GPMC_NWE register */
 	writew(readw(&ctrl_base->gpmc_nwe) | 0x0E00, &ctrl_base->gpmc_nwe);
@@ -121,15 +134,7 @@  static void setup_net_chip(void)
 	writew(readw(&ctrl_base->gpmc_nadv_ale) | 0x0E00,
 		&ctrl_base->gpmc_nadv_ale);
 
-	/* Make GPIO 64 as output pin and send a magic pulse through it */
-	if (!gpio_request(64, "")) {
-		gpio_direction_output(64, 0);
-		gpio_set_value(64, 1);
-		udelay(1);
-		gpio_set_value(64, 0);
-		udelay(1);
-		gpio_set_value(64, 1);
-	}
+	reset_net_chip(64);
 }
 #else
 static inline void setup_net_chip(void) {}
@@ -200,10 +205,10 @@  void set_muxconf_regs(void)
 #if defined(CONFIG_CMD_NET)
 int board_eth_init(bd_t *bis)
 {
-	int rc = 0;
 #ifdef CONFIG_SMC911X
-	rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
+	return smc911x_initialize(0, CONFIG_SMC911X_BASE);
+#else
+	return 0;
 #endif
-	return rc;
 }
 #endif