[PATCH 8/9] arm/mach-pxa: add basic devices hooks

Robert Jarzmik robert.jarzmik at free.fr
Wed Nov 23 22:02:43 EST 2011


From: Robert Jarzmik <robert.jarzmik at atosorigin.com>

Add basic functions to declare the basic PXA devices :
 - I2C device
 - frame buffer device
 - MMC device
 - UART device

Signed-off-by: Robert Jarzmik <robert.jarzmik at free.fr>
---
 arch/arm/mach-pxa/devices.c              |   32 ++++++++++++++++++++++++++++++
 arch/arm/mach-pxa/include/mach/devices.h |    9 ++++++++
 2 files changed, 41 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-pxa/devices.c
 create mode 100644 arch/arm/mach-pxa/include/mach/devices.h

diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
new file mode 100644
index 0000000..f5aabae
--- /dev/null
+++ b/arch/arm/mach-pxa/devices.c
@@ -0,0 +1,32 @@
+#include <common.h>
+#include <driver.h>
+#include <mach/devices.h>
+#include <mach/pxafb.h>
+
+static inline struct device_d *pxa_add_device(char *name, int id, void *base,
+					      int size, void *pdata)
+{
+	return add_generic_device(name, id, NULL, (resource_size_t)base, size,
+				  IORESOURCE_MEM, pdata);
+}
+
+struct device_d *pxa_add_i2c(void *base, int id,
+			     struct i2c_platform_data *pdata)
+{
+	return pxa_add_device("i2c-pxa", id, base, 0x1000, pdata);
+}
+
+struct device_d *pxa_add_uart(void *base, int id)
+{
+	return pxa_add_device("pxa_serial", id, base, 0x1000, NULL);
+}
+
+struct device_d *pxa_add_fb(void *base, struct pxafb_platform_data *pdata)
+{
+	return pxa_add_device("pxafb", -1, base, 0x1000, pdata);
+}
+
+struct device_d *pxa_add_mmc(void *base, int id, void *pdata)
+{
+	return pxa_add_device("pxa-mmc", id, base, 0x1000, pdata);
+}
diff --git a/arch/arm/mach-pxa/include/mach/devices.h b/arch/arm/mach-pxa/include/mach/devices.h
new file mode 100644
index 0000000..b549f69
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/devices.h
@@ -0,0 +1,9 @@
+#include <i2c/i2c.h>
+#include <mach/pxafb.h>
+
+struct device_d *pxa_add_i2c(void *base, int id,
+			     struct i2c_platform_data *pdata);
+struct device_d *pxa_add_uart(void *base, int id);
+struct device_d *pxa_add_fb(void *base, struct pxafb_platform_data *pdata);
+struct device_d *pxa_add_mmc(void *base, int id, void *pdata);
+
-- 
1.7.5.4




More information about the barebox mailing list