Skip to content

Commit

Permalink
net:sunxi-gmac: add gmac support
Browse files Browse the repository at this point in the history
The commit itself comes from

https://github.com/cubieboard/linux-sunxi/tree/cubie/sunxi-3.4/

IRC user jemk found out the IP itself comes from DesignWare. It turns
out it is supported already in both the mainline (stmmac) and the
U-Boot (designware). These existing drivers should be made to work
with Allwinner chips. This driver is solely for the purpose of the
reference and will not be improved.

Signed-off-by: arokux <arokux@gmail.com>
  • Loading branch information
benn authored and amery committed Nov 12, 2013
1 parent 96a337c commit d9e27bc
Show file tree
Hide file tree
Showing 16 changed files with 4,399 additions and 1 deletion.
2 changes: 1 addition & 1 deletion arch/arm/plat-sunxi/include/plat/irqs.h
Expand Up @@ -188,9 +188,9 @@
#define SW_INT_IRQNO_SYNC_TIMER1 (83 + SW_INT_START)

/* sun7i only */
#define SW_INT_IRQNO_GMAC (85 + SW_INT_START)
#define SW_INT_IRQNO_TWI3 (88 + SW_INT_START)
#define SW_INT_IRQNO_TWI4 (89 + SW_INT_START)
#define SW_INT_IRQNO_GMAC (85 + SW_INT_START)
#ifdef CONFIG_ARCH_SUN7I
#define SW_INT_END (127 + SW_INT_START)
#else
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/Kconfig
Expand Up @@ -184,6 +184,7 @@ config SUNXI_EMAC
To compile this driver as a module, choose M here. The module
will be called sunxi_emac.

source "drivers/net/ethernet/allwinner/gmac/Kconfig"
source "drivers/net/ethernet/tehuti/Kconfig"
source "drivers/net/ethernet/ti/Kconfig"
source "drivers/net/ethernet/tile/Kconfig"
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/Makefile
Expand Up @@ -68,6 +68,7 @@ obj-$(CONFIG_NET_VENDOR_SMSC) += smsc/
obj-$(CONFIG_NET_VENDOR_STMICRO) += stmicro/
obj-$(CONFIG_NET_VENDOR_SUN) += sun/
obj-$(CONFIG_SUNXI_EMAC) += allwinner/
obj-$(CONFIG_SUNXI_GMAC) += allwinner/gmac/
obj-$(CONFIG_NET_VENDOR_TEHUTI) += tehuti/
obj-$(CONFIG_NET_VENDOR_TI) += ti/
obj-$(CONFIG_TILE_NET) += tile/
Expand Down
47 changes: 47 additions & 0 deletions drivers/net/ethernet/allwinner/gmac/Kconfig
@@ -0,0 +1,47 @@
config SUNXI_GMAC
tristate "Sunxi platform 10/100/1000Mbps Ethernet driver"
depends on HAS_IOMEM
select NET_CORE
select MII
select PHYLIB
select CRC32
---help---
This is the driver for the Sunxi Ethernet.

if SUNXI_GMAC

config GMAC_SCRIPT_SYS
bool "Use sunxi platform script"
depends on SUNXI_GMAC
default y
---help---
The GMAC gpio request and control by the script of sunxi platform.
Select it, by script. If not, ioremap by drivers itself.

config GMAC_CLK_SYS
bool "Clock use system interface"
depends on SUNXI_GMAC
default y
---help---
It select the clock controler is system or the driver itself.
If you want to use the system interface, select it. If not, the
driver will control the clock by ioremap.

choice
prompt "Select the DMA TX/RX descriptor operating modes"
depends on SUNXI_GMAC
---help---
This driver supports DMA descriptor to operate both in dual buffer
(RING) and linked-list(CHAINED) mode. In RING mode each descriptor
points to two data buffer pointers whereas in CHAINED mode they
points to only one data buffer pointer.

config GMAC_RING
bool "Enable Descriptor Ring Mode"

config GMAC_CHAINED
bool "Enable Descriptor Chained Mode"

endchoice

endif
6 changes: 6 additions & 0 deletions drivers/net/ethernet/allwinner/gmac/Makefile
@@ -0,0 +1,6 @@
obj-$(CONFIG_SUNXI_GMAC) += sunxi_gmac.o
gmac-$(CONFIG_GMAC_TEST) += gmac_test.o

sunxi_gmac-y := gmac_core.o gmac_mdio.o \
gmac_plat.o gmac_base.o \
gmac_desc.o gmac_ethtool.o

0 comments on commit d9e27bc

Please sign in to comment.