Skip to contentSkip to conversation

sun6i: Add gmac support for sun6i boards

PATCH New Hans de Goede 2 participants 2 messages Nov 21, 2014 – Nov 25, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sun6i: Add gmac support for sun6i boards

Hookup the gmac found on the sun6i / A31 SoCs.

---
 arch/arm/include/asm/arch-sunxi/clock_sun6i.h |  8 +++++
 arch/arm/include/asm/arch-sunxi/cpu.h         |  4 +++
 arch/arm/include/asm/arch-sunxi/gpio.h        |  1 +
 board/sunxi/gmac.c                            | 45 +++++++++++++++++++++++++++
 configs/CSQ_CS908_defconfig                   |  2 +-
 configs/Mele_M9_defconfig                     |  2 +-
 6 files changed, 60 insertions(+), 2 deletions(-)
arch/arm/include/asm/arch-sunxi/clock_sun6i.h +8 -0
index 7e810bb..4bdc0de 100644
@@ -204,6 +204,7 @@ struct sunxi_ccm_reg {
 #define AHB_GATE_OFFSET_USB_EHCI1	27
 #define AHB_GATE_OFFSET_USB_EHCI0	26
 #define AHB_GATE_OFFSET_MCTL		14
+#define AHB_GATE_OFFSET_GMAC		17
 #define AHB_GATE_OFFSET_MMC3		11
 #define AHB_GATE_OFFSET_MMC2		10
 #define AHB_GATE_OFFSET_MMC1		9
@@ -230,6 +231,12 @@ struct sunxi_ccm_reg {
 #define CCM_USB_CTRL_PHY1_CLK (0x1 << 9)
 #define CCM_USB_CTRL_PHY2_CLK (0x1 << 10)
 
+#define CCM_GMAC_CTRL_TX_CLK_SRC_MII	0x0
+#define CCM_GMAC_CTRL_TX_CLK_SRC_EXT_RGMII 0x1
+#define CCM_GMAC_CTRL_TX_CLK_SRC_INT_RGMII 0x2
+#define CCM_GMAC_CTRL_GPIT_MII		(0x0 << 2)
+#define CCM_GMAC_CTRL_GPIT_RGMII	(0x1 << 2)
+
 #define MDFS_CLK_DEFAULT		0x81000002 /* PLL6 / 3 */
 
 #define CCM_DRAMCLK_CFG_DIV0(x)		((x - 1) << 8)
@@ -265,6 +272,7 @@ struct sunxi_ccm_reg {
 #define MBUS_CLK_DEFAULT		0x81000001 /* PLL6 / 2 */
 
 /* ahb_reset0 offsets */
+#define AHB_RESET_OFFSET_GMAC		17
 #define AHB_RESET_OFFSET_MCTL		14
 #define AHB_RESET_OFFSET_MMC3		11
 #define AHB_RESET_OFFSET_MMC2		10
arch/arm/include/asm/arch-sunxi/cpu.h +4 -0
index 90e06c0..8aeed2f 100644
@@ -99,9 +99,13 @@
 
 #define SUNXI_SCR_BASE			0x01c2c400
 
+#ifndef CONFIG_MACH_SUN6I
 #define SUNXI_GPS_BASE			0x01c30000
 #define SUNXI_MALI400_BASE		0x01c40000
 #define SUNXI_GMAC_BASE			0x01c50000
+#else
+#define SUNXI_GMAC_BASE			0x01c30000
+#endif
 
 #define SUNXI_DRAM_COM_BASE		0x01c62000
 #define SUNXI_DRAM_CTL0_BASE		0x01c63000
arch/arm/include/asm/arch-sunxi/gpio.h +1 -0
index c734cf0..366c0dc 100644
@@ -134,6 +134,7 @@ enum sunxi_gpio_number {
 #define SUNXI_GPIO_OUTPUT	1
 
 #define SUNXI_GPA0_EMAC		2
+#define SUN6I_GPA0_GMAC		2
 #define SUN7I_GPA0_GMAC		5
 
 #define SUNXI_GPB0_TWI0		2
board/sunxi/gmac.c +45 -0

67 lines not on this page · raw message

configs/CSQ_CS908_defconfig +1 -1
index cdc0404..679fe47 100644
@@ -1,5 +1,5 @@
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="USB_EHCI"
+CONFIG_SYS_EXTRA_OPTIONS="USB_EHCI,SUNXI_GMAC"
 CONFIG_FDTFILE="sun6i-a31s-cs908.dtb"
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
configs/Mele_M9_defconfig +1 -1
index 7e50888..6f466ca 100644
@@ -1,5 +1,5 @@
 CONFIG_SPL=y
-CONFIG_SYS_EXTRA_OPTIONS="USB_EHCI"
+CONFIG_SYS_EXTRA_OPTIONS="USB_EHCI,SUNXI_GMAC"
 CONFIG_FDTFILE="sun6i-a31-m9.dtb"
 +S:CONFIG_ARM=y
 +S:CONFIG_ARCH_SUNXI=y
Signature · 1 line
2.1.0