diff --git a/sys/arm/allwinner/a10_gpio.c b/sys/arm/allwinner/a10_gpio.c index b2dca00bf688..c461013431ab 100644 --- a/sys/arm/allwinner/a10_gpio.c +++ b/sys/arm/allwinner/a10_gpio.c @@ -524,8 +524,9 @@ static driver_t a10_gpio_driver = { DRIVER_MODULE(a10_gpio, simplebus, a10_gpio_driver, a10_gpio_devclass, 0, 0); int -a10_emac_gpio_config(uint32_t pin) +a10_gpio_ethernet_activate(uint32_t func) { + int i; struct a10_gpio_softc *sc = a10_gpio_sc; if (sc == NULL) @@ -533,7 +534,8 @@ a10_emac_gpio_config(uint32_t pin) /* Configure pin mux settings for MII. */ A10_GPIO_LOCK(sc); - a10_gpio_set_function(sc, pin, A10_GPIO_PULLDOWN); + for (i = 0; i <= 17; i++) + a10_gpio_set_function(sc, i, func); A10_GPIO_UNLOCK(sc); return (0); diff --git a/sys/arm/allwinner/a10_gpio.h b/sys/arm/allwinner/a10_gpio.h index 0e1dc8688729..e78b18f5226b 100644 --- a/sys/arm/allwinner/a10_gpio.h +++ b/sys/arm/allwinner/a10_gpio.h @@ -29,6 +29,9 @@ #ifndef _A10_GPIO_H_ #define _A10_GPIO_H_ -int a10_emac_gpio_config(uint32_t pin); +#define A10_GPIO_FUNC_MII 2 +#define A10_GPIO_FUNC_RGMII 5 + +int a10_gpio_ethernet_activate(uint32_t); #endif diff --git a/sys/arm/allwinner/if_emac.c b/sys/arm/allwinner/if_emac.c index e311049f2f8b..18aeb8fc14ba 100644 --- a/sys/arm/allwinner/if_emac.c +++ b/sys/arm/allwinner/if_emac.c @@ -142,17 +142,12 @@ static int sysctl_hw_emac_proc_limit(SYSCTL_HANDLER_ARGS); static void emac_sys_setup(void) { - int i; + /* Activate EMAC clock. */ a10_clk_emac_activate(); - - /* - * Configure pin mux settings for MII. - * Pins PA0 from PA17. - */ - for (i = 0; i <= 17; i++) - a10_emac_gpio_config(i); - /* Map sram */ + /* Set the pin mux to EMAC (mii). */ + a10_gpio_ethernet_activate(A10_GPIO_FUNC_MII); + /* Map sram. */ a10_map_to_emac(); }