Add patches sent upstream for bmips and b53 and remove downstream ones.
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
--- a/arch/mips/bmips/setup.c
+++ b/arch/mips/bmips/setup.c
-@@ -31,11 +31,51 @@
+@@ -31,13 +31,52 @@
#define RELO_NORMAL_VEC BIT(18)
+#define REG_BCM63268_MISC_SB ((void __iomem *)CKSEG1ADDR(0x10001814))
+#define BCM63268_FCVO_SHIFT 21
+#define BCM63268_FCVO_MASK (0xf << BCM63268_FCVO_SHIFT)
-+
+
+ extern bool bmips_rac_flush_disable;
static const unsigned long kbase = VMLINUX_LOAD_ADDRESS & 0xfff00000;
struct bmips_quirk {
const char *compatible;
void (*quirk_fn)(void);
-@@ -134,17 +174,161 @@ const char *get_system_type(void)
+@@ -142,17 +181,161 @@ const char *get_system_type(void)
return "Generic BMIPS kernel";
}
#define REG_BCM6368_DDR_PLLC ((void __iomem *)CKSEG1ADDR(0x100012a0))
#define BCM6368_PLLC_P1_SHIFT 0
#define BCM6368_PLLC_P1_MASK (0xf << BCM6368_PLLC_P1_SHIFT)
-@@ -67,7 +73,21 @@
+@@ -67,6 +73,21 @@
#define REG_BCM63268_MISC_SB ((void __iomem *)CKSEG1ADDR(0x10001814))
#define BCM63268_FCVO_SHIFT 21
#define BCM63268_FCVO_MASK (0xf << BCM63268_FCVO_SHIFT)
+#define BCM63268_MEMC_ADDR ((void __iomem *)CKSEG1ADDR(0x10003000))
-
++
+#define SDRAM_CFG_REG 0x0
+#define SDRAM_SPACE_SHIFT 4
+#define SDRAM_SPACE_MASK (0xf << SDRAM_SPACE_SHIFT)
+
+#define DDR_CSEND_REG 0x8
- static const unsigned long kbase = VMLINUX_LOAD_ADDRESS & 0xfff00000;
+ extern bool bmips_rac_flush_disable;
-@@ -76,6 +96,11 @@ struct bmips_cpufreq {
+@@ -77,6 +98,11 @@ struct bmips_cpufreq {
u32 (*cpu_freq)(void);
};
struct bmips_quirk {
const char *compatible;
void (*quirk_fn)(void);
-@@ -333,9 +358,90 @@ void __init plat_time_init(void)
+@@ -340,9 +366,90 @@ void __init plat_time_init(void)
mips_hpt_frequency = freq;
}
const struct bmips_quirk *q;
set_io_port_base(0);
-@@ -353,6 +459,18 @@ void __init plat_mem_setup(void)
+@@ -360,6 +467,18 @@ void __init plat_mem_setup(void)
__dt_setup_arch(dtb);
+++ /dev/null
-From f48c93e4c4b5dbad1c0fbd623fd68f55f1667527 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
-Date: Fri, 10 Mar 2023 13:05:10 +0100
-Subject: [PATCH] mips: bmips: BCM6358: disable arch_sync_dma_for_cpu_all() for
- TP1
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-arch_sync_dma_for_cpu_all() causes kernel panics on BCM6358 with EHCI/OHCI:
-[ 3.881739] usb 1-1: new high-speed USB device number 2 using ehci-platform
-[ 3.895011] Reserved instruction in kernel code[#1]:
-[ 3.900113] CPU: 0 PID: 1 Comm: init Not tainted 5.10.16 #0
-[ 3.905829] $ 0 : 00000000 10008700 00000000 77d94060
-[ 3.911238] $ 4 : 7fd1f088 00000000 81431cac 81431ca0
-[ 3.916641] $ 8 : 00000000 ffffefff 8075cd34 00000000
-[ 3.922043] $12 : 806f8d40 f3e812b7 00000000 000d9aaa
-[ 3.927446] $16 : 7fd1f068 7fd1f080 7ff559b8 81428470
-[ 3.932848] $20 : 00000000 00000000 55590000 77d70000
-[ 3.938251] $24 : 00000018 00000010
-[ 3.943655] $28 : 81430000 81431e60 81431f28 800157fc
-[ 3.949058] Hi : 00000000
-[ 3.952013] Lo : 00000000
-[ 3.955019] epc : 80015808 setup_sigcontext+0x54/0x24c
-[ 3.960464] ra : 800157fc setup_sigcontext+0x48/0x24c
-[ 3.965913] Status: 10008703 KERNEL EXL IE
-[ 3.970216] Cause : 00800028 (ExcCode 0a)
-[ 3.974340] PrId : 0002a010 (Broadcom BMIPS4350)
-[ 3.979170] Modules linked in: ohci_platform ohci_hcd fsl_mph_dr_of ehci_platform ehci_fsl ehci_hcd gpio_button_hotplug usbcore nls_base usb_common
-[ 3.992907] Process init (pid: 1, threadinfo=(ptrval), task=(ptrval), tls=77e22ec8)
-[ 4.000776] Stack : 81431ef4 7fd1f080 81431f28 81428470 7fd1f068 81431edc 7ff559b8 81428470
-[ 4.009467] 81431f28 7fd1f080 55590000 77d70000 77d5498c 80015c70 806f0000 8063ae74
-[ 4.018149] 08100002 81431f28 0000000a 08100002 81431f28 0000000a 77d6b418 00000003
-[ 4.026831] ffffffff 80016414 80080734 81431ecc 81431ecc 00000001 00000000 04000000
-[ 4.035512] 77d54874 00000000 00000000 00000000 00000000 00000012 00000002 00000000
-[ 4.044196] ...
-[ 4.046706] Call Trace:
-[ 4.049238] [<80015808>] setup_sigcontext+0x54/0x24c
-[ 4.054356] [<80015c70>] setup_frame+0xdc/0x124
-[ 4.059015] [<80016414>] do_notify_resume+0x1dc/0x288
-[ 4.064207] [<80011b50>] work_notifysig+0x10/0x18
-[ 4.069036]
-[ 4.070538] Code: 8fc300b4 00001025 26240008 <ac820000> ac830004 3c048063 0c0228aa 24846a00 26240010
-[ 4.080686]
-[ 4.082517] ---[ end trace 22a8edb41f5f983b ]---
-[ 4.087374] Kernel panic - not syncing: Fatal exception
-[ 4.092753] Rebooting in 1 seconds..
-
-This only happens when booting from TP1 instead of TP0.
-
-Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
----
- arch/mips/bmips/dma.c | 5 +++++
- arch/mips/bmips/setup.c | 9 +++++++++
- 2 files changed, 14 insertions(+)
-
---- a/arch/mips/bmips/dma.c
-+++ b/arch/mips/bmips/dma.c
-@@ -64,11 +64,16 @@ phys_addr_t dma_to_phys(struct device *d
- return dma_addr;
- }
-
-+int bmips_dma_sync_disable = 0;
-+
- void arch_sync_dma_for_cpu_all(void)
- {
- void __iomem *cbr = BMIPS_GET_CBR();
- u32 cfg;
-
-+ if (bmips_dma_sync_disable)
-+ return;
-+
- if (boot_cpu_type() != CPU_BMIPS3300 &&
- boot_cpu_type() != CPU_BMIPS4350 &&
- boot_cpu_type() != CPU_BMIPS4380)
---- a/arch/mips/bmips/setup.c
-+++ b/arch/mips/bmips/setup.c
-@@ -89,6 +89,8 @@
-
- #define DDR_CSEND_REG 0x8
-
-+extern int bmips_dma_sync_disable;
-+
- static const unsigned long kbase = VMLINUX_LOAD_ADDRESS & 0xfff00000;
-
- struct bmips_cpufreq {
-@@ -168,6 +170,13 @@ static void bcm6358_quirks(void)
- * disable SMP for now
- */
- bmips_smp_enabled = 0;
-+
-+ /*
-+ * ARCH_HAS_SYNC_DMA_FOR_CPU_ALL causes kernel panics on BCM6358 when
-+ * booting from TP1
-+ */
-+ if (read_c0_brcm_cmt_local() & (1 << 31))
-+ bmips_dma_sync_disable = 1;
- }
-
- static void bcm6368_quirks(void)
--- /dev/null
+From 20a4b57c0fafd23ae0f6bcab5b5adf4af4c80280 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
+Date: Thu, 16 Mar 2023 19:31:21 +0100
+Subject: [PATCH] mips: bmips: tweak Kconfig options
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
+---
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/mips/Kconfig
++++ b/arch/mips/Kconfig
+@@ -274,25 +274,20 @@ config BMIPS_GENERIC
+ select SYNC_R4K
+ select COMMON_CLK
+ select BCM6345_L1_IRQ
+- select BCM7038_L1_IRQ
+- select BCM7120_L2_IRQ
+- select BRCMSTB_L2_IRQ
+ select IRQ_MIPS_CPU
+ select DMA_NONCOHERENT
+ select SYS_SUPPORTS_32BIT_KERNEL
+- select SYS_SUPPORTS_LITTLE_ENDIAN
+ select SYS_SUPPORTS_BIG_ENDIAN
+- select SYS_SUPPORTS_HIGHMEM
+ select SYS_HAS_CPU_BMIPS32_3300
+ select SYS_HAS_CPU_BMIPS4350
+ select SYS_HAS_CPU_BMIPS4380
+- select SYS_HAS_CPU_BMIPS5000
+ select SWAP_IO_SPACE
+ select USB_EHCI_BIG_ENDIAN_DESC if CPU_BIG_ENDIAN
+ select USB_EHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN
+ select USB_OHCI_BIG_ENDIAN_DESC if CPU_BIG_ENDIAN
+ select USB_OHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN
+ select HARDIRQS_SW_RESEND
++ select MIPS_L1_CACHE_SHIFT_4
+ help
+ Build a generic DT-based kernel image that boots on select
+ BCM33xx cable modem chips, BCM63xx DSL chips, and BCM7xxx set-top
+++ /dev/null
-From b5c07b7bceed9287647697408423acd08f97db73 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
-Date: Thu, 16 Mar 2023 18:42:41 +0100
-Subject: [PATCH] irqchip/bcm-6345-l1: request memory region
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Request memory region in order to display it in /proc/iomem.
-Also stop printing the MMIO address since it just displays (ptrval).
-
-Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
----
- drivers/irqchip/irq-bcm6345-l1.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
---- a/drivers/irqchip/irq-bcm6345-l1.c
-+++ b/drivers/irqchip/irq-bcm6345-l1.c
-@@ -261,6 +261,9 @@ static int __init bcm6345_l1_init_one(st
- if (!cpu->map_base)
- return -ENOMEM;
-
-+ if (!request_mem_region(res.start, sz, res.name))
-+ pr_err("Failed to request intc memory");
-+
- for (i = 0; i < n_words; i++) {
- cpu->enable_cache[i] = 0;
- __raw_writel(0, cpu->map_base + reg_enable(intc, i));
-@@ -339,8 +342,7 @@ static int __init bcm6345_l1_of_init(str
- for_each_cpu(idx, &intc->cpumask) {
- struct bcm6345_l1_cpu *cpu = intc->cpus[idx];
-
-- pr_info(" CPU%u at MMIO 0x%p (irq = %d)\n", idx,
-- cpu->map_base, cpu->parent_irq);
-+ pr_info(" CPU%u (irq = %d)\n", idx, cpu->parent_irq);
- }
-
- return 0;
+++ /dev/null
-From 20a4b57c0fafd23ae0f6bcab5b5adf4af4c80280 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
-Date: Thu, 16 Mar 2023 19:31:21 +0100
-Subject: [PATCH] mips: bmips: tweak Kconfig options
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
----
- Makefile | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/arch/mips/Kconfig
-+++ b/arch/mips/Kconfig
-@@ -274,25 +274,20 @@ config BMIPS_GENERIC
- select SYNC_R4K
- select COMMON_CLK
- select BCM6345_L1_IRQ
-- select BCM7038_L1_IRQ
-- select BCM7120_L2_IRQ
-- select BRCMSTB_L2_IRQ
- select IRQ_MIPS_CPU
- select DMA_NONCOHERENT
- select SYS_SUPPORTS_32BIT_KERNEL
-- select SYS_SUPPORTS_LITTLE_ENDIAN
- select SYS_SUPPORTS_BIG_ENDIAN
-- select SYS_SUPPORTS_HIGHMEM
- select SYS_HAS_CPU_BMIPS32_3300
- select SYS_HAS_CPU_BMIPS4350
- select SYS_HAS_CPU_BMIPS4380
-- select SYS_HAS_CPU_BMIPS5000
- select SWAP_IO_SPACE
- select USB_EHCI_BIG_ENDIAN_DESC if CPU_BIG_ENDIAN
- select USB_EHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN
- select USB_OHCI_BIG_ENDIAN_DESC if CPU_BIG_ENDIAN
- select USB_OHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN
- select HARDIRQS_SW_RESEND
-+ select MIPS_L1_CACHE_SHIFT_4
- help
- Build a generic DT-based kernel image that boots on select
- BCM33xx cable modem chips, BCM63xx DSL chips, and BCM7xxx set-top
+++ /dev/null
-From dadd7a1aa1eaebd5a03dee933c9051eae3724f00 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
-Date: Thu, 9 Mar 2023 19:18:07 +0100
-Subject: [PATCH] net: dsa: b53: mmap: fix device tree support
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-CPU port should also be enabled in order to get a working switch.
-
-Fixes: a5538a777b73 ("net: dsa: b53: mmap: Add device tree support")
-Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
----
- drivers/net/dsa/b53/b53_mmap.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/net/dsa/b53/b53_mmap.c
-+++ b/drivers/net/dsa/b53/b53_mmap.c
-@@ -263,7 +263,7 @@ static int b53_mmap_probe_of(struct plat
- if (of_property_read_u32(of_port, "reg", ®))
- continue;
-
-- if (reg < B53_CPU_PORT)
-+ if (reg < B53_N_PORTS)
- pdata->enabled_ports |= BIT(reg);
- }
-
+++ /dev/null
-From 32cf73d8c6485b7b97aca7e377a68436d09b7022 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
-Date: Sun, 14 Mar 2021 20:03:44 +0100
-Subject: [PATCH] net: dsa: b53: add support for BCM63xx RGMIIs
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
----
- drivers/net/dsa/b53/b53_common.c | 37 ++++++++++++++++++++++++++++++++
- 1 file changed, 37 insertions(+)
-
---- a/drivers/net/dsa/b53/b53_common.c
-+++ b/drivers/net/dsa/b53/b53_common.c
-@@ -1209,6 +1209,36 @@ static void b53_force_port_config(struct
- b53_write8(dev, B53_CTRL_PAGE, off, reg);
- }
-
-+static void b53_adjust_63xx_rgmii(struct dsa_switch *ds, int port,
-+ phy_interface_t interface)
-+{
-+ struct b53_device *dev = ds->priv;
-+ u8 rgmii_ctrl = 0, off;
-+
-+ if (port == 8)
-+ off = B53_RGMII_CTRL_IMP;
-+ else
-+ off = B53_RGMII_CTRL_P(port);
-+
-+ b53_read8(dev, B53_CTRL_PAGE, off, &rgmii_ctrl);
-+
-+ rgmii_ctrl &= ~(RGMII_CTRL_DLL_RXC | RGMII_CTRL_DLL_TXC);
-+ if (interface == PHY_INTERFACE_MODE_RGMII_ID)
-+ rgmii_ctrl |= (RGMII_CTRL_DLL_RXC | RGMII_CTRL_DLL_TXC);
-+ else if (interface == PHY_INTERFACE_MODE_RGMII_RXID)
-+ rgmii_ctrl |= RGMII_CTRL_DLL_RXC;
-+ else if (interface == PHY_INTERFACE_MODE_RGMII_TXID)
-+ rgmii_ctrl |= RGMII_CTRL_DLL_TXC;
-+
-+ if (port != B53_CPU_PORT)
-+ rgmii_ctrl |= RGMII_CTRL_ENABLE_GMII;
-+
-+ b53_write8(dev, B53_CTRL_PAGE, off, rgmii_ctrl);
-+
-+ dev_info(ds->dev, "Configured port %d for %s\n", port,
-+ phy_modes(interface));
-+}
-+
- static void b53_adjust_link(struct dsa_switch *ds, int port,
- struct phy_device *phydev)
- {
-@@ -1235,6 +1265,9 @@ static void b53_adjust_link(struct dsa_s
- tx_pause, rx_pause);
- b53_force_link(dev, port, phydev->link);
-
-+ if (is63xx(dev))
-+ b53_adjust_63xx_rgmii(ds, port, phydev->interface);
-+
- if (is531x5(dev) && phy_interface_is_rgmii(phydev)) {
- if (port == dev->imp_port)
- off = B53_RGMII_CTRL_IMP;
-@@ -1419,6 +1452,9 @@ void b53_phylink_mac_link_up(struct dsa_
- {
- struct b53_device *dev = ds->priv;
-
-+ if (is63xx(dev) && port >= 4)
-+ b53_adjust_63xx_rgmii(ds, port, interface);
-+
- if (mode == MLO_AN_PHY)
- return;
-
--- /dev/null
+From patchwork Fri Mar 17 10:20:04 2023
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 8bit
+X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?=
+ <noltari@gmail.com>
+X-Patchwork-Id: 13178815
+Return-Path: <linux-mips-owner@vger.kernel.org>
+X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
+ aws-us-west-2-korg-lkml-1.web.codeaurora.org
+Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
+ by smtp.lore.kernel.org (Postfix) with ESMTP id 583F3C6FD1D
+ for <linux-mips@archiver.kernel.org>; Fri, 17 Mar 2023 10:20:18 +0000 (UTC)
+Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
+ id S230027AbjCQKUQ (ORCPT <rfc822;linux-mips@archiver.kernel.org>);
+ Fri, 17 Mar 2023 06:20:16 -0400
+Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59114 "EHLO
+ lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
+ with ESMTP id S230044AbjCQKUN (ORCPT
+ <rfc822;linux-mips@vger.kernel.org>); Fri, 17 Mar 2023 06:20:13 -0400
+Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com
+ [IPv6:2a00:1450:4864:20::32f])
+ by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D53A3A8C6D;
+ Fri, 17 Mar 2023 03:20:11 -0700 (PDT)
+Received: by mail-wm1-x32f.google.com with SMTP id m35so2981539wms.4;
+ Fri, 17 Mar 2023 03:20:11 -0700 (PDT)
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=gmail.com; s=20210112; t=1679048410;
+ h=content-transfer-encoding:mime-version:references:in-reply-to
+ :message-id:date:subject:cc:to:from:from:to:cc:subject:date
+ :message-id:reply-to;
+ bh=B2zyx3U3AXPDRFjYOKBt3zCYzGwvMHjuxaFvhcNGMYw=;
+ b=K3QDrLd9/AHTE97KGupZsihjvv1DcPrg2e5kH4N0u/ThdjpSlxk4PJnJ9/W85XPSVY
+ zfpR2A/7EoOEyo9550zL4/vmpfYl5lHM165L/lkqA7Wk5e/nBD9VnONeb+Ez793paFFp
+ RxLrZ8g8vsw5NIz3niUCWkssoP2pnhKziF9soVnCQVqJa9NU+K+eBXiQWjYeXVVpf8Ea
+ AoOekpaWai5FbM4COmKJ/BDQtrJNRfInvBhVWCCkHFy1S5u62UdueveL3+51NeXMtdqz
+ SetdI7WF1tRyDt+Xg/KfChDi8C0UaNruqs4LXxNzfsB61BFNwRFhSKOZM1Upw0RCaBBt
+ 0+2Q==
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=1e100.net; s=20210112; t=1679048410;
+ h=content-transfer-encoding:mime-version:references:in-reply-to
+ :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
+ :subject:date:message-id:reply-to;
+ bh=B2zyx3U3AXPDRFjYOKBt3zCYzGwvMHjuxaFvhcNGMYw=;
+ b=ssmBiLA9DVCYeyC8re6arEIfPSvf12+ZaR/lSBvPJ7neJBPgX28RJgfWLbi9OusC5u
+ wmSMBZ0qVjMyrcS6sYaOGQ56OxGeHkV1AoCPChp4/4gaWQJmyqY+2oPTGkA2+m0074uL
+ T2+QW0Lur1M2SHucj+0efX80LEnRxP5vm9AM4eyLIlJ2QQxjgZXugBUhCrbZGXiEP9eB
+ SdMQGSWQD8CGXoT5XdlsjsoVz1OD3eTQ473h9hoEzJJHt8iaev/cbakU+sXJp47LAOm+
+ Z9lFp48X9PYKCMLnIpv9R7wDOZEuVUsFbSt+cWYjYhe/2pk81hq/6GoqwRg49d5RCGYg
+ 0yJQ==
+X-Gm-Message-State: AO0yUKXr0uvEyGo9igqtrAKEBKNPRe53kAqRy0B/zeh/7tt0qOu9YtUj
+ YMatgtK4nm//OUHE/4+7hlAo/t4+V2+khw==
+X-Google-Smtp-Source:
+ AK7set+XbAcnblyGYtZEQ3m/zbT8wd4QB6ZZhQIf//mcWDT47T1rsYpCDodIx9M1dCI0qTfC6sZw7w==
+X-Received: by 2002:a05:600c:540a:b0:3ea:e582:48dd with SMTP id
+ he10-20020a05600c540a00b003eae58248ddmr24486119wmb.34.1679048409764;
+ Fri, 17 Mar 2023 03:20:09 -0700 (PDT)
+Received: from atlantis.lan (255.red-79-146-124.dynamicip.rima-tde.net.
+ [79.146.124.255])
+ by smtp.gmail.com with ESMTPSA id
+ 1-20020a05600c234100b003e00c453447sm7336512wmq.48.2023.03.17.03.20.08
+ (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
+ Fri, 17 Mar 2023 03:20:09 -0700 (PDT)
+From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= <noltari@gmail.com>
+To: f.fainelli@gmail.com, jonas.gorski@gmail.com,
+ bcm-kernel-feedback-list@broadcom.com, tsbogend@alpha.franken.de,
+ linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
+Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= <noltari@gmail.com>
+Subject: [PATCH v3] mips: bmips: BCM6358: disable RAC flush for TP1
+Date: Fri, 17 Mar 2023 11:20:04 +0100
+Message-Id: <20230317102004.235879-1-noltari@gmail.com>
+X-Mailer: git-send-email 2.30.2
+In-Reply-To: <20230316180518.783613-1-noltari@gmail.com>
+References: <20230316180518.783613-1-noltari@gmail.com>
+MIME-Version: 1.0
+Precedence: bulk
+List-ID: <linux-mips.vger.kernel.org>
+X-Mailing-List: linux-mips@vger.kernel.org
+
+RAC flush causes kernel panics on BCM6358 with EHCI/OHCI when booting from TP1:
+[ 3.881739] usb 1-1: new high-speed USB device number 2 using ehci-platform
+[ 3.895011] Reserved instruction in kernel code[#1]:
+[ 3.900113] CPU: 0 PID: 1 Comm: init Not tainted 5.10.16 #0
+[ 3.905829] $ 0 : 00000000 10008700 00000000 77d94060
+[ 3.911238] $ 4 : 7fd1f088 00000000 81431cac 81431ca0
+[ 3.916641] $ 8 : 00000000 ffffefff 8075cd34 00000000
+[ 3.922043] $12 : 806f8d40 f3e812b7 00000000 000d9aaa
+[ 3.927446] $16 : 7fd1f068 7fd1f080 7ff559b8 81428470
+[ 3.932848] $20 : 00000000 00000000 55590000 77d70000
+[ 3.938251] $24 : 00000018 00000010
+[ 3.943655] $28 : 81430000 81431e60 81431f28 800157fc
+[ 3.949058] Hi : 00000000
+[ 3.952013] Lo : 00000000
+[ 3.955019] epc : 80015808 setup_sigcontext+0x54/0x24c
+[ 3.960464] ra : 800157fc setup_sigcontext+0x48/0x24c
+[ 3.965913] Status: 10008703 KERNEL EXL IE
+[ 3.970216] Cause : 00800028 (ExcCode 0a)
+[ 3.974340] PrId : 0002a010 (Broadcom BMIPS4350)
+[ 3.979170] Modules linked in: ohci_platform ohci_hcd fsl_mph_dr_of ehci_platform ehci_fsl ehci_hcd gpio_button_hotplug usbcore nls_base usb_common
+[ 3.992907] Process init (pid: 1, threadinfo=(ptrval), task=(ptrval), tls=77e22ec8)
+[ 4.000776] Stack : 81431ef4 7fd1f080 81431f28 81428470 7fd1f068 81431edc 7ff559b8 81428470
+[ 4.009467] 81431f28 7fd1f080 55590000 77d70000 77d5498c 80015c70 806f0000 8063ae74
+[ 4.018149] 08100002 81431f28 0000000a 08100002 81431f28 0000000a 77d6b418 00000003
+[ 4.026831] ffffffff 80016414 80080734 81431ecc 81431ecc 00000001 00000000 04000000
+[ 4.035512] 77d54874 00000000 00000000 00000000 00000000 00000012 00000002 00000000
+[ 4.044196] ...
+[ 4.046706] Call Trace:
+[ 4.049238] [<80015808>] setup_sigcontext+0x54/0x24c
+[ 4.054356] [<80015c70>] setup_frame+0xdc/0x124
+[ 4.059015] [<80016414>] do_notify_resume+0x1dc/0x288
+[ 4.064207] [<80011b50>] work_notifysig+0x10/0x18
+[ 4.069036]
+[ 4.070538] Code: 8fc300b4 00001025 26240008 <ac820000> ac830004 3c048063 0c0228aa 24846a00 26240010
+[ 4.080686]
+[ 4.082517] ---[ end trace 22a8edb41f5f983b ]---
+[ 4.087374] Kernel panic - not syncing: Fatal exception
+[ 4.092753] Rebooting in 1 seconds..
+
+Because the bootloader (CFE) is not initializing the Read-ahead cache properly
+on the second thread (TP1). Since the RAC was not initialized properly, we
+should avoid flushing it at the risk of corrupting the instruction stream as
+seen in the trace above.
+
+Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
+---
+ v3: add changes suggested by Florian:
+ - Switch to a bool and remove unneeded initialization.
+ - Remove if from bcm6358_quirks().
+ - Improve commit description and bcm6358_quirks() comment.
+ v2: check if we're running on TP1 and invert logic.
+
+ arch/mips/bmips/dma.c | 5 +++++
+ arch/mips/bmips/setup.c | 8 ++++++++
+ 2 files changed, 13 insertions(+)
+
+--- a/arch/mips/bmips/dma.c
++++ b/arch/mips/bmips/dma.c
+@@ -64,6 +64,8 @@ phys_addr_t dma_to_phys(struct device *d
+ return dma_addr;
+ }
+
++bool bmips_rac_flush_disable;
++
+ void arch_sync_dma_for_cpu_all(void)
+ {
+ void __iomem *cbr = BMIPS_GET_CBR();
+@@ -74,6 +76,9 @@ void arch_sync_dma_for_cpu_all(void)
+ boot_cpu_type() != CPU_BMIPS4380)
+ return;
+
++ if (unlikely(bmips_rac_flush_disable))
++ return;
++
+ /* Flush stale data out of the readahead cache */
+ cfg = __raw_readl(cbr + BMIPS_RAC_CONFIG);
+ __raw_writel(cfg | 0x100, cbr + BMIPS_RAC_CONFIG);
+--- a/arch/mips/bmips/setup.c
++++ b/arch/mips/bmips/setup.c
+@@ -34,6 +34,8 @@
+ #define REG_BCM6328_OTP ((void __iomem *)CKSEG1ADDR(0x1000062c))
+ #define BCM6328_TP1_DISABLED BIT(9)
+
++extern bool bmips_rac_flush_disable;
++
+ static const unsigned long kbase = VMLINUX_LOAD_ADDRESS & 0xfff00000;
+
+ struct bmips_quirk {
+@@ -103,6 +105,12 @@ static void bcm6358_quirks(void)
+ * disable SMP for now
+ */
+ bmips_smp_enabled = 0;
++
++ /*
++ * RAC flush causes kernel panics on BCM6358 when booting from TP1
++ * because the bootloader is not initializing it properly.
++ */
++ bmips_rac_flush_disable = !!(read_c0_brcm_cmt_local() & (1 << 31));
+ }
+
+ static void bcm6368_quirks(void)
--- /dev/null
+From patchwork Thu Mar 16 19:28:33 2023
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 8bit
+X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?=
+ <noltari@gmail.com>
+X-Patchwork-Id: 13178238
+Return-Path: <linux-mips-owner@vger.kernel.org>
+X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
+ aws-us-west-2-korg-lkml-1.web.codeaurora.org
+Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
+ by smtp.lore.kernel.org (Postfix) with ESMTP id 5EF2AC6FD19
+ for <linux-mips@archiver.kernel.org>; Thu, 16 Mar 2023 19:28:43 +0000 (UTC)
+Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
+ id S230076AbjCPT2l (ORCPT <rfc822;linux-mips@archiver.kernel.org>);
+ Thu, 16 Mar 2023 15:28:41 -0400
+Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56412 "EHLO
+ lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
+ with ESMTP id S230039AbjCPT2k (ORCPT
+ <rfc822;linux-mips@vger.kernel.org>); Thu, 16 Mar 2023 15:28:40 -0400
+Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com
+ [IPv6:2a00:1450:4864:20::42f])
+ by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7259B7D9F;
+ Thu, 16 Mar 2023 12:28:38 -0700 (PDT)
+Received: by mail-wr1-x42f.google.com with SMTP id y14so2539231wrq.4;
+ Thu, 16 Mar 2023 12:28:38 -0700 (PDT)
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=gmail.com; s=20210112; t=1678994917;
+ h=content-transfer-encoding:mime-version:references:in-reply-to
+ :message-id:date:subject:cc:to:from:from:to:cc:subject:date
+ :message-id:reply-to;
+ bh=j8afldfRZftLeVmekmQfoh01jVdumsVP7nkKoPaU3Q0=;
+ b=FzMRr5ekh/fDiJqTlezNj6nLjzvn5z92FtYeB8MquVSMB8PuvarccnyqAzsXiccf+v
+ uwRFIomnTWNLGVjzc1xrB2hGiCKD3jBo5n1u8p/yEV6rpolbxVjfM7eTHXyAHXGXz7ZJ
+ TPeVbWfAlxiSD6+BPtXr/efehcdI64fIoL6G/U1WHNMo01Tzr/Obf3y5tug17N0fGcXg
+ CH6E5a2HguZUtwrm26LcK9IOV/7xEx5eIE1cOvTLMxPbGWaZwEjjP16HylJr06xRLhaf
+ RpiYBT3mXwwuOx0jLOhqavY/2kZ9GVbZRWMMwZrZv9xNO13SBwc1VUVgD4k3FntnSk7Z
+ AaOQ==
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=1e100.net; s=20210112; t=1678994917;
+ h=content-transfer-encoding:mime-version:references:in-reply-to
+ :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
+ :subject:date:message-id:reply-to;
+ bh=j8afldfRZftLeVmekmQfoh01jVdumsVP7nkKoPaU3Q0=;
+ b=OaA5DMgqalrfqO5iOtmmxFPsH90MkN7l4EJpyVnzuiO1Wd6rSCpqPOR7xpxZno8OPP
+ tdfm4vzn9Ie4AUDbFKDTUlPG+tgkmIruo3K9C0VnY9DD2PRZMEYBbWaJKU1otqKt0NKu
+ IAAHNvxvQvCESKzbXFLYwWbRKFScOSMGmGBTDfgThz51A18Ff1hJy/BmnuZk7M2TLgHO
+ wQpy9t7oeB/Hkxl41y46emLc/nESsvwvAG/fx/zPzCe9UiaQLrdZq+BKeOwSBedktzK5
+ U/ZTfgzU2UGSI67aGRqqGnI0uXq+MAJMK18qzM0VByxj6W+AXJ6BJr5P0quljeQ8upSg
+ bEUg==
+X-Gm-Message-State: AO0yUKWnqTlccBDnqwCSRdqOBGc2FyfiLy1Tg7EjPENlISpzXuDYwW/R
+ lJSI06rrfq+Vel/SigfpGJI=
+X-Google-Smtp-Source:
+ AK7set/jYfYl9ttVzIXJO+ZQVfa6cE/yOsP8fx4teiTmGNNWyVlIJRzMAlF3IUGqRAXAmY3hAabIuQ==
+X-Received: by 2002:a5d:40ce:0:b0:2cd:ceab:df1a with SMTP id
+ b14-20020a5d40ce000000b002cdceabdf1amr381006wrq.32.1678994916642;
+ Thu, 16 Mar 2023 12:28:36 -0700 (PDT)
+Received: from atlantis.lan (255.red-79-146-124.dynamicip.rima-tde.net.
+ [79.146.124.255])
+ by smtp.gmail.com with ESMTPSA id
+ l10-20020a5d4bca000000b002cfea3c49d5sm180041wrt.52.2023.03.16.12.28.35
+ (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
+ Thu, 16 Mar 2023 12:28:35 -0700 (PDT)
+From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= <noltari@gmail.com>
+To: f.fainelli@gmail.com, jonas.gorski@gmail.com,
+ bcm-kernel-feedback-list@broadcom.com, tglx@linutronix.de,
+ maz@kernel.org, linux-mips@vger.kernel.org,
+ linux-kernel@vger.kernel.org
+Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= <noltari@gmail.com>
+Subject: [PATCH v2] irqchip/bcm-6345-l1: request memory region
+Date: Thu, 16 Mar 2023 20:28:33 +0100
+Message-Id: <20230316192833.1603149-1-noltari@gmail.com>
+X-Mailer: git-send-email 2.30.2
+In-Reply-To: <20230316180701.783785-1-noltari@gmail.com>
+References: <20230316180701.783785-1-noltari@gmail.com>
+MIME-Version: 1.0
+Precedence: bulk
+List-ID: <linux-mips.vger.kernel.org>
+X-Mailing-List: linux-mips@vger.kernel.org
+
+Request memory region in order to display it in /proc/iomem.
+Also stop printing the MMIO address since it just displays (ptrval).
+
+Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
+Acked-by: Florian Fainelli <f.fainelli@gmail.com>
+---
+ v2: request memory region and stop displaying MMIO address.
+
+ drivers/irqchip/irq-bcm6345-l1.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/drivers/irqchip/irq-bcm6345-l1.c
++++ b/drivers/irqchip/irq-bcm6345-l1.c
+@@ -261,6 +261,9 @@ static int __init bcm6345_l1_init_one(st
+ if (!cpu->map_base)
+ return -ENOMEM;
+
++ if (!request_mem_region(res.start, sz, res.name))
++ pr_err("failed to request intc memory");
++
+ for (i = 0; i < n_words; i++) {
+ cpu->enable_cache[i] = 0;
+ __raw_writel(0, cpu->map_base + reg_enable(intc, i));
+@@ -339,8 +342,7 @@ static int __init bcm6345_l1_of_init(str
+ for_each_cpu(idx, &intc->cpumask) {
+ struct bcm6345_l1_cpu *cpu = intc->cpus[idx];
+
+- pr_info(" CPU%u at MMIO 0x%p (irq = %d)\n", idx,
+- cpu->map_base, cpu->parent_irq);
++ pr_info(" CPU%u (irq = %d)\n", idx, cpu->parent_irq);
+ }
+
+ return 0;
--- /dev/null
+From patchwork Thu Mar 16 17:28:07 2023
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 8bit
+X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?=
+ <noltari@gmail.com>
+X-Patchwork-Id: 13178135
+X-Patchwork-Delegate: kuba@kernel.org
+Return-Path: <netdev-owner@vger.kernel.org>
+X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
+ aws-us-west-2-korg-lkml-1.web.codeaurora.org
+Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
+ by smtp.lore.kernel.org (Postfix) with ESMTP id 9F385C6FD19
+ for <netdev@archiver.kernel.org>; Thu, 16 Mar 2023 17:29:18 +0000 (UTC)
+Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
+ id S229918AbjCPR3Q (ORCPT <rfc822;netdev@archiver.kernel.org>);
+ Thu, 16 Mar 2023 13:29:16 -0400
+Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44474 "EHLO
+ lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
+ with ESMTP id S229902AbjCPR3G (ORCPT
+ <rfc822;netdev@vger.kernel.org>); Thu, 16 Mar 2023 13:29:06 -0400
+Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com
+ [IPv6:2a00:1450:4864:20::433])
+ by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB3CC1D929;
+ Thu, 16 Mar 2023 10:29:03 -0700 (PDT)
+Received: by mail-wr1-x433.google.com with SMTP id y14so2246984wrq.4;
+ Thu, 16 Mar 2023 10:29:03 -0700 (PDT)
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=gmail.com; s=20210112; t=1678987742;
+ h=content-transfer-encoding:mime-version:references:in-reply-to
+ :message-id:date:subject:cc:to:from:from:to:cc:subject:date
+ :message-id:reply-to;
+ bh=n/Cr1XNCJNfBa+dPDtalOZXIIV6S3ucGcQ6qFqXXuSc=;
+ b=Ka0GgVg9azCPEBkuB0FcSt9tMYqZVblZJl1uT4KWVRAEgVcgqi44vSYpvlzc3TfFMI
+ Ulqrk15TYN022WhQxI63v/NQum/s+yKg2G7wZYj2wHxsGAaoaLtFw8lsjoqTx8NZjsXO
+ OIlTQqkyvDBE4t4FkO9w47A9Q2ruNzohH7Mng3Kraup/9Wyb3PGdybj/sC9/Pvnw6aPz
+ 4Ep0ufMhgNjCk8X2buy346Tcow1zyQVQeGAZrxQzPbWcwa5rFbWGv6iD4wYbHKYm/DZV
+ ah4lc+p0anRvAsNDlqj9fa+VY96nD4X/R7q5M3u7jTEL5YPvrOH5a8y5P5c92mWXiI7i
+ RABA==
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=1e100.net; s=20210112; t=1678987742;
+ h=content-transfer-encoding:mime-version:references:in-reply-to
+ :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
+ :subject:date:message-id:reply-to;
+ bh=n/Cr1XNCJNfBa+dPDtalOZXIIV6S3ucGcQ6qFqXXuSc=;
+ b=RnTP/w7AloNUBWmU5C26i+lQQMLIbND8o8gY/M87Dw22DuDdCIQQxRQypN9pzW4fmS
+ VfNg/kh5Hydzm2bSw7AXMtT0hrbTfBZr2sB6BEKlojw3txmRVCoDGvlZLhTCRtPYGECX
+ WqK1d37sgZ+bBEtjsPfCoVxdLpMCAjxlzLTCnwIclXsHLJg6Tsup33wu6kCFaQz1GYi1
+ hDlc0KC9TZBXr0+3kzzXVyp0X3P30TlAamlojgoi44oa8246DcMBMtsbhiRPLUsdcIfs
+ k+UDK2IemrCvgh5hfN3tX/DtwzoOxPjmB2FZjdxi7+6+c/abS5IYjQ8I1b30JOzDZeMs
+ E6nA==
+X-Gm-Message-State: AO0yUKXFx+XUMUlLCdoCi82z77K5Ax1VNa78esJmOz5Jv6sQIYmKTgvD
+ VrU+Kl3YdJgxxLbxpm1e8RI=
+X-Google-Smtp-Source:
+ AK7set8fFjLrpZ1Ll4TW9iTex7qD+OJccAtDrfibvtBWYkVr0jRxWbwBsrVExeDl051bEIdDmJrszQ==
+X-Received: by 2002:a5d:61c7:0:b0:2ce:a697:75c7 with SMTP id
+ q7-20020a5d61c7000000b002cea69775c7mr4660631wrv.33.1678987742168;
+ Thu, 16 Mar 2023 10:29:02 -0700 (PDT)
+Received: from atlantis.lan (255.red-79-146-124.dynamicip.rima-tde.net.
+ [79.146.124.255])
+ by smtp.gmail.com with ESMTPSA id
+ n7-20020a5d4847000000b002c5d3f0f737sm7719124wrs.30.2023.03.16.10.29.01
+ (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
+ Thu, 16 Mar 2023 10:29:01 -0700 (PDT)
+From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= <noltari@gmail.com>
+To: f.fainelli@gmail.com, jonas.gorski@gmail.com, andrew@lunn.ch,
+ olteanv@gmail.com, davem@davemloft.net, edumazet@google.com,
+ kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
+ linux-kernel@vger.kernel.org
+Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= <noltari@gmail.com>
+Subject: [PATCH v2] net: dsa: b53: mmap: fix device tree support
+Date: Thu, 16 Mar 2023 18:28:07 +0100
+Message-Id: <20230316172807.460146-1-noltari@gmail.com>
+X-Mailer: git-send-email 2.30.2
+In-Reply-To: <20230310121059.4498-1-noltari@gmail.com>
+References: <20230310121059.4498-1-noltari@gmail.com>
+MIME-Version: 1.0
+Precedence: bulk
+List-ID: <netdev.vger.kernel.org>
+X-Mailing-List: netdev@vger.kernel.org
+X-Patchwork-Delegate: kuba@kernel.org
+
+CPU port should also be enabled in order to get a working switch.
+
+Fixes: a5538a777b73 ("net: dsa: b53: mmap: Add device tree support")
+Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
+Acked-by: Florian Fainelli <f.fainelli@gmail.com>
+---
+ v2: switch to B53_N_PORTS
+
+ drivers/net/dsa/b53/b53_mmap.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/net/dsa/b53/b53_mmap.c
++++ b/drivers/net/dsa/b53/b53_mmap.c
+@@ -263,7 +263,7 @@ static int b53_mmap_probe_of(struct plat
+ if (of_property_read_u32(of_port, "reg", ®))
+ continue;
+
+- if (reg < B53_CPU_PORT)
++ if (reg < B53_N_PORTS)
+ pdata->enabled_ports |= BIT(reg);
+ }
+
--- /dev/null
+From patchwork Sun Mar 19 09:55:40 2023
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 8bit
+X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?=
+ <noltari@gmail.com>
+X-Patchwork-Id: 13180301
+X-Patchwork-Delegate: kuba@kernel.org
+Return-Path: <netdev-owner@vger.kernel.org>
+X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
+ aws-us-west-2-korg-lkml-1.web.codeaurora.org
+Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
+ by smtp.lore.kernel.org (Postfix) with ESMTP id 59CF8C7618A
+ for <netdev@archiver.kernel.org>; Sun, 19 Mar 2023 09:55:59 +0000 (UTC)
+Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
+ id S229723AbjCSJzz (ORCPT <rfc822;netdev@archiver.kernel.org>);
+ Sun, 19 Mar 2023 05:55:55 -0400
+Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33746 "EHLO
+ lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
+ with ESMTP id S229468AbjCSJzv (ORCPT
+ <rfc822;netdev@vger.kernel.org>); Sun, 19 Mar 2023 05:55:51 -0400
+Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com
+ [IPv6:2a00:1450:4864:20::333])
+ by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83BCD23A6E;
+ Sun, 19 Mar 2023 02:55:49 -0700 (PDT)
+Received: by mail-wm1-x333.google.com with SMTP id
+ l15-20020a05600c4f0f00b003ed58a9a15eso5776403wmq.5;
+ Sun, 19 Mar 2023 02:55:49 -0700 (PDT)
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=gmail.com; s=20210112; t=1679219748;
+ h=content-transfer-encoding:mime-version:references:in-reply-to
+ :message-id:date:subject:cc:to:from:from:to:cc:subject:date
+ :message-id:reply-to;
+ bh=yaNuTTfeHI1WnGa3QC7carZ37ibM4EyUyUnDDBSr6nM=;
+ b=bTf0pdvAUXMqrJw4A+PLFfwONMAaXL3S4GDMJH3tYgRz/0Vpy7FkmgpWveMhjrqiDM
+ O6v17DizCYtzUrLXC9z9mMD3F8tl0SETaor8aE/MtvnxVq/Yq80WT5xnEh0iJBhWnRP1
+ 0ZKyuoqWZQPnQ9vXbctEu3ZPxub9szdfmxWCtutESvAIvY7Y1qt4ZGg4ZDexov88P4lN
+ pgP6KaBNSVKSsVlDL4ukHqWyrkzpPtcOmDrPC8/HUTsraFnQ4iOL8vVR2Q26qKf2JI6m
+ yKwAd88ZKSnFRAyGdXAoXqiAKkcmDW5523samaxmBI23gxG5ryD3JnZBlo5r55gnPGo9
+ C0uQ==
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=1e100.net; s=20210112; t=1679219748;
+ h=content-transfer-encoding:mime-version:references:in-reply-to
+ :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
+ :subject:date:message-id:reply-to;
+ bh=yaNuTTfeHI1WnGa3QC7carZ37ibM4EyUyUnDDBSr6nM=;
+ b=buUr8oNY3Rb4YRuvXOFLPRXT0v9e8f87X1i1bsLfYPL/CokAJIhwAaChGjvMN1l3zP
+ YCfM9Xynl3tF3k4nrb1xKGmc7LuHONe8KjOgFgFuvtepBg7uvBdwi7A3UmbznhgUpzlo
+ HE7X3S5dfDNX/LLwpOyWM34Hk+w6i6pXP2FD7CB/1TwvdZFjnPHbhDhQTnJQNFaFmXz2
+ d4WxBzxqU6k+4PC4AHRhGkn8QunICQ90MDk9NgNtuT5E1tTh5Bz4ykQ95sKKeTih3OBO
+ sx0mBrCqsTwpteTweNvnMuoOxmyKbM8Ca8cwS1QpfIWI0ASy+j7j2SiTG7nrKl2hUJTW
+ heAQ==
+X-Gm-Message-State: AO0yUKWVY0SzDxRYNSJrKpnV6m176lCPK8B2N12aX56FfpuGNCuaPAmf
+ wYaBrXYVORDSYFVtNsY7gc3xMZp1z+ba7A==
+X-Google-Smtp-Source:
+ AK7set8q+UMyrNpNNfcRo8o3ynviTGRk1oKu2CmzwYJVZxCAYYvXmLtyXvhcnqpBROVi7Kj+1rKDuw==
+X-Received: by 2002:a05:600c:4f50:b0:3ed:4b0f:5378 with SMTP id
+ m16-20020a05600c4f5000b003ed4b0f5378mr11519857wmq.27.1679219747816;
+ Sun, 19 Mar 2023 02:55:47 -0700 (PDT)
+Received: from atlantis.lan (255.red-79-146-124.dynamicip.rima-tde.net.
+ [79.146.124.255])
+ by smtp.gmail.com with ESMTPSA id
+ i26-20020a1c541a000000b003ed246f76a2sm13390609wmb.1.2023.03.19.02.55.46
+ (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
+ Sun, 19 Mar 2023 02:55:47 -0700 (PDT)
+From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= <noltari@gmail.com>
+To: andrew@lunn.ch, f.fainelli@gmail.com, jonas.gorski@gmail.com,
+ olteanv@gmail.com, davem@davemloft.net, edumazet@google.com,
+ kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
+ linux-kernel@vger.kernel.org
+Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= <noltari@gmail.com>,
+ Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
+Subject: [PATCH v2] net: dsa: tag_brcm: legacy: fix daisy-chained switches
+Date: Sun, 19 Mar 2023 10:55:40 +0100
+Message-Id: <20230319095540.239064-1-noltari@gmail.com>
+X-Mailer: git-send-email 2.30.2
+In-Reply-To: <20230317120815.321871-1-noltari@gmail.com>
+References: <20230317120815.321871-1-noltari@gmail.com>
+MIME-Version: 1.0
+Precedence: bulk
+List-ID: <netdev.vger.kernel.org>
+X-Mailing-List: netdev@vger.kernel.org
+X-Patchwork-Delegate: kuba@kernel.org
+
+When BCM63xx internal switches are connected to switches with a 4-byte
+Broadcom tag, it does not identify the packet as VLAN tagged, so it adds one
+based on its PVID (which is likely 0).
+Right now, the packet is received by the BCM63xx internal switch and the 6-byte
+tag is properly processed. The next step would to decode the corresponding
+4-byte tag. However, the internal switch adds an invalid VLAN tag after the
+6-byte tag and the 4-byte tag handling fails.
+In order to fix this we need to remove the invalid VLAN tag after the 6-byte
+tag before passing it to the 4-byte tag decoding.
+
+Fixes: 964dbf186eaa ("net: dsa: tag_brcm: add support for legacy tags")
+Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
+Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
+---
+ v2: add missing fixes tag.
+
+ net/dsa/tag_brcm.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+--- a/net/dsa/tag_brcm.c
++++ b/net/dsa/tag_brcm.c
+@@ -7,6 +7,7 @@
+
+ #include <linux/dsa/brcm.h>
+ #include <linux/etherdevice.h>
++#include <linux/if_vlan.h>
+ #include <linux/list.h>
+ #include <linux/slab.h>
+
+@@ -248,6 +249,7 @@ static struct sk_buff *brcm_leg_tag_xmit
+ static struct sk_buff *brcm_leg_tag_rcv(struct sk_buff *skb,
+ struct net_device *dev)
+ {
++ int len = BRCM_LEG_TAG_LEN;
+ int source_port;
+ u8 *brcm_tag;
+
+@@ -262,12 +264,16 @@ static struct sk_buff *brcm_leg_tag_rcv(
+ if (!skb->dev)
+ return NULL;
+
++ /* VLAN tag is added by BCM63xx internal switch */
++ if (netdev_uses_dsa(skb->dev))
++ len += VLAN_HLEN;
++
+ /* Remove Broadcom tag and update checksum */
+- skb_pull_rcsum(skb, BRCM_LEG_TAG_LEN);
++ skb_pull_rcsum(skb, len);
+
+ dsa_default_offload_fwd_mark(skb);
+
+- dsa_strip_etype_header(skb, BRCM_LEG_TAG_LEN);
++ dsa_strip_etype_header(skb, len);
+
+ return skb;
+ }
--- /dev/null
+From patchwork Sun Mar 19 22:08:05 2023
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 8bit
+X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?=
+ <noltari@gmail.com>
+X-Patchwork-Id: 13180645
+X-Patchwork-Delegate: kuba@kernel.org
+Return-Path: <netdev-owner@vger.kernel.org>
+X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
+ aws-us-west-2-korg-lkml-1.web.codeaurora.org
+Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
+ by smtp.lore.kernel.org (Postfix) with ESMTP id A7A46C6FD1F
+ for <netdev@archiver.kernel.org>; Sun, 19 Mar 2023 22:08:15 +0000 (UTC)
+Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
+ id S230223AbjCSWIN (ORCPT <rfc822;netdev@archiver.kernel.org>);
+ Sun, 19 Mar 2023 18:08:13 -0400
+Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32878 "EHLO
+ lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
+ with ESMTP id S229565AbjCSWIM (ORCPT
+ <rfc822;netdev@vger.kernel.org>); Sun, 19 Mar 2023 18:08:12 -0400
+Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com
+ [IPv6:2a00:1450:4864:20::42e])
+ by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 605D3E062;
+ Sun, 19 Mar 2023 15:08:10 -0700 (PDT)
+Received: by mail-wr1-x42e.google.com with SMTP id h17so8695188wrt.8;
+ Sun, 19 Mar 2023 15:08:10 -0700 (PDT)
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=gmail.com; s=20210112; t=1679263689;
+ h=content-transfer-encoding:mime-version:references:in-reply-to
+ :message-id:date:subject:cc:to:from:from:to:cc:subject:date
+ :message-id:reply-to;
+ bh=GmPK75Q9ZD3h3IYflWYuDwS99V2e532KgDlnNucAoJg=;
+ b=PSdrywW48P4Lq8z9wOSPXFB/ZdO/JfuyiGlw3Gz1Iriy+Smo/cBnJ0Ve9zKkX3AKTO
+ Tr7/g8xhSQX8sU5WAOEPC13uVjKpO4VZsamXHTmMKL4mmfII3K/piAsQcMQkkNpgouab
+ Ci9yr+7ASSmqEUHIbYTM6sl6a47rPwqk3b3DcTIE2CwJsPPNXnpQ/aSVbJAcEdhcZICc
+ X4rAmjrYjcsl8coFIGHHPlrMH9ShekQWxB84vEb6bO1nXOORNPizOHuY1vJ3wa3WgXsx
+ YwlvutMFVIUXfgL2ZwCmQAKWJPiAaFk+CCk3oxSeOYoAzkjcbMyapz9VnooStfvR2aV3
+ k+2g==
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=1e100.net; s=20210112; t=1679263689;
+ h=content-transfer-encoding:mime-version:references:in-reply-to
+ :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
+ :subject:date:message-id:reply-to;
+ bh=GmPK75Q9ZD3h3IYflWYuDwS99V2e532KgDlnNucAoJg=;
+ b=NGjqrGERyaxRwINtevHaY97h9X9W+1UY62YYwotqwv5+cfvB8myjBbD3WH2WzaqMes
+ o9MMER9RE8/arW3jIVlBv4ORDUuEZ7AeGgy5UbFyQZIPHlp+hJ/sxFrGvYUwamg4Qrr9
+ ojargh8ORsEiMeqaf+5AkmEagNhrrV3ax0pUuWDzbJ3vXGoHjfCetHz5xyNL46dvXBfb
+ l/OZqjv9IYob552uUoUmCy/TbEQDqvmjkFrROFK9gtBNxgxUJkwbyiWIOVsf6RR8OarP
+ f7bbvSJYkvTvzx2u/g0Up7NW5ZyihMGBmDs377M3yW6AnSxW6jlfl30QmMU1aEigYXvy
+ v3mA==
+X-Gm-Message-State: AO0yUKUm1PYmYa4xlHuVD23mZcZm83a+xbhcbs0Xryi3yF/+UnjM4Cho
+ GAfqSh5MZ/rlOAm3Vnpn//9hOG5Lc8vLYg==
+X-Google-Smtp-Source:
+ AK7set+5pTahGGgk1hF/mHGkGBhsMf0//oQjZd4QFHx+HaeSgP5f6q7g0bRUcTX8kRtgHH0T7l1/hQ==
+X-Received: by 2002:a5d:474f:0:b0:2d6:2ae8:70d with SMTP id
+ o15-20020a5d474f000000b002d62ae8070dmr2382593wrs.39.1679263688549;
+ Sun, 19 Mar 2023 15:08:08 -0700 (PDT)
+Received: from atlantis.lan (255.red-79-146-124.dynamicip.rima-tde.net.
+ [79.146.124.255])
+ by smtp.gmail.com with ESMTPSA id
+ d6-20020a5d6dc6000000b002c53f6c7599sm7354727wrz.29.2023.03.19.15.08.07
+ (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
+ Sun, 19 Mar 2023 15:08:07 -0700 (PDT)
+From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= <noltari@gmail.com>
+To: f.fainelli@gmail.com, jonas.gorski@gmail.com, andrew@lunn.ch,
+ olteanv@gmail.com, davem@davemloft.net, edumazet@google.com,
+ kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
+ linux-kernel@vger.kernel.org
+Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= <noltari@gmail.com>
+Subject: [PATCH v2] net: dsa: b53: add support for BCM63xx RGMIIs
+Date: Sun, 19 Mar 2023 23:08:05 +0100
+Message-Id: <20230319220805.124024-1-noltari@gmail.com>
+X-Mailer: git-send-email 2.30.2
+In-Reply-To: <20230319183330.761251-1-noltari@gmail.com>
+References: <20230319183330.761251-1-noltari@gmail.com>
+MIME-Version: 1.0
+Precedence: bulk
+List-ID: <netdev.vger.kernel.org>
+X-Mailing-List: netdev@vger.kernel.org
+X-Patchwork-Delegate: kuba@kernel.org
+
+BCM63xx RGMII ports require additional configuration in order to work.
+
+Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
+Reviewed-by: Andrew Lunn <andrew@lunn.ch>
+---
+ v2: add changes suggested by Andrew:
+ - Use a switch statement.
+ - Use dev_dbg() instead of dev_info().
+
+ drivers/net/dsa/b53/b53_common.c | 46 ++++++++++++++++++++++++++++++++
+ drivers/net/dsa/b53/b53_priv.h | 1 +
+ 2 files changed, 47 insertions(+)
+
+--- a/drivers/net/dsa/b53/b53_common.c
++++ b/drivers/net/dsa/b53/b53_common.c
+@@ -1209,6 +1209,46 @@ static void b53_force_port_config(struct
+ b53_write8(dev, B53_CTRL_PAGE, off, reg);
+ }
+
++static void b53_adjust_63xx_rgmii(struct dsa_switch *ds, int port,
++ phy_interface_t interface)
++{
++ struct b53_device *dev = ds->priv;
++ u8 rgmii_ctrl = 0, off;
++
++ if (port == dev->imp_port)
++ off = B53_RGMII_CTRL_IMP;
++ else
++ off = B53_RGMII_CTRL_P(port);
++
++ b53_read8(dev, B53_CTRL_PAGE, off, &rgmii_ctrl);
++
++ switch (interface) {
++ case PHY_INTERFACE_MODE_RGMII_ID:
++ rgmii_ctrl |= (RGMII_CTRL_DLL_RXC | RGMII_CTRL_DLL_TXC);
++ break;
++ case PHY_INTERFACE_MODE_RGMII_RXID:
++ rgmii_ctrl &= ~(RGMII_CTRL_DLL_TXC);
++ rgmii_ctrl |= RGMII_CTRL_DLL_RXC;
++ break;
++ case PHY_INTERFACE_MODE_RGMII_TXID:
++ rgmii_ctrl &= ~(RGMII_CTRL_DLL_RXC);
++ rgmii_ctrl |= RGMII_CTRL_DLL_TXC;
++ break;
++ case PHY_INTERFACE_MODE_RGMII:
++ default:
++ rgmii_ctrl &= ~(RGMII_CTRL_DLL_RXC | RGMII_CTRL_DLL_TXC);
++ break;
++ }
++
++ if (port != dev->imp_port)
++ rgmii_ctrl |= RGMII_CTRL_ENABLE_GMII;
++
++ b53_write8(dev, B53_CTRL_PAGE, off, rgmii_ctrl);
++
++ dev_dbg(ds->dev, "Configured port %d for %s\n", port,
++ phy_modes(interface));
++}
++
+ static void b53_adjust_link(struct dsa_switch *ds, int port,
+ struct phy_device *phydev)
+ {
+@@ -1235,6 +1275,9 @@ static void b53_adjust_link(struct dsa_s
+ tx_pause, rx_pause);
+ b53_force_link(dev, port, phydev->link);
+
++ if (is63xx(dev) && port >= B53_63XX_RGMII0)
++ b53_adjust_63xx_rgmii(ds, port, phydev->interface);
++
+ if (is531x5(dev) && phy_interface_is_rgmii(phydev)) {
+ if (port == dev->imp_port)
+ off = B53_RGMII_CTRL_IMP;
+@@ -1396,6 +1439,9 @@ void b53_phylink_mac_link_down(struct ds
+ {
+ struct b53_device *dev = ds->priv;
+
++ if (is63xx(dev) && port >= B53_63XX_RGMII0)
++ b53_adjust_63xx_rgmii(ds, port, interface);
++
+ if (mode == MLO_AN_PHY)
+ return;
+
+--- a/drivers/net/dsa/b53/b53_priv.h
++++ b/drivers/net/dsa/b53/b53_priv.h
+@@ -206,6 +206,7 @@ static inline int is58xx(struct b53_devi
+ dev->chip_id == BCM7278_DEVICE_ID;
+ }
+
++#define B53_63XX_RGMII0 4
+ #define B53_CPU_PORT_25 5
+ #define B53_CPU_PORT 8
+
--- /dev/null
+From patchwork Mon Mar 20 15:50:22 2023
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 8bit
+X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?=
+ <noltari@gmail.com>
+X-Patchwork-Id: 13181527
+X-Patchwork-Delegate: kuba@kernel.org
+Return-Path: <netdev-owner@vger.kernel.org>
+X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
+ aws-us-west-2-korg-lkml-1.web.codeaurora.org
+Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
+ by smtp.lore.kernel.org (Postfix) with ESMTP id 70553C6FD1D
+ for <netdev@archiver.kernel.org>; Mon, 20 Mar 2023 16:01:00 +0000 (UTC)
+Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
+ id S233364AbjCTQA5 (ORCPT <rfc822;netdev@archiver.kernel.org>);
+ Mon, 20 Mar 2023 12:00:57 -0400
+Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51588 "EHLO
+ lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
+ with ESMTP id S233532AbjCTQAP (ORCPT
+ <rfc822;netdev@vger.kernel.org>); Mon, 20 Mar 2023 12:00:15 -0400
+Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com
+ [IPv6:2a00:1450:4864:20::335])
+ by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A422B3E0B3;
+ Mon, 20 Mar 2023 08:50:37 -0700 (PDT)
+Received: by mail-wm1-x335.google.com with SMTP id
+ t17-20020a05600c451100b003edc906aeeaso1726035wmo.1;
+ Mon, 20 Mar 2023 08:50:37 -0700 (PDT)
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=gmail.com; s=20210112; t=1679327430;
+ h=content-transfer-encoding:mime-version:references:in-reply-to
+ :message-id:date:subject:cc:to:from:from:to:cc:subject:date
+ :message-id:reply-to;
+ bh=NmGOzoXiGILw8p8HpY3VfgsDYOA5bH4v8OqaYevH4J4=;
+ b=KptaZem0Zxnxtwy+VdrvXw5NY/HSYmbxmV8+mSnoXZgQGHLjW/gCyDXpzRqcSBXIGV
+ fvtFTanvZcTCA4f/cyoAkEsqIkmQyDHwEshHutyJEaWN9q3yB5eTAnUcq4z3e7P4nTu2
+ +ZOho9zDyRb4r24J6UbiN9ZUzcsuYVQwm1Qz0zJ+63dx+gD20hgCL+7775pvqoFYwgpP
+ 1ABgO6OngXBB42/L8+ZBwsg3mXy06HuqMLEQK/FmtcXjTml0OaO3S5cJvUdNGsdNrvx+
+ kaTtRBBzqin3DRExaIekr/jPzOB3X1oV2TzhInT4SPhtULIah750U4ljBqf92PwnjvHc
+ 6JDQ==
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=1e100.net; s=20210112; t=1679327430;
+ h=content-transfer-encoding:mime-version:references:in-reply-to
+ :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
+ :subject:date:message-id:reply-to;
+ bh=NmGOzoXiGILw8p8HpY3VfgsDYOA5bH4v8OqaYevH4J4=;
+ b=GsByHVP16hADSORlzScxFXsjTNWGBbyYNiWQHZzojsE/ffOZrXokZWDNH4GTlB7uv4
+ 4Gs1NNLT8Bk95OjDvHAm5bJxZGwyfeHZeTqxBpBlGapyqb2D9XGxpYXbF9VaQgd7oKjN
+ v7Si3AKtD8g7o//OkdsslkT8JxzhdjmHK0pJN9ssxhHMePGutYkZH+n7JlIrQVaDs7iU
+ nvg1lcFLNvn+MrLpNE5r8KMIPdTwGMIOQAuZ1tqttHrGRkfi92KF1p93p/Qn8uDIGO/B
+ ocZHPyMlXDh/Q7Qjsy/BihOrW3+cSZm7OomPh8vWhppGKwkxLYCZAsKeDGOjLvfdV2Rf
+ lZwQ==
+X-Gm-Message-State: AO0yUKW2wNtd5kSfm2dxbqnhxVZrNkzLVVdLsO0eADsnjtWufqMWFS0a
+ ZubXW4z6gV3Oqv2lPuWyQDU=
+X-Google-Smtp-Source:
+ AK7set8bMf4RMiUM14onDSGmYFsmJuDQ+P9yadvVBWt05IjyUwc/8tNalTsC2hQ62KhoCUpBfCEb7g==
+X-Received: by 2002:a05:600c:468c:b0:3eb:38b0:e748 with SMTP id
+ p12-20020a05600c468c00b003eb38b0e748mr10091873wmo.13.1679327430592;
+ Mon, 20 Mar 2023 08:50:30 -0700 (PDT)
+Received: from atlantis.lan (255.red-79-146-124.dynamicip.rima-tde.net.
+ [79.146.124.255])
+ by smtp.gmail.com with ESMTPSA id
+ 3-20020a05600c020300b003eddefd8792sm4812333wmi.14.2023.03.20.08.50.29
+ (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
+ Mon, 20 Mar 2023 08:50:30 -0700 (PDT)
+From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= <noltari@gmail.com>
+To: f.fainelli@gmail.com, andrew@lunn.ch, olteanv@gmail.com,
+ davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
+ pabeni@redhat.com, robh+dt@kernel.org,
+ krzysztof.kozlowski+dt@linaro.org, netdev@vger.kernel.org,
+ devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
+Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= <noltari@gmail.com>
+Subject: [PATCH 2/4] net: dsa: b53: mmap: add more BCM63xx SoCs
+Date: Mon, 20 Mar 2023 16:50:22 +0100
+Message-Id: <20230320155024.164523-3-noltari@gmail.com>
+X-Mailer: git-send-email 2.30.2
+In-Reply-To: <20230320155024.164523-1-noltari@gmail.com>
+References: <20230320155024.164523-1-noltari@gmail.com>
+MIME-Version: 1.0
+Precedence: bulk
+List-ID: <netdev.vger.kernel.org>
+X-Mailing-List: netdev@vger.kernel.org
+X-Patchwork-Delegate: kuba@kernel.org
+
+BCM6318, BCM6362 and BCM63268 are SoCs with a B53 MMAP switch.
+
+Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
+---
+ drivers/net/dsa/b53/b53_mmap.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/net/dsa/b53/b53_mmap.c
++++ b/drivers/net/dsa/b53/b53_mmap.c
+@@ -333,8 +333,11 @@ static void b53_mmap_shutdown(struct pla
+
+ static const struct of_device_id b53_mmap_of_table[] = {
+ { .compatible = "brcm,bcm3384-switch" },
++ { .compatible = "brcm,bcm6318-switch" },
+ { .compatible = "brcm,bcm6328-switch" },
++ { .compatible = "brcm,bcm6362-switch" },
+ { .compatible = "brcm,bcm6368-switch" },
++ { .compatible = "brcm,bcm63268-switch" },
+ { .compatible = "brcm,bcm63xx-switch" },
+ { /* sentinel */ },
+ };
--- /dev/null
+From patchwork Mon Mar 20 15:50:23 2023
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 8bit
+X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?=
+ <noltari@gmail.com>
+X-Patchwork-Id: 13181525
+X-Patchwork-Delegate: kuba@kernel.org
+Return-Path: <netdev-owner@vger.kernel.org>
+X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
+ aws-us-west-2-korg-lkml-1.web.codeaurora.org
+Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
+ by smtp.lore.kernel.org (Postfix) with ESMTP id AA605C7618D
+ for <netdev@archiver.kernel.org>; Mon, 20 Mar 2023 16:00:42 +0000 (UTC)
+Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
+ id S233060AbjCTQAk (ORCPT <rfc822;netdev@archiver.kernel.org>);
+ Mon, 20 Mar 2023 12:00:40 -0400
+Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50606 "EHLO
+ lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
+ with ESMTP id S233508AbjCTQAL (ORCPT
+ <rfc822;netdev@vger.kernel.org>); Mon, 20 Mar 2023 12:00:11 -0400
+Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com
+ [IPv6:2a00:1450:4864:20::332])
+ by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8A523E0BA;
+ Mon, 20 Mar 2023 08:50:37 -0700 (PDT)
+Received: by mail-wm1-x332.google.com with SMTP id
+ fm20-20020a05600c0c1400b003ead37e6588so9459945wmb.5;
+ Mon, 20 Mar 2023 08:50:37 -0700 (PDT)
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=gmail.com; s=20210112; t=1679327432;
+ h=content-transfer-encoding:mime-version:references:in-reply-to
+ :message-id:date:subject:cc:to:from:from:to:cc:subject:date
+ :message-id:reply-to;
+ bh=16/AUEfT4/3aNTDuWfjKv1lfTz12+h3pg0SmLHFA5Y8=;
+ b=n+22dPTXjE1jqw2beYW8Kqab5uczPETidauati8u3xeWTbKyfCENVVcYJBQgNPM3pw
+ BeH+srFpkROFpxJ+btOlNSEZA4pIuBf2EOOU4AWrlPTWglRDxVHZ3X7kVDptJnxVGvre
+ zNQ31LP8wxHP9XSFxYbkK9ybYYC8WP3fQZwcGcAgliP2cbKQMwuUP/i2w3Hqml8t6rP1
+ 5HaZgmWt9wdh8c76nCWP03IuNM9oJ9qa3YWDBrVVN2eMe0mGxZmKR+Wb/BZj3o5ezJmu
+ q41drXRwHBC6vF1K+HHeOgAcMlTKIJUAo2daNVm/UBTXj2SXsvfh4nfgrWVAexOpd/uP
+ elYw==
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=1e100.net; s=20210112; t=1679327432;
+ h=content-transfer-encoding:mime-version:references:in-reply-to
+ :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
+ :subject:date:message-id:reply-to;
+ bh=16/AUEfT4/3aNTDuWfjKv1lfTz12+h3pg0SmLHFA5Y8=;
+ b=6ZfI8DXxxDA2NF5hw1Mfoc/pGgW+OfRfwgMoE4jB/ABbQg8zdQ/Ja7FGIqVPbi2hZe
+ fvd7j+dw8CZvNbkRbsYQvMTwRfDRonn8aAwJBBNkMyTcm8s3D5BRURzVpe0ScyzPYvxQ
+ 0cXZASSL+EXA7Fyf51y4emSNy6Xb3nY0pjKWFUphqra9TdFQzhtnpdlN3tTwXFN9jlEu
+ 3Se1FWEiQP5FRtqXIU/oefh5FMXoJEDCKq8geZ04mouAdeVxZd/FUBR754EY6uNAhMVG
+ hef4iX7HeDpTCJLCprNVFgQ80bbl/uh+QnBtEVGlDFcH4GR7csGSIp2g/3Qzj/m78rkz
+ ml1Q==
+X-Gm-Message-State: AO0yUKUPCBZQSCICZA8m4nHTp32xYgPPzQnSGO9a0aop0wLJeOUszuYx
+ hH7zNhPrx7BZWaytny88AN0=
+X-Google-Smtp-Source:
+ AK7set9y2vPkyUF0Tln19u08/DwcR4L11U6iFXPmpi6kdzFhq0OrCiFNu8aAeCvisP/C/rvYvKH9Lw==
+X-Received: by 2002:a05:600c:310e:b0:3e9:f15b:935b with SMTP id
+ g14-20020a05600c310e00b003e9f15b935bmr34745262wmo.32.1679327432097;
+ Mon, 20 Mar 2023 08:50:32 -0700 (PDT)
+Received: from atlantis.lan (255.red-79-146-124.dynamicip.rima-tde.net.
+ [79.146.124.255])
+ by smtp.gmail.com with ESMTPSA id
+ 3-20020a05600c020300b003eddefd8792sm4812333wmi.14.2023.03.20.08.50.30
+ (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
+ Mon, 20 Mar 2023 08:50:31 -0700 (PDT)
+From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= <noltari@gmail.com>
+To: f.fainelli@gmail.com, andrew@lunn.ch, olteanv@gmail.com,
+ davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
+ pabeni@redhat.com, robh+dt@kernel.org,
+ krzysztof.kozlowski+dt@linaro.org, netdev@vger.kernel.org,
+ devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
+Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= <noltari@gmail.com>
+Subject: [PATCH 3/4] net: dsa: b53: mmap: allow passing a chip ID
+Date: Mon, 20 Mar 2023 16:50:23 +0100
+Message-Id: <20230320155024.164523-4-noltari@gmail.com>
+X-Mailer: git-send-email 2.30.2
+In-Reply-To: <20230320155024.164523-1-noltari@gmail.com>
+References: <20230320155024.164523-1-noltari@gmail.com>
+MIME-Version: 1.0
+Precedence: bulk
+List-ID: <netdev.vger.kernel.org>
+X-Mailing-List: netdev@vger.kernel.org
+X-Patchwork-Delegate: kuba@kernel.org
+
+BCM63268 SoCs require a special handling for their RGMIIs, so we should be
+able to identify them as a special BCM63xx switch.
+
+Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
+---
+ drivers/net/dsa/b53/b53_mmap.c | 32 +++++++++++++++++++++++---------
+ drivers/net/dsa/b53/b53_priv.h | 9 ++++++++-
+ 2 files changed, 31 insertions(+), 10 deletions(-)
+
+--- a/drivers/net/dsa/b53/b53_mmap.c
++++ b/drivers/net/dsa/b53/b53_mmap.c
+@@ -248,7 +248,7 @@ static int b53_mmap_probe_of(struct plat
+ return -ENOMEM;
+
+ pdata->regs = mem;
+- pdata->chip_id = BCM63XX_DEVICE_ID;
++ pdata->chip_id = (u32)device_get_match_data(dev);
+ pdata->big_endian = of_property_read_bool(np, "big-endian");
+
+ of_ports = of_get_child_by_name(np, "ports");
+@@ -332,14 +332,28 @@ static void b53_mmap_shutdown(struct pla
+ }
+
+ static const struct of_device_id b53_mmap_of_table[] = {
+- { .compatible = "brcm,bcm3384-switch" },
+- { .compatible = "brcm,bcm6318-switch" },
+- { .compatible = "brcm,bcm6328-switch" },
+- { .compatible = "brcm,bcm6362-switch" },
+- { .compatible = "brcm,bcm6368-switch" },
+- { .compatible = "brcm,bcm63268-switch" },
+- { .compatible = "brcm,bcm63xx-switch" },
+- { /* sentinel */ },
++ {
++ .compatible = "brcm,bcm3384-switch",
++ .data = (void *)BCM63XX_DEVICE_ID,
++ }, {
++ .compatible = "brcm,bcm6318-switch",
++ .data = (void *)BCM63XX_DEVICE_ID,
++ }, {
++ .compatible = "brcm,bcm6328-switch",
++ .data = (void *)BCM63XX_DEVICE_ID,
++ }, {
++ .compatible = "brcm,bcm6362-switch",
++ .data = (void *)BCM63XX_DEVICE_ID,
++ }, {
++ .compatible = "brcm,bcm6368-switch",
++ .data = (void *)BCM63XX_DEVICE_ID,
++ }, {
++ .compatible = "brcm,bcm63268-switch",
++ .data = (void *)BCM63268_DEVICE_ID,
++ }, {
++ .compatible = "brcm,bcm63xx-switch",
++ .data = (void *)BCM63XX_DEVICE_ID,
++ }, { /* sentinel */ }
+ };
+ MODULE_DEVICE_TABLE(of, b53_mmap_of_table);
+
+--- a/drivers/net/dsa/b53/b53_priv.h
++++ b/drivers/net/dsa/b53/b53_priv.h
+@@ -75,6 +75,7 @@ enum {
+ BCM53125_DEVICE_ID = 0x53125,
+ BCM53128_DEVICE_ID = 0x53128,
+ BCM63XX_DEVICE_ID = 0x6300,
++ BCM63268_DEVICE_ID = 0x63268,
+ BCM53010_DEVICE_ID = 0x53010,
+ BCM53011_DEVICE_ID = 0x53011,
+ BCM53012_DEVICE_ID = 0x53012,
+@@ -186,7 +187,13 @@ static inline int is531x5(struct b53_dev
+
+ static inline int is63xx(struct b53_device *dev)
+ {
+- return dev->chip_id == BCM63XX_DEVICE_ID;
++ return dev->chip_id == BCM63XX_DEVICE_ID ||
++ dev->chip_id == BCM63268_DEVICE_ID;
++}
++
++static inline int is63268(struct b53_device *dev)
++{
++ return dev->chip_id == BCM63268_DEVICE_ID;
+ }
+
+ static inline int is5301x(struct b53_device *dev)
--- /dev/null
+From patchwork Mon Mar 20 15:50:24 2023
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 8bit
+X-Patchwork-Submitter: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?=
+ <noltari@gmail.com>
+X-Patchwork-Id: 13181526
+X-Patchwork-Delegate: kuba@kernel.org
+Return-Path: <netdev-owner@vger.kernel.org>
+X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
+ aws-us-west-2-korg-lkml-1.web.codeaurora.org
+Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
+ by smtp.lore.kernel.org (Postfix) with ESMTP id 93F5BC6FD1D
+ for <netdev@archiver.kernel.org>; Mon, 20 Mar 2023 16:00:57 +0000 (UTC)
+Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
+ id S233333AbjCTQAy (ORCPT <rfc822;netdev@archiver.kernel.org>);
+ Mon, 20 Mar 2023 12:00:54 -0400
+Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46084 "EHLO
+ lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
+ with ESMTP id S233519AbjCTQAM (ORCPT
+ <rfc822;netdev@vger.kernel.org>); Mon, 20 Mar 2023 12:00:12 -0400
+Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com
+ [IPv6:2a00:1450:4864:20::330])
+ by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA2C438B53;
+ Mon, 20 Mar 2023 08:50:38 -0700 (PDT)
+Received: by mail-wm1-x330.google.com with SMTP id iw17so2507691wmb.0;
+ Mon, 20 Mar 2023 08:50:37 -0700 (PDT)
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=gmail.com; s=20210112; t=1679327433;
+ h=content-transfer-encoding:mime-version:references:in-reply-to
+ :message-id:date:subject:cc:to:from:from:to:cc:subject:date
+ :message-id:reply-to;
+ bh=WlRvHn65p7ApqB1hkWXEl334dlDtfL7sexIylSD7RF8=;
+ b=Xb9J1kzvH/7/KC9kfFPe5nfM0jOx0VqmPqlTVHQ2ICuE/eznYiDnZR2GROkiEBeSW5
+ aj8nTpjx/Zgj9GE1Ere9JmGDP4qH6Ms4GG1dcgxiwCZUubj8EmKPPzq+xRYgui52JXXZ
+ GG9yZPfp/eWkFHvSgIPzHyC1iWc88F8XSN7+xdXyC7MOoEWIbvy0y04VrbuO9p8+RjCl
+ XbF+dk2kkZAseZ7QMlgJZ2Bt8HfHx2I4D6+r4BhyVy6oIsdzkMTei+drCezAB5fFzerw
+ y3GD2qAHDRRSrMpv7wTUuM9Erg/6k7sGs+HKjLlgmmAwT7LMqxNkXvmZeU5IucnlPzyQ
+ zxGw==
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
+ d=1e100.net; s=20210112; t=1679327433;
+ h=content-transfer-encoding:mime-version:references:in-reply-to
+ :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
+ :subject:date:message-id:reply-to;
+ bh=WlRvHn65p7ApqB1hkWXEl334dlDtfL7sexIylSD7RF8=;
+ b=mx+DrcUS/RrkssaKZwtjxNb1RtQP6+pwhyW7/EaPvgWZPMBZeDHy7B+x5GRw7gA8l5
+ lIqtZ41yhnrcZ8wp6SSyG+pJJ2Xn4q0N8W3NJS8vZz5/ORmoRdLxyNY8IdlTQlmjV9YT
+ jY1LCVegFoErlMPP49XZ1fzJtRPIeFv0MZphvdw7nXk5yhg4+vpnfCPKzOJdOmpEgfut
+ GnIW/BBXCezqjF0GT9Lmp61lPf1j0PCq8lmrcrZtKwI11zyVmOPqgdWmkRh+YirD5L0P
+ ORDeuqwz5SkyDZ+Sw+dahSLeLtZ/VB+58nFWPpxF4yUw/sKPrhpkZfGzo/VN/jDL1ZfN
+ 1t3w==
+X-Gm-Message-State: AO0yUKVurWpxXw8kQLLJFFk7zmIVuc+hSmpXM9lpLIB/ByDuw5z3fAds
+ TZs+QVHvNnvyK9ovwNMJwU0=
+X-Google-Smtp-Source:
+ AK7set8fEPc92nUNA58HgNEL8eOH1DCae42kd5S11MkuO5+TV9yIVNP77n+5gS3XrTpCzsFfJmaf/A==
+X-Received: by 2002:a05:600c:470e:b0:3eb:42fc:fb30 with SMTP id
+ v14-20020a05600c470e00b003eb42fcfb30mr34204824wmo.32.1679327433327;
+ Mon, 20 Mar 2023 08:50:33 -0700 (PDT)
+Received: from atlantis.lan (255.red-79-146-124.dynamicip.rima-tde.net.
+ [79.146.124.255])
+ by smtp.gmail.com with ESMTPSA id
+ 3-20020a05600c020300b003eddefd8792sm4812333wmi.14.2023.03.20.08.50.32
+ (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
+ Mon, 20 Mar 2023 08:50:32 -0700 (PDT)
+From: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= <noltari@gmail.com>
+To: f.fainelli@gmail.com, andrew@lunn.ch, olteanv@gmail.com,
+ davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
+ pabeni@redhat.com, robh+dt@kernel.org,
+ krzysztof.kozlowski+dt@linaro.org, netdev@vger.kernel.org,
+ devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
+Cc: =?utf-8?q?=C3=81lvaro_Fern=C3=A1ndez_Rojas?= <noltari@gmail.com>
+Subject: [PATCH 4/4] net: dsa: b53: add BCM63268 RGMII configuration
+Date: Mon, 20 Mar 2023 16:50:24 +0100
+Message-Id: <20230320155024.164523-5-noltari@gmail.com>
+X-Mailer: git-send-email 2.30.2
+In-Reply-To: <20230320155024.164523-1-noltari@gmail.com>
+References: <20230320155024.164523-1-noltari@gmail.com>
+MIME-Version: 1.0
+Precedence: bulk
+List-ID: <netdev.vger.kernel.org>
+X-Mailing-List: netdev@vger.kernel.org
+X-Patchwork-Delegate: kuba@kernel.org
+
+BCM63268 requires special RGMII configuration to work.
+
+Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
+---
+ drivers/net/dsa/b53/b53_common.c | 6 +++++-
+ drivers/net/dsa/b53/b53_regs.h | 1 +
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/dsa/b53/b53_common.c
++++ b/drivers/net/dsa/b53/b53_common.c
+@@ -1240,8 +1240,12 @@ static void b53_adjust_63xx_rgmii(struct
+ break;
+ }
+
+- if (port != dev->imp_port)
++ if (port != dev->imp_port) {
++ if (is63268(dev))
++ rgmii_ctrl |= RGMII_CTRL_MII_OVERRIDE;
++
+ rgmii_ctrl |= RGMII_CTRL_ENABLE_GMII;
++ }
+
+ b53_write8(dev, B53_CTRL_PAGE, off, rgmii_ctrl);
+
+--- a/drivers/net/dsa/b53/b53_regs.h
++++ b/drivers/net/dsa/b53/b53_regs.h
+@@ -138,6 +138,7 @@
+
+ #define B53_RGMII_CTRL_IMP 0x60
+ #define RGMII_CTRL_ENABLE_GMII BIT(7)
++#define RGMII_CTRL_MII_OVERRIDE BIT(6)
+ #define RGMII_CTRL_TIMING_SEL BIT(2)
+ #define RGMII_CTRL_DLL_RXC BIT(1)
+ #define RGMII_CTRL_DLL_TXC BIT(0)