net: dsa: microchip: ksz9477: setup single-led mode (dirty)
Signed-off-by: Heinrich Toews <ht@twx-software.de>
This commit is contained in:
parent
3c892fb041
commit
7a999a818a
@ -174,6 +174,7 @@ int ksz9477_reset_switch(struct ksz_device *dev)
|
|||||||
SPI_AUTO_EDGE_DETECTION, 0);
|
SPI_AUTO_EDGE_DETECTION, 0);
|
||||||
|
|
||||||
/* default configuration */
|
/* default configuration */
|
||||||
|
/* TWx: REG_SW_LUE_CTRL_1 = Switch Lookup Engine Control 1 Register */
|
||||||
ksz_write8(dev, REG_SW_LUE_CTRL_1,
|
ksz_write8(dev, REG_SW_LUE_CTRL_1,
|
||||||
SW_AGING_ENABLE | SW_LINK_AUTO_AGING | SW_SRC_ADDR_FILTER);
|
SW_AGING_ENABLE | SW_LINK_AUTO_AGING | SW_SRC_ADDR_FILTER);
|
||||||
|
|
||||||
@ -195,6 +196,62 @@ int ksz9477_reset_switch(struct ksz_device *dev)
|
|||||||
data8 = SW_ENABLE_REFCLKO | SW_REFCLKO_IS_125MHZ;
|
data8 = SW_ENABLE_REFCLKO | SW_REFCLKO_IS_125MHZ;
|
||||||
ksz_write8(dev, REG_SW_GLOBAL_OUTPUT_CTRL__1, data8);
|
ksz_write8(dev, REG_SW_GLOBAL_OUTPUT_CTRL__1, data8);
|
||||||
|
|
||||||
|
{
|
||||||
|
u16 data16;
|
||||||
|
|
||||||
|
/* REGS
|
||||||
|
*
|
||||||
|
* Write MMD - Device Address 2h, Register 00h = 0010h to enable single-LED mode.
|
||||||
|
*
|
||||||
|
* REG_PORT_PHY_MMD_SETUP - Write the PHY MMD Setup Register with 0002h
|
||||||
|
* REG_PORT_PHY_MMD_INDEX_DATA - Write the PHY MMD Data Register with 0000h
|
||||||
|
* - Write the PHY MMD Setup Register with 4002h
|
||||||
|
* - Write the PHY MMD Data Register with 0010h
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* WRITE */
|
||||||
|
for (int i = 1; i <= 5; i++) {
|
||||||
|
|
||||||
|
/* skip EM port 3(4) */
|
||||||
|
if (i == 4)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Read <MMD LED Mode Register> for Port i */
|
||||||
|
ksz_write16(dev, REG_PORT_PHY_MMD_SETUP |
|
||||||
|
(i << 12), 0x0002);
|
||||||
|
ksz_write16(dev, REG_PORT_PHY_MMD_INDEX_DATA |
|
||||||
|
(i << 12), 0x0000);
|
||||||
|
ksz_write16(dev, REG_PORT_PHY_MMD_SETUP |
|
||||||
|
(i << 12), 0x4002);
|
||||||
|
ksz_write16(dev, REG_PORT_PHY_MMD_INDEX_DATA |
|
||||||
|
(i << 12), 0x0011);
|
||||||
|
|
||||||
|
/* Due to Errata Module 19 this workaround is needed to
|
||||||
|
* enable single-led mode. It has also to be a 32bit
|
||||||
|
* write.
|
||||||
|
*/
|
||||||
|
ksz_write32(dev, REG_PORT_PHY_DIGITAL_DEBUG_3 |
|
||||||
|
(i << 12), 0xfa000300);
|
||||||
|
|
||||||
|
pr_info("TWx %s:%d - Port %d: Wrote MMD LED Mode Register: 0x%x\n.",
|
||||||
|
__func__, __LINE__, i, 0x0011);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* READ */
|
||||||
|
for (int i = 1; i <= 5; i++) {
|
||||||
|
/* Read <MMD LED Mode Register> for Port i */
|
||||||
|
ksz_write16(dev, REG_PORT_PHY_MMD_SETUP | (i << 12), 0x0002);
|
||||||
|
ksz_write16(dev, REG_PORT_PHY_MMD_INDEX_DATA | (i << 12), 0x0000);
|
||||||
|
ksz_write16(dev, REG_PORT_PHY_MMD_SETUP | (i << 12), 0x4002);
|
||||||
|
ksz_read16(dev, REG_PORT_PHY_MMD_INDEX_DATA | (i << 12), &data16);
|
||||||
|
|
||||||
|
pr_info("TWx %s:%d - Port %d: MMD LED Mode Register: 0x%x\n.",
|
||||||
|
__func__, __LINE__, i, data16);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user