This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM335X am33xx_cpsw_init 使用外部MAC資料

Expert 2272 points


請問..

據我所知,Kernel 在開機過程中,會透過am33xx_cpsw_init 來設定mac addr

我想在am33xx_cpsw_init中讀取外部MAC資料來設定MAC

若我們的板子,使用TF卡開機,想請教...

1. MAC資料 可以存放於TF卡 FAT32分區嗎?

2. Kernel 該如何讀取存放於TF卡中FAT32 資料??

3.還是說進入rootfs後,再透過ifconfig hw ether設定MAC比較方便??? TI 建議如何做???

int am33xx_cpsw_init(enum am33xx_cpsw_mac_mode mode, unsigned char *phy_id0,
unsigned char *phy_id1)
{
struct omap_hwmod *oh;
struct platform_device *pdev;
u32 mac_lo, mac_hi, gmii_sel;
u32 i;

mac_lo = omap_ctrl_readl(TI81XX_CONTROL_MAC_ID0_LO);
mac_hi = omap_ctrl_readl(TI81XX_CONTROL_MAC_ID0_HI);
am33xx_cpsw_slaves[0].mac_addr[0] = mac_hi & 0xFF;
am33xx_cpsw_slaves[0].mac_addr[1] = (mac_hi & 0xFF00) >> 8;
am33xx_cpsw_slaves[0].mac_addr[2] = (mac_hi & 0xFF0000) >> 16;
am33xx_cpsw_slaves[0].mac_addr[3] = (mac_hi & 0xFF000000) >> 24;
am33xx_cpsw_slaves[0].mac_addr[4] = mac_lo & 0xFF;
am33xx_cpsw_slaves[0].mac_addr[5] = (mac_lo & 0xFF00) >> 8;

/* Read MACID0 from eeprom if eFuse MACID is invalid */
if (!is_valid_ether_addr(am33xx_cpsw_slaves[0].mac_addr)) {
for (i = 0; i < ETH_ALEN; i++)
am33xx_cpsw_slaves[0].mac_addr[i] = am33xx_macid0[i];
}