Created wrapper to add omap devices. Signed-off-by: Teresa Gámez <t.gamez@xxxxxxxxx> --- 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@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox