mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-30 16:14:12 +00:00
ff529e8137
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.71 Manually rebased: airoha/patches-6.6/110-01-clk-en7523-Rework-clock-handling-for-different-clock.patch airoha/patches-6.6/111-mmc-mtk-sd-add-support-for-AN7581-MMC-Host.patch All other patches automatically rebased. Build system: x86/64 Build-tested: bcm27xx/bcm2712 Run-tested: bcm27xx/bcm2712 Signed-off-by: John Audia <therealgraysky@proton.me> [ fix manually rebased patch ] Link: https://github.com/openwrt/openwrt/pull/17568 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> (cherry picked from commit 3f87c5ac4221deb37d4c3e730e692eef8f9c9ffe)
83 lines
2.6 KiB
Diff
83 lines
2.6 KiB
Diff
From 04cd09990fdc3106d9fc4c47dda100e521d62a43 Mon Sep 17 00:00:00 2001
|
|
From: Christian Marangi <ansuelsmth@gmail.com>
|
|
Date: Wed, 18 Dec 2024 10:03:45 +0100
|
|
Subject: [PATCH 1/4] clk: en7523: Rework clock handling for different clock
|
|
numbers
|
|
|
|
Airoha EN7581 SoC have additional clock compared to EN7523 but current
|
|
driver permits to only support up to EN7523 clock numbers.
|
|
|
|
To handle this, rework the clock handling and permit to declare the
|
|
clocks number in match_data and alloca clk_data based on the compatible
|
|
match_data.
|
|
|
|
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
|
---
|
|
drivers/clk/clk-en7523.c | 14 ++++++++------
|
|
1 file changed, 8 insertions(+), 6 deletions(-)
|
|
|
|
--- a/drivers/clk/clk-en7523.c
|
|
+++ b/drivers/clk/clk-en7523.c
|
|
@@ -75,6 +75,7 @@ struct en_rst_data {
|
|
};
|
|
|
|
struct en_clk_soc_data {
|
|
+ u32 num_clocks;
|
|
const struct clk_ops pcie_ops;
|
|
int (*hw_init)(struct platform_device *pdev,
|
|
struct clk_hw_onecell_data *clk_data);
|
|
@@ -504,8 +505,6 @@ static void en7523_register_clocks(struc
|
|
u32 rate;
|
|
int i;
|
|
|
|
- clk_data->num = EN7523_NUM_CLOCKS;
|
|
-
|
|
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;
|
|
@@ -587,8 +586,6 @@ static void en7581_register_clocks(struc
|
|
|
|
hw = en7523_register_pcie_clk(dev, base);
|
|
clk_data->hws[EN7523_CLK_PCIE] = hw;
|
|
-
|
|
- clk_data->num = EN7523_NUM_CLOCKS;
|
|
}
|
|
|
|
static int en7523_reset_update(struct reset_controller_dev *rcdev,
|
|
@@ -702,21 +699,24 @@ static int en7523_clk_probe(struct platf
|
|
struct clk_hw_onecell_data *clk_data;
|
|
int r;
|
|
|
|
+ soc_data = device_get_match_data(&pdev->dev);
|
|
+
|
|
clk_data = devm_kzalloc(&pdev->dev,
|
|
- struct_size(clk_data, hws, EN7523_NUM_CLOCKS),
|
|
+ struct_size(clk_data, hws, soc_data->num_clocks),
|
|
GFP_KERNEL);
|
|
if (!clk_data)
|
|
return -ENOMEM;
|
|
|
|
- soc_data = device_get_match_data(&pdev->dev);
|
|
r = soc_data->hw_init(pdev, clk_data);
|
|
if (r)
|
|
return r;
|
|
|
|
+ clk_data->num = soc_data->num_clocks;
|
|
return of_clk_add_hw_provider(node, of_clk_hw_onecell_get, clk_data);
|
|
}
|
|
|
|
static const struct en_clk_soc_data en7523_data = {
|
|
+ .num_clocks = ARRAY_SIZE(en7523_base_clks) + 1,
|
|
.pcie_ops = {
|
|
.is_enabled = en7523_pci_is_enabled,
|
|
.prepare = en7523_pci_prepare,
|
|
@@ -726,6 +726,8 @@ static const struct en_clk_soc_data en75
|
|
};
|
|
|
|
static const struct en_clk_soc_data en7581_data = {
|
|
+ /* We increment num_clocks by 1 to account for additional PCIe clock */
|
|
+ .num_clocks = ARRAY_SIZE(en7581_base_clks) + 1,
|
|
.pcie_ops = {
|
|
.is_enabled = en7581_pci_is_enabled,
|
|
.enable = en7581_pci_enable,
|