mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] ARM OMAP: Create device file
@ 2012-10-11  7:25 Teresa Gámez
  2012-10-11  7:25 ` [PATCH 2/2] ARM OMAP: Use wrapper in board files Teresa Gámez
  2012-10-12  7:58 ` [PATCH 1/2] ARM OMAP: Create device file Sascha Hauer
  0 siblings, 2 replies; 6+ messages in thread
From: Teresa Gámez @ 2012-10-11  7:25 UTC (permalink / raw)
  To: barebox

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/2] ARM OMAP: Use wrapper in board files
  2012-10-11  7:25 [PATCH 1/2] ARM OMAP: Create device file Teresa Gámez
@ 2012-10-11  7:25 ` 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
  1 sibling, 1 reply; 6+ messages in thread
From: Teresa Gámez @ 2012-10-11  7:25 UTC (permalink / raw)
  To: barebox

Use the omap wrappers in board files instead of add_generic_device().
Compile tested every affected board. Tested on pcm049.

Signed-off-by: Teresa Gámez <t.gamez@phytec.de>
---
 arch/arm/boards/beagle/board.c            |   17 +++++------------
 arch/arm/boards/omap343xdsp/board.c       |   12 ++++--------
 arch/arm/boards/omap3evm/board.c          |   18 +++++-------------
 arch/arm/boards/panda/board.c             |   19 +++++--------------
 arch/arm/boards/pcm049/board.c            |   21 +++++++--------------
 arch/arm/boards/phycard-a-l1/pca-a-l1.c   |   20 +++++---------------
 arch/arm/boards/phycard-a-xl2/pca-a-xl2.c |   21 +++++++--------------
 7 files changed, 38 insertions(+), 90 deletions(-)

diff --git a/arch/arm/boards/beagle/board.c b/arch/arm/boards/beagle/board.c
index 19bf740..bab11c8 100644
--- a/arch/arm/boards/beagle/board.c
+++ b/arch/arm/boards/beagle/board.c
@@ -62,6 +62,7 @@
 #include <mach/sys_info.h>
 #include <mach/syslib.h>
 #include <mach/control.h>
+#include <mach/devices.h>
 #include <mach/omap3-mux.h>
 #include <mach/gpmc.h>
 #include <mach/gpmc_nand.h>
@@ -235,11 +236,6 @@ pure_initcall(beagle_board_init);
 
 #ifdef CONFIG_DRIVER_SERIAL_NS16550
 
-static struct NS16550_plat serial_plat = {
-	.clock = 48000000,      /* 48MHz (APLL96/2) */
-	.shift = 2,
-};
-
 /**
  * @brief UART serial port initialization - remember to enable COM clocks in
  * arch
@@ -249,8 +245,7 @@ static struct NS16550_plat serial_plat = {
 static int beagle_console_init(void)
 {
 	/* Register the serial port */
-	add_ns16550_device(DEVICE_ID_DYNAMIC, OMAP_UART3_BASE, 1024, IORESOURCE_MEM_8BIT,
-			   &serial_plat);
+	omap_add_ns16550(OMAP_UART3_BASE);
 
 	return 0;
 }
@@ -287,7 +282,7 @@ static struct gpmc_nand_platform_data nand_plat = {
 
 static int beagle_mem_init(void)
 {
-	arm_add_mem_device("ram0", 0x80000000, 128 * 1024 * 1024);
+	omap_add_ram0(SZ_128M);
 
 	return 0;
 }
@@ -296,8 +291,7 @@ mem_initcall(beagle_mem_init);
 static int beagle_devices_init(void)
 {
 	i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
-	add_generic_device("i2c-omap", DEVICE_ID_DYNAMIC, NULL, OMAP_I2C1_BASE, SZ_4K,
-			   IORESOURCE_MEM, NULL);
+	omap_add_i2c(OMAP_I2C1_BASE, NULL);
 
 #ifdef CONFIG_USB_EHCI_OMAP
 	if (ehci_omap_init(&omap_ehci_pdata) >= 0)
@@ -310,8 +304,7 @@ static int beagle_devices_init(void)
 #endif
 	omap_add_gpmc_nand_device(&nand_plat);
 
-	add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL, OMAP_MMC1_BASE, SZ_4K,
-			   IORESOURCE_MEM, NULL);
+	omap_add_mmc(OMAP_MMC1_BASE, NULL);
 
 	armlinux_set_bootparams((void *)0x80000100);
 	armlinux_set_architecture(MACH_TYPE_OMAP3_BEAGLE);
diff --git a/arch/arm/boards/omap343xdsp/board.c b/arch/arm/boards/omap343xdsp/board.c
index 2343dc0..08211c3 100644
--- a/arch/arm/boards/omap343xdsp/board.c
+++ b/arch/arm/boards/omap343xdsp/board.c
@@ -45,11 +45,13 @@
 
 #include <common.h>
 #include <console.h>
+#include <sizes.h>
 #include <init.h>
 #include <driver.h>
 #include <io.h>
 #include <ns16550.h>
 #include <asm/armlinux.h>
+#include <mach/devices.h>
 #include <mach/silicon.h>
 #include <mach/sdrc.h>
 #include <mach/sys_info.h>
@@ -604,11 +606,6 @@ static void mux_config(void)
 
 #ifdef CONFIG_DRIVER_SERIAL_NS16550
 
-static struct NS16550_plat serial_plat = {
-	.clock = 48000000,	/* 48MHz (APLL96/2) */
-	.shift = 2,
-};
-
 /**
  * @brief UART serial port initialization - remember to enable COM clocks in arch
  *
@@ -617,8 +614,7 @@ static struct NS16550_plat serial_plat = {
 static int sdp3430_console_init(void)
 {
 	/* Register the serial port */
-	add_ns16550_device(DEVICE_ID_DYNAMIC, OMAP_UART3_BASE, 1024, IORESOURCE_MEM_8BIT,
-			   &serial_plat);
+	omap_add_ns16550(OMAP_UART3_BASE);
 
 	return 0;
 }
@@ -628,7 +624,7 @@ console_initcall(sdp3430_console_init);
 
 static int sdp3430_mem_init(void)
 {
-	arm_add_mem_device("ram0", 0x80000000, 128 * 1024 * 1024);
+	omap_add_ram0(SZ_128M);
 
 	return 0;
 }
diff --git a/arch/arm/boards/omap3evm/board.c b/arch/arm/boards/omap3evm/board.c
index 7d4a87f..dbaa63c 100644
--- a/arch/arm/boards/omap3evm/board.c
+++ b/arch/arm/boards/omap3evm/board.c
@@ -48,6 +48,7 @@
 #include <sizes.h>
 #include <ns16550.h>
 #include <asm/armlinux.h>
+#include <mach/devices.h>
 #include <mach/silicon.h>
 #include <mach/sdrc.h>
 #include <mach/sys_info.h>
@@ -214,11 +215,6 @@ pure_initcall(omap3_evm_board_init);
 
 #ifdef CONFIG_DRIVER_SERIAL_NS16550
 
-static struct NS16550_plat serial_plat = {
-	.clock		= 48000000,      /* 48MHz (APLL96/2) */
-	.shift		= 2,
-};
-
 /**
  * @brief Initialize the serial port to be used as console.
  *
@@ -226,14 +222,11 @@ static struct NS16550_plat serial_plat = {
  */
 static int omap3evm_init_console(void)
 {
-	add_ns16550_device(DEVICE_ID_DYNAMIC,
 #if defined(CONFIG_OMAP3EVM_UART1)
-			OMAP_UART1_BASE,
+	omap_add_ns16550(OMAP_UART1_BASE);
 #elif defined(CONFIG_OMAP3EVM_UART3)
-			OMAP_UART3_BASE,
+	omap_add_ns16550(OMAP_UART3_BASE);
 #endif
-			1024, IORESOURCE_MEM_8BIT, &serial_plat);
-
 	return 0;
 }
 console_initcall(omap3evm_init_console);
@@ -241,7 +234,7 @@ console_initcall(omap3evm_init_console);
 
 static int omap3evm_mem_init(void)
 {
-	arm_add_mem_device("ram0", 0x80000000, 128 * 1024 * 1024);
+	omap_add_ram0(SZ_128M);
 
 	return 0;
 }
@@ -256,8 +249,7 @@ static int omap3evm_init_devices(void)
 	gpmc_generic_init(0x10);
 #endif
 #ifdef CONFIG_MCI_OMAP_HSMMC
-	add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL, OMAP_MMC1_BASE, SZ_4K,
-				IORESOURCE_MEM, NULL);
+	omap_add_mmc(OMAP_MMC1_BASE, NULL);
 #endif
         armlinux_set_bootparams((void *)0x80000100);
         armlinux_set_architecture(MACH_TYPE_OMAP3EVM);
diff --git a/arch/arm/boards/panda/board.c b/arch/arm/boards/panda/board.c
index 98c05b2..7f3f430 100644
--- a/arch/arm/boards/panda/board.c
+++ b/arch/arm/boards/panda/board.c
@@ -19,6 +19,7 @@
 #include <asm/mmu.h>
 #include <mach/gpio.h>
 #include <environment.h>
+#include <mach/devices.h>
 #include <mach/xload.h>
 #include <i2c/i2c.h>
 #include <gpio.h>
@@ -33,16 +34,10 @@ static int board_revision;
 #define GPIO_BOARD_ID1 101
 #define GPIO_BOARD_ID2 171
 
-static struct NS16550_plat serial_plat = {
-	.clock = 48000000,      /* 48MHz (APLL96/2) */
-	.shift = 2,
-};
-
 static int panda_console_init(void)
 {
 	/* Register the serial port */
-	add_ns16550_device(DEVICE_ID_DYNAMIC, OMAP44XX_UART3_BASE, 1024,
-			IORESOURCE_MEM_8BIT, &serial_plat);
+	omap_add_ns16550(OMAP44XX_UART3_BASE);
 
 	return 0;
 }
@@ -50,7 +45,7 @@ console_initcall(panda_console_init);
 
 static int panda_mem_init(void)
 {
-	arm_add_mem_device("ram0", 0x80000000, SZ_1G);
+	omap_add_ram0(SZ_1G);
 
 	return 0;
 }
@@ -160,13 +155,9 @@ static int panda_devices_init(void)
 	}
 
 	i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
-	add_generic_device("i2c-omap", DEVICE_ID_DYNAMIC,
-				NULL, 0x48070000, 0x1000,
-				IORESOURCE_MEM, NULL);
-
+	omap_add_i2c(0x48070000, NULL);
 
-	add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL, 0x4809C100, SZ_4K,
-			   IORESOURCE_MEM, NULL);
+	omap_add_mmc(0x4809C100, NULL);
 	panda_ehci_init();
 
 	panda_led_init();
diff --git a/arch/arm/boards/pcm049/board.c b/arch/arm/boards/pcm049/board.c
index 3159457..aa20ff1 100644
--- a/arch/arm/boards/pcm049/board.c
+++ b/arch/arm/boards/pcm049/board.c
@@ -32,22 +32,17 @@
 #include <partition.h>
 #include <nand.h>
 #include <asm/mmu.h>
+#include <mach/devices.h>
 #include <mach/gpio.h>
 #include <mach/gpmc.h>
 #include <mach/gpmc_nand.h>
 #include <mach/xload.h>
 #include <i2c/i2c.h>
 
-static struct NS16550_plat serial_plat = {
-	.clock = 48000000,      /* 48MHz (APLL96/2) */
-	.shift = 2,
-};
-
 static int pcm049_console_init(void)
 {
 	/* Register the serial port */
-	add_ns16550_device(DEVICE_ID_DYNAMIC, OMAP44XX_UART3_BASE, 1024,
-			IORESOURCE_MEM_8BIT, &serial_plat);
+	omap_add_ns16550(OMAP44XX_UART3_BASE);
 
 	return 0;
 }
@@ -55,10 +50,10 @@ console_initcall(pcm049_console_init);
 
 static int pcm049_mem_init(void)
 {
-	arm_add_mem_device("ram0", 0x80000000, SZ_512M);
+	omap_add_ram0(SZ_512M);
+
+	omap_add_sram0(0x40300000, 48 * SZ_1K);
 
-	add_mem_device("sram0", 0x40300000, 48 * 1024,
-				   IORESOURCE_MEM_WRITEABLE);
 	return 0;
 }
 mem_initcall(pcm049_mem_init);
@@ -99,11 +94,9 @@ static struct gpmc_nand_platform_data nand_plat = {
 static int pcm049_devices_init(void)
 {
 	i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
-	add_generic_device("i2c-omap", DEVICE_ID_DYNAMIC, NULL, 0x48070000, 0x1000,
-				IORESOURCE_MEM, NULL);
+	omap_add_i2c(0x48070000, NULL);
 
-	add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL, 0x4809C100, SZ_4K,
-			   IORESOURCE_MEM, NULL);
+	omap_add_mmc(0x4809C100, NULL);
 
 	gpmc_generic_init(0x10);
 
diff --git a/arch/arm/boards/phycard-a-l1/pca-a-l1.c b/arch/arm/boards/phycard-a-l1/pca-a-l1.c
index f2d10f2..a934057 100644
--- a/arch/arm/boards/phycard-a-l1/pca-a-l1.c
+++ b/arch/arm/boards/phycard-a-l1/pca-a-l1.c
@@ -57,6 +57,7 @@
 #include <generated/mach-types.h>
 #include <linux/err.h>
 #include <mach/control.h>
+#include <mach/devices.h>
 #include <mach/gpmc.h>
 #include <mach/gpmc_nand.h>
 #include <mach/omap_hsmmc.h>
@@ -308,14 +309,6 @@ static int pcaal1_board_init(void)
 }
 pure_initcall(pcaal1_board_init);
 
-/*
- * Run-time initialization(s)
- */
-static struct NS16550_plat serial_plat = {
-	.clock	= 48000000,      /* 48MHz (APLL96/2) */
-	.shift	= 2,
-};
-
 /**
  * @brief Initialize the serial port to be used as console.
  *
@@ -323,8 +316,7 @@ static struct NS16550_plat serial_plat = {
  */
 static int pcaal1_init_console(void)
 {
-	add_ns16550_device(DEVICE_ID_DYNAMIC, OMAP_UART3_BASE, 1024, IORESOURCE_MEM_8BIT,
-			   &serial_plat);
+	omap_add_ns16550(OMAP_UART3_BASE);
 
 	return 0;
 }
@@ -366,10 +358,9 @@ static int pcaal1_mem_init(void)
 	 */
 	gpmc_generic_init(0x10);
 #endif
-	add_mem_device("sram0", OMAP_SRAM_BASE, 60 * SZ_1K,
-				   IORESOURCE_MEM_WRITEABLE);
+	omap_add_sram0(OMAP_SRAM_BASE, 60 * SZ_1K);
 
-	arm_add_mem_device("ram0", OMAP_SDRC_CS0, get_sdr_cs_size(SDRC_CS0_OSET));
+	omap_add_ram0(get_sdr_cs_size(SDRC_CS0_OSET));
 	printf("found %s at SDCS0\n", size_human_readable(get_sdr_cs_size(SDRC_CS0_OSET)));
 
 	if ((get_sdr_cs_size(SDRC_CS1_OSET) != 0) && (get_sdr_cs1_base() != OMAP_SDRC_CS0)) {
@@ -398,8 +389,7 @@ static int pcaal1_init_devices(void)
 	omap_add_gpmc_nand_device(&nand_plat);
 
 #ifdef CONFIG_MCI_OMAP_HSMMC
-	add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL, OMAP_MMC1_BASE, SZ_4K,
-			   IORESOURCE_MEM, &pcaal1_hsmmc_plat);
+	omap_add_mmc(OMAP_MMC1_BASE, &pcaal1_hsmmc_plat);
 #endif
 
 #ifdef CONFIG_DRIVER_NET_SMC911X
diff --git a/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c b/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c
index 64e6d94..12d118b 100644
--- a/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c
+++ b/arch/arm/boards/phycard-a-xl2/pca-a-xl2.c
@@ -32,6 +32,7 @@
 #include <partition.h>
 #include <nand.h>
 #include <asm/mmu.h>
+#include <mach/devices.h>
 #include <mach/gpio.h>
 #include <mach/gpmc.h>
 #include <mach/gpmc_nand.h>
@@ -39,16 +40,10 @@
 #include <mach/omap_hsmmc.h>
 #include <i2c/i2c.h>
 
-static struct NS16550_plat serial_plat = {
-	.clock = 48000000,      /* 48MHz (APLL96/2) */
-	.shift = 2,
-};
-
 static int pcaaxl2_console_init(void)
 {
 	/* Register the serial port */
-	add_ns16550_device(DEVICE_ID_DYNAMIC, OMAP44XX_UART3_BASE, 1024,
-		IORESOURCE_MEM_8BIT, &serial_plat);
+	omap_add_ns16550(OMAP44XX_UART3_BASE);
 
 	return 0;
 }
@@ -56,10 +51,10 @@ console_initcall(pcaaxl2_console_init);
 
 static int pcaaxl2_mem_init(void)
 {
-	arm_add_mem_device("ram0", 0x80000000, SZ_512M);
+	omap_add_ram0(SZ_512M);
+
+	omap_add_sram0(0x40300000, 48 * SZ_1K);
 
-	add_mem_device("sram0", 0x40300000, 48 * 1024,
-				   IORESOURCE_MEM_WRITEABLE);
 	return 0;
 }
 mem_initcall(pcaaxl2_mem_init);
@@ -111,16 +106,14 @@ static int pcaaxl2_devices_init(void)
 	u32 value;
 
 	i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
-	add_generic_device("i2c-omap", DEVICE_ID_DYNAMIC, NULL, 0x48070000, 0x1000,
-				IORESOURCE_MEM, NULL);
+	omap_add_i2c(0x48070000, NULL);
 
 	value = readl(OMAP4_CONTROL_PBIASLITE);
 	value &= ~OMAP4_MMC1_PBIASLITE_VMODE;
 	value |= (OMAP4_MMC1_PBIASLITE_PWRDNZ |	OMAP4_MMC1_PWRDNZ);
 	writel(value, OMAP4_CONTROL_PBIASLITE);
 
-	add_generic_device("omap-hsmmc", DEVICE_ID_DYNAMIC, NULL, 0x4809C100, SZ_4K,
-			   IORESOURCE_MEM, &mmc_device);
+	omap_add_mmc(0x4809C100, &mmc_device);
 
 	gpmc_generic_init(0x10);
 
-- 
1.7.0.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] ARM OMAP: Use wrapper in board files
  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
  0 siblings, 0 replies; 6+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-10-11 12:44 UTC (permalink / raw)
  To: Teresa Gámez; +Cc: barebox

On 09:25 Thu 11 Oct     , Teresa Gámez wrote:
> Use the omap wrappers in board files instead of add_generic_device().
> Compile tested every affected board. Tested on pcm049.
> 
> Signed-off-by: Teresa Gámez <t.gamez@phytec.de>
> ---
>  arch/arm/boards/beagle/board.c            |   17 +++++------------
>  arch/arm/boards/omap343xdsp/board.c       |   12 ++++--------
>  arch/arm/boards/omap3evm/board.c          |   18 +++++-------------
>  arch/arm/boards/panda/board.c             |   19 +++++--------------
>  arch/arm/boards/pcm049/board.c            |   21 +++++++--------------
>  arch/arm/boards/phycard-a-l1/pca-a-l1.c   |   20 +++++---------------
>  arch/arm/boards/phycard-a-xl2/pca-a-xl2.c |   21 +++++++--------------
>  7 files changed, 38 insertions(+), 90 deletions(-)
> 
> diff --git a/arch/arm/boards/beagle/board.c b/arch/arm/boards/beagle/board.c
> index 19bf740..bab11c8 100644
> --- a/arch/arm/boards/beagle/board.c
> +++ b/arch/arm/boards/beagle/board.c
> @@ -62,6 +62,7 @@
>  #include <mach/sys_info.h>
>  #include <mach/syslib.h>
>  #include <mach/control.h>
> +#include <mach/devices.h>
>  #include <mach/omap3-mux.h>
>  #include <mach/gpmc.h>
>  #include <mach/gpmc_nand.h>
> @@ -235,11 +236,6 @@ pure_initcall(beagle_board_init);
>  
>  #ifdef CONFIG_DRIVER_SERIAL_NS16550
>  
> -static struct NS16550_plat serial_plat = {
> -	.clock = 48000000,      /* 48MHz (APLL96/2) */
> -	.shift = 2,
> -};
> -
>  /**
>   * @brief UART serial port initialization - remember to enable COM clocks in
>   * arch
> @@ -249,8 +245,7 @@ static struct NS16550_plat serial_plat = {
>  static int beagle_console_init(void)
>  {
>  	/* Register the serial port */
> -	add_ns16550_device(DEVICE_ID_DYNAMIC, OMAP_UART3_BASE, 1024, IORESOURCE_MEM_8BIT,
> -			   &serial_plat);
> +	omap_add_ns16550(OMAP_UART3_BASE);
do not even provide the base at board level
>  
>  	return 0;
>  }
> @@ -287,7 +282,7 @@ static struct gpmc_nand_platform_data nand_plat = {
>  
>  static int beagle_mem_init(void)
>  {
> -	arm_add_mem_device("ram0", 0x80000000, 128 * 1024 * 1024);
> +	omap_add_ram0(SZ_128M);
>  
>  	return 0;
>  }
> @@ -296,8 +291,7 @@ mem_initcall(beagle_mem_init);
>  static int beagle_devices_init(void)
>  {
>  	i2c_register_board_info(0, i2c_devices, ARRAY_SIZE(i2c_devices));
> -	add_generic_device("i2c-omap", DEVICE_ID_DYNAMIC, NULL, OMAP_I2C1_BASE, SZ_4K,
> -			   IORESOURCE_MEM, NULL);
> +	omap_add_i2c(OMAP_I2C1_BASE, NULL);
ditoo and etc..

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] ARM OMAP: Create device file
  2012-10-11  7:25 [PATCH 1/2] ARM OMAP: Create device file Teresa Gámez
  2012-10-11  7:25 ` [PATCH 2/2] ARM OMAP: Use wrapper in board files Teresa Gámez
@ 2012-10-12  7:58 ` Sascha Hauer
  2012-10-12  9:30   ` Teresa Gamez
  1 sibling, 1 reply; 6+ messages in thread
From: Sascha Hauer @ 2012-10-12  7:58 UTC (permalink / raw)
  To: Teresa Gámez; +Cc: barebox

Hi Teresa,

On Thu, Oct 11, 2012 at 09:25:34AM +0200, Teresa Gámez wrote:
> Created wrapper to add omap devices.
> 
> Signed-off-by: Teresa Gámez <t.gamez@phytec.de>
> ---
> +
> +struct device_d *omap_add_mmc(resource_size_t base, void *pdata)
> +{
> +	return omap_add_device("omap-hsmmc", base, SZ_4K, pdata);
> +}

Nice work. As Jean Christophe already mentioned, it would be nice to
skip the base address. That would mean to have a omap_add_mmc() function
like above in an omap generic place and then:

static inline struct device_d omap<x>_add_mmc<y>(void *pdata)
{
	omap_add_mmc(OMAPx_MMCy_BASE, pdata);
}

in omap3/4 specific include files.

Let me know if you want to work on this, otherwise I'm also happy to
apply this one as it's already a step forward.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] ARM OMAP: Create device file
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Teresa Gamez @ 2012-10-12  9:30 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Am 12.10.2012 09:58, schrieb Sascha Hauer:

Hello Sascha,

> Nice work. As Jean Christophe already mentioned, it would be nice to
> skip the base address. That would mean to have a omap_add_mmc() function
> like above in an omap generic place and then:
>
> static inline struct device_d omap<x>_add_mmc<y>(void *pdata)
> {
> 	omap_add_mmc(OMAPx_MMCy_BASE, pdata);
> }
>
> in omap3/4 specific include files.
>
> Let me know if you want to work on this, otherwise I'm also happy to
> apply this one as it's already a step forward.
I will change it as you suggested.
I would base my rework on next so I can apply the changes also on the 
archosg9 board.

Teresa

>
> Sascha
>
>


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] ARM OMAP: Create device file
  2012-10-12  9:30   ` Teresa Gamez
@ 2012-10-13 12:10     ` Sascha Hauer
  0 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2012-10-13 12:10 UTC (permalink / raw)
  To: Teresa Gamez; +Cc: barebox

On Fri, Oct 12, 2012 at 11:30:40AM +0200, Teresa Gamez wrote:
> Am 12.10.2012 09:58, schrieb Sascha Hauer:
> 
> Hello Sascha,
> 
> >Nice work. As Jean Christophe already mentioned, it would be nice to
> >skip the base address. That would mean to have a omap_add_mmc() function
> >like above in an omap generic place and then:
> >
> >static inline struct device_d omap<x>_add_mmc<y>(void *pdata)
> >{
> >	omap_add_mmc(OMAPx_MMCy_BASE, pdata);
> >}
> >
> >in omap3/4 specific include files.
> >
> >Let me know if you want to work on this, otherwise I'm also happy to
> >apply this one as it's already a step forward.
> I will change it as you suggested.
> I would base my rework on next so I can apply the changes also on
> the archosg9 board.

Ok, thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-10-13 12:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-11  7:25 [PATCH 1/2] ARM OMAP: Create device file Teresa Gámez
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox