From: Duje Mihanović <[email protected]>

It has been concluded by comparing the gate clock masks and vendor code
between PXA1908/28 that PXA1908's APBCP, similarly to PXA1928's APBC,
has controllable reset lines. Describe these in the driver for
correctness.

Signed-off-by: Duje Mihanović <[email protected]>
---
 drivers/clk/mmp/clk-pxa1908-apbcp.c | 31 ++++++++++++++++++++++++++++---
 1 file changed, 28 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/mmp/clk-pxa1908-apbcp.c 
b/drivers/clk/mmp/clk-pxa1908-apbcp.c
index f638d7e89b47..1aa476103553 100644
--- a/drivers/clk/mmp/clk-pxa1908-apbcp.c
+++ b/drivers/clk/mmp/clk-pxa1908-apbcp.c
@@ -7,6 +7,7 @@
 #include <dt-bindings/clock/marvell,pxa1908.h>
 
 #include "clk.h"
+#include "reset.h"
 
 #define APBCP_UART2            0x1c
 #define APBCP_TWSI2            0x28
@@ -24,9 +25,9 @@ static DEFINE_SPINLOCK(uart2_lock);
 static const char * const uart_parent_names[] = {"pll1_117", "uart_pll"};
 
 static struct mmp_param_gate_clk apbcp_gate_clks[] = {
-       {PXA1908_CLK_UART2, "uart2_clk", "uart2_mux", CLK_SET_RATE_PARENT, 
APBCP_UART2, 0x7, 0x3, 0x0, 0, &uart2_lock},
-       {PXA1908_CLK_TWSI2, "twsi2_clk", "pll1_32", CLK_SET_RATE_PARENT, 
APBCP_TWSI2, 0x7, 0x3, 0x0, 0, NULL},
-       {PXA1908_CLK_AICER, "ripc_clk", NULL, 0, APBCP_AICER, 0x7, 0x2, 0x0, 0, 
NULL},
+       {PXA1908_CLK_UART2, "uart2_clk", "uart2_mux", CLK_SET_RATE_PARENT, 
APBCP_UART2, 0x3, 0x3, 0x0, 0, &uart2_lock},
+       {PXA1908_CLK_TWSI2, "twsi2_clk", "pll1_32", CLK_SET_RATE_PARENT, 
APBCP_TWSI2, 0x3, 0x3, 0x0, 0, NULL},
+       {PXA1908_CLK_AICER, "ripc_clk", NULL, 0, APBCP_AICER, 0x3, 0x2, 0x0, 0, 
NULL},
 };
 
 static struct mmp_param_mux_clk apbcp_mux_clks[] = {
@@ -43,6 +44,28 @@ static void pxa1908_apb_p_periph_clk_init(struct 
pxa1908_clk_unit *pxa_unit)
                        ARRAY_SIZE(apbcp_gate_clks));
 }
 
+/* Taken from clk-of-pxa1928.c */
+static void pxa1908_clk_reset_init(struct device_node *np,
+                                  struct pxa1908_clk_unit *pxa_unit)
+{
+       struct mmp_clk_reset_cell *cells;
+       int nr_cells = ARRAY_SIZE(apbcp_gate_clks);
+
+       cells = kzalloc_objs(*cells, nr_cells);
+       if (!cells)
+               return;
+
+       for (int i = 0; i < nr_cells; i++) {
+               cells[i].clk_id = apbcp_gate_clks[i].id;
+               cells[i].reg = pxa_unit->base + apbcp_gate_clks[i].offset;
+               cells[i].bits = BIT(2);
+               cells[i].flags = 0;
+               cells[i].lock = apbcp_gate_clks[i].lock;
+       };
+
+       mmp_clk_reset_register(np, cells, nr_cells);
+}
+
 static int pxa1908_apbcp_probe(struct platform_device *pdev)
 {
        struct pxa1908_clk_unit *pxa_unit;
@@ -59,6 +82,8 @@ static int pxa1908_apbcp_probe(struct platform_device *pdev)
 
        pxa1908_apb_p_periph_clk_init(pxa_unit);
 
+       pxa1908_clk_reset_init(pdev->dev.of_node, pxa_unit);
+
        return 0;
 }
 

-- 
2.53.0


Reply via email to