summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorloos <loos@FreeBSD.org>2015-07-03 17:54:41 +0000
committerloos <loos@FreeBSD.org>2015-07-03 17:54:41 +0000
commit51a53682f0159879c2bf549274da9d918c49414f (patch)
treeaac01c68178a8546c9fcbda408f1213093913f79
parent06c28ee0717b26e72018e2a5c5bf321facc78f32 (diff)
downloadFreeBSD-src-51a53682f0159879c2bf549274da9d918c49414f.zip
FreeBSD-src-51a53682f0159879c2bf549274da9d918c49414f.tar.gz
Rename a10_emac_gpio_config() to a10_gpio_ethernet_activate() to make the
change to GMAC easier on A20 SoCs. On A10 only the EMAC controller is available (fast ethernet), but on A20 there is also GMAC a high (or better) performant controller (gigabit ethernet). On A20 the both controllers uses the same pins to talk to the ethernet PHY (MII or RGMII) and they can be selected by the GPIO pin mux. There is work in progress to bring in GMAC support.
-rw-r--r--sys/arm/allwinner/a10_gpio.c6
-rw-r--r--sys/arm/allwinner/a10_gpio.h5
-rw-r--r--sys/arm/allwinner/if_emac.c13
3 files changed, 12 insertions, 12 deletions
diff --git a/sys/arm/allwinner/a10_gpio.c b/sys/arm/allwinner/a10_gpio.c
index b2dca00..c461013 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 0e1dc86..e78b18f 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 e311049..18aeb8f 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();
}
OpenPOWER on IntegriCloud