clk: davinci: Add platform information for TI DM646x PSC
authorDavid Lechner <david@lechnology.com>
Fri, 16 Mar 2018 02:52:32 +0000 (21:52 -0500)
committerStephen Boyd <sboyd@kernel.org>
Tue, 20 Mar 2018 17:16:26 +0000 (10:16 -0700)
This adds platform-specific declarations for the PSC clocks on TI
DM646x based systems.

Signed-off-by: David Lechner <david@lechnology.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/davinci/Makefile
drivers/clk/davinci/psc-dm646x.c [new file with mode: 0644]
drivers/clk/davinci/psc.c
drivers/clk/davinci/psc.h

index a20e3795eaf9be4fef5ec07895952ffed4b98594..6c388d44162d764a19bee741d9069a7020f1509c 100644 (file)
@@ -15,4 +15,5 @@ obj-$(CONFIG_ARCH_DAVINCI_DA850)      += psc-da850.o
 obj-$(CONFIG_ARCH_DAVINCI_DM355)       += psc-dm355.o
 obj-$(CONFIG_ARCH_DAVINCI_DM365)       += psc-dm365.o
 obj-$(CONFIG_ARCH_DAVINCI_DM644x)      += psc-dm644x.o
+obj-$(CONFIG_ARCH_DAVINCI_DM646x)      += psc-dm646x.o
 endif
diff --git a/drivers/clk/davinci/psc-dm646x.c b/drivers/clk/davinci/psc-dm646x.c
new file mode 100644 (file)
index 0000000..468ef86
--- /dev/null
@@ -0,0 +1,80 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * PSC clock descriptions for TI DaVinci DM646x
+ *
+ * Copyright (C) 2018 David Lechner <david@lechnology.com>
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/clk.h>
+#include <linux/clkdev.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/types.h>
+
+#include "psc.h"
+
+LPSC_CLKDEV1(ide_clkdev,       NULL,           "palm_bk3710");
+LPSC_CLKDEV2(emac_clkdev,      NULL,           "davinci_emac.1",
+                               "fck",          "davinci_mdio.0");
+LPSC_CLKDEV1(aemif_clkdev,     "aemif",        NULL);
+LPSC_CLKDEV1(mcasp0_clkdev,    NULL,           "davinci-mcasp.0");
+LPSC_CLKDEV1(mcasp1_clkdev,    NULL,           "davinci-mcasp.1");
+LPSC_CLKDEV1(uart0_clkdev,     NULL,           "serial8250.0");
+LPSC_CLKDEV1(uart1_clkdev,     NULL,           "serial8250.1");
+LPSC_CLKDEV1(uart2_clkdev,     NULL,           "serial8250.2");
+LPSC_CLKDEV1(i2c_clkdev,       NULL,           "i2c_davinci.1");
+/* REVISIT: gpio-davinci.c should be modified to drop con_id */
+LPSC_CLKDEV1(gpio_clkdev,      "gpio",         NULL);
+LPSC_CLKDEV1(timer0_clkdev,    "timer0",        NULL);
+
+static const struct davinci_lpsc_clk_info dm646x_psc_info[] = {
+       LPSC(0,  0, arm,      pll1_sysclk2, NULL,          LPSC_ALWAYS_ENABLED),
+       /* REVISIT how to disable? */
+       LPSC(1,  0, dsp,      pll1_sysclk1, NULL,          LPSC_ALWAYS_ENABLED),
+       LPSC(4,  0, edma_cc,  pll1_sysclk2, NULL,          LPSC_ALWAYS_ENABLED),
+       LPSC(5,  0, edma_tc0, pll1_sysclk2, NULL,          LPSC_ALWAYS_ENABLED),
+       LPSC(6,  0, edma_tc1, pll1_sysclk2, NULL,          LPSC_ALWAYS_ENABLED),
+       LPSC(7,  0, edma_tc2, pll1_sysclk2, NULL,          LPSC_ALWAYS_ENABLED),
+       LPSC(8,  0, edma_tc3, pll1_sysclk2, NULL,          LPSC_ALWAYS_ENABLED),
+       LPSC(10, 0, ide,      pll1_sysclk4, ide_clkdev,    0),
+       LPSC(14, 0, emac,     pll1_sysclk3, emac_clkdev,   0),
+       LPSC(16, 0, vpif0,    ref_clk,      NULL,          LPSC_ALWAYS_ENABLED),
+       LPSC(17, 0, vpif1,    ref_clk,      NULL,          LPSC_ALWAYS_ENABLED),
+       LPSC(21, 0, aemif,    pll1_sysclk3, aemif_clkdev,  LPSC_ALWAYS_ENABLED),
+       LPSC(22, 0, mcasp0,   pll1_sysclk3, mcasp0_clkdev, 0),
+       LPSC(23, 0, mcasp1,   pll1_sysclk3, mcasp1_clkdev, 0),
+       LPSC(26, 0, uart0,    aux_clkin,    uart0_clkdev,  0),
+       LPSC(27, 0, uart1,    aux_clkin,    uart1_clkdev,  0),
+       LPSC(28, 0, uart2,    aux_clkin,    uart2_clkdev,  0),
+       /* REVIST: disabling hangs system */
+       LPSC(29, 0, pwm0,     pll1_sysclk3, NULL,          LPSC_ALWAYS_ENABLED),
+       /* REVIST: disabling hangs system */
+       LPSC(30, 0, pwm1,     pll1_sysclk3, NULL,          LPSC_ALWAYS_ENABLED),
+       LPSC(31, 0, i2c,      pll1_sysclk3, i2c_clkdev,    0),
+       LPSC(33, 0, gpio,     pll1_sysclk3, gpio_clkdev,   0),
+       LPSC(34, 0, timer0,   pll1_sysclk3, timer0_clkdev, LPSC_ALWAYS_ENABLED),
+       LPSC(35, 0, timer1,   pll1_sysclk3, NULL,          0),
+       { }
+};
+
+static int dm646x_psc_init(struct device *dev, void __iomem *base)
+{
+       return davinci_psc_register_clocks(dev, dm646x_psc_info, 46, base);
+}
+
+static struct clk_bulk_data dm646x_psc_parent_clks[] = {
+       { .id = "ref_clk"      },
+       { .id = "aux_clkin"    },
+       { .id = "pll1_sysclk1" },
+       { .id = "pll1_sysclk2" },
+       { .id = "pll1_sysclk3" },
+       { .id = "pll1_sysclk4" },
+       { .id = "pll1_sysclk5" },
+};
+
+const struct davinci_psc_init_data dm646x_psc_init_data = {
+       .parent_clks            = dm646x_psc_parent_clks,
+       .num_parent_clks        = ARRAY_SIZE(dm646x_psc_parent_clks),
+       .psc_init               = &dm646x_psc_init,
+};
index 65209382a3a688ede19fe45cc67cd286d2b843a1..3b0e59dfbdd760e9ea3f85ef24a9519ced859cbf 100644 (file)
@@ -495,6 +495,7 @@ static const struct platform_device_id davinci_psc_id_table[] = {
        { .name = "dm355-psc",  .driver_data = (kernel_ulong_t)&dm355_psc_init_data  },
        { .name = "dm365-psc",  .driver_data = (kernel_ulong_t)&dm365_psc_init_data  },
        { .name = "dm644x-psc", .driver_data = (kernel_ulong_t)&dm644x_psc_init_data },
+       { .name = "dm646x-psc", .driver_data = (kernel_ulong_t)&dm646x_psc_init_data },
        { }
 };
 
index d665cb0050995d2bf8c2784d4c02a6f47a96cc66..c2a7df6413fe8c5330c3c4a9f43ac5089402fda4 100644 (file)
@@ -103,5 +103,6 @@ extern const struct davinci_psc_init_data of_da850_psc1_init_data;
 extern const struct davinci_psc_init_data dm355_psc_init_data;
 extern const struct davinci_psc_init_data dm365_psc_init_data;
 extern const struct davinci_psc_init_data dm644x_psc_init_data;
+extern const struct davinci_psc_init_data dm646x_psc_init_data;
 
 #endif /* __CLK_DAVINCI_PSC_H__ */