Skip to contentSkip to conversation

arm:samsung:serial: Extract common Samsung UART code

PATCH Superseded Lukasz Majewski 4 participants 14 messages Jul 21, 2013 – Sep 24, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm:samsung:serial: Extract common Samsung UART code

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.

---
 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
arch/arm/include/asm/arch-exynos/uart.h deleted +0 -58
deleted file mode 100644
index 6cc68df..0000000
@@ -1,58 +0,0 @@
-/*
- * (C) Copyright 2009 Samsung Electronics
- * Minkyu Kang <[email protected]>
- * Heungjun Kim <[email protected]>
- *
- * 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
arch/arm/include/asm/arch-s5pc1xx/uart.h deleted +0 -58

58 lines not on this page · raw message

arch/arm/include/asm/samsung-common/uart.h new file +88 -0

88 lines not on this page · raw message

drivers/serial/Makefile +1 -1
index 0f954a5..4c4ba75 100644
@@ -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
drivers/serial/serial_s5p.c +2 -11
index 6836c7a..fb0677b 100644
@@ -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)
 {
include/configs/exynos5250-dt.h +1 -0
index 582c584..303a8de 100644
@@ -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
include/configs/origen.h +1 -0
index 5013aee..7197243 100644
@@ -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
include/configs/s5p_goni.h +1 -0
index 56e8347..440c4a3 100644
@@ -58,6 +58,7 @@
 /*
  * select serial console configuration
  */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL2			1	/* use SERIAL2 */
 #define CONFIG_BAUDRATE			115200
 
include/configs/s5pc210_universal.h +1 -0
index eb13bb3..398db2a 100644
@@ -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
 
include/configs/smdkc100.h +1 -0
index fb640db..6964a77 100644
@@ -63,6 +63,7 @@
 /*
  * select serial console configuration
  */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL0			1	/* use SERIAL 0 on SMDKC100 */
 
 /* PWM */
include/configs/smdkv310.h +1 -0
index 0f04597..3c68543 100644
@@ -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
include/configs/trats.h +1 -0
index 356d87b..e9c1fa4 100644
@@ -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
 
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH v2 1/1 arm:samsung:serial Extract common UART code

This commit brings removal of 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.

Moreover building of UART code now depends on more verbose CONFIG_S5P_SERIAL. Thereof all relevant boards configs have been adjusted.

---
Changes for v2:
- Remove S3C64XX define from the code

---
 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 |   78 ++++++++++++++++++++++++++++
 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, 88 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
arch/arm/include/asm/arch-exynos/uart.h deleted +0 -58
deleted file mode 100644
index 6cc68df..0000000
@@ -1,58 +0,0 @@
-/*
- * (C) Copyright 2009 Samsung Electronics
- * Minkyu Kang <[email protected]>
- * Heungjun Kim <[email protected]>
- *
- * 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
arch/arm/include/asm/arch-s5pc1xx/uart.h deleted +0 -58

58 lines not on this page · raw message

arch/arm/include/asm/samsung-common/uart.h new file +78 -0

78 lines not on this page · raw message

drivers/serial/Makefile +1 -1
index 0f954a5..4c4ba75 100644
@@ -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
drivers/serial/serial_s5p.c +2 -11
index 6836c7a..fb0677b 100644
@@ -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)
 {
include/configs/exynos5250-dt.h +1 -0
index 582c584..303a8de 100644
@@ -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
include/configs/origen.h +1 -0
index 5013aee..7197243 100644
@@ -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
include/configs/s5p_goni.h +1 -0
index 56e8347..440c4a3 100644
@@ -58,6 +58,7 @@
 /*
  * select serial console configuration
  */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL2			1	/* use SERIAL2 */
 #define CONFIG_BAUDRATE			115200
 
include/configs/s5pc210_universal.h +1 -0
index eb13bb3..398db2a 100644
@@ -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
 
include/configs/smdkc100.h +1 -0
index fb640db..6964a77 100644
@@ -63,6 +63,7 @@
 /*
  * select serial console configuration
  */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL0			1	/* use SERIAL 0 on SMDKC100 */
 
 /* PWM */
include/configs/smdkv310.h +1 -0
index 0f04597..3c68543 100644
@@ -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
include/configs/trats.h +1 -0
index 356d87b..e9c1fa4 100644
@@ -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
 
Signature · 1 line
1.7.10.4
#2 lore raw

v3 cover arm:exynos:cleanup: Extract common code

In reply to Lukasz Majewski

This series of commits attempts to clean-up the Exynos3/4 code. Common code for Exynos3 (S5PV210) and Exynos4 has been extracted.

Moreover it will facilitate support for older Samsung targets - like venerable s3c6410 (arm1176) SoC.

Lukasz Majewski (3):
arm:samsung:serial Extract common UART code
arm:samsung: Move common code from ./s5p-common to ./samsung-common/ arm:samsung:cpu_info: Rename s5p_* to samsung_*

 Makefile                                    |    7 +-
 arch/arm/cpu/armv7/exynos/pinmux.c          |    2 +-
 arch/arm/cpu/armv7/s5p-common/Makefile      |   34 ------
 arch/arm/cpu/armv7/s5p-common/cpu_info.c    |   41 -------
 arch/arm/cpu/armv7/s5p-common/pwm.c         |  171 --------------------------
 arch/arm/cpu/armv7/s5p-common/sromc.c       |   33 -----
 arch/arm/cpu/armv7/s5p-common/timer.c       |  132 --------------------
 arch/arm/cpu/samsung-common/Makefile        |   30 +++++
 arch/arm/cpu/samsung-common/cpu_info.c      |   40 +++++++
 arch/arm/cpu/samsung-common/pwm.c           |  172 +++++++++++++++++++++++++++
 arch/arm/cpu/samsung-common/sromc.c         |   33 +++++
 arch/arm/cpu/samsung-common/timer.c         |  131 ++++++++++++++++++++
 arch/arm/include/asm/arch-exynos/cpu.h      |   24 ++--
 arch/arm/include/asm/arch-exynos/pwm.h      |   55 ---------
 arch/arm/include/asm/arch-exynos/sromc.h    |   55 ---------
 arch/arm/include/asm/arch-exynos/uart.h     |   44 -------
 arch/arm/include/asm/arch-s5pc1xx/cpu.h     |   12 +-
 arch/arm/include/asm/arch-s5pc1xx/pwm.h     |   55 ---------
 arch/arm/include/asm/arch-s5pc1xx/sromc.h   |   40 -------
 arch/arm/include/asm/arch-s5pc1xx/uart.h    |   44 -------
 arch/arm/include/asm/samsung-common/pwm.h   |   55 +++++++++
 arch/arm/include/asm/samsung-common/sromc.h |   60 ++++++++++
 arch/arm/include/asm/samsung-common/uart.h  |   64 ++++++++++
 board/samsung/smdk5250/exynos5-dt.c         |    2 +-
 board/samsung/smdkc100/smdkc100.c           |   11 +-
 board/samsung/smdkv310/smdkv310.c           |    2 +-
 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 +
 spl/Makefile                                |    2 +-
 36 files changed, 626 insertions(+), 747 deletions(-)
 delete mode 100644 arch/arm/cpu/armv7/s5p-common/Makefile
 delete mode 100644 arch/arm/cpu/armv7/s5p-common/cpu_info.c
 delete mode 100644 arch/arm/cpu/armv7/s5p-common/pwm.c
 delete mode 100644 arch/arm/cpu/armv7/s5p-common/sromc.c
 delete mode 100644 arch/arm/cpu/armv7/s5p-common/timer.c
 create mode 100644 arch/arm/cpu/samsung-common/Makefile
 create mode 100644 arch/arm/cpu/samsung-common/cpu_info.c
 create mode 100644 arch/arm/cpu/samsung-common/pwm.c
 create mode 100644 arch/arm/cpu/samsung-common/sromc.c
 create mode 100644 arch/arm/cpu/samsung-common/timer.c
 delete mode 100644 arch/arm/include/asm/arch-exynos/pwm.h
 delete mode 100644 arch/arm/include/asm/arch-exynos/sromc.h
 delete mode 100644 arch/arm/include/asm/arch-exynos/uart.h
 delete mode 100644 arch/arm/include/asm/arch-s5pc1xx/pwm.h
 delete mode 100644 arch/arm/include/asm/arch-s5pc1xx/sromc.h
 delete mode 100644 arch/arm/include/asm/arch-s5pc1xx/uart.h
 create mode 100644 arch/arm/include/asm/samsung-common/pwm.h
 create mode 100644 arch/arm/include/asm/samsung-common/sromc.h
 create mode 100644 arch/arm/include/asm/samsung-common/uart.h
Signature · 1 line
1.7.10.4
#3 lore raw

PATCH v3 1/3 arm:samsung:serial Extract common UART code

This commit brings removal of 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.

Moreover building of UART code now depends on more verbose CONFIG_S5P_SERIAL. Thereof all relevant boards configs have been adjusted.

---
Changes for v3:
- Comply with SPDX license format

Changes for v2:
- Remove S3C64XX define from the code

---
 arch/arm/include/asm/arch-exynos/uart.h    |   44 -------------------
 arch/arm/include/asm/arch-s5pc1xx/uart.h   |   44 -------------------
 arch/arm/include/asm/samsung-common/uart.h |   64 ++++++++++++++++++++++++++++
 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, 74 insertions(+), 100 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
arch/arm/include/asm/arch-exynos/uart.h deleted +0 -44
deleted file mode 100644
index 33d6ba3..0000000
@@ -1,44 +0,0 @@
-/*
- * (C) Copyright 2009 Samsung Electronics
- * Minkyu Kang <[email protected]>
- * Heungjun Kim <[email protected]>
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#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
arch/arm/include/asm/arch-s5pc1xx/uart.h deleted +0 -44

44 lines not on this page · raw message

arch/arm/include/asm/samsung-common/uart.h new file +64 -0

64 lines not on this page · raw message

drivers/serial/Makefile +1 -1
index 697f2bb..e3ca49a 100644
@@ -19,7 +19,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
drivers/serial/serial_s5p.c +2 -11
index f98b422..be08925 100644
@@ -12,22 +12,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)
 {
include/configs/exynos5250-dt.h +1 -0
index 8f8f85f..a759d07 100644
@@ -69,6 +69,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
include/configs/origen.h +1 -0
index da13574..a59419d 100644
@@ -48,6 +48,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
include/configs/s5p_goni.h +1 -0
index d0fafd7..812b7f3 100644
@@ -42,6 +42,7 @@
 /*
  * select serial console configuration
  */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL2			1	/* use SERIAL2 */
 #define CONFIG_BAUDRATE			115200
 
include/configs/s5pc210_universal.h +1 -0
index 97a4008..2270449 100644
@@ -48,6 +48,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
 
include/configs/smdkc100.h +1 -0
index a572e62..4631dac 100644
@@ -47,6 +47,7 @@
 /*
  * select serial console configuration
  */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL0			1	/* use SERIAL 0 on SMDKC100 */
 
 /* PWM */
include/configs/smdkv310.h +1 -0
index 0496661..9e10bf1 100644
@@ -48,6 +48,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
include/configs/trats.h +1 -0
index 9b6aac9..6b301c8 100644
@@ -53,6 +53,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
 
Signature · 1 line
1.7.10.4
#4 lore raw

PATCH v3 1/3 arm:samsung:serial Extract common UART code

Hi Minkyu,

By mistake I've forgotten to add you to CC for the v3 of this patch series.

However you were on CC for last two versions of those patches.

I'd be very grateful for feedback :-)

Quoted 332 lines

This commit brings removal of 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.

Moreover building of UART code now depends on more verbose CONFIG_S5P_SERIAL. Thereof all relevant boards configs have been adjusted.

---
Changes for v3:
- Comply with SPDX license format

Changes for v2:
- Remove S3C64XX define from the code

---
 arch/arm/include/asm/arch-exynos/uart.h    |   44 -------------------
 arch/arm/include/asm/arch-s5pc1xx/uart.h   |   44 -------------------
 arch/arm/include/asm/samsung-common/uart.h |   64
++++++++++++++++++++++++++++
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,

74 insertions(+), 100 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

(quoted diff) +0 -0

b/arch/arm/include/asm/arch-exynos/uart.h deleted file mode 100644 index 33d6ba3..0000000

arch/arm/include/asm/arch-exynos/uart.h deleted +0 -44
@@ -1,44 +0,0 @@
-/*
- * (C) Copyright 2009 Samsung Electronics
- * Minkyu Kang <[email protected]>
- * Heungjun Kim <[email protected]>
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#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
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-s5pc1xx/uart.h deleted file mode 100644 index 26db098..0000000

arch/arm/include/asm/arch-s5pc1xx/uart.h deleted +0 -44
@@ -1,44 +0,0 @@
-/*
- * (C) Copyright 2009 Samsung Electronics
- * Minkyu Kang <[email protected]>
- * Heungjun Kim <[email protected]>
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#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
(quoted diff) +0 -0

b/arch/arm/include/asm/samsung-common/uart.h new file mode 100644 index 0000000..ce92399

arch/arm/include/asm/samsung-common/uart.h new file +64 -0
@@ -0,0 +1,64 @@
+/*
+ * (C) Copyright 2009 Samsung Electronics
+ * Minkyu Kang <[email protected]>
+ * Heungjun Kim <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#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)
+	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)
+	return 1;
+#else /* Exynos 4 and 5 */
+	return 0;
+#endif
+}
+
+#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 */
+};
+
+#endif	/* __ASSEMBLY__ */
+
+#endif
drivers/serial/Makefile +1 -1
index 697f2bb..e3ca49a 100644
@@ -19,7 +19,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
drivers/serial/serial_s5p.c +2 -11
index f98b422..be08925 100644
@@ -12,22 +12,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)
 {
(quoted diff) +0 -0

b/include/configs/exynos5250-dt.h index 8f8f85f..a759d07 100644

include/configs/exynos5250-dt.h +1 -0
@@ -69,6 +69,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
include/configs/origen.h +1 -0
index da13574..a59419d 100644
@@ -48,6 +48,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

include/configs/s5p_goni.h +1 -0
index d0fafd7..812b7f3 100644
@@ -42,6 +42,7 @@
 /*
  * select serial console configuration
  */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL2			1	/* use

SERIAL2 */ #define CONFIG_BAUDRATE 115200

(quoted diff) +0 -0

b/include/configs/s5pc210_universal.h index 97a4008..2270449 100644

include/configs/s5pc210_universal.h +1 -0
@@ -48,6 +48,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
 
include/configs/smdkc100.h +1 -0
index a572e62..4631dac 100644
@@ -47,6 +47,7 @@
 /*
  * select serial console configuration
  */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL0			1	/* use SERIAL

0 on SMDKC100 */
/* PWM */

include/configs/smdkv310.h +1 -0
index 0496661..9e10bf1 100644
@@ -48,6 +48,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

include/configs/trats.h +1 -0
index 9b6aac9..6b301c8 100644
@@ -53,6 +53,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
 
Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#5 lore raw

PATCH v3 1/3 arm:samsung:serial Extract common UART code

In reply to Lukasz Majewski

Dear Lukasz,

Quoted 164 lines · Lukasz Majewski

This commit brings removal of 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.

Moreover building of UART code now depends on more verbose CONFIG_S5P_SERIAL. Thereof all relevant boards configs have been adjusted.

---
Changes for v3:
- Comply with SPDX license format

Changes for v2:
- Remove S3C64XX define from the code

---
 arch/arm/include/asm/arch-exynos/uart.h    |   44 -------------------
 arch/arm/include/asm/arch-s5pc1xx/uart.h   |   44 -------------------
 arch/arm/include/asm/samsung-common/uart.h |   64 ++++++++++++++++++++++++++++
 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, 74 insertions(+), 100 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
arch/arm/include/asm/arch-exynos/uart.h deleted +0 -44
deleted file mode 100644
index 33d6ba3..0000000
@@ -1,44 +0,0 @@
-/*
- * (C) Copyright 2009 Samsung Electronics
- * Minkyu Kang <[email protected]>
- * Heungjun Kim <[email protected]>
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#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
arch/arm/include/asm/arch-s5pc1xx/uart.h deleted +0 -44
deleted file mode 100644
index 26db098..0000000
@@ -1,44 +0,0 @@
-/*
- * (C) Copyright 2009 Samsung Electronics
- * Minkyu Kang <[email protected]>
- * Heungjun Kim <[email protected]>
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#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
arch/arm/include/asm/samsung-common/uart.h new file +24 -0
new file mode 100644
index 0000000..ce92399
@@ -0,0 +1,64 @@
+/*
+ * (C) Copyright 2009 Samsung Electronics
+ * Minkyu Kang <[email protected]>
+ * Heungjun Kim <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#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;

arch/arm/include/asm/samsung-common/uart.h line 34

Quoted 10 lines
arch/arm/include/asm/samsung-common/uart.h new file +10 -0
+	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)

OK. I understood your patch's concept and patch looks good. But, we have not been allowed ifdef at our SoCs. So, I can't accept your patch easily.

How you think?
Do we really need to combine headers?
I agree that they are almost duplicate codes.
But I thinks it's not a redundant.

Quoted 150 lines
arch/arm/include/asm/samsung-common/uart.h new file +30 -0
+	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)
+	return 1;
+#else /* Exynos 4 and 5 */
+	return 0;
+#endif
+}
+
+#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 */
+};
+
+#endif	/* __ASSEMBLY__ */
+
+#endif
drivers/serial/Makefile +1 -1
index 697f2bb..e3ca49a 100644
@@ -19,7 +19,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
drivers/serial/serial_s5p.c +2 -11
index f98b422..be08925 100644
@@ -12,22 +12,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)
 {
include/configs/exynos5250-dt.h +1 -0
index 8f8f85f..a759d07 100644
@@ -69,6 +69,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
include/configs/origen.h +1 -0
index da13574..a59419d 100644
@@ -48,6 +48,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
include/configs/s5p_goni.h +1 -0
index d0fafd7..812b7f3 100644
@@ -42,6 +42,7 @@
 /*
  * select serial console configuration
  */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL2			1	/* use SERIAL2 */
 #define CONFIG_BAUDRATE			115200
 
include/configs/s5pc210_universal.h +1 -0
index 97a4008..2270449 100644
@@ -48,6 +48,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
 
include/configs/smdkc100.h +1 -0
index a572e62..4631dac 100644
@@ -47,6 +47,7 @@
 /*
  * select serial console configuration
  */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL0			1	/* use SERIAL 0 on SMDKC100 */
 
 /* PWM */
include/configs/smdkv310.h +1 -0
index 0496661..9e10bf1 100644
@@ -48,6 +48,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
include/configs/trats.h +0 -0
index 9b6aac9..6b301c8 100644

include/configs/trats.h line 59

Quoted 7 lines
include/configs/trats.h +1 -0
@@ -53,6 +53,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
 

Thanks,
Minkyu Kang.

#6 lore raw

PATCH v3 1/3 arm:samsung:serial Extract common UART code

Hi Minkyu

Quoted 171 lines

Dear Lukasz,

Quoted 168 lines · Lukasz Majewski

This commit brings removal of 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.

Moreover building of UART code now depends on more verbose CONFIG_S5P_SERIAL. Thereof all relevant boards configs have been adjusted.

---
Changes for v3:
- Comply with SPDX license format

Changes for v2:
- Remove S3C64XX define from the code

---
 arch/arm/include/asm/arch-exynos/uart.h    |   44
------------------- arch/arm/include/asm/arch-s5pc1xx/uart.h   |
44 ------------------- arch/arm/include/asm/samsung-common/uart.h
|   64 ++++++++++++++++++++++++++++
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, 74 insertions(+), 100 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

(quoted diff) +0 -0

b/arch/arm/include/asm/arch-exynos/uart.h deleted file mode 100644 index 33d6ba3..0000000

arch/arm/include/asm/arch-exynos/uart.h deleted +0 -44
@@ -1,44 +0,0 @@
-/*
- * (C) Copyright 2009 Samsung Electronics
- * Minkyu Kang <[email protected]>
- * Heungjun Kim <[email protected]>
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#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
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-s5pc1xx/uart.h deleted file mode 100644 index 26db098..0000000

arch/arm/include/asm/arch-s5pc1xx/uart.h deleted +0 -44
@@ -1,44 +0,0 @@
-/*
- * (C) Copyright 2009 Samsung Electronics
- * Minkyu Kang <[email protected]>
- * Heungjun Kim <[email protected]>
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#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
(quoted diff) +0 -0

b/arch/arm/include/asm/samsung-common/uart.h new file mode 100644 index 0000000..ce92399

arch/arm/include/asm/samsung-common/uart.h new file +26 -0
@@ -0,0 +1,64 @@
+/*
+ * (C) Copyright 2009 Samsung Electronics
+ * Minkyu Kang <[email protected]>
+ * Heungjun Kim <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#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;
Quoted 8 lines

arch/arm/include/asm/samsung-common/uart.h line 34

Quoted 8 lines
arch/arm/include/asm/samsung-common/uart.h new file +8 -0
+	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)
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^[1]
Quoted 4 lines

OK. I understood your patch's concept and patch looks good. But, we have not been allowed ifdef at our SoCs. So, I can't accept your patch easily.

The problem is that several Samsung SoCs reuse the same IP blocks.

For example S3C6410 (which I want to add to u-boot), S5PC100, S5PC110, Exynos4 and Exynos5 are using the same timer, pwm, sromc, uart, udc, sdhci, and many others IP blocks.

As I've proposed in this patch series - several IP blocks *.c files shall go into samsung-common directory at arch/arm/cpu/samsung-common. This arm soc version independent code can be reused at s3c6410 (arm1176) CPU.

Another issue - headers. The register map for relevant IP blocks is the same at s3c6410 and exynos5250. The only difference is the offset at the end of the structure.

Quoted 2 lines

How you think?

We can remove [1] if we define the struct s5p_uart without the "unsigned char res3[xxx];"in the end.

It is correct, since we are using the "IP block offset defines" anyway to index correct IP block instance (like uart0/1/2...).

Quoted 4 lines

Do we really need to combine headers?
I agree that they are almost duplicate codes.
But I thinks it's not a redundant.

Another issue is the artificial distinction between s5pc1xx and exynos families of the processors.

Both are armv7, both are cortex (A8 and A9).I think that arch/arm/cpu/armv7/s5pc1xx code shall be moved to arch/arm/cpu/armv7/exynos

Also arch/arm/include/asm/arch-{s5pc1xx|exynos} code can be put to samsung-common directory (as also proposed in those patch series).

Frankly, we shall mimic the tegra or imx tree. As fair as I've noticed at those SoCs the common code has been put to various *-common directories.

I've added other Samsung boards maintainers to Cc.

Quoted 154 lines
Quoted 154 lines
arch/arm/include/asm/samsung-common/uart.h new file +23 -0
+	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)
+	return 1;
+#else /* Exynos 4 and 5 */
+	return 0;
+#endif
+}
+
+#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

*/

arch/arm/include/asm/samsung-common/uart.h new file +7 -0
+	u8 port_id;     /* uart port number */
+	u8 enabled;     /* 1 if enabled, 0 if disabled */
+};
+
+#endif	/* __ASSEMBLY__ */
+
+#endif
drivers/serial/Makefile +1 -1
index 697f2bb..e3ca49a 100644
@@ -19,7 +19,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
(quoted diff) +0 -0

b/drivers/serial/serial_s5p.c index f98b422..be08925 100644

drivers/serial/serial_s5p.c +2 -11
@@ -12,22 +12,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)

{

(quoted diff) +0 -0

b/include/configs/exynos5250-dt.h index 8f8f85f..a759d07 100644

include/configs/exynos5250-dt.h +1 -0
@@ -69,6 +69,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
include/configs/origen.h +1 -0
index da13574..a59419d 100644
@@ -48,6 +48,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

include/configs/s5p_goni.h +1 -0
index d0fafd7..812b7f3 100644
@@ -42,6 +42,7 @@
 /*
  * select serial console configuration
  */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL2			1	/* use

SERIAL2 */ #define CONFIG_BAUDRATE 115200

(quoted diff) +0 -0

b/include/configs/s5pc210_universal.h index 97a4008..2270449 100644

include/configs/s5pc210_universal.h +1 -0
@@ -48,6 +48,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
 
include/configs/smdkc100.h +1 -0
index a572e62..4631dac 100644
@@ -47,6 +47,7 @@
 /*
  * select serial console configuration
  */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL0			1	/* use

SERIAL 0 on SMDKC100 */
/* PWM */

include/configs/smdkv310.h +1 -0
index 0496661..9e10bf1 100644
@@ -48,6 +48,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

include/configs/trats.h +0 -0
index 9b6aac9..6b301c8 100644
@@ -53,6 +53,7 @@
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE +
 (16 << 20)) 
 /* select serial console configuration */
Quoted 8 lines

include/configs/trats.h line 59

Quoted 5 lines
include/configs/trats.h +1 -0
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL2			/* use SERIAL 2 */
 #define CONFIG_BAUDRATE			115200
 

Thanks,
Minkyu Kang.

Regards,

Lukasz Majewski
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130828/c4698590/attachment.pgp>

#7 lore raw

PATCH v3 1/3 arm:samsung:serial Extract common UART code

Hi Minkyu,

Quoted 224 lines

Hi Minkyu

Quoted 171 lines

Dear Lukasz,

Quoted 168 lines · Lukasz Majewski

This commit brings removal of 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.

Moreover building of UART code now depends on more verbose CONFIG_S5P_SERIAL. Thereof all relevant boards configs have been adjusted.

---
Changes for v3:
- Comply with SPDX license format

Changes for v2:
- Remove S3C64XX define from the code

---
 arch/arm/include/asm/arch-exynos/uart.h    |   44
------------------- arch/arm/include/asm/arch-s5pc1xx/uart.h   |
44 ------------------- arch/arm/include/asm/samsung-common/uart.h
|   64 ++++++++++++++++++++++++++++
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, 74 insertions(+), 100 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

(quoted diff) +0 -0

b/arch/arm/include/asm/arch-exynos/uart.h deleted file mode 100644 index 33d6ba3..0000000

arch/arm/include/asm/arch-exynos/uart.h deleted +0 -44
@@ -1,44 +0,0 @@
-/*
- * (C) Copyright 2009 Samsung Electronics
- * Minkyu Kang <[email protected]>
- * Heungjun Kim <[email protected]>
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#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
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-s5pc1xx/uart.h deleted file mode 100644 index 26db098..0000000

arch/arm/include/asm/arch-s5pc1xx/uart.h deleted +0 -44
@@ -1,44 +0,0 @@
-/*
- * (C) Copyright 2009 Samsung Electronics
- * Minkyu Kang <[email protected]>
- * Heungjun Kim <[email protected]>
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#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
(quoted diff) +0 -0

b/arch/arm/include/asm/samsung-common/uart.h new file mode 100644 index 0000000..ce92399

arch/arm/include/asm/samsung-common/uart.h new file +26 -0
@@ -0,0 +1,64 @@
+/*
+ * (C) Copyright 2009 Samsung Electronics
+ * Minkyu Kang <[email protected]>
+ * Heungjun Kim <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#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;
Quoted 8 lines

arch/arm/include/asm/samsung-common/uart.h line 34

Quoted 8 lines
arch/arm/include/asm/samsung-common/uart.h new file +8 -0
+	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)
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^[1]
Quoted 4 lines

OK. I understood your patch's concept and patch looks good. But, we have not been allowed ifdef at our SoCs. So, I can't accept your patch easily.

The problem is that several Samsung SoCs reuse the same IP blocks.

For example S3C6410 (which I want to add to u-boot), S5PC100, S5PC110, Exynos4 and Exynos5 are using the same timer, pwm, sromc, uart, udc, sdhci, and many others IP blocks.

As I've proposed in this patch series - several IP blocks *.c files shall go into samsung-common directory at arch/arm/cpu/samsung-common. This arm soc version independent code can be reused at s3c6410 (arm1176) CPU.

Another issue - headers. The register map for relevant IP blocks is the same at s3c6410 and exynos5250. The only difference is the offset at the end of the structure.

Quoted 2 lines

How you think?

We can remove [1] if we define the struct s5p_uart without the "unsigned char res3[xxx];"in the end.

It is correct, since we are using the "IP block offset defines" anyway to index correct IP block instance (like uart0/1/2...).

Quoted 4 lines

Do we really need to combine headers?
I agree that they are almost duplicate codes.
But I thinks it's not a redundant.

Another issue is the artificial distinction between s5pc1xx and exynos families of the processors.

Both are armv7, both are cortex (A8 and A9).I think that arch/arm/cpu/armv7/s5pc1xx code shall be moved to arch/arm/cpu/armv7/exynos

Quoted 8 lines

Also arch/arm/include/asm/arch-{s5pc1xx|exynos} code can be put to samsung-common directory (as also proposed in those patch series).

Frankly, we shall mimic the tegra or imx tree. As fair as I've noticed at those SoCs the common code has been put to various *-common directories.

I've added other Samsung boards maintainers to Cc.

Have you thought about this?

Quoted 164 lines
Quoted 155 lines
Quoted 155 lines
arch/arm/include/asm/samsung-common/uart.h new file +23 -0
+	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)
+	return 1;
+#else /* Exynos 4 and 5 */
+	return 0;
+#endif
+}
+
+#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 */

arch/arm/include/asm/samsung-common/uart.h new file +7 -0
+	u8 port_id;     /* uart port number */
+	u8 enabled;     /* 1 if enabled, 0 if disabled */
+};
+
+#endif	/* __ASSEMBLY__ */
+
+#endif
drivers/serial/Makefile +0 -0
index 697f2bb..e3ca49a 100644
@@ -19,7 +19,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

drivers/serial/Makefile +1 -1
-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
(quoted diff) +0 -0

b/drivers/serial/serial_s5p.c index f98b422..be08925 100644

drivers/serial/serial_s5p.c +1 -8
@@ -12,22 +12,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 */

drivers/serial/serial_s5p.c +1 -3
-	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)
 {
(quoted diff) +0 -0

b/include/configs/exynos5250-dt.h index 8f8f85f..a759d07 100644

include/configs/exynos5250-dt.h +1 -0
@@ -69,6 +69,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
include/configs/origen.h +1 -0
index da13574..a59419d 100644
@@ -48,6 +48,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

(quoted diff) +0 -0

b/include/configs/s5p_goni.h index d0fafd7..812b7f3 100644

include/configs/s5p_goni.h +1 -0
@@ -42,6 +42,7 @@
 /*
  * select serial console configuration
  */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL2			1	/* use

SERIAL2 */ #define CONFIG_BAUDRATE 115200

(quoted diff) +0 -0

b/include/configs/s5pc210_universal.h index 97a4008..2270449 100644 --- a/include/configs/s5pc210_universal.h +++ b/include/configs/s5pc210_universal.h

include/configs/s5p_goni.h +1 -0
@@ -48,6 +48,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
 
(quoted diff) +0 -0

b/include/configs/smdkc100.h index a572e62..4631dac 100644

include/configs/smdkc100.h +1 -0
@@ -47,6 +47,7 @@
 /*
  * select serial console configuration
  */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL0			1	/* use

SERIAL 0 on SMDKC100 */
/* PWM */

(quoted diff) +0 -0

b/include/configs/smdkv310.h index 0496661..9e10bf1 100644

include/configs/smdkv310.h +1 -0
@@ -48,6 +48,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

include/configs/trats.h +0 -0
index 9b6aac9..6b301c8 100644
@@ -53,6 +53,7 @@
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE +
 (16 << 20)) 
 /* select serial console configuration */
Quoted 8 lines

include/configs/trats.h line 59

Quoted 5 lines
include/configs/trats.h +1 -0
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL2			/* use SERIAL 2 */
 #define CONFIG_BAUDRATE			115200
 

Thanks,
Minkyu Kang.

Quoted 3 lines

Regards,

Lukasz Majewski

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130912/6d4631cd/attachment.pgp>

#8 lore raw

PATCH v3 1/3 arm:samsung:serial Extract common UART code

In reply to Lukasz Majewski
Quoted 204 lines · Lukasz Majewski

Hi Minkyu

Quoted 171 lines

Dear Lukasz,

Quoted 168 lines · Lukasz Majewski

This commit brings removal of 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.

Moreover building of UART code now depends on more verbose CONFIG_S5P_SERIAL. Thereof all relevant boards configs have been adjusted.

---
Changes for v3:
- Comply with SPDX license format

Changes for v2:
- Remove S3C64XX define from the code

---
 arch/arm/include/asm/arch-exynos/uart.h    |   44
------------------- arch/arm/include/asm/arch-s5pc1xx/uart.h   |
44 ------------------- arch/arm/include/asm/samsung-common/uart.h
|   64 ++++++++++++++++++++++++++++
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, 74 insertions(+), 100 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

(quoted diff) +0 -0

b/arch/arm/include/asm/arch-exynos/uart.h deleted file mode 100644 index 33d6ba3..0000000

arch/arm/include/asm/arch-exynos/uart.h deleted +0 -44
@@ -1,44 +0,0 @@
-/*
- * (C) Copyright 2009 Samsung Electronics
- * Minkyu Kang <[email protected]>
- * Heungjun Kim <[email protected]>
- *
- * SPDX-License-Identifier:        GPL-2.0+
- */
-
-#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
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-s5pc1xx/uart.h deleted file mode 100644 index 26db098..0000000

arch/arm/include/asm/arch-s5pc1xx/uart.h deleted +0 -44
@@ -1,44 +0,0 @@
-/*
- * (C) Copyright 2009 Samsung Electronics
- * Minkyu Kang <[email protected]>
- * Heungjun Kim <[email protected]>
- *
- * SPDX-License-Identifier:        GPL-2.0+
- */
-
-#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
(quoted diff) +0 -0

b/arch/arm/include/asm/samsung-common/uart.h new file mode 100644 index 0000000..ce92399

arch/arm/include/asm/samsung-common/uart.h new file +26 -0
@@ -0,0 +1,64 @@
+/*
+ * (C) Copyright 2009 Samsung Electronics
+ * Minkyu Kang <[email protected]>
+ * Heungjun Kim <[email protected]>
+ *
+ * SPDX-License-Identifier:        GPL-2.0+
+ */
+
+#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;
Quoted 8 lines

arch/arm/include/asm/samsung-common/uart.h line 34

Quoted 8 lines
arch/arm/include/asm/samsung-common/uart.h new file +8 -0
+   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)
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^[1]
Quoted 4 lines

OK. I understood your patch's concept and patch looks good. But, we have not been allowed ifdef at our SoCs. So, I can't accept your patch easily.

The problem is that several Samsung SoCs reuse the same IP blocks.

For example S3C6410 (which I want to add to u-boot), S5PC100, S5PC110, Exynos4 and Exynos5 are using the same timer, pwm, sromc, uart, udc, sdhci, and many others IP blocks.

As I've proposed in this patch series - several IP blocks *.c files shall go into samsung-common directory at arch/arm/cpu/samsung-common. This arm soc version independent code can be reused at s3c6410 (arm1176) CPU.

Another issue - headers. The register map for relevant IP blocks is the same at s3c6410 and exynos5250. The only difference is the offset at the end of the structure.

Quoted 1 line
Quoted 4 lines
Quoted 1 line

How you think?

We can remove [1] if we define the struct s5p_uart without the "unsigned char res3[xxx];"in the end.

first of all sorry for late response.

I think it is a good thought. By removing the res[3] padding in the structure we can do away with ifdef's.
As uart_offset is used to hop next uart port.

But keep in mind that there are another two reserved fields(res2, res3). If there is any any change in those reserve field values in future soc's then this approach will not work.

Quoted 25 lines

It is correct, since we are using the "IP block offset defines" anyway to index correct IP block instance (like uart0/1/2...).

Quoted 4 lines

Do we really need to combine headers?
I agree that they are almost duplicate codes.
But I thinks it's not a redundant.

Another issue is the artificial distinction between s5pc1xx and exynos families of the processors.

Both are armv7, both are cortex (A8 and A9).I think that arch/arm/cpu/armv7/s5pc1xx code shall be moved to arch/arm/cpu/armv7/exynos

Also arch/arm/include/asm/arch-{s5pc1xx|exynos} code can be put to samsung-common directory (as also proposed in those patch series).

Frankly, we shall mimic the tegra or imx tree. As fair as I've noticed at those SoCs the common code has been put to various *-common directories.

I've added other Samsung boards maintainers to Cc.

Quoted 10 lines
Quoted 10 lines

arch/arm/include/asm/samsung-common/uart.h line 44

Quoted 10 lines
arch/arm/include/asm/samsung-common/uart.h new file +10 -0
+   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)

This can be done away using cpu_is_xxX.

Quoted 162 lines
Quoted 144 lines
Quoted 144 lines
arch/arm/include/asm/samsung-common/uart.h new file +13 -0
+   return 1;
+#else /* Exynos 4 and 5 */
+   return 0;
+#endif
+}
+
+#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

*/

arch/arm/include/asm/samsung-common/uart.h new file +7 -0
+   u8 port_id;     /* uart port number */
+   u8 enabled;     /* 1 if enabled, 0 if disabled */
+};
+
+#endif     /* __ASSEMBLY__ */
+
+#endif
drivers/serial/Makefile +1 -1
index 697f2bb..e3ca49a 100644
@@ -19,7 +19,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
(quoted diff) +0 -0

b/drivers/serial/serial_s5p.c index f98b422..be08925 100644

drivers/serial/serial_s5p.c +2 -11
@@ -12,22 +12,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)

{

(quoted diff) +0 -0

b/include/configs/exynos5250-dt.h index 8f8f85f..a759d07 100644

include/configs/exynos5250-dt.h +1 -0
@@ -69,6 +69,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
include/configs/origen.h +1 -0
index da13574..a59419d 100644
@@ -48,6 +48,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

include/configs/s5p_goni.h +1 -0
index d0fafd7..812b7f3 100644
@@ -42,6 +42,7 @@
 /*
  * select serial console configuration
  */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL2                     1       /* use

SERIAL2 */ #define CONFIG_BAUDRATE 115200

(quoted diff) +0 -0

b/include/configs/s5pc210_universal.h index 97a4008..2270449 100644

include/configs/s5pc210_universal.h +1 -0
@@ -48,6 +48,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
 
include/configs/smdkc100.h +1 -0
index a572e62..4631dac 100644
@@ -47,6 +47,7 @@
 /*
  * select serial console configuration
  */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL0                     1       /* use

SERIAL 0 on SMDKC100 */
/* PWM */

include/configs/smdkv310.h +1 -0
index 0496661..9e10bf1 100644
@@ -48,6 +48,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

include/configs/trats.h +0 -0
index 9b6aac9..6b301c8 100644
@@ -53,6 +53,7 @@
 #define CONFIG_SYS_MALLOC_LEN              (CONFIG_ENV_SIZE +
 (16 << 20))
 /* select serial console configuration */
Quoted 8 lines

include/configs/trats.h line 59

Quoted 5 lines
include/configs/trats.h +1 -0
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL2                     /* use SERIAL 2 */
 #define CONFIG_BAUDRATE                    115200
 

Thanks,
Minkyu Kang.

Regards,

Lukasz Majewski

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Signature · 2 lines
with warm regards,
Chander Kashyap
#9 lore raw

PATCH v3 1/3 arm:samsung:serial Extract common UART code

In reply to Lukasz Majewski

Dear Lukasz,

Quoted 204 lines · Lukasz Majewski

Hi Minkyu

Quoted 171 lines

Dear Lukasz,

Quoted 168 lines · Lukasz Majewski

This commit brings removal of 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.

Moreover building of UART code now depends on more verbose CONFIG_S5P_SERIAL. Thereof all relevant boards configs have been adjusted.

---
Changes for v3:
- Comply with SPDX license format

Changes for v2:
- Remove S3C64XX define from the code

---
 arch/arm/include/asm/arch-exynos/uart.h    |   44
------------------- arch/arm/include/asm/arch-s5pc1xx/uart.h   |
44 ------------------- arch/arm/include/asm/samsung-common/uart.h
|   64 ++++++++++++++++++++++++++++
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, 74 insertions(+), 100 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

(quoted diff) +0 -0

b/arch/arm/include/asm/arch-exynos/uart.h deleted file mode 100644 index 33d6ba3..0000000

arch/arm/include/asm/arch-exynos/uart.h deleted +0 -44
@@ -1,44 +0,0 @@
-/*
- * (C) Copyright 2009 Samsung Electronics
- * Minkyu Kang <[email protected]>
- * Heungjun Kim <[email protected]>
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#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
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-s5pc1xx/uart.h deleted file mode 100644 index 26db098..0000000

arch/arm/include/asm/arch-s5pc1xx/uart.h deleted +0 -44
@@ -1,44 +0,0 @@
-/*
- * (C) Copyright 2009 Samsung Electronics
- * Minkyu Kang <[email protected]>
- * Heungjun Kim <[email protected]>
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#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
(quoted diff) +0 -0

b/arch/arm/include/asm/samsung-common/uart.h new file mode 100644 index 0000000..ce92399

arch/arm/include/asm/samsung-common/uart.h new file +26 -0
@@ -0,0 +1,64 @@
+/*
+ * (C) Copyright 2009 Samsung Electronics
+ * Minkyu Kang <[email protected]>
+ * Heungjun Kim <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#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;
Quoted 8 lines

arch/arm/include/asm/samsung-common/uart.h line 34

Quoted 8 lines
arch/arm/include/asm/samsung-common/uart.h new file +8 -0
+	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)
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^[1]
Quoted 4 lines

OK. I understood your patch's concept and patch looks good. But, we have not been allowed ifdef at our SoCs. So, I can't accept your patch easily.

The problem is that several Samsung SoCs reuse the same IP blocks.

For example S3C6410 (which I want to add to u-boot), S5PC100, S5PC110, Exynos4 and Exynos5 are using the same timer, pwm, sromc, uart, udc, sdhci, and many others IP blocks.

As I've proposed in this patch series - several IP blocks *.c files shall go into samsung-common directory at arch/arm/cpu/samsung-common. This arm soc version independent code can be reused at s3c6410 (arm1176) CPU.

Another issue - headers. The register map for relevant IP blocks is the same at s3c6410 and exynos5250. The only difference is the offset at the end of the structure.

Quoted 1 line
Quoted 4 lines
Quoted 1 line

How you think?

We can remove [1] if we define the struct s5p_uart without the "unsigned char res3[xxx];"in the end.

It's OK.
but, how can you remove other ifdefs?

Quoted 9 lines

It is correct, since we are using the "IP block offset defines" anyway to index correct IP block instance (like uart0/1/2...).

Quoted 4 lines

Do we really need to combine headers?
I agree that they are almost duplicate codes.
But I thinks it's not a redundant.

Quoted 6 lines

Another issue is the artificial distinction between s5pc1xx and exynos families of the processors.

Both are armv7, both are cortex (A8 and A9).I think that arch/arm/cpu/armv7/s5pc1xx code shall be moved to arch/arm/cpu/armv7/exynos

hm.. then, some files (cpu, clock, gpio,,, ) will be complicated.

Quoted 173 lines

Also arch/arm/include/asm/arch-{s5pc1xx|exynos} code can be put to samsung-common directory (as also proposed in those patch series).

Frankly, we shall mimic the tegra or imx tree. As fair as I've noticed at those SoCs the common code has been put to various *-common directories.

I've added other Samsung boards maintainers to Cc.

Quoted 154 lines
Quoted 154 lines
arch/arm/include/asm/samsung-common/uart.h new file +23 -0
+	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)
+	return 1;
+#else /* Exynos 4 and 5 */
+	return 0;
+#endif
+}
+
+#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

*/

arch/arm/include/asm/samsung-common/uart.h new file +7 -0
+	u8 port_id;     /* uart port number */
+	u8 enabled;     /* 1 if enabled, 0 if disabled */
+};
+
+#endif	/* __ASSEMBLY__ */
+
+#endif
drivers/serial/Makefile +1 -1
index 697f2bb..e3ca49a 100644
@@ -19,7 +19,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
(quoted diff) +0 -0

b/drivers/serial/serial_s5p.c index f98b422..be08925 100644

drivers/serial/serial_s5p.c +2 -11
@@ -12,22 +12,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)

{

(quoted diff) +0 -0

b/include/configs/exynos5250-dt.h index 8f8f85f..a759d07 100644

include/configs/exynos5250-dt.h +1 -0
@@ -69,6 +69,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
include/configs/origen.h +1 -0
index da13574..a59419d 100644
@@ -48,6 +48,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

include/configs/s5p_goni.h +1 -0
index d0fafd7..812b7f3 100644
@@ -42,6 +42,7 @@
 /*
  * select serial console configuration
  */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL2			1	/* use

SERIAL2 */ #define CONFIG_BAUDRATE 115200

(quoted diff) +0 -0

b/include/configs/s5pc210_universal.h index 97a4008..2270449 100644

include/configs/s5pc210_universal.h +1 -0
@@ -48,6 +48,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
 
include/configs/smdkc100.h +1 -0
index a572e62..4631dac 100644
@@ -47,6 +47,7 @@
 /*
  * select serial console configuration
  */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL0			1	/* use

SERIAL 0 on SMDKC100 */
/* PWM */

include/configs/smdkv310.h +1 -0
index 0496661..9e10bf1 100644
@@ -48,6 +48,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

include/configs/trats.h +0 -0
index 9b6aac9..6b301c8 100644
@@ -53,6 +53,7 @@
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE +
 (16 << 20)) 
 /* select serial console configuration */
Quoted 8 lines

include/configs/trats.h line 59

Quoted 5 lines
include/configs/trats.h +1 -0
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL2			/* use SERIAL 2 */
 #define CONFIG_BAUDRATE			115200
 

Thanks,
Minkyu Kang.

Quoted 4 lines

Regards,

Lukasz Majewski

Thanks,
Minkyu Kang.

#10 lore raw

PATCH v3 1/3 arm:samsung:serial Extract common UART code

Hi Minkyu,

Quoted 207 lines

Dear Lukasz,

Quoted 204 lines · Lukasz Majewski

Hi Minkyu

Quoted 171 lines

Dear Lukasz,

Quoted 168 lines · Lukasz Majewski

This commit brings removal of 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.

Moreover building of UART code now depends on more verbose CONFIG_S5P_SERIAL. Thereof all relevant boards configs have been adjusted.

---
Changes for v3:
- Comply with SPDX license format

Changes for v2:
- Remove S3C64XX define from the code

---
 arch/arm/include/asm/arch-exynos/uart.h    |   44
------------------- arch/arm/include/asm/arch-s5pc1xx/uart.h   |
44 ------------------- arch/arm/include/asm/samsung-common/uart.h
|   64 ++++++++++++++++++++++++++++
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, 74 insertions(+), 100 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

(quoted diff) +0 -0

b/arch/arm/include/asm/arch-exynos/uart.h deleted file mode 100644 index 33d6ba3..0000000

arch/arm/include/asm/arch-exynos/uart.h deleted +0 -44
@@ -1,44 +0,0 @@
-/*
- * (C) Copyright 2009 Samsung Electronics
- * Minkyu Kang <[email protected]>
- * Heungjun Kim <[email protected]>
- *
- * SPDX-License-Identifier:        GPL-2.0+
- */
-
-#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
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-s5pc1xx/uart.h deleted file mode 100644 index 26db098..0000000

arch/arm/include/asm/arch-s5pc1xx/uart.h deleted +0 -44
@@ -1,44 +0,0 @@
-/*
- * (C) Copyright 2009 Samsung Electronics
- * Minkyu Kang <[email protected]>
- * Heungjun Kim <[email protected]>
- *
- * SPDX-License-Identifier:        GPL-2.0+
- */
-
-#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
(quoted diff) +0 -0

b/arch/arm/include/asm/samsung-common/uart.h new file mode 100644 index 0000000..ce92399

arch/arm/include/asm/samsung-common/uart.h new file +26 -0
@@ -0,0 +1,64 @@
+/*
+ * (C) Copyright 2009 Samsung Electronics
+ * Minkyu Kang <[email protected]>
+ * Heungjun Kim <[email protected]>
+ *
+ * SPDX-License-Identifier:        GPL-2.0+
+ */
+
+#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;
Quoted 8 lines

arch/arm/include/asm/samsung-common/uart.h line 34

Quoted 8 lines
arch/arm/include/asm/samsung-common/uart.h new file +8 -0
+   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)
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^[1]
Quoted 4 lines

OK. I understood your patch's concept and patch looks good. But, we have not been allowed ifdef at our SoCs. So, I can't accept your patch easily.

The problem is that several Samsung SoCs reuse the same IP blocks.

For example S3C6410 (which I want to add to u-boot), S5PC100, S5PC110, Exynos4 and Exynos5 are using the same timer, pwm, sromc, uart, udc, sdhci, and many others IP blocks.

As I've proposed in this patch series - several IP blocks *.c files shall go into samsung-common directory at arch/arm/cpu/samsung-common. This arm soc version independent code can be reused at s3c6410 (arm1176) CPU.

Another issue - headers. The register map for relevant IP blocks is the same at s3c6410 and exynos5250. The only difference is the offset at the end of the structure.

Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

How you think?

We can remove [1] if we define the struct s5p_uart without the "unsigned char res3[xxx];"in the end.

It's OK.
but, how can you remove other ifdefs?

Other #ifdef here is the s5p_uart_divslot function:

+static inline int s5p_uart_divslot(void)
+{
+#if defined(CONFIG_S5PC100) || defined(CONFIG_S5PC110)
+ return 1;
+#else /* Exynos 4 and 5 */
+ return 0;
+#endif
+}

It looks like a good candidate for clean up.

Quoted 10 lines
Quoted 10 lines

It is correct, since we are using the "IP block offset defines" anyway to index correct IP block instance (like uart0/1/2...).

Quoted 4 lines

Do we really need to combine headers?
I agree that they are almost duplicate codes.
But I thinks it's not a redundant.

Quoted 8 lines
Quoted 6 lines

Another issue is the artificial distinction between s5pc1xx and exynos families of the processors.

Both are armv7, both are cortex (A8 and A9).I think that arch/arm/cpu/armv7/s5pc1xx code shall be moved to arch/arm/cpu/armv7/exynos

hm.. then, some files (cpu, clock, gpio,,, ) will be complicated.

The timer handling code is directly reused at s3c6410. Also please look into PATCH 2/3 and PATCH 3/3 in this series. For example, PATCH 3/3 unifies cpu info.

Now at arch/arm/cpu/armv7/s5pc1xx directory one finds: cache.S, clock.c and reset.S

Moreover, if we plan to describe Samsung boards in a device tree - in a similar way to e.g. Tegra, common code base would be more than welcome.

Quoted 181 lines
Quoted 174 lines

Also arch/arm/include/asm/arch-{s5pc1xx|exynos} code can be put to samsung-common directory (as also proposed in those patch series).

Frankly, we shall mimic the tegra or imx tree. As fair as I've noticed at those SoCs the common code has been put to various *-common directories.

I've added other Samsung boards maintainers to Cc.

Quoted 154 lines
Quoted 154 lines
arch/arm/include/asm/samsung-common/uart.h new file +23 -0
+   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)
+   return 1;
+#else /* Exynos 4 and 5 */
+   return 0;
+#endif
+}
+
+#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

*/

arch/arm/include/asm/samsung-common/uart.h new file +7 -0
+   u8 port_id;     /* uart port number */
+   u8 enabled;     /* 1 if enabled, 0 if disabled */
+};
+
+#endif     /* __ASSEMBLY__ */
+
+#endif
drivers/serial/Makefile +0 -0
index 697f2bb..e3ca49a 100644
@@ -19,7 +19,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

drivers/serial/Makefile +1 -1
-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
(quoted diff) +0 -0

b/drivers/serial/serial_s5p.c index f98b422..be08925 100644

drivers/serial/serial_s5p.c +2 -11
@@ -12,22 +12,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)

{

(quoted diff) +0 -0

b/include/configs/exynos5250-dt.h index 8f8f85f..a759d07 100644

include/configs/exynos5250-dt.h +1 -0
@@ -69,6 +69,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
include/configs/origen.h +1 -0
index da13574..a59419d 100644
@@ -48,6 +48,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

(quoted diff) +0 -0

b/include/configs/s5p_goni.h index d0fafd7..812b7f3 100644

include/configs/s5p_goni.h +1 -0
@@ -42,6 +42,7 @@
 /*
  * select serial console configuration
  */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL2                     1       /* use

SERIAL2 */ #define CONFIG_BAUDRATE 115200

(quoted diff) +0 -0

b/include/configs/s5pc210_universal.h index 97a4008..2270449 100644 --- a/include/configs/s5pc210_universal.h +++ b/include/configs/s5pc210_universal.h

include/configs/s5p_goni.h +1 -0
@@ -48,6 +48,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
 
(quoted diff) +0 -0

b/include/configs/smdkc100.h index a572e62..4631dac 100644

include/configs/smdkc100.h +1 -0
@@ -47,6 +47,7 @@
 /*
  * select serial console configuration
  */
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL0                     1       /* use

SERIAL 0 on SMDKC100 */
/* PWM */

(quoted diff) +0 -0

b/include/configs/smdkv310.h index 0496661..9e10bf1 100644

include/configs/smdkv310.h +1 -0
@@ -48,6 +48,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

include/configs/trats.h +0 -0
index 9b6aac9..6b301c8 100644
@@ -53,6 +53,7 @@
 #define CONFIG_SYS_MALLOC_LEN              (CONFIG_ENV_SIZE +
 (16 << 20))
 /* select serial console configuration */
Quoted 8 lines

include/configs/trats.h line 59

Quoted 5 lines
include/configs/trats.h +1 -0
+#define CONFIG_S5P_SERIAL
 #define CONFIG_SERIAL2                     /* use SERIAL 2 */
 #define CONFIG_BAUDRATE                    115200
 

Thanks,
Minkyu Kang.

Quoted 4 lines

Regards,

Lukasz Majewski

Thanks,
Minkyu Kang.

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
#11 lore raw

PATCH v3 2/3 arm:samsung: Move common code from ./s5p-common to ./samsung-common/

In reply to Lukasz Majewski

Common Samsung code has been moved one level up - to ./samsung-common directory. This would allow other - non S5P based targets to reuse this code base Moreover duplicated header files were removed.

---
Changes for v3:
- Comply with SPDX license format when moving files to new location

Changes for v2:
- Only compile in libsamsung-common for non arm9 boards
- Exclude common sromc controller code
- Adjust smdkc100 to work with common sromc.h header
- Adjust boards #includes for asm/samsung-common/sromc.h

---
 Makefile                                    |    7 +-
 arch/arm/cpu/armv7/exynos/pinmux.c          |    2 +-
 arch/arm/cpu/armv7/s5p-common/Makefile      |   34 ------
 arch/arm/cpu/armv7/s5p-common/cpu_info.c    |   41 -------
 arch/arm/cpu/armv7/s5p-common/pwm.c         |  171 --------------------------
 arch/arm/cpu/armv7/s5p-common/sromc.c       |   33 -----
 arch/arm/cpu/armv7/s5p-common/timer.c       |  132 --------------------
 arch/arm/cpu/samsung-common/Makefile        |   30 +++++
 arch/arm/cpu/samsung-common/cpu_info.c      |   40 +++++++
 arch/arm/cpu/samsung-common/pwm.c           |  172 +++++++++++++++++++++++++++
 arch/arm/cpu/samsung-common/sromc.c         |   33 +++++
 arch/arm/cpu/samsung-common/timer.c         |  131 ++++++++++++++++++++
 arch/arm/include/asm/arch-exynos/pwm.h      |   55 ---------
 arch/arm/include/asm/arch-exynos/sromc.h    |   55 ---------
 arch/arm/include/asm/arch-s5pc1xx/pwm.h     |   55 ---------
 arch/arm/include/asm/arch-s5pc1xx/sromc.h   |   40 -------
 arch/arm/include/asm/samsung-common/pwm.h   |   55 +++++++++
 arch/arm/include/asm/samsung-common/sromc.h |   60 ++++++++++
 board/samsung/smdk5250/exynos5-dt.c         |    2 +-
 board/samsung/smdkc100/smdkc100.c           |   11 +-
 board/samsung/smdkv310/smdkv310.c           |    2 +-
 spl/Makefile                                |    2 +-
 22 files changed, 534 insertions(+), 629 deletions(-)
 delete mode 100644 arch/arm/cpu/armv7/s5p-common/Makefile
 delete mode 100644 arch/arm/cpu/armv7/s5p-common/cpu_info.c
 delete mode 100644 arch/arm/cpu/armv7/s5p-common/pwm.c
 delete mode 100644 arch/arm/cpu/armv7/s5p-common/sromc.c
 delete mode 100644 arch/arm/cpu/armv7/s5p-common/timer.c
 create mode 100644 arch/arm/cpu/samsung-common/Makefile
 create mode 100644 arch/arm/cpu/samsung-common/cpu_info.c
 create mode 100644 arch/arm/cpu/samsung-common/pwm.c
 create mode 100644 arch/arm/cpu/samsung-common/sromc.c
 create mode 100644 arch/arm/cpu/samsung-common/timer.c
 delete mode 100644 arch/arm/include/asm/arch-exynos/pwm.h
 delete mode 100644 arch/arm/include/asm/arch-exynos/sromc.h
 delete mode 100644 arch/arm/include/asm/arch-s5pc1xx/pwm.h
 delete mode 100644 arch/arm/include/asm/arch-s5pc1xx/sromc.h
 create mode 100644 arch/arm/include/asm/samsung-common/pwm.h
 create mode 100644 arch/arm/include/asm/samsung-common/sromc.h
Makefile +3 -4
index d545d30..836c04d 100644
@@ -330,11 +330,10 @@ ifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35 mxs vf610))
 LIBS-y += arch/$(ARCH)/imx-common/libimx-common.o
 endif
 
-ifeq ($(SOC),s5pc1xx)
-LIBS-y += $(CPUDIR)/s5p-common/libs5p-common.o
+ifeq ($(VENDOR),samsung)
+ifneq ($(SOC), s3c24x0)
+LIBS-y += arch/$(ARCH)/cpu/samsung-common/libsamsung-common.o
 endif
-ifeq ($(SOC),exynos)
-LIBS-y += $(CPUDIR)/s5p-common/libs5p-common.o
 endif
 ifneq ($(CONFIG_TEGRA),)
 LIBS-y += arch/$(ARCH)/cpu/$(SOC)-common/lib$(SOC)-common.o
arch/arm/cpu/armv7/exynos/pinmux.c +1 -1
index 1b05ebf..ed662bb 100644
@@ -9,7 +9,7 @@
 #include <fdtdec.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/pinmux.h>
-#include <asm/arch/sromc.h>
+#include <asm/samsung-common/sromc.h>
 
 static void exynos5_uart_config(int peripheral)
 {
arch/arm/cpu/armv7/s5p-common/Makefile deleted +0 -34
deleted file mode 100644
index fd7290c..0000000
@@ -1,34 +0,0 @@
-#
-# Copyright (C) 2009 Samsung Electronics
-# Minkyu Kang <[email protected]>
-#
-# SPDX-License-Identifier:	GPL-2.0+
-#
-
-include $(TOPDIR)/config.mk
-
-LIB	= $(obj)libs5p-common.o
-
-COBJS-y		+= cpu_info.o
-ifndef CONFIG_SPL_BUILD
-COBJS-y		+= timer.o
-COBJS-y		+= sromc.o
-COBJS-$(CONFIG_PWM)	+= pwm.o
-endif
-
-SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS	:= $(addprefix $(obj),$(COBJS-y) $(SOBJS))
-
-all:	 $(obj).depend $(LIB)
-
-$(LIB):	$(OBJS)
-	$(call cmd_link_o_target, $(OBJS))
-
-#########################################################################
-
-# defines $(obj).depend target
-include $(SRCTREE)/rules.mk
-
-sinclude $(obj).depend
-
-#########################################################################
arch/arm/cpu/armv7/s5p-common/cpu_info.c deleted +0 -41

41 lines not on this page · raw message

arch/arm/cpu/armv7/s5p-common/pwm.c deleted +0 -171

171 lines not on this page · raw message

arch/arm/cpu/armv7/s5p-common/sromc.c deleted +0 -33
deleted file mode 100644
index 806456f..0000000
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2010 Samsung Electronics
- * Naveen Krishna Ch <[email protected]>
- *
- * SPDX-License-Identifier:	GPL-2.0+
- */
-
-#include <common.h>
-#include <asm/io.h>
-#include <asm/arch/sromc.h>
-
-/*
- * s5p_config_sromc() - select the proper SROMC Bank and configure the
- * band width control and bank control registers
- * srom_bank	- SROM
- * srom_bw_conf  - SMC Band witdh reg configuration value
- * srom_bc_conf  - SMC Bank Control reg configuration value
- */
-void s5p_config_sromc(u32 srom_bank, u32 srom_bw_conf, u32 srom_bc_conf)
-{
-	u32 tmp;
-	struct s5p_sromc *srom =
-		(struct s5p_sromc *)samsung_get_base_sromc();
-
-	/* Configure SMC_BW register to handle proper SROMC bank */
-	tmp = srom->bw;
-	tmp &= ~(0xF << (srom_bank * 4));
-	tmp |= srom_bw_conf;
-	srom->bw = tmp;
-
-	/* Configure SMC_BC register */
-	srom->bc[srom_bank] = srom_bc_conf;
-}
arch/arm/cpu/armv7/s5p-common/timer.c deleted +0 -132

132 lines not on this page · raw message

arch/arm/cpu/samsung-common/Makefile new file +30 -0
new file mode 100644
index 0000000..22eae3e
@@ -0,0 +1,30 @@
+#
+# Copyright (C) 2009 Samsung Electronics
+# Minkyu Kang <[email protected]>
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= $(obj)libsamsung-common.o
+
+COBJS-$(CONFIG_PWM)	+= pwm.o
+COBJS-y			+= timer.o sromc.o cpu_info.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS-y) $(SOBJS))
+
+all:	 $(obj).depend $(LIB)
+
+$(LIB):	$(OBJS)
+	$(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
arch/arm/cpu/samsung-common/cpu_info.c new file +40 -0
new file mode 100644
index 0000000..e18c4f6
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2009 Samsung Electronics
+ * Minkyu Kang <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/clk.h>
+
+/* Default is s5pc100 */
+unsigned int s5p_cpu_id = 0xC100;
+/* Default is EVT1 */
+unsigned int s5p_cpu_rev = 1;
+
+#ifdef CONFIG_ARCH_CPU_INIT
+int arch_cpu_init(void)
+{
+	s5p_set_cpu_id();
+
+	return 0;
+}
+#endif
+
+u32 get_device_type(void)
+{
+	return s5p_cpu_id;
+}
+
+#ifdef CONFIG_DISPLAY_CPUINFO
+int print_cpuinfo(void)
+{
+	char buf[32];
+
+	printf("CPU:\t%s%X@%sMHz\n", s5p_get_cpu_name(), s5p_cpu_id,
+	       strmhz(buf, get_arm_clk()));
+
+	return 0;
+}
+#endif
arch/arm/cpu/samsung-common/pwm.c new file +172 -0

172 lines not on this page · raw message

arch/arm/cpu/samsung-common/sromc.c new file +33 -0
new file mode 100644
index 0000000..522f4d9
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2010 Samsung Electronics
+ * Naveen Krishna Ch <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/samsung-common/sromc.h>
+
+/*
+ * s5p_config_sromc() - select the proper SROMC Bank and configure the
+ * band width control and bank control registers
+ * srom_bank	- SROM
+ * srom_bw_conf  - SMC Band witdh reg configuration value
+ * srom_bc_conf  - SMC Bank Control reg configuration value
+ */
+void s5p_config_sromc(u32 srom_bank, u32 srom_bw_conf, u32 srom_bc_conf)
+{
+	u32 tmp;
+	struct s5p_sromc *srom =
+		(struct s5p_sromc *)samsung_get_base_sromc();
+
+	/* Configure SMC_BW register to handle proper SROMC bank */
+	tmp = srom->bw;
+	tmp &= ~(0xF << (srom_bank * 4));
+	tmp |= srom_bw_conf;
+	srom->bw = tmp;
+
+	/* Configure SMC_BC register */
+	srom->bc[srom_bank] = srom_bc_conf;
+}
arch/arm/cpu/samsung-common/timer.c new file +131 -0

131 lines not on this page · raw message

arch/arm/include/asm/arch-exynos/pwm.h deleted +0 -55

55 lines not on this page · raw message

arch/arm/include/asm/arch-exynos/sromc.h deleted +0 -55

55 lines not on this page · raw message

arch/arm/include/asm/arch-s5pc1xx/pwm.h deleted +0 -55

55 lines not on this page · raw message

arch/arm/include/asm/arch-s5pc1xx/sromc.h deleted +0 -40
deleted file mode 100644
index df1bf51..0000000
@@ -1,40 +0,0 @@
-/*
- * (C) Copyright 2010 Samsung Electronics
- * Naveen Krishna Ch <[email protected]>
- *
- * SPDX-License-Identifier:	GPL-2.0+
- *
- * Note: This file contains the register description for Memory subsystem
- * 	 (SROM, NAND Flash, OneNand, DDR, OneDRAM) on S5PC1XX.
- *
- * 	 Only SROMC is defined as of now
- */
-
-#ifndef __ASM_ARCH_SROMC_H_
-#define __ASM_ARCH_SROMC_H_
-
-#define SMC_DATA16_WIDTH(x)    (1<<((x*4)+0))
-#define SMC_BYTE_ADDR_MODE(x)  (1<<((x*4)+1))  /* 0-> Half-word base address*/
-						/* 1-> Byte base address*/
-#define SMC_WAIT_ENABLE(x)     (1<<((x*4)+2))
-#define SMC_BYTE_ENABLE(x)     (1<<((x*4)+3))
-
-#define SMC_BC_TACS(x) (x << 28) /* 0clk     address set-up */
-#define SMC_BC_TCOS(x) (x << 24) /* 4clk     chip selection set-up */
-#define SMC_BC_TACC(x) (x << 16) /* 14clk    access cycle */
-#define SMC_BC_TCOH(x) (x << 12) /* 1clk     chip selection hold */
-#define SMC_BC_TAH(x)  (x << 8)  /* 4clk     address holding time */
-#define SMC_BC_TACP(x) (x << 4)  /* 6clk     page mode access cycle */
-#define SMC_BC_PMC(x)  (x << 0)  /* normal(1data)page mode configuration */
-
-#ifndef __ASSEMBLY__
-struct s5p_sromc {
-	unsigned int	bw;
-	unsigned int	bc[6];
-};
-#endif	/* __ASSEMBLY__ */
-
-/* Configure the Band Width and Bank Control Regs for required SROMC Bank */
-void s5p_config_sromc(u32 srom_bank, u32 srom_bw_conf, u32 srom_bc_conf);
-
-#endif /* __ASM_ARCH_SMC_H_ */
arch/arm/include/asm/samsung-common/pwm.h new file +55 -0

55 lines not on this page · raw message

arch/arm/include/asm/samsung-common/sromc.h new file +60 -0

60 lines not on this page · raw message

board/samsung/smdk5250/exynos5-dt.c +1 -1
index bb4a82f..734183a 100644
@@ -18,7 +18,7 @@
 #include <asm/arch/mmc.h>
 #include <asm/arch/pinmux.h>
 #include <asm/arch/power.h>
-#include <asm/arch/sromc.h>
+#include <asm/samsung-common/sromc.h>
 #include <power/pmic.h>
 #include <power/max77686_pmic.h>
 #include <tmu.h>
board/samsung/smdkc100/smdkc100.c +6 -5
index 860c851..1e481f9 100644
@@ -8,7 +8,7 @@
 
 #include <common.h>
 #include <asm/io.h>
-#include <asm/arch/sromc.h>
+#include <asm/samsung-common/sromc.h>
 #include <asm/arch/gpio.h>
 #include <netdev.h>
 
@@ -28,10 +28,11 @@ static void smc9115_pre_init(void)
 	s5p_gpio_cfg_pin(&gpio->k0, CONFIG_ENV_SROM_BANK, GPIO_FUNC(2));
 
 	/* Ethernet needs bus width of 16 bits */
-	smc_bw_conf = SMC_DATA16_WIDTH(CONFIG_ENV_SROM_BANK);
-	smc_bc_conf = SMC_BC_TACS(0x0) | SMC_BC_TCOS(0x4) | SMC_BC_TACC(0xe)
-			| SMC_BC_TCOH(0x1) | SMC_BC_TAH(0x4)
-			| SMC_BC_TACP(0x6) | SMC_BC_PMC(0x0);
+	smc_bw_conf = SROMC_DATA16_WIDTH(CONFIG_ENV_SROM_BANK);
+	smc_bc_conf = SROMC_BC_TACS(0x0) | SROMC_BC_TCOS(0x4)
+		| SROMC_BC_TACC(0xe) | SROMC_BC_TCOH(0x1)
+		| SROMC_BC_TAH(0x4) | SROMC_BC_TACP(0x6)
+		| SROMC_BC_PMC(0x0);
 
 	/* Select and configure the SROMC bank */
 	s5p_config_sromc(CONFIG_ENV_SROM_BANK, smc_bw_conf, smc_bc_conf);
board/samsung/smdkv310/smdkv310.c +1 -1
index 81a3060..b85fe14 100644
@@ -12,7 +12,7 @@
 #include <asm/arch/mmc.h>
 #include <asm/arch/periph.h>
 #include <asm/arch/pinmux.h>
-#include <asm/arch/sromc.h>
+#include <asm/samsung-common/sromc.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 struct exynos4_gpio_part1 *gpio1;
spl/Makefile +1 -1
index 6e5299b..d7d7b40 100644
@@ -102,7 +102,7 @@ LIBS-y += arch/$(ARCH)/imx-common/libimx-common.o
 endif
 
 ifeq ($(SOC),exynos)
-LIBS-y += $(CPUDIR)/s5p-common/libs5p-common.o
+LIBS-y += arch/$(ARCH)/cpu/samsung-common/libsamsung-common.o
 endif
 
 # Add GCC lib
Signature · 1 line
1.7.10.4
#12 lore raw

PATCH v3 3/3 arm:samsung:cpu_info: Rename s5p_* to samsung_*

In reply to Lukasz Majewski

Common CPU info code has been refactored to use more generic name - namely samsung_* instead of s5p_*.
This change will prevent code duplication for non armv7a based SoCs (e.g. s3c64xx).

---
Changes for v3:
- New patch

---
 arch/arm/cpu/samsung-common/cpu_info.c  |   10 +++++-----
 arch/arm/include/asm/arch-exynos/cpu.h  |   24 ++++++++++++------------
 arch/arm/include/asm/arch-s5pc1xx/cpu.h |   12 ++++++------
 3 files changed, 23 insertions(+), 23 deletions(-)
arch/arm/cpu/samsung-common/cpu_info.c +5 -5
index e18c4f6..89dc80d 100644
@@ -9,14 +9,14 @@
 #include <asm/arch/clk.h>
 
 /* Default is s5pc100 */
-unsigned int s5p_cpu_id = 0xC100;
+unsigned int samsung_cpu_id = 0xC100;
 /* Default is EVT1 */
-unsigned int s5p_cpu_rev = 1;
+unsigned int samsung_cpu_rev = 1;
 
 #ifdef CONFIG_ARCH_CPU_INIT
 int arch_cpu_init(void)
 {
-	s5p_set_cpu_id();
+	samsung_set_cpu_id();
 
 	return 0;
 }
@@ -24,7 +24,7 @@ int arch_cpu_init(void)
 
 u32 get_device_type(void)
 {
-	return s5p_cpu_id;
+	return samsung_cpu_id;
 }
 
 #ifdef CONFIG_DISPLAY_CPUINFO
@@ -32,7 +32,7 @@ int print_cpuinfo(void)
 {
 	char buf[32];
 
-	printf("CPU:\t%s%X@%sMHz\n", s5p_get_cpu_name(), s5p_cpu_id,
+	printf("CPU:\t%s%X@%sMHz\n", samsung_get_cpu_name(), samsung_cpu_id,
 	       strmhz(buf, get_arm_clk()));
 
 	return 0;
arch/arm/include/asm/arch-exynos/cpu.h +12 -12
index cb924fb..17106df 100644
@@ -124,40 +124,40 @@
 #ifndef __ASSEMBLY__
 #include <asm/io.h>
 /* CPU detection macros */
-extern unsigned int s5p_cpu_id;
-extern unsigned int s5p_cpu_rev;
+extern unsigned int samsung_cpu_id;
+extern unsigned int samsung_cpu_rev;
 
 static inline int s5p_get_cpu_rev(void)
 {
-	return s5p_cpu_rev;
+	return samsung_cpu_rev;
 }
 
-static inline void s5p_set_cpu_id(void)
+static inline void samsung_set_cpu_id(void)
 {
 	unsigned int pro_id = (readl(EXYNOS4_PRO_ID) & 0x00FFF000) >> 12;
 
 	switch (pro_id) {
 	case 0x200:
 		/* Exynos4210 EVT0 */
-		s5p_cpu_id = 0x4210;
-		s5p_cpu_rev = 0;
+		samsung_cpu_id = 0x4210;
+		samsung_cpu_rev = 0;
 		break;
 	case 0x210:
 		/* Exynos4210 EVT1 */
-		s5p_cpu_id = 0x4210;
+		samsung_cpu_id = 0x4210;
 		break;
 	case 0x412:
 		/* Exynos4412 */
-		s5p_cpu_id = 0x4412;
+		samsung_cpu_id = 0x4412;
 		break;
 	case 0x520:
 		/* Exynos5250 */
-		s5p_cpu_id = 0x5250;
+		samsung_cpu_id = 0x5250;
 		break;
 	}
 }
 
-static inline char *s5p_get_cpu_name(void)
+static inline char *samsung_get_cpu_name(void)
 {
 	return EXYNOS_CPU_NAME;
 }
@@ -165,7 +165,7 @@ static inline char *s5p_get_cpu_name(void)
 #define IS_SAMSUNG_TYPE(type, id)			\
 static inline int __attribute__((no_instrument_function)) cpu_is_##type(void) \
 {							\
-	return (s5p_cpu_id >> 12) == id;		\
+	return (samsung_cpu_id >> 12) == id;		\
 }
 
 IS_SAMSUNG_TYPE(exynos4, 0x4)
@@ -175,7 +175,7 @@ IS_SAMSUNG_TYPE(exynos5, 0x5)
 static inline int __attribute__((no_instrument_function)) \
 	proid_is_##type(void)				\
 {							\
-	return s5p_cpu_id == id;			\
+	return samsung_cpu_id == id;			\
 }
 
 IS_EXYNOS_TYPE(exynos4210, 0x4210)
arch/arm/include/asm/arch-s5pc1xx/cpu.h +6 -6
index 4fc5a0c..b3208ce 100644
@@ -50,15 +50,15 @@
 #ifndef __ASSEMBLY__
 #include <asm/io.h>
 /* CPU detection macros */
-extern unsigned int s5p_cpu_id;
+extern unsigned int samsung_cpu_id;
 
-static inline void s5p_set_cpu_id(void)
+static inline void samsung_set_cpu_id(void)
 {
-	s5p_cpu_id = readl(S5PC100_PRO_ID);
-	s5p_cpu_id = 0xC000 | ((s5p_cpu_id & 0x00FFF000) >> 12);
+	samsung_cpu_id = readl(S5PC100_PRO_ID);
+	samsung_cpu_id = 0xC000 | ((samsung_cpu_id & 0x00FFF000) >> 12);
 }
 
-static inline char *s5p_get_cpu_name(void)
+static inline char *samsung_get_cpu_name(void)
 {
 	return S5P_CPU_NAME;
 }
@@ -66,7 +66,7 @@ static inline char *s5p_get_cpu_name(void)
 #define IS_SAMSUNG_TYPE(type, id)			\
 static inline int cpu_is_##type(void)			\
 {							\
-	return s5p_cpu_id == id ? 1 : 0;		\
+	return samsung_cpu_id == id ? 1 : 0;		\
 }
 
 IS_SAMSUNG_TYPE(s5pc100, 0xc100)
Signature · 1 line
1.7.10.4
#13 lore raw

v3 cover arm:exynos:cleanup: Extract common code

In reply to Lukasz Majewski

Hi Minkyu,

Quoted 6 lines

This series of commits attempts to clean-up the Exynos3/4 code. Common code for Exynos3 (S5PV210) and Exynos4 has been extracted.

Moreover it will facilitate support for older Samsung targets - like venerable s3c6410 (arm1176) SoC.

ping.

Quoted 64 lines

Lukasz Majewski (3):
arm:samsung:serial Extract common UART code
arm:samsung: Move common code from ./s5p-common to ./samsung-common/ arm:samsung:cpu_info: Rename s5p_* to samsung_*

 Makefile                                    |    7 +-
 arch/arm/cpu/armv7/exynos/pinmux.c          |    2 +-
 arch/arm/cpu/armv7/s5p-common/Makefile      |   34 ------
 arch/arm/cpu/armv7/s5p-common/cpu_info.c    |   41 -------
 arch/arm/cpu/armv7/s5p-common/pwm.c         |  171

--------------------------
arch/arm/cpu/armv7/s5p-common/sromc.c | 33 -----
arch/arm/cpu/armv7/s5p-common/timer.c | 132
-------------------- arch/arm/cpu/samsung-common/Makefile |
30 +++++ arch/arm/cpu/samsung-common/cpu_info.c | 40 +++++++
arch/arm/cpu/samsung-common/pwm.c | 172
+++++++++++++++++++++++++++
arch/arm/cpu/samsung-common/sromc.c | 33 +++++
arch/arm/cpu/samsung-common/timer.c | 131
++++++++++++++++++++ arch/arm/include/asm/arch-exynos/cpu.h |
24 ++-- arch/arm/include/asm/arch-exynos/pwm.h | 55 ---------

arch/arm/include/asm/arch-exynos/sromc.h    |   55 ---------
arch/arm/include/asm/arch-exynos/uart.h     |   44 -------
arch/arm/include/asm/arch-s5pc1xx/cpu.h     |   12 +-
arch/arm/include/asm/arch-s5pc1xx/pwm.h     |   55 ---------
arch/arm/include/asm/arch-s5pc1xx/sromc.h   |   40 -------
arch/arm/include/asm/arch-s5pc1xx/uart.h    |   44 -------
arch/arm/include/asm/samsung-common/pwm.h   |   55 +++++++++
arch/arm/include/asm/samsung-common/sromc.h |   60 ++++++++++
arch/arm/include/asm/samsung-common/uart.h  |   64 ++++++++++
board/samsung/smdk5250/exynos5-dt.c         |    2 +-
board/samsung/smdkc100/smdkc100.c           |   11 +-
board/samsung/smdkv310/smdkv310.c           |    2 +-
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 +
spl/Makefile                                |    2 +- 36 files

changed, 626 insertions(+), 747 deletions(-) delete mode 100644 arch/arm/cpu/armv7/s5p-common/Makefile delete mode 100644 arch/arm/cpu/armv7/s5p-common/cpu_info.c delete mode 100644 arch/arm/cpu/armv7/s5p-common/pwm.c delete mode 100644 arch/arm/cpu/armv7/s5p-common/sromc.c delete mode 100644 arch/arm/cpu/armv7/s5p-common/timer.c create mode 100644 arch/arm/cpu/samsung-common/Makefile create mode 100644 arch/arm/cpu/samsung-common/cpu_info.c create mode 100644 arch/arm/cpu/samsung-common/pwm.c create mode 100644 arch/arm/cpu/samsung-common/sromc.c create mode 100644 arch/arm/cpu/samsung-common/timer.c delete mode 100644 arch/arm/include/asm/arch-exynos/pwm.h delete mode 100644 arch/arm/include/asm/arch-exynos/sromc.h delete mode 100644 arch/arm/include/asm/arch-exynos/uart.h delete mode 100644 arch/arm/include/asm/arch-s5pc1xx/pwm.h delete mode 100644 arch/arm/include/asm/arch-s5pc1xx/sromc.h delete mode 100644 arch/arm/include/asm/arch-s5pc1xx/uart.h create mode 100644 arch/arm/include/asm/samsung-common/pwm.h create mode 100644 arch/arm/include/asm/samsung-common/sromc.h create mode 100644 arch/arm/include/asm/samsung-common/uart.h

Signature · 5 lines
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group