Ian Campbell | 5835823 | 2014-05-05 11:52:28 +0100 | [diff] [blame] | 1 | #include <common.h> |
| 2 | #include <netdev.h> |
| 3 | #include <miiphy.h> |
Ian Campbell | 5835823 | 2014-05-05 11:52:28 +0100 | [diff] [blame] | 4 | #include <asm/io.h> |
| 5 | #include <asm/arch/clock.h> |
Ian Campbell | 5835823 | 2014-05-05 11:52:28 +0100 | [diff] [blame] | 6 | |
Hans de Goede | fc8991c | 2016-03-17 13:53:03 +0100 | [diff] [blame] | 7 | void eth_init_board(void) |
Ian Campbell | 5835823 | 2014-05-05 11:52:28 +0100 | [diff] [blame] | 8 | { |
Ian Campbell | 5835823 | 2014-05-05 11:52:28 +0100 | [diff] [blame] | 9 | struct sunxi_ccm_reg *const ccm = |
| 10 | (struct sunxi_ccm_reg *)SUNXI_CCM_BASE; |
| 11 | |
Ian Campbell | 5835823 | 2014-05-05 11:52:28 +0100 | [diff] [blame] | 12 | /* Set MII clock */ |
Chen-Yu Tsai | ef7e723 | 2014-06-09 11:37:01 +0200 | [diff] [blame] | 13 | #ifdef CONFIG_RGMII |
Ian Campbell | 5835823 | 2014-05-05 11:52:28 +0100 | [diff] [blame] | 14 | setbits_le32(&ccm->gmac_clk_cfg, CCM_GMAC_CTRL_TX_CLK_SRC_INT_RGMII | |
| 15 | CCM_GMAC_CTRL_GPIT_RGMII); |
Hans de Goede | c13f60d | 2015-01-25 12:10:48 +0100 | [diff] [blame] | 16 | setbits_le32(&ccm->gmac_clk_cfg, |
| 17 | CCM_GMAC_CTRL_TX_CLK_DELAY(CONFIG_GMAC_TX_DELAY)); |
Chen-Yu Tsai | ef7e723 | 2014-06-09 11:37:01 +0200 | [diff] [blame] | 18 | #else |
| 19 | setbits_le32(&ccm->gmac_clk_cfg, CCM_GMAC_CTRL_TX_CLK_SRC_MII | |
| 20 | CCM_GMAC_CTRL_GPIT_MII); |
| 21 | #endif |
Ian Campbell | 5835823 | 2014-05-05 11:52:28 +0100 | [diff] [blame] | 22 | } |