ARM: mxs: Add pwm clocks and device registration
authorSascha Hauer <s.hauer@pengutronix.de>
Tue, 25 Jan 2011 10:58:15 +0000 (11:58 +0100)
committerSascha Hauer <s.hauer@pengutronix.de>
Tue, 1 Mar 2011 13:19:59 +0000 (14:19 +0100)
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
arch/arm/mach-mxs/Kconfig
arch/arm/mach-mxs/clock-mx23.c
arch/arm/mach-mxs/clock-mx28.c
arch/arm/mach-mxs/devices-mx23.h
arch/arm/mach-mxs/devices-mx28.h
arch/arm/mach-mxs/devices/Kconfig
arch/arm/mach-mxs/devices/Makefile
arch/arm/mach-mxs/devices/platform-mxs-pwm.c [new file with mode: 0644]
arch/arm/mach-mxs/include/mach/devices-common.h

index 55bf075..836cc81 100644 (file)
@@ -8,10 +8,12 @@ config MXS_OCOTP
 config SOC_IMX23
        bool
        select CPU_ARM926T
+       select HAVE_PWM
 
 config SOC_IMX28
        bool
        select CPU_ARM926T
+       select HAVE_PWM
 
 comment "MXS platforms:"
 
index 7c5dace..38ee1b1 100644 (file)
@@ -447,7 +447,11 @@ static struct clk_lookup lookups[] = {
        _REGISTER_CLOCK(NULL, "hclk", hbus_clk)
        _REGISTER_CLOCK(NULL, "usb", usb_clk)
        _REGISTER_CLOCK(NULL, "audio", audio_clk)
-       _REGISTER_CLOCK(NULL, "pwm", pwm_clk)
+       _REGISTER_CLOCK("mxs-pwm.0", NULL, pwm_clk)
+       _REGISTER_CLOCK("mxs-pwm.1", NULL, pwm_clk)
+       _REGISTER_CLOCK("mxs-pwm.2", NULL, pwm_clk)
+       _REGISTER_CLOCK("mxs-pwm.3", NULL, pwm_clk)
+       _REGISTER_CLOCK("mxs-pwm.4", NULL, pwm_clk)
 };
 
 static int clk_misc_init(void)
index febd787..40726c7 100644 (file)
@@ -622,7 +622,14 @@ static struct clk_lookup lookups[] = {
        _REGISTER_CLOCK("flexcan.1", NULL, can1_clk)
        _REGISTER_CLOCK(NULL, "usb0", usb0_clk)
        _REGISTER_CLOCK(NULL, "usb1", usb1_clk)
-       _REGISTER_CLOCK(NULL, "pwm", pwm_clk)
+       _REGISTER_CLOCK("mxs-pwm.0", NULL, pwm_clk)
+       _REGISTER_CLOCK("mxs-pwm.1", NULL, pwm_clk)
+       _REGISTER_CLOCK("mxs-pwm.2", NULL, pwm_clk)
+       _REGISTER_CLOCK("mxs-pwm.3", NULL, pwm_clk)
+       _REGISTER_CLOCK("mxs-pwm.4", NULL, pwm_clk)
+       _REGISTER_CLOCK("mxs-pwm.5", NULL, pwm_clk)
+       _REGISTER_CLOCK("mxs-pwm.6", NULL, pwm_clk)
+       _REGISTER_CLOCK("mxs-pwm.7", NULL, pwm_clk)
        _REGISTER_CLOCK(NULL, "lradc", lradc_clk)
        _REGISTER_CLOCK(NULL, "spdif", spdif_clk)
 };
index c4d4773..7fb27b1 100644 (file)
@@ -19,3 +19,5 @@ extern const struct mxs_auart_data mx23_auart_data[] __initconst;
 #define mx23_add_auart(id)     mxs_add_auart(&mx23_auart_data[id])
 #define mx23_add_auart0()              mx23_add_auart(0)
 #define mx23_add_auart1()              mx23_add_auart(1)
+
+#define mx23_add_mxs_pwm(id)           mxs_add_mxs_pwm(MX23_PWM_BASE_ADDR, id)
index 3b18304..69d19ea 100644 (file)
@@ -32,3 +32,5 @@ extern const struct mxs_flexcan_data mx28_flexcan_data[] __initconst;
        mxs_add_flexcan(&mx28_flexcan_data[id], pdata)
 #define mx28_add_flexcan0(pdata)       mx28_add_flexcan(0, pdata)
 #define mx28_add_flexcan1(pdata)       mx28_add_flexcan(1, pdata)
+
+#define mx28_add_mxs_pwm(id)           mxs_add_mxs_pwm(MX28_PWM_BASE_ADDR, id)
index 6c65b67..3aeec24 100644 (file)
@@ -11,3 +11,6 @@ config MXS_HAVE_PLATFORM_FEC
 config MXS_HAVE_PLATFORM_FLEXCAN
        select HAVE_CAN_FLEXCAN if CAN
        bool
+
+config MXS_HAVE_PLATFORM_MXS_PWM
+       bool
index a8dc8d5..978310f 100644 (file)
@@ -2,3 +2,4 @@ obj-$(CONFIG_MXS_HAVE_AMBA_DUART) += amba-duart.o
 obj-$(CONFIG_MXS_HAVE_PLATFORM_AUART) += platform-auart.o
 obj-$(CONFIG_MXS_HAVE_PLATFORM_FEC) += platform-fec.o
 obj-$(CONFIG_MXS_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o
+obj-$(CONFIG_MXS_HAVE_PLATFORM_MXS_PWM) += platform-mxs-pwm.o
diff --git a/arch/arm/mach-mxs/devices/platform-mxs-pwm.c b/arch/arm/mach-mxs/devices/platform-mxs-pwm.c
new file mode 100644 (file)
index 0000000..680f5a9
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2010 Pengutronix
+ * Sascha Hauer <s.hauer@pengutronix.de>
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License version 2 as published by the
+ * Free Software Foundation.
+ */
+#include <asm/sizes.h>
+#include <mach/devices-common.h>
+
+struct platform_device *__init mxs_add_mxs_pwm(resource_size_t iobase, int id)
+{
+       struct resource res = {
+               .flags = IORESOURCE_MEM,
+       };
+
+       res.start = iobase + 0x10 + 0x20 * id;
+       res.end = res.start + 0x1f;
+
+       return mxs_add_platform_device("mxs-pwm", id, &res, 1, NULL, 0);
+}
index e7aefb4..d460d30 100644 (file)
@@ -63,3 +63,7 @@ struct mxs_flexcan_data {
 struct platform_device *__init mxs_add_flexcan(
                const struct mxs_flexcan_data *data,
                const struct flexcan_platform_data *pdata);
+
+/* pwm */
+struct platform_device *__init mxs_add_mxs_pwm(
+               resource_size_t iobase, int id);