The patches are based on v3.10-rc4.
They are build tested for s3c2410_defconfig, s3c6400_defconfig,
s5p64x0_defconfig, s5pc100_defconfig, s5pv210_defconfig,
exynos4_defconfig and exynos_defconfig.
Since they affect all the Samsung boards, testing them on different
machines would be essential. Unfortunately I can only test on Exynos here.
Tested on Exynos5250 based Arndale board.
Changes for v2:
* Instead of checking for uart_base, we are now checking whether
DEBUG_LL is enabled. This removes the ifdefs used in mach/uncompress.h
* 3rd patch has been updated by Tomasz Figa's patch that almost does
the same thing.
Tomasz Figa (1):
ARM: s5p64x0: Use common uncompress.h part for plat-samsung
Tushar Behera (2):
ARM: EXYNOS: uncompress - print debug messages if DEBUG_LL is defined
ARM: SAMSUNG: Consolidate uncompress subroutine
arch/arm/mach-exynos/include/mach/uncompress.h | 3 -
arch/arm/mach-s3c24xx/include/mach/uncompress.h | 3 +
arch/arm/mach-s3c64xx/include/mach/uncompress.h | 3 +
arch/arm/mach-s5p64x0/include/mach/uncompress.h | 162 +----------------------
arch/arm/mach-s5pc100/include/mach/uncompress.h | 2 +
arch/arm/mach-s5pv210/include/mach/uncompress.h | 2 +
arch/arm/plat-samsung/include/plat/uncompress.h | 16 ++-
7 files changed, 27 insertions(+), 164 deletions(-)
--
1.7.9.5
Printing low-level debug messages make an assumption that the specified
UART port has been preconfigured by the bootloader. Incorrectly
specified UART port results in system getting stalled while printing the
message "Uncompressing Linux... done, booting the kernel"
This UART port number is specified through S3C_LOWLEVEL_UART_PORT. Since
the UART port might different for different board, it is not possible to
specify it correctly for every board that use a common defconfig file.
Calling this print subroutine only when DEBUG_LL fixes the problem. By
disabling DEBUG_LL in default config file, we would be able to boot
multiple boards with different default UART ports.
With this current approach, we miss the print "Uncompressing Linux...
done, booting the kernel." when DEBUG_LL is not defined.
Signed-off-by: Tushar Behera <[email protected]>
---
Change for v2:
* Instead of checking value of uart_base, now check if DEBUG_LL
is enabled. This removes the ifdef's from mach/uncompress.h
arch/arm/plat-samsung/include/plat/uncompress.h | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/arch/arm/plat-samsung/include/plat/uncompress.h b/arch/arm/plat-samsung/include/plat/uncompress.h
index 438b248..02b66d7 100644
--- a/arch/arm/plat-samsung/include/plat/uncompress.h
+++ b/arch/arm/plat-samsung/include/plat/uncompress.h
@@ -66,6 +66,9 @@ uart_rd(unsigned int reg)
static void putc(int ch)
{
+ if (!config_enabled(CONFIG_DEBUG_LL))
+ return;
+
if (uart_rd(S3C2410_UFCON) & S3C2410_UFCON_FIFOMODE) {
int level;
@@ -118,7 +121,12 @@ static void arch_decomp_error(const char *x)
#ifdef CONFIG_S3C_BOOT_UART_FORCE_FIFO
static inline void arch_enable_uart_fifo(void)
{
- u32 fifocon = uart_rd(S3C2410_UFCON);
+ u32 fifocon;
+
+ if (!config_enabled(CONFIG_DEBUG_LL))
+ return;
+
+ fifocon = uart_rd(S3C2410_UFCON);
if (!(fifocon & S3C2410_UFCON_FIFOMODE)) {
fifocon |= S3C2410_UFCON_RESETBOTH;
--
1.7.9.5
For mach-exynos, uart_base is a pointer and the value is calculated
in the machine folder. For other machines, uart_base is defined as
a macro in platform directory. For symmetry, the uart_base macro
definition is removed and the uart_base calculation is moved to
specific machine folders.
This would help us consolidating uncompress subroutine for s5p64x0.
Signed-off-by: Tushar Behera <[email protected]>
---
Changes for v2:
* Remove ifdef's while calculating uart_base value.
arch/arm/mach-exynos/include/mach/uncompress.h | 3 ---
arch/arm/mach-s3c24xx/include/mach/uncompress.h | 3 +++
arch/arm/mach-s3c64xx/include/mach/uncompress.h | 3 +++
arch/arm/mach-s5pc100/include/mach/uncompress.h | 2 ++
arch/arm/mach-s5pv210/include/mach/uncompress.h | 2 ++
arch/arm/plat-samsung/include/plat/uncompress.h | 6 ++----
6 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-exynos/include/mach/uncompress.h b/arch/arm/mach-exynos/include/mach/uncompress.h
index 2979995..d405762 100644
--- a/arch/arm/mach-exynos/include/mach/uncompress.h
+++ b/arch/arm/mach-exynos/include/mach/uncompress.h
@@ -15,9 +15,6 @@
#include <asm/mach-types.h>
#include <mach/map.h>
-
-volatile u8 *uart_base;
-
#include <plat/uncompress.h>
static unsigned int __raw_readl(unsigned int ptr)
diff --git a/arch/arm/mach-s3c24xx/include/mach/uncompress.h b/arch/arm/mach-s3c24xx/include/mach/uncompress.h
index 8b283f8..7d2ce20 100644
--- a/arch/arm/mach-s3c24xx/include/mach/uncompress.h
+++ b/arch/arm/mach-s3c24xx/include/mach/uncompress.h
@@ -49,6 +49,9 @@ static void arch_detect_cpu(void)
fifo_mask = S3C2410_UFSTAT_TXMASK;
fifo_max = 15 << S3C2410_UFSTAT_TXSHIFT;
}
+
+ uart_base = (volatile u8 *) S3C_PA_UART +
+ (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT);
}
#endif /* __ASM_ARCH_UNCOMPRESS_H */
diff --git a/arch/arm/mach-s3c64xx/include/mach/uncompress.h b/arch/arm/mach-s3c64xx/include/mach/uncompress.h
index c6a82a2..1c95673 100644
--- a/arch/arm/mach-s3c64xx/include/mach/uncompress.h
+++ b/arch/arm/mach-s3c64xx/include/mach/uncompress.h
@@ -23,6 +23,9 @@ static void arch_detect_cpu(void)
/* we do not need to do any cpu detection here at the moment. */
fifo_mask = S3C2440_UFSTAT_TXMASK;
fifo_max = 63 << S3C2440_UFSTAT_TXSHIFT;
+
+ uart_base = (volatile u8 *)S3C_PA_UART +
+ (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT);
}
#endif /* __ASM_ARCH_UNCOMPRESS_H */
diff --git a/arch/arm/mach-s5pc100/include/mach/uncompress.h b/arch/arm/mach-s5pc100/include/mach/uncompress.h
index 01ccf53..720e133 100644
--- a/arch/arm/mach-s5pc100/include/mach/uncompress.h
+++ b/arch/arm/mach-s5pc100/include/mach/uncompress.h
@@ -23,6 +23,8 @@ static void arch_detect_cpu(void)
/* we do not need to do any cpu detection here at the moment. */
fifo_mask = S3C2440_UFSTAT_TXMASK;
fifo_max = 63 << S3C2440_UFSTAT_TXSHIFT;
+
+ uart_base = (volatile u8 *)S5P_PA_UART(CONFIG_S3C_LOWLEVEL_UART_PORT);
}
#endif /* __ASM_ARCH_UNCOMPRESS_H */
diff --git a/arch/arm/mach-s5pv210/include/mach/uncompress.h b/arch/arm/mach-s5pv210/include/mach/uncompress.h
index ef977ea..231cb07 100644
--- a/arch/arm/mach-s5pv210/include/mach/uncompress.h
+++ b/arch/arm/mach-s5pv210/include/mach/uncompress.h
@@ -21,6 +21,8 @@ static void arch_detect_cpu(void)
/* we do not need to do any cpu detection here at the moment. */
fifo_mask = S5PV210_UFSTAT_TXMASK;
fifo_max = 63 << S5PV210_UFSTAT_TXSHIFT;
+
+ uart_base = (volatile u8 *)S5P_PA_UART(CONFIG_S3C_LOWLEVEL_UART_PORT);
}
#endif /* __ASM_ARCH_UNCOMPRESS_H */
diff --git a/arch/arm/plat-samsung/include/plat/uncompress.h b/arch/arm/plat-samsung/include/plat/uncompress.h
index 02b66d7..2ace0d5 100644
--- a/arch/arm/plat-samsung/include/plat/uncompress.h
+++ b/arch/arm/plat-samsung/include/plat/uncompress.h
@@ -21,6 +21,8 @@ typedef unsigned int upf_t; /* cannot include linux/serial_core.h */
unsigned int fifo_mask;
unsigned int fifo_max;
+volatile u8 *uart_base;
+
/* forward declerations */
static void arch_detect_cpu(void);
@@ -37,10 +39,6 @@ static void arch_detect_cpu(void);
/* how many bytes we allow into the FIFO at a time in FIFO mode */
#define FIFO_MAX (14)
-#ifdef S3C_PA_UART
-#define uart_base S3C_PA_UART + (S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT)
-#endif
-
static __inline__ void
uart_wr(unsigned int reg, unsigned int val)
{
--
1.7.9.5
From: Tomasz Figa <[email protected]>
Since uart_base can be set dynamically in arch_detect_cpu(), there is no
need to have a copy of all code locally, just to override UART base
address.
This patch removes any duplicate code in uncompress.h variant of s5p64x0
and implements proper arch_detect_cpu() function to initialize UART with
SoC-specific parameters.
While at it, replace hard-coded register address with macro.
Signed-off-by: Tomasz Figa <[email protected]>
Signed-off-by: Tushar Behera <[email protected]>
---
(This patch replaces the original patch in this patchset as it was an
earlier-posted near-identical patch.)
Changes for v2:
* Remove the declaration of uart_base (taken care in plat/uncompress.h)
arch/arm/mach-s5p64x0/include/mach/uncompress.h | 162 +----------------------
1 file changed, 6 insertions(+), 156 deletions(-)
diff --git a/arch/arm/mach-s5p64x0/include/mach/uncompress.h b/arch/arm/mach-s5p64x0/include/mach/uncompress.h
index 19e0d64..bc04bd5 100644
--- a/arch/arm/mach-s5p64x0/include/mach/uncompress.h
+++ b/arch/arm/mach-s5p64x0/include/mach/uncompress.h
@@ -14,171 +14,21 @@
#define __ASM_ARCH_UNCOMPRESS_H
#include <mach/map.h>
+#include <plat/uncompress.h>
-/*
- * cannot use commonly <plat/uncompress.h>
- * because uart base of S5P6440 and S5P6450 is different
- */
-
-typedef unsigned int upf_t; /* cannot include linux/serial_core.h */
-
-/* uart setup */
-
-unsigned int fifo_mask;
-unsigned int fifo_max;
-
-/* forward declerations */
-
-static void arch_detect_cpu(void);
-
-/* defines for UART registers */
-
-#include <plat/regs-serial.h>
-#include <plat/regs-watchdog.h>
-
-/* working in physical space... */
-#undef S3C2410_WDOGREG
-#define S3C2410_WDOGREG(x) ((S3C24XX_PA_WATCHDOG + (x)))
-
-/* how many bytes we allow into the FIFO at a time in FIFO mode */
-#define FIFO_MAX (14)
-
-unsigned long uart_base;
-
-static __inline__ void get_uart_base(void)
+static void arch_detect_cpu(void)
{
unsigned int chipid;
chipid = *(const volatile unsigned int __force *) 0xE0100118;
- uart_base = S3C_UART_OFFSET * CONFIG_S3C_LOWLEVEL_UART_PORT;
-
if ((chipid & 0xff000) == 0x50000)
- uart_base += 0xEC800000;
+ uart_base = S5P6450_PA_UART(CONFIG_S3C_LOWLEVEL_UART_PORT);
else
- uart_base += 0xEC000000;
-}
-
-static __inline__ void uart_wr(unsigned int reg, unsigned int val)
-{
- volatile unsigned int *ptr;
-
- get_uart_base();
- ptr = (volatile unsigned int *)(reg + uart_base);
- *ptr = val;
-}
-
-static __inline__ unsigned int uart_rd(unsigned int reg)
-{
- volatile unsigned int *ptr;
-
- get_uart_base();
- ptr = (volatile unsigned int *)(reg + uart_base);
- return *ptr;
-}
-
-/*
- * we can deal with the case the UARTs are being run
- * in FIFO mode, so that we don't hold up our execution
- * waiting for tx to happen...
- */
-
-static void putc(int ch)
-{
- if (uart_rd(S3C2410_UFCON) & S3C2410_UFCON_FIFOMODE) {
- int level;
-
- while (1) {
- level = uart_rd(S3C2410_UFSTAT);
- level &= fifo_mask;
-
- if (level < fifo_max)
- break;
- }
-
- } else {
- /* not using fifos */
-
- while ((uart_rd(S3C2410_UTRSTAT) & S3C2410_UTRSTAT_TXE) != S3C2410_UTRSTAT_TXE)
- barrier();
- }
+ uart_base = S5P6440_PA_UART(CONFIG_S3C_LOWLEVEL_UART_PORT);
- /* write byte to transmission register */
- uart_wr(S3C2410_UTXH, ch);
-}
-
-static inline void flush(void)
-{
-}
-
-#define __raw_writel(d, ad) \
- do { \
- *((volatile unsigned int __force *)(ad)) = (d); \
- } while (0)
-
-
-#ifdef CONFIG_S3C_BOOT_ERROR_RESET
-
-static void arch_decomp_error(const char *x)
-{
- putstr("\n\n");
- putstr(x);
- putstr("\n\n -- System resetting\n");
-
- __raw_writel(0x4000, S3C2410_WTDAT);
- __raw_writel(0x4000, S3C2410_WTCNT);
- __raw_writel(S3C2410_WTCON_ENABLE | S3C2410_WTCON_DIV128 | S3C2410_WTCON_RSTEN | S3C2410_WTCON_PRESCALE(0x40), S3C2410_WTCON);
-
- while(1);
-}
-
-#define arch_error arch_decomp_error
-#endif
-
-#ifdef CONFIG_S3C_BOOT_UART_FORCE_FIFO
-static inline void arch_enable_uart_fifo(void)
-{
- u32 fifocon = uart_rd(S3C2410_UFCON);
-
- if (!(fifocon & S3C2410_UFCON_FIFOMODE)) {
- fifocon |= S3C2410_UFCON_RESETBOTH;
- uart_wr(S3C2410_UFCON, fifocon);
-
- /* wait for fifo reset to complete */
- while (1) {
- fifocon = uart_rd(S3C2410_UFCON);
- if (!(fifocon & S3C2410_UFCON_RESETBOTH))
- break;
- }
- }
-}
-#else
-#define arch_enable_uart_fifo() do { } while(0)
-#endif
-
-static void arch_decomp_setup(void)
-{
- /*
- * we may need to setup the uart(s) here if we are not running
- * on an BAST... the BAST will have left the uarts configured
- * after calling linux.
- */
-
- arch_detect_cpu();
-
- /*
- * Enable the UART FIFOs if they where not enabled and our
- * configuration says we should turn them on.
- */
-
- arch_enable_uart_fifo();
-}
-
-
-
-static void arch_detect_cpu(void)
-{
- /* we do not need to do any cpu detection here at the moment. */
+ fifo_mask = S3C2440_UFSTAT_TXMASK;
+ fifo_max = 63 << S3C2440_UFSTAT_TXSHIFT;
}
#endif /* __ASM_ARCH_UNCOMPRESS_H */
--
1.7.9.5
On 06/04/2013 09:49 AM, Tushar Behera wrote:
> Printing low-level debug messages make an assumption that the specified
> UART port has been preconfigured by the bootloader. Incorrectly
> specified UART port results in system getting stalled while printing the
> message "Uncompressing Linux... done, booting the kernel"
> This UART port number is specified through S3C_LOWLEVEL_UART_PORT. Since
> the UART port might different for different board, it is not possible to
> specify it correctly for every board that use a common defconfig file.
>
> Calling this print subroutine only when DEBUG_LL fixes the problem. By
> disabling DEBUG_LL in default config file, we would be able to boot
> multiple boards with different default UART ports.
>
> With this current approach, we miss the print "Uncompressing Linux...
> done, booting the kernel." when DEBUG_LL is not defined.
>
> Signed-off-by: Tushar Behera <[email protected]>
> ---
> Change for v2:
> * Instead of checking value of uart_base, now check if DEBUG_LL
> is enabled. This removes the ifdef's from mach/uncompress.h
>
>
> arch/arm/plat-samsung/include/plat/uncompress.h | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
If there are no concerns, would it be possible to queue this patch [1/3]
for 3.10?
The other two patches can wait for 3.11.
--
Tushar Behera
On Thu, Jun 06, 2013 at 02:37:01PM +0530, Tushar Behera wrote:
> On 06/04/2013 09:49 AM, Tushar Behera wrote:
> > Printing low-level debug messages make an assumption that the specified
> > UART port has been preconfigured by the bootloader. Incorrectly
> > specified UART port results in system getting stalled while printing the
> > message "Uncompressing Linux... done, booting the kernel"
> > This UART port number is specified through S3C_LOWLEVEL_UART_PORT. Since
> > the UART port might different for different board, it is not possible to
> > specify it correctly for every board that use a common defconfig file.
> >
> > Calling this print subroutine only when DEBUG_LL fixes the problem. By
> > disabling DEBUG_LL in default config file, we would be able to boot
> > multiple boards with different default UART ports.
> >
> > With this current approach, we miss the print "Uncompressing Linux...
> > done, booting the kernel." when DEBUG_LL is not defined.
> >
> > Signed-off-by: Tushar Behera <[email protected]>
> > ---
> > Change for v2:
> > * Instead of checking value of uart_base, now check if DEBUG_LL
> > is enabled. This removes the ifdef's from mach/uncompress.h
> >
> >
> > arch/arm/plat-samsung/include/plat/uncompress.h | 10 +++++++++-
> > 1 file changed, 9 insertions(+), 1 deletion(-)
> >
>
> If there are no concerns, would it be possible to queue this patch [1/3]
> for 3.10?
>
> The other two patches can wait for 3.11.
Sure, I've applied it to fixes for 3.10.
-Olof
On 06/04/2013 09:49 AM, Tushar Behera wrote:
> For mach-exynos, uart_base is a pointer and the value is calculated
> in the machine folder. For other machines, uart_base is defined as
> a macro in platform directory. For symmetry, the uart_base macro
> definition is removed and the uart_base calculation is moved to
> specific machine folders.
>
> This would help us consolidating uncompress subroutine for s5p64x0.
>
> Signed-off-by: Tushar Behera <[email protected]>
> ---
> Changes for v2:
> * Remove ifdef's while calculating uart_base value.
>
Kukjin,
Would you please queue this up for 3.11?
Thanks.
--
Tushar Behera
On 06/04/2013 09:49 AM, Tushar Behera wrote:
> From: Tomasz Figa <[email protected]>
>
> Since uart_base can be set dynamically in arch_detect_cpu(), there is no
> need to have a copy of all code locally, just to override UART base
> address.
>
> This patch removes any duplicate code in uncompress.h variant of s5p64x0
> and implements proper arch_detect_cpu() function to initialize UART with
> SoC-specific parameters.
>
> While at it, replace hard-coded register address with macro.
>
> Signed-off-by: Tomasz Figa <[email protected]>
> Signed-off-by: Tushar Behera <[email protected]>
> ---
> (This patch replaces the original patch in this patchset as it was an
> earlier-posted near-identical patch.)
>
> Changes for v2:
> * Remove the declaration of uart_base (taken care in plat/uncompress.h)
>
Kukjin,
Would you please queue this up for 3.11?
Thanks.
--
Tushar Behera
On 06/13/13 15:04, Tushar Behera wrote:
> On 06/04/2013 09:49 AM, Tushar Behera wrote:
>> For mach-exynos, uart_base is a pointer and the value is calculated
>> in the machine folder. For other machines, uart_base is defined as
>> a macro in platform directory. For symmetry, the uart_base macro
>> definition is removed and the uart_base calculation is moved to
>> specific machine folders.
>>
>> This would help us consolidating uncompress subroutine for s5p64x0.
>>
>> Signed-off-by: Tushar Behera<[email protected]>
>> ---
>> Changes for v2:
>> * Remove ifdef's while calculating uart_base value.
>>
>
> Kukjin,
>
> Would you please queue this up for 3.11?
>
Sure, applied this and 3rd for 3.11.
Thanks,
- Kukjin