All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] arm:samsung:serial: Extract common Samsung UART code
@ 2013-07-21 21:50 Lukasz Majewski
  2013-07-25 21:43 ` [U-Boot] [PATCH v2] arm:samsung:serial Extract common " Lukasz Majewski
  2013-08-12 21:15 ` [U-Boot] [PATCH v3 0/3] arm:exynos:cleanup: Extract common code Lukasz Majewski
  0 siblings, 2 replies; 14+ messages in thread
From: Lukasz Majewski @ 2013-07-21 21:50 UTC (permalink / raw)
  To: u-boot

This commit removes duplicated code for UART IP block embedded at Samsung
SoCs.
New ./include/asm/samsung-common directory has been created to store
common code for existing and future Samsung targets.

Additionally building of UART code now depends on more verbose
CONFIG_S5P_SERIAL define.
For this reason all relevant configs have been adjusted.

Signed-off-by: Lukasz Majewski <l.majewski@majess.pl>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 arch/arm/include/asm/arch-exynos/uart.h    |   58 ------------------
 arch/arm/include/asm/arch-s5pc1xx/uart.h   |   58 ------------------
 arch/arm/include/asm/samsung-common/uart.h |   88 ++++++++++++++++++++++++++++
 drivers/serial/Makefile                    |    2 +-
 drivers/serial/serial_s5p.c                |   13 +---
 include/configs/exynos5250-dt.h            |    1 +
 include/configs/origen.h                   |    1 +
 include/configs/s5p_goni.h                 |    1 +
 include/configs/s5pc210_universal.h        |    1 +
 include/configs/smdkc100.h                 |    1 +
 include/configs/smdkv310.h                 |    1 +
 include/configs/trats.h                    |    1 +
 12 files changed, 98 insertions(+), 128 deletions(-)
 delete mode 100644 arch/arm/include/asm/arch-exynos/uart.h
 delete mode 100644 arch/arm/include/asm/arch-s5pc1xx/uart.h
 create mode 100644 arch/arm/include/asm/samsung-common/uart.h

diff --git a/arch/arm/include/asm/arch-exynos/uart.h b/arch/arm/include/asm/arch-exynos/uart.h
deleted file mode 100644
index 6cc68df..0000000
--- a/arch/arm/include/asm/arch-exynos/uart.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * (C) Copyright 2009 Samsung Electronics
- * Minkyu Kang <mk7.kang@samsung.com>
- * Heungjun Kim <riverful.kim@samsung.com>
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- */
-
-#ifndef __ASM_ARCH_UART_H_
-#define __ASM_ARCH_UART_H_
-
-#ifndef __ASSEMBLY__
-/* baudrate rest value */
-union br_rest {
-	unsigned short	slot;		/* udivslot */
-	unsigned char	value;		/* ufracval */
-};
-
-struct s5p_uart {
-	unsigned int	ulcon;
-	unsigned int	ucon;
-	unsigned int	ufcon;
-	unsigned int	umcon;
-	unsigned int	utrstat;
-	unsigned int	uerstat;
-	unsigned int	ufstat;
-	unsigned int	umstat;
-	unsigned char	utxh;
-	unsigned char	res1[3];
-	unsigned char	urxh;
-	unsigned char	res2[3];
-	unsigned int	ubrdiv;
-	union br_rest	rest;
-	unsigned char	res3[0xffd0];
-};
-
-static inline int s5p_uart_divslot(void)
-{
-	return 0;
-}
-
-#endif	/* __ASSEMBLY__ */
-
-#endif
diff --git a/arch/arm/include/asm/arch-s5pc1xx/uart.h b/arch/arm/include/asm/arch-s5pc1xx/uart.h
deleted file mode 100644
index 1c56739..0000000
--- a/arch/arm/include/asm/arch-s5pc1xx/uart.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * (C) Copyright 2009 Samsung Electronics
- * Minkyu Kang <mk7.kang@samsung.com>
- * Heungjun Kim <riverful.kim@samsung.com>
- *
- * 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- */
-
-#ifndef __ASM_ARCH_UART_H_
-#define __ASM_ARCH_UART_H_
-
-#ifndef __ASSEMBLY__
-/* baudrate rest value */
-union br_rest {
-	unsigned short	slot;		/* udivslot */
-	unsigned char	value;		/* ufracval */
-};
-
-struct s5p_uart {
-	unsigned int	ulcon;
-	unsigned int	ucon;
-	unsigned int	ufcon;
-	unsigned int	umcon;
-	unsigned int	utrstat;
-	unsigned int	uerstat;
-	unsigned int	ufstat;
-	unsigned int	umstat;
-	unsigned char	utxh;
-	unsigned char	res1[3];
-	unsigned char	urxh;
-	unsigned char	res2[3];
-	unsigned int	ubrdiv;
-	union br_rest	rest;
-	unsigned char	res3[0x3d0];
-};
-
-static inline int s5p_uart_divslot(void)
-{
-	return 1;
-}
-
-#endif	/* __ASSEMBLY__ */
-
-#endif
diff --git a/arch/arm/include/asm/samsung-common/uart.h b/arch/arm/include/asm/samsung-common/uart.h
new file mode 100644
index 0000000..3b6572d
--- /dev/null
+++ b/arch/arm/include/asm/samsung-common/uart.h
@@ -0,0 +1,88 @@
+/*
+ * (C) Copyright 2009 Samsung Electronics
+ * Minkyu Kang <mk7.kang@samsung.com>
+ * Heungjun Kim <riverful.kim@samsung.com>
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ASM_ARCH_UART_H_
+#define __ASM_ARCH_UART_H_
+
+#ifndef __ASSEMBLY__
+/* baudrate rest value */
+union br_rest {
+	unsigned short	slot;		/* udivslot */
+	unsigned char	value;		/* ufracval */
+};
+
+struct s5p_uart {
+	unsigned int	ulcon;
+	unsigned int	ucon;
+	unsigned int	ufcon;
+	unsigned int	umcon;
+	unsigned int	utrstat;
+	unsigned int	uerstat;
+	unsigned int	ufstat;
+	unsigned int	umstat;
+	unsigned char	utxh;
+	unsigned char	res1[3];
+	unsigned char	urxh;
+	unsigned char	res2[3];
+	unsigned int	ubrdiv;
+	union br_rest	rest;
+#if defined(CONFIG_S5PC100) ||     \
+	defined(CONFIG_S5PC110) || \
+	defined(CONFIG_S3C64XX)
+	unsigned char	res3[0x3d0];
+#else /* Exynos 4 and 5 */
+	unsigned char	res3[0xffd0];
+#endif
+};
+
+
+static inline int s5p_uart_divslot(void)
+{
+#if defined(CONFIG_S5PC100) ||     \
+	defined(CONFIG_S5PC110) || \
+	defined(CONFIG_S3C64XX)
+	return 1;
+#else /* Exynos 4 and 5 */
+	return 0;
+#endif
+}
+
+#if defined(CONFIG_S3C64XX)
+#define RX_FIFO_COUNT_MASK	0x3f
+#define RX_FIFO_FULL_MASK	(1 << 6)
+#define TX_FIFO_FULL_MASK	(1 << 14)
+#else /* S5PC110 and Exynos 4 and 5 */
+#define RX_FIFO_COUNT_MASK      0xff
+#define RX_FIFO_FULL_MASK       (1 << 8)
+#define TX_FIFO_FULL_MASK       (1 << 24)
+#endif
+
+/* Information about a serial port */
+struct fdt_serial {
+	u32 base_addr;  /* address of registers in physical memory */
+	u8 port_id;     /* uart port number */
+	u8 enabled;     /* 1 if enabled, 0 if disabled */
+};
+
+#endif	/* __ASSEMBLY__ */
+
+#endif
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index 0f954a5..4c4ba75 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -35,7 +35,7 @@ COBJS-$(CONFIG_LPC32XX_HSUART) += lpc32xx_hsuart.o
 COBJS-$(CONFIG_MCFUART) += mcfuart.o
 COBJS-$(CONFIG_OPENCORES_YANU) += opencores_yanu.o
 COBJS-$(CONFIG_SYS_NS16550) += ns16550.o
-COBJS-$(CONFIG_S5P) += serial_s5p.o
+COBJS-$(CONFIG_S5P_SERIAL) += serial_s5p.o
 COBJS-$(CONFIG_SYS_NS16550_SERIAL) += serial_ns16550.o
 COBJS-$(CONFIG_IMX_SERIAL) += serial_imx.o
 COBJS-$(CONFIG_IXP_SERIAL) += serial_ixp.o
diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c
index 6836c7a..fb0677b 100644
--- a/drivers/serial/serial_s5p.c
+++ b/drivers/serial/serial_s5p.c
@@ -25,22 +25,13 @@
 #include <fdtdec.h>
 #include <linux/compiler.h>
 #include <asm/io.h>
-#include <asm/arch/uart.h>
+#include <asm/samsung-common/uart.h>
 #include <asm/arch/clk.h>
 #include <serial.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#define RX_FIFO_COUNT_MASK	0xff
-#define RX_FIFO_FULL_MASK	(1 << 8)
-#define TX_FIFO_FULL_MASK	(1 << 24)
-
-/* Information about a serial port */
-struct fdt_serial {
-	u32 base_addr;  /* address of registers in physical memory */
-	u8 port_id;     /* uart port number */
-	u8 enabled;     /* 1 if enabled, 0 if disabled */
-} config __attribute__ ((section(".data")));
+struct fdt_serial config __attribute__ ((section(".data")));
 
 static inline struct s5p_uart *s5p_get_base_uart(int dev_index)
 {
diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h
index 582c584..303a8de 100644
--- a/include/configs/exynos5250-dt.h
+++ b/include/configs/exynos5250-dt.h
@@ -86,6 +86,7 @@
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (4 << 20))
 
 /* select serial console configuration */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_BAUDRATE			115200
 #define EXYNOS5_DEFAULT_UART_OFFSET	0x010000
 #define CONFIG_SILENT_CONSOLE
diff --git a/include/configs/origen.h b/include/configs/origen.h
index 5013aee..7197243 100644
--- a/include/configs/origen.h
+++ b/include/configs/origen.h
@@ -64,6 +64,7 @@
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20))
 
 /* select serial console configuration */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL2			1	/* use SERIAL 2 */
 #define CONFIG_BAUDRATE			115200
 #define EXYNOS4_DEFAULT_UART_OFFSET	0x020000
diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 56e8347..440c4a3 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -58,6 +58,7 @@
 /*
  * select serial console configuration
  */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL2			1	/* use SERIAL2 */
 #define CONFIG_BAUDRATE			115200
 
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index eb13bb3..398db2a 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -64,6 +64,7 @@
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20))
 
 /* select serial console configuration */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL2		1	/* use SERIAL 2 */
 #define CONFIG_BAUDRATE		115200
 
diff --git a/include/configs/smdkc100.h b/include/configs/smdkc100.h
index fb640db..6964a77 100644
--- a/include/configs/smdkc100.h
+++ b/include/configs/smdkc100.h
@@ -63,6 +63,7 @@
 /*
  * select serial console configuration
  */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL0			1	/* use SERIAL 0 on SMDKC100 */
 
 /* PWM */
diff --git a/include/configs/smdkv310.h b/include/configs/smdkv310.h
index 0f04597..3c68543 100644
--- a/include/configs/smdkv310.h
+++ b/include/configs/smdkv310.h
@@ -64,6 +64,7 @@
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20))
 
 /* select serial console configuration */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL1			1	/* use SERIAL 1 */
 #define CONFIG_BAUDRATE			115200
 #define EXYNOS4_DEFAULT_UART_OFFSET	0x010000
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 356d87b..e9c1fa4 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -69,6 +69,7 @@
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (16 << 20))
 
 /* select serial console configuration */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL2			/* use SERIAL 2 */
 #define CONFIG_BAUDRATE			115200
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-09-24 10:11 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-21 21:50 [U-Boot] [PATCH] arm:samsung:serial: Extract common Samsung UART code Lukasz Majewski
2013-07-25 21:43 ` [U-Boot] [PATCH v2] arm:samsung:serial Extract common " Lukasz Majewski
2013-08-12 21:15 ` [U-Boot] [PATCH v3 0/3] arm:exynos:cleanup: Extract common code Lukasz Majewski
2013-08-12 21:15   ` [U-Boot] [PATCH v3 1/3] arm:samsung:serial Extract common UART code Lukasz Majewski
2013-08-16  7:16     ` Lukasz Majewski
2013-08-28 10:11     ` Minkyu Kang
2013-08-28 21:01       ` Lukasz Majewski
2013-09-12 19:43         ` Lukasz Majewski
2013-09-13  2:45         ` Chander Kashyap
2013-09-24  8:42         ` Minkyu Kang
2013-09-24 10:11           ` Lukasz Majewski
2013-08-12 21:15   ` [U-Boot] [PATCH v3 2/3] arm:samsung: Move common code from ./s5p-common to ./samsung-common/ Lukasz Majewski
2013-08-12 21:15   ` [U-Boot] [PATCH v3 3/3] arm:samsung:cpu_info: Rename s5p_* to samsung_* Lukasz Majewski
2013-08-22 10:55   ` [U-Boot] [PATCH v3 0/3] arm:exynos:cleanup: Extract common code Lukasz Majewski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.