mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-29 10:08:59 +00:00
28f534d953
Update patch set for new release and add required kernel option CONFIG_ZRAM_TRACK_ENTRY_ACTIME to generic config Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.66 Manually rebased: bcm27xx/patches-6.6/950-0092-MMC-added-alternative-MMC-driver.patch bcm53xx/patches-6.6/180-usb-xhci-add-support-for-performing-fake-doorbell.patch starfive/patches-6.6/1000-serial-8250_dw-Add-starfive-jh7100-hsuart-compatible.patch Removed upstreamed: bcm27xx/patches-6.6/950-0029-vc4_hdmi-Avoid-log-spam-for-audio-start-failure.patch[1] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.6.66&id=e0388a95736abd1f5f5a94221dd1ac24eacbd4d7 Build system: x86/64 Build-tested: bcm27xx/bcm2712, flogic/glinet_gl-mt6000, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64 Run-tested: bcm27xx/bcm2712, flogic/glinet_gl-mt6000, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64 Signed-off-by: John Audia <therealgraysky@proton.me> Link: https://github.com/openwrt/openwrt/pull/17271 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
163 lines
4.9 KiB
Diff
163 lines
4.9 KiB
Diff
From f72fc22038dd544fa4d39c06e8c81c09c0041ed4 Mon Sep 17 00:00:00 2001
|
|
From: Lorenzo Bianconi <lorenzo@kernel.org>
|
|
Date: Tue, 12 Nov 2024 01:08:51 +0100
|
|
Subject: [PATCH 3/6] clk: en7523: introduce chip_scu regmap
|
|
|
|
Introduce chip_scu regmap pointer since EN7581 SoC will access chip-scu
|
|
memory area via a syscon node. Remove first memory region mapping
|
|
for EN7581 SoC. This patch does not introduce any backward incompatibility
|
|
since the dts for EN7581 SoC is not upstream yet.
|
|
|
|
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
|
Link: https://lore.kernel.org/r/20241112-clk-en7581-syscon-v2-4-8ada5e394ae4@kernel.org
|
|
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
|
|
---
|
|
drivers/clk/clk-en7523.c | 81 ++++++++++++++++++++++++++++++----------
|
|
1 file changed, 61 insertions(+), 20 deletions(-)
|
|
|
|
--- a/drivers/clk/clk-en7523.c
|
|
+++ b/drivers/clk/clk-en7523.c
|
|
@@ -3,8 +3,10 @@
|
|
#include <linux/delay.h>
|
|
#include <linux/clk-provider.h>
|
|
#include <linux/io.h>
|
|
+#include <linux/mfd/syscon.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/property.h>
|
|
+#include <linux/regmap.h>
|
|
#include <linux/reset-controller.h>
|
|
#include <dt-bindings/clock/en7523-clk.h>
|
|
#include <dt-bindings/reset/airoha,en7581-reset.h>
|
|
@@ -247,15 +249,11 @@ static const u16 en7581_rst_map[] = {
|
|
[EN7581_XPON_MAC_RST] = RST_NR_PER_BANK + 31,
|
|
};
|
|
|
|
-static unsigned int en7523_get_base_rate(void __iomem *base, unsigned int i)
|
|
+static u32 en7523_get_base_rate(const struct en_clk_desc *desc, u32 val)
|
|
{
|
|
- const struct en_clk_desc *desc = &en7523_base_clks[i];
|
|
- u32 val;
|
|
-
|
|
if (!desc->base_bits)
|
|
return desc->base_value;
|
|
|
|
- val = readl(base + desc->base_reg);
|
|
val >>= desc->base_shift;
|
|
val &= (1 << desc->base_bits) - 1;
|
|
|
|
@@ -265,16 +263,11 @@ static unsigned int en7523_get_base_rate
|
|
return desc->base_values[val];
|
|
}
|
|
|
|
-static u32 en7523_get_div(void __iomem *base, int i)
|
|
+static u32 en7523_get_div(const struct en_clk_desc *desc, u32 val)
|
|
{
|
|
- const struct en_clk_desc *desc = &en7523_base_clks[i];
|
|
- u32 reg, val;
|
|
-
|
|
if (!desc->div_bits)
|
|
return 1;
|
|
|
|
- reg = desc->div_reg ? desc->div_reg : desc->base_reg;
|
|
- val = readl(base + reg);
|
|
val >>= desc->div_shift;
|
|
val &= (1 << desc->div_bits) - 1;
|
|
|
|
@@ -418,9 +411,12 @@ static void en7523_register_clocks(struc
|
|
|
|
for (i = 0; i < ARRAY_SIZE(en7523_base_clks); i++) {
|
|
const struct en_clk_desc *desc = &en7523_base_clks[i];
|
|
+ u32 reg = desc->div_reg ? desc->div_reg : desc->base_reg;
|
|
+ u32 val = readl(base + desc->base_reg);
|
|
|
|
- rate = en7523_get_base_rate(base, i);
|
|
- rate /= en7523_get_div(base, i);
|
|
+ rate = en7523_get_base_rate(desc, val);
|
|
+ val = readl(base + reg);
|
|
+ rate /= en7523_get_div(desc, val);
|
|
|
|
hw = clk_hw_register_fixed_rate(dev, desc->name, NULL, 0, rate);
|
|
if (IS_ERR(hw)) {
|
|
@@ -454,21 +450,66 @@ static int en7523_clk_hw_init(struct pla
|
|
return 0;
|
|
}
|
|
|
|
+static void en7581_register_clocks(struct device *dev, struct clk_hw_onecell_data *clk_data,
|
|
+ struct regmap *map, void __iomem *base)
|
|
+{
|
|
+ struct clk_hw *hw;
|
|
+ u32 rate;
|
|
+ int i;
|
|
+
|
|
+ for (i = 0; i < ARRAY_SIZE(en7523_base_clks); i++) {
|
|
+ const struct en_clk_desc *desc = &en7523_base_clks[i];
|
|
+ u32 val, reg = desc->div_reg ? desc->div_reg : desc->base_reg;
|
|
+ int err;
|
|
+
|
|
+ err = regmap_read(map, desc->base_reg, &val);
|
|
+ if (err) {
|
|
+ pr_err("Failed reading fixed clk rate %s: %d\n",
|
|
+ desc->name, err);
|
|
+ continue;
|
|
+ }
|
|
+ rate = en7523_get_base_rate(desc, val);
|
|
+
|
|
+ err = regmap_read(map, reg, &val);
|
|
+ if (err) {
|
|
+ pr_err("Failed reading fixed clk div %s: %d\n",
|
|
+ desc->name, err);
|
|
+ continue;
|
|
+ }
|
|
+ rate /= en7523_get_div(desc, val);
|
|
+
|
|
+ hw = clk_hw_register_fixed_rate(dev, desc->name, NULL, 0, rate);
|
|
+ if (IS_ERR(hw)) {
|
|
+ pr_err("Failed to register clk %s: %ld\n",
|
|
+ desc->name, PTR_ERR(hw));
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ clk_data->hws[desc->id] = hw;
|
|
+ }
|
|
+
|
|
+ hw = en7523_register_pcie_clk(dev, base);
|
|
+ clk_data->hws[EN7523_CLK_PCIE] = hw;
|
|
+
|
|
+ clk_data->num = EN7523_NUM_CLOCKS;
|
|
+}
|
|
+
|
|
static int en7581_clk_hw_init(struct platform_device *pdev,
|
|
struct clk_hw_onecell_data *clk_data)
|
|
{
|
|
- void __iomem *base, *np_base;
|
|
+ void __iomem *np_base;
|
|
+ struct regmap *map;
|
|
u32 val;
|
|
|
|
- base = devm_platform_ioremap_resource(pdev, 0);
|
|
- if (IS_ERR(base))
|
|
- return PTR_ERR(base);
|
|
+ map = syscon_regmap_lookup_by_compatible("airoha,en7581-chip-scu");
|
|
+ if (IS_ERR(map))
|
|
+ return PTR_ERR(map);
|
|
|
|
- np_base = devm_platform_ioremap_resource(pdev, 1);
|
|
+ np_base = devm_platform_ioremap_resource(pdev, 0);
|
|
if (IS_ERR(np_base))
|
|
return PTR_ERR(np_base);
|
|
|
|
- en7523_register_clocks(&pdev->dev, clk_data, base, np_base);
|
|
+ en7581_register_clocks(&pdev->dev, clk_data, map, np_base);
|
|
|
|
val = readl(np_base + REG_NP_SCU_SSTR);
|
|
val &= ~(REG_PCIE_XSI0_SEL_MASK | REG_PCIE_XSI1_SEL_MASK);
|
|
@@ -545,7 +586,7 @@ static int en7523_reset_register(struct
|
|
if (!soc_data->reset.idx_map_nr)
|
|
return 0;
|
|
|
|
- base = devm_platform_ioremap_resource(pdev, 2);
|
|
+ base = devm_platform_ioremap_resource(pdev, 1);
|
|
if (IS_ERR(base))
|
|
return PTR_ERR(base);
|
|
|