]> Pileus Git - ~andy/linux/commitdiff
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 55bf075add9b28f164b2e98a95567cff0b285831..836cc81a63a1ff2b433a7ef016f49aba9a9fd516 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 7c5dace92b9159b56c59c12ac28fb9bdf150a799..38ee1b17a27d0ae56da717078facbd054489750b 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 febd787f054f7661c2ead686e6bc80733a3e81a8..40726c70328f4784c19d6cc05ea2f0423a19aa4f 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 c4d4773d3e855892a83f7a11192ac6352084e1c1..7fb27b12bea9ff2968fde9a8c2152caec6747a6a 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 3b18304c5653e066994222813f4e3044713e12b1..69d19ea19d4d9909e687393cb29650d6c2b28644 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 6c65b6716cf7905d148bb9292650b2c080df5bb0..3aeec246e746755b92ce9aa2df69c81f014d70ed 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 a8dc8d5f6e1e4f492c27a07d64ddd48dbffc5d70..978310fcafd6c61598dc6460c04120e3d53d3663 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 e7aefb467ab3a1fc1f4b5a8d0fac169fad9802ae..d460d304555537b1541488e881192c502f29f2e5 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);