From 07a8e6d6ee04de7c95de9824e3d1821744f92970 Mon Sep 17 00:00:00 2001 From: Andrew Ruder Date: Wed, 12 Aug 2015 12:55:47 -0500 Subject: pxa: Fix boot hang by avoiding vector relocation Since commit 3ff46cc42b9d73d0 ("arm: relocate the exception vectors") pxa does not boot anymore. Add a specific relocate_vectors macro that skips the vector relocation, as the pxa SoC does not provide RAM at the high vectors address (0xFFFF0000), and (0x00000000) maps to ROM. This allows pxa to boot again. Cc: Marek Vasut Signed-off-by: Andrew Ruder --- arch/arm/cpu/pxa/Makefile | 1 + arch/arm/cpu/pxa/relocate.S | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 arch/arm/cpu/pxa/relocate.S diff --git a/arch/arm/cpu/pxa/Makefile b/arch/arm/cpu/pxa/Makefile index 8cd475e3a4..3ee08cd188 100644 --- a/arch/arm/cpu/pxa/Makefile +++ b/arch/arm/cpu/pxa/Makefile @@ -13,3 +13,4 @@ obj-$(CONFIG_CPU_PXA27X) += pxa2xx.o obj-y += cpuinfo.o obj-y += timer.o obj-y += usb.o +obj-y += relocate.o diff --git a/arch/arm/cpu/pxa/relocate.S b/arch/arm/cpu/pxa/relocate.S new file mode 100644 index 0000000000..fafd4daeb6 --- /dev/null +++ b/arch/arm/cpu/pxa/relocate.S @@ -0,0 +1,23 @@ +/* + * relocate - PXA270 vector relocation + * + * Copyright (c) 2013 Albert ARIBAUD + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include + +/* + * The PXA SoC is very specific with respect to exceptions: it + * does not provide RAM at the high vectors address (0xFFFF0000), + * thus only the low address (0x00000000) is useable; but that is + * in ROM, so let's avoid relocating the vectors. + */ + .section .text.relocate_vectors,"ax",%progbits + +ENTRY(relocate_vectors) + + bx lr + +ENDPROC(relocate_vectors) -- cgit v1.2.1 From 7d211fec96d1d6b6d828f3bb4abc59180f6e3556 Mon Sep 17 00:00:00 2001 From: Andrew Ruder Date: Wed, 12 Aug 2015 13:18:31 -0500 Subject: arm: pxa: use common timer functions This patch moves pxa to the common timer functions added in commit 8dfafdd - Introduce common timer functions The (removed) pxa timer code (specifically __udelay()) could deadlock at the 32-bit boundary of get_ticks(). get_ticks() returned a 32-bit value cast up to a 64-bit value. If get_ticks() + tmo in __udelay() crossed the 32-bit boundary, the while condition became unconditionally true and locked the processor. Rather than patch the specific pxa issues, simply move everything over to the common code. Signed-off-by: Andrew Ruder Cc: Marek Vasut Cc: Tom Rini --- arch/arm/cpu/pxa/timer.c | 69 +--------------------------------- arch/arm/include/asm/arch-pxa/config.h | 25 ++++++++++++ arch/arm/include/asm/config.h | 5 ++- 3 files changed, 30 insertions(+), 69 deletions(-) create mode 100644 arch/arm/include/asm/arch-pxa/config.h diff --git a/arch/arm/cpu/pxa/timer.c b/arch/arm/cpu/pxa/timer.c index c4717de6a9..11fefd5499 100644 --- a/arch/arm/cpu/pxa/timer.c +++ b/arch/arm/cpu/pxa/timer.c @@ -6,80 +6,13 @@ * SPDX-License-Identifier: GPL-2.0+ */ -#include #include #include -#include DECLARE_GLOBAL_DATA_PTR; -#define TIMER_LOAD_VAL 0xffffffff - -#define timestamp (gd->arch.tbl) -#define lastinc (gd->arch.lastinc) - -#if defined(CONFIG_CPU_PXA27X) || defined(CONFIG_CPU_MONAHANS) -#define TIMER_FREQ_HZ 3250000 -#elif defined(CONFIG_CPU_PXA25X) -#define TIMER_FREQ_HZ 3686400 -#else -#error "Timer frequency unknown - please config PXA CPU type" -#endif - -static unsigned long long tick_to_time(unsigned long long tick) -{ - return lldiv(tick * CONFIG_SYS_HZ, TIMER_FREQ_HZ); -} - -static unsigned long long us_to_tick(unsigned long long us) -{ - return lldiv(us * TIMER_FREQ_HZ, 1000000); -} - int timer_init(void) { - writel(0, OSCR); + writel(0, CONFIG_SYS_TIMER_COUNTER); return 0; } - -unsigned long long get_ticks(void) -{ - /* Current tick value */ - uint32_t now = readl(OSCR); - - if (now >= lastinc) { - /* - * Normal mode (non roll) - * Move stamp forward with absolute diff ticks - */ - timestamp += (now - lastinc); - } else { - /* We have rollover of incrementer */ - timestamp += (TIMER_LOAD_VAL - lastinc) + now; - } - - lastinc = now; - return timestamp; -} - -ulong get_timer(ulong base) -{ - return tick_to_time(get_ticks()) - base; -} - -void __udelay(unsigned long usec) -{ - unsigned long long tmp; - ulong tmo; - - tmo = us_to_tick(usec); - tmp = get_ticks() + tmo; /* get current timestamp */ - - while (get_ticks() < tmp) /* loop till event */ - /*NOP*/; -} - -ulong get_tbclk(void) -{ - return TIMER_FREQ_HZ; -} diff --git a/arch/arm/include/asm/arch-pxa/config.h b/arch/arm/include/asm/arch-pxa/config.h new file mode 100644 index 0000000000..5836945214 --- /dev/null +++ b/arch/arm/include/asm/arch-pxa/config.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2014 Andrew Ruder + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef _ASM_ARM_PXA_CONFIG_ +#define _ASM_ARM_PXA_CONFIG_ + +#include + +/* + * Generic timer support + */ +#if defined(CONFIG_CPU_PXA27X) || defined(CONFIG_CPU_MONAHANS) +#define CONFIG_SYS_TIMER_RATE 3250000 +#elif defined(CONFIG_CPU_PXA25X) +#define CONFIG_SYS_TIMER_RATE 3686400 +#else +#error "Timer frequency unknown - please config PXA CPU type" +#endif + +#define CONFIG_SYS_TIMER_COUNTER OSCR + +#endif /* _ASM_ARM_PXA_CONFIG_ */ diff --git a/arch/arm/include/asm/config.h b/arch/arm/include/asm/config.h index 7a34a0186c..22fff02778 100644 --- a/arch/arm/include/asm/config.h +++ b/arch/arm/include/asm/config.h @@ -19,7 +19,10 @@ #include #endif -#ifdef CONFIG_LS102XA +#if defined(CONFIG_LS102XA) || \ + defined(CONFIG_CPU_PXA27X) || \ + defined(CONFIG_CPU_MONAHANS) || \ + defined(CONFIG_CPU_PXA25X) #include #endif -- cgit v1.2.1 From 67b855fe54730c16702dda0a5b2d53ab6b01500f Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Sun, 16 Aug 2015 04:16:26 +0200 Subject: arm: pxa: clean-up include file order Cleaning up order of include files by sorting them alphabetically keeping in mind to leave common.h on top. Signed-off-by: Marcel Ziswiler --- arch/arm/cpu/pxa/pxa2xx.c | 4 ++-- arch/arm/cpu/pxa/timer.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/cpu/pxa/pxa2xx.c b/arch/arm/cpu/pxa/pxa2xx.c index 7e861e26db..2f12fb9c82 100644 --- a/arch/arm/cpu/pxa/pxa2xx.c +++ b/arch/arm/cpu/pxa/pxa2xx.c @@ -10,11 +10,11 @@ * SPDX-License-Identifier: GPL-2.0+ */ +#include +#include #include #include #include -#include -#include /* Flush I/D-cache */ static void cache_flush(void) diff --git a/arch/arm/cpu/pxa/timer.c b/arch/arm/cpu/pxa/timer.c index 11fefd5499..7c25e67fea 100644 --- a/arch/arm/cpu/pxa/timer.c +++ b/arch/arm/cpu/pxa/timer.c @@ -6,8 +6,8 @@ * SPDX-License-Identifier: GPL-2.0+ */ -#include #include +#include DECLARE_GLOBAL_DATA_PTR; -- cgit v1.2.1 From 54a5cf81c491e4c4dfc2acf77daf2500f6cc8546 Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Sun, 16 Aug 2015 04:16:27 +0200 Subject: arm: pxa: mmc: clean-up include file order Cleaning up order of include files by sorting them alphabetically keeping in mind to leave common.h on top. Signed-off-by: Marcel Ziswiler --- drivers/mmc/pxa_mmc_gen.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/pxa_mmc_gen.c b/drivers/mmc/pxa_mmc_gen.c index 25ab0b1fc8..19ae81d470 100644 --- a/drivers/mmc/pxa_mmc_gen.c +++ b/drivers/mmc/pxa_mmc_gen.c @@ -6,15 +6,13 @@ * SPDX-License-Identifier: GPL-2.0+ */ -#include #include -#include - -#include -#include #include #include +#include #include +#include +#include /* PXAMMC Generic default config for various CPUs */ #if defined(CONFIG_CPU_PXA25X) -- cgit v1.2.1 From 8648b2358ae50714baa9b1d65f767847c5184c17 Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Sun, 16 Aug 2015 04:16:29 +0200 Subject: serial: pxa: clean-up include file order Cleaning up order of include files by sorting them alphabetically keeping in mind to leave common.h on top. Signed-off-by: Marcel Ziswiler --- drivers/serial/serial_pxa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/serial/serial_pxa.c b/drivers/serial/serial_pxa.c index d5140045bf..8fbcc10248 100644 --- a/drivers/serial/serial_pxa.c +++ b/drivers/serial/serial_pxa.c @@ -18,12 +18,12 @@ */ #include -#include -#include #include #include #include #include +#include +#include DECLARE_GLOBAL_DATA_PTR; -- cgit v1.2.1 From 745e7e0ae03c72e8e2878a2b1b8ebfb771c5ed53 Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Sun, 16 Aug 2015 04:16:30 +0200 Subject: usb: pxa27x_udc: clean-up include file order Cleaning up order of include files by sorting them alphabetically keeping in mind to leave common.h on top. Signed-off-by: Marcel Ziswiler --- drivers/usb/gadget/pxa27x_udc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c index 9423555280..c7b21aee42 100644 --- a/drivers/usb/gadget/pxa27x_udc.c +++ b/drivers/usb/gadget/pxa27x_udc.c @@ -10,11 +10,10 @@ #include -#include -#include -#include #include +#include #include +#include #include #include -- cgit v1.2.1 From ab9272f955be6357d8a5b901d1feff279548da12 Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Sun, 16 Aug 2015 04:16:31 +0200 Subject: lcd: pxa: clean-up include file order Cleaning up order of include files by sorting them alphabetically keeping in mind to leave common.h on top. Signed-off-by: Marcel Ziswiler --- drivers/video/pxa_lcd.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/video/pxa_lcd.c b/drivers/video/pxa_lcd.c index 64cef37bc9..2799425a63 100644 --- a/drivers/video/pxa_lcd.c +++ b/drivers/video/pxa_lcd.c @@ -11,14 +11,13 @@ /* ** HEADER FILES */ /************************************************************************/ -#include #include -#include -#include -#include -#include #include #include +#include +#include +#include +#include /* #define DEBUG */ -- cgit v1.2.1 From a9fb90d1ee694655861e4c1c23a6a6c8207a495f Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Sun, 16 Aug 2015 04:16:33 +0200 Subject: arm: pxa: palmtreo680: get rid of obsolete CONFIG_SYS_LCD_PXA_NO_L_BIAS Looks like the define CONFIG_SYS_LCD_PXA_NO_L_BIAS is not used anywhere else throughout the U-Boot sources any more. Drop it. Signed-off-by: Marcel Ziswiler --- include/configs/palmtreo680.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/configs/palmtreo680.h b/include/configs/palmtreo680.h index ffb0d1e19a..5ffed82955 100644 --- a/include/configs/palmtreo680.h +++ b/include/configs/palmtreo680.h @@ -67,7 +67,6 @@ #define CONFIG_PXA_LCD #define CONFIG_ACX544AKN #define CONFIG_LCD_LOGO -#define CONFIG_SYS_LCD_PXA_NO_L_BIAS /* don't configure GPIO77 as L_BIAS */ #define LCD_BPP LCD_COLOR16 #define CONFIG_FB_ADDR 0x5c000000 /* internal SRAM */ #define CONFIG_CMD_BMP -- cgit v1.2.1 From d817889b1e5907da0c4885fcdf20f2f265966e86 Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Sun, 16 Aug 2015 04:16:34 +0200 Subject: arm: pxa: colibri_pxa270: add some more nor flash details Add some more NOR flash details like size, bus width and lock/unlock time outs. Signed-off-by: Marcel Ziswiler --- include/configs/colibri_pxa270.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/configs/colibri_pxa270.h b/include/configs/colibri_pxa270.h index a1b64c60e6..722ff525f5 100644 --- a/include/configs/colibri_pxa270.h +++ b/include/configs/colibri_pxa270.h @@ -122,16 +122,20 @@ */ #ifdef CONFIG_CMD_FLASH #define PHYS_FLASH_1 0x00000000 /* Flash Bank #1 */ +#define PHYS_FLASH_SIZE 0x02000000 /* 32 MB */ #define CONFIG_SYS_FLASH_BASE PHYS_FLASH_1 #define CONFIG_SYS_FLASH_CFI #define CONFIG_FLASH_CFI_DRIVER 1 +#define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_32BIT #define CONFIG_SYS_MAX_FLASH_SECT (4 + 255) #define CONFIG_SYS_MAX_FLASH_BANKS 1 #define CONFIG_SYS_FLASH_ERASE_TOUT (25 * CONFIG_SYS_HZ) #define CONFIG_SYS_FLASH_WRITE_TOUT (25 * CONFIG_SYS_HZ) +#define CONFIG_SYS_FLASH_LOCK_TOUT (25 * CONFIG_SYS_HZ) +#define CONFIG_SYS_FLASH_UNLOCK_TOUT (25 * CONFIG_SYS_HZ) #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE 1 #define CONFIG_SYS_FLASH_PROTECTION 1 -- cgit v1.2.1 From 4f9bbd9e69420c156370d5c39a2fc67bc8c76fee Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Sun, 16 Aug 2015 04:16:35 +0200 Subject: arm: pxa: colibri_pxa270: add optional lcd support Add optional LCD support. Note that depending on the toolchain used one might have to drop some other features to stay within the 0x40000 size limit. Signed-off-by: Marcel Ziswiler --- include/configs/colibri_pxa270.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/configs/colibri_pxa270.h b/include/configs/colibri_pxa270.h index 722ff525f5..f2fa85ee59 100644 --- a/include/configs/colibri_pxa270.h +++ b/include/configs/colibri_pxa270.h @@ -19,6 +19,9 @@ /* Avoid overwriting factory configuration block */ #define CONFIG_BOARD_SIZE_LIMIT 0x40000 +/* We will never enable dcache because we have to setup MMU first */ +#define CONFIG_SYS_DCACHE_OFF + /* * Environment settings */ @@ -56,6 +59,16 @@ #define CONFIG_CMD_MMC #define CONFIG_CMD_USB +/* LCD support */ +#ifdef CONFIG_LCD +#define CONFIG_PXA_LCD +#define CONFIG_PXA_VGA +#define CONFIG_SYS_WHITE_ON_BLACK +#define CONFIG_CONSOLE_SCROLL_LINES 10 +#define CONFIG_CMD_BMP +#define CONFIG_LCD_LOGO +#endif + /* * Networking Configuration */ -- cgit v1.2.1 From 3664fa1beec3921dcfed605a9b37f63dee28ce6a Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Sun, 16 Aug 2015 04:16:36 +0200 Subject: arm: pxa: colibri_pxa270: add optional i2c support This is useful once Andrew's PXA I2C driver gets merged. Signed-off-by: Marcel Ziswiler --- include/configs/colibri_pxa270.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/configs/colibri_pxa270.h b/include/configs/colibri_pxa270.h index f2fa85ee59..4efc9c5f3e 100644 --- a/include/configs/colibri_pxa270.h +++ b/include/configs/colibri_pxa270.h @@ -59,6 +59,15 @@ #define CONFIG_CMD_MMC #define CONFIG_CMD_USB +/* I2C support */ +#ifdef CONFIG_SYS_I2C +#define CONFIG_CMD_I2C +#define CONFIG_SYS_I2C_PXA +#define CONFIG_PXA_STD_I2C +#define CONFIG_PXA_PWR_I2C +#define CONFIG_SYS_I2C_SPEED 100000 +#endif + /* LCD support */ #ifdef CONFIG_LCD #define CONFIG_PXA_LCD -- cgit v1.2.1