* [PATCH RFC Vb] bgmac: fix *initial* chip reset to support BCM5358
@ 2023-02-24 13:48 Rafał Miłecki
2023-02-24 18:03 ` Florian Fainelli
0 siblings, 1 reply; 2+ messages in thread
From: Rafał Miłecki @ 2023-02-24 13:48 UTC (permalink / raw)
To: Florian Fainelli, bcm-kernel-feedback-list
Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netdev, linux-arm-kernel, linux-kernel, Rafał Miłecki,
Rafał Miłecki
While bringing hardware up we should perform a full reset including the
switch bit (BGMAC_BCMA_IOCTL_SW_RESET aka SICF_SWRST). It's what
specification says and what reference driver does.
This seems to be critical for the BCM5358. Without this hardware doesn't
get initialized properly and doesn't seem to transmit or receive any
packets.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
RFC: This is alternative solutionto the
[PATCH RFC] bgmac: fix *initial* chip reset to support BCM5358
https://lore.kernel.org/lkml/20230207225327.27534-1-zajec5@gmail.com/T/
Any comments on the prefered solution? Parameter vs. flag?
---
drivers/net/ethernet/broadcom/bgmac.c | 8 ++++++--
drivers/net/ethernet/broadcom/bgmac.h | 2 ++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
index 3038386a5afd..1761df8fb7f9 100644
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
@@ -890,13 +890,13 @@ static void bgmac_chip_reset_idm_config(struct bgmac *bgmac)
if (iost & BGMAC_BCMA_IOST_ATTACHED) {
flags = BGMAC_BCMA_IOCTL_SW_CLKEN;
- if (!bgmac->has_robosw)
+ if (bgmac->in_init || !bgmac->has_robosw)
flags |= BGMAC_BCMA_IOCTL_SW_RESET;
}
bgmac_clk_enable(bgmac, flags);
}
- if (iost & BGMAC_BCMA_IOST_ATTACHED && !bgmac->has_robosw)
+ if (iost & BGMAC_BCMA_IOST_ATTACHED && (bgmac->in_init || !bgmac->has_robosw))
bgmac_idm_write(bgmac, BCMA_IOCTL,
bgmac_idm_read(bgmac, BCMA_IOCTL) &
~BGMAC_BCMA_IOCTL_SW_RESET);
@@ -1490,6 +1490,8 @@ int bgmac_enet_probe(struct bgmac *bgmac)
struct net_device *net_dev = bgmac->net_dev;
int err;
+ bgmac->in_init = true;
+
bgmac_chip_intrs_off(bgmac);
net_dev->irq = bgmac->irq;
@@ -1542,6 +1544,8 @@ int bgmac_enet_probe(struct bgmac *bgmac)
/* Omit FCS from max MTU size */
net_dev->max_mtu = BGMAC_RX_MAX_FRAME_SIZE - ETH_FCS_LEN;
+ bgmac->in_init = false;
+
err = register_netdev(bgmac->net_dev);
if (err) {
dev_err(bgmac->dev, "Cannot register net device\n");
diff --git a/drivers/net/ethernet/broadcom/bgmac.h b/drivers/net/ethernet/broadcom/bgmac.h
index e05ac92c0650..d73ef262991d 100644
--- a/drivers/net/ethernet/broadcom/bgmac.h
+++ b/drivers/net/ethernet/broadcom/bgmac.h
@@ -472,6 +472,8 @@ struct bgmac {
int irq;
u32 int_mask;
+ bool in_init;
+
/* Current MAC state */
int mac_speed;
int mac_duplex;
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH RFC Vb] bgmac: fix *initial* chip reset to support BCM5358
2023-02-24 13:48 [PATCH RFC Vb] bgmac: fix *initial* chip reset to support BCM5358 Rafał Miłecki
@ 2023-02-24 18:03 ` Florian Fainelli
0 siblings, 0 replies; 2+ messages in thread
From: Florian Fainelli @ 2023-02-24 18:03 UTC (permalink / raw)
To: Rafał Miłecki, bcm-kernel-feedback-list
Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
netdev, linux-arm-kernel, linux-kernel, Rafał Miłecki
On 2/24/23 05:48, Rafał Miłecki wrote:
> While bringing hardware up we should perform a full reset including the
> switch bit (BGMAC_BCMA_IOCTL_SW_RESET aka SICF_SWRST). It's what
> specification says and what reference driver does.
>
> This seems to be critical for the BCM5358. Without this hardware doesn't
> get initialized properly and doesn't seem to transmit or receive any
> packets.
>
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> ---
> RFC: This is alternative solutionto the
> [PATCH RFC] bgmac: fix *initial* chip reset to support BCM5358
> https://lore.kernel.org/lkml/20230207225327.27534-1-zajec5@gmail.com/T/
>
> Any comments on the prefered solution? Parameter vs. flag?
Seems to me that the flags have been used to express
features/quirks/capabilities as much as what you are trying to do here,
flag would be my preference. LGTM otherwise.
--
Florian
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-02-24 18:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-24 13:48 [PATCH RFC Vb] bgmac: fix *initial* chip reset to support BCM5358 Rafał Miłecki
2023-02-24 18:03 ` Florian Fainelli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).