kernel: fix bgmac support for BCM5358
Fix two long-standing regressions. Fixes: https://github.com/openwrt/openwrt/issues/8278 Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit 5e48c534f7c6b3a861f4a2dbb81d7bfcd9606f61)
This commit is contained in:
parent
1d206bcd71
commit
64261da739
@ -0,0 +1,76 @@
|
||||
From 327dabbd0111910a7d174b0b812d608d6b67bead Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
|
||||
Date: Mon, 8 Aug 2022 23:05:25 +0200
|
||||
Subject: [PATCH] bgmac: fix *initial* chip reset to support BCM5358
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
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.
|
||||
|
||||
Originally bgmac was calling bgmac_chip_reset() before setting
|
||||
"has_robosw" property which resulted in expected behaviour. That has
|
||||
changed as a side effect of adding platform device support which
|
||||
regressed BCM5358 support.
|
||||
|
||||
Fixes: f6a95a24957a ("net: ethernet: bgmac: Add platform device support")
|
||||
Cc: Jon Mason <jdmason@kudzu.us>
|
||||
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
|
||||
---
|
||||
drivers/net/ethernet/broadcom/bgmac.c | 8 ++++++--
|
||||
drivers/net/ethernet/broadcom/bgmac.h | 2 ++
|
||||
2 files changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
--- 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(
|
||||
|
||||
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);
|
||||
@@ -1489,6 +1489,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;
|
||||
@@ -1538,6 +1540,8 @@ int bgmac_enet_probe(struct bgmac *bgmac
|
||||
net_dev->hw_features = net_dev->features;
|
||||
net_dev->vlan_features = net_dev->features;
|
||||
|
||||
+ bgmac->in_init = false;
|
||||
+
|
||||
err = register_netdev(bgmac->net_dev);
|
||||
if (err) {
|
||||
dev_err(bgmac->dev, "Cannot register net device\n");
|
||||
--- a/drivers/net/ethernet/broadcom/bgmac.h
|
||||
+++ b/drivers/net/ethernet/broadcom/bgmac.h
|
||||
@@ -511,6 +511,8 @@ struct bgmac {
|
||||
int irq;
|
||||
u32 int_mask;
|
||||
|
||||
+ bool in_init;
|
||||
+
|
||||
/* Current MAC state */
|
||||
int mac_speed;
|
||||
int mac_duplex;
|
@ -14,7 +14,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
|
||||
--- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
|
||||
+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
|
||||
@@ -268,6 +268,7 @@ static int bgmac_probe(struct bcma_devic
|
||||
@@ -280,6 +280,7 @@ static int bgmac_probe(struct bcma_devic
|
||||
bgmac->feature_flags |= BGMAC_FEAT_CLKCTLST;
|
||||
bgmac->feature_flags |= BGMAC_FEAT_NO_RESET;
|
||||
bgmac->feature_flags |= BGMAC_FEAT_FORCE_SPEED_2500;
|
||||
@ -50,7 +50,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
/**************************************************
|
||||
* MII
|
||||
**************************************************/
|
||||
@@ -1538,6 +1550,14 @@ int bgmac_enet_probe(struct bgmac *bgmac
|
||||
@@ -1540,6 +1552,14 @@ int bgmac_enet_probe(struct bgmac *bgmac
|
||||
net_dev->hw_features = net_dev->features;
|
||||
net_dev->vlan_features = net_dev->features;
|
||||
|
||||
@ -62,10 +62,10 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
+ bgmac->b53_device = &bgmac_b53_dev;
|
||||
+ }
|
||||
+
|
||||
bgmac->in_init = false;
|
||||
|
||||
err = register_netdev(bgmac->net_dev);
|
||||
if (err) {
|
||||
dev_err(bgmac->dev, "Cannot register net device\n");
|
||||
@@ -1560,6 +1580,10 @@ EXPORT_SYMBOL_GPL(bgmac_enet_probe);
|
||||
@@ -1564,6 +1584,10 @@ EXPORT_SYMBOL_GPL(bgmac_enet_probe);
|
||||
|
||||
void bgmac_enet_remove(struct bgmac *bgmac)
|
||||
{
|
||||
@ -86,7 +86,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
|
||||
struct bgmac_slot_info {
|
||||
union {
|
||||
@@ -532,6 +533,9 @@ struct bgmac {
|
||||
@@ -534,6 +535,9 @@ struct bgmac {
|
||||
void (*cmn_maskset32)(struct bgmac *bgmac, u16 offset, u32 mask,
|
||||
u32 set);
|
||||
int (*phy_connect)(struct bgmac *bgmac);
|
||||
|
Loading…
x
Reference in New Issue
Block a user