[PATCH 09/18] Samsung/serial: move the decision about an improved UART into Kconfig
Juergen Beisert
jbe at pengutronix.de
Fri Jul 13 15:01:01 EDT 2012
More or less just cosmetic (removing ifdefs!).
Signed-off-by: Juergen Beisert <jbe at pengutronix.de>
---
arch/arm/mach-samsung/Kconfig | 5 +++++
arch/arm/mach-samsung/include/mach/s5pcxx-iomap.h | 2 --
drivers/serial/serial_s3c.c | 16 ++++++++--------
3 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/arch/arm/mach-samsung/Kconfig b/arch/arm/mach-samsung/Kconfig
index 90cda30..28bbc97 100644
--- a/arch/arm/mach-samsung/Kconfig
+++ b/arch/arm/mach-samsung/Kconfig
@@ -20,6 +20,9 @@ config ARCH_BAREBOX_MAX_BARE_INIT_SIZE
hex
default 0x1ff0 if ARCH_S5PCxx
+config SAMSUNG_IMPROVED_UART
+ bool
+
if ARCH_S3C24xx
config CPU_S3C2410
@@ -89,9 +92,11 @@ endif
if ARCH_S5PCxx
config CPU_S5PC110
+ select SAMSUNG_IMPROVED_UART
bool
config CPU_S5PV210
+ select SAMSUNG_IMPROVED_UART
bool
choice
diff --git a/arch/arm/mach-samsung/include/mach/s5pcxx-iomap.h b/arch/arm/mach-samsung/include/mach/s5pcxx-iomap.h
index 248f868..448e3b8 100644
--- a/arch/arm/mach-samsung/include/mach/s5pcxx-iomap.h
+++ b/arch/arm/mach-samsung/include/mach/s5pcxx-iomap.h
@@ -45,8 +45,6 @@
#define S3C_UART2_SIZE 0x400
#define S3C_UART3_BASE (S3C_UART_BASE + 0x800)
#define S3C_UART3_SIZE 0x400
-#define S3C_UART_HAS_UBRDIVSLOT
-#define S3C_UART_HAS_UINTM
#define S5P_DMC0_BASE 0xF0000000
#define S5P_DMC1_BASE 0xF1400000
diff --git a/drivers/serial/serial_s3c.c b/drivers/serial/serial_s3c.c
index a2b8e56..8736f0b 100644
--- a/drivers/serial/serial_s3c.c
+++ b/drivers/serial/serial_s3c.c
@@ -74,10 +74,11 @@ static int s3c_serial_setbaudrate(struct console_device *cdev, int baudrate)
void __iomem *base = priv->regs;
unsigned val;
-#ifdef S3C_UART_HAS_UBRDIVSLOT
- val = s3c_get_arch_uart_input_clock(base) / baudrate;
- writew(udivslot_table[val & 15], base + UBRDIVSLOT);
-#endif
+ if (IS_ENABLED(CONFIG_SAMSUNG_IMPROVED_UART)) {
+ val = s3c_get_arch_uart_input_clock(base) / baudrate;
+ writew(udivslot_table[val & 15], base + UBRDIVSLOT);
+ }
+
val = s3c_get_arch_uart_input_clock(base) / (16 * baudrate) - 1;
writew(val, base + UBRDIV);
@@ -101,10 +102,9 @@ static int s3c_serial_init_port(struct console_device *cdev)
writew(0x0245 | UCON_SET_CLK_SRC(CONFIG_DRIVER_SERIAL_S3C_CLK),
base + UCON);
-#ifdef S3C_UART_HAS_UINTM
- /* 'interrupt or polling mode' for both directions */
- writeb(0xf, base + UINTM);
-#endif
+ if (IS_ENABLED(CONFIG_SAMSUNG_IMPROVED_UART))
+ /* 'interrupt or polling mode' for both directions */
+ writeb(0xf, base + UINTM);
if (IS_ENABLED(CONFIG_DRIVER_SERIAL_S3C_AUTOSYNC))
writeb(0x10, base + UMCON); /* enable auto flow control */
--
1.7.10.4
More information about the barebox
mailing list