soc: sifive: ccache: Add StarFive JH71x0 support
authorEmil Renner Berthing <kernel@esmil.dk>
Tue, 5 Apr 2022 22:38:05 +0000 (00:38 +0200)
committerŁukasz Stelmach <l.stelmach@samsung.com>
Thu, 9 Feb 2023 18:48:02 +0000 (19:48 +0100)
This adds support for the StarFive JH7100 and JH7110 SoCs which also
feature this SiFive cache controller.

Unfortunately the interrupt for uncorrected data is broken on the JH7100
and fires continuously, so add a quirk to not register a handler for it.

Signed-off-by: Emil Renner Berthing <kernel@esmil.dk>
arch/riscv/Kconfig.socs
drivers/soc/Makefile
drivers/soc/sifive/Kconfig
drivers/soc/sifive/sifive_ccache.c

index 69774bb362d6a7f34950de06756469d20f63e206..5a40e05f8cababffa63df1f1ecb9f2a5238a93dc 100644 (file)
@@ -22,6 +22,7 @@ config SOC_STARFIVE
        bool "StarFive SoCs"
        select PINCTRL
        select RESET_CONTROLLER
+       select SIFIVE_CCACHE
        select SIFIVE_PLIC
        help
          This enables support for StarFive SoC platform hardware.
index 69ba6508cf2c17229ef32afcb79137b53f969d09..53466984085890a64a0ea45d9f107a217feba531 100644 (file)
@@ -26,7 +26,7 @@ obj-y                         += qcom/
 obj-y                          += renesas/
 obj-y                          += rockchip/
 obj-$(CONFIG_SOC_SAMSUNG)      += samsung/
-obj-$(CONFIG_SOC_SIFIVE)       += sifive/
+obj-y                          += sifive/
 obj-y                          += sunxi/
 obj-$(CONFIG_ARCH_TEGRA)       += tegra/
 obj-y                          += ti/
index ed4c571f8771b355f76e079185f38c312b25907a..e86870be34c9562d861587263e5546cf1ebae138 100644 (file)
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 
-if SOC_SIFIVE
+if SOC_SIFIVE || SOC_STARFIVE
 
 config SIFIVE_CCACHE
        bool "Sifive Composable Cache controller"
index 3684f5b40a80ef8a6584126e795f455c3f577975..fd5f0c7b060f85abc5a364475933cb7f7f497ca4 100644 (file)
@@ -106,6 +106,8 @@ static void ccache_config_read(void)
 static const struct of_device_id sifive_ccache_ids[] = {
        { .compatible = "sifive,fu540-c000-ccache" },
        { .compatible = "sifive,fu740-c000-ccache" },
+       { .compatible = "starfive,jh7100-ccache", .data = (void *)BIT(DATA_UNCORR) },
+       { .compatible = "starfive,jh7110-ccache" },
        { .compatible = "sifive,ccache0" },
        { /* end of table */ }
 };
@@ -210,11 +212,15 @@ static int __init sifive_ccache_init(void)
        struct device_node *np;
        struct resource res;
        int i, rc, intr_num;
+       const struct of_device_id *match;
+       unsigned long broken_irqs;
 
-       np = of_find_matching_node(NULL, sifive_ccache_ids);
+       np = of_find_matching_node_and_match(NULL, sifive_ccache_ids, &match);
        if (!np)
                return -ENODEV;
 
+       broken_irqs = (uintptr_t)match->data;
+
        if (of_address_to_resource(np, 0, &res)) {
                rc = -ENODEV;
                goto err_node_put;
@@ -240,6 +246,10 @@ static int __init sifive_ccache_init(void)
 
        for (i = 0; i < intr_num; i++) {
                g_irq[i] = irq_of_parse_and_map(np, i);
+
+               if (broken_irqs & BIT(i))
+                       continue;
+
                rc = request_irq(g_irq[i], ccache_int_handler, 0, "ccache_ecc",
                                 NULL);
                if (rc) {