ARM MXS: Add auart platform support for i.MX28
authorSascha Hauer <s.hauer@pengutronix.de>
Tue, 11 Jan 2011 14:56:40 +0000 (15:56 +0100)
committerSascha Hauer <s.hauer@pengutronix.de>
Tue, 25 Jan 2011 07:39:58 +0000 (08:39 +0100)
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
arch/arm/mach-mxs/clock-mx28.c
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-auart.c [new file with mode: 0644]
arch/arm/mach-mxs/include/mach/devices-common.h

index 56312c092a9ea08efc0196fb5f87e6f31b12d132..2f1a9904a4e1154f01c7c6acffc23838ea4ef21c 100644 (file)
@@ -609,6 +609,11 @@ static struct clk_lookup lookups[] = {
        _REGISTER_CLOCK("duart", NULL, uart_clk)
        _REGISTER_CLOCK("imx28-fec.0", NULL, fec_clk)
        _REGISTER_CLOCK("imx28-fec.1", NULL, fec_clk)
+       _REGISTER_CLOCK("mxs-auart.0", NULL, uart_clk)
+       _REGISTER_CLOCK("mxs-auart.1", NULL, uart_clk)
+       _REGISTER_CLOCK("mxs-auart.2", NULL, uart_clk)
+       _REGISTER_CLOCK("mxs-auart.3", NULL, uart_clk)
+       _REGISTER_CLOCK("mxs-auart.4", NULL, uart_clk)
        _REGISTER_CLOCK("fec.0", NULL, fec_clk)
        _REGISTER_CLOCK("rtc", NULL, rtc_clk)
        _REGISTER_CLOCK("pll2", NULL, pll2_clk)
index 33773a6333a2a861b0cf1dbbe8e6e680012d562e..1ab7bf0aa458c2ae4c9e7b2ef7dd8769751d4d60 100644 (file)
@@ -15,6 +15,14 @@ extern const struct amba_device mx28_duart_device __initconst;
 #define mx28_add_duart() \
        mxs_add_duart(&mx28_duart_device)
 
+extern const struct mxs_auart_data mx28_auart_data[] __initconst;
+#define mx28_add_auart(id)     mxs_add_auart(&mx28_auart_data[id])
+#define mx28_add_auart0()              mx28_add_auart(0)
+#define mx28_add_auart1()              mx28_add_auart(1)
+#define mx28_add_auart2()              mx28_add_auart(2)
+#define mx28_add_auart3()              mx28_add_auart(3)
+#define mx28_add_auart4()              mx28_add_auart(4)
+
 extern const struct mxs_fec_data mx28_fec_data[] __initconst;
 #define mx28_add_fec(id, pdata) \
        mxs_add_fec(&mx28_fec_data[id], pdata)
index cf7dc1ae575b282040ab3cec561972c3edeff904..3001b754948a924ba4d9dc104c0bf1999f25c563 100644 (file)
@@ -2,5 +2,8 @@ config MXS_HAVE_AMBA_DUART
        bool
        select ARM_AMBA
 
+config MXS_HAVE_PLATFORM_AUART
+       bool
+
 config MXS_HAVE_PLATFORM_FEC
        bool
index d0a09f6934b853560a7a76afcbfa6f7085c3176d..c814d054bad7937a4d2e49906232a27adecbc5a9 100644 (file)
@@ -1,2 +1,3 @@
 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
diff --git a/arch/arm/mach-mxs/devices/platform-auart.c b/arch/arm/mach-mxs/devices/platform-auart.c
new file mode 100644 (file)
index 0000000..f0dbf8a
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * 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/mx28.h>
+#include <mach/devices-common.h>
+
+#define mxs_auart_data_entry_single(soc, _id)                          \
+       {                                                               \
+               .id = _id,                                              \
+               .iobase = soc ## _AUART ## _id ## _BASE_ADDR,           \
+               .irq = soc ## _INT_AUART ## _id,                        \
+       }
+
+#define mxs_auart_data_entry(soc, _id)                                 \
+       [_id] = mxs_auart_data_entry_single(soc, _id)
+
+#ifdef CONFIG_SOC_IMX28
+const struct mxs_auart_data mx28_auart_data[] __initconst = {
+#define mx28_auart_data_entry(_id)                                     \
+       mxs_auart_data_entry(MX28, _id)
+       mx28_auart_data_entry(0),
+       mx28_auart_data_entry(1),
+       mx28_auart_data_entry(2),
+       mx28_auart_data_entry(3),
+       mx28_auart_data_entry(4),
+};
+#endif
+
+struct platform_device *__init mxs_add_auart(
+               const struct mxs_auart_data *data)
+{
+       struct resource res[] = {
+               {
+                       .start = data->iobase,
+                       .end = data->iobase + SZ_8K - 1,
+                       .flags = IORESOURCE_MEM,
+               }, {
+                       .start = data->irq,
+                       .end = data->irq,
+                       .flags = IORESOURCE_IRQ,
+               },
+       };
+
+       return mxs_add_platform_device_dmamask("mxs-auart", data->id,
+                                       res, ARRAY_SIZE(res), NULL, 0,
+                                       DMA_BIT_MASK(32));
+}
+
index 6c3d1a103433016bdec67d64f4ee858fb7711a49..bed40021e2c252c2d8347a20298927a81ee2f2be 100644 (file)
@@ -30,6 +30,16 @@ int __init mxs_add_amba_device(const struct amba_device *dev);
 /* duart */
 int __init mxs_add_duart(const struct amba_device *dev);
 
+/* auart */
+struct mxs_auart_data {
+       int id;
+       resource_size_t iobase;
+       resource_size_t iosize;
+       resource_size_t irq;
+};
+struct platform_device *__init mxs_add_auart(
+               const struct mxs_auart_data *data);
+
 /* fec */
 #include <linux/fec.h>
 struct mxs_fec_data {