mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-29 18:19:02 +00:00
9131cb44ff
Introduce EN7581 SoC support with currently rfb board supported. This is a new 64bit SoC from Airoha that is currently almost fully supported upstream with only the DTS missing. Setting source-only waiting for the full upstream support to be completed. Link: https://github.com/openwrt/openwrt/pull/16730 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
99 lines
3.0 KiB
Diff
99 lines
3.0 KiB
Diff
From 457e74667f452d7f071ad2b2d9313ec62ebc4b02 Mon Sep 17 00:00:00 2001
|
|
From: Lorenzo Bianconi <lorenzo@kernel.org>
|
|
Date: Sat, 6 Apr 2024 12:43:43 +0200
|
|
Subject: [PATCH 1/2] clk: en7523: Add en_clk_soc_data data structure
|
|
|
|
Introduce en_clk_soc_data data structure in order to define multiple
|
|
clk_ops for each supported SoC. This is a preliminary patch to
|
|
introduce EN7581 clock support.
|
|
|
|
Tested-by: Zhengping Zhang <zhengping.zhang@airoha.com>
|
|
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
|
Link: https://lore.kernel.org/r/562a0da8d7874a02a324687c152c87a1549924bd.1712399981.git.lorenzo@kernel.org
|
|
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
|
|
---
|
|
drivers/clk/clk-en7523.c | 34 +++++++++++++++++++++-------------
|
|
1 file changed, 21 insertions(+), 13 deletions(-)
|
|
|
|
--- a/drivers/clk/clk-en7523.c
|
|
+++ b/drivers/clk/clk-en7523.c
|
|
@@ -3,8 +3,8 @@
|
|
#include <linux/delay.h>
|
|
#include <linux/clk-provider.h>
|
|
#include <linux/io.h>
|
|
-#include <linux/of.h>
|
|
#include <linux/platform_device.h>
|
|
+#include <linux/property.h>
|
|
#include <dt-bindings/clock/en7523-clk.h>
|
|
|
|
#define REG_PCI_CONTROL 0x88
|
|
@@ -48,6 +48,10 @@ struct en_clk_gate {
|
|
struct clk_hw hw;
|
|
};
|
|
|
|
+struct en_clk_soc_data {
|
|
+ const struct clk_ops pcie_ops;
|
|
+};
|
|
+
|
|
static const u32 gsw_base[] = { 400000000, 500000000 };
|
|
static const u32 emi_base[] = { 333000000, 400000000 };
|
|
static const u32 bus_base[] = { 500000000, 540000000 };
|
|
@@ -150,11 +154,6 @@ static const struct en_clk_desc en7523_b
|
|
}
|
|
};
|
|
|
|
-static const struct of_device_id of_match_clk_en7523[] = {
|
|
- { .compatible = "airoha,en7523-scu", },
|
|
- { /* sentinel */ }
|
|
-};
|
|
-
|
|
static unsigned int en7523_get_base_rate(void __iomem *base, unsigned int i)
|
|
{
|
|
const struct en_clk_desc *desc = &en7523_base_clks[i];
|
|
@@ -252,14 +251,10 @@ static void en7523_pci_unprepare(struct
|
|
static struct clk_hw *en7523_register_pcie_clk(struct device *dev,
|
|
void __iomem *np_base)
|
|
{
|
|
- static const struct clk_ops pcie_gate_ops = {
|
|
- .is_enabled = en7523_pci_is_enabled,
|
|
- .prepare = en7523_pci_prepare,
|
|
- .unprepare = en7523_pci_unprepare,
|
|
- };
|
|
+ const struct en_clk_soc_data *soc_data = device_get_match_data(dev);
|
|
struct clk_init_data init = {
|
|
.name = "pcie",
|
|
- .ops = &pcie_gate_ops,
|
|
+ .ops = &soc_data->pcie_ops,
|
|
};
|
|
struct en_clk_gate *cg;
|
|
|
|
@@ -269,7 +264,7 @@ static struct clk_hw *en7523_register_pc
|
|
|
|
cg->base = np_base;
|
|
cg->hw.init = &init;
|
|
- en7523_pci_unprepare(&cg->hw);
|
|
+ init.ops->unprepare(&cg->hw);
|
|
|
|
if (clk_hw_register(dev, &cg->hw))
|
|
return NULL;
|
|
@@ -338,6 +333,19 @@ static int en7523_clk_probe(struct platf
|
|
return r;
|
|
}
|
|
|
|
+static const struct en_clk_soc_data en7523_data = {
|
|
+ .pcie_ops = {
|
|
+ .is_enabled = en7523_pci_is_enabled,
|
|
+ .prepare = en7523_pci_prepare,
|
|
+ .unprepare = en7523_pci_unprepare,
|
|
+ },
|
|
+};
|
|
+
|
|
+static const struct of_device_id of_match_clk_en7523[] = {
|
|
+ { .compatible = "airoha,en7523-scu", .data = &en7523_data },
|
|
+ { /* sentinel */ }
|
|
+};
|
|
+
|
|
static struct platform_driver clk_en7523_drv = {
|
|
.probe = en7523_clk_probe,
|
|
.driver = {
|