diff options
Diffstat (limited to 'arch/arm')
45 files changed, 245 insertions, 190 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 8278c82e3a..7ccc8f309b 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -42,6 +42,7 @@ config ARCH_IMX select GPIOLIB select COMMON_CLK select CLKDEV_LOOKUP + select WATCHDOG_IMX_RESET_SOURCE config ARCH_MXS bool "Freescale i.MX23/28 (mxs) based" @@ -71,14 +72,12 @@ config ARCH_S3C24xx select ARCH_SAMSUNG select CPU_ARM920T select GENERIC_GPIO -# -# Currently no board support -# -#config ARCH_S5PCxx -# bool "Samsung S5PC110, S5PV210" -# select ARCH_SAMSUNG -# select CPU_V7 -# select GENERIC_GPIO + +config ARCH_S5PCxx + bool "Samsung S5PC110, S5PV210" + select ARCH_SAMSUNG + select CPU_V7 + select GENERIC_GPIO config ARCH_S3C64xx bool "Samsung S3C64xx" diff --git a/arch/arm/boards/a9m2440/lowlevel_init.S b/arch/arm/boards/a9m2440/lowlevel_init.S index da29efdc21..8f6cfcbe68 100644 --- a/arch/arm/boards/a9m2440/lowlevel_init.S +++ b/arch/arm/boards/a9m2440/lowlevel_init.S @@ -225,7 +225,7 @@ reset: cmp pc, #S3C_SDRAM_END bhs 1f - mov pc, r10 + b board_init_lowlevel_return /* we are running from NOR or NAND/SRAM memory. Do further initialisation */ 1: diff --git a/arch/arm/boards/freescale-mx28-evk/mx28-evk.c b/arch/arm/boards/freescale-mx28-evk/mx28-evk.c index 7cd61f9e96..5bcb24cf45 100644 --- a/arch/arm/boards/freescale-mx28-evk/mx28-evk.c +++ b/arch/arm/boards/freescale-mx28-evk/mx28-evk.c @@ -236,7 +236,7 @@ static int mx28_evk_devices_init(void) imx_enable_enetclk(); mx28_evk_fec_reset(); - add_generic_device("fec_imx", 0, NULL, IMX_FEC0_BASE, 0x4000, + add_generic_device("imx28-fec", 0, NULL, IMX_FEC0_BASE, 0x4000, IORESOURCE_MEM, &fec_info); return 0; diff --git a/arch/arm/boards/friendlyarm-tiny210/lowlevel.c b/arch/arm/boards/friendlyarm-tiny210/lowlevel.c index 791918a874..695f97d7e8 100644 --- a/arch/arm/boards/friendlyarm-tiny210/lowlevel.c +++ b/arch/arm/boards/friendlyarm-tiny210/lowlevel.c @@ -61,7 +61,7 @@ void __bare_init reset(void) #endif if (get_pc() < 0xD0000000) /* Are we running from iRAM? */ - return; /* No, we don't. */ + board_init_lowlevel_return(); /* No, we don't. */ s5p_init_dram_bank_ddr2(S5P_DMC0_BASE, 0x20E00323, 0, 0); diff --git a/arch/arm/boards/karo-tx28/tx28-stk5.c b/arch/arm/boards/karo-tx28/tx28-stk5.c index 961787669b..766e77b247 100644 --- a/arch/arm/boards/karo-tx28/tx28-stk5.c +++ b/arch/arm/boards/karo-tx28/tx28-stk5.c @@ -393,7 +393,7 @@ void base_board_init(void) tx28_get_ethaddr(); imx_enable_enetclk(); - add_generic_device("fec_imx", 0, NULL, IMX_FEC0_BASE, 0x4000, + add_generic_device("imx28-fec", 0, NULL, IMX_FEC0_BASE, 0x4000, IORESOURCE_MEM, &fec_info); ret = register_persistent_environment(); diff --git a/arch/arm/boards/panda/lowlevel.c b/arch/arm/boards/panda/lowlevel.c index 3a241489be..33d06be29a 100644 --- a/arch/arm/boards/panda/lowlevel.c +++ b/arch/arm/boards/panda/lowlevel.c @@ -81,7 +81,7 @@ void reset(void) common_reset(); if (get_pc() > 0x80000000) - return; + board_init_lowlevel_return(); r = 0x4030d000; __asm__ __volatile__("mov sp, %0" : : "r"(r)); diff --git a/arch/arm/boards/pcm049/lowlevel.c b/arch/arm/boards/pcm049/lowlevel.c index 20e40c5b89..c3fc6c7e1f 100644 --- a/arch/arm/boards/pcm049/lowlevel.c +++ b/arch/arm/boards/pcm049/lowlevel.c @@ -91,7 +91,7 @@ void reset(void) common_reset(); if (get_pc() > 0x80000000) - return; + board_init_lowlevel_return(); r = 0x4030d000; __asm__ __volatile__("mov sp, %0" : : "r"(r)); diff --git a/arch/arm/boards/phycard-a-xl2/lowlevel.c b/arch/arm/boards/phycard-a-xl2/lowlevel.c index d47234757a..24b4ab8ea5 100644 --- a/arch/arm/boards/phycard-a-xl2/lowlevel.c +++ b/arch/arm/boards/phycard-a-xl2/lowlevel.c @@ -91,7 +91,7 @@ void reset(void) common_reset(); if (get_pc() > 0x80000000) - return; + board_init_lowlevel_return(); r = 0x4030d000; __asm__ __volatile__("mov sp, %0" : : "r"(r)); diff --git a/arch/arm/cpu/Kconfig b/arch/arm/cpu/Kconfig index f55e8626a8..2ed678961d 100644 --- a/arch/arm/cpu/Kconfig +++ b/arch/arm/cpu/Kconfig @@ -17,7 +17,7 @@ config CPU_ARM920T and is used in the Maverick EP9312 and the Samsung S3C2410. More information on the Maverick EP9312 at - <http://linuxdevices.com/products/PD2382866068.html>. + <http://www.cirrus.com/en/products/ep9312.html>. Say Y if you want support for the ARM920T processor. Otherwise, say N. diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index c5b76ea979..288c0b24a8 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -269,8 +269,9 @@ static int do_bootz_linux(struct image_data *data) ret = do_bootz_linux_fdt(fd, data); if (ret && ret != -ENXIO) - return ret; + goto err_out; + close(fd); return __do_bootm_linux(data, swap); err_out: @@ -431,6 +432,7 @@ static int do_bootm_aimage(struct image_data *data) reset_cpu(0); } + close(fd); return __do_bootm_linux(data, 0); err_out: diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index 54703f319f..67f3a8cc03 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -1,5 +1,4 @@ obj-y += clocksource.o gpio.o -obj-$(CONFIG_RESET_SOURCE) += reset_source.o obj-$(CONFIG_ARCH_IMX1) += imx1.o iomux-v1.o clk-imx1.o obj-$(CONFIG_ARCH_IMX25) += imx25.o iomux-v3.o clk-imx25.o obj-$(CONFIG_ARCH_IMX21) += imx21.o iomux-v1.o clk-imx21.o diff --git a/arch/arm/mach-imx/clk-imx1.c b/arch/arm/mach-imx/clk-imx1.c index 45e9c6643f..0d04a92f36 100644 --- a/arch/arm/mach-imx/clk-imx1.c +++ b/arch/arm/mach-imx/clk-imx1.c @@ -96,9 +96,18 @@ static int imx1_ccm_probe(struct device_d *dev) return 0; } +static __maybe_unused struct of_device_id imx1_ccm_dt_ids[] = { + { + .compatible = "fsl,imx1-ccm", + }, { + /* sentinel */ + } +}; + static struct driver_d imx1_ccm_driver = { .probe = imx1_ccm_probe, .name = "imx1-ccm", + .of_compatible = DRV_OF_COMPAT(imx1_ccm_dt_ids), }; static int imx1_ccm_init(void) diff --git a/arch/arm/mach-imx/clk-imx21.c b/arch/arm/mach-imx/clk-imx21.c index 69aaa9e6ad..a7c5732260 100644 --- a/arch/arm/mach-imx/clk-imx21.c +++ b/arch/arm/mach-imx/clk-imx21.c @@ -107,9 +107,18 @@ static int imx21_ccm_probe(struct device_d *dev) return 0; } +static __maybe_unused struct of_device_id imx21_ccm_dt_ids[] = { + { + .compatible = "fsl,imx21-ccm", + }, { + /* sentinel */ + } +}; + static struct driver_d imx21_ccm_driver = { .probe = imx21_ccm_probe, .name = "imx21-ccm", + .of_compatible = DRV_OF_COMPAT(imx21_ccm_dt_ids), }; static int imx21_ccm_init(void) diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c index 3b9588ced5..17e54494dd 100644 --- a/arch/arm/mach-imx/clk-imx25.c +++ b/arch/arm/mach-imx/clk-imx25.c @@ -76,9 +76,19 @@ static int imx25_ccm_probe(struct device_d *dev) base = dev_request_mem_region(dev, 0); - writel(0x10e88578, base + CCM_CGCR0); - writel(0x0478e1e0, base + CCM_CGCR0); - writel(0x0007c400, base + CCM_CGCR0); + writel((1 << 3) | (1 << 4) | (1 << 5) | (1 << 6) | (1 << 8) | (1 << 9) | + (1 << 10) | (1 << 15) | (1 << 19) | (1 << 21) | (1 << 22) | + (1 << 23) | (1 << 24) | (1 << 28), + base + CCM_CGCR0); + + writel((1 << 5) | (1 << 6) | (1 << 7) | (1 << 8) | (1 << 13) | (1 << 14) | + (1 << 15) | (1 << 19) | (1 << 20) | (1 << 21) | (1 << 22) | + (1 << 26) | (1 << 29) | (1 << 31), + base + CCM_CGCR1); + + writel((1 << 0) | (1 << 1) | (1 << 2) | (1 << 10) | (1 << 13) | (1 << 14) | + (1 << 15) | (1 << 16) | (1 << 17) | (1 << 18), + base + CCM_CGCR2); clks[dummy] = clk_fixed("dummy", 0); clks[osc] = clk_fixed("osc", 24000000); @@ -142,9 +152,18 @@ static int imx25_ccm_probe(struct device_d *dev) return 0; } +static __maybe_unused struct of_device_id imx25_ccm_dt_ids[] = { + { + .compatible = "fsl,imx25-ccm", + }, { + /* sentinel */ + } +}; + static struct driver_d imx25_ccm_driver = { .probe = imx25_ccm_probe, .name = "imx25-ccm", + .of_compatible = DRV_OF_COMPAT(imx25_ccm_dt_ids), }; static int imx25_ccm_init(void) diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c index e4062289bc..df444da19d 100644 --- a/arch/arm/mach-imx/clk-imx27.c +++ b/arch/arm/mach-imx/clk-imx27.c @@ -143,9 +143,18 @@ static int imx27_ccm_probe(struct device_d *dev) return 0; } +static __maybe_unused struct of_device_id imx27_ccm_dt_ids[] = { + { + .compatible = "fsl,imx27-ccm", + }, { + /* sentinel */ + } +}; + static struct driver_d imx27_ccm_driver = { .probe = imx27_ccm_probe, .name = "imx27-ccm", + .of_compatible = DRV_OF_COMPAT(imx27_ccm_dt_ids), }; static int imx27_ccm_init(void) diff --git a/arch/arm/mach-imx/clk-imx31.c b/arch/arm/mach-imx/clk-imx31.c index cf8963a326..aa1b652ddd 100644 --- a/arch/arm/mach-imx/clk-imx31.c +++ b/arch/arm/mach-imx/clk-imx31.c @@ -121,9 +121,18 @@ static int imx31_ccm_probe(struct device_d *dev) return 0; } +static __maybe_unused struct of_device_id imx31_ccm_dt_ids[] = { + { + .compatible = "fsl,imx31-ccm", + }, { + /* sentinel */ + } +}; + static struct driver_d imx31_ccm_driver = { .probe = imx31_ccm_probe, .name = "imx31-ccm", + .of_compatible = DRV_OF_COMPAT(imx31_ccm_dt_ids), }; static int imx31_ccm_init(void) diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c index dfa75614fa..5b5a9e7882 100644 --- a/arch/arm/mach-imx/clk-imx35.c +++ b/arch/arm/mach-imx/clk-imx35.c @@ -174,9 +174,18 @@ static int imx35_ccm_probe(struct device_d *dev) return 0; } +static __maybe_unused struct of_device_id imx35_ccm_dt_ids[] = { + { + .compatible = "fsl,imx35-ccm", + }, { + /* sentinel */ + } +}; + static struct driver_d imx35_ccm_driver = { .probe = imx35_ccm_probe, .name = "imx35-ccm", + .of_compatible = DRV_OF_COMPAT(imx35_ccm_dt_ids), }; static int imx35_ccm_init(void) diff --git a/arch/arm/mach-imx/clk-imx5.c b/arch/arm/mach-imx/clk-imx5.c index 365fcb3338..03a18435c6 100644 --- a/arch/arm/mach-imx/clk-imx5.c +++ b/arch/arm/mach-imx/clk-imx5.c @@ -233,9 +233,18 @@ static int imx51_ccm_probe(struct device_d *dev) return 0; } +static __maybe_unused struct of_device_id imx51_ccm_dt_ids[] = { + { + .compatible = "fsl,imx51-ccm", + }, { + /* sentinel */ + } +}; + static struct driver_d imx51_ccm_driver = { .probe = imx51_ccm_probe, .name = "imx51-ccm", + .of_compatible = DRV_OF_COMPAT(imx51_ccm_dt_ids), }; static int imx51_ccm_init(void) @@ -285,9 +294,18 @@ static int imx53_ccm_probe(struct device_d *dev) return 0; } +static __maybe_unused struct of_device_id imx53_ccm_dt_ids[] = { + { + .compatible = "fsl,imx53-ccm", + }, { + /* sentinel */ + } +}; + static struct driver_d imx53_ccm_driver = { .probe = imx53_ccm_probe, .name = "imx53-ccm", + .of_compatible = DRV_OF_COMPAT(imx53_ccm_dt_ids), }; static int imx53_ccm_init(void) diff --git a/arch/arm/mach-imx/clk-imx6.c b/arch/arm/mach-imx/clk-imx6.c index 19a8bc6836..a1da47a959 100644 --- a/arch/arm/mach-imx/clk-imx6.c +++ b/arch/arm/mach-imx/clk-imx6.c @@ -294,9 +294,18 @@ static int imx6_ccm_probe(struct device_d *dev) return 0; } +static __maybe_unused struct of_device_id imx6_ccm_dt_ids[] = { + { + .compatible = "fsl,imx6-ccm", + }, { + /* sentinel */ + } +}; + static struct driver_d imx6_ccm_driver = { .probe = imx6_ccm_probe, .name = "imx6-ccm", + .of_compatible = DRV_OF_COMPAT(imx6_ccm_dt_ids), }; static int imx6_ccm_init(void) diff --git a/arch/arm/mach-imx/clocksource.c b/arch/arm/mach-imx/clocksource.c index 69a688c09d..e482fad624 100644 --- a/arch/arm/mach-imx/clocksource.c +++ b/arch/arm/mach-imx/clocksource.c @@ -179,40 +179,3 @@ static int imx_gpt_init(void) return platform_driver_register(&imx_gpt_driver); } coredevice_initcall(imx_gpt_init); - -/* - * Watchdog Registers - */ -#ifdef CONFIG_ARCH_IMX1 -#define WDOG_WCR 0x00 /* Watchdog Control Register */ -#define WDOG_WSR 0x04 /* Watchdog Service Register */ -#define WDOG_WSTR 0x08 /* Watchdog Status Register */ -#define WDOG_WCR_WDE (1 << 0) -#else -#define WDOG_WCR 0x00 /* Watchdog Control Register */ -#define WDOG_WSR 0x02 /* Watchdog Service Register */ -#define WDOG_WSTR 0x04 /* Watchdog Status Register */ -#define WDOG_WCR_WDE (1 << 2) -#endif - -/* - * Reset the cpu by setting up the watchdog timer and let it time out - */ -void __noreturn reset_cpu (unsigned long addr) -{ - void __iomem *wdt = IOMEM(IMX_WDT_BASE); - - /* Disable watchdog and set Time-Out field to 0 */ - writew(0x0, wdt + WDOG_WCR); - - /* Write Service Sequence */ - writew(0x5555, wdt + WDOG_WSR); - writew(0xaaaa, wdt + WDOG_WSR); - - /* Enable watchdog */ - writew(WDOG_WCR_WDE, wdt + WDOG_WCR); - - while (1); - /*NOTREACHED*/ -} -EXPORT_SYMBOL(reset_cpu); diff --git a/arch/arm/mach-imx/devices.c b/arch/arm/mach-imx/devices.c index 9fde84f1a1..4ee4e6cc8d 100644 --- a/arch/arm/mach-imx/devices.c +++ b/arch/arm/mach-imx/devices.c @@ -8,9 +8,14 @@ static inline struct device_d *imx_add_device(char *name, int id, void *base, in IORESOURCE_MEM, pdata); } -struct device_d *imx_add_fec(void *base, struct fec_platform_data *pdata) +struct device_d *imx_add_fec_imx27(void *base, struct fec_platform_data *pdata) { - return imx_add_device("fec_imx", -1, base, 0x1000, pdata); + return imx_add_device("imx27-fec", -1, base, 0x1000, pdata); +} + +struct device_d *imx_add_fec_imx6(void *base, struct fec_platform_data *pdata) +{ + return imx_add_device("imx6-fec", -1, base, 0x1000, pdata); } struct device_d *imx_add_spi(void *base, int id, struct spi_imx_master *pdata) @@ -23,9 +28,14 @@ struct device_d *imx_add_i2c(void *base, int id, struct i2c_platform_data *pdata return imx_add_device("i2c-fsl", id, base, 0x1000, pdata); } -struct device_d *imx_add_uart(void *base, int id) +struct device_d *imx_add_uart_imx1(void *base, int id) +{ + return imx_add_device("imx1-uart", id, base, 0x1000, NULL); +} + +struct device_d *imx_add_uart_imx21(void *base, int id) { - return imx_add_device("imx_serial", id, base, 0x1000, NULL); + return imx_add_device("imx21-uart", id, base, 0x1000, NULL); } struct device_d *imx_add_nand(void *base, struct imx_nand_platform_data *pdata) diff --git a/arch/arm/mach-imx/gpio.c b/arch/arm/mach-imx/gpio.c index 6c88948da0..cd7655a5d1 100644 --- a/arch/arm/mach-imx/gpio.c +++ b/arch/arm/mach-imx/gpio.c @@ -137,6 +137,7 @@ static int imx_gpio_probe(struct device_d *dev) imxgpio->chip.base = of_alias_get_id(dev->device_node, "gpio"); if (imxgpio->chip.base < 0) return imxgpio->chip.base; + imxgpio->chip.base *= 32; } else { imxgpio->chip.base = dev->id * 32; } diff --git a/arch/arm/mach-imx/imx1.c b/arch/arm/mach-imx/imx1.c index 747ec09f01..966a8c2847 100644 --- a/arch/arm/mach-imx/imx1.c +++ b/arch/arm/mach-imx/imx1.c @@ -17,6 +17,31 @@ #include <mach/imx-regs.h> #include <mach/weim.h> #include <mach/iomux-v1.h> +#include <reset_source.h> + +#define MX1_RSR MX1_SCM_BASE_ADDR +#define RSR_EXR (1 << 0) +#define RSR_WDR (1 << 1) + +static void imx1_detect_reset_source(void) +{ + u32 val = readl((void *)MX1_RSR) & 0x3; + + switch (val) { + case RSR_EXR: + set_reset_source(RESET_RST); + return; + case RSR_WDR: + set_reset_source(RESET_WDG); + return; + case 0: + set_reset_source(RESET_POR); + return; + default: + /* else keep the default 'unknown' state */ + return; + } +} void imx1_setup_eimcs(size_t cs, unsigned upper, unsigned lower) { @@ -27,6 +52,7 @@ void imx1_setup_eimcs(size_t cs, unsigned upper, unsigned lower) static int imx1_init(void) { imx_iomuxv1_init((void *)MX1_GPIO1_BASE_ADDR); + imx1_detect_reset_source(); add_generic_device("imx1-ccm", 0, NULL, MX1_CCM_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL); add_generic_device("imx1-gpt", 0, NULL, MX1_TIM1_BASE_ADDR, 0x100, IORESOURCE_MEM, NULL); @@ -34,6 +60,7 @@ static int imx1_init(void) add_generic_device("imx1-gpio", 1, NULL, MX1_GPIO2_BASE_ADDR, 0x100, IORESOURCE_MEM, NULL); add_generic_device("imx1-gpio", 2, NULL, MX1_GPIO3_BASE_ADDR, 0x100, IORESOURCE_MEM, NULL); add_generic_device("imx1-gpio", 3, NULL, MX1_GPIO4_BASE_ADDR, 0x100, IORESOURCE_MEM, NULL); + add_generic_device("imx1-wdt", 0, NULL, MX1_WDT_BASE_ADDR, 0x100, IORESOURCE_MEM, NULL); return 0; } diff --git a/arch/arm/mach-imx/imx21.c b/arch/arm/mach-imx/imx21.c index 55216dc9d7..417ada37ff 100644 --- a/arch/arm/mach-imx/imx21.c +++ b/arch/arm/mach-imx/imx21.c @@ -36,6 +36,7 @@ static int imx21_init(void) add_generic_device("imx-gpio", 3, NULL, MX21_GPIO4_BASE_ADDR, 0x100, IORESOURCE_MEM, NULL); add_generic_device("imx-gpio", 4, NULL, MX21_GPIO5_BASE_ADDR, 0x100, IORESOURCE_MEM, NULL); add_generic_device("imx-gpio", 5, NULL, MX21_GPIO6_BASE_ADDR, 0x100, IORESOURCE_MEM, NULL); + add_generic_device("imx21-wdt", 0, NULL, MX21_WDOG_BASE_ADDR, 0x100, IORESOURCE_MEM, NULL); return 0; } diff --git a/arch/arm/mach-imx/imx25.c b/arch/arm/mach-imx/imx25.c index 87c23ecce5..92b5a1ba1e 100644 --- a/arch/arm/mach-imx/imx25.c +++ b/arch/arm/mach-imx/imx25.c @@ -74,6 +74,7 @@ static int imx25_init(void) add_generic_device("imx31-gpio", 1, NULL, MX25_GPIO2_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL); add_generic_device("imx31-gpio", 2, NULL, MX25_GPIO3_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL); add_generic_device("imx31-gpio", 3, NULL, MX25_GPIO4_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL); + add_generic_device("imx21-wdt", 0, NULL, MX25_WDOG_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL); return 0; } diff --git a/arch/arm/mach-imx/imx27.c b/arch/arm/mach-imx/imx27.c index 7b33ce220f..a0a510f5ab 100644 --- a/arch/arm/mach-imx/imx27.c +++ b/arch/arm/mach-imx/imx27.c @@ -116,6 +116,7 @@ static int imx27_init(void) add_generic_device("imx1-gpio", 3, NULL, MX27_GPIO4_BASE_ADDR, 0x100, IORESOURCE_MEM, NULL); add_generic_device("imx1-gpio", 4, NULL, MX27_GPIO5_BASE_ADDR, 0x100, IORESOURCE_MEM, NULL); add_generic_device("imx1-gpio", 5, NULL, MX27_GPIO6_BASE_ADDR, 0x100, IORESOURCE_MEM, NULL); + add_generic_device("imx21-wdt", 0, NULL, MX27_WDOG_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL); return 0; } diff --git a/arch/arm/mach-imx/imx31.c b/arch/arm/mach-imx/imx31.c index d4955bf2cc..71b4c333c0 100644 --- a/arch/arm/mach-imx/imx31.c +++ b/arch/arm/mach-imx/imx31.c @@ -37,6 +37,7 @@ static int imx31_init(void) add_generic_device("imx-gpio", 0, NULL, MX31_GPIO1_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL); add_generic_device("imx-gpio", 1, NULL, MX31_GPIO2_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL); add_generic_device("imx-gpio", 2, NULL, MX31_GPIO3_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL); + add_generic_device("imx21-wdt", 0, NULL, MX31_WDOG_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL); return 0; } diff --git a/arch/arm/mach-imx/imx35.c b/arch/arm/mach-imx/imx35.c index 7b743dfac0..946c8ddbcc 100644 --- a/arch/arm/mach-imx/imx35.c +++ b/arch/arm/mach-imx/imx35.c @@ -76,6 +76,7 @@ static int imx35_init(void) add_generic_device("imx-gpio", 0, NULL, MX35_GPIO1_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL); add_generic_device("imx-gpio", 1, NULL, MX35_GPIO2_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL); add_generic_device("imx-gpio", 2, NULL, MX35_GPIO3_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL); + add_generic_device("imx21-wdt", 0, NULL, MX35_WDOG_BASE_ADDR, 0x4000, IORESOURCE_MEM, NULL); return 0; } diff --git a/arch/arm/mach-imx/imx51.c b/arch/arm/mach-imx/imx51.c index 9cad9e0cde..fac5c25486 100644 --- a/arch/arm/mach-imx/imx51.c +++ b/arch/arm/mach-imx/imx51.c @@ -68,6 +68,7 @@ static int imx51_init(void) add_generic_device("imx31-gpio", 1, NULL, MX51_GPIO2_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL); add_generic_device("imx31-gpio", 2, NULL, MX51_GPIO3_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL); add_generic_device("imx31-gpio", 3, NULL, MX51_GPIO4_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL); + add_generic_device("imx21-wdt", 0, NULL, MX51_WDOG_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL); return 0; } diff --git a/arch/arm/mach-imx/imx53.c b/arch/arm/mach-imx/imx53.c index 059ef7203b..0a4de83a4c 100644 --- a/arch/arm/mach-imx/imx53.c +++ b/arch/arm/mach-imx/imx53.c @@ -66,6 +66,7 @@ static int imx53_init(void) add_generic_device("imx31-gpio", 4, NULL, MX53_GPIO5_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL); add_generic_device("imx31-gpio", 5, NULL, MX53_GPIO6_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL); add_generic_device("imx31-gpio", 6, NULL, MX53_GPIO7_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL); + add_generic_device("imx21-wdt", 0, NULL, MX53_WDOG1_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL); return 0; } diff --git a/arch/arm/mach-imx/imx6.c b/arch/arm/mach-imx/imx6.c index fef6832e76..c9eec5ab75 100644 --- a/arch/arm/mach-imx/imx6.c +++ b/arch/arm/mach-imx/imx6.c @@ -64,6 +64,7 @@ static int imx6_init(void) add_generic_device("imx31-gpio", 4, NULL, MX6_GPIO5_BASE_ADDR, 0x4000, IORESOURCE_MEM, NULL); add_generic_device("imx31-gpio", 5, NULL, MX6_GPIO6_BASE_ADDR, 0x4000, IORESOURCE_MEM, NULL); add_generic_device("imx31-gpio", 6, NULL, MX6_GPIO7_BASE_ADDR, 0x4000, IORESOURCE_MEM, NULL); + add_generic_device("imx21-wdt", 0, NULL, MX6_WDOG1_BASE_ADDR, 0x4000, IORESOURCE_MEM, NULL); return 0; } diff --git a/arch/arm/mach-imx/include/mach/devices-imx1.h b/arch/arm/mach-imx/include/mach/devices-imx1.h index c73113cf64..391c1a9c8e 100644 --- a/arch/arm/mach-imx/include/mach/devices-imx1.h +++ b/arch/arm/mach-imx/include/mach/devices-imx1.h @@ -2,10 +2,10 @@ static inline struct device_d *imx1_add_uart0(void) { - return imx_add_uart((void *)MX1_UART1_BASE_ADDR, 0); + return imx_add_uart_imx1((void *)MX1_UART1_BASE_ADDR, 0); } static inline struct device_d *imx1_add_uart1(void) { - return imx_add_uart((void *)MX1_UART2_BASE_ADDR, 1); + return imx_add_uart_imx1((void *)MX1_UART2_BASE_ADDR, 1); } diff --git a/arch/arm/mach-imx/include/mach/devices-imx21.h b/arch/arm/mach-imx/include/mach/devices-imx21.h index 31c5f8c17b..ad7ee5ed02 100644 --- a/arch/arm/mach-imx/include/mach/devices-imx21.h +++ b/arch/arm/mach-imx/include/mach/devices-imx21.h @@ -3,22 +3,22 @@ static inline struct device_d *imx21_add_uart0(void) { - return imx_add_uart((void *)MX21_UART1_BASE_ADDR, 0); + return imx_add_uart_imx21((void *)MX21_UART1_BASE_ADDR, 0); } static inline struct device_d *imx21_add_uart1(void) { - return imx_add_uart((void *)MX21_UART2_BASE_ADDR, 1); + return imx_add_uart_imx21((void *)MX21_UART2_BASE_ADDR, 1); } static inline struct device_d *imx21_add_uart2(void) { - return imx_add_uart((void *)MX21_UART2_BASE_ADDR, 2); + return imx_add_uart_imx21((void *)MX21_UART2_BASE_ADDR, 2); } static inline struct device_d *imx21_add_uart3(void) { - return imx_add_uart((void *)MX21_UART2_BASE_ADDR, 3); + return imx_add_uart_imx21((void *)MX21_UART2_BASE_ADDR, 3); } static inline struct device_d *imx21_add_nand(struct imx_nand_platform_data *pdata) diff --git a/arch/arm/mach-imx/include/mach/devices-imx25.h b/arch/arm/mach-imx/include/mach/devices-imx25.h index 86cda35a43..a655be9564 100644 --- a/arch/arm/mach-imx/include/mach/devices-imx25.h +++ b/arch/arm/mach-imx/include/mach/devices-imx25.h @@ -33,27 +33,27 @@ static inline struct device_d *imx25_add_spi2(struct spi_imx_master *pdata) static inline struct device_d *imx25_add_uart0(void) { - return imx_add_uart((void *)MX25_UART1_BASE_ADDR, 0); + return imx_add_uart_imx21((void *)MX25_UART1_BASE_ADDR, 0); } static inline struct device_d *imx25_add_uart1(void) { - return imx_add_uart((void *)MX25_UART2_BASE_ADDR, 1); + return imx_add_uart_imx21((void *)MX25_UART2_BASE_ADDR, 1); } static inline struct device_d *imx25_add_uart2(void) { - return imx_add_uart((void *)MX25_UART3_BASE_ADDR, 2); + return imx_add_uart_imx21((void *)MX25_UART3_BASE_ADDR, 2); } static inline struct device_d *imx25_add_uart3(void) { - return imx_add_uart((void *)MX25_UART4_BASE_ADDR, 3); + return imx_add_uart_imx21((void *)MX25_UART4_BASE_ADDR, 3); } static inline struct device_d *imx25_add_uart4(void) { - return imx_add_uart((void *)MX25_UART5_BASE_ADDR, 4); + return imx_add_uart_imx21((void *)MX25_UART5_BASE_ADDR, 4); } static inline struct device_d *imx25_add_nand(struct imx_nand_platform_data *pdata) @@ -68,7 +68,7 @@ static inline struct device_d *imx25_add_fb(struct imx_fb_platform_data *pdata) static inline struct device_d *imx25_add_fec(struct fec_platform_data *pdata) { - return imx_add_fec((void *)MX25_FEC_BASE_ADDR, pdata); + return imx_add_fec_imx27((void *)MX25_FEC_BASE_ADDR, pdata); } static inline struct device_d *imx25_add_mmc0(struct esdhc_platform_data *pdata) diff --git a/arch/arm/mach-imx/include/mach/devices-imx27.h b/arch/arm/mach-imx/include/mach/devices-imx27.h index 2799343e59..79da93531d 100644 --- a/arch/arm/mach-imx/include/mach/devices-imx27.h +++ b/arch/arm/mach-imx/include/mach/devices-imx27.h @@ -23,22 +23,22 @@ static inline struct device_d *imx27_add_i2c1(struct i2c_platform_data *pdata) static inline struct device_d *imx27_add_uart0(void) { - return imx_add_uart((void *)MX27_UART1_BASE_ADDR, 0); + return imx_add_uart_imx21((void *)MX27_UART1_BASE_ADDR, 0); } static inline struct device_d *imx27_add_uart1(void) { - return imx_add_uart((void *)MX27_UART2_BASE_ADDR, 1); + return imx_add_uart_imx21((void *)MX27_UART2_BASE_ADDR, 1); } static inline struct device_d *imx27_add_uart2(void) { - return imx_add_uart((void *)MX27_UART3_BASE_ADDR, 2); + return imx_add_uart_imx21((void *)MX27_UART3_BASE_ADDR, 2); } static inline struct device_d *imx27_add_uart3(void) { - return imx_add_uart((void *)MX27_UART4_BASE_ADDR, 3); + return imx_add_uart_imx21((void *)MX27_UART4_BASE_ADDR, 3); } static inline struct device_d *imx27_add_nand(struct imx_nand_platform_data *pdata) @@ -53,7 +53,7 @@ static inline struct device_d *imx27_add_fb(struct imx_fb_platform_data *pdata) static inline struct device_d *imx27_add_fec(struct fec_platform_data *pdata) { - return imx_add_fec((void *)MX27_FEC_BASE_ADDR, pdata); + return imx_add_fec_imx27((void *)MX27_FEC_BASE_ADDR, pdata); } static inline struct device_d *imx27_add_mmc0(void *pdata) diff --git a/arch/arm/mach-imx/include/mach/devices-imx31.h b/arch/arm/mach-imx/include/mach/devices-imx31.h index d45e4e1027..72167b0a14 100644 --- a/arch/arm/mach-imx/include/mach/devices-imx31.h +++ b/arch/arm/mach-imx/include/mach/devices-imx31.h @@ -19,27 +19,27 @@ static inline struct device_d *imx31_add_spi2(struct spi_imx_master *pdata) static inline struct device_d *imx31_add_uart0(void) { - return imx_add_uart((void *)MX31_UART1_BASE_ADDR, 0); + return imx_add_uart_imx21((void *)MX31_UART1_BASE_ADDR, 0); } static inline struct device_d *imx31_add_uart1(void) { - return imx_add_uart((void *)MX31_UART2_BASE_ADDR, 1); + return imx_add_uart_imx21((void *)MX31_UART2_BASE_ADDR, 1); } static inline struct device_d *imx31_add_uart2(void) { - return imx_add_uart((void *)MX31_UART3_BASE_ADDR, 2); + return imx_add_uart_imx21((void *)MX31_UART3_BASE_ADDR, 2); } static inline struct device_d *imx31_add_uart3(void) { - return imx_add_uart((void *)MX31_UART4_BASE_ADDR, 3); + return imx_add_uart_imx21((void *)MX31_UART4_BASE_ADDR, 3); } static inline struct device_d *imx31_add_uart4(void) { - return imx_add_uart((void *)MX31_UART5_BASE_ADDR, 4); + return imx_add_uart_imx21((void *)MX31_UART5_BASE_ADDR, 4); } static inline struct device_d *imx31_add_nand(struct imx_nand_platform_data *pdata) diff --git a/arch/arm/mach-imx/include/mach/devices-imx35.h b/arch/arm/mach-imx/include/mach/devices-imx35.h index 27c49e7161..912c41872e 100644 --- a/arch/arm/mach-imx/include/mach/devices-imx35.h +++ b/arch/arm/mach-imx/include/mach/devices-imx35.h @@ -28,17 +28,17 @@ static inline struct device_d *imx35_add_spi(struct spi_imx_master *pdata) static inline struct device_d *imx35_add_uart0(void) { - return imx_add_uart((void *)MX35_UART1_BASE_ADDR, 0); + return imx_add_uart_imx21((void *)MX35_UART1_BASE_ADDR, 0); } static inline struct device_d *imx35_add_uart1(void) { - return imx_add_uart((void *)MX35_UART2_BASE_ADDR, 1); + return imx_add_uart_imx21((void *)MX35_UART2_BASE_ADDR, 1); } static inline struct device_d *imx35_add_uart2(void) { - return imx_add_uart((void *)MX35_UART3_BASE_ADDR, 2); + return imx_add_uart_imx21((void *)MX35_UART3_BASE_ADDR, 2); } static inline struct device_d *imx35_add_nand(struct imx_nand_platform_data *pdata) @@ -53,7 +53,7 @@ static inline struct device_d *imx35_add_fb(struct imx_ipu_fb_platform_data *pda static inline struct device_d *imx35_add_fec(struct fec_platform_data *pdata) { - return imx_add_fec((void *)MX35_FEC_BASE_ADDR, pdata); + return imx_add_fec_imx27((void *)MX35_FEC_BASE_ADDR, pdata); } static inline struct device_d *imx35_add_mmc0(struct esdhc_platform_data *pdata) diff --git a/arch/arm/mach-imx/include/mach/devices-imx51.h b/arch/arm/mach-imx/include/mach/devices-imx51.h index 4b35c96e21..8ee3c17478 100644 --- a/arch/arm/mach-imx/include/mach/devices-imx51.h +++ b/arch/arm/mach-imx/include/mach/devices-imx51.h @@ -29,22 +29,22 @@ static inline struct device_d *imx51_add_i2c1(struct i2c_platform_data *pdata) static inline struct device_d *imx51_add_uart0(void) { - return imx_add_uart((void *)MX51_UART1_BASE_ADDR, 0); + return imx_add_uart_imx21((void *)MX51_UART1_BASE_ADDR, 0); } static inline struct device_d *imx51_add_uart1(void) { - return imx_add_uart((void *)MX51_UART2_BASE_ADDR, 1); + return imx_add_uart_imx21((void *)MX51_UART2_BASE_ADDR, 1); } static inline struct device_d *imx51_add_uart2(void) { - return imx_add_uart((void *)MX51_UART3_BASE_ADDR, 2); + return imx_add_uart_imx21((void *)MX51_UART3_BASE_ADDR, 2); } static inline struct device_d *imx51_add_fec(struct fec_platform_data *pdata) { - return imx_add_fec((void *)MX51_MXC_FEC_BASE_ADDR, pdata); + return imx_add_fec_imx27((void *)MX51_MXC_FEC_BASE_ADDR, pdata); } static inline struct device_d *imx51_add_mmc0(struct esdhc_platform_data *pdata) diff --git a/arch/arm/mach-imx/include/mach/devices-imx53.h b/arch/arm/mach-imx/include/mach/devices-imx53.h index 54d7b27be1..5f967eaac2 100644 --- a/arch/arm/mach-imx/include/mach/devices-imx53.h +++ b/arch/arm/mach-imx/include/mach/devices-imx53.h @@ -23,22 +23,22 @@ static inline struct device_d *imx53_add_i2c1(struct i2c_platform_data *pdata) static inline struct device_d *imx53_add_uart0(void) { - return imx_add_uart((void *)MX53_UART1_BASE_ADDR, 0); + return imx_add_uart_imx21((void *)MX53_UART1_BASE_ADDR, 0); } static inline struct device_d *imx53_add_uart1(void) { - return imx_add_uart((void *)MX53_UART2_BASE_ADDR, 1); + return imx_add_uart_imx21((void *)MX53_UART2_BASE_ADDR, 1); } static inline struct device_d *imx53_add_uart2(void) { - return imx_add_uart((void *)MX53_UART3_BASE_ADDR, 2); + return imx_add_uart_imx21((void *)MX53_UART3_BASE_ADDR, 2); } static inline struct device_d *imx53_add_fec(struct fec_platform_data *pdata) { - return imx_add_fec((void *)MX53_FEC_BASE_ADDR, pdata); + return imx_add_fec_imx27((void *)MX53_FEC_BASE_ADDR, pdata); } static inline struct device_d *imx53_add_mmc0(struct esdhc_platform_data *pdata) diff --git a/arch/arm/mach-imx/include/mach/devices-imx6.h b/arch/arm/mach-imx/include/mach/devices-imx6.h index c73e4888ed..f8282e7fca 100644 --- a/arch/arm/mach-imx/include/mach/devices-imx6.h +++ b/arch/arm/mach-imx/include/mach/devices-imx6.h @@ -2,22 +2,22 @@ static inline struct device_d *imx6_add_uart0(void) { - return imx_add_uart((void *)MX6_UART1_BASE_ADDR, 0); + return imx_add_uart_imx21((void *)MX6_UART1_BASE_ADDR, 0); } static inline struct device_d *imx6_add_uart1(void) { - return imx_add_uart((void *)MX6_UART2_BASE_ADDR, 1); + return imx_add_uart_imx21((void *)MX6_UART2_BASE_ADDR, 1); } static inline struct device_d *imx6_add_uart2(void) { - return imx_add_uart((void *)MX6_UART3_BASE_ADDR, 2); + return imx_add_uart_imx21((void *)MX6_UART3_BASE_ADDR, 2); } static inline struct device_d *imx6_add_uart3(void) { - return imx_add_uart((void *)MX6_UART4_BASE_ADDR, 3); + return imx_add_uart_imx21((void *)MX6_UART4_BASE_ADDR, 3); } static inline struct device_d *imx6_add_mmc0(struct esdhc_platform_data *pdata) @@ -42,7 +42,7 @@ static inline struct device_d *imx6_add_mmc3(struct esdhc_platform_data *pdata) static inline struct device_d *imx6_add_fec(struct fec_platform_data *pdata) { - return imx_add_fec((void *)MX6_ENET_BASE_ADDR, pdata); + return imx_add_fec_imx6((void *)MX6_ENET_BASE_ADDR, pdata); } static inline struct device_d *imx6_add_spi0(struct spi_imx_master *pdata) diff --git a/arch/arm/mach-imx/include/mach/devices.h b/arch/arm/mach-imx/include/mach/devices.h index da9164616e..f7824f5406 100644 --- a/arch/arm/mach-imx/include/mach/devices.h +++ b/arch/arm/mach-imx/include/mach/devices.h @@ -8,10 +8,12 @@ #include <mach/imx-ipu-fb.h> #include <mach/esdhc.h> -struct device_d *imx_add_fec(void *base, struct fec_platform_data *pdata); +struct device_d *imx_add_fec_imx27(void *base, struct fec_platform_data *pdata); +struct device_d *imx_add_fec_imx6(void *base, struct fec_platform_data *pdata); struct device_d *imx_add_spi(void *base, int id, struct spi_imx_master *pdata); struct device_d *imx_add_i2c(void *base, int id, struct i2c_platform_data *pdata); -struct device_d *imx_add_uart(void *base, int id); +struct device_d *imx_add_uart_imx1(void *base, int id); +struct device_d *imx_add_uart_imx21(void *base, int id); struct device_d *imx_add_nand(void *base, struct imx_nand_platform_data *pdata); struct device_d *imx_add_fb(void *base, struct imx_fb_platform_data *pdata); struct device_d *imx_add_ipufb(void *base, struct imx_ipu_fb_platform_data *pdata); diff --git a/arch/arm/mach-imx/reset_source.c b/arch/arm/mach-imx/reset_source.c deleted file mode 100644 index e7b2a906c5..0000000000 --- a/arch/arm/mach-imx/reset_source.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * (C) Copyright 2012 Juergen Beisert - <kernel@pengutronix.de> - * - * 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 <init.h> -#include <io.h> -#include <reset_source.h> -#include <mach/imx-regs.h> - -#ifdef CONFIG_ARCH_IMX1 -# define IMX_RESET_SRC_WDOG (1 << 1) -# define IMX_RESET_SRC_HRDRESET (1 << 0) -/* let the compiler sort out useless code on this arch */ -# define IMX_RESET_SRC_WARMSTART 0 -# define IMX_RESET_SRC_COLDSTART 0 -#else - /* WRSR checked for i.MX25, i.MX27, i.MX31, i.MX35 and i.MX51 */ -# define WDOG_WRSR 0x04 - /* valid for i.MX25, i.MX27, i.MX31, i.MX35, i.MX51 */ -# define IMX_RESET_SRC_WARMSTART (1 << 0) - /* valid for i.MX25, i.MX27, i.MX31, i.MX35, i.MX51 */ -# define IMX_RESET_SRC_WDOG (1 << 1) - /* valid for i.MX27, i.MX31, always '0' on i.MX25, i.MX35, i.MX51 */ -# define IMX_RESET_SRC_HRDRESET (1 << 3) - /* valid for i.MX27, i.MX31, always '0' on i.MX25, i.MX35, i.MX51 */ -# define IMX_RESET_SRC_COLDSTART (1 << 4) -#endif - -static unsigned read_detection_register(void) -{ -#ifdef CONFIG_ARCH_IMX1 - return readl(IMX_SYSCTRL_BASE); -#else - return readw(IMX_WDT_BASE + WDOG_WRSR); -#endif -} - -static int imx_detect_reset_source(void) -{ - unsigned reg = read_detection_register(); - - if (reg & IMX_RESET_SRC_COLDSTART) { - set_reset_source(RESET_POR); - return 0; - } - - if (reg & (IMX_RESET_SRC_HRDRESET | IMX_RESET_SRC_WARMSTART)) { - set_reset_source(RESET_RST); - return 0; - } - - if (reg & IMX_RESET_SRC_WDOG) { - set_reset_source(RESET_WDG); - return 0; - } - - /* else keep the default 'unknown' state */ - return 0; -} - -device_initcall(imx_detect_reset_source); diff --git a/arch/arm/mach-omap/gpio.c b/arch/arm/mach-omap/gpio.c index 376e9a7d55..49ffbda503 100644 --- a/arch/arm/mach-omap/gpio.c +++ b/arch/arm/mach-omap/gpio.c @@ -133,7 +133,7 @@ static int omap_gpio_probe(struct device_d *dev) omapgpio = xzalloc(sizeof(*omapgpio)); omapgpio->base = dev_request_mem_region(dev, 0); omapgpio->chip.ops = &omap_gpio_ops; - omapgpio->chip.base = -1; + omapgpio->chip.base = dev->id * 32; omapgpio->chip.ngpio = 32; omapgpio->chip.dev = dev; gpiochip_add(&omapgpio->chip); diff --git a/arch/arm/mach-omap/omap3_generic.c b/arch/arm/mach-omap/omap3_generic.c index 5028e9a9e6..10eeacdc80 100644 --- a/arch/arm/mach-omap/omap3_generic.c +++ b/arch/arm/mach-omap/omap3_generic.c @@ -515,17 +515,17 @@ const struct gpmc_config omap3_nand_cfg = { static int omap3_gpio_init(void) { add_generic_device("omap-gpio", 0, NULL, 0x48310000, - 0x100, IORESOURCE_MEM, NULL); + 0xf00, IORESOURCE_MEM, NULL); add_generic_device("omap-gpio", 1, NULL, 0x49050000, - 0x100, IORESOURCE_MEM, NULL); + 0xf00, IORESOURCE_MEM, NULL); add_generic_device("omap-gpio", 2, NULL, 0x49052000, - 0x100, IORESOURCE_MEM, NULL); + 0xf00, IORESOURCE_MEM, NULL); add_generic_device("omap-gpio", 3, NULL, 0x49054000, - 0x100, IORESOURCE_MEM, NULL); + 0xf00, IORESOURCE_MEM, NULL); add_generic_device("omap-gpio", 4, NULL, 0x49056000, - 0x100, IORESOURCE_MEM, NULL); + 0xf00, IORESOURCE_MEM, NULL); add_generic_device("omap-gpio", 5, NULL, 0x49058000, - 0x100, IORESOURCE_MEM, NULL); + 0xf00, IORESOURCE_MEM, NULL); return 0; } diff --git a/arch/arm/mach-omap/omap4_generic.c b/arch/arm/mach-omap/omap4_generic.c index a159dfcb7e..76134f22d0 100644 --- a/arch/arm/mach-omap/omap4_generic.c +++ b/arch/arm/mach-omap/omap4_generic.c @@ -484,11 +484,27 @@ enum omap_boot_src omap4_bootsrc(void) return OMAP_BOOTSRC_UNKNOWN; } +#define GPIO_MASK 0x1f + +static void __iomem *omap4_get_gpio_base(unsigned gpio) +{ + void __iomem *base; + + if (gpio < 32) + base = (void *)0x4a310000; + else + base = (void *)(0x48053000 + ((gpio & ~GPIO_MASK) << 8)); + + return base; +} + #define I2C_SLAVE 0x12 noinline int omap4_scale_vcores(unsigned vsel0_pin) { + void __iomem *base; unsigned int rev = omap4_revision(); + u32 val = 0; /* For VC bypass only VCOREx_CGF_FORCE is necessary and * VCOREx_CFG_VOLTAGE changes can be discarded @@ -510,8 +526,17 @@ noinline int omap4_scale_vcores(unsigned vsel0_pin) * VSEL1 is grounded on board. So the following selects * VSEL1 = 0 and VSEL0 = 1 */ - gpio_direction_output(vsel0_pin, 0); - gpio_set_value(vsel0_pin, 1); + base = omap4_get_gpio_base(vsel0_pin); + + val = 1 << (vsel0_pin & GPIO_MASK); + writel(val, base + 0x190); + + val = readl(base + 0x134); + val &= (1 << (vsel0_pin & GPIO_MASK)); + writel(val, base + 0x134); + + val = 1 << (vsel0_pin & GPIO_MASK); + writel(val, base + 0x194); } /* set VCORE1 force VSEL */ @@ -576,17 +601,17 @@ const struct gpmc_config omap4_nand_cfg = { static int omap4_gpio_init(void) { add_generic_device("omap-gpio", 0, NULL, 0x4a310100, - 0x1000, IORESOURCE_MEM, NULL); + 0xf00, IORESOURCE_MEM, NULL); add_generic_device("omap-gpio", 1, NULL, 0x48055100, - 0x1000, IORESOURCE_MEM, NULL); + 0xf00, IORESOURCE_MEM, NULL); add_generic_device("omap-gpio", 2, NULL, 0x48057100, - 0x1000, IORESOURCE_MEM, NULL); + 0xf00, IORESOURCE_MEM, NULL); add_generic_device("omap-gpio", 3, NULL, 0x48059100, - 0x1000, IORESOURCE_MEM, NULL); + 0xf00, IORESOURCE_MEM, NULL); add_generic_device("omap-gpio", 4, NULL, 0x4805b100, - 0x1000, IORESOURCE_MEM, NULL); + 0xf00, IORESOURCE_MEM, NULL); add_generic_device("omap-gpio", 5, NULL, 0x4805d100, - 0x1000, IORESOURCE_MEM, NULL); + 0xf00, IORESOURCE_MEM, NULL); return 0; } |