26e9ae3bcd22042300b0bd0d1b0530e089152fd5
[openwrt/staging/dangole.git] /
1 From e7731194fdf085f46d58b1adccfddbd0dfee4873 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Fri, 7 Jul 2023 08:53:25 +0200
4 Subject: [PATCH] net: bgmac: postpone turning IRQs off to avoid SoC hangs
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Turning IRQs off is done by accessing Ethernet controller registers.
10 That can't be done until device's clock is enabled. It results in a SoC
11 hang otherwise.
12
13 This bug remained unnoticed for years as most bootloaders keep all
14 Ethernet interfaces turned on. It seems to only affect a niche SoC
15 family BCM47189. It has two Ethernet controllers but CFE bootloader uses
16 only the first one.
17
18 Fixes: 34322615cbaa ("net: bgmac: Mask interrupts during probe")
19 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
20 Reviewed-by: Michal Kubiak <michal.kubiak@intel.com>
21 Signed-off-by: David S. Miller <davem@davemloft.net>
22 ---
23 drivers/net/ethernet/broadcom/bgmac.c | 4 ++--
24 1 file changed, 2 insertions(+), 2 deletions(-)
25
26 --- a/drivers/net/ethernet/broadcom/bgmac.c
27 +++ b/drivers/net/ethernet/broadcom/bgmac.c
28 @@ -1492,8 +1492,6 @@ int bgmac_enet_probe(struct bgmac *bgmac
29
30 bgmac->in_init = true;
31
32 - bgmac_chip_intrs_off(bgmac);
33 -
34 net_dev->irq = bgmac->irq;
35 SET_NETDEV_DEV(net_dev, bgmac->dev);
36 dev_set_drvdata(bgmac->dev, bgmac);
37 @@ -1511,6 +1509,8 @@ int bgmac_enet_probe(struct bgmac *bgmac
38 */
39 bgmac_clk_enable(bgmac, 0);
40
41 + bgmac_chip_intrs_off(bgmac);
42 +
43 /* This seems to be fixing IRQ by assigning OOB #6 to the core */
44 if (!(bgmac->feature_flags & BGMAC_FEAT_IDM_MASK)) {
45 if (bgmac->feature_flags & BGMAC_FEAT_IRQ_ID_OOB_6)