Re: [PATCH net-next v3 04/10] net: ti: prueth: Adds link detection, RX and TX support.
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
Date: 2025-02-14 15:44:29
Also in:
linux-arm-kernel, linux-devicetree, lkml
Hello, On Fri, 14 Feb 2025 13:07:51 +0530 parvathi [off-list ref] wrote:
From: Roger Quadros <redacted> Changes corresponding to link configuration such as speed and duplexity. IRQ and handler initializations are performed for packet reception.Firmware receives the packet from the wire and stores it into OCMC queue. Next, it notifies the CPU via interrupt. Upon receiving the interrupt CPU will service the IRQ and packet will be processed by pushing the newly allocated SKB to upper layers. When the user application want to transmit a packet, it will invoke sys_send() which will inturn invoke the PRUETH driver, then it will write the packet into OCMC queues. PRU firmware will pick up the packet and transmit it on to the wire. Signed-off-by: Roger Quadros <redacted> Signed-off-by: Andrew F. Davis <redacted> Signed-off-by: Basharath Hussain Khaja <redacted> Signed-off-by: Parvathi Pudi <parvathi@couthit.com>
quoted hunk ↗ jump to hunk
+/* update phy/port status information for firmware */ +static void icssm_emac_update_phystatus(struct prueth_emac *emac) +{ + struct prueth *prueth = emac->prueth; + u32 phy_speed, port_status = 0; + enum prueth_mem region; + u32 delay; + + region = emac->dram; + phy_speed = emac->speed; + icssm_prueth_write_reg(prueth, region, PHY_SPEED_OFFSET, phy_speed); + + delay = TX_CLK_DELAY_100M; + + delay = delay << PRUSS_MII_RT_TXCFG_TX_CLK_DELAY_SHIFT; + + if (emac->port_id) { + regmap_update_bits(prueth->mii_rt, + PRUSS_MII_RT_TXCFG1, + PRUSS_MII_RT_TXCFG_TX_CLK_DELAY_MASK, + delay); + } else { + regmap_update_bits(prueth->mii_rt, + PRUSS_MII_RT_TXCFG0, + PRUSS_MII_RT_TXCFG_TX_CLK_DELAY_MASK, + delay); + } + + if (emac->link) + port_status |= PORT_LINK_MASK; + + writeb(port_status, prueth->mem[region].va + PORT_STATUS_OFFSET); +} + /* called back by PHY layer if there is change in link state of hw port*/ static void icssm_emac_adjust_link(struct net_device *ndev) {@@ -369,6 +426,8 @@ static void icssm_emac_adjust_link(struct net_device *ndev) emac->link = 0; } + icssm_emac_update_phystatus(emac); +
It looks to me like emac->link, emac->speed and emac->duplex are only used in icssm_emac_update_phystatus(). If you consider either passing these as parameters to the above function, or simply merge icssm_emac_update_phystatus() into your adjust_link callback, you can get rid of these 3 attributes entirely. It even looks like emac->duplex is simply unused. Thanks, Maxime