blob: 2a885305ebe028f071b1c2f970cd523fb3cac325 [file] [log] [blame]
Ian Campbellba8311f2014-05-05 11:52:28 +01001#include <common.h>
2#include <netdev.h>
3#include <miiphy.h>
Ian Campbellba8311f2014-05-05 11:52:28 +01004#include <asm/io.h>
5#include <asm/arch/clock.h>
Ian Campbellba8311f2014-05-05 11:52:28 +01006
Hans de Goede42cbbe32016-03-17 13:53:03 +01007void eth_init_board(void)
Ian Campbellba8311f2014-05-05 11:52:28 +01008{
Ian Campbellba8311f2014-05-05 11:52:28 +01009 struct sunxi_ccm_reg *const ccm =
10 (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
11
Ian Campbellba8311f2014-05-05 11:52:28 +010012 /* Set MII clock */
Chen-Yu Tsaic1f6aa32014-06-09 11:37:01 +020013#ifdef CONFIG_RGMII
Ian Campbellba8311f2014-05-05 11:52:28 +010014 setbits_le32(&ccm->gmac_clk_cfg, CCM_GMAC_CTRL_TX_CLK_SRC_INT_RGMII |
15 CCM_GMAC_CTRL_GPIT_RGMII);
Hans de Goedebf880fe2015-01-25 12:10:48 +010016 setbits_le32(&ccm->gmac_clk_cfg,
17 CCM_GMAC_CTRL_TX_CLK_DELAY(CONFIG_GMAC_TX_DELAY));
Chen-Yu Tsaic1f6aa32014-06-09 11:37:01 +020018#else
19 setbits_le32(&ccm->gmac_clk_cfg, CCM_GMAC_CTRL_TX_CLK_SRC_MII |
20 CCM_GMAC_CTRL_GPIT_MII);
21#endif
Ian Campbellba8311f2014-05-05 11:52:28 +010022}