嵌入式爱好者

335xs使用8720phy芯片的配置问题

2021-3-22 08:40| 发布者: ljb2019001| 查看: 1739| 评论: 0

类目: 知识库  >  AM335x系列产品     文档编号: 482

由于经常有客户咨询335xs上使用8720phy芯片的问题(目前使用的是8031),所以总结一下配置过程中遇到的问题和解决方法。


配置思路就是参考335xs2的板级文件修改335xs的板级文件去配置,遇到以下问题:

1. pinmux配置(kernel-3.2/arch/arm/mach-omap2/board-am335xevm-xs.c

335xs上的8031使用的是RGMII,而8720使用的是RMII

如下是335xs2对rmii1引脚的复用初始化

```

/* Module pin mux for rmii1 */

static struct pinmux_config rmii1_pin_mux[] = {

// {"mii1_crs.rmii1_crs_dv", OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLDOWN},

// {"mii1_rxerr.mii1_rxerr", OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLDOWN},

{"mii1_txen.mii1_txen", OMAP_MUX_MODE1 | AM33XX_PIN_OUTPUT},

{"mii1_txd1.mii1_txd1", OMAP_MUX_MODE1 | AM33XX_PIN_OUTPUT},

{"mii1_txd0.mii1_txd0", OMAP_MUX_MODE1 | AM33XX_PIN_OUTPUT},

{"mii1_rxd1.mii1_rxd1", OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLDOWN},

{"mii1_rxd0.mii1_rxd0", OMAP_MUX_MODE1 | AM33XX_PIN_INPUT_PULLDOWN},

//  {"rmii1_refclk.rmii1_refclk", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLDOWN},

{"mdio_data.mdio_data", OMAP_MUX_MODE0 | AM33XX_PIN_INPUT_PULLUP},

{"mdio_clk.mdio_clk", OMAP_MUX_MODE0 | AM33XX_PIN_OUTPUT_PULLUP},

{NULL, 0},

};

```

往往客户会直接将这个配置复制到335xs上,导致phy识别不到地址

原因是图中注释掉的引脚,其实是在uboot阶段就初始化过了,所以板级文件没有初始化,把注释去掉就能解决。

2.初始化RMII总线,需要把AM33XX_CPSW_MODE_RGMII修改为AM33XX_CPSW_MODE_RMII

/* ok335x */

static void setup_ok335x(void)

{

/*which doesn't have Write Protect pin */

am335x_mmc[0].gpio_wp = -EINVAL;


_configure_device(EVM_SK, ok335x_dev_cfg, PROFILE_NONE);

am33xx_cpsw_init(AM33XX_CPSW_MODE_RGMII, NULL, NULL);

/* Atheros Tx Clk delay Phy fixup */

phy_register_fixup_for_uid(AM335X_EVM_PHY_ID, AM335X_EVM_PHY_MASK,

   am33xx_evm_tx_clk_dly_phy_fixup);

}

3.phy地址修改,将CONFIG_OK335XS2修改成CONFIG_OK335XS

/* AM335X EVM Phy ID and Debug Registers */

#if defined(CONFIG_OK335XS2)

//#define AM335X_EVM_PHY_ID       0x080017

#define AM335X_EVM_PHY_ID       0x7c0f0 

//#define AM335X_EVM_PHY_ID       0x20005c90 

#else

#define AM335X_EVM_PHY_ID 0x4dd074

#endif

4.RMII1  clk_en(kernel-3.2/arch/arm/mach-omap2/device.cCONFIG_OK335XS2修改成CONFIG_OK335XS

#if defined(CONFIG_OK335XS2)

#define RMII1_IO_CLK_EN 0x0040

gmii_sel |= (RMII1_IO_CLK_EN);

#endif

5.phy_id(kernel-3.2/arch/arm/mach-omap2/device.c)  CONFIG_OK335XS2修改成CONFIG_OK335XS

/* TODO : Verify the offsets */

static struct cpsw_slave_data am33xx_cpsw_slaves[] = {

{

.slave_reg_ofs  = 0x200,

.sliver_reg_ofs = 0xd80,

#ifdef CONFIG_OK335XS2

.phy_id = "0:01",

#else 

.phy_id = "0:00",

#endif

.dual_emac_reserved_vlan = CPSW_PORT_VLAN_SLAVE_0,

},

{

.slave_reg_ofs  = 0x300,

.sliver_reg_ofs = 0xdc0,

#ifdef CONFIG_OK335XS2

.phy_id = "0:00",

#else 

.phy_id = "0:01",

#endif

.dual_emac_reserved_vlan = CPSW_PORT_VLAN_SLAVE_1,

},

};



已解决

未解决

只是看看

最新评论

QQ|小黑屋| 飞凌嵌入式 ( 冀ICP备12004394号-1 )

GMT+8, 2024-11-22 11:53

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

返回顶部