mirror of
https://github.com/cesanta/mongoose.git
synced 2024-11-23 18:49:01 +08:00
Update TM4C driver init + nits
This commit is contained in:
parent
1b75017c3c
commit
15c8ba5d3f
@ -17192,10 +17192,11 @@ void mg_phy_init(struct mg_phy *phy, uint8_t phy_addr, uint8_t config) {
|
||||
if (id1 == MG_PHY_DP83x && id2 != MG_PHY_DP83867) {
|
||||
phy->write_reg(phy_addr, MG_PHY_DP83x_REG_RCSR, MG_BIT(7) | MG_BIT(0));
|
||||
} else if (id1 == MG_PHY_KSZ8x) {
|
||||
phy->write_reg(
|
||||
phy_addr, MG_PHY_REG_BCR, // Disable isolation (override hw)
|
||||
// Disable isolation (override hw, it doesn't make sense at this point)
|
||||
phy->write_reg( // #2848, some NXP boards set ISO, even though
|
||||
phy_addr, MG_PHY_REG_BCR, // docs say they don't
|
||||
phy->read_reg(phy_addr, MG_PHY_REG_BCR) & (uint16_t) ~MG_BIT(10));
|
||||
phy->write_reg(phy_addr, MG_PHY_KSZ8x_REG_PC2R,
|
||||
phy->write_reg(phy_addr, MG_PHY_KSZ8x_REG_PC2R, // now do clock stuff
|
||||
MG_BIT(15) | MG_BIT(8) | MG_BIT(7));
|
||||
} else if (id1 == MG_PHY_LAN87x) {
|
||||
// nothing to do
|
||||
|
15
mongoose.h
15
mongoose.h
@ -3052,6 +3052,21 @@ struct mg_tcpip_driver_tm4c_data {
|
||||
#define MG_DRIVER_MDC_CR 1
|
||||
#endif
|
||||
|
||||
#define MG_TCPIP_DRIVER_INIT(mgr) \
|
||||
do { \
|
||||
static struct mg_tcpip_driver_tm4c_data driver_data_; \
|
||||
static struct mg_tcpip_if mif_; \
|
||||
driver_data_.mdc_cr = MG_DRIVER_MDC_CR; \
|
||||
mif_.ip = MG_TCPIP_IP; \
|
||||
mif_.mask = MG_TCPIP_MASK; \
|
||||
mif_.gw = MG_TCPIP_GW; \
|
||||
mif_.driver = &mg_tcpip_driver_tm4c; \
|
||||
mif_.driver_data = &driver_data_; \
|
||||
MG_SET_MAC_ADDRESS(mif_.mac); \
|
||||
mg_tcpip_init(mgr, &mif_); \
|
||||
MG_INFO(("Driver: tm4c, MAC: %M", mg_print_mac, mif_.mac)); \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -70,10 +70,11 @@ void mg_phy_init(struct mg_phy *phy, uint8_t phy_addr, uint8_t config) {
|
||||
if (id1 == MG_PHY_DP83x && id2 != MG_PHY_DP83867) {
|
||||
phy->write_reg(phy_addr, MG_PHY_DP83x_REG_RCSR, MG_BIT(7) | MG_BIT(0));
|
||||
} else if (id1 == MG_PHY_KSZ8x) {
|
||||
phy->write_reg(
|
||||
phy_addr, MG_PHY_REG_BCR, // Disable isolation (override hw)
|
||||
// Disable isolation (override hw, it doesn't make sense at this point)
|
||||
phy->write_reg( // #2848, some NXP boards set ISO, even though
|
||||
phy_addr, MG_PHY_REG_BCR, // docs say they don't
|
||||
phy->read_reg(phy_addr, MG_PHY_REG_BCR) & (uint16_t) ~MG_BIT(10));
|
||||
phy->write_reg(phy_addr, MG_PHY_KSZ8x_REG_PC2R,
|
||||
phy->write_reg(phy_addr, MG_PHY_KSZ8x_REG_PC2R, // now do clock stuff
|
||||
MG_BIT(15) | MG_BIT(8) | MG_BIT(7));
|
||||
} else if (id1 == MG_PHY_LAN87x) {
|
||||
// nothing to do
|
||||
|
@ -19,4 +19,19 @@ struct mg_tcpip_driver_tm4c_data {
|
||||
#define MG_DRIVER_MDC_CR 1
|
||||
#endif
|
||||
|
||||
#define MG_TCPIP_DRIVER_INIT(mgr) \
|
||||
do { \
|
||||
static struct mg_tcpip_driver_tm4c_data driver_data_; \
|
||||
static struct mg_tcpip_if mif_; \
|
||||
driver_data_.mdc_cr = MG_DRIVER_MDC_CR; \
|
||||
mif_.ip = MG_TCPIP_IP; \
|
||||
mif_.mask = MG_TCPIP_MASK; \
|
||||
mif_.gw = MG_TCPIP_GW; \
|
||||
mif_.driver = &mg_tcpip_driver_tm4c; \
|
||||
mif_.driver_data = &driver_data_; \
|
||||
MG_SET_MAC_ADDRESS(mif_.mac); \
|
||||
mg_tcpip_init(mgr, &mif_); \
|
||||
MG_INFO(("Driver: tm4c, MAC: %M", mg_print_mac, mif_.mac)); \
|
||||
} while (0)
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user