Commit 6ed75ba78b664c25d1a12312336fdb4a82b54359

Authored by Ladislav Michl
Committed by Tom Rini
1 parent 8a1c1043d5

igep00x0: Cleanup ethernet support

- 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>

Showing 1 changed file with 19 additions and 14 deletions Side-by-side Diff

board/isee/igep00x0/igep00x0.c
... ... @@ -101,6 +101,19 @@
101 101 #endif
102 102  
103 103 #if defined(CONFIG_CMD_NET)
  104 +
  105 +static void reset_net_chip(int gpio)
  106 +{
  107 + if (!gpio_request(gpio, "eth nrst")) {
  108 + gpio_direction_output(gpio, 1);
  109 + udelay(1);
  110 + gpio_set_value(gpio, 0);
  111 + udelay(40);
  112 + gpio_set_value(gpio, 1);
  113 + mdelay(10);
  114 + }
  115 +}
  116 +
104 117 /*
105 118 * Routine: setup_net_chip
106 119 * Description: Setting up the configuration GPMC registers specific to the
... ... @@ -110,8 +123,8 @@
110 123 {
111 124 struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE;
112 125  
113   - enable_gpmc_cs_config(gpmc_lan_config, &gpmc_cfg->cs[5], 0x2C000000,
114   - GPMC_SIZE_16M);
  126 + enable_gpmc_cs_config(gpmc_lan_config, &gpmc_cfg->cs[5],
  127 + CONFIG_SMC911X_BASE, GPMC_SIZE_16M);
115 128  
116 129 /* Enable off mode for NWE in PADCONF_GPMC_NWE register */
117 130 writew(readw(&ctrl_base->gpmc_nwe) | 0x0E00, &ctrl_base->gpmc_nwe);
... ... @@ -121,15 +134,7 @@
121 134 writew(readw(&ctrl_base->gpmc_nadv_ale) | 0x0E00,
122 135 &ctrl_base->gpmc_nadv_ale);
123 136  
124   - /* Make GPIO 64 as output pin and send a magic pulse through it */
125   - if (!gpio_request(64, "")) {
126   - gpio_direction_output(64, 0);
127   - gpio_set_value(64, 1);
128   - udelay(1);
129   - gpio_set_value(64, 0);
130   - udelay(1);
131   - gpio_set_value(64, 1);
132   - }
  137 + reset_net_chip(64);
133 138 }
134 139 #else
135 140 static inline void setup_net_chip(void) {}
136 141  
137 142  
... ... @@ -200,11 +205,11 @@
200 205 #if defined(CONFIG_CMD_NET)
201 206 int board_eth_init(bd_t *bis)
202 207 {
203   - int rc = 0;
204 208 #ifdef CONFIG_SMC911X
205   - rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
  209 + return smc911x_initialize(0, CONFIG_SMC911X_BASE);
  210 +#else
  211 + return 0;
206 212 #endif
207   - return rc;
208 213 }
209 214 #endif