From: "Teresa Gámez" <t.gamez@phytec.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/2] ARM OMAP: Create device file
Date: Thu, 11 Oct 2012 09:25:34 +0200 [thread overview]
Message-ID: <1349940335-20960-1-git-send-email-t.gamez@phytec.de> (raw)
Created wrapper to add omap devices.
Signed-off-by: Teresa Gámez <t.gamez@phytec.de>
---
arch/arm/mach-omap/Makefile | 4 +-
arch/arm/mach-omap/devices.c | 65 +++++++++++++++++++++++++++++
arch/arm/mach-omap/include/mach/devices.h | 24 +++++++++++
3 files changed, 91 insertions(+), 2 deletions(-)
create mode 100644 arch/arm/mach-omap/devices.c
create mode 100644 arch/arm/mach-omap/include/mach/devices.h
diff --git a/arch/arm/mach-omap/Makefile b/arch/arm/mach-omap/Makefile
index f752bc7..672944d 100644
--- a/arch/arm/mach-omap/Makefile
+++ b/arch/arm/mach-omap/Makefile
@@ -15,8 +15,8 @@
# GNU General Public License for more details.
#
#
-obj-$(CONFIG_ARCH_OMAP) += syslib.o
-pbl-$(CONFIG_ARCH_OMAP) += syslib.o
+obj-$(CONFIG_ARCH_OMAP) += syslib.o devices.o
+pbl-$(CONFIG_ARCH_OMAP) += syslib.o devices.o
obj-$(CONFIG_OMAP_CLOCK_SOURCE_S32K) += s32k_clksource.o
obj-$(CONFIG_ARCH_OMAP3) += omap3_core.o omap3_generic.o auxcr.o
pbl-$(CONFIG_ARCH_OMAP3) += omap3_core.o omap3_generic.o auxcr.o
diff --git a/arch/arm/mach-omap/devices.c b/arch/arm/mach-omap/devices.c
new file mode 100644
index 0000000..a4812b4
--- /dev/null
+++ b/arch/arm/mach-omap/devices.c
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2012 Teresa Gámez, Phytec Messtechnik GmbH
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <common.h>
+#include <driver.h>
+#include <sizes.h>
+#include <ns16550.h>
+#include <asm/armlinux.h>
+#include <mach/devices.h>
+
+static inline struct device_d *omap_add_device(char *name, resource_size_t base,
+ resource_size_t size, void *pdata)
+{
+ return add_generic_device(name, DEVICE_ID_DYNAMIC, NULL,
+ base, size, IORESOURCE_MEM, pdata);
+}
+
+void omap_add_ram0(resource_size_t size)
+{
+ arm_add_mem_device("ram0", 0x80000000, size);
+}
+
+void omap_add_sram0(resource_size_t base, resource_size_t size)
+{
+ add_mem_device("sram0", base, size, IORESOURCE_MEM_WRITEABLE);
+}
+
+static struct NS16550_plat serial_plat = {
+ .clock = 48000000, /* 48MHz (APLL96/2) */
+ .shift = 2,
+};
+
+struct device_d *omap_add_ns16550(resource_size_t base)
+{
+ return add_ns16550_device(DEVICE_ID_DYNAMIC, base, SZ_1K,
+ IORESOURCE_MEM_8BIT, &serial_plat);
+}
+
+struct device_d *omap_add_mmc(resource_size_t base, void *pdata)
+{
+ return omap_add_device("omap-hsmmc", base, SZ_4K, pdata);
+}
+
+struct device_d *omap_add_i2c(resource_size_t base, void *pdata)
+{
+ return omap_add_device("i2c-omap", base, SZ_4K, pdata);
+}
+
+struct device_d *omap_add_spi(resource_size_t base, int id, void *pdata)
+{
+ return add_generic_device("omap3_spi", id, NULL,
+ base, SZ_4K, IORESOURCE_MEM, pdata);
+}
diff --git a/arch/arm/mach-omap/include/mach/devices.h b/arch/arm/mach-omap/include/mach/devices.h
new file mode 100644
index 0000000..05f1fe4
--- /dev/null
+++ b/arch/arm/mach-omap/include/mach/devices.h
@@ -0,0 +1,24 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __ASM_ARCH_OMAP_DEVICES_H
+#define __ASM_ARCH_OMAP_DEVICES_H
+
+void omap_add_ram0(resource_size_t size);
+void omap_add_sram0(resource_size_t base, resource_size_t size);
+struct device_d *omap_add_ns16550(resource_size_t base);
+struct device_d *omap_add_mmc(resource_size_t base, void *pdata);
+struct device_d *omap_add_i2c(resource_size_t base, void *pdata);
+struct device_d *omap_add_spi(resource_size_t base, int id, void *pdata);
+
+#endif
--
1.7.0.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2012-10-11 7:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-11 7:25 Teresa Gámez [this message]
2012-10-11 7:25 ` [PATCH 2/2] ARM OMAP: Use wrapper in board files Teresa Gámez
2012-10-11 12:44 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-12 7:58 ` [PATCH 1/2] ARM OMAP: Create device file Sascha Hauer
2012-10-12 9:30 ` Teresa Gamez
2012-10-13 12:10 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1349940335-20960-1-git-send-email-t.gamez@phytec.de \
--to=t.gamez@phytec.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox