All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem
@ 2012-09-16 23:20 Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 01/71] serial: Coding style cleanup of struct serial_device Marek Vasut
                   ` (72 more replies)
  0 siblings, 73 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

This patchset is a STAGE 1 of preparation of the stdio and serial subsys
for the driver model.

The idea of this patchset is:

1) Clean up the struct serial_device
   Do a coding style cleanup.
2) Replace .init and .uninit with .start and .stop
   This is to bring struct serial_device much closer to struct stdio_dev
   so later on, these structures can be overlayed and struct serial_device
   can be easily passed to stdio subsystem directly.
3) Do minor cleanups on the PXA and MPC512X
   Basically for PXA this means to remove default_serial_console() call
   from every single PXA board and move it into PXA serial driver. For
   MPC512X, that means properly defining PSC console number.
4) Add support for CONFIG_SERIAL_MULTI into every single driver
   Implement support for both non-multi and multi operation into every
   single serial driver in the U-Boot source tree. This is a vast majority
   of this patchset.
5) Unconditionally enable CONFIG_SERIAL_MULTI
   Enable the multi operation throughout the whole U-Boot tree, both for
   SPL and non-SPL builds. There was also some breakage due to this, so
   this patchset also addresses that with minor fixes.
6) Remove unused code used for the non-multi operation
   Remove code that was used when CONFIG_SERIAL_MULTI was not selected.
   Also remove all occurances of CONFIG_SERIAL_MULTI throughout the source
   tree. Some parts of the code must have been adjusted to cope with this
   since they were initially only written for non-multi operation. These
   were minor adjustments mostly in macros though.

This changeset obviously does mean size growth of U-Boot, therefore some
statistics (stock U-Boot first, patchset last):

Configuring for omap3_beagle board...
   text    data     bss     dec     hex filename
 325687    8456  266888  601031   92bc7 ./u-boot
 326912    8648  266944  602504   93188 ./u-boot
  43082    1812  198020  242914   3b4e2 ./spl/u-boot-spl
  45794    1860  198020  245674   3bfaa ./spl/u-boot-spl

Configuring for P1020RDB-PC_36BIT_SPIFLASH - Board: p1_p2_rdb_pc, Options: P1020RDB,36BIT,SPIFLASH
   text    data     bss     dec     hex filename
 392469   30628  267568  690665   a89e9 ./u-boot
 394550   30940  267600  693090   a9362 ./u-boot

Configuring for grsim_leon2 board...
   text    data     bss     dec     hex filename
  95658    3328    2640  101626   18cfa ./u-boot
  97058    3384    2640  103082   192aa ./u-boot

Configuring for sandbox board...
   text    data     bss     dec     hex filename
 137394    6364   28488  172246   2a0d6 ./u-boot
 138674    6456   28504  173634   2a642 ./u-boot

Marek Vasut (71):
  serial: Coding style cleanup of struct serial_device
  serial: Rename .init() and .uninit() in serial_device
  serial: Properly spell out the structure member names of
    serial_driver
  serial: pxa: Implement default_serial_console in serial_pxa.c
  serial: pxa: Make use of default_serial_console in serial_pxa
  serial: pxa: Make local functions static
  serial: mpc512x: Properly define CONFIG_SYS_PSC3 in config files
  serial: Implement serial_initfunc() macro
  serial: mpc8xx: Move serial registration from serial_initialize()
  serial: s3c24xx: Move serial registration from serial_initialize()
  serial: pxa: Move serial registration from serial_initialize()
  serial: s5p: Move serial registration from serial_initialize()
  serial: microblaze: Move serial registration from serial_initialize()
  serial: mpc512x: Move serial registration from serial_initialize()
  serial: ns16550: Move serial registration from serial_initialize()
  serial: bfin: Remove the bfin_serialN_device exports from serial.h
  serial: bfin: Adjust serial_register_bfin_uart()
  serial: zoom2: Remove zoom2 serial prototypes from serial.h
  serial: bfin: Flip the jtag serial console to CONFIG_SERIAL_MULTI
  serial: mips: Implement CONFIG_SERIAL_MULTI into au1x00 serial driver
  serial: mips: Implement CONFIG_SERIAL_MULTI into asc serial driver
  serial: mips: Implement CONFIG_SERIAL_MULTI into JZ serial driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc5xx serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8220 serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8260 serial
    drivers
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc85xx serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into iop480 serial
    driver
  serial: sparc: Implement CONFIG_SERIAL_MULTI into leon2 serial driver
  serial: sparc: Implement CONFIG_SERIAL_MULTI into leon3 serial driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into marvell serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into amirix serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw serial driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into cogent serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into cpci750 serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into evb64260 serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into ml2 serial driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into sconsole serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into p3mx serial
    driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into altera_jtag serial
    driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into altera serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into atmel serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into lpc32xx serial driver
  serial: mcf: Implement CONFIG_SERIAL_MULTI into MCF serial driver
  serial: Implement CONFIG_SERIAL_MULTI into ns9750 serial driver
  serial: oc: Implement CONFIG_SERIAL_MULTI into OpenCores serial
    driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into s3c4510b serial
    driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into s3c64xx serial driver
  serial: sandbox: Implement CONFIG_SERIAL_MULTI into sandbox serial
    driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into clps7111 serial
    driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into imx serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into ixp serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into ks8695 serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into lh7a40x serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into lpc2292 serial driver
  serial: Implement CONFIG_SERIAL_MULTI into max3100 serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into mxc serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into netarm serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into pl01x serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into s3c44b0 serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into sa1100 serial driver
  serial: sh: Implement CONFIG_SERIAL_MULTI into sh serial driver
  serial: spl: Implement empty functions for SPL
  serial: mxs: spl: Remove empty serial_* functions from SPL code
  serial: ns16550: Call usbtty_poll only in non-SPL build
  serial: Use puts() and hang() instead of panic() in SPL
  serial: Unconditionally enable CONFIG_SERIAL_MULTI
  serial: Remove CONFIG_SERIAL_MULTI from config files
  serial: Remove CONFIG_SERIAL_MULTI from serial drivers
  serial: Remove CONFIG_SERIAL_MULTI from remaining sources
  serial: Compile common/serial.c by default
  serial: Enhance the manual relocation

 arch/arm/cpu/arm926ejs/mxs/spl_boot.c         |    4 -
 arch/arm/lib/board.c                          |    2 -
 arch/blackfin/cpu/jtag-console.c              |   37 +++-
 arch/blackfin/cpu/serial.c                    |    6 +-
 arch/blackfin/lib/board.c                     |    2 -
 arch/m68k/lib/board.c                         |    2 -
 arch/microblaze/lib/board.c                   |    2 -
 arch/mips/cpu/mips32/au1x00/au1x00_serial.c   |   42 ++++-
 arch/mips/cpu/mips32/incaip/asc_serial.c      |   35 +++-
 arch/mips/cpu/xburst/jz_serial.c              |   35 +++-
 arch/nds32/lib/board.c                        |    2 -
 arch/powerpc/cpu/mpc512x/serial.c             |   92 +++-------
 arch/powerpc/cpu/mpc5xx/serial.c              |   69 ++++---
 arch/powerpc/cpu/mpc5xxx/serial.c             |  181 ++++++-------------
 arch/powerpc/cpu/mpc8220/uart.c               |   35 +++-
 arch/powerpc/cpu/mpc8260/serial_scc.c         |   39 ++--
 arch/powerpc/cpu/mpc8260/serial_smc.c         |   39 ++--
 arch/powerpc/cpu/mpc85xx/serial_scc.c         |   39 ++--
 arch/powerpc/cpu/mpc8xx/serial.c              |   43 +++--
 arch/powerpc/cpu/ppc4xx/iop480_uart.c         |   36 +++-
 arch/powerpc/lib/board.c                      |    2 -
 arch/sandbox/lib/board.c                      |    2 -
 arch/sparc/cpu/leon2/serial.c                 |   51 ++++--
 arch/sparc/cpu/leon3/serial.c                 |   51 ++++--
 arch/x86/lib/board.c                          |    2 -
 board/Marvell/common/serial.c                 |   48 +++--
 board/amirix/ap1000/serial.c                  |   35 +++-
 board/balloon3/balloon3.c                     |    5 -
 board/bmw/serial.c                            |   36 +++-
 board/cogent/serial.c                         |   34 +++-
 board/esd/cpci750/serial.c                    |   36 +++-
 board/evb64260/serial.c                       |   54 ++++--
 board/logicpd/zoom2/zoom2_serial.c            |    7 +-
 board/logicpd/zoom2/zoom2_serial.h            |   16 +-
 board/ml2/serial.c                            |   35 +++-
 board/palmld/palmld.c                         |    5 -
 board/palmtc/palmtc.c                         |    5 -
 board/pcippc2/sconsole.c                      |   35 +++-
 board/pdm360ng/pdm360ng.c                     |    6 -
 board/prodrive/p3mx/serial.c                  |   36 +++-
 board/toradex/colibri_pxa270/colibri_pxa270.c |    5 -
 board/trizepsiv/conxs.c                       |    7 -
 board/vpac270/vpac270.c                       |    5 -
 board/zipitz2/zipitz2.c                       |    5 -
 common/Makefile                               |    2 +-
 common/cmd_nvedit.c                           |    2 -
 common/fdt_support.c                          |    4 -
 common/iomux.c                                |    2 -
 common/serial.c                               |  241 ++++++++++++++++---------
 common/stdio.c                                |    2 -
 drivers/serial/altera_jtag_uart.c             |   39 +++-
 drivers/serial/altera_uart.c                  |   51 ++++--
 drivers/serial/atmel_usart.c                  |   35 +++-
 drivers/serial/lpc32xx_hsuart.c               |   57 +++---
 drivers/serial/mcfuart.c                      |   33 +++-
 drivers/serial/ns16550.c                      |    2 +-
 drivers/serial/ns9750_serial.c                |   33 +++-
 drivers/serial/opencores_yanu.c               |   35 +++-
 drivers/serial/s3c4510b_uart.c                |   33 +++-
 drivers/serial/s3c64xx.c                      |   33 +++-
 drivers/serial/sandbox.c                      |   35 +++-
 drivers/serial/serial.c                       |  128 +++----------
 drivers/serial/serial_clps7111.c              |   34 +++-
 drivers/serial/serial_imx.c                   |   36 +++-
 drivers/serial/serial_ixp.c                   |   36 +++-
 drivers/serial/serial_ks8695.c                |   41 ++++-
 drivers/serial/serial_lh7a40x.c               |   34 +++-
 drivers/serial/serial_lpc2292.c               |   34 +++-
 drivers/serial/serial_max3100.c               |   42 +++--
 drivers/serial/serial_mxc.c                   |   40 ++--
 drivers/serial/serial_netarm.c                |   33 +++-
 drivers/serial/serial_pl01x.c                 |   37 +++-
 drivers/serial/serial_pxa.c                   |   65 ++++---
 drivers/serial/serial_s3c24x0.c               |   78 ++------
 drivers/serial/serial_s3c44b0.c               |   36 +++-
 drivers/serial/serial_s5p.c                   |   27 ++-
 drivers/serial/serial_sa1100.c                |   36 +++-
 drivers/serial/serial_sh.c                    |   33 +++-
 drivers/serial/serial_xuartlite.c             |   70 +++----
 include/common.h                              |   12 --
 include/configs/DU440.h                       |    1 -
 include/configs/KAREF.h                       |    1 -
 include/configs/METROBOX.h                    |    1 -
 include/configs/MPC8569MDS.h                  |    1 -
 include/configs/P1010RDB.h                    |    1 -
 include/configs/P1_P2_RDB.h                   |    1 -
 include/configs/P2020COME.h                   |    1 -
 include/configs/PMC440.h                      |    1 -
 include/configs/TB5200.h                      |    1 -
 include/configs/amcc-common.h                 |    1 -
 include/configs/aria.h                        |    1 +
 include/configs/balloon3.h                    |    1 +
 include/configs/bfin_adi_common.h             |    1 -
 include/configs/colibri_pxa270.h              |    1 +
 include/configs/coreboot.h                    |    1 -
 include/configs/eNET.h                        |    1 -
 include/configs/harmony.h                     |    1 -
 include/configs/jadecpu.h                     |    1 -
 include/configs/korat.h                       |    1 -
 include/configs/lubbock.h                     |    1 +
 include/configs/lwmon.h                       |    1 -
 include/configs/lwmon5.h                      |    1 -
 include/configs/mcc200.h                      |    5 -
 include/configs/mecp5123.h                    |    1 +
 include/configs/medcom.h                      |    1 -
 include/configs/mpc5121ads.h                  |    1 +
 include/configs/omap3_zoom2.h                 |    3 +-
 include/configs/origen.h                      |    1 -
 include/configs/palmld.h                      |    1 +
 include/configs/palmtc.h                      |    1 +
 include/configs/paz00.h                       |    1 -
 include/configs/pcs440ep.h                    |    1 -
 include/configs/pdm360ng.h                    |    3 -
 include/configs/plutux.h                      |    1 -
 include/configs/pxa255_idp.h                  |    1 +
 include/configs/quad100hd.h                   |    1 -
 include/configs/s5p_goni.h                    |    1 -
 include/configs/s5pc210_universal.h           |    1 -
 include/configs/sc3.h                         |    1 -
 include/configs/seaboard.h                    |    1 -
 include/configs/smdk5250.h                    |    1 -
 include/configs/smdkc100.h                    |    1 -
 include/configs/smdkv310.h                    |    1 -
 include/configs/tec.h                         |    1 -
 include/configs/tegra20-common-post.h         |    5 -
 include/configs/trats.h                       |    1 -
 include/configs/trimslice.h                   |    1 -
 include/configs/trizepsiv.h                   |    2 +-
 include/configs/ventana.h                     |    1 -
 include/configs/vpac270.h                     |    1 +
 include/configs/whistler.h                    |    1 -
 include/configs/xaeniax.h                     |    2 +-
 include/configs/zeus.h                        |    1 -
 include/configs/zipitz2.h                     |    1 +
 include/serial.h                              |   79 ++------
 post/board/pdm360ng/coproc_com.c              |    3 -
 136 files changed, 1740 insertions(+), 1166 deletions(-)

Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Michal Simek <monstr@monstr.eu>
Cc: U-Boot DM <u-boot-dm@lists.denx.de>

-- 
1.7.10.4

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

* [U-Boot] [PATCH 01/71] serial: Coding style cleanup of struct serial_device
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 02/71] serial: Rename .init() and .uninit() in serial_device Marek Vasut
                   ` (71 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Do a simple cleanup of the struct serial_device and align it with
current coding style. Checkpatch now reports no errors.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 include/serial.h |   23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/include/serial.h b/include/serial.h
index cbdf8a9..8433ed7 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -5,20 +5,19 @@
 
 struct serial_device {
 	/* enough bytes to match alignment of following func pointer */
-	char name[16];
-
-	int  (*init) (void);
-	int  (*uninit) (void);
-	void (*setbrg) (void);
-	int (*getc) (void);
-	int (*tstc) (void);
-	void (*putc) (const char c);
-	void (*puts) (const char *s);
+	char	name[16];
+
+	int	(*init)(void);
+	int	(*uninit)(void);
+	void	(*setbrg)(void);
+	int	(*getc)(void);
+	int	(*tstc)(void);
+	void	(*putc)(const char c);
+	void	(*puts)(const char *s);
 #if CONFIG_POST & CONFIG_SYS_POST_UART
-	void (*loop) (int);
+	void	(*loop)(int);
 #endif
-
-	struct serial_device *next;
+	struct serial_device	*next;
 };
 
 extern struct serial_device serial_smc_device;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 02/71] serial: Rename .init() and .uninit() in serial_device
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 01/71] serial: Coding style cleanup of struct serial_device Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 03/71] serial: Properly spell out the structure member names of serial_driver Marek Vasut
                   ` (70 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Rename .init() to .start() and .uninit() to .stop() in struct
serial_device. This allows aligning struct serial_device with
closer to struct stdio_dev. The real goal here is to allow
these two structures to converge together and eventually make
one to be a superset of the other.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 arch/blackfin/cpu/serial.c |    4 ++--
 common/serial.c            |   16 ++++++++--------
 include/serial.h           |    4 ++--
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/blackfin/cpu/serial.c b/arch/blackfin/cpu/serial.c
index 6603dc0..33677ba 100644
--- a/arch/blackfin/cpu/serial.c
+++ b/arch/blackfin/cpu/serial.c
@@ -236,8 +236,8 @@ static void uart##n##_loop(int state) \
 \
 struct serial_device bfin_serial##n##_device = { \
 	.name   = "bfin_uart"#n, \
-	.init   = uart##n##_init, \
-	.uninit = uart##n##_uninit, \
+	.start  = uart##n##_init, \
+	.stop   = uart##n##_uninit, \
 	.setbrg = uart##n##_setbrg, \
 	.getc   = uart##n##_getc, \
 	.tstc   = uart##n##_tstc, \
diff --git a/common/serial.c b/common/serial.c
index 75cc1bb..5740d4f 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -35,7 +35,7 @@ static struct serial_device *serial_current;
 void serial_register(struct serial_device *dev)
 {
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
-	dev->init += gd->reloc_off;
+	dev->start += gd->reloc_off;
 	dev->setbrg += gd->reloc_off;
 	dev->getc += gd->reloc_off;
 	dev->tstc += gd->reloc_off;
@@ -136,8 +136,8 @@ void serial_stdio_init(void)
 		strcpy(dev.name, s->name);
 		dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT;
 
-		dev.start = s->init;
-		dev.stop = s->uninit;
+		dev.start = s->start;
+		dev.stop = s->stop;
 		dev.putc = s->putc;
 		dev.puts = s->puts;
 		dev.getc = s->getc;
@@ -168,7 +168,7 @@ void serial_reinit_all(void)
 	struct serial_device *s;
 
 	for (s = serial_devices; s; s = s->next)
-		s->init();
+		s->start();
 }
 
 static struct serial_device *get_current(void)
@@ -188,7 +188,7 @@ static struct serial_device *get_current(void)
 
 int serial_init(void)
 {
-	return get_current()->init();
+	return get_current()->start();
 }
 
 void serial_setbrg(void)
@@ -288,9 +288,9 @@ int uart_post_test(int flags)
 		/* Disable loop back */
 		s->loop(0);
 
-		/* XXX: There is no serial_uninit() !? */
-		if (s->uninit)
-			s->uninit();
+		/* XXX: There is no serial_stop() !? */
+		if (s->stop)
+			s->stop();
 	}
 
  done:
diff --git a/include/serial.h b/include/serial.h
index 8433ed7..eb1388c 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -7,8 +7,8 @@ struct serial_device {
 	/* enough bytes to match alignment of following func pointer */
 	char	name[16];
 
-	int	(*init)(void);
-	int	(*uninit)(void);
+	int	(*start)(void);
+	int	(*stop)(void);
 	void	(*setbrg)(void);
 	int	(*getc)(void);
 	int	(*tstc)(void);
-- 
1.7.10.4

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

* [U-Boot] [PATCH 03/71] serial: Properly spell out the structure member names of serial_driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 01/71] serial: Coding style cleanup of struct serial_device Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 02/71] serial: Rename .init() and .uninit() in serial_device Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-18  6:13   ` Michal Simek
  2012-09-16 23:20 ` [U-Boot] [PATCH 04/71] serial: pxa: Implement default_serial_console in serial_pxa.c Marek Vasut
                   ` (69 subsequent siblings)
  72 siblings, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Properly spell out the whole structure member names when an initialized
varible is instantiated from the struct serial_driver. In case the
structure definition for struct serial_driver undergoes reordering,
there will be no impact on variables defined based on this structure.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: C Nauman <cnauman@diagraph.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Michal Simek <monstr@monstr.eu>
---
 arch/powerpc/cpu/mpc512x/serial.c  |   18 +++++++++---------
 arch/powerpc/cpu/mpc5xxx/serial.c  |   32 ++++++++++++++++----------------
 arch/powerpc/cpu/mpc8xx/serial.c   |   32 ++++++++++++++++----------------
 board/logicpd/zoom2/zoom2_serial.h |   16 ++++++++--------
 drivers/serial/serial.c            |   19 ++++++++++---------
 drivers/serial/serial_pxa.c        |   16 ++++++++--------
 drivers/serial/serial_s3c24x0.c    |   18 +++++++++---------
 drivers/serial/serial_s5p.c        |   19 ++++++++++---------
 drivers/serial/serial_xuartlite.c  |   19 ++++++++++---------
 9 files changed, 96 insertions(+), 93 deletions(-)

diff --git a/arch/powerpc/cpu/mpc512x/serial.c b/arch/powerpc/cpu/mpc512x/serial.c
index 7c53346..f4f52ad 100644
--- a/arch/powerpc/cpu/mpc512x/serial.c
+++ b/arch/powerpc/cpu/mpc512x/serial.c
@@ -319,15 +319,15 @@ int serial_getcts_dev(unsigned int idx)
 		serial_puts_dev(port, s); \
 	}
 
-#define INIT_PSC_SERIAL_STRUCTURE(port, name) { \
-	name, \
-	serial##port##_init, \
-	serial##port##_uninit, \
-	serial##port##_setbrg, \
-	serial##port##_getc, \
-	serial##port##_tstc, \
-	serial##port##_putc, \
-	serial##port##_puts, \
+#define INIT_PSC_SERIAL_STRUCTURE(port, __name) {	\
+	.name	= __name,				\
+	.start	= serial##port##_init,			\
+	.stop	= serial##port##_uninit,		\
+	.setbrg	= serial##port##_setbrg,		\
+	.getc	= serial##port##_getc,			\
+	.tstc	= serial##port##_tstc,			\
+	.putc	= serial##port##_putc,			\
+	.puts	= serial##port##_puts,			\
 }
 
 #if defined(CONFIG_SYS_PSC1)
diff --git a/arch/powerpc/cpu/mpc5xxx/serial.c b/arch/powerpc/cpu/mpc5xxx/serial.c
index aa09f67..9bebff8 100644
--- a/arch/powerpc/cpu/mpc5xxx/serial.c
+++ b/arch/powerpc/cpu/mpc5xxx/serial.c
@@ -338,14 +338,14 @@ int serial1_tstc(void)
 
 struct serial_device serial0_device =
 {
-	"serial0",
-	serial0_init,
-	NULL,
-	serial0_setbrg,
-	serial0_getc,
-	serial0_tstc,
-	serial0_putc,
-	serial0_puts,
+	.name	= "serial0",
+	.start	= serial0_init,
+	.stop	= NULL,
+	.setbrg	= serial0_setbrg,
+	.getc	= serial0_getc,
+	.tstc	= serial0_tstc,
+	.putc	= serial0_putc,
+	.puts	= serial0_puts,
 };
 
 __weak struct serial_device *default_serial_console(void)
@@ -355,14 +355,14 @@ __weak struct serial_device *default_serial_console(void)
 
 struct serial_device serial1_device =
 {
-	"serial1",
-	serial1_init,
-	NULL,
-	serial1_setbrg,
-	serial1_getc,
-	serial1_tstc,
-	serial1_putc,
-	serial1_puts,
+	.name	= "serial1",
+	.start	= serial1_init,
+	.stop	= NULL,
+	.setbrg	= serial1_setbrg,
+	.getc	= serial1_getc,
+	.tstc	= serial1_tstc,
+	.putc	= serial1_putc,
+	.puts	= serial1_puts,
 };
 #endif /* CONFIG_SERIAL_MULTI */
 
diff --git a/arch/powerpc/cpu/mpc8xx/serial.c b/arch/powerpc/cpu/mpc8xx/serial.c
index 9239b24..dc9b323 100644
--- a/arch/powerpc/cpu/mpc8xx/serial.c
+++ b/arch/powerpc/cpu/mpc8xx/serial.c
@@ -390,14 +390,14 @@ smc_tstc(void)
 
 struct serial_device serial_smc_device =
 {
-	"serial_smc",
-	smc_init,
-	NULL,
-	smc_setbrg,
-	smc_getc,
-	smc_tstc,
-	smc_putc,
-	smc_puts,
+	.name	= "serial_smc",
+	.start	= smc_init,
+	.stop	= NULL,
+	.setbrg	= smc_setbrg,
+	.getc	= smc_getc,
+	.tstc	= smc_tstc,
+	.putc	= smc_putc,
+	.puts	= smc_puts,
 };
 
 #endif /* CONFIG_8xx_CONS_SMC1 || CONFIG_8xx_CONS_SMC2 */
@@ -660,14 +660,14 @@ scc_tstc(void)
 
 struct serial_device serial_scc_device =
 {
-	"serial_scc",
-	scc_init,
-	NULL,
-	scc_setbrg,
-	scc_getc,
-	scc_tstc,
-	scc_putc,
-	scc_puts,
+	.name	= "serial_scc",
+	.start	= scc_init,
+	.stop	= NULL,
+	.setbrg	= scc_setbrg,
+	.getc	= scc_getc,
+	.tstc	= scc_tstc,
+	.putc	= scc_putc,
+	.puts	= scc_puts,
 };
 
 #endif	/* CONFIG_8xx_CONS_SCCx */
diff --git a/board/logicpd/zoom2/zoom2_serial.h b/board/logicpd/zoom2/zoom2_serial.h
index 4e30587..61306be 100644
--- a/board/logicpd/zoom2/zoom2_serial.h
+++ b/board/logicpd/zoom2/zoom2_serial.h
@@ -61,14 +61,14 @@ int quad_tstc_##n(void)				\
 }						\
 struct serial_device zoom2_serial_device##n =	\
 {						\
-	N(n),					\
-	quad_init_##n,				\
-	NULL,					\
-	quad_setbrg_##n,			\
-	quad_getc_##n,				\
-	quad_tstc_##n,				\
-	quad_putc_##n,				\
-	quad_puts_##n,				\
+	.name	= N(n),				\
+	.start	= quad_init_##n,		\
+	.stop	= NULL,				\
+	.setbrg	= quad_setbrg_##n,		\
+	.getc	= quad_getc_##n,		\
+	.tstc	= quad_tstc_##n,		\
+	.putc	= quad_putc_##n,		\
+	.puts	= quad_puts_##n,		\
 };
 
 #endif /* ZOOM2_SERIAL_H */
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index b10bab7..9d92dee 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -106,15 +106,16 @@ static NS16550_t serial_ports[4] = {
 	serial_puts_dev(port, s);}
 
 /* Serial device descriptor */
-#define INIT_ESERIAL_STRUCTURE(port, name) {\
-	name,\
-	eserial##port##_init,\
-	NULL,\
-	eserial##port##_setbrg,\
-	eserial##port##_getc,\
-	eserial##port##_tstc,\
-	eserial##port##_putc,\
-	eserial##port##_puts, }
+#define INIT_ESERIAL_STRUCTURE(port, __name) {	\
+	.name	= __name,			\
+	.start	= eserial##port##_init,		\
+	.stop	= NULL,				\
+	.setbrg	= eserial##port##_setbrg,	\
+	.getc	= eserial##port##_getc,		\
+	.tstc	= eserial##port##_tstc,		\
+	.putc	= eserial##port##_putc,		\
+	.puts	= eserial##port##_puts,		\
+}
 
 #endif /* CONFIG_SERIAL_MULTI */
 
diff --git a/drivers/serial/serial_pxa.c b/drivers/serial/serial_pxa.c
index a9976d7..97e3f36 100644
--- a/drivers/serial/serial_pxa.c
+++ b/drivers/serial/serial_pxa.c
@@ -269,14 +269,14 @@ void pxa_puts_dev(unsigned int uart_index, const char *s)
 #define	pxa_uart_desc(uart)						\
 	struct serial_device serial_##uart##_device =			\
 	{								\
-		"serial_"#uart,						\
-		uart##_init,						\
-		NULL,							\
-		uart##_setbrg,						\
-		uart##_getc,						\
-		uart##_tstc,						\
-		uart##_putc,						\
-		uart##_puts,						\
+		.name	= "serial_"#uart,				\
+		.start	= uart##_init,					\
+		.stop	= NULL,						\
+		.setbrg	= uart##_setbrg,				\
+		.getc	= uart##_getc,					\
+		.tstc	= uart##_tstc,					\
+		.putc	= uart##_putc,					\
+		.puts	= uart##_puts,					\
 	};
 
 #define	pxa_uart_multi(uart, UART)					\
diff --git a/drivers/serial/serial_s3c24x0.c b/drivers/serial/serial_s3c24x0.c
index 12bcdd3..fa6aac0 100644
--- a/drivers/serial/serial_s3c24x0.c
+++ b/drivers/serial/serial_s3c24x0.c
@@ -69,15 +69,15 @@ DECLARE_GLOBAL_DATA_PTR;
 		serial_puts_dev(port, s); \
 	}
 
-#define INIT_S3C_SERIAL_STRUCTURE(port, name) { \
-	name, \
-	s3serial##port##_init, \
-	NULL,\
-	s3serial##port##_setbrg, \
-	s3serial##port##_getc, \
-	s3serial##port##_tstc, \
-	s3serial##port##_putc, \
-	s3serial##port##_puts, \
+#define INIT_S3C_SERIAL_STRUCTURE(port, __name) {	\
+	.name	= __name,				\
+	.start	= s3serial##port##_init,		\
+	.stop	= NULL,					\
+	.setbrg	= s3serial##port##_setbrg,		\
+	.getc	= s3serial##port##_getc,		\
+	.tstc	= s3serial##port##_tstc,		\
+	.putc	= s3serial##port##_putc,		\
+	.puts	= s3serial##port##_puts,		\
 }
 
 #endif /* CONFIG_SERIAL_MULTI */
diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c
index 6819bb0..43cbc4f 100644
--- a/drivers/serial/serial_s5p.c
+++ b/drivers/serial/serial_s5p.c
@@ -183,15 +183,16 @@ int s5p_serial##port##_tstc(void) { return serial_tstc_dev(port); } \
 void s5p_serial##port##_putc(const char c) { serial_putc_dev(c, port); } \
 void s5p_serial##port##_puts(const char *s) { serial_puts_dev(s, port); }
 
-#define INIT_S5P_SERIAL_STRUCTURE(port, name) { \
-	name, \
-	s5p_serial##port##_init, \
-	NULL, \
-	s5p_serial##port##_setbrg, \
-	s5p_serial##port##_getc, \
-	s5p_serial##port##_tstc, \
-	s5p_serial##port##_putc, \
-	s5p_serial##port##_puts, }
+#define INIT_S5P_SERIAL_STRUCTURE(port, __name) {	\
+	.name	= __name,				\
+	.start	= s5p_serial##port##_init,		\
+	.stop	= NULL,					\
+	.setbrg	= s5p_serial##port##_setbrg,		\
+	.getc	= s5p_serial##port##_getc,		\
+	.tstc	= s5p_serial##port##_tstc,		\
+	.putc	= s5p_serial##port##_putc,		\
+	.puts	= s5p_serial##port##_puts,		\
+}
 
 DECLARE_S5P_SERIAL_FUNCTIONS(0);
 struct serial_device s5p_serial0_device =
diff --git a/drivers/serial/serial_xuartlite.c b/drivers/serial/serial_xuartlite.c
index 3a38f9e..2b869c1 100644
--- a/drivers/serial/serial_xuartlite.c
+++ b/drivers/serial/serial_xuartlite.c
@@ -138,15 +138,16 @@ int serial_tstc(void)
 				{ uartlite_serial_puts(s, port); }
 
 /* Serial device descriptor */
-#define INIT_ESERIAL_STRUCTURE(port, name) {\
-	name,\
-	userial##port##_init,\
-	NULL,\
-	userial##port##_setbrg,\
-	userial##port##_getc,\
-	userial##port##_tstc,\
-	userial##port##_putc,\
-	userial##port##_puts, }
+#define INIT_ESERIAL_STRUCTURE(port, __name) {	\
+	.name	= __name,			\
+	.start	= userial##port##_init,		\
+	.stop	= NULL,				\
+	.setbrg	= userial##port##_setbrg,	\
+	.getc	= userial##port##_getc,		\
+	.tstc	= userial##port##_tstc,		\
+	.putc	= userial##port##_putc,		\
+	.puts	= userial##port##_puts,		\
+}
 
 DECLARE_ESERIAL_FUNCTIONS(0);
 struct serial_device uartlite_serial0_device =
-- 
1.7.10.4

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

* [U-Boot] [PATCH 04/71] serial: pxa: Implement default_serial_console in serial_pxa.c
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (2 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 03/71] serial: Properly spell out the structure member names of serial_driver Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 05/71] serial: pxa: Make use of default_serial_console in serial_pxa Marek Vasut
                   ` (68 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Implement weak default_serial_console() function in serial_pxa
driver, which gets available in case CONFIG_SERIAL_MULTI is
enabled. This will get helpful in subsequent patches, which will
encapsulate PXA's struct serial_device instances in serial_pxa
driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 drivers/serial/serial_pxa.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/serial/serial_pxa.c b/drivers/serial/serial_pxa.c
index 97e3f36..ad2d77e 100644
--- a/drivers/serial/serial_pxa.c
+++ b/drivers/serial/serial_pxa.c
@@ -36,6 +36,7 @@
 #include <asm/arch/pxa-regs.h>
 #include <asm/arch/regs-uart.h>
 #include <asm/io.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -298,4 +299,19 @@ void pxa_puts_dev(unsigned int uart_index, const char *s)
 
 #ifndef	CONFIG_SERIAL_MULTI
 	pxa_uart(serial, UART)
+#else
+__weak struct serial_device *default_serial_console(void)
+{
+#if CONFIG_CONS_INDEX == 1
+	return &serial_hwuart_device;
+#elif CONFIG_CONS_INDEX == 2
+	return &serial_stuart_device;
+#elif CONFIG_CONS_INDEX == 3
+	return &serial_ffuart_device;
+#elif CONFIG_CONS_INDEX == 4
+	return &serial_btuart_device;
+#else
+#error "Bad CONFIG_CONS_INDEX."
+#endif
+}
 #endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 05/71] serial: pxa: Make use of default_serial_console in serial_pxa
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (3 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 04/71] serial: pxa: Implement default_serial_console in serial_pxa.c Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 06/71] serial: pxa: Make local functions static Marek Vasut
                   ` (67 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Make use of the newly implemented weak default_serial_console in
the serial_pxa driver. This removes all reimplementations of this
function from board files.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 board/balloon3/balloon3.c                     |    5 -----
 board/palmld/palmld.c                         |    5 -----
 board/palmtc/palmtc.c                         |    5 -----
 board/toradex/colibri_pxa270/colibri_pxa270.c |    5 -----
 board/trizepsiv/conxs.c                       |    5 -----
 board/vpac270/vpac270.c                       |    5 -----
 board/zipitz2/zipitz2.c                       |    5 -----
 include/configs/balloon3.h                    |    1 +
 include/configs/colibri_pxa270.h              |    1 +
 include/configs/lubbock.h                     |    1 +
 include/configs/palmld.h                      |    1 +
 include/configs/palmtc.h                      |    1 +
 include/configs/pxa255_idp.h                  |    1 +
 include/configs/trizepsiv.h                   |    1 +
 include/configs/vpac270.h                     |    1 +
 include/configs/xaeniax.h                     |    2 +-
 include/configs/zipitz2.h                     |    1 +
 17 files changed, 10 insertions(+), 36 deletions(-)

diff --git a/board/balloon3/balloon3.c b/board/balloon3/balloon3.c
index f360323..c934988 100644
--- a/board/balloon3/balloon3.c
+++ b/board/balloon3/balloon3.c
@@ -53,11 +53,6 @@ int board_init(void)
 	return 0;
 }
 
-struct serial_device *default_serial_console(void)
-{
-	return &serial_stuart_device;
-}
-
 int dram_init(void)
 {
 	pxa2xx_dram_init();
diff --git a/board/palmld/palmld.c b/board/palmld/palmld.c
index 2f1ad20..57b4f5f 100644
--- a/board/palmld/palmld.c
+++ b/board/palmld/palmld.c
@@ -52,11 +52,6 @@ int board_init(void)
 	return 0;
 }
 
-struct serial_device *default_serial_console(void)
-{
-	return &serial_ffuart_device;
-}
-
 int dram_init(void)
 {
 	pxa2xx_dram_init();
diff --git a/board/palmtc/palmtc.c b/board/palmtc/palmtc.c
index 4adf152..b23eec8 100644
--- a/board/palmtc/palmtc.c
+++ b/board/palmtc/palmtc.c
@@ -51,11 +51,6 @@ int board_init(void)
 	return 0;
 }
 
-struct serial_device *default_serial_console(void)
-{
-	return &serial_ffuart_device;
-}
-
 int dram_init(void)
 {
 	pxa2xx_dram_init();
diff --git a/board/toradex/colibri_pxa270/colibri_pxa270.c b/board/toradex/colibri_pxa270/colibri_pxa270.c
index d72e5d6..a6e13c8 100644
--- a/board/toradex/colibri_pxa270/colibri_pxa270.c
+++ b/board/toradex/colibri_pxa270/colibri_pxa270.c
@@ -29,11 +29,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-struct serial_device *default_serial_console(void)
-{
-	return &serial_ffuart_device;
-}
-
 int board_init(void)
 {
 	/* We have RAM, disable cache */
diff --git a/board/trizepsiv/conxs.c b/board/trizepsiv/conxs.c
index 1291195..8fc3c40 100644
--- a/board/trizepsiv/conxs.c
+++ b/board/trizepsiv/conxs.c
@@ -135,11 +135,6 @@ int board_late_init(void)
 	return 0;
 }
 
-struct serial_device *default_serial_console (void)
-{
-	return &serial_ffuart_device;
-}
-
 int dram_init(void)
 {
 	pxa2xx_dram_init();
diff --git a/board/vpac270/vpac270.c b/board/vpac270/vpac270.c
index dfdab9b..2663534 100644
--- a/board/vpac270/vpac270.c
+++ b/board/vpac270/vpac270.c
@@ -50,11 +50,6 @@ int board_init(void)
 	return 0;
 }
 
-struct serial_device *default_serial_console(void)
-{
-	return &serial_ffuart_device;
-}
-
 int dram_init(void)
 {
 #ifndef	CONFIG_ONENAND
diff --git a/board/zipitz2/zipitz2.c b/board/zipitz2/zipitz2.c
index 82dfa82..579841d 100644
--- a/board/zipitz2/zipitz2.c
+++ b/board/zipitz2/zipitz2.c
@@ -62,11 +62,6 @@ int board_init (void)
 	return 0;
 }
 
-struct serial_device *default_serial_console (void)
-{
-	return &serial_stuart_device;
-}
-
 int dram_init(void)
 {
 	pxa2xx_dram_init();
diff --git a/include/configs/balloon3.h b/include/configs/balloon3.h
index 756f409..0f26a5b 100644
--- a/include/configs/balloon3.h
+++ b/include/configs/balloon3.h
@@ -53,6 +53,7 @@
  */
 #define	CONFIG_PXA_SERIAL
 #define	CONFIG_STUART			1
+#define CONFIG_CONS_INDEX		2
 #define	CONFIG_BAUDRATE			115200
 
 /*
diff --git a/include/configs/colibri_pxa270.h b/include/configs/colibri_pxa270.h
index ae84344..bb8bea7 100644
--- a/include/configs/colibri_pxa270.h
+++ b/include/configs/colibri_pxa270.h
@@ -55,6 +55,7 @@
  */
 #define	CONFIG_PXA_SERIAL
 #define	CONFIG_FFUART			1
+#define CONFIG_CONS_INDEX		3
 #define	CONFIG_BAUDRATE			115200
 
 /*
diff --git a/include/configs/lubbock.h b/include/configs/lubbock.h
index 0a1d1e0..ed64960 100644
--- a/include/configs/lubbock.h
+++ b/include/configs/lubbock.h
@@ -64,6 +64,7 @@
  */
 #define CONFIG_PXA_SERIAL
 #define CONFIG_FFUART	       1       /* we use FFUART on LUBBOCK */
+#define CONFIG_CONS_INDEX	3
 
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
diff --git a/include/configs/palmld.h b/include/configs/palmld.h
index 835121e..c5dd494 100644
--- a/include/configs/palmld.h
+++ b/include/configs/palmld.h
@@ -54,6 +54,7 @@
  */
 #define	CONFIG_PXA_SERIAL
 #define	CONFIG_FFUART			1
+#define CONFIG_CONS_INDEX		3
 #define	CONFIG_BAUDRATE			9600
 
 /*
diff --git a/include/configs/palmtc.h b/include/configs/palmtc.h
index bc88354..6e8d8e9 100644
--- a/include/configs/palmtc.h
+++ b/include/configs/palmtc.h
@@ -58,6 +58,7 @@
  */
 #define	CONFIG_PXA_SERIAL
 #define	CONFIG_FFUART			1
+#define CONFIG_CONS_INDEX		3
 #define	CONFIG_BAUDRATE			115200
 
 /*
diff --git a/include/configs/pxa255_idp.h b/include/configs/pxa255_idp.h
index ce9e7d1..24c5363 100644
--- a/include/configs/pxa255_idp.h
+++ b/include/configs/pxa255_idp.h
@@ -99,6 +99,7 @@
  */
 #define CONFIG_PXA_SERIAL
 #define CONFIG_FFUART	       1       /* we use FFUART on LUBBOCK */
+#define CONFIG_CONS_INDEX	3
 
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
diff --git a/include/configs/trizepsiv.h b/include/configs/trizepsiv.h
index 151059a..47c6a23 100644
--- a/include/configs/trizepsiv.h
+++ b/include/configs/trizepsiv.h
@@ -68,6 +68,7 @@
 #define CONFIG_FFUART	       1       /* we use FFUART on Conxs */
 #define CONFIG_BTUART	       1       /* we use BTUART on Conxs */
 #define CONFIG_STUART	       1       /* we use STUART on Conxs */
+#define CONFIG_CONS_INDEX	3
 
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
diff --git a/include/configs/vpac270.h b/include/configs/vpac270.h
index 424a902..5e948f9 100644
--- a/include/configs/vpac270.h
+++ b/include/configs/vpac270.h
@@ -75,6 +75,7 @@
  */
 #define	CONFIG_PXA_SERIAL
 #define	CONFIG_FFUART			1
+#define CONFIG_CONS_INDEX		3
 #define	CONFIG_BAUDRATE			115200
 
 /*
diff --git a/include/configs/xaeniax.h b/include/configs/xaeniax.h
index e399e95..eee2547 100644
--- a/include/configs/xaeniax.h
+++ b/include/configs/xaeniax.h
@@ -54,7 +54,7 @@
  */
 #define CONFIG_PXA_SERIAL
 #define CONFIG_BTUART	       1       /* we use BTUART on XAENIAX */
-
+#define CONFIG_CONS_INDEX	4
 
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
diff --git a/include/configs/zipitz2.h b/include/configs/zipitz2.h
index 8b7e05b..bf6394a 100644
--- a/include/configs/zipitz2.h
+++ b/include/configs/zipitz2.h
@@ -66,6 +66,7 @@
  */
 #define	CONFIG_PXA_SERIAL
 #define	CONFIG_STUART			1
+#define CONFIG_CONS_INDEX		2
 #define	CONFIG_BAUDRATE			115200
 
 /*
-- 
1.7.10.4

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

* [U-Boot] [PATCH 06/71] serial: pxa: Make local functions static
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (4 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 05/71] serial: pxa: Make use of default_serial_console in serial_pxa Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 07/71] serial: mpc512x: Properly define CONFIG_SYS_PSC3 in config files Marek Vasut
                   ` (66 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Make functions that are local-only static, so no hairy symbols
stick out of the serial_pxa driver file.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 drivers/serial/serial_pxa.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/serial/serial_pxa.c b/drivers/serial/serial_pxa.c
index ad2d77e..bd3b3cf 100644
--- a/drivers/serial/serial_pxa.c
+++ b/drivers/serial/serial_pxa.c
@@ -87,7 +87,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #endif
 #endif
 
-uint32_t pxa_uart_get_baud_divider(void)
+static uint32_t pxa_uart_get_baud_divider(void)
 {
 	if (gd->baudrate == 1200)
 		return 768;
@@ -105,7 +105,7 @@ uint32_t pxa_uart_get_baud_divider(void)
 		return 0;
 }
 
-struct pxa_uart_regs *pxa_uart_index_to_regs(uint32_t uart_index)
+static struct pxa_uart_regs *pxa_uart_index_to_regs(uint32_t uart_index)
 {
 	switch (uart_index) {
 	case FFUART_INDEX: return (struct pxa_uart_regs *)FFUART_BASE;
@@ -117,7 +117,7 @@ struct pxa_uart_regs *pxa_uart_index_to_regs(uint32_t uart_index)
 	}
 }
 
-void pxa_uart_toggle_clock(uint32_t uart_index, int enable)
+static void pxa_uart_toggle_clock(uint32_t uart_index, int enable)
 {
 	uint32_t clk_reg, clk_offset, reg;
 
-- 
1.7.10.4

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

* [U-Boot] [PATCH 07/71] serial: mpc512x: Properly define CONFIG_SYS_PSC3 in config files
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (5 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 06/71] serial: pxa: Make local functions static Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 08/71] serial: Implement serial_initfunc() macro Marek Vasut
                   ` (65 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Some of the boards using the mpc512x serial driver didn't properly
define which PSC console to use. This caused breakage when building
with CONFIG_SERIAL_MULTI enabled. Fix this by defining the default
PSC console.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 include/configs/aria.h       |    1 +
 include/configs/mecp5123.h   |    1 +
 include/configs/mpc5121ads.h |    1 +
 3 files changed, 3 insertions(+)

diff --git a/include/configs/aria.h b/include/configs/aria.h
index b21b495..0b31c50 100644
--- a/include/configs/aria.h
+++ b/include/configs/aria.h
@@ -322,6 +322,7 @@
  * Serial console configuration
  */
 #define CONFIG_PSC_CONSOLE		3	/* console on PSC3 */
+#define CONFIG_SYS_PSC3
 #if CONFIG_PSC_CONSOLE != 3
 #error CONFIG_PSC_CONSOLE must be 3
 #endif
diff --git a/include/configs/mecp5123.h b/include/configs/mecp5123.h
index b41bda9..cafc273 100644
--- a/include/configs/mecp5123.h
+++ b/include/configs/mecp5123.h
@@ -222,6 +222,7 @@
  * Serial console configuration
  */
 #define CONFIG_PSC_CONSOLE	3	/* console is on PSC3 */
+#define CONFIG_SYS_PSC3
 #if CONFIG_PSC_CONSOLE != 3
 #error CONFIG_PSC_CONSOLE must be 3
 #endif
diff --git a/include/configs/mpc5121ads.h b/include/configs/mpc5121ads.h
index 9d1327f..3f55d35 100644
--- a/include/configs/mpc5121ads.h
+++ b/include/configs/mpc5121ads.h
@@ -290,6 +290,7 @@
  * Serial console configuration
  */
 #define CONFIG_PSC_CONSOLE	3	/* console is on PSC3 */
+#define CONFIG_SYS_PSC3
 #if CONFIG_PSC_CONSOLE != 3
 #error CONFIG_PSC_CONSOLE must be 3
 #endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 08/71] serial: Implement serial_initfunc() macro
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (6 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 07/71] serial: mpc512x: Properly define CONFIG_SYS_PSC3 in config files Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-18 17:31   ` Tom Rini
  2012-09-16 23:20 ` [U-Boot] [PATCH 09/71] serial: mpc8xx: Move serial registration from serial_initialize() Marek Vasut
                   ` (64 subsequent siblings)
  72 siblings, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

This macro simplifies declaration of weak aliases for per-driver
functions, which register these drivers with the serial subsystem.
The idea here is to push serial_register() calls from serial.c into
the drivers. To avoid pile of ifdef construct as it is now, create
weak aliases to these functions, which in case the driver is not
present alias onto an empty function, which is in turn optimized out
altogether.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>
---
 common/serial.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/common/serial.c b/common/serial.c
index 5740d4f..84dbe50 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -32,6 +32,14 @@ DECLARE_GLOBAL_DATA_PTR;
 static struct serial_device *serial_devices;
 static struct serial_device *serial_current;
 
+static void serial_null(void)
+{
+}
+
+#define serial_initfunc(name)					\
+	void name(void)						\
+		__attribute__((weak, alias("serial_null")));
+
 void serial_register(struct serial_device *dev)
 {
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
-- 
1.7.10.4

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

* [U-Boot] [PATCH 09/71] serial: mpc8xx: Move serial registration from serial_initialize()
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (7 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 08/71] serial: Implement serial_initfunc() macro Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 10/71] serial: s3c24xx: " Marek Vasut
                   ` (63 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Move the registration of serial_smc and serial_scc ports from
default serial_initialize() into CPU specific function called from
serial_initialize(). This slims down the serial_initialize() call
to a bare tracker of all possible serial port registration routines
in U-Boot.

The exports of both serial_scc_device and serial_smc_device can
not yet be removed as they are still used in default_serial_console()
calls.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>
---
 arch/powerpc/cpu/mpc8xx/serial.c |   11 +++++++++++
 common/serial.c                  |   11 +++--------
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/cpu/mpc8xx/serial.c b/arch/powerpc/cpu/mpc8xx/serial.c
index dc9b323..00888e9 100644
--- a/arch/powerpc/cpu/mpc8xx/serial.c
+++ b/arch/powerpc/cpu/mpc8xx/serial.c
@@ -681,6 +681,17 @@ __weak struct serial_device *default_serial_console(void)
 #endif
 }
 
+void mpc8xx_serial_initialize(void)
+{
+#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2)
+	serial_register(&serial_smc_device);
+#endif
+#if	defined(CONFIG_8xx_CONS_SCC1) || defined(CONFIG_8xx_CONS_SCC2) || \
+	defined(CONFIG_8xx_CONS_SCC3) || defined(CONFIG_8xx_CONS_SCC4)
+	serial_register(&serial_scc_device);
+#endif
+}
+
 #ifdef CONFIG_MODEM_SUPPORT
 void disable_putc(void)
 {
diff --git a/common/serial.c b/common/serial.c
index 84dbe50..0187dac 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -40,6 +40,8 @@ static void serial_null(void)
 	void name(void)						\
 		__attribute__((weak, alias("serial_null")));
 
+serial_initfunc(mpc8xx_serial_initialize);
+
 void serial_register(struct serial_device *dev)
 {
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
@@ -57,14 +59,7 @@ void serial_register(struct serial_device *dev)
 
 void serial_initialize(void)
 {
-#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2)
-	serial_register(&serial_smc_device);
-#endif
-#if	defined(CONFIG_8xx_CONS_SCC1) || defined(CONFIG_8xx_CONS_SCC2) || \
-	defined(CONFIG_8xx_CONS_SCC3) || defined(CONFIG_8xx_CONS_SCC4)
-	serial_register(&serial_scc_device);
-#endif
-
+	mpc8xx_serial_initialize();
 #if defined(CONFIG_SYS_NS16550_SERIAL)
 #if defined(CONFIG_SYS_NS16550_COM1)
 	serial_register(&eserial1_device);
-- 
1.7.10.4

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

* [U-Boot] [PATCH 10/71] serial: s3c24xx: Move serial registration from serial_initialize()
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (8 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 09/71] serial: mpc8xx: Move serial registration from serial_initialize() Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 11/71] serial: pxa: " Marek Vasut
                   ` (62 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Move the registration of s3c24xx_serialN_device ports from
default serial_initialize() into driver specific function called from
serial_initialize(). This slims down the serial_initialize() call
to a bare tracker of all possible serial port registration routines
in U-Boot.

The newly implemented s3c24xx_serial_initialize() function, which is
implemented inside of the serial_s3c24xx driver allows encapsulation
of s3c24xx_serialN_device within the serial_s3c24xx driver itself.

Also, remove the exports of s3c24xx_serialN_device from include/serial.h
as they are no longer needed. This is simply because the implementation of
default_serial_console() is wrapped into the serial_s3c24xx driver and
the default console is picked by CONFIG_SERIAL<N> macro in config file.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: C Nauman <cnauman@diagraph.com>
---
 common/serial.c                 |    7 ++-----
 drivers/serial/serial_s3c24x0.c |    7 +++++++
 include/serial.h                |    6 ------
 3 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 0187dac..b210b05 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -41,6 +41,7 @@ static void serial_null(void)
 		__attribute__((weak, alias("serial_null")));
 
 serial_initfunc(mpc8xx_serial_initialize);
+serial_initfunc(s3c24xx_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -83,11 +84,7 @@ void serial_initialize(void)
 #if defined(CONFIG_STUART)
 	serial_register(&serial_stuart_device);
 #endif
-#if defined(CONFIG_S3C2410)
-	serial_register(&s3c24xx_serial0_device);
-	serial_register(&s3c24xx_serial1_device);
-	serial_register(&s3c24xx_serial2_device);
-#endif
+	s3c24xx_serial_initialize();
 #if defined(CONFIG_S5P)
 	serial_register(&s5p_serial0_device);
 	serial_register(&s5p_serial1_device);
diff --git a/drivers/serial/serial_s3c24x0.c b/drivers/serial/serial_s3c24x0.c
index fa6aac0..625c6b7 100644
--- a/drivers/serial/serial_s3c24x0.c
+++ b/drivers/serial/serial_s3c24x0.c
@@ -323,4 +323,11 @@ __weak struct serial_device *default_serial_console(void)
 #error "CONFIG_SERIAL? missing."
 #endif
 }
+
+void s3c24xx_serial_initialize(void)
+{
+	serial_register(&s3c24xx_serial0_device);
+	serial_register(&s3c24xx_serial1_device);
+	serial_register(&s3c24xx_serial2_device);
+}
 #endif /* CONFIG_SERIAL_MULTI */
diff --git a/include/serial.h b/include/serial.h
index eb1388c..aec6506 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -56,12 +56,6 @@ extern struct serial_device uartlite_serial2_device;
 extern struct serial_device uartlite_serial3_device;
 #endif
 
-#if defined(CONFIG_S3C2410)
-extern struct serial_device s3c24xx_serial0_device;
-extern struct serial_device s3c24xx_serial1_device;
-extern struct serial_device s3c24xx_serial2_device;
-#endif
-
 #if defined(CONFIG_S5P)
 extern struct serial_device s5p_serial0_device;
 extern struct serial_device s5p_serial1_device;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 11/71] serial: pxa: Move serial registration from serial_initialize()
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (9 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 10/71] serial: s3c24xx: " Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 12/71] serial: s5p: " Marek Vasut
                   ` (61 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Move the registration of serial_XXuart ports from default
serial_initialize() into driver specific function called from
serial_initialize(). This slims down the serial_initialize() call
to a bare tracker of all possible serial port registration routines
in U-Boot.

The newly implemented pxa_serial_initialize() function, which is
implemented inside of the serial_pxa driver allows encapsulation
of serial_XXuart within the serial_pxa driver itself.

Also, remove the exports of serial_XXuart from include/serial.h
as they are no longer needed. This is simply because the implementation of
default_serial_console() is wrapped into the serial_pxa driver and
the default console is picked by CONFIG_CONS_IDX macro in config file.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c             |   11 ++---------
 drivers/serial/serial_pxa.c |   13 +++++++++++++
 include/serial.h            |    4 ----
 3 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index b210b05..d457d23 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -41,6 +41,7 @@ static void serial_null(void)
 		__attribute__((weak, alias("serial_null")));
 
 serial_initfunc(mpc8xx_serial_initialize);
+serial_initfunc(pxa_serial_initialize);
 serial_initfunc(s3c24xx_serial_initialize);
 
 void serial_register(struct serial_device *dev)
@@ -75,15 +76,7 @@ void serial_initialize(void)
 	serial_register(&eserial4_device);
 #endif
 #endif /* CONFIG_SYS_NS16550_SERIAL */
-#if defined(CONFIG_FFUART)
-	serial_register(&serial_ffuart_device);
-#endif
-#if defined(CONFIG_BTUART)
-	serial_register(&serial_btuart_device);
-#endif
-#if defined(CONFIG_STUART)
-	serial_register(&serial_stuart_device);
-#endif
+	pxa_serial_initialize();
 	s3c24xx_serial_initialize();
 #if defined(CONFIG_S5P)
 	serial_register(&s5p_serial0_device);
diff --git a/drivers/serial/serial_pxa.c b/drivers/serial/serial_pxa.c
index bd3b3cf..46d7689 100644
--- a/drivers/serial/serial_pxa.c
+++ b/drivers/serial/serial_pxa.c
@@ -314,4 +314,17 @@ __weak struct serial_device *default_serial_console(void)
 #error "Bad CONFIG_CONS_INDEX."
 #endif
 }
+
+void pxa_serial_initialize(void)
+{
+#if defined(CONFIG_FFUART)
+	serial_register(&serial_ffuart_device);
+#endif
+#if defined(CONFIG_BTUART)
+	serial_register(&serial_btuart_device);
+#endif
+#if defined(CONFIG_STUART)
+	serial_register(&serial_stuart_device);
+#endif
+}
 #endif
diff --git a/include/serial.h b/include/serial.h
index aec6506..c64bb04 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -70,10 +70,6 @@ extern struct serial_device zoom2_serial_device2;
 extern struct serial_device zoom2_serial_device3;
 #endif
 
-extern struct serial_device serial_ffuart_device;
-extern struct serial_device serial_btuart_device;
-extern struct serial_device serial_stuart_device;
-
 #if defined(CONFIG_SYS_BFIN_UART)
 extern void serial_register_bfin_uart(void);
 extern struct serial_device bfin_serial0_device;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 12/71] serial: s5p: Move serial registration from serial_initialize()
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (10 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 11/71] serial: pxa: " Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-18  1:28   ` Minkyu Kang
  2012-09-16 23:20 ` [U-Boot] [PATCH 13/71] serial: microblaze: " Marek Vasut
                   ` (60 subsequent siblings)
  72 siblings, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Move the registration of s5p_serialN_device ports from default
serial_initialize() into driver specific function called from
serial_initialize(). This slims down the serial_initialize() call
to a bare tracker of all possible serial port registration routines
in U-Boot.

The newly implemented s5p_serial_initialize() function, which is
implemented inside of the serial_s5p driver allows encapsulation
of s5p_serialN_device within the serial_s5p driver itself.

Also, remove the exports of s5p_serialN_device from include/serial.h
as they are no longer needed. This is simply because the implementation of
default_serial_console() is wrapped into the serial_s5p driver and
the default console is picked by CONFIG_SERIAL<N> macro in config file.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 common/serial.c             |    8 ++------
 drivers/serial/serial_s5p.c |    8 ++++++++
 include/serial.h            |    7 -------
 3 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index d457d23..c021c3f 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -43,6 +43,7 @@ static void serial_null(void)
 serial_initfunc(mpc8xx_serial_initialize);
 serial_initfunc(pxa_serial_initialize);
 serial_initfunc(s3c24xx_serial_initialize);
+serial_initfunc(s5p_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -78,12 +79,7 @@ void serial_initialize(void)
 #endif /* CONFIG_SYS_NS16550_SERIAL */
 	pxa_serial_initialize();
 	s3c24xx_serial_initialize();
-#if defined(CONFIG_S5P)
-	serial_register(&s5p_serial0_device);
-	serial_register(&s5p_serial1_device);
-	serial_register(&s5p_serial2_device);
-	serial_register(&s5p_serial3_device);
-#endif
+	s5p_serial_initialize();
 #if defined(CONFIG_MPC512X)
 #if defined(CONFIG_SYS_PSC1)
 	serial_register(&serial1_device);
diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c
index 43cbc4f..3c41242 100644
--- a/drivers/serial/serial_s5p.c
+++ b/drivers/serial/serial_s5p.c
@@ -221,3 +221,11 @@ __weak struct serial_device *default_serial_console(void)
 #error "CONFIG_SERIAL? missing."
 #endif
 }
+
+void s5p_serial_initialize(void)
+{
+	serial_register(&s5p_serial0_device);
+	serial_register(&s5p_serial1_device);
+	serial_register(&s5p_serial2_device);
+	serial_register(&s5p_serial3_device);
+}
diff --git a/include/serial.h b/include/serial.h
index c64bb04..08a9287 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -56,13 +56,6 @@ extern struct serial_device uartlite_serial2_device;
 extern struct serial_device uartlite_serial3_device;
 #endif
 
-#if defined(CONFIG_S5P)
-extern struct serial_device s5p_serial0_device;
-extern struct serial_device s5p_serial1_device;
-extern struct serial_device s5p_serial2_device;
-extern struct serial_device s5p_serial3_device;
-#endif
-
 #if defined(CONFIG_OMAP3_ZOOM2)
 extern struct serial_device zoom2_serial_device0;
 extern struct serial_device zoom2_serial_device1;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 13/71] serial: microblaze: Move serial registration from serial_initialize()
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (11 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 12/71] serial: s5p: " Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-18  6:14   ` Michal Simek
  2012-09-16 23:20 ` [U-Boot] [PATCH 14/71] serial: mpc512x: " Marek Vasut
                   ` (59 subsequent siblings)
  72 siblings, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Move the registration of xuartlite_serialN_device ports from
default serial_initialize() into driver specific function called from
serial_initialize(). This slims down the serial_initialize() call
to a bare tracker of all possible serial port registration routines
in U-Boot.

The newly implemented xuartlite_serial_initialize() function, which is
implemented inside of the serial_xuartlite driver allows encapsulation
of xuartlite_serialN_device within the serial_xuartlite driver itself.

Also, remove the exports of xuartlite_serialN_device from include/serial.h
as they are no longer needed. This is simply because the implementation of
default_serial_console() is wrapped into the serial_xuartlite driver and
the default console is picked by CONFIG_SERIAL<N> macro in config file.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Michal Simek <monstr@monstr.eu>
---
 common/serial.c                   |   16 ++--------------
 drivers/serial/serial_xuartlite.c |   16 ++++++++++++++++
 include/serial.h                  |    7 -------
 3 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index c021c3f..e19a17f 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -44,6 +44,7 @@ serial_initfunc(mpc8xx_serial_initialize);
 serial_initfunc(pxa_serial_initialize);
 serial_initfunc(s3c24xx_serial_initialize);
 serial_initfunc(s5p_serial_initialize);
+serial_initfunc(uartlite_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -97,20 +98,7 @@ void serial_initialize(void)
 #if defined(CONFIG_SYS_BFIN_UART)
 	serial_register_bfin_uart();
 #endif
-#if defined(CONFIG_XILINX_UARTLITE)
-# ifdef XILINX_UARTLITE_BASEADDR
-	serial_register(&uartlite_serial0_device);
-# endif /* XILINX_UARTLITE_BASEADDR */
-# ifdef XILINX_UARTLITE_BASEADDR1
-	serial_register(&uartlite_serial1_device);
-# endif /* XILINX_UARTLITE_BASEADDR1 */
-# ifdef XILINX_UARTLITE_BASEADDR2
-	serial_register(&uartlite_serial2_device);
-# endif /* XILINX_UARTLITE_BASEADDR2 */
-# ifdef XILINX_UARTLITE_BASEADDR3
-	serial_register(&uartlite_serial3_device);
-# endif /* XILINX_UARTLITE_BASEADDR3 */
-#endif /* CONFIG_XILINX_UARTLITE */
+	uartlite_serial_initialize();
 	serial_assign(default_serial_console()->name);
 }
 
diff --git a/drivers/serial/serial_xuartlite.c b/drivers/serial/serial_xuartlite.c
index 2b869c1..d90c42d 100644
--- a/drivers/serial/serial_xuartlite.c
+++ b/drivers/serial/serial_xuartlite.c
@@ -177,4 +177,20 @@ __weak struct serial_device *default_serial_console(void)
 	return &uartlite_serial3_device;
 # endif /* XILINX_UARTLITE_BASEADDR3 */
 }
+
+void uartlite_serial_initialize(void)
+{
+#ifdef XILINX_UARTLITE_BASEADDR
+	serial_register(&uartlite_serial0_device);
+#endif /* XILINX_UARTLITE_BASEADDR */
+#ifdef XILINX_UARTLITE_BASEADDR1
+	serial_register(&uartlite_serial1_device);
+#endif /* XILINX_UARTLITE_BASEADDR1 */
+#ifdef XILINX_UARTLITE_BASEADDR2
+	serial_register(&uartlite_serial2_device);
+#endif /* XILINX_UARTLITE_BASEADDR2 */
+#ifdef XILINX_UARTLITE_BASEADDR3
+	serial_register(&uartlite_serial3_device);
+#endif /* XILINX_UARTLITE_BASEADDR3 */
+}
 #endif /* CONFIG_SERIAL_MULTI */
diff --git a/include/serial.h b/include/serial.h
index 08a9287..73991a6 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -49,13 +49,6 @@ extern struct serial_device serial4_device;
 extern struct serial_device serial6_device;
 #endif
 
-#if defined(CONFIG_XILINX_UARTLITE)
-extern struct serial_device uartlite_serial0_device;
-extern struct serial_device uartlite_serial1_device;
-extern struct serial_device uartlite_serial2_device;
-extern struct serial_device uartlite_serial3_device;
-#endif
-
 #if defined(CONFIG_OMAP3_ZOOM2)
 extern struct serial_device zoom2_serial_device0;
 extern struct serial_device zoom2_serial_device1;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 14/71] serial: mpc512x: Move serial registration from serial_initialize()
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (12 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 13/71] serial: microblaze: " Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 15/71] serial: ns16550: " Marek Vasut
                   ` (58 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Move the registration of serialN_device ports from default
serial_initialize() into driver specific function called from
serial_initialize(). This slims down the serial_initialize() call
to a bare tracker of all possible serial port registration routines
in U-Boot.

The newly implemented mpc512x_serial_initialize() function, which is
implemented inside of the mpc512x serial driver allows encapsulation
of serialN_device within the mpc512x serial driver itself.

Also, remove the exports of serialN_device from include/serial.h
as they are no longer needed. This is simply because the implementation of
default_serial_console() is wrapped into the mpx512x serial driver and
the default console is picked by CONFIG_SERIAL<N> macro in config file.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/powerpc/cpu/mpc512x/serial.c |   16 ++++++++++++++++
 common/serial.c                   |   16 ++--------------
 include/serial.h                  |    7 -------
 3 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/arch/powerpc/cpu/mpc512x/serial.c b/arch/powerpc/cpu/mpc512x/serial.c
index f4f52ad..bc10c50 100644
--- a/arch/powerpc/cpu/mpc512x/serial.c
+++ b/arch/powerpc/cpu/mpc512x/serial.c
@@ -365,6 +365,22 @@ __weak struct serial_device *default_serial_console(void)
 #endif
 }
 
+void mpc512x_serial_initialize(void)
+{
+#if defined(CONFIG_SYS_PSC1)
+	serial_register(&serial1_device);
+#endif
+#if defined(CONFIG_SYS_PSC3)
+	serial_register(&serial3_device);
+#endif
+#if defined(CONFIG_SYS_PSC4)
+	serial_register(&serial4_device);
+#endif
+#if defined(CONFIG_SYS_PSC6)
+	serial_register(&serial6_device);
+#endif
+}
+
 #else
 
 void serial_setbrg(void)
diff --git a/common/serial.c b/common/serial.c
index e19a17f..08c6e2a 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -44,6 +44,7 @@ serial_initfunc(mpc8xx_serial_initialize);
 serial_initfunc(pxa_serial_initialize);
 serial_initfunc(s3c24xx_serial_initialize);
 serial_initfunc(s5p_serial_initialize);
+serial_initfunc(mpc512x_serial_initialize);
 serial_initfunc(uartlite_serial_initialize);
 
 void serial_register(struct serial_device *dev)
@@ -81,20 +82,7 @@ void serial_initialize(void)
 	pxa_serial_initialize();
 	s3c24xx_serial_initialize();
 	s5p_serial_initialize();
-#if defined(CONFIG_MPC512X)
-#if defined(CONFIG_SYS_PSC1)
-	serial_register(&serial1_device);
-#endif
-#if defined(CONFIG_SYS_PSC3)
-	serial_register(&serial3_device);
-#endif
-#if defined(CONFIG_SYS_PSC4)
-	serial_register(&serial4_device);
-#endif
-#if defined(CONFIG_SYS_PSC6)
-	serial_register(&serial6_device);
-#endif
-#endif
+	mpc512x_serial_initialize();
 #if defined(CONFIG_SYS_BFIN_UART)
 	serial_register_bfin_uart();
 #endif
diff --git a/include/serial.h b/include/serial.h
index 73991a6..497f49a 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -42,13 +42,6 @@ extern struct serial_device eserial4_device;
 
 #endif
 
-#if defined(CONFIG_MPC512X)
-extern struct serial_device serial1_device;
-extern struct serial_device serial3_device;
-extern struct serial_device serial4_device;
-extern struct serial_device serial6_device;
-#endif
-
 #if defined(CONFIG_OMAP3_ZOOM2)
 extern struct serial_device zoom2_serial_device0;
 extern struct serial_device zoom2_serial_device1;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 15/71] serial: ns16550: Move serial registration from serial_initialize()
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (13 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 14/71] serial: mpc512x: " Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 16/71] serial: bfin: Remove the bfin_serialN_device exports from serial.h Marek Vasut
                   ` (57 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Move the registration of eserialN_device ports from default
serial_initialize() into driver specific function called from
serial_initialize(). This slims down the serial_initialize() call
to a bare tracker of all possible serial port registration routines
in U-Boot.

The newly implemented ns16550_serial_initialize() function, which is
implemented inside of the ns16550 serial driver allows encapsulation
of eserialN_device within the ns16550 serial driver itself.

Also, remove the exports of eserialN_device from include/serial.h
as they are no longer needed. This is simply because the implementation of
default_serial_console() is wrapped into the ns16550 serial driver and
the default console is picked by CONFIG_SERIAL<N> macro in config file.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Michal Simek <monstr@monstr.eu>
---
 common/serial.c         |   16 ++--------------
 drivers/serial/serial.c |   16 ++++++++++++++++
 include/serial.h        |    8 ++------
 3 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 08c6e2a..faad804 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -41,6 +41,7 @@ static void serial_null(void)
 		__attribute__((weak, alias("serial_null")));
 
 serial_initfunc(mpc8xx_serial_initialize);
+serial_initfunc(ns16550_serial_initialize);
 serial_initfunc(pxa_serial_initialize);
 serial_initfunc(s3c24xx_serial_initialize);
 serial_initfunc(s5p_serial_initialize);
@@ -65,20 +66,7 @@ void serial_register(struct serial_device *dev)
 void serial_initialize(void)
 {
 	mpc8xx_serial_initialize();
-#if defined(CONFIG_SYS_NS16550_SERIAL)
-#if defined(CONFIG_SYS_NS16550_COM1)
-	serial_register(&eserial1_device);
-#endif
-#if defined(CONFIG_SYS_NS16550_COM2)
-	serial_register(&eserial2_device);
-#endif
-#if defined(CONFIG_SYS_NS16550_COM3)
-	serial_register(&eserial3_device);
-#endif
-#if defined(CONFIG_SYS_NS16550_COM4)
-	serial_register(&eserial4_device);
-#endif
-#endif /* CONFIG_SYS_NS16550_SERIAL */
+	ns16550_serial_initialize();
 	pxa_serial_initialize();
 	s3c24xx_serial_initialize();
 	s5p_serial_initialize();
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index 9d92dee..00ad97c 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -340,4 +340,20 @@ __weak struct serial_device *default_serial_console(void)
 #endif
 }
 
+void ns16550_serial_initialize(void)
+{
+#if defined(CONFIG_SYS_NS16550_COM1)
+	serial_register(&eserial1_device);
+#endif
+#if defined(CONFIG_SYS_NS16550_COM2)
+	serial_register(&eserial2_device);
+#endif
+#if defined(CONFIG_SYS_NS16550_COM3)
+	serial_register(&eserial3_device);
+#endif
+#if defined(CONFIG_SYS_NS16550_COM4)
+	serial_register(&eserial4_device);
+#endif
+}
+
 #endif /* CONFIG_SERIAL_MULTI */
diff --git a/include/serial.h b/include/serial.h
index 497f49a..6a42904 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -33,14 +33,10 @@ extern struct serial_device *default_serial_console(void);
 	defined(CONFIG_TEGRA20) || defined(CONFIG_SYS_COREBOOT)
 extern struct serial_device serial0_device;
 extern struct serial_device serial1_device;
-#if defined(CONFIG_SYS_NS16550_SERIAL)
+#endif
+
 extern struct serial_device eserial1_device;
 extern struct serial_device eserial2_device;
-extern struct serial_device eserial3_device;
-extern struct serial_device eserial4_device;
-#endif /* CONFIG_SYS_NS16550_SERIAL */
-
-#endif
 
 #if defined(CONFIG_OMAP3_ZOOM2)
 extern struct serial_device zoom2_serial_device0;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 16/71] serial: bfin: Remove the bfin_serialN_device exports from serial.h
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (14 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 15/71] serial: ns16550: " Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 17/71] serial: bfin: Adjust serial_register_bfin_uart() Marek Vasut
                   ` (56 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Remove the exports from serial.h as they are only used in the blackfin
serial driver. Furthermore, they are only used for registration, which
is handled already inside that driver and default_serial_port() call,
which is also handled in that driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Mike Frysinger <vapier@gentoo.org>
---
 include/serial.h |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/include/serial.h b/include/serial.h
index 6a42904..b405792 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -47,10 +47,6 @@ extern struct serial_device zoom2_serial_device3;
 
 #if defined(CONFIG_SYS_BFIN_UART)
 extern void serial_register_bfin_uart(void);
-extern struct serial_device bfin_serial0_device;
-extern struct serial_device bfin_serial1_device;
-extern struct serial_device bfin_serial2_device;
-extern struct serial_device bfin_serial3_device;
 #endif
 
 extern void serial_register(struct serial_device *);
-- 
1.7.10.4

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

* [U-Boot] [PATCH 17/71] serial: bfin: Adjust serial_register_bfin_uart()
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (15 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 16/71] serial: bfin: Remove the bfin_serialN_device exports from serial.h Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 18/71] serial: zoom2: Remove zoom2 serial prototypes from serial.h Marek Vasut
                   ` (55 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Rename the serial_register_bfin_uart() to bfin_initialize_serial()
to be consistent with the rest of the naming. Next, remove it's
prototype from serial.h and properly insert it into serial.c as
the rest of the serial initialization functions.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Mike Frysinger <vapier@gentoo.org>
---
 arch/blackfin/cpu/serial.c |    2 +-
 common/serial.c            |    5 ++---
 include/serial.h           |    4 ----
 3 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/arch/blackfin/cpu/serial.c b/arch/blackfin/cpu/serial.c
index 33677ba..64340ec 100644
--- a/arch/blackfin/cpu/serial.c
+++ b/arch/blackfin/cpu/serial.c
@@ -272,7 +272,7 @@ __weak struct serial_device *default_serial_console(void)
 #endif
 }
 
-void serial_register_bfin_uart(void)
+void bfin_serial_initialize(void)
 {
 #ifdef UART0_DLL
 	serial_register(&bfin_serial0_device);
diff --git a/common/serial.c b/common/serial.c
index faad804..0a43c1b 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -45,6 +45,7 @@ serial_initfunc(ns16550_serial_initialize);
 serial_initfunc(pxa_serial_initialize);
 serial_initfunc(s3c24xx_serial_initialize);
 serial_initfunc(s5p_serial_initialize);
+serial_initfunc(bfin_serial_initialize);
 serial_initfunc(mpc512x_serial_initialize);
 serial_initfunc(uartlite_serial_initialize);
 
@@ -71,9 +72,7 @@ void serial_initialize(void)
 	s3c24xx_serial_initialize();
 	s5p_serial_initialize();
 	mpc512x_serial_initialize();
-#if defined(CONFIG_SYS_BFIN_UART)
-	serial_register_bfin_uart();
-#endif
+	bfin_serial_initialize();
 	uartlite_serial_initialize();
 	serial_assign(default_serial_console()->name);
 }
diff --git a/include/serial.h b/include/serial.h
index b405792..e65dd26 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -45,10 +45,6 @@ extern struct serial_device zoom2_serial_device2;
 extern struct serial_device zoom2_serial_device3;
 #endif
 
-#if defined(CONFIG_SYS_BFIN_UART)
-extern void serial_register_bfin_uart(void);
-#endif
-
 extern void serial_register(struct serial_device *);
 extern void serial_initialize(void);
 extern void serial_stdio_init(void);
-- 
1.7.10.4

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

* [U-Boot] [PATCH 18/71] serial: zoom2: Remove zoom2 serial prototypes from serial.h
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (16 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 17/71] serial: bfin: Adjust serial_register_bfin_uart() Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 19/71] serial: bfin: Flip the jtag serial console to CONFIG_SERIAL_MULTI Marek Vasut
                   ` (54 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Remove the prototypes for zoom2_serial_deviceN from serial.h . This
can't be done right away, as they are referenced from the zoom2
config file. Therefore, adjust the code so the config file only
specifies number of the port. Then, replace the simple return in
default_serial_console() with a switch across possible values, which
returns the zoom2_serial_deviceN . With such adjustment in place,
the exported prototypes in serial.h can be safely removed.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 board/logicpd/zoom2/zoom2_serial.c |    7 ++++++-
 include/configs/omap3_zoom2.h      |    2 +-
 include/serial.h                   |    7 -------
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/board/logicpd/zoom2/zoom2_serial.c b/board/logicpd/zoom2/zoom2_serial.c
index 74f165f..9b7aea8 100644
--- a/board/logicpd/zoom2/zoom2_serial.c
+++ b/board/logicpd/zoom2/zoom2_serial.c
@@ -135,5 +135,10 @@ QUAD_INIT (3)
 
 struct serial_device *default_serial_console(void)
 {
-	return ZOOM2_DEFAULT_SERIAL_DEVICE;
+	switch (ZOOM2_DEFAULT_SERIAL_DEVICE) {
+	case 0: return &zoom2_serial_device0;
+	case 1: return &zoom2_serial_device1;
+	case 2: return &zoom2_serial_device2;
+	case 3: return &zoom2_serial_device3;
+	}
 }
diff --git a/include/configs/omap3_zoom2.h b/include/configs/omap3_zoom2.h
index 4447dff..a7cc5fc 100644
--- a/include/configs/omap3_zoom2.h
+++ b/include/configs/omap3_zoom2.h
@@ -81,7 +81,7 @@
  * 0 - 1 : first  USB with respect to the left edge of the debug board
  * 2 - 3 : second USB with respect to the left edge of the debug board
  */
-#define ZOOM2_DEFAULT_SERIAL_DEVICE	(&zoom2_serial_device0)
+#define ZOOM2_DEFAULT_SERIAL_DEVICE	0
 
 #define V_NS16550_CLK			(1843200)	/* 1.8432 Mhz */
 
diff --git a/include/serial.h b/include/serial.h
index e65dd26..96f0a89 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -38,13 +38,6 @@ extern struct serial_device serial1_device;
 extern struct serial_device eserial1_device;
 extern struct serial_device eserial2_device;
 
-#if defined(CONFIG_OMAP3_ZOOM2)
-extern struct serial_device zoom2_serial_device0;
-extern struct serial_device zoom2_serial_device1;
-extern struct serial_device zoom2_serial_device2;
-extern struct serial_device zoom2_serial_device3;
-#endif
-
 extern void serial_register(struct serial_device *);
 extern void serial_initialize(void);
 extern void serial_stdio_init(void);
-- 
1.7.10.4

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

* [U-Boot] [PATCH 19/71] serial: bfin: Flip the jtag serial console to CONFIG_SERIAL_MULTI
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (17 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 18/71] serial: zoom2: Remove zoom2 serial prototypes from serial.h Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 20/71] serial: mips: Implement CONFIG_SERIAL_MULTI into au1x00 serial driver Marek Vasut
                   ` (53 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Rework the emulation of serial console via JTAG from simple ad-hoc
implementation of serial port routines to CONFIG_SERIAL_MULTI and
enable CONFIG_SERIAL_MULTI unconditionally for blackfin.

In order for the JTAG serial console to take precedence over all
other serial ports available in system, implement override for
default_serial_console call returning this JTAG serial console.

This brings in a bit of a growth of size, but eventually will allow
us to unconditionally enable CONFIG_SERIAL_MULTI throughout the whole
U-Boot and maintain only one serial subsystem.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Mike Frysinger <vapier@gentoo.org>
---
 arch/blackfin/cpu/jtag-console.c  |   37 ++++++++++++++++++++++++++++++-------
 common/serial.c                   |    2 ++
 include/configs/bfin_adi_common.h |    2 +-
 3 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/arch/blackfin/cpu/jtag-console.c b/arch/blackfin/cpu/jtag-console.c
index a77358a..7cddb85 100644
--- a/arch/blackfin/cpu/jtag-console.c
+++ b/arch/blackfin/cpu/jtag-console.c
@@ -194,12 +194,35 @@ int drv_jtag_console_init(void)
 }
 
 #ifdef CONFIG_UART_CONSOLE_IS_JTAG
+#include <serial.h>
 /* Since the JTAG is always available (at power on), allow it to fake a UART */
-void serial_set_baud(uint32_t baud) {}
-void serial_setbrg(void)            {}
-int serial_init(void)               { return 0; }
-void serial_putc(const char c)      __attribute__((alias("jtag_putc")));
-void serial_puts(const char *s)     __attribute__((alias("jtag_puts")));
-int serial_tstc(void)               __attribute__((alias("jtag_tstc")));
-int serial_getc(void)               __attribute__((alias("jtag_getc")));
+void jtag_serial_setbrg(void)
+{
+}
+
+int jtag_serial_init(void)
+{
+	return 0;
+}
+
+static struct serial_device serial_jtag_drv = {
+	.name	= "jtag",
+	.start	= jtag_serial_init,
+	.stop	= NULL,
+	.setbrg	= jtag_serial_setbrg,
+	.putc	= jtag_putc,
+	.puts	= jtag_puts,
+	.tstc	= jtag_tstc,
+	.getc	= jtag_getc,
+};
+
+void bfin_jtag_initialize(void)
+{
+	serial_register(&serial_jtag_drv);
+}
+
+struct serial_device *default_serial_console(void)
+{
+	return &serial_jtag_drv;
+}
 #endif
diff --git a/common/serial.c b/common/serial.c
index 0a43c1b..25aeea0 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -46,6 +46,7 @@ serial_initfunc(pxa_serial_initialize);
 serial_initfunc(s3c24xx_serial_initialize);
 serial_initfunc(s5p_serial_initialize);
 serial_initfunc(bfin_serial_initialize);
+serial_initfunc(bfin_jtag_initialize);
 serial_initfunc(mpc512x_serial_initialize);
 serial_initfunc(uartlite_serial_initialize);
 
@@ -73,6 +74,7 @@ void serial_initialize(void)
 	s5p_serial_initialize();
 	mpc512x_serial_initialize();
 	bfin_serial_initialize();
+	bfin_jtag_initialize();
 	uartlite_serial_initialize();
 	serial_assign(default_serial_console()->name);
 }
diff --git a/include/configs/bfin_adi_common.h b/include/configs/bfin_adi_common.h
index 3fbf5c6..7132f8f 100644
--- a/include/configs/bfin_adi_common.h
+++ b/include/configs/bfin_adi_common.h
@@ -108,11 +108,11 @@
 #define CONFIG_LOADS_ECHO	1
 #define CONFIG_JTAG_CONSOLE
 #define CONFIG_SILENT_CONSOLE
+#define CONFIG_SERIAL_MULTI
 #ifndef CONFIG_BAUDRATE
 # define CONFIG_BAUDRATE	57600
 #endif
 #ifndef CONFIG_DEBUG_EARLY_SERIAL
-# define CONFIG_SERIAL_MULTI
 # define CONFIG_SYS_BFIN_UART
 #endif
 
-- 
1.7.10.4

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

* [U-Boot] [PATCH 20/71] serial: mips: Implement CONFIG_SERIAL_MULTI into au1x00 serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (18 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 19/71] serial: bfin: Flip the jtag serial console to CONFIG_SERIAL_MULTI Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 21/71] serial: mips: Implement CONFIG_SERIAL_MULTI into asc " Marek Vasut
                   ` (52 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into au1x00 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the au1x00 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
---
 arch/mips/cpu/mips32/au1x00/au1x00_serial.c |   74 +++++++++++++++++++++++----
 common/serial.c                             |    3 ++
 2 files changed, 67 insertions(+), 10 deletions(-)

diff --git a/arch/mips/cpu/mips32/au1x00/au1x00_serial.c b/arch/mips/cpu/mips32/au1x00/au1x00_serial.c
index c25ba5a..9682775 100644
--- a/arch/mips/cpu/mips32/au1x00/au1x00_serial.c
+++ b/arch/mips/cpu/mips32/au1x00/au1x00_serial.c
@@ -28,6 +28,8 @@
 #include <config.h>
 #include <common.h>
 #include <asm/au1x00.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 /******************************************************************************
 *
@@ -40,7 +42,7 @@
 * RETURNS: N/A
 */
 
-int serial_init (void)
+static int au1x00_serial_init(void)
 {
 	volatile u32 *uart_fifoctl = (volatile u32*)(UART0_ADDR+UART_FCR);
 	volatile u32 *uart_enable = (volatile u32*)(UART0_ADDR+UART_ENABLE);
@@ -63,7 +65,7 @@ int serial_init (void)
 }
 
 
-void serial_setbrg (void)
+static void au1x00_serial_setbrg(void)
 {
 	volatile u32 *uart_clk = (volatile u32*)(UART0_ADDR+UART_CLK);
 	volatile u32 *uart_lcr = (volatile u32*)(UART0_ADDR+UART_LCR);
@@ -87,12 +89,13 @@ void serial_setbrg (void)
 	*uart_lcr = UART_LCR_WLEN8;
 }
 
-void serial_putc (const char c)
+static void au1x00_serial_putc(const char c)
 {
 	volatile u32 *uart_lsr = (volatile u32*)(UART0_ADDR+UART_LSR);
 	volatile u32 *uart_tx = (volatile u32*)(UART0_ADDR+UART_TX);
 
-	if (c == '\n') serial_putc ('\r');
+	if (c == '\n')
+		au1x00_serial_putc('\r');
 
 	/* Wait for fifo to shift out some bytes */
 	while((*uart_lsr&UART_LSR_THRE)==0);
@@ -100,15 +103,13 @@ void serial_putc (const char c)
 	*uart_tx = (u32)c;
 }
 
-void serial_puts (const char *s)
+static void au1x00_serial_puts(const char *s)
 {
 	while (*s)
-	{
-		serial_putc (*s++);
-	}
+		serial_putc(*s++);
 }
 
-int serial_getc (void)
+static int au1x00_serial_getc(void)
 {
 	volatile u32 *uart_rx = (volatile u32*)(UART0_ADDR+UART_RX);
 	char c;
@@ -119,7 +120,7 @@ int serial_getc (void)
 	return c;
 }
 
-int serial_tstc (void)
+static int au1x00_serial_tstc(void)
 {
 	volatile u32 *uart_lsr = (volatile u32*)(UART0_ADDR+UART_LSR);
 
@@ -129,3 +130,56 @@ int serial_tstc (void)
 	}
 	return 0;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device au1x00_serial_drv = {
+	.name	= "au1x00_serial",
+	.start	= au1x00_serial_init,
+	.stop	= NULL,
+	.setbrg	= au1x00_serial_setbrg,
+	.putc	= au1x00_serial_putc,
+	.puts	= au1x00_serial_puts,
+	.getc	= au1x00_serial_getc,
+	.tstc	= au1x00_serial_tstc,
+};
+
+void au1x00_serial_initialize(void)
+{
+	serial_register(&au1x00_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &au1x00_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return au1x00_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	au1x00_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	au1x00_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	au1x00_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return au1x00_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return au1x00_serial_tstc();
+}
+#endif
diff --git a/common/serial.c b/common/serial.c
index 25aeea0..6ddc5fa 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -49,6 +49,7 @@ serial_initfunc(bfin_serial_initialize);
 serial_initfunc(bfin_jtag_initialize);
 serial_initfunc(mpc512x_serial_initialize);
 serial_initfunc(uartlite_serial_initialize);
+serial_initfunc(au1x00_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -76,6 +77,8 @@ void serial_initialize(void)
 	bfin_serial_initialize();
 	bfin_jtag_initialize();
 	uartlite_serial_initialize();
+	au1x00_serial_initialize();
+
 	serial_assign(default_serial_console()->name);
 }
 
-- 
1.7.10.4

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

* [U-Boot] [PATCH 21/71] serial: mips: Implement CONFIG_SERIAL_MULTI into asc serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (19 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 20/71] serial: mips: Implement CONFIG_SERIAL_MULTI into au1x00 serial driver Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 22/71] serial: mips: Implement CONFIG_SERIAL_MULTI into JZ " Marek Vasut
                   ` (51 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into asc serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the asc driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
---
 arch/mips/cpu/mips32/incaip/asc_serial.c |   67 +++++++++++++++++++++++++++---
 common/serial.c                          |    2 +
 2 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/arch/mips/cpu/mips32/incaip/asc_serial.c b/arch/mips/cpu/mips32/incaip/asc_serial.c
index 7239804..b5f32e2 100644
--- a/arch/mips/cpu/mips32/incaip/asc_serial.c
+++ b/arch/mips/cpu/mips32/incaip/asc_serial.c
@@ -5,6 +5,8 @@
 #include <config.h>
 #include <common.h>
 #include <asm/inca-ip.h>
+#include <serial.h>
+#include <linux/compiler.h>
 #include "asc_serial.h"
 
 
@@ -32,7 +34,7 @@ static volatile incaAsc_t *pAsc = (incaAsc_t *)INCA_IP_ASC;
 * RETURNS: N/A
 */
 
-int serial_init (void)
+static int asc_serial_init(void)
 {
     /* we have to set PMU.EN13 bit to enable an ASC device*/
     INCAASC_PMU_ENABLE(13);
@@ -82,7 +84,7 @@ int serial_init (void)
     return 0;
 }
 
-void serial_setbrg (void)
+static void asc_serial_setbrg(void)
 {
     ulong      uiReloadValue, fdv;
     ulong      f_ASC;
@@ -210,7 +212,7 @@ static int serial_setopt (void)
     return 0;
 }
 
-void serial_putc (const char c)
+static void asc_serial_putc(const char c)
 {
     uint txFl = 0;
 
@@ -234,7 +236,7 @@ void serial_putc (const char c)
     }
 }
 
-void serial_puts (const char *s)
+static void asc_serial_puts(const char *s)
 {
     while (*s)
     {
@@ -242,7 +244,7 @@ void serial_puts (const char *s)
     }
 }
 
-int serial_getc (void)
+static int asc_serial_getc(void)
 {
     ulong symbol_mask;
     char c;
@@ -257,7 +259,7 @@ int serial_getc (void)
     return c;
 }
 
-int serial_tstc (void)
+static int asc_serial_tstc(void)
 {
     int res = 1;
 
@@ -283,3 +285,56 @@ int serial_tstc (void)
 
     return res;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device asc_serial_drv = {
+	.name	= "asc_serial",
+	.start	= asc_serial_init,
+	.stop	= NULL,
+	.setbrg	= asc_serial_setbrg,
+	.putc	= asc_serial_putc,
+	.puts	= asc_serial_puts,
+	.getc	= asc_serial_getc,
+	.tstc	= asc_serial_tstc,
+};
+
+void asc_serial_initialize(void)
+{
+	serial_register(&asc_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &asc_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return asc_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	asc_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	asc_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	asc_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return asc_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return asc_serial_tstc();
+}
+#endif
diff --git a/common/serial.c b/common/serial.c
index 6ddc5fa..d6e83f8 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -50,6 +50,7 @@ serial_initfunc(bfin_jtag_initialize);
 serial_initfunc(mpc512x_serial_initialize);
 serial_initfunc(uartlite_serial_initialize);
 serial_initfunc(au1x00_serial_initialize);
+serial_initfunc(asc_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -78,6 +79,7 @@ void serial_initialize(void)
 	bfin_jtag_initialize();
 	uartlite_serial_initialize();
 	au1x00_serial_initialize();
+	asc_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 22/71] serial: mips: Implement CONFIG_SERIAL_MULTI into JZ serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (20 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 21/71] serial: mips: Implement CONFIG_SERIAL_MULTI into asc " Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 23/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc5xx " Marek Vasut
                   ` (50 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into JZ serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the JZ driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
---
 arch/mips/cpu/xburst/jz_serial.c |   67 ++++++++++++++++++++++++++++++++++----
 common/serial.c                  |    2 ++
 2 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/arch/mips/cpu/xburst/jz_serial.c b/arch/mips/cpu/xburst/jz_serial.c
index e6c48e0..b1e1d27 100644
--- a/arch/mips/cpu/xburst/jz_serial.c
+++ b/arch/mips/cpu/xburst/jz_serial.c
@@ -23,6 +23,8 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/jz4740.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 /*
  * serial_init - initialize a channel
@@ -35,7 +37,7 @@
  */
 struct jz4740_uart *uart = (struct jz4740_uart *)CONFIG_SYS_UART_BASE;
 
-int serial_init(void)
+static int jz_serial_init(void)
 {
 	/* Disable port interrupts while changing hardware */
 	writeb(0, &uart->dlhr_ier);
@@ -62,7 +64,7 @@ int serial_init(void)
 	return 0;
 }
 
-void serial_setbrg(void)
+static void jz_serial_setbrg(void)
 {
 	u32 baud_div, tmp;
 
@@ -79,7 +81,7 @@ void serial_setbrg(void)
 	writeb(tmp, &uart->lcr);
 }
 
-int serial_tstc(void)
+static int jz_serial_tstc(void)
 {
 	if (readb(&uart->lsr) & UART_LSR_DR)
 		return 1;
@@ -87,7 +89,7 @@ int serial_tstc(void)
 	return 0;
 }
 
-void serial_putc(const char c)
+static void jz_serial_putc(const char c)
 {
 	if (c == '\n')
 		serial_putc('\r');
@@ -99,7 +101,7 @@ void serial_putc(const char c)
 	writeb((u8)c, &uart->rbr_thr_dllr);
 }
 
-int serial_getc(void)
+static int jz_serial_getc(void)
 {
 	while (!serial_tstc())
 		;
@@ -107,8 +109,61 @@ int serial_getc(void)
 	return readb(&uart->rbr_thr_dllr);
 }
 
-void serial_puts(const char *s)
+static void jz_serial_puts(const char *s)
 {
 	while (*s)
 		serial_putc(*s++);
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device jz_serial_drv = {
+	.name	= "jz_serial",
+	.start	= jz_serial_init,
+	.stop	= NULL,
+	.setbrg	= jz_serial_setbrg,
+	.putc	= jz_serial_putc,
+	.puts	= jz_serial_puts,
+	.getc	= jz_serial_getc,
+	.tstc	= jz_serial_tstc,
+};
+
+void jz_serial_initialize(void)
+{
+	serial_register(&jz_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &jz_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return jz_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	jz_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	jz_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	jz_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return jz_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return jz_serial_tstc();
+}
+#endif
diff --git a/common/serial.c b/common/serial.c
index d6e83f8..dd35a62 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -51,6 +51,7 @@ serial_initfunc(mpc512x_serial_initialize);
 serial_initfunc(uartlite_serial_initialize);
 serial_initfunc(au1x00_serial_initialize);
 serial_initfunc(asc_serial_initialize);
+serial_initfunc(jz_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -80,6 +81,7 @@ void serial_initialize(void)
 	uartlite_serial_initialize();
 	au1x00_serial_initialize();
 	asc_serial_initialize();
+	jz_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 23/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc5xx serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (21 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 22/71] serial: mips: Implement CONFIG_SERIAL_MULTI into JZ " Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 24/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8220 " Marek Vasut
                   ` (49 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into mpc5xx serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the mpc5xx driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/powerpc/cpu/mpc5xx/serial.c |   95 +++++++++++++++++++++++++++++---------
 common/serial.c                  |    2 +
 2 files changed, 76 insertions(+), 21 deletions(-)

diff --git a/arch/powerpc/cpu/mpc5xx/serial.c b/arch/powerpc/cpu/mpc5xx/serial.c
index 88c6db8..dbaacfc 100644
--- a/arch/powerpc/cpu/mpc5xx/serial.c
+++ b/arch/powerpc/cpu/mpc5xx/serial.c
@@ -33,20 +33,40 @@
 #include <watchdog.h>
 #include <command.h>
 #include <mpc5xx.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
- * Local function prototypes
+ * Local functions
  */
 
-static int ready_to_send(void);
+static int ready_to_send(void)
+{
+	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
+	volatile short status;
+
+	do {
+#if defined(CONFIG_5xx_CONS_SCI1)
+		status = immr->im_qsmcm.qsmcm_sc1sr;
+#else
+		status = immr->im_qsmcm.qsmcm_sc2sr;
+#endif
+
+#if defined(CONFIG_WATCHDOG)
+		reset_5xx_watchdog (immr);
+#endif
+	} while ((status & SCI_TDRE) == 0);
+	return 1;
+
+}
 
 /*
  * Minimal global serial functions needed to use one of the SCI modules.
  */
 
-int serial_init (void)
+static int mpc5xx_serial_init(void)
 {
 	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
 
@@ -63,7 +83,7 @@ int serial_init (void)
 	return 0;
 }
 
-void serial_putc(const char c)
+static void mpc5xx_serial_putc(const char c)
 {
 	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
 
@@ -85,7 +105,7 @@ void serial_putc(const char c)
 	}
 }
 
-int serial_getc(void)
+static int mpc5xx_serial_getc(void)
 {
 	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
 	volatile short status;
@@ -113,7 +133,7 @@ int serial_getc(void)
 	return	tmp;
 }
 
-int serial_tstc()
+static int mpc5xx_serial_tstc()
 {
 	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
 	short status;
@@ -127,7 +147,7 @@ int serial_tstc()
 	return (status & SCI_RDRF);
 }
 
-void serial_setbrg (void)
+static void mpc5xx_serial_setbrg(void)
 {
 	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
 	short scxbr;
@@ -141,7 +161,7 @@ void serial_setbrg (void)
 #endif
 }
 
-void serial_puts (const char *s)
+static void mpc5xx_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc(*s);
@@ -149,22 +169,55 @@ void serial_puts (const char *s)
 	}
 }
 
-int ready_to_send(void)
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device mpc5xx_serial_drv = {
+	.name	= "mpc5xx_serial",
+	.start	= mpc5xx_serial_init,
+	.stop	= NULL,
+	.setbrg	= mpc5xx_serial_setbrg,
+	.putc	= mpc5xx_serial_putc,
+	.puts	= mpc5xx_serial_puts,
+	.getc	= mpc5xx_serial_getc,
+	.tstc	= mpc5xx_serial_tstc,
+};
+
+void mpc5xx_serial_initialize(void)
 {
-	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
-	volatile short status;
+	serial_register(&mpc5xx_serial_drv);
+}
 
-	do {
-#if defined(CONFIG_5xx_CONS_SCI1)
-		status = immr->im_qsmcm.qsmcm_sc1sr;
+__weak struct serial_device *default_serial_console(void)
+{
+	return &mpc5xx_serial_drv;
+}
 #else
-		status = immr->im_qsmcm.qsmcm_sc2sr;
-#endif
+int serial_init(void)
+{
+	return mpc5xx_serial_init();
+}
 
-#if defined(CONFIG_WATCHDOG)
-		reset_5xx_watchdog (immr);
-#endif
-	} while ((status & SCI_TDRE) == 0);
-	return 1;
+void serial_setbrg(void)
+{
+	mpc5xx_serial_setbrg();
+}
 
+void serial_putc(const char c)
+{
+	mpc5xx_serial_putc(c);
 }
+
+void serial_puts(const char *s)
+{
+	mpc5xx_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return mpc5xx_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return mpc5xx_serial_tstc();
+}
+#endif
diff --git a/common/serial.c b/common/serial.c
index dd35a62..69fa583 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -52,6 +52,7 @@ serial_initfunc(uartlite_serial_initialize);
 serial_initfunc(au1x00_serial_initialize);
 serial_initfunc(asc_serial_initialize);
 serial_initfunc(jz_serial_initialize);
+serial_initfunc(mpc5xx_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -82,6 +83,7 @@ void serial_initialize(void)
 	au1x00_serial_initialize();
 	asc_serial_initialize();
 	jz_serial_initialize();
+	mpc5xx_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 24/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8220 serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (22 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 23/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc5xx " Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 25/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8260 serial drivers Marek Vasut
                   ` (48 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into mpc8220 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the mpc8220 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/powerpc/cpu/mpc8220/uart.c |   67 +++++++++++++++++++++++++++++++++++----
 common/serial.c                 |    2 ++
 2 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/cpu/mpc8220/uart.c b/arch/powerpc/cpu/mpc8220/uart.c
index 0c4b536..545c81a 100644
--- a/arch/powerpc/cpu/mpc8220/uart.c
+++ b/arch/powerpc/cpu/mpc8220/uart.c
@@ -29,13 +29,15 @@
 
 #include <common.h>
 #include <mpc8220.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
 #define PSC_BASE   MMAP_PSC1
 
 #if defined(CONFIG_PSC_CONSOLE)
-int serial_init (void)
+static int mpc8220_serial_init(void)
 {
 	volatile psc8220_t *psc = (psc8220_t *) PSC_BASE;
 	u32 counter;
@@ -69,7 +71,7 @@ int serial_init (void)
 	return (0);
 }
 
-void serial_putc (const char c)
+static void mpc8220_serial_putc(const char c)
 {
 	volatile psc8220_t *psc = (psc8220_t *) PSC_BASE;
 
@@ -82,14 +84,14 @@ void serial_putc (const char c)
 	psc->xmitbuf[0] = c;
 }
 
-void serial_puts (const char *s)
+static void mpc8220_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
-int serial_getc (void)
+static int mpc8220_serial_getc(void)
 {
 	volatile psc8220_t *psc = (psc8220_t *) PSC_BASE;
 
@@ -98,14 +100,14 @@ int serial_getc (void)
 	return psc->xmitbuf[2];
 }
 
-int serial_tstc (void)
+static int mpc8220_serial_tstc(void)
 {
 	volatile psc8220_t *psc = (psc8220_t *) PSC_BASE;
 
 	return (psc->sr_csr & PSC_SR_RXRDY);
 }
 
-void serial_setbrg (void)
+static void mpc8220_serial_setbrg(void)
 {
 	volatile psc8220_t *psc = (psc8220_t *) PSC_BASE;
 	u32 counter;
@@ -123,4 +125,57 @@ void serial_setbrg (void)
 
 	psc->cr = PSC_CR_RX_ENABLE | PSC_CR_TX_ENABLE;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device mpc8220_serial_drv = {
+	.name	= "mpc8220_serial",
+	.start	= mpc8220_serial_init,
+	.stop	= NULL,
+	.setbrg	= mpc8220_serial_setbrg,
+	.putc	= mpc8220_serial_putc,
+	.puts	= mpc8220_serial_puts,
+	.getc	= mpc8220_serial_getc,
+	.tstc	= mpc8220_serial_tstc,
+};
+
+void mpc8220_serial_initialize(void)
+{
+	serial_register(&mpc8220_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &mpc8220_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return mpc8220_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	mpc8220_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	mpc8220_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	mpc8220_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return mpc8220_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return mpc8220_serial_tstc();
+}
+#endif
 #endif /* CONFIG_PSC_CONSOLE */
diff --git a/common/serial.c b/common/serial.c
index 69fa583..db06f97 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -53,6 +53,7 @@ serial_initfunc(au1x00_serial_initialize);
 serial_initfunc(asc_serial_initialize);
 serial_initfunc(jz_serial_initialize);
 serial_initfunc(mpc5xx_serial_initialize);
+serial_initfunc(mpc8220_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -84,6 +85,7 @@ void serial_initialize(void)
 	asc_serial_initialize();
 	jz_serial_initialize();
 	mpc5xx_serial_initialize();
+	mpc8220_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 25/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8260 serial drivers
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (23 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 24/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8220 " Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 26/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc85xx serial driver Marek Vasut
                   ` (47 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into both SCC and SMC mpc8260
serial drivers. These drivers were so far only usable directly, but this
patch also adds support for the multi method. This allows using more than
one serial driver alongside the mpc8260 drivers. Also, add a weak
implementation of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/powerpc/cpu/mpc8260/serial_scc.c |   71 ++++++++++++++++++++++++++++-----
 arch/powerpc/cpu/mpc8260/serial_smc.c |   71 ++++++++++++++++++++++++++++-----
 common/serial.c                       |    4 ++
 3 files changed, 124 insertions(+), 22 deletions(-)

diff --git a/arch/powerpc/cpu/mpc8260/serial_scc.c b/arch/powerpc/cpu/mpc8260/serial_scc.c
index 4ab6a28..cfbcd79 100644
--- a/arch/powerpc/cpu/mpc8260/serial_scc.c
+++ b/arch/powerpc/cpu/mpc8260/serial_scc.c
@@ -31,6 +31,8 @@
 #include <common.h>
 #include <mpc8260.h>
 #include <asm/cpm_8260.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -82,7 +84,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #endif
 
-int serial_init (void)
+static int mpc8260_scc_serial_init(void)
 {
 	volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
 	volatile scc_t *sp;
@@ -180,8 +182,7 @@ int serial_init (void)
 	return (0);
 }
 
-void
-serial_setbrg (void)
+static void mpc8260_scc_serial_setbrg(void)
 {
 #if defined(CONFIG_CONS_USE_EXTC)
 	m8260_cpm_extcbrg(SCC_INDEX, gd->baudrate,
@@ -191,8 +192,7 @@ serial_setbrg (void)
 #endif
 }
 
-void
-serial_putc(const char c)
+static void mpc8260_scc_serial_putc(const char c)
 {
 	volatile scc_uart_t	*up;
 	volatile cbd_t		*tbdf;
@@ -217,16 +217,14 @@ serial_putc(const char c)
 	tbdf->cbd_sc |= BD_SC_READY;
 }
 
-void
-serial_puts (const char *s)
+static void mpc8260_scc_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
-int
-serial_getc(void)
+static int mpc8260_scc_serial_getc(void)
 {
 	volatile cbd_t		*rbdf;
 	volatile scc_uart_t	*up;
@@ -250,8 +248,7 @@ serial_getc(void)
 	return (c);
 }
 
-int
-serial_tstc()
+static int mpc8260_scc_serial_tstc(void)
 {
 	volatile cbd_t		*rbdf;
 	volatile scc_uart_t	*up;
@@ -264,6 +261,58 @@ serial_tstc()
 	return ((rbdf->cbd_sc & BD_SC_EMPTY) == 0);
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device mpc8260_scc_serial_drv = {
+	.name	= "mpc8260_scc_serial",
+	.start	= mpc8260_scc_serial_init,
+	.stop	= NULL,
+	.setbrg	= mpc8260_scc_serial_setbrg,
+	.putc	= mpc8260_scc_serial_putc,
+	.puts	= mpc8260_scc_serial_puts,
+	.getc	= mpc8260_scc_serial_getc,
+	.tstc	= mpc8260_scc_serial_tstc,
+};
+
+void mpc8260_scc_serial_initialize(void)
+{
+	serial_register(&mpc8260_scc_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &mpc8260_scc_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return mpc8260_scc_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	mpc8260_scc_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	mpc8260_scc_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	mpc8260_scc_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return mpc8260_scc_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return mpc8260_scc_serial_tstc();
+}
+#endif
 #endif	/* CONFIG_CONS_ON_SCC */
 
 #if defined(CONFIG_KGDB_ON_SCC)
diff --git a/arch/powerpc/cpu/mpc8260/serial_smc.c b/arch/powerpc/cpu/mpc8260/serial_smc.c
index 7b6eaba..012fc98 100644
--- a/arch/powerpc/cpu/mpc8260/serial_smc.c
+++ b/arch/powerpc/cpu/mpc8260/serial_smc.c
@@ -33,6 +33,8 @@
 #include <common.h>
 #include <mpc8260.h>
 #include <asm/cpm_8260.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -91,7 +93,7 @@ static unsigned char brg_map[] = {
 	3,	/* BRG1 for SCC4 */
 };
 
-int serial_init (void)
+static int mpc8260_smc_serial_init(void)
 {
 	volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
 	volatile smc_t *sp;
@@ -183,8 +185,7 @@ int serial_init (void)
 	return (0);
 }
 
-void
-serial_setbrg (void)
+static void mpc8260_smc_serial_setbrg(void)
 {
 #if defined(CONFIG_CONS_USE_EXTC)
 	m8260_cpm_extcbrg(brg_map[SMC_INDEX], gd->baudrate,
@@ -194,8 +195,7 @@ serial_setbrg (void)
 #endif
 }
 
-void
-serial_putc(const char c)
+static void mpc8260_smc_serial_putc(const char c)
 {
 	volatile smc_uart_t	*up;
 	volatile immap_t	*im = (immap_t *)CONFIG_SYS_IMMR;
@@ -216,16 +216,14 @@ serial_putc(const char c)
 	rtx->txbd.cbd_sc |= BD_SC_READY;
 }
 
-void
-serial_puts (const char *s)
+static void mpc8260_smc_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
-int
-serial_getc(void)
+static int mpc8260_smc_serial_getc(void)
 {
 	volatile smc_uart_t	*up;
 	volatile immap_t	*im = (immap_t *)CONFIG_SYS_IMMR;
@@ -254,8 +252,7 @@ serial_getc(void)
 	return(c);
 }
 
-int
-serial_tstc()
+static int mpc8260_smc_serial_tstc(void)
 {
 	volatile smc_uart_t	*up;
 	volatile immap_t	*im = (immap_t *)CONFIG_SYS_IMMR;
@@ -267,6 +264,58 @@ serial_tstc()
 	return !(rtx->rxbd.cbd_sc & BD_SC_EMPTY);
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device mpc8260_smc_serial_drv = {
+	.name	= "mpc8260_smc_serial",
+	.start	= mpc8260_smc_serial_init,
+	.stop	= NULL,
+	.setbrg	= mpc8260_smc_serial_setbrg,
+	.putc	= mpc8260_smc_serial_putc,
+	.puts	= mpc8260_smc_serial_puts,
+	.getc	= mpc8260_smc_serial_getc,
+	.tstc	= mpc8260_smc_serial_tstc,
+};
+
+void mpc8260_smc_serial_initialize(void)
+{
+	serial_register(&mpc8260_smc_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &mpc8260_smc_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return mpc8260_smc_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	mpc8260_smc_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	mpc8260_smc_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	mpc8260_smc_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return mpc8260_smc_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return mpc8260_smc_serial_tstc();
+}
+#endif
 #endif	/* CONFIG_CONS_ON_SMC */
 
 #if defined(CONFIG_KGDB_ON_SMC)
diff --git a/common/serial.c b/common/serial.c
index db06f97..5c8cbdd 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -54,6 +54,8 @@ serial_initfunc(asc_serial_initialize);
 serial_initfunc(jz_serial_initialize);
 serial_initfunc(mpc5xx_serial_initialize);
 serial_initfunc(mpc8220_serial_initialize);
+serial_initfunc(mpc8260_scc_serial_initialize);
+serial_initfunc(mpc8260_smc_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -86,6 +88,8 @@ void serial_initialize(void)
 	jz_serial_initialize();
 	mpc5xx_serial_initialize();
 	mpc8220_serial_initialize();
+	mpc8260_scc_serial_initialize();
+	mpc8260_smc_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 26/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc85xx serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (24 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 25/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8260 serial drivers Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 27/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into iop480 " Marek Vasut
                   ` (46 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into mpc85xx serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the mpc85xx driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/powerpc/cpu/mpc85xx/serial_scc.c |   71 ++++++++++++++++++++++++++++-----
 common/serial.c                       |    2 +
 2 files changed, 62 insertions(+), 11 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/serial_scc.c b/arch/powerpc/cpu/mpc85xx/serial_scc.c
index 2dab212..d192642 100644
--- a/arch/powerpc/cpu/mpc85xx/serial_scc.c
+++ b/arch/powerpc/cpu/mpc85xx/serial_scc.c
@@ -34,6 +34,8 @@
 
 #include <common.h>
 #include <asm/cpm_85xx.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -85,7 +87,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #endif
 
-int serial_init (void)
+static int mpc85xx_serial_init(void)
 {
 	volatile ccsr_cpm_t *cpm = (ccsr_cpm_t *)CONFIG_SYS_MPC85xx_CPM_ADDR;
 	volatile ccsr_cpm_scc_t *sp;
@@ -184,8 +186,7 @@ int serial_init (void)
 	return (0);
 }
 
-void
-serial_setbrg (void)
+static void mpc85xx_serial_setbrg(void)
 {
 #if defined(CONFIG_CONS_USE_EXTC)
 	m8560_cpm_extcbrg(SCC_INDEX, gd->baudrate,
@@ -195,8 +196,7 @@ serial_setbrg (void)
 #endif
 }
 
-void
-serial_putc(const char c)
+static void mpc85xx_serial_putc(const char c)
 {
 	volatile scc_uart_t	*up;
 	volatile cbd_t		*tbdf;
@@ -220,16 +220,14 @@ serial_putc(const char c)
 	tbdf->cbd_sc |= BD_SC_READY;
 }
 
-void
-serial_puts (const char *s)
+static void mpc85xx_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
-int
-serial_getc(void)
+static int mpc85xx_serial_getc(void)
 {
 	volatile cbd_t		*rbdf;
 	volatile scc_uart_t	*up;
@@ -252,8 +250,7 @@ serial_getc(void)
 	return (c);
 }
 
-int
-serial_tstc()
+static int mpc85xx_serial_tstc(void)
 {
 	volatile cbd_t		*rbdf;
 	volatile scc_uart_t	*up;
@@ -265,4 +262,56 @@ serial_tstc()
 	return ((rbdf->cbd_sc & BD_SC_EMPTY) == 0);
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device mpc85xx_serial_drv = {
+	.name	= "mpc85xx_serial",
+	.start	= mpc85xx_serial_init,
+	.stop	= NULL,
+	.setbrg	= mpc85xx_serial_setbrg,
+	.putc	= mpc85xx_serial_putc,
+	.puts	= mpc85xx_serial_puts,
+	.getc	= mpc85xx_serial_getc,
+	.tstc	= mpc85xx_serial_tstc,
+};
+
+void mpc85xx_serial_initialize(void)
+{
+	serial_register(&mpc85xx_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &mpc85xx_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return mpc85xx_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	mpc85xx_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	mpc85xx_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	mpc85xx_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return mpc85xx_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return mpc85xx_serial_tstc();
+}
+#endif
 #endif	/* CONFIG_CONS_ON_SCC */
diff --git a/common/serial.c b/common/serial.c
index 5c8cbdd..aeae51d 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -56,6 +56,7 @@ serial_initfunc(mpc5xx_serial_initialize);
 serial_initfunc(mpc8220_serial_initialize);
 serial_initfunc(mpc8260_scc_serial_initialize);
 serial_initfunc(mpc8260_smc_serial_initialize);
+serial_initfunc(mpc85xx_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -90,6 +91,7 @@ void serial_initialize(void)
 	mpc8220_serial_initialize();
 	mpc8260_scc_serial_initialize();
 	mpc8260_smc_serial_initialize();
+	mpc85xx_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 27/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into iop480 serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (25 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 26/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc85xx serial driver Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-19 10:59   ` Stefan Roese
  2012-09-16 23:20 ` [U-Boot] [PATCH 28/71] serial: sparc: Implement CONFIG_SERIAL_MULTI into leon2 " Marek Vasut
                   ` (45 subsequent siblings)
  72 siblings, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into iop480 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the iop480 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/powerpc/cpu/ppc4xx/iop480_uart.c |   65 ++++++++++++++++++++++++++++++---
 common/serial.c                       |    2 +
 2 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/cpu/ppc4xx/iop480_uart.c b/arch/powerpc/cpu/ppc4xx/iop480_uart.c
index 027ca30..fb25e15 100644
--- a/arch/powerpc/cpu/ppc4xx/iop480_uart.c
+++ b/arch/powerpc/cpu/ppc4xx/iop480_uart.c
@@ -29,6 +29,7 @@
 
 #ifdef CONFIG_SERIAL_MULTI
 #include <serial.h>
+#include <linux/compiler.h>
 #endif
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -132,7 +133,7 @@ DECLARE_GLOBAL_DATA_PTR;
  * as serial console interface.
  */
 
-int serial_init (void)
+static int iop480_serial_init(void)
 {
 	unsigned short br_reg;
 
@@ -153,7 +154,7 @@ int serial_init (void)
 	return (0);
 }
 
-void serial_setbrg (void)
+static void iop480_serial_setbrg(void)
 {
 	unsigned short br_reg;
 
@@ -165,7 +166,7 @@ void serial_setbrg (void)
 	      ((br_reg & 0xff00) >> 8)); /* ... */
 }
 
-void serial_putc (const char c)
+static void iop480_serial_putc(const char c)
 {
 	if (c == '\n')
 		serial_putc ('\r');
@@ -182,14 +183,14 @@ void serial_putc (const char c)
 	}
 }
 
-void serial_puts (const char *s)
+static void iop480_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
-int serial_getc ()
+static int iop480_serial_getc(void)
 {
 	unsigned char status = 0;
 
@@ -212,7 +213,7 @@ int serial_getc ()
 	return (0x000000ff & (int) in_8((u8 *)asyncRxBufferport1));
 }
 
-int serial_tstc ()
+static int iop480_serial_tstc(void)
 {
 	unsigned char status;
 
@@ -233,4 +234,56 @@ int serial_tstc ()
 	return 0;
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device iop480_serial_drv = {
+	.name	= "iop480_serial",
+	.start	= iop480_serial_init,
+	.stop	= NULL,
+	.setbrg	= iop480_serial_setbrg,
+	.putc	= iop480_serial_putc,
+	.puts	= iop480_serial_puts,
+	.getc	= iop480_serial_getc,
+	.tstc	= iop480_serial_tstc,
+};
+
+void iop480_serial_initialize(void)
+{
+	serial_register(&iop480_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &iop480_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return iop480_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	iop480_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	iop480_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	iop480_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return iop480_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return iop480_serial_tstc();
+}
+#endif
 #endif	/* CONFIG_IOP480 */
diff --git a/common/serial.c b/common/serial.c
index aeae51d..398ad30 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -57,6 +57,7 @@ serial_initfunc(mpc8220_serial_initialize);
 serial_initfunc(mpc8260_scc_serial_initialize);
 serial_initfunc(mpc8260_smc_serial_initialize);
 serial_initfunc(mpc85xx_serial_initialize);
+serial_initfunc(iop480_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -92,6 +93,7 @@ void serial_initialize(void)
 	mpc8260_scc_serial_initialize();
 	mpc8260_smc_serial_initialize();
 	mpc85xx_serial_initialize();
+	iop480_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 28/71] serial: sparc: Implement CONFIG_SERIAL_MULTI into leon2 serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (26 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 27/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into iop480 " Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 29/71] serial: sparc: Implement CONFIG_SERIAL_MULTI into leon3 " Marek Vasut
                   ` (44 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into leon2 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the leon2 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Peter Tyser <ptyser@xes-inc.com>
---
 arch/sparc/cpu/leon2/serial.c |   83 ++++++++++++++++++++++++++++++++++-------
 common/serial.c               |    2 +
 2 files changed, 71 insertions(+), 14 deletions(-)

diff --git a/arch/sparc/cpu/leon2/serial.c b/arch/sparc/cpu/leon2/serial.c
index 4f41b8e..61d059b 100644
--- a/arch/sparc/cpu/leon2/serial.c
+++ b/arch/sparc/cpu/leon2/serial.c
@@ -26,6 +26,8 @@
 #include <common.h>
 #include <asm/processor.h>
 #include <asm/leon.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -39,7 +41,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #define READ_DWORD(var) SPARC_NOCACHE_READ_DWORD((unsigned int)&(var))
 #endif
 
-int serial_init(void)
+static int leon2_serial_init(void)
 {
 	LEON2_regs *leon2 = (LEON2_regs *) LEON2_PREGS;
 	LEON2_Uart_regs *regs;
@@ -72,15 +74,7 @@ int serial_init(void)
 	return 0;
 }
 
-void serial_putc(const char c)
-{
-	if (c == '\n')
-		serial_putc_raw('\r');
-
-	serial_putc_raw(c);
-}
-
-void serial_putc_raw(const char c)
+static void leon2_serial_putc_raw(const char c)
 {
 	LEON2_regs *leon2 = (LEON2_regs *) LEON2_PREGS;
 	LEON2_Uart_regs *regs;
@@ -103,14 +97,22 @@ void serial_putc_raw(const char c)
 #endif
 }
 
-void serial_puts(const char *s)
+static void leon2_serial_putc(const char c)
+{
+	if (c == '\n')
+		leon2_serial_putc_raw('\r');
+
+	leon2_serial_putc_raw(c);
+}
+
+static void leon2_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc(*s++);
 	}
 }
 
-int serial_getc(void)
+static int leon2_serial_getc(void)
 {
 	LEON2_regs *leon2 = (LEON2_regs *) LEON2_PREGS;
 	LEON2_Uart_regs *regs;
@@ -128,7 +130,7 @@ int serial_getc(void)
 	return READ_WORD(regs->UART_Channel);
 }
 
-int serial_tstc(void)
+static int leon2_serial_tstc(void)
 {
 	LEON2_regs *leon2 = (LEON2_regs *) LEON2_PREGS;
 	LEON2_Uart_regs *regs;
@@ -143,7 +145,7 @@ int serial_tstc(void)
 }
 
 /* set baud rate for uart */
-void serial_setbrg(void)
+static void leon2_serial_setbrg(void)
 {
 	/* update baud rate settings, read it from gd->baudrate */
 	unsigned int scaler;
@@ -163,3 +165,56 @@ void serial_setbrg(void)
 		regs->UART_Scaler = scaler;
 	}
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device leon2_serial_drv = {
+	.name	= "leon2_serial",
+	.start	= leon2_serial_init,
+	.stop	= NULL,
+	.setbrg	= leon2_serial_setbrg,
+	.putc	= leon2_serial_putc,
+	.puts	= leon2_serial_puts,
+	.getc	= leon2_serial_getc,
+	.tstc	= leon2_serial_tstc,
+};
+
+void leon2_serial_initialize(void)
+{
+	serial_register(&leon2_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &leon2_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return leon2_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	leon2_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	leon2_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	leon2_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return leon2_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return leon2_serial_tstc();
+}
+#endif
diff --git a/common/serial.c b/common/serial.c
index 398ad30..8848126 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -58,6 +58,7 @@ serial_initfunc(mpc8260_scc_serial_initialize);
 serial_initfunc(mpc8260_smc_serial_initialize);
 serial_initfunc(mpc85xx_serial_initialize);
 serial_initfunc(iop480_serial_initialize);
+serial_initfunc(leon2_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -94,6 +95,7 @@ void serial_initialize(void)
 	mpc8260_smc_serial_initialize();
 	mpc85xx_serial_initialize();
 	iop480_serial_initialize();
+	leon2_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 29/71] serial: sparc: Implement CONFIG_SERIAL_MULTI into leon3 serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (27 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 28/71] serial: sparc: Implement CONFIG_SERIAL_MULTI into leon2 " Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 30/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into marvell " Marek Vasut
                   ` (43 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into leon3 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the leon3 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Peter Tyser <ptyser@xes-inc.com>
---
 arch/sparc/cpu/leon3/serial.c |   83 ++++++++++++++++++++++++++++++++++-------
 common/serial.c               |    2 +
 2 files changed, 71 insertions(+), 14 deletions(-)

diff --git a/arch/sparc/cpu/leon3/serial.c b/arch/sparc/cpu/leon3/serial.c
index 4b2fcb8..a110244 100644
--- a/arch/sparc/cpu/leon3/serial.c
+++ b/arch/sparc/cpu/leon3/serial.c
@@ -27,6 +27,8 @@
 #include <asm/processor.h>
 #include <asm/leon.h>
 #include <ambapp.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -42,7 +44,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 ambapp_dev_apbuart *leon3_apbuart = NULL;
 
-int serial_init(void)
+static int leon3_serial_init(void)
 {
 	ambapp_apbdev apbdev;
 	unsigned int tmp;
@@ -72,15 +74,7 @@ int serial_init(void)
 	return -1;		/* didn't find hardware */
 }
 
-void serial_putc(const char c)
-{
-	if (c == '\n')
-		serial_putc_raw('\r');
-
-	serial_putc_raw(c);
-}
-
-void serial_putc_raw(const char c)
+static void leon3_serial_putc_raw(const char c)
 {
 	if (!leon3_apbuart)
 		return;
@@ -97,14 +91,22 @@ void serial_putc_raw(const char c)
 #endif
 }
 
-void serial_puts(const char *s)
+static void leon3_serial_putc(const char c)
+{
+	if (c == '\n')
+		leon3_serial_putc_raw('\r');
+
+	leon3_serial_putc_raw(c);
+}
+
+static void leon3_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc(*s++);
 	}
 }
 
-int serial_getc(void)
+static int leon3_serial_getc(void)
 {
 	if (!leon3_apbuart)
 		return 0;
@@ -116,7 +118,7 @@ int serial_getc(void)
 	return READ_WORD(leon3_apbuart->data);
 }
 
-int serial_tstc(void)
+static int leon3_serial_tstc(void)
 {
 	if (leon3_apbuart)
 		return (READ_WORD(leon3_apbuart->status) &
@@ -125,7 +127,7 @@ int serial_tstc(void)
 }
 
 /* set baud rate for uart */
-void serial_setbrg(void)
+static void leon3_serial_setbrg(void)
 {
 	/* update baud rate settings, read it from gd->baudrate */
 	unsigned int scaler;
@@ -137,3 +139,56 @@ void serial_setbrg(void)
 	}
 	return;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device leon3_serial_drv = {
+	.name	= "leon3_serial",
+	.start	= leon3_serial_init,
+	.stop	= NULL,
+	.setbrg	= leon3_serial_setbrg,
+	.putc	= leon3_serial_putc,
+	.puts	= leon3_serial_puts,
+	.getc	= leon3_serial_getc,
+	.tstc	= leon3_serial_tstc,
+};
+
+void leon3_serial_initialize(void)
+{
+	serial_register(&leon3_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &leon3_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return leon3_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	leon3_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	leon3_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	leon3_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return leon3_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return leon3_serial_tstc();
+}
+#endif
diff --git a/common/serial.c b/common/serial.c
index 8848126..4907009 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -59,6 +59,7 @@ serial_initfunc(mpc8260_smc_serial_initialize);
 serial_initfunc(mpc85xx_serial_initialize);
 serial_initfunc(iop480_serial_initialize);
 serial_initfunc(leon2_serial_initialize);
+serial_initfunc(leon3_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -96,6 +97,7 @@ void serial_initialize(void)
 	mpc85xx_serial_initialize();
 	iop480_serial_initialize();
 	leon2_serial_initialize();
+	leon3_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 30/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into marvell serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (28 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 29/71] serial: sparc: Implement CONFIG_SERIAL_MULTI into leon3 " Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 31/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into amirix " Marek Vasut
                   ` (42 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into marvell serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the marvell driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/Marvell/common/serial.c |   80 ++++++++++++++++++++++++++++++++++-------
 common/serial.c               |    2 ++
 2 files changed, 69 insertions(+), 13 deletions(-)

diff --git a/board/Marvell/common/serial.c b/board/Marvell/common/serial.c
index 3e7f406..a5231eb 100644
--- a/board/Marvell/common/serial.c
+++ b/board/Marvell/common/serial.c
@@ -32,6 +32,9 @@
 
 #include <common.h>
 #include <command.h>
+#include <serial.h>
+#include <linux/compiler.h>
+
 #include "../include/memory.h"
 #include "serial.h"
 
@@ -48,9 +51,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_MPSC
-
-
-int serial_init (void)
+static int marvell_serial_init(void)
 {
 #if (defined CONFIG_SYS_INIT_CHAN1) || (defined CONFIG_SYS_INIT_CHAN2)
 	int clock_divisor = 230400 / gd->baudrate;
@@ -68,7 +69,7 @@ int serial_init (void)
 	return (0);
 }
 
-void serial_putc (const char c)
+static void marvell_serial_putc(const char c)
 {
 	if (c == '\n')
 		mpsc_putchar ('\r');
@@ -76,24 +77,24 @@ void serial_putc (const char c)
 	mpsc_putchar (c);
 }
 
-int serial_getc (void)
+static int marvell_serial_getc(void)
 {
 	return mpsc_getchar ();
 }
 
-int serial_tstc (void)
+static int marvell_serial_tstc(void)
 {
 	return mpsc_test_char ();
 }
 
-void serial_setbrg (void)
+static void marvell_serial_setbrg(void)
 {
 	galbrg_set_baudrate (CONFIG_MPSC_PORT, gd->baudrate);
 }
 
 #else  /* ! CONFIG_MPSC */
 
-int serial_init (void)
+static int marvell_serial_init(void)
 {
 	int clock_divisor = 230400 / gd->baudrate;
 
@@ -106,7 +107,7 @@ int serial_init (void)
 	return (0);
 }
 
-void serial_putc (const char c)
+static void marvell_serial_putc(const char c)
 {
 	if (c == '\n')
 		NS16550_putc (COM_PORTS[CONFIG_SYS_DUART_CHAN], '\r');
@@ -114,17 +115,17 @@ void serial_putc (const char c)
 	NS16550_putc (COM_PORTS[CONFIG_SYS_DUART_CHAN], c);
 }
 
-int serial_getc (void)
+static int marvell_serial_getc(void)
 {
 	return NS16550_getc (COM_PORTS[CONFIG_SYS_DUART_CHAN]);
 }
 
-int serial_tstc (void)
+static int marvell_serial_tstc(void)
 {
 	return NS16550_tstc (COM_PORTS[CONFIG_SYS_DUART_CHAN]);
 }
 
-void serial_setbrg (void)
+static void marvell_serial_setbrg(void)
 {
 	int clock_divisor = 230400 / gd->baudrate;
 
@@ -138,13 +139,66 @@ void serial_setbrg (void)
 
 #endif /* CONFIG_MPSC */
 
-void serial_puts (const char *s)
+static void marvell_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device marvell_serial_drv = {
+	.name	= "marvell_serial",
+	.start	= marvell_serial_init,
+	.stop	= NULL,
+	.setbrg	= marvell_serial_setbrg,
+	.putc	= marvell_serial_putc,
+	.puts	= marvell_serial_puts,
+	.getc	= marvell_serial_getc,
+	.tstc	= marvell_serial_tstc,
+};
+
+void marvell_serial_initialize(void)
+{
+	serial_register(&marvell_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &marvell_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return marvell_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	marvell_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	marvell_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	marvell_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return marvell_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return marvell_serial_tstc();
+}
+#endif
+
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
 {
diff --git a/common/serial.c b/common/serial.c
index 4907009..0288b49 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -60,6 +60,7 @@ serial_initfunc(mpc85xx_serial_initialize);
 serial_initfunc(iop480_serial_initialize);
 serial_initfunc(leon2_serial_initialize);
 serial_initfunc(leon3_serial_initialize);
+serial_initfunc(marvell_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -98,6 +99,7 @@ void serial_initialize(void)
 	iop480_serial_initialize();
 	leon2_serial_initialize();
 	leon3_serial_initialize();
+	marvell_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 31/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into amirix serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (29 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 30/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into marvell " Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-19 11:05   ` Stefan Roese
  2012-09-16 23:20 ` [U-Boot] [PATCH 32/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw " Marek Vasut
                   ` (41 subsequent siblings)
  72 siblings, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into amirix serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the amirix driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/amirix/ap1000/serial.c |   66 ++++++++++++++++++++++++++++++++++++++----
 common/serial.c              |    2 ++
 2 files changed, 62 insertions(+), 6 deletions(-)

diff --git a/board/amirix/ap1000/serial.c b/board/amirix/ap1000/serial.c
index 87003be..2c2e9f9 100644
--- a/board/amirix/ap1000/serial.c
+++ b/board/amirix/ap1000/serial.c
@@ -24,6 +24,8 @@
 #include <asm/processor.h>
 #include <command.h>
 #include <config.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 #include <ns16550.h>
 
@@ -36,7 +38,7 @@ const NS16550_t COM_PORTS[] =
 #define CONFIG_SYS_DUART_CHAN gComPort
 static int gComPort = 0;
 
-int serial_init (void)
+static int amirix_serial_init(void)
 {
 	int clock_divisor = CONFIG_SYS_NS16550_CLK / 16 / gd->baudrate;
 
@@ -46,7 +48,7 @@ int serial_init (void)
 	return 0;
 }
 
-void serial_putc (const char c)
+static void amirix_serial_putc(const char c)
 {
 	if (c == '\n') {
 		NS16550_putc (COM_PORTS[CONFIG_SYS_DUART_CHAN], '\r');
@@ -55,17 +57,17 @@ void serial_putc (const char c)
 	NS16550_putc (COM_PORTS[CONFIG_SYS_DUART_CHAN], c);
 }
 
-int serial_getc (void)
+static int amirix_serial_getc(void)
 {
 	return NS16550_getc (COM_PORTS[CONFIG_SYS_DUART_CHAN]);
 }
 
-int serial_tstc (void)
+static int amirix_serial_tstc(void)
 {
 	return NS16550_tstc (COM_PORTS[CONFIG_SYS_DUART_CHAN]);
 }
 
-void serial_setbrg (void)
+static void amirix_serial_setbrg(void)
 {
 	int clock_divisor = CONFIG_SYS_NS16550_CLK / 16 / gd->baudrate;
 
@@ -77,13 +79,65 @@ void serial_setbrg (void)
 #endif
 }
 
-void serial_puts (const char *s)
+static void amirix_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device amirix_serial_drv = {
+	.name	= "amirix_serial",
+	.start	= amirix_serial_init,
+	.stop	= NULL,
+	.setbrg	= amirix_serial_setbrg,
+	.putc	= amirix_serial_putc,
+	.puts	= amirix_serial_puts,
+	.getc	= amirix_serial_getc,
+	.tstc	= amirix_serial_tstc,
+};
+
+void amirix_serial_initialize(void)
+{
+	serial_register(&amirix_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &amirix_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return amirix_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	amirix_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	amirix_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	amirix_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return amirix_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return amirix_serial_tstc();
+}
+#endif
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
 {
diff --git a/common/serial.c b/common/serial.c
index 0288b49..6a09139 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -61,6 +61,7 @@ serial_initfunc(iop480_serial_initialize);
 serial_initfunc(leon2_serial_initialize);
 serial_initfunc(leon3_serial_initialize);
 serial_initfunc(marvell_serial_initialize);
+serial_initfunc(amirix_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -100,6 +101,7 @@ void serial_initialize(void)
 	leon2_serial_initialize();
 	leon3_serial_initialize();
 	marvell_serial_initialize();
+	amirix_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 32/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (30 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 31/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into amirix " Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-19 11:09   ` Stefan Roese
  2012-09-16 23:20 ` [U-Boot] [PATCH 33/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into cogent " Marek Vasut
                   ` (40 subsequent siblings)
  72 siblings, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into bmw serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the bmw driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/bmw/serial.c |   68 +++++++++++++++++++++++++++++++++++++++++++++++-----
 common/serial.c    |    2 ++
 2 files changed, 64 insertions(+), 6 deletions(-)

diff --git a/board/bmw/serial.c b/board/bmw/serial.c
index 0c97f12..569131f 100644
--- a/board/bmw/serial.c
+++ b/board/bmw/serial.c
@@ -22,6 +22,9 @@
  */
 
 #include <common.h>
+#include <serial.h>
+#include <linux/compiler.h>
+
 #include "ns16550.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -38,7 +41,7 @@ static struct NS16550 *console =
 
 extern ulong get_bus_freq (ulong);
 
-int serial_init (void)
+static int bmw_serial_init(void)
 {
 	int clock_divisor = gd->bus_clk / 16 / gd->baudrate;
 
@@ -47,7 +50,7 @@ int serial_init (void)
 	return (0);
 }
 
-void serial_putc (const char c)
+static void bmw_serial_putc(const char c)
 {
 	if (c == '\n') {
 		serial_putc ('\r');
@@ -55,7 +58,7 @@ void serial_putc (const char c)
 	NS16550_putc (console, c);
 }
 
-void serial_puts (const char *s)
+static void bmw_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
@@ -63,19 +66,72 @@ void serial_puts (const char *s)
 }
 
 
-int serial_getc (void)
+static int bmw_serial_getc(void)
 {
 	return NS16550_getc (console);
 }
 
-int serial_tstc (void)
+static int bmw_serial_tstc(void)
 {
 	return NS16550_tstc (console);
 }
 
-void serial_setbrg (void)
+static void bmw_serial_setbrg(void)
 {
 	int clock_divisor = get_bus_freq (0) / 16 / gd->baudrate;
 
 	NS16550_reinit (console, clock_divisor);
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device bmw_serial_drv = {
+	.name	= "bmw_serial",
+	.start	= bmw_serial_init,
+	.stop	= NULL,
+	.setbrg	= bmw_serial_setbrg,
+	.putc	= bmw_serial_putc,
+	.puts	= bmw_serial_puts,
+	.getc	= bmw_serial_getc,
+	.tstc	= bmw_serial_tstc,
+};
+
+void bmw_serial_initialize(void)
+{
+	serial_register(&bmw_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &bmw_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return bmw_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	bmw_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	bmw_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	bmw_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return bmw_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return bmw_serial_tstc();
+}
+#endif
diff --git a/common/serial.c b/common/serial.c
index 6a09139..19d3a6f 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -62,6 +62,7 @@ serial_initfunc(leon2_serial_initialize);
 serial_initfunc(leon3_serial_initialize);
 serial_initfunc(marvell_serial_initialize);
 serial_initfunc(amirix_serial_initialize);
+serial_initfunc(bmw_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -102,6 +103,7 @@ void serial_initialize(void)
 	leon3_serial_initialize();
 	marvell_serial_initialize();
 	amirix_serial_initialize();
+	bmw_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 33/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into cogent serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (31 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 32/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw " Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:20 ` [U-Boot] [PATCH 34/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into cpci750 " Marek Vasut
                   ` (39 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into cogent serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the cogent driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/cogent/serial.c |   66 ++++++++++++++++++++++++++++++++++++++++++++-----
 common/serial.c       |    2 ++
 2 files changed, 62 insertions(+), 6 deletions(-)

diff --git a/board/cogent/serial.c b/board/cogent/serial.c
index d9c27be..18a9dbf 100644
--- a/board/cogent/serial.c
+++ b/board/cogent/serial.c
@@ -5,6 +5,8 @@
 
 #include <common.h>
 #include <board/cogent/serial.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -25,7 +27,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #error CONFIG_CONS_INDEX must be configured for Cogent motherboard serial
 #endif
 
-int serial_init (void)
+static int cogent_serial_init(void)
 {
 	cma_mb_serial *mbsp = (cma_mb_serial *) CMA_MB_SERIAL_BASE;
 
@@ -38,7 +40,7 @@ int serial_init (void)
 	return (0);
 }
 
-void serial_setbrg (void)
+static void cogent_serial_setbrg(void)
 {
 	cma_mb_serial *mbsp = (cma_mb_serial *) CMA_MB_SERIAL_BASE;
 	unsigned int divisor;
@@ -54,7 +56,7 @@ void serial_setbrg (void)
 	cma_mb_reg_write (&mbsp->ser_lcr, lcr);	/* unset DLAB */
 }
 
-void serial_putc (const char c)
+static void cogent_serial_putc(const char c)
 {
 	cma_mb_serial *mbsp = (cma_mb_serial *) CMA_MB_SERIAL_BASE;
 
@@ -66,13 +68,13 @@ void serial_putc (const char c)
 	cma_mb_reg_write (&mbsp->ser_thr, c);
 }
 
-void serial_puts (const char *s)
+static void cogent_serial_puts(const char *s)
 {
 	while (*s != '\0')
 		serial_putc (*s++);
 }
 
-int serial_getc (void)
+static int cogent_serial_getc(void)
 {
 	cma_mb_serial *mbsp = (cma_mb_serial *) CMA_MB_SERIAL_BASE;
 
@@ -81,13 +83,65 @@ int serial_getc (void)
 	return ((int) cma_mb_reg_read (&mbsp->ser_rhr) & 0x7f);
 }
 
-int serial_tstc (void)
+static int cogent_serial_tstc(void)
 {
 	cma_mb_serial *mbsp = (cma_mb_serial *) CMA_MB_SERIAL_BASE;
 
 	return ((cma_mb_reg_read (&mbsp->ser_lsr) & LSR_DR) != 0);
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device cogent_serial_drv = {
+	.name	= "cogent_serial",
+	.start	= cogent_serial_init,
+	.stop	= NULL,
+	.setbrg	= cogent_serial_setbrg,
+	.putc	= cogent_serial_putc,
+	.puts	= cogent_serial_puts,
+	.getc	= cogent_serial_getc,
+	.tstc	= cogent_serial_tstc,
+};
+
+void cogent_serial_initialize(void)
+{
+	serial_register(&cogent_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &cogent_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return cogent_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	cogent_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	cogent_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	cogent_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return cogent_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return cogent_serial_tstc();
+}
+#endif
 #endif /* CONS_NONE */
 
 #if defined(CONFIG_CMD_KGDB) && \
diff --git a/common/serial.c b/common/serial.c
index 19d3a6f..a51ce99 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -63,6 +63,7 @@ serial_initfunc(leon3_serial_initialize);
 serial_initfunc(marvell_serial_initialize);
 serial_initfunc(amirix_serial_initialize);
 serial_initfunc(bmw_serial_initialize);
+serial_initfunc(cogent_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -104,6 +105,7 @@ void serial_initialize(void)
 	marvell_serial_initialize();
 	amirix_serial_initialize();
 	bmw_serial_initialize();
+	cogent_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 34/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into cpci750 serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (32 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 33/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into cogent " Marek Vasut
@ 2012-09-16 23:20 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 35/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into evb64260 " Marek Vasut
                   ` (38 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:20 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into cpci750 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the cpci750 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/esd/cpci750/serial.c |   67 ++++++++++++++++++++++++++++++++++++++++----
 common/serial.c            |    2 ++
 2 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/board/esd/cpci750/serial.c b/board/esd/cpci750/serial.c
index e1af37e..9ff7c27 100644
--- a/board/esd/cpci750/serial.c
+++ b/board/esd/cpci750/serial.c
@@ -35,6 +35,9 @@
 
 #include <common.h>
 #include <command.h>
+#include <serial.h>
+#include <linux/compiler.h>
+
 #include "../../Marvell/include/memory.h"
 #include "serial.h"
 
@@ -42,14 +45,14 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int serial_init (void)
+static int cpci750_serial_init(void)
 {
 	mpsc_init (gd->baudrate);
 
 	return (0);
 }
 
-void serial_putc (const char c)
+static void cpci750_serial_putc(const char c)
 {
 	if (c == '\n')
 		mpsc_putchar ('\r');
@@ -57,29 +60,81 @@ void serial_putc (const char c)
 	mpsc_putchar (c);
 }
 
-int serial_getc (void)
+static int cpci750_serial_getc(void)
 {
 	return mpsc_getchar ();
 }
 
-int serial_tstc (void)
+static int cpci750_serial_tstc(void)
 {
 	return mpsc_test_char ();
 }
 
-void serial_setbrg (void)
+static void cpci750_serial_setbrg(void)
 {
 	galbrg_set_baudrate (CONFIG_MPSC_PORT, gd->baudrate);
 }
 
 
-void serial_puts (const char *s)
+static void cpci750_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device cpci750_serial_drv = {
+	.name	= "cpci750_serial",
+	.start	= cpci750_serial_init,
+	.stop	= NULL,
+	.setbrg	= cpci750_serial_setbrg,
+	.putc	= cpci750_serial_putc,
+	.puts	= cpci750_serial_puts,
+	.getc	= cpci750_serial_getc,
+	.tstc	= cpci750_serial_tstc,
+};
+
+void cpci750_serial_initialize(void)
+{
+	serial_register(&cpci750_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &cpci750_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return cpci750_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	cpci750_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	cpci750_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	cpci750_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return cpci750_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return cpci750_serial_tstc();
+}
+#endif
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
 {
diff --git a/common/serial.c b/common/serial.c
index a51ce99..c77d3ba 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -64,6 +64,7 @@ serial_initfunc(marvell_serial_initialize);
 serial_initfunc(amirix_serial_initialize);
 serial_initfunc(bmw_serial_initialize);
 serial_initfunc(cogent_serial_initialize);
+serial_initfunc(cpci750_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -106,6 +107,7 @@ void serial_initialize(void)
 	amirix_serial_initialize();
 	bmw_serial_initialize();
 	cogent_serial_initialize();
+	cpci750_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 35/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into evb64260 serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (33 preceding siblings ...)
  2012-09-16 23:20 ` [U-Boot] [PATCH 34/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into cpci750 " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 36/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into ml2 " Marek Vasut
                   ` (37 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into evb64260 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the evb64260 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/evb64260/serial.c |   85 ++++++++++++++++++++++++++++++++++++-----------
 common/serial.c         |    2 ++
 2 files changed, 67 insertions(+), 20 deletions(-)

diff --git a/board/evb64260/serial.c b/board/evb64260/serial.c
index 9d71115..cf46a4d 100644
--- a/board/evb64260/serial.c
+++ b/board/evb64260/serial.c
@@ -30,6 +30,8 @@
 #include <common.h>
 #include <command.h>
 #include <galileo/memory.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 #if (defined CONFIG_SYS_INIT_CHAN1) || (defined CONFIG_SYS_INIT_CHAN2)
 #include <ns16550.h>
@@ -48,7 +50,7 @@ const NS16550_t COM_PORTS[] = { (NS16550_t) CONFIG_SYS_NS16550_COM1,
 
 #ifdef CONFIG_MPSC
 
-int serial_init (void)
+static int evb64260_serial_init(void)
 {
 #if (defined CONFIG_SYS_INIT_CHAN1) || (defined CONFIG_SYS_INIT_CHAN2)
 	int clock_divisor = CONFIG_SYS_NS16550_CLK / 16 / gd->baudrate;
@@ -66,8 +68,7 @@ int serial_init (void)
 	return (0);
 }
 
-void
-serial_putc(const char c)
+static void evb64260_serial_putc(const char c)
 {
 	if (c == '\n')
 		mpsc_putchar('\r');
@@ -75,27 +76,24 @@ serial_putc(const char c)
 	mpsc_putchar(c);
 }
 
-int
-serial_getc(void)
+static int evb64260_serial_getc(void)
 {
 	return mpsc_getchar();
 }
 
-int
-serial_tstc(void)
+static int evb64260_serial_tstc(void)
 {
 	return mpsc_test_char();
 }
 
-void
-serial_setbrg (void)
+static void evb64260_serial_setbrg(void)
 {
 	galbrg_set_baudrate(CONFIG_MPSC_PORT, gd->baudrate);
 }
 
 #else /* ! CONFIG_MPSC */
 
-int serial_init (void)
+static int evb64260_serial_init(void)
 {
 	int clock_divisor = CONFIG_SYS_NS16550_CLK / 16 / gd->baudrate;
 
@@ -109,8 +107,7 @@ int serial_init (void)
 	return (0);
 }
 
-void
-serial_putc(const char c)
+static void evb64260_serial_putc(const char c)
 {
 	if (c == '\n')
 		NS16550_putc(COM_PORTS[CONFIG_SYS_DUART_CHAN], '\r');
@@ -118,20 +115,17 @@ serial_putc(const char c)
 	NS16550_putc(COM_PORTS[CONFIG_SYS_DUART_CHAN], c);
 }
 
-int
-serial_getc(void)
+static int evb64260_serial_getc(void)
 {
 	return NS16550_getc(COM_PORTS[CONFIG_SYS_DUART_CHAN]);
 }
 
-int
-serial_tstc(void)
+static int evb64260_serial_tstc(void)
 {
 	return NS16550_tstc(COM_PORTS[CONFIG_SYS_DUART_CHAN]);
 }
 
-void
-serial_setbrg (void)
+static void evb64260_serial_setbrg(void)
 {
 	int clock_divisor = CONFIG_SYS_NS16550_CLK / 16 / gd->baudrate;
 
@@ -145,14 +139,65 @@ serial_setbrg (void)
 
 #endif /* CONFIG_MPSC */
 
-void
-serial_puts (const char *s)
+static void evb64260_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device evb64260_serial_drv = {
+	.name	= "evb64260_serial",
+	.start	= evb64260_serial_init,
+	.stop	= NULL,
+	.setbrg	= evb64260_serial_setbrg,
+	.putc	= evb64260_serial_putc,
+	.puts	= evb64260_serial_puts,
+	.getc	= evb64260_serial_getc,
+	.tstc	= evb64260_serial_tstc,
+};
+
+void evb64260_serial_initialize(void)
+{
+	serial_register(&evb64260_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &evb64260_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return evb64260_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	evb64260_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	evb64260_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	evb64260_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return evb64260_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return evb64260_serial_tstc();
+}
+#endif
 #if defined(CONFIG_CMD_KGDB)
 void
 kgdb_serial_init(void)
diff --git a/common/serial.c b/common/serial.c
index c77d3ba..2acf4c1 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -65,6 +65,7 @@ serial_initfunc(amirix_serial_initialize);
 serial_initfunc(bmw_serial_initialize);
 serial_initfunc(cogent_serial_initialize);
 serial_initfunc(cpci750_serial_initialize);
+serial_initfunc(evb64260_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -108,6 +109,7 @@ void serial_initialize(void)
 	bmw_serial_initialize();
 	cogent_serial_initialize();
 	cpci750_serial_initialize();
+	evb64260_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 36/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into ml2 serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (34 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 35/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into evb64260 " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-19 11:21   ` Stefan Roese
  2012-09-16 23:21 ` [U-Boot] [PATCH 37/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into sconsole " Marek Vasut
                   ` (36 subsequent siblings)
  72 siblings, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into ml2 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the ml2 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/ml2/serial.c |   66 +++++++++++++++++++++++++++++++++++++++++++++++-----
 common/serial.c    |    2 ++
 2 files changed, 62 insertions(+), 6 deletions(-)

diff --git a/board/ml2/serial.c b/board/ml2/serial.c
index d9113ab..0ed1150 100644
--- a/board/ml2/serial.c
+++ b/board/ml2/serial.c
@@ -24,6 +24,8 @@
 #include <asm/processor.h>
 #include <command.h>
 #include <configs/ML2.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 #if (defined CONFIG_SYS_INIT_CHAN1) || (defined CONFIG_SYS_INIT_CHAN2)
 #include <ns16550.h>
@@ -37,7 +39,7 @@ const NS16550_t COM_PORTS[] = { (NS16550_t) CONFIG_SYS_NS16550_COM1,
 };
 #endif
 
-int serial_init (void)
+static int ml2_serial_init(void)
 {
 	int clock_divisor = CONFIG_SYS_NS16550_CLK / 16 / gd->baudrate;
 
@@ -51,7 +53,7 @@ int serial_init (void)
 
 }
 
-void serial_putc (const char c)
+static void ml2_serial_putc(const char c)
 {
 	if (c == '\n')
 		NS16550_putc (COM_PORTS[CONFIG_SYS_DUART_CHAN], '\r');
@@ -59,17 +61,17 @@ void serial_putc (const char c)
 	NS16550_putc (COM_PORTS[CONFIG_SYS_DUART_CHAN], c);
 }
 
-int serial_getc (void)
+static int ml2_serial_getc(void)
 {
 	return NS16550_getc (COM_PORTS[CONFIG_SYS_DUART_CHAN]);
 }
 
-int serial_tstc (void)
+static int ml2_serial_tstc(void)
 {
 	return NS16550_tstc (COM_PORTS[CONFIG_SYS_DUART_CHAN]);
 }
 
-void serial_setbrg (void)
+static void ml2_serial_setbrg(void)
 {
 	int clock_divisor = CONFIG_SYS_NS16550_CLK / 16 / gd->baudrate;
 
@@ -81,13 +83,65 @@ void serial_setbrg (void)
 #endif
 }
 
-void serial_puts (const char *s)
+static void ml2_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device ml2_serial_drv = {
+	.name	= "ml2_serial",
+	.start	= ml2_serial_init,
+	.stop	= NULL,
+	.setbrg	= ml2_serial_setbrg,
+	.putc	= ml2_serial_putc,
+	.puts	= ml2_serial_puts,
+	.getc	= ml2_serial_getc,
+	.tstc	= ml2_serial_tstc,
+};
+
+void ml2_serial_initialize(void)
+{
+	serial_register(&ml2_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &ml2_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return ml2_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	ml2_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	ml2_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	ml2_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return ml2_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return ml2_serial_tstc();
+}
+#endif
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
 {
diff --git a/common/serial.c b/common/serial.c
index 2acf4c1..393e296 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -66,6 +66,7 @@ serial_initfunc(bmw_serial_initialize);
 serial_initfunc(cogent_serial_initialize);
 serial_initfunc(cpci750_serial_initialize);
 serial_initfunc(evb64260_serial_initialize);
+serial_initfunc(ml2_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -110,6 +111,7 @@ void serial_initialize(void)
 	cogent_serial_initialize();
 	cpci750_serial_initialize();
 	evb64260_serial_initialize();
+	ml2_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 37/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into sconsole serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (35 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 36/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into ml2 " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 38/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into p3mx " Marek Vasut
                   ` (35 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into sconsole serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the sconsole driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/pcippc2/sconsole.c |   66 +++++++++++++++++++++++++++++++++++++++++-----
 common/serial.c          |    2 ++
 2 files changed, 62 insertions(+), 6 deletions(-)

diff --git a/board/pcippc2/sconsole.c b/board/pcippc2/sconsole.c
index 6ef38f4..0a31963 100644
--- a/board/pcippc2/sconsole.c
+++ b/board/pcippc2/sconsole.c
@@ -23,6 +23,8 @@
 
 #include <config.h>
 #include <common.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 #include "sconsole.h"
 
@@ -34,7 +36,7 @@ int	(*sconsole_getc) (void) = 0;
 int	(*sconsole_tstc) (void) = 0;
 void	(*sconsole_setbrg) (void) = 0;
 
-int serial_init (void)
+static int sconsole_serial_init(void)
 {
 	sconsole_buffer_t *sb = SCONSOLE_BUFFER;
 
@@ -46,7 +48,7 @@ int serial_init (void)
 	return (0);
 }
 
-void serial_putc (char c)
+static void sconsole_serial_putc(char c)
 {
 	if (sconsole_putc) {
 		(*sconsole_putc) (c);
@@ -65,7 +67,7 @@ void serial_putc (char c)
 	}
 }
 
-void serial_puts (const char *s)
+static void sconsole_serial_puts(const char *s)
 {
 	if (sconsole_puts) {
 		(*sconsole_puts) (s);
@@ -84,7 +86,7 @@ void serial_puts (const char *s)
 	}
 }
 
-int serial_getc (void)
+static int sconsole_serial_getc(void)
 {
 	if (sconsole_getc) {
 		return (*sconsole_getc) ();
@@ -93,7 +95,7 @@ int serial_getc (void)
 	}
 }
 
-int serial_tstc (void)
+static int sconsole_serial_tstc(void)
 {
 	if (sconsole_tstc) {
 		return (*sconsole_tstc) ();
@@ -102,7 +104,7 @@ int serial_tstc (void)
 	}
 }
 
-void serial_setbrg (void)
+static void sconsole_serial_setbrg(void)
 {
 	if (sconsole_setbrg) {
 		(*sconsole_setbrg) ();
@@ -113,6 +115,58 @@ void serial_setbrg (void)
 	}
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device sconsole_serial_drv = {
+	.name	= "sconsole_serial",
+	.start	= sconsole_serial_init,
+	.stop	= NULL,
+	.setbrg	= sconsole_serial_setbrg,
+	.putc	= sconsole_serial_putc,
+	.puts	= sconsole_serial_puts,
+	.getc	= sconsole_serial_getc,
+	.tstc	= sconsole_serial_tstc,
+};
+
+void sconsole_serial_initialize(void)
+{
+	serial_register(&sconsole_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &sconsole_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return sconsole_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	sconsole_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	sconsole_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	sconsole_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return sconsole_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return sconsole_serial_tstc();
+}
+#endif
 int sconsole_get_baudrate (void)
 {
 	sconsole_buffer_t *sb = SCONSOLE_BUFFER;
diff --git a/common/serial.c b/common/serial.c
index 393e296..d9cd3bf 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -67,6 +67,7 @@ serial_initfunc(cogent_serial_initialize);
 serial_initfunc(cpci750_serial_initialize);
 serial_initfunc(evb64260_serial_initialize);
 serial_initfunc(ml2_serial_initialize);
+serial_initfunc(sconsole_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -112,6 +113,7 @@ void serial_initialize(void)
 	cpci750_serial_initialize();
 	evb64260_serial_initialize();
 	ml2_serial_initialize();
+	sconsole_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 38/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into p3mx serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (36 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 37/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into sconsole " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 39/71] serial: arm: Implement CONFIG_SERIAL_MULTI into altera_jtag " Marek Vasut
                   ` (34 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into p3mx serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the p3mx driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/prodrive/p3mx/serial.c |   68 ++++++++++++++++++++++++++++++++++++++----
 common/serial.c              |    2 ++
 2 files changed, 64 insertions(+), 6 deletions(-)

diff --git a/board/prodrive/p3mx/serial.c b/board/prodrive/p3mx/serial.c
index e1af37e..d3591b4 100644
--- a/board/prodrive/p3mx/serial.c
+++ b/board/prodrive/p3mx/serial.c
@@ -35,6 +35,9 @@
 
 #include <common.h>
 #include <command.h>
+#include <serial.h>
+#include <linux/compiler.h>
+
 #include "../../Marvell/include/memory.h"
 #include "serial.h"
 
@@ -42,14 +45,14 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int serial_init (void)
+static int p3mx_serial_init(void)
 {
 	mpsc_init (gd->baudrate);
 
 	return (0);
 }
 
-void serial_putc (const char c)
+static void p3mx_serial_putc(const char c)
 {
 	if (c == '\n')
 		mpsc_putchar ('\r');
@@ -57,29 +60,82 @@ void serial_putc (const char c)
 	mpsc_putchar (c);
 }
 
-int serial_getc (void)
+static int p3mx_serial_getc(void)
 {
 	return mpsc_getchar ();
 }
 
-int serial_tstc (void)
+static int p3mx_serial_tstc(void)
 {
 	return mpsc_test_char ();
 }
 
-void serial_setbrg (void)
+static void p3mx_serial_setbrg(void)
 {
 	galbrg_set_baudrate (CONFIG_MPSC_PORT, gd->baudrate);
 }
 
 
-void serial_puts (const char *s)
+static void p3mx_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device p3mx_serial_drv = {
+	.name	= "p3mx_serial",
+	.start	= p3mx_serial_init,
+	.stop	= NULL,
+	.setbrg	= p3mx_serial_setbrg,
+	.putc	= p3mx_serial_putc,
+	.puts	= p3mx_serial_puts,
+	.getc	= p3mx_serial_getc,
+	.tstc	= p3mx_serial_tstc,
+};
+
+void p3mx_serial_initialize(void)
+{
+	serial_register(&p3mx_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &p3mx_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return p3mx_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	p3mx_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	p3mx_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	p3mx_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return p3mx_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return p3mx_serial_tstc();
+}
+#endif
+
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
 {
diff --git a/common/serial.c b/common/serial.c
index d9cd3bf..2d6ba05 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -68,6 +68,7 @@ serial_initfunc(cpci750_serial_initialize);
 serial_initfunc(evb64260_serial_initialize);
 serial_initfunc(ml2_serial_initialize);
 serial_initfunc(sconsole_serial_initialize);
+serial_initfunc(p3mx_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -114,6 +115,7 @@ void serial_initialize(void)
 	evb64260_serial_initialize();
 	ml2_serial_initialize();
 	sconsole_serial_initialize();
+	p3mx_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 39/71] serial: arm: Implement CONFIG_SERIAL_MULTI into altera_jtag serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (37 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 38/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into p3mx " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-10-01 12:33   ` Thomas Chou
  2012-10-01 14:45   ` [U-Boot] [PATCH 39/72 V2] " Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 40/71] serial: arm: Implement CONFIG_SERIAL_MULTI into altera " Marek Vasut
                   ` (33 subsequent siblings)
  72 siblings, 2 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into altera_jtag serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the altera_jtag driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Thomas Chou <thomas@wytron.com.tw>
---
 common/serial.c                   |    2 ++
 drivers/serial/altera_jtag_uart.c |   71 +++++++++++++++++++++++++++++++++----
 2 files changed, 67 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 2d6ba05..24879ec 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -69,6 +69,7 @@ serial_initfunc(evb64260_serial_initialize);
 serial_initfunc(ml2_serial_initialize);
 serial_initfunc(sconsole_serial_initialize);
 serial_initfunc(p3mx_serial_initialize);
+serial_initfunc(altera_jtag_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -116,6 +117,7 @@ void serial_initialize(void)
 	ml2_serial_initialize();
 	sconsole_serial_initialize();
 	p3mx_serial_initialize();
+	altera_jtag_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/altera_jtag_uart.c b/drivers/serial/altera_jtag_uart.c
index 2980e4d..d3b6c1c 100644
--- a/drivers/serial/altera_jtag_uart.c
+++ b/drivers/serial/altera_jtag_uart.c
@@ -33,10 +33,16 @@ DECLARE_GLOBAL_DATA_PTR;
  *-----------------------------------------------------------------*/
 static nios_jtag_t *jtag = (nios_jtag_t *)CONFIG_SYS_NIOS_CONSOLE;
 
-void serial_setbrg( void ){ return; }
-int serial_init( void ) { return(0);}
+static void altera_jtag_serial_setbrg(void)
+{
+}
+
+static int altera_jtag_serial_init(void)
+{
+	return 0;
+}
 
-void serial_putc (char c)
+static void altera_jtag_serial_putc(char c)
 {
 	while (1) {
 		unsigned st = readl(&jtag->control);
@@ -51,18 +57,18 @@ void serial_putc (char c)
 	writel ((unsigned char)c, &jtag->data);
 }
 
-void serial_puts (const char *s)
+static void altera_jtag_serial_puts(const char *s)
 {
 	while (*s != 0)
 		serial_putc (*s++);
 }
 
-int serial_tstc (void)
+static int altera_jtag_serial_tstc(void)
 {
 	return ( readl (&jtag->control) & NIOS_JTAG_RRDY);
 }
 
-int serial_getc (void)
+static int altera_jtag_serial_getc(void)
 {
 	int c;
 	unsigned val;
@@ -76,3 +82,56 @@ int serial_getc (void)
 	c = val & 0x0ff;
 	return (c);
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device altera_jtag_serial_drv = {
+	.name	= "altera_jtag_serial",
+	.start	= altera_jtag_serial_init,
+	.stop	= NULL,
+	.setbrg	= altera_jtag_serial_setbrg,
+	.putc	= altera_jtag_serial_putc,
+	.puts	= altera_jtag_serial_puts,
+	.getc	= altera_jtag_serial_getc,
+	.tstc	= altera_jtag_serial_tstc,
+};
+
+void altera_jtag_serial_initialize(void)
+{
+	serial_register(&altera_jtag_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &altera_jtag_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return altera_jtag_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	altera_jtag_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	altera_jtag_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	altera_jtag_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return altera_jtag_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return altera_jtag_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 40/71] serial: arm: Implement CONFIG_SERIAL_MULTI into altera serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (38 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 39/71] serial: arm: Implement CONFIG_SERIAL_MULTI into altera_jtag " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-10-01 12:31   ` Thomas Chou
  2012-10-01 14:46   ` [U-Boot] [PATCH 40/72 V2] " Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 41/71] serial: arm: Implement CONFIG_SERIAL_MULTI into atmel " Marek Vasut
                   ` (32 subsequent siblings)
  72 siblings, 2 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into altera serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the altera driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Scott McNutt <smcnutt@psyent.com>
---
 common/serial.c              |    2 +
 drivers/serial/altera_uart.c |   83 ++++++++++++++++++++++++++++++++++++------
 2 files changed, 73 insertions(+), 12 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 24879ec..e6566da 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -70,6 +70,7 @@ serial_initfunc(ml2_serial_initialize);
 serial_initfunc(sconsole_serial_initialize);
 serial_initfunc(p3mx_serial_initialize);
 serial_initfunc(altera_jtag_serial_initialize);
+serial_initfunc(altera_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -118,6 +119,7 @@ void serial_initialize(void)
 	sconsole_serial_initialize();
 	p3mx_serial_initialize();
 	altera_jtag_serial_initialize();
+	altera_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c
index 045f119..18b820b 100644
--- a/drivers/serial/altera_uart.c
+++ b/drivers/serial/altera_uart.c
@@ -37,27 +37,33 @@ static nios_uart_t *uart = (nios_uart_t *) CONFIG_SYS_NIOS_CONSOLE;
 
 #if defined(CONFIG_SYS_NIOS_FIXEDBAUD)
 
-/* Everything's already setup for fixed-baud PTF
+/*
+ * Everything's already setup for fixed-baud PTF
  * assignment
  */
-void serial_setbrg (void){ return; }
-int serial_init (void) { return (0);}
+static void altera_serial_setbrg(void)
+{
+}
+
+static int altera_serial_init(void)
+{
+	return 0;
+}
 
 #else
 
-void serial_setbrg (void)
+static void altera_serial_setbrg(void)
 {
 	unsigned div;
 
 	div = (CONFIG_SYS_CLK_FREQ/gd->baudrate)-1;
 	writel (div, &uart->divisor);
-	return;
 }
 
-int serial_init (void)
+static int altera_serial_init(void)
 {
-	serial_setbrg ();
-	return (0);
+	serial_setbrg();
+	return 0;
 }
 
 #endif /* CONFIG_SYS_NIOS_FIXEDBAUD */
@@ -65,7 +71,7 @@ int serial_init (void)
 /*-----------------------------------------------------------------------
  * UART CONSOLE
  *---------------------------------------------------------------------*/
-void serial_putc (char c)
+static void altera_serial_putc(char c)
 {
 	if (c == '\n')
 		serial_putc ('\r');
@@ -74,21 +80,74 @@ void serial_putc (char c)
 	writel ((unsigned char)c, &uart->txdata);
 }
 
-void serial_puts (const char *s)
+static void altera_serial_puts(const char *s)
 {
 	while (*s != 0) {
 		serial_putc (*s++);
 	}
 }
 
-int serial_tstc (void)
+static int altera_serial_tstc(void)
 {
 	return (readl (&uart->status) & NIOS_UART_RRDY);
 }
 
-int serial_getc (void)
+static int altera_serial_getc(void)
 {
 	while (serial_tstc () == 0)
 		WATCHDOG_RESET ();
 	return (readl (&uart->rxdata) & 0x00ff );
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device altera_serial_drv = {
+	.name	= "altera_serial",
+	.start	= altera_serial_init,
+	.stop	= NULL,
+	.setbrg	= altera_serial_setbrg,
+	.putc	= altera_serial_putc,
+	.puts	= altera_serial_puts,
+	.getc	= altera_serial_getc,
+	.tstc	= altera_serial_tstc,
+};
+
+void altera_serial_initialize(void)
+{
+	serial_register(&altera_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &altera_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return altera_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	altera_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	altera_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	altera_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return altera_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return altera_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 41/71] serial: arm: Implement CONFIG_SERIAL_MULTI into atmel serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (39 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 40/71] serial: arm: Implement CONFIG_SERIAL_MULTI into altera " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-17  6:51   ` Andreas Bießmann
  2012-09-18 23:45   ` Andreas Bießmann
  2012-09-16 23:21 ` [U-Boot] [PATCH 42/71] serial: arm: Implement CONFIG_SERIAL_MULTI into lpc32xx " Marek Vasut
                   ` (31 subsequent siblings)
  72 siblings, 2 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into atmel serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the atmel driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Xu, Hong <Hong.Xu@atmel.com>
---
 common/serial.c              |    2 ++
 drivers/serial/atmel_usart.c |   67 ++++++++++++++++++++++++++++++++++++++----
 2 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index e6566da..b880303 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -71,6 +71,7 @@ serial_initfunc(sconsole_serial_initialize);
 serial_initfunc(p3mx_serial_initialize);
 serial_initfunc(altera_jtag_serial_initialize);
 serial_initfunc(altera_serial_initialize);
+serial_initfunc(atmel_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -120,6 +121,7 @@ void serial_initialize(void)
 	p3mx_serial_initialize();
 	altera_jtag_serial_initialize();
 	altera_serial_initialize();
+	atmel_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c
index 943ef70..d49d5d4 100644
--- a/drivers/serial/atmel_usart.c
+++ b/drivers/serial/atmel_usart.c
@@ -20,6 +20,8 @@
  */
 #include <common.h>
 #include <watchdog.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 #include <asm/io.h>
 #include <asm/arch/clk.h>
@@ -29,7 +31,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void serial_setbrg(void)
+static void atmel_serial_setbrg(void)
 {
 	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
 	unsigned long divisor;
@@ -45,7 +47,7 @@ void serial_setbrg(void)
 	writel(USART3_BF(CD, divisor), &usart->brgr);
 }
 
-int serial_init(void)
+static int atmel_serial_init(void)
 {
 	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
 
@@ -73,7 +75,7 @@ int serial_init(void)
 	return 0;
 }
 
-void serial_putc(char c)
+static void atmel_serial_putc(char c)
 {
 	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
 
@@ -84,13 +86,13 @@ void serial_putc(char c)
 	writel(c, &usart->thr);
 }
 
-void serial_puts(const char *s)
+static void atmel_serial_puts(const char *s)
 {
 	while (*s)
 		serial_putc(*s++);
 }
 
-int serial_getc(void)
+static int atmel_serial_getc(void)
 {
 	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
 
@@ -99,8 +101,61 @@ int serial_getc(void)
 	return readl(&usart->rhr);
 }
 
-int serial_tstc(void)
+static int atmel_serial_tstc(void)
 {
 	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
 	return (readl(&usart->csr) & USART3_BIT(RXRDY)) != 0;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device atmel_serial_drv = {
+	.name	= "atmel_serial",
+	.start	= atmel_serial_init,
+	.stop	= NULL,
+	.setbrg	= atmel_serial_setbrg,
+	.putc	= atmel_serial_putc,
+	.puts	= atmel_serial_puts,
+	.getc	= atmel_serial_getc,
+	.tstc	= atmel_serial_tstc,
+};
+
+void atmel_serial_initialize(void)
+{
+	serial_register(&atmel_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &atmel_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return atmel_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	atmel_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	atmel_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	atmel_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return atmel_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return atmel_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 42/71] serial: arm: Implement CONFIG_SERIAL_MULTI into lpc32xx serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (40 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 41/71] serial: arm: Implement CONFIG_SERIAL_MULTI into atmel " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-17 22:28   ` Vladimir Zapolskiy
  2012-09-16 23:21 ` [U-Boot] [PATCH 43/71] serial: mcf: Implement CONFIG_SERIAL_MULTI into MCF " Marek Vasut
                   ` (30 subsequent siblings)
  72 siblings, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into lpc32xx serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the lpc32xx driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Vladimir Zapolskiy <vz@mleia.com>
---
 common/serial.c                 |    2 ++
 drivers/serial/lpc32xx_hsuart.c |   71 ++++++++++++++++++++++++++-------------
 2 files changed, 50 insertions(+), 23 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index b880303..8bc26d8 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -72,6 +72,7 @@ serial_initfunc(p3mx_serial_initialize);
 serial_initfunc(altera_jtag_serial_initialize);
 serial_initfunc(altera_serial_initialize);
 serial_initfunc(atmel_serial_initialize);
+serial_initfunc(lpc32xx_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -122,6 +123,7 @@ void serial_initialize(void)
 	altera_jtag_serial_initialize();
 	altera_serial_initialize();
 	atmel_serial_initialize();
+	lpc32xx_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/lpc32xx_hsuart.c b/drivers/serial/lpc32xx_hsuart.c
index 8ce3382..536fd46 100644
--- a/drivers/serial/lpc32xx_hsuart.c
+++ b/drivers/serial/lpc32xx_hsuart.c
@@ -22,12 +22,14 @@
 #include <asm/arch/clk.h>
 #include <asm/arch/uart.h>
 #include <asm/io.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
 static struct hsuart_regs *hsuart = (struct hsuart_regs *)HS_UART_BASE;
 
-static void lpc32xx_hsuart_set_baudrate(void)
+static void lpc32xx_serial_setbrg(void)
 {
 	u32 div;
 
@@ -39,7 +41,7 @@ static void lpc32xx_hsuart_set_baudrate(void)
 	writel(div, &hsuart->rate);
 }
 
-static int lpc32xx_hsuart_getc(void)
+static int lpc32xx_serial_getc(void)
 {
 	while (!(readl(&hsuart->level) & HSUART_LEVEL_RX))
 		/* NOP */;
@@ -47,7 +49,7 @@ static int lpc32xx_hsuart_getc(void)
 	return readl(&hsuart->rx) & HSUART_RX_DATA;
 }
 
-static void lpc32xx_hsuart_putc(const char c)
+static void lpc32xx_serial_putc(const char c)
 {
 	writel(c, &hsuart->tx);
 
@@ -56,7 +58,7 @@ static void lpc32xx_hsuart_putc(const char c)
 		/* NOP */;
 }
 
-static int lpc32xx_hsuart_tstc(void)
+static int lpc32xx_serial_tstc(void)
 {
 	if (readl(&hsuart->level) & HSUART_LEVEL_RX)
 		return 1;
@@ -64,49 +66,72 @@ static int lpc32xx_hsuart_tstc(void)
 	return 0;
 }
 
-static void lpc32xx_hsuart_init(void)
+static int lpc32xx_serial_init(void)
 {
-	lpc32xx_hsuart_set_baudrate();
+	lpc32xx_serial_setbrg();
 
 	/* Disable hardware RTS and CTS flow control, set up RX and TX FIFO */
 	writel(HSUART_CTRL_TMO_16 | HSUART_CTRL_HSU_OFFSET(20) |
 	       HSUART_CTRL_HSU_RX_TRIG_32 | HSUART_CTRL_HSU_TX_TRIG_0,
 	       &hsuart->ctrl);
+	return 0;
 }
 
-void serial_setbrg(void)
+static void lpc32xx_serial_puts(const char *s)
 {
-	return lpc32xx_hsuart_set_baudrate();
+	while (*s)
+		serial_putc(*s++);
 }
 
-void serial_putc(const char c)
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device lpc32xx_serial_drv = {
+	.name	= "lpc32xx_serial",
+	.start	= lpc32xx_serial_init,
+	.stop	= NULL,
+	.setbrg	= lpc32xx_serial_setbrg,
+	.putc	= lpc32xx_serial_putc,
+	.puts	= lpc32xx_serial_puts,
+	.getc	= lpc32xx_serial_getc,
+	.tstc	= lpc32xx_serial_tstc,
+};
+
+void lpc32xx_serial_initialize(void)
 {
-	lpc32xx_hsuart_putc(c);
+	serial_register(&lpc32xx_serial_drv);
+}
 
-	/* If \n, also do \r */
-	if (c == '\n')
-		lpc32xx_hsuart_putc('\r');
+__weak struct serial_device *default_serial_console(void)
+{
+	return &lpc32xx_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return lpc32xx_serial_init();
 }
 
-int serial_getc(void)
+void serial_setbrg(void)
 {
-	return lpc32xx_hsuart_getc();
+	lpc32xx_serial_setbrg();
 }
 
-void serial_puts(const char *s)
+void serial_putc(const char c)
 {
-	while (*s)
-		serial_putc(*s++);
+	lpc32xx_serial_putc(c);
 }
 
-int serial_tstc(void)
+void serial_puts(const char *s)
 {
-	return lpc32xx_hsuart_tstc();
+	lpc32xx_serial_puts(s);
 }
 
-int serial_init(void)
+int serial_getc(void)
 {
-	lpc32xx_hsuart_init();
+	return lpc32xx_serial_getc();
+}
 
-	return 0;
+int serial_tstc(void)
+{
+	return lpc32xx_serial_tstc();
 }
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 43/71] serial: mcf: Implement CONFIG_SERIAL_MULTI into MCF serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (41 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 42/71] serial: arm: Implement CONFIG_SERIAL_MULTI into lpc32xx " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 44/71] serial: Implement CONFIG_SERIAL_MULTI into ns9750 " Marek Vasut
                   ` (29 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into MCF serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the MCF driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: TsiChung Liew <tsicliew@gmail.com>
---
 common/serial.c          |    2 ++
 drivers/serial/mcfuart.c |   65 +++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 8bc26d8..fa16dce 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -73,6 +73,7 @@ serial_initfunc(altera_jtag_serial_initialize);
 serial_initfunc(altera_serial_initialize);
 serial_initfunc(atmel_serial_initialize);
 serial_initfunc(lpc32xx_serial_initialize);
+serial_initfunc(mcf_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -124,6 +125,7 @@ void serial_initialize(void)
 	altera_serial_initialize();
 	atmel_serial_initialize();
 	lpc32xx_serial_initialize();
+	mcf_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/mcfuart.c b/drivers/serial/mcfuart.c
index d93b24b..7e0b765 100644
--- a/drivers/serial/mcfuart.c
+++ b/drivers/serial/mcfuart.c
@@ -36,7 +36,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 extern void uart_port_conf(int port);
 
-int serial_init(void)
+static int mcf_serial_init(void)
 {
 	volatile uart_t *uart;
 	u32 counter;
@@ -74,7 +74,7 @@ int serial_init(void)
 	return (0);
 }
 
-void serial_putc(const char c)
+static void mcf_serial_putc(const char c)
 {
 	volatile uart_t *uart = (volatile uart_t *)(CONFIG_SYS_UART_BASE);
 
@@ -87,14 +87,14 @@ void serial_putc(const char c)
 	uart->utb = c;
 }
 
-void serial_puts(const char *s)
+static void mcf_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc(*s++);
 	}
 }
 
-int serial_getc(void)
+static int mcf_serial_getc(void)
 {
 	volatile uart_t *uart = (volatile uart_t *)(CONFIG_SYS_UART_BASE);
 
@@ -103,14 +103,14 @@ int serial_getc(void)
 	return uart->urb;
 }
 
-int serial_tstc(void)
+static int mcf_serial_tstc(void)
 {
 	volatile uart_t *uart = (volatile uart_t *)(CONFIG_SYS_UART_BASE);
 
 	return (uart->usr & UART_USR_RXRDY);
 }
 
-void serial_setbrg(void)
+static void mcf_serial_setbrg(void)
 {
 	volatile uart_t *uart = (volatile uart_t *)(CONFIG_SYS_UART_BASE);
 	u32 counter;
@@ -129,3 +129,56 @@ void serial_setbrg(void)
 
 	uart->ucr = UART_UCR_RX_ENABLED | UART_UCR_TX_ENABLED;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device mcf_serial_drv = {
+	.name	= "mcf_serial",
+	.start	= mcf_serial_init,
+	.stop	= NULL,
+	.setbrg	= mcf_serial_setbrg,
+	.putc	= mcf_serial_putc,
+	.puts	= mcf_serial_puts,
+	.getc	= mcf_serial_getc,
+	.tstc	= mcf_serial_tstc,
+};
+
+void mcf_serial_initialize(void)
+{
+	serial_register(&mcf_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &mcf_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return mcf_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	mcf_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	mcf_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	mcf_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return mcf_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return mcf_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 44/71] serial: Implement CONFIG_SERIAL_MULTI into ns9750 serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (42 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 43/71] serial: mcf: Implement CONFIG_SERIAL_MULTI into MCF " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 45/71] serial: oc: Implement CONFIG_SERIAL_MULTI into OpenCores " Marek Vasut
                   ` (28 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into ns9750 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the ns9750 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                |    2 ++
 drivers/serial/ns9750_serial.c |   65 ++++++++++++++++++++++++++++++++++++----
 2 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index fa16dce..c6a275d 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -74,6 +74,7 @@ serial_initfunc(altera_serial_initialize);
 serial_initfunc(atmel_serial_initialize);
 serial_initfunc(lpc32xx_serial_initialize);
 serial_initfunc(mcf_serial_initialize);
+serial_initfunc(ns9750_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -126,6 +127,7 @@ void serial_initialize(void)
 	atmel_serial_initialize();
 	lpc32xx_serial_initialize();
 	mcf_serial_initialize();
+	ns9750_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/ns9750_serial.c b/drivers/serial/ns9750_serial.c
index e9645a0..829f6d5 100644
--- a/drivers/serial/ns9750_serial.c
+++ b/drivers/serial/ns9750_serial.c
@@ -52,7 +52,7 @@ static unsigned int unCharCache; /* unCharCache is only valid if
  * @Descr: configures GPIOs and UART. Requires BBUS Master Reset turned off
  ***********************************************************************/
 
-int serial_init( void )
+static int ns9750_serial_init(void)
 {
 	unsigned int aunGPIOTxD[] = { 0, 8, 40, 44 };
 	unsigned int aunGPIORxD[] = { 1, 9, 41, 45 };
@@ -85,7 +85,7 @@ int serial_init( void )
  * @Descr: writes one character to the FIFO. Blocks until FIFO is not full
  ***********************************************************************/
 
-void serial_putc( const char c )
+static void ns9750_serial_putc(const char c)
 {
 	if (c == '\n')
 		serial_putc( '\r' );
@@ -105,7 +105,7 @@ void serial_putc( const char c )
  * @Descr: writes non-zero string to the FIFO.
  ***********************************************************************/
 
-void serial_puts( const char *s )
+static void ns9750_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc( *s++ );
@@ -118,7 +118,7 @@ void serial_puts( const char *s )
  * @Descr: performs only 8bit accesses to the FIFO. No error handling
  ***********************************************************************/
 
-int serial_getc( void )
+static int ns9750_serial_getc(void)
 {
 	int i;
 
@@ -142,7 +142,7 @@ int serial_getc( void )
  *	   unCharCache and the numbers of characters in cCharsAvailable
  ***********************************************************************/
 
-int serial_tstc( void )
+static int ns9750_serial_tstc(void)
 {
 	unsigned int unRegCache;
 
@@ -171,7 +171,7 @@ int serial_tstc( void )
 	return 0;
 }
 
-void serial_setbrg( void )
+static void ns9750_serial_setbrg(void)
 {
 	*get_ser_reg_addr_channel( NS9750_SER_BITRATE, CONSOLE ) =
 		calcBitrateRegister();
@@ -208,3 +208,56 @@ static unsigned int calcRxCharGapRegister( void )
 {
 	return NS9750_SER_RX_CHAR_TIMER_TRUN;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device ns9750_serial_drv = {
+	.name	= "ns9750_serial",
+	.start	= ns9750_serial_init,
+	.stop	= NULL,
+	.setbrg	= ns9750_serial_setbrg,
+	.putc	= ns9750_serial_putc,
+	.puts	= ns9750_serial_puts,
+	.getc	= ns9750_serial_getc,
+	.tstc	= ns9750_serial_tstc,
+};
+
+void ns9750_serial_initialize(void)
+{
+	serial_register(&ns9750_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &ns9750_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return ns9750_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	ns9750_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	ns9750_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	ns9750_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return ns9750_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return ns9750_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 45/71] serial: oc: Implement CONFIG_SERIAL_MULTI into OpenCores serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (43 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 44/71] serial: Implement CONFIG_SERIAL_MULTI into ns9750 " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 46/71] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c4510b " Marek Vasut
                   ` (27 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into OpenCores serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the OpenCores driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Scott McNutt <smcnutt@psyent.com>
---
 common/serial.c                 |    2 ++
 drivers/serial/opencores_yanu.c |   67 +++++++++++++++++++++++++++++++++++----
 2 files changed, 62 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index c6a275d..f217093 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -75,6 +75,7 @@ serial_initfunc(atmel_serial_initialize);
 serial_initfunc(lpc32xx_serial_initialize);
 serial_initfunc(mcf_serial_initialize);
 serial_initfunc(ns9750_serial_initialize);
+serial_initfunc(oc_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -128,6 +129,7 @@ void serial_initialize(void)
 	lpc32xx_serial_initialize();
 	mcf_serial_initialize();
 	ns9750_serial_initialize();
+	oc_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/opencores_yanu.c b/drivers/serial/opencores_yanu.c
index f383011..a0dd301 100644
--- a/drivers/serial/opencores_yanu.c
+++ b/drivers/serial/opencores_yanu.c
@@ -37,7 +37,7 @@ static yanu_uart_t *uart = (yanu_uart_t *)CONFIG_SYS_NIOS_CONSOLE;
 
 /* Everything's already setup for fixed-baud PTF assignment*/
 
-void serial_setbrg (void)
+static void oc_serial_setbrg(void)
 {
 	int n, k;
 	const unsigned max_uns = 0xFFFFFFFF;
@@ -68,7 +68,7 @@ void serial_setbrg (void)
 
 #else
 
-void serial_setbrg (void)
+static void oc_serial_setbrg(void)
 {
 	int n, k;
 	const unsigned max_uns = 0xFFFFFFFF;
@@ -100,7 +100,7 @@ void serial_setbrg (void)
 
 #endif /* CONFIG_SYS_NIOS_FIXEDBAUD */
 
-int serial_init (void)
+static int oc_serial_init(void)
 {
 	unsigned action,control;
 
@@ -141,7 +141,7 @@ int serial_init (void)
 /*-----------------------------------------------------------------------
  * YANU CONSOLE
  *---------------------------------------------------------------------*/
-void serial_putc (char c)
+static void oc_serial_putc(char c)
 {
 	int tx_chars;
 	unsigned status;
@@ -161,7 +161,7 @@ void serial_putc (char c)
 	writel((unsigned char)c, &uart->data);
 }
 
-void serial_puts (const char *s)
+static void oc_serial_puts(const char *s)
 {
 	while (*s != 0) {
 		serial_putc (*s++);
@@ -169,7 +169,7 @@ void serial_puts (const char *s)
 }
 
 
-int serial_tstc(void)
+static int oc_serial_tstc(void)
 {
 	unsigned status ;
 
@@ -178,7 +178,7 @@ int serial_tstc(void)
 		 ((1 << YANU_RFIFO_CHARS_N) - 1)) > 0);
 }
 
-int serial_getc (void)
+statoc int oc_serial_getc(void)
 {
 	while (serial_tstc() == 0)
 		WATCHDOG_RESET ();
@@ -188,3 +188,56 @@ int serial_getc (void)
 
 	return(readl(&uart->data) & YANU_DATA_CHAR_MASK);
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device oc_serial_drv = {
+	.name	= "oc_serial",
+	.start	= oc_serial_init,
+	.stop	= NULL,
+	.setbrg	= oc_serial_setbrg,
+	.putc	= oc_serial_putc,
+	.puts	= oc_serial_puts,
+	.getc	= oc_serial_getc,
+	.tstc	= oc_serial_tstc,
+};
+
+void oc_serial_initialize(void)
+{
+	serial_register(&oc_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &oc_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return oc_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	oc_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	oc_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	oc_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return oc_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return oc_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 46/71] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c4510b serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (44 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 45/71] serial: oc: Implement CONFIG_SERIAL_MULTI into OpenCores " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 47/71] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c64xx " Marek Vasut
                   ` (26 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into s3c4510b serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the s3c4510b driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                |    2 ++
 drivers/serial/s3c4510b_uart.c |   65 ++++++++++++++++++++++++++++++++++++----
 2 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index f217093..d0a20e9 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -76,6 +76,7 @@ serial_initfunc(lpc32xx_serial_initialize);
 serial_initfunc(mcf_serial_initialize);
 serial_initfunc(ns9750_serial_initialize);
 serial_initfunc(oc_serial_initialize);
+serial_initfunc(s3c4510b_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -130,6 +131,7 @@ void serial_initialize(void)
 	mcf_serial_initialize();
 	ns9750_serial_initialize();
 	oc_serial_initialize();
+	s3c4510b_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/s3c4510b_uart.c b/drivers/serial/s3c4510b_uart.c
index aa378e1..4f7f98e 100644
--- a/drivers/serial/s3c4510b_uart.c
+++ b/drivers/serial/s3c4510b_uart.c
@@ -80,7 +80,7 @@ static int serial_flush_output(void)
 }
 
 
-void serial_setbrg (void)
+static void s3c4510b_serial_setbrg(void)
 {
 	UART_LINE_CTRL ulctrl;
 	UART_CTRL      uctrl;
@@ -135,7 +135,7 @@ void serial_setbrg (void)
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  *
  */
-int serial_init (void)
+static int s3c4510b_serial_init(void)
 {
 
 #if   CONFIG_SERIAL1 == 1
@@ -155,7 +155,7 @@ int serial_init (void)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc (const char c)
+static void s3c4510_serial_putc(const char c)
 {
 	/* wait for room in the transmit FIFO */
 	while( !uart->m_stat.bf.txBufEmpty);
@@ -174,7 +174,7 @@ void serial_putc (const char c)
  * Test if an input byte is ready from the serial port. Returns non-zero on
  * success, 0 otherwise.
  */
-int serial_tstc (void)
+static int s3c4510b_serial_tstc(void)
 {
 	return uart->m_stat.bf.rxReady;
 }
@@ -184,7 +184,7 @@ int serial_tstc (void)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_getc (void)
+static int s3c4510b_serial_getc(void)
 {
 	int rv;
 
@@ -197,7 +197,7 @@ int serial_getc (void)
 	}
 }
 
-void serial_puts (const char *s)
+static void s3c4510b_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
@@ -210,3 +210,56 @@ void serial_puts (const char *s)
 	uart->m_ctrl.bf.sendBreak = 0;
 
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device s3c4510b_serial_drv = {
+	.name	= "s3c4510b_serial",
+	.start	= s3c4510b_serial_init,
+	.stop	= NULL,
+	.setbrg	= s3c4510b_serial_setbrg,
+	.putc	= s3c4510b_serial_putc,
+	.puts	= s3c4510b_serial_puts,
+	.getc	= s3c4510b_serial_getc,
+	.tstc	= s3c4510b_serial_tstc,
+};
+
+void s3c4510b_serial_initialize(void)
+{
+	serial_register(&s3c4510b_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &s3c4510b_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return s3c4510b_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	s3c4510b_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	s3c4510b_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	s3c4510b_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return s3c4510b_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return s3c4510b_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 47/71] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c64xx serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (45 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 46/71] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c4510b " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-18  1:30   ` Minkyu Kang
  2012-09-16 23:21 ` [U-Boot] [PATCH 48/71] serial: sandbox: Implement CONFIG_SERIAL_MULTI into sandbox " Marek Vasut
                   ` (25 subsequent siblings)
  72 siblings, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into s3c64xx serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the s3c64xx driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: John Rigby <john.rigby@linaro.org>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 common/serial.c          |    2 ++
 drivers/serial/s3c64xx.c |   65 +++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index d0a20e9..93d6a08 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -77,6 +77,7 @@ serial_initfunc(mcf_serial_initialize);
 serial_initfunc(ns9750_serial_initialize);
 serial_initfunc(oc_serial_initialize);
 serial_initfunc(s3c4510b_serial_initialize);
+serial_initfunc(s3c64xx_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -132,6 +133,7 @@ void serial_initialize(void)
 	ns9750_serial_initialize();
 	oc_serial_initialize();
 	s3c4510b_serial_initialize();
+	s3c64xx_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/s3c64xx.c b/drivers/serial/s3c64xx.c
index a88e930..823425b 100644
--- a/drivers/serial/s3c64xx.c
+++ b/drivers/serial/s3c64xx.c
@@ -68,7 +68,7 @@ static const int udivslot[] = {
 	0xffdf,
 };
 
-void serial_setbrg(void)
+static void s3c64xx_serial_setbrg(void)
 {
 	s3c64xx_uart *const uart = s3c64xx_get_base_uart(UART_NR);
 	u32 pclk = get_PCLK();
@@ -88,7 +88,7 @@ void serial_setbrg(void)
  * Initialise the serial port with the given baudrate. The settings
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  */
-int serial_init(void)
+static int s3c64xx_serial_init(void)
 {
 	s3c64xx_uart *const uart = s3c64xx_get_base_uart(UART_NR);
 
@@ -110,7 +110,7 @@ int serial_init(void)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_getc(void)
+static int s3c64xx_serial_getc(void)
 {
 	s3c64xx_uart *const uart = s3c64xx_get_base_uart(UART_NR);
 
@@ -137,7 +137,7 @@ void enable_putc(void)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc(const char c)
+static void s3c64xx_serial_putc(const char c)
 {
 	s3c64xx_uart *const uart = s3c64xx_get_base_uart(UART_NR);
 
@@ -159,15 +159,68 @@ void serial_putc(const char c)
 /*
  * Test whether a character is in the RX buffer
  */
-int serial_tstc(void)
+static int s3c64xx_serial_tstc(void)
 {
 	s3c64xx_uart *const uart = s3c64xx_get_base_uart(UART_NR);
 
 	return uart->UTRSTAT & 0x1;
 }
 
-void serial_puts(const char *s)
+static void s3c64xx_serial_puts(const char *s)
 {
 	while (*s)
 		serial_putc(*s++);
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device s3c64xx_serial_drv = {
+	.name	= "s3c64xx_serial",
+	.start	= s3c64xx_serial_init,
+	.stop	= NULL,
+	.setbrg	= s3c64xx_serial_setbrg,
+	.putc	= s3c64xx_serial_putc,
+	.puts	= s3c64xx_serial_puts,
+	.getc	= s3c64xx_serial_getc,
+	.tstc	= s3c64xx_serial_tstc,
+};
+
+void s3c64xx_serial_initialize(void)
+{
+	serial_register(&s3c64xx_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &s3c64xx_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return s3c64xx_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	s3c64xx_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	s3c64xx_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	s3c64xx_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return s3c64xx_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return s3c64xx_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 48/71] serial: sandbox: Implement CONFIG_SERIAL_MULTI into sandbox serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (46 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 47/71] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c64xx " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 49/71] serial: arm: Implement CONFIG_SERIAL_MULTI into clps7111 " Marek Vasut
                   ` (24 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into sandbox serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the sandbox driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Mike Frysinger <vapier@gentoo.org>
---
 common/serial.c          |    2 ++
 drivers/serial/sandbox.c |   67 +++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 93d6a08..a7a3234 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -78,6 +78,7 @@ serial_initfunc(ns9750_serial_initialize);
 serial_initfunc(oc_serial_initialize);
 serial_initfunc(s3c4510b_serial_initialize);
 serial_initfunc(s3c64xx_serial_initialize);
+serial_initfunc(sandbox_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -134,6 +135,7 @@ void serial_initialize(void)
 	oc_serial_initialize();
 	s3c4510b_serial_initialize();
 	s3c64xx_serial_initialize();
+	sandbox_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/sandbox.c b/drivers/serial/sandbox.c
index 1927c16..d60fbba 100644
--- a/drivers/serial/sandbox.c
+++ b/drivers/serial/sandbox.c
@@ -27,28 +27,30 @@
 
 #include <common.h>
 #include <os.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
-int serial_init(void)
+static int sandbox_serial_init(void)
 {
 	os_tty_raw(0);
 	return 0;
 }
 
-void serial_setbrg(void)
+static void sandbox_serial_setbrg(void)
 {
 }
 
-void serial_putc(const char ch)
+static void sandbox_serial_putc(const char ch)
 {
 	os_write(1, &ch, 1);
 }
 
-void serial_puts(const char *str)
+static void sandbox_serial_puts(const char *str)
 {
 	os_write(1, str, strlen(str));
 }
 
-int serial_getc(void)
+static int sandbox_serial_getc(void)
 {
 	char buf;
 	ssize_t count;
@@ -57,7 +59,60 @@ int serial_getc(void)
 	return count == 1 ? buf : 0;
 }
 
-int serial_tstc(void)
+static int sandbox_serial_tstc(void)
 {
 	return 0;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device sandbox_serial_drv = {
+	.name	= "sandbox_serial",
+	.start	= sandbox_serial_init,
+	.stop	= NULL,
+	.setbrg	= sandbox_serial_setbrg,
+	.putc	= sandbox_serial_putc,
+	.puts	= sandbox_serial_puts,
+	.getc	= sandbox_serial_getc,
+	.tstc	= sandbox_serial_tstc,
+};
+
+void sandbox_serial_initialize(void)
+{
+	serial_register(&sandbox_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &sandbox_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return sandbox_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	sandbox_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	sandbox_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	sandbox_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return sandbox_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return sandbox_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 49/71] serial: arm: Implement CONFIG_SERIAL_MULTI into clps7111 serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (47 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 48/71] serial: sandbox: Implement CONFIG_SERIAL_MULTI into sandbox " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 50/71] serial: arm: Implement CONFIG_SERIAL_MULTI into imx " Marek Vasut
                   ` (23 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into clps7111 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the clps7111 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                  |    2 ++
 drivers/serial/serial_clps7111.c |   66 ++++++++++++++++++++++++++++++++++----
 2 files changed, 61 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index a7a3234..4471262 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -79,6 +79,7 @@ serial_initfunc(oc_serial_initialize);
 serial_initfunc(s3c4510b_serial_initialize);
 serial_initfunc(s3c64xx_serial_initialize);
 serial_initfunc(sandbox_serial_initialize);
+serial_initfunc(clps7111_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -136,6 +137,7 @@ void serial_initialize(void)
 	s3c4510b_serial_initialize();
 	s3c64xx_serial_initialize();
 	sandbox_serial_initialize();
+	clps7111_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_clps7111.c b/drivers/serial/serial_clps7111.c
index a6aecad..e1bed90 100644
--- a/drivers/serial/serial_clps7111.c
+++ b/drivers/serial/serial_clps7111.c
@@ -33,7 +33,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void serial_setbrg (void)
+static void clps7111_serial_setbrg(void)
 {
 	unsigned int reg = 0;
 
@@ -63,7 +63,7 @@ void serial_setbrg (void)
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  *
  */
-int serial_init (void)
+static int clps7111_serial_init(void)
 {
 	serial_setbrg ();
 
@@ -74,7 +74,7 @@ int serial_init (void)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc (const char c)
+static void clps7111_serial_putc(const char c)
 {
 	int tmo;
 
@@ -95,7 +95,7 @@ void serial_putc (const char c)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_tstc (void)
+static int clps7111_serial_tstc(void)
 {
 	return !(IO_SYSFLG1 & SYSFLG1_URXFE);
 }
@@ -105,17 +105,69 @@ int serial_tstc (void)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_getc (void)
+static int clps7111_serial_getc(void)
 {
 	while (IO_SYSFLG1 & SYSFLG1_URXFE);
 
 	return IO_UARTDR1 & 0xff;
 }
 
-void
-serial_puts (const char *s)
+static void clps7111_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device clps7111_serial_drv = {
+	.name	= "clps7111_serial",
+	.start	= clps7111_serial_init,
+	.stop	= NULL,
+	.setbrg	= clps7111_serial_setbrg,
+	.putc	= clps7111_serial_putc,
+	.puts	= clps7111_serial_puts,
+	.getc	= clps7111_serial_getc,
+	.tstc	= clps7111_serial_tstc,
+};
+
+void clps7111_serial_initialize(void)
+{
+	serial_register(&clps7111_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &clps7111_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return clps7111_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	clps7111_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	clps7111_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	clps7111_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return clps7111_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return clps7111_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 50/71] serial: arm: Implement CONFIG_SERIAL_MULTI into imx serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (48 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 49/71] serial: arm: Implement CONFIG_SERIAL_MULTI into clps7111 " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-17 13:58   ` Stefano Babic
  2012-09-16 23:21 ` [U-Boot] [PATCH 51/71] serial: arm: Implement CONFIG_SERIAL_MULTI into ixp " Marek Vasut
                   ` (22 subsequent siblings)
  72 siblings, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into imx serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the imx driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Stefano Babic <sbabic@denx.de>
---
 common/serial.c             |    2 ++
 drivers/serial/serial_imx.c |   68 ++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 63 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 4471262..cb8eacf 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -80,6 +80,7 @@ serial_initfunc(s3c4510b_serial_initialize);
 serial_initfunc(s3c64xx_serial_initialize);
 serial_initfunc(sandbox_serial_initialize);
 serial_initfunc(clps7111_serial_initialize);
+serial_initfunc(imx_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -138,6 +139,7 @@ void serial_initialize(void)
 	s3c64xx_serial_initialize();
 	sandbox_serial_initialize();
 	clps7111_serial_initialize();
+	imx_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_imx.c b/drivers/serial/serial_imx.c
index b9ca748..d37ec29 100644
--- a/drivers/serial/serial_imx.c
+++ b/drivers/serial/serial_imx.c
@@ -19,6 +19,8 @@
 
 #include <common.h>
 #include <asm/arch/imx-regs.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 #if defined CONFIG_IMX_SERIAL1
 #define UART_BASE IMX_UART1_BASE
@@ -50,7 +52,7 @@ struct imx_serial {
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void serial_setbrg (void)
+static void imx_serial_setbrg(void)
 {
 	serial_init();
 }
@@ -62,7 +64,7 @@ extern void imx_gpio_mode(int gpio_mode);
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  *
  */
-int serial_init (void)
+static int imx_serial_init(void)
 {
 	volatile struct imx_serial* base = (struct imx_serial *)UART_BASE;
 	unsigned int ufcr_rfdiv;
@@ -163,7 +165,7 @@ int serial_init (void)
  * otherwise. When the function is successful, the character read is
  * written into its argument c.
  */
-int serial_getc (void)
+static int imx_serial_getc(void)
 {
 	volatile struct imx_serial* base = (struct imx_serial *)UART_BASE;
 	unsigned char ch;
@@ -185,7 +187,7 @@ int hwflow_onoff(int on)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc (const char c)
+static void imx_serial_putc(const char c)
 {
 	volatile struct imx_serial* base = (struct imx_serial *)UART_BASE;
 
@@ -202,7 +204,7 @@ void serial_putc (const char c)
 /*
  * Test whether a character is in the RX buffer
  */
-int serial_tstc (void)
+static int imx_serial_tstc(void)
 {
 	volatile struct imx_serial* base = (struct imx_serial *)UART_BASE;
 
@@ -212,10 +214,62 @@ int serial_tstc (void)
 	return 1;
 }
 
-void
-serial_puts (const char *s)
+static void imx_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device imx_serial_drv = {
+	.name	= "imx_serial",
+	.start	= imx_serial_init,
+	.stop	= NULL,
+	.setbrg	= imx_serial_setbrg,
+	.putc	= imx_serial_putc,
+	.puts	= imx_serial_puts,
+	.getc	= imx_serial_getc,
+	.tstc	= imx_serial_tstc,
+};
+
+void imx_serial_initialize(void)
+{
+	serial_register(&imx_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &imx_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return imx_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	imx_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	imx_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	imx_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return imx_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return imx_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 51/71] serial: arm: Implement CONFIG_SERIAL_MULTI into ixp serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (49 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 50/71] serial: arm: Implement CONFIG_SERIAL_MULTI into imx " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 52/71] serial: arm: Implement CONFIG_SERIAL_MULTI into ks8695 " Marek Vasut
                   ` (21 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into ixp serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the ixp driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Michael Schwingen <michael@schwingen.org>
---
 common/serial.c             |    2 ++
 drivers/serial/serial_ixp.c |   68 ++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 63 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index cb8eacf..3d8fa7f 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -81,6 +81,7 @@ serial_initfunc(s3c64xx_serial_initialize);
 serial_initfunc(sandbox_serial_initialize);
 serial_initfunc(clps7111_serial_initialize);
 serial_initfunc(imx_serial_initialize);
+serial_initfunc(ixp_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -140,6 +141,7 @@ void serial_initialize(void)
 	sandbox_serial_initialize();
 	clps7111_serial_initialize();
 	imx_serial_initialize();
+	ixp_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_ixp.c b/drivers/serial/serial_ixp.c
index a9acd47..6e3f7f0 100644
--- a/drivers/serial/serial_ixp.c
+++ b/drivers/serial/serial_ixp.c
@@ -31,6 +31,8 @@
 #include <common.h>
 #include <asm/arch/ixp425.h>
 #include <watchdog.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 /*
  *               14.7456 MHz
@@ -41,7 +43,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void serial_setbrg (void)
+static void ixp_serial_setbrg(void)
 {
 	unsigned int quot = 0;
 	int uart = CONFIG_SYS_IXP425_CONSOLE;
@@ -72,7 +74,7 @@ void serial_setbrg (void)
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  *
  */
-int serial_init (void)
+static int ixp_serial_init(void)
 {
 	serial_setbrg ();
 
@@ -83,7 +85,7 @@ int serial_init (void)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc (const char c)
+static void ixp_serial_putc(const char c)
 {
 	/* wait for room in the tx FIFO on UART */
 	while ((LSR(CONFIG_SYS_IXP425_CONSOLE) & LSR_TEMT) == 0)
@@ -101,7 +103,7 @@ void serial_putc (const char c)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_tstc (void)
+static int ixp_serial_tstc(void)
 {
 	return LSR(CONFIG_SYS_IXP425_CONSOLE) & LSR_DR;
 }
@@ -111,7 +113,7 @@ int serial_tstc (void)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_getc (void)
+static int ixp_serial_getc(void)
 {
 	while (!(LSR(CONFIG_SYS_IXP425_CONSOLE) & LSR_DR))
 		WATCHDOG_RESET();	/* Reset HW Watchdog, if needed */
@@ -119,10 +121,62 @@ int serial_getc (void)
 	return (char) RBR(CONFIG_SYS_IXP425_CONSOLE) & 0xff;
 }
 
-void
-serial_puts (const char *s)
+static void ixp_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device ixp_serial_drv = {
+	.name	= "ixp_serial",
+	.start	= ixp_serial_init,
+	.stop	= NULL,
+	.setbrg	= ixp_serial_setbrg,
+	.putc	= ixp_serial_putc,
+	.puts	= ixp_serial_puts,
+	.getc	= ixp_serial_getc,
+	.tstc	= ixp_serial_tstc,
+};
+
+void ixp_serial_initialize(void)
+{
+	serial_register(&ixp_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &ixp_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return ixp_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	ixp_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	ixp_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	ixp_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return ixp_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return ixp_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 52/71] serial: arm: Implement CONFIG_SERIAL_MULTI into ks8695 serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (50 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 51/71] serial: arm: Implement CONFIG_SERIAL_MULTI into ixp " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 53/71] serial: arm: Implement CONFIG_SERIAL_MULTI into lh7a40x " Marek Vasut
                   ` (20 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into ks8695 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the ks8695 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                |    2 ++
 drivers/serial/serial_ks8695.c |   73 +++++++++++++++++++++++++++++++++++-----
 2 files changed, 66 insertions(+), 9 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 3d8fa7f..21c8ac3 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -82,6 +82,7 @@ serial_initfunc(sandbox_serial_initialize);
 serial_initfunc(clps7111_serial_initialize);
 serial_initfunc(imx_serial_initialize);
 serial_initfunc(ixp_serial_initialize);
+serial_initfunc(ks8695_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -142,6 +143,7 @@ void serial_initialize(void)
 	clps7111_serial_initialize();
 	imx_serial_initialize();
 	ixp_serial_initialize();
+	ks8695_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_ks8695.c b/drivers/serial/serial_ks8695.c
index aacd1be..b3af388 100644
--- a/drivers/serial/serial_ks8695.c
+++ b/drivers/serial/serial_ks8695.c
@@ -20,6 +20,8 @@
 
 #include <common.h>
 #include <asm/arch/platform.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 #ifndef CONFIG_SERIAL1
 #error "Bad: you didn't configure serial ..."
@@ -54,7 +56,7 @@ struct ks8695uart {
 int serial_console = 1;
 
 
-void serial_setbrg(void)
+static void ks8695_serial_setbrg(void)
 {
 	volatile struct ks8695uart *uartp = KS8695_UART_ADDR;
 
@@ -63,14 +65,14 @@ void serial_setbrg(void)
 	uartp->LCR = KS8695_UART_LINEC_WLEN8;
 }
 
-int serial_init(void)
+static int ks8695_serial_init(void)
 {
 	serial_console = 1;
 	serial_setbrg();
 	return 0;
 }
 
-void serial_raw_putc(const char c)
+static void ks8695_serial_raw_putc(const char c)
 {
 	volatile struct ks8695uart *uartp = KS8695_UART_ADDR;
 	int i;
@@ -83,16 +85,16 @@ void serial_raw_putc(const char c)
 	uartp->TX = c;
 }
 
-void serial_putc(const char c)
+static void ks8695_serial_putc(const char c)
 {
 	if (serial_console) {
-		serial_raw_putc(c);
+		ks8695_serial_raw_putc(c);
 		if (c == '\n')
-			serial_raw_putc('\r');
+			ks8695_serial_raw_putc('\r');
 	}
 }
 
-int serial_tstc(void)
+static int ks8695_serial_tstc(void)
 {
 	volatile struct ks8695uart *uartp = KS8695_UART_ADDR;
 	if (serial_console)
@@ -100,14 +102,14 @@ int serial_tstc(void)
 	return 0;
 }
 
-void serial_puts(const char *s)
+static void ks8695_serial_puts(const char *s)
 {
 	char c;
 	while ((c = *s++) != 0)
 		serial_putc(c);
 }
 
-int serial_getc(void)
+static int ks8695_serial_getc(void)
 {
 	volatile struct ks8695uart *uartp = KS8695_UART_ADDR;
 
@@ -115,3 +117,56 @@ int serial_getc(void)
 		;
 	return (uartp->RX);
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device ks8695_serial_drv = {
+	.name	= "ks8695_serial",
+	.start	= ks8695_serial_init,
+	.stop	= NULL,
+	.setbrg	= ks8695_serial_setbrg,
+	.putc	= ks8695_serial_putc,
+	.puts	= ks8695_serial_puts,
+	.getc	= ks8695_serial_getc,
+	.tstc	= ks8695_serial_tstc,
+};
+
+void ks8695_serial_initialize(void)
+{
+	serial_register(&ks8695_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &ks8695_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return ks8695_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	ks8695_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	ks8695_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	ks8695_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return ks8695_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return ks8695_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 53/71] serial: arm: Implement CONFIG_SERIAL_MULTI into lh7a40x serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (51 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 52/71] serial: arm: Implement CONFIG_SERIAL_MULTI into ks8695 " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 54/71] serial: arm: Implement CONFIG_SERIAL_MULTI into lpc2292 " Marek Vasut
                   ` (19 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into lh7a40x serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the lh7a40x driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                 |    2 ++
 drivers/serial/serial_lh7a40x.c |   66 ++++++++++++++++++++++++++++++++++-----
 2 files changed, 61 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 21c8ac3..59a8650 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -83,6 +83,7 @@ serial_initfunc(clps7111_serial_initialize);
 serial_initfunc(imx_serial_initialize);
 serial_initfunc(ixp_serial_initialize);
 serial_initfunc(ks8695_serial_initialize);
+serial_initfunc(lh7a40x_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -144,6 +145,7 @@ void serial_initialize(void)
 	imx_serial_initialize();
 	ixp_serial_initialize();
 	ks8695_serial_initialize();
+	lh7a40x_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_lh7a40x.c b/drivers/serial/serial_lh7a40x.c
index 4767489..6b73606 100644
--- a/drivers/serial/serial_lh7a40x.c
+++ b/drivers/serial/serial_lh7a40x.c
@@ -33,7 +33,7 @@ DECLARE_GLOBAL_DATA_PTR;
 # error "No console configured ... "
 #endif
 
-void serial_setbrg (void)
+static void lh7a40x_serial_setbrg(void)
 {
 	lh7a40x_uart_t* uart = LH7A40X_UART_PTR(UART_CONSOLE);
 	int i;
@@ -61,7 +61,7 @@ void serial_setbrg (void)
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  *
  */
-int serial_init (void)
+static int lh7a40x_serial_init(void)
 {
 	lh7a40x_uart_t* uart = LH7A40X_UART_PTR(UART_CONSOLE);
 
@@ -95,7 +95,7 @@ int serial_init (void)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_getc (void)
+static int lh7a40x_serial_getc(void)
 {
 	lh7a40x_uart_t* uart = LH7A40X_UART_PTR(UART_CONSOLE);
 
@@ -141,7 +141,7 @@ void enable_putc(void)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc (const char c)
+static void lh7a40x_serial_putc(const char c)
 {
 	lh7a40x_uart_t* uart = LH7A40X_UART_PTR(UART_CONSOLE);
 
@@ -168,17 +168,69 @@ void serial_putc (const char c)
 /*
  * Test whether a character is in the RX buffer
  */
-int serial_tstc (void)
+static int lh7a40x_serial_tstc(void)
 {
 	lh7a40x_uart_t* uart = LH7A40X_UART_PTR(UART_CONSOLE);
 
 	return(!(uart->status & UART_RXFE));
 }
 
-void
-serial_puts (const char *s)
+static void lh7a40x_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device lh7a40x_serial_drv = {
+	.name	= "lh7a40x_serial",
+	.start	= lh7a40x_serial_init,
+	.stop	= NULL,
+	.setbrg	= lh7a40x_serial_setbrg,
+	.putc	= lh7a40x_serial_putc,
+	.puts	= lh7a40x_serial_puts,
+	.getc	= lh7a40x_serial_getc,
+	.tstc	= lh7a40x_serial_tstc,
+};
+
+void lh7a40x_serial_initialize(void)
+{
+	serial_register(&lh7a40x_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &lh7a40x_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return lh7a40x_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	lh7a40x_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	lh7a40x_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	lh7a40x_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return lh7a40x_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return lh7a40x_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 54/71] serial: arm: Implement CONFIG_SERIAL_MULTI into lpc2292 serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (52 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 53/71] serial: arm: Implement CONFIG_SERIAL_MULTI into lh7a40x " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 55/71] serial: Implement CONFIG_SERIAL_MULTI into max3100 " Marek Vasut
                   ` (18 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into lpc2292 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the lpc2292 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                 |    2 ++
 drivers/serial/serial_lpc2292.c |   66 ++++++++++++++++++++++++++++++++++-----
 2 files changed, 61 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 59a8650..23c8d22 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -84,6 +84,7 @@ serial_initfunc(imx_serial_initialize);
 serial_initfunc(ixp_serial_initialize);
 serial_initfunc(ks8695_serial_initialize);
 serial_initfunc(lh7a40x_serial_initialize);
+serial_initfunc(lpc2292_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -146,6 +147,7 @@ void serial_initialize(void)
 	ixp_serial_initialize();
 	ks8695_serial_initialize();
 	lh7a40x_serial_initialize();
+	lpc2292_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_lpc2292.c b/drivers/serial/serial_lpc2292.c
index e3a60b6..2601ee7 100644
--- a/drivers/serial/serial_lpc2292.c
+++ b/drivers/serial/serial_lpc2292.c
@@ -33,7 +33,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void serial_setbrg (void)
+static void lpc2292_serial_setbrg(void)
 {
 	unsigned short divisor = 0;
 
@@ -57,7 +57,7 @@ void serial_setbrg (void)
 	PUT8(U0FCR, 1);		/* Enable RX and TX FIFOs */
 }
 
-int serial_init (void)
+static int lpc2292_serial_init(void)
 {
 	unsigned long pinsel0;
 
@@ -71,7 +71,7 @@ int serial_init (void)
 	return (0);
 }
 
-void serial_putc (const char c)
+static void lpc2292_serial_putc(const char c)
 {
 	if (c == '\n')
 	{
@@ -83,14 +83,13 @@ void serial_putc (const char c)
 	PUT8(U0THR, c);
 }
 
-int serial_getc (void)
+static int lpc2292_serial_getc(void)
 {
 	while((GET8(U0LSR) & 1) == 0);
 	return GET8(U0RBR);
 }
 
-void
-serial_puts (const char *s)
+static void lpc2292_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
@@ -98,7 +97,60 @@ serial_puts (const char *s)
 }
 
 /* Test if there is a byte to read */
-int serial_tstc (void)
+static int lpc2292_serial_tstc(void)
 {
 	return (GET8(U0LSR) & 1);
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device lpc2292_serial_drv = {
+	.name	= "lpc2292_serial",
+	.start	= lpc2292_serial_init,
+	.stop	= NULL,
+	.setbrg	= lpc2292_serial_setbrg,
+	.putc	= lpc2292_serial_putc,
+	.puts	= lpc2292_serial_puts,
+	.getc	= lpc2292_serial_getc,
+	.tstc	= lpc2292_serial_tstc,
+};
+
+void lpc2292_serial_initialize(void)
+{
+	serial_register(&lpc2292_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &lpc2292_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return lpc2292_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	lpc2292_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	lpc2292_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	lpc2292_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return lpc2292_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return lpc2292_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 55/71] serial: Implement CONFIG_SERIAL_MULTI into max3100 serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (53 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 54/71] serial: arm: Implement CONFIG_SERIAL_MULTI into lpc2292 " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 56/71] serial: arm: Implement CONFIG_SERIAL_MULTI into mxc " Marek Vasut
                   ` (17 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into max3100 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the max3100 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                 |    2 ++
 drivers/serial/serial_max3100.c |   72 +++++++++++++++++++++++++++++++--------
 2 files changed, 60 insertions(+), 14 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 23c8d22..f007d13 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -85,6 +85,7 @@ serial_initfunc(ixp_serial_initialize);
 serial_initfunc(ks8695_serial_initialize);
 serial_initfunc(lh7a40x_serial_initialize);
 serial_initfunc(lpc2292_serial_initialize);
+serial_initfunc(max3100_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -148,6 +149,7 @@ void serial_initialize(void)
 	ks8695_serial_initialize();
 	lh7a40x_serial_initialize();
 	lpc2292_serial_initialize();
+	max3100_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_max3100.c b/drivers/serial/serial_max3100.c
index 4abc271..b21fba0 100644
--- a/drivers/serial/serial_max3100.c
+++ b/drivers/serial/serial_max3100.c
@@ -25,6 +25,8 @@
 
 #include <common.h>
 #include <watchdog.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -149,7 +151,7 @@ static int rxfifo_in;
 static int rxfifo_out;
 static unsigned char rxfifo_buf[16];
 
-static void max3100_putc(int c)
+static void max3100_serial_putc_raw(int c)
 {
 	unsigned int rx;
 
@@ -164,7 +166,7 @@ static void max3100_putc(int c)
 	}
 }
 
-static int max3100_getc(void)
+static int max3100_serial_getc(void)
 {
 	int c;
 	unsigned int rx;
@@ -190,7 +192,7 @@ static int max3100_getc(void)
 	return c;
 }
 
-static int max3100_tstc(void)
+static int max3100_serial_tstc(void)
 {
 	unsigned int rx;
 
@@ -213,7 +215,7 @@ static int max3100_tstc(void)
 	return 1;
 }
 
-int serial_init(void)
+static int max3100_serial_init(void)
 {
 	unsigned int wconf, rconf;
 	int i;
@@ -268,31 +270,73 @@ int serial_init(void)
 	return (0);
 }
 
-void serial_putc(const char c)
+static void max3100_serial_putc(const char c)
 {
 	if (c == '\n')
-		max3100_putc('\r');
+		max3100_serial_putc_raw('\r');
 
-	max3100_putc(c);
+	max3100_serial_putc_raw(c);
 }
 
-void serial_puts(const char *s)
+static void max3100_serial_puts(const char *s)
 {
 	while (*s)
-		serial_putc (*s++);
+		max3100_serial_putc_raw(*s++);
 }
 
-int serial_getc(void)
+static void max3100_serial_setbrg(void)
 {
-	return max3100_getc();
 }
 
-int serial_tstc(void)
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device max3100_serial_drv = {
+	.name	= "max3100_serial",
+	.start	= max3100_serial_init,
+	.stop	= NULL,
+	.setbrg	= max3100_serial_setbrg,
+	.putc	= max3100_serial_putc,
+	.puts	= max3100_serial_puts,
+	.getc	= max3100_serial_getc,
+	.tstc	= max3100_serial_tstc,
+};
+
+void max3100_serial_initialize(void)
+{
+	serial_register(&max3100_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &max3100_serial_drv;
+}
+#else
+int serial_init(void)
 {
-	return max3100_tstc();
+	return max3100_serial_init();
 }
 
-/* XXX WTF? */
 void serial_setbrg(void)
 {
+	max3100_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	max3100_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	max3100_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return max3100_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return max3100_serial_tstc();
 }
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 56/71] serial: arm: Implement CONFIG_SERIAL_MULTI into mxc serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (54 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 55/71] serial: Implement CONFIG_SERIAL_MULTI into max3100 " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 57/71] serial: arm: Implement CONFIG_SERIAL_MULTI into netarm " Marek Vasut
                   ` (16 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into mxc serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the mxc driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Stefano Babic <sbabic@denx.de>
---
 common/serial.c             |    2 ++
 drivers/serial/serial_mxc.c |   68 ++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 63 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index f007d13..566a3cc 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -86,6 +86,7 @@ serial_initfunc(ks8695_serial_initialize);
 serial_initfunc(lh7a40x_serial_initialize);
 serial_initfunc(lpc2292_serial_initialize);
 serial_initfunc(max3100_serial_initialize);
+serial_initfunc(mxc_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -150,6 +151,7 @@ void serial_initialize(void)
 	lh7a40x_serial_initialize();
 	lpc2292_serial_initialize();
 	max3100_serial_initialize();
+	mxc_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
index af00b9c..0899e9b 100644
--- a/drivers/serial/serial_mxc.c
+++ b/drivers/serial/serial_mxc.c
@@ -21,6 +21,8 @@
 #include <watchdog.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/clock.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 #define __REG(x)     (*((volatile u32 *)(x)))
 
@@ -145,7 +147,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void serial_setbrg (void)
+static void mxc_serial_setbrg(void)
 {
 	u32 clk = imx_get_uartclk();
 
@@ -158,14 +160,14 @@ void serial_setbrg (void)
 
 }
 
-int serial_getc (void)
+static int mxc_serial_getc(void)
 {
 	while (__REG(UART_PHYS + UTS) & UTS_RXEMPTY)
 		WATCHDOG_RESET();
 	return (__REG(UART_PHYS + URXD) & URXD_RX_DATA); /* mask out status from upper word */
 }
 
-void serial_putc (const char c)
+static void mxc_serial_putc(const char c)
 {
 	__REG(UART_PHYS + UTXD) = c;
 
@@ -181,7 +183,7 @@ void serial_putc (const char c)
 /*
  * Test whether a character is in the RX buffer
  */
-int serial_tstc (void)
+static int mxc_serial_tstc(void)
 {
 	/* If receive fifo is empty, return false */
 	if (__REG(UART_PHYS + UTS) & UTS_RXEMPTY)
@@ -189,8 +191,7 @@ int serial_tstc (void)
 	return 1;
 }
 
-void
-serial_puts (const char *s)
+static void mxc_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
@@ -202,7 +203,7 @@ serial_puts (const char *s)
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  *
  */
-int serial_init (void)
+static int mxc_serial_init(void)
 {
 	__REG(UART_PHYS + UCR1) = 0x0;
 	__REG(UART_PHYS + UCR2) = 0x0;
@@ -224,3 +225,56 @@ int serial_init (void)
 
 	return 0;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device mxc_serial_drv = {
+	.name	= "mxc_serial",
+	.start	= mxc_serial_init,
+	.stop	= NULL,
+	.setbrg	= mxc_serial_setbrg,
+	.putc	= mxc_serial_putc,
+	.puts	= mxc_serial_puts,
+	.getc	= mxc_serial_getc,
+	.tstc	= mxc_serial_tstc,
+};
+
+void mxc_serial_initialize(void)
+{
+	serial_register(&mxc_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &mxc_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return mxc_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	mxc_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	mxc_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	mxc_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return mxc_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return mxc_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 57/71] serial: arm: Implement CONFIG_SERIAL_MULTI into netarm serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (55 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 56/71] serial: arm: Implement CONFIG_SERIAL_MULTI into mxc " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 58/71] serial: arm: Implement CONFIG_SERIAL_MULTI into pl01x " Marek Vasut
                   ` (15 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into netarm serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the netarm driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Stefano Babic <sbabic@denx.de>
---
 common/serial.c                |    2 ++
 drivers/serial/serial_netarm.c |   65 ++++++++++++++++++++++++++++++++++++----
 2 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 566a3cc..c033cf0 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -87,6 +87,7 @@ serial_initfunc(lh7a40x_serial_initialize);
 serial_initfunc(lpc2292_serial_initialize);
 serial_initfunc(max3100_serial_initialize);
 serial_initfunc(mxc_serial_initialize);
+serial_initfunc(netarm_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -152,6 +153,7 @@ void serial_initialize(void)
 	lpc2292_serial_initialize();
 	max3100_serial_initialize();
 	mxc_serial_initialize();
+	netarm_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_netarm.c b/drivers/serial/serial_netarm.c
index d04790d..ff6612d 100644
--- a/drivers/serial/serial_netarm.c
+++ b/drivers/serial/serial_netarm.c
@@ -59,7 +59,7 @@ extern void _netarm_led_FAIL1(void);
 /*
  * Setup both serial i/f with given baudrate
  */
-void serial_setbrg (void)
+static void netarm_serial_setbrg(void)
 {
 	/* set 0 ... make sure pins are configured for serial */
 #if !defined(CONFIG_NETARM_NS7520)
@@ -108,7 +108,7 @@ void serial_setbrg (void)
  * Initialise the serial port with the given baudrate. The settings
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  */
-int serial_init (void)
+static int netarm_serial_init(void)
 {
 	serial_setbrg ();
 	return 0;
@@ -118,7 +118,7 @@ int serial_init (void)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc (const char c)
+static void netarm_serial_putc(const char c)
 {
 	volatile unsigned char *fifo;
 
@@ -135,7 +135,7 @@ void serial_putc (const char c)
  * Test of a single byte from the serial port. Returns 1 on success, 0
  * otherwise.
  */
-int serial_tstc(void)
+static int netarm_serial_tstc(void)
 {
 	return serial_reg_ch1->status_a & NETARM_SER_STATA_RX_RDY;
 }
@@ -144,7 +144,7 @@ int serial_tstc(void)
  * Read a single byte from the serial port. Returns 1 on success, 0
  * otherwise.
  */
-int serial_getc (void)
+static int netarm_serial_getc(void)
 {
 	unsigned int ch_uint;
 	volatile unsigned int *fifo;
@@ -182,9 +182,62 @@ int serial_getc (void)
 	return ch_uint & 0xff;
 }
 
-void serial_puts (const char *s)
+static void netarm_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device netarm_serial_drv = {
+	.name	= "netarm_serial",
+	.start	= netarm_serial_init,
+	.stop	= NULL,
+	.setbrg	= netarm_serial_setbrg,
+	.putc	= netarm_serial_putc,
+	.puts	= netarm_serial_puts,
+	.getc	= netarm_serial_getc,
+	.tstc	= netarm_serial_tstc,
+};
+
+void netarm_serial_initialize(void)
+{
+	serial_register(&netarm_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &netarm_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return netarm_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	netarm_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	netarm_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	netarm_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return netarm_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return netarm_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 58/71] serial: arm: Implement CONFIG_SERIAL_MULTI into pl01x serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (56 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 57/71] serial: arm: Implement CONFIG_SERIAL_MULTI into netarm " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 59/71] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c44b0 " Marek Vasut
                   ` (14 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into pl01x serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the pl01x driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Mathieu J. Poirier <mathieu.poirier@linaro.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: John Rigby <john.rigby@linaro.org>
Cc: Rabin Vincent <rabin.vincent@stericsson.com>
---
 common/serial.c               |    2 ++
 drivers/serial/serial_pl01x.c |   69 ++++++++++++++++++++++++++++++++++++-----
 2 files changed, 64 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index c033cf0..48e6044 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -88,6 +88,7 @@ serial_initfunc(lpc2292_serial_initialize);
 serial_initfunc(max3100_serial_initialize);
 serial_initfunc(mxc_serial_initialize);
 serial_initfunc(netarm_serial_initialize);
+serial_initfunc(pl01x_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -154,6 +155,7 @@ void serial_initialize(void)
 	max3100_serial_initialize();
 	mxc_serial_initialize();
 	netarm_serial_initialize();
+	pl01x_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c
index d4c5137..beb0c98 100644
--- a/drivers/serial/serial_pl01x.c
+++ b/drivers/serial/serial_pl01x.c
@@ -30,6 +30,8 @@
 #include <common.h>
 #include <watchdog.h>
 #include <asm/io.h>
+#include <serial.h>
+#include <linux/compiler.h>
 #include "serial_pl01x.h"
 
 /*
@@ -54,7 +56,7 @@ static struct pl01x_regs *pl01x_get_regs(int portnum)
 
 #ifdef CONFIG_PL010_SERIAL
 
-int serial_init (void)
+static int pl01x_serial_init(void)
 {
 	struct pl01x_regs *regs = pl01x_get_regs(CONSOLE_PORT);
 	unsigned int divisor;
@@ -104,7 +106,7 @@ int serial_init (void)
 
 #ifdef CONFIG_PL011_SERIAL
 
-int serial_init (void)
+static int pl01x_serial_init(void)
 {
 	struct pl01x_regs *regs = pl01x_get_regs(CONSOLE_PORT);
 	unsigned int temp;
@@ -169,7 +171,7 @@ int serial_init (void)
 
 #endif /* CONFIG_PL011_SERIAL */
 
-void serial_putc (const char c)
+static void pl01x_serial_putc(const char c)
 {
 	if (c == '\n')
 		pl01x_putc (CONSOLE_PORT, '\r');
@@ -177,24 +179,24 @@ void serial_putc (const char c)
 	pl01x_putc (CONSOLE_PORT, c);
 }
 
-void serial_puts (const char *s)
+static void pl01x_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
-int serial_getc (void)
+static int pl01x_serial_getc(void)
 {
 	return pl01x_getc (CONSOLE_PORT);
 }
 
-int serial_tstc (void)
+static int pl01x_serial_tstc(void)
 {
 	return pl01x_tstc (CONSOLE_PORT);
 }
 
-void serial_setbrg (void)
+static void pl01x_serial_setbrg(void)
 {
 	struct pl01x_regs *regs = pl01x_get_regs(CONSOLE_PORT);
 
@@ -250,3 +252,56 @@ static int pl01x_tstc (int portnum)
 	WATCHDOG_RESET();
 	return !(readl(&regs->fr) & UART_PL01x_FR_RXFE);
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device pl01x_serial_drv = {
+	.name	= "pl01x_serial",
+	.start	= pl01x_serial_init,
+	.stop	= NULL,
+	.setbrg	= pl01x_serial_setbrg,
+	.putc	= pl01x_serial_putc,
+	.puts	= pl01x_serial_puts,
+	.getc	= pl01x_serial_getc,
+	.tstc	= pl01x_serial_tstc,
+};
+
+void pl01x_serial_initialize(void)
+{
+	serial_register(&pl01x_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &pl01x_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return pl01x_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	pl01x_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	pl01x_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	pl01x_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return pl01x_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return pl01x_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 59/71] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c44b0 serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (57 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 58/71] serial: arm: Implement CONFIG_SERIAL_MULTI into pl01x " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 60/71] serial: arm: Implement CONFIG_SERIAL_MULTI into sa1100 " Marek Vasut
                   ` (13 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into s3c44b0 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the s3c44b0 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                 |    2 ++
 drivers/serial/serial_s3c44b0.c |   68 ++++++++++++++++++++++++++++++++++-----
 2 files changed, 62 insertions(+), 8 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 48e6044..1953aaf 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -89,6 +89,7 @@ serial_initfunc(max3100_serial_initialize);
 serial_initfunc(mxc_serial_initialize);
 serial_initfunc(netarm_serial_initialize);
 serial_initfunc(pl01x_serial_initialize);
+serial_initfunc(s3c44b0_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -156,6 +157,7 @@ void serial_initialize(void)
 	mxc_serial_initialize();
 	netarm_serial_initialize();
 	pl01x_serial_initialize();
+	s3c44b0_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_s3c44b0.c b/drivers/serial/serial_s3c44b0.c
index 95d0266..8beba1a 100644
--- a/drivers/serial/serial_s3c44b0.c
+++ b/drivers/serial/serial_s3c44b0.c
@@ -68,7 +68,7 @@ static int serial_flush_output(void)
 }
 
 
-void serial_setbrg (void)
+static void s3c44b0_serial_setbrg(void)
 {
 	u32 divisor = 0;
 
@@ -156,7 +156,7 @@ void serial_setbrg (void)
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  *
  */
-int serial_init (void)
+static int s3c44b0_serial_init(void)
 {
 	serial_setbrg ();
 
@@ -167,7 +167,7 @@ int serial_init (void)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc (const char c)
+static void s3c44b0_serial_putc(const char c)
 {
 	/* wait for room in the transmit FIFO */
 	while(!(UTRSTAT0 & 0x02));
@@ -187,7 +187,7 @@ void serial_putc (const char c)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_tstc (void)
+static int s3c44b0_serial_tstc(void)
 {
 	return (UTRSTAT0 & 0x01);
 }
@@ -197,22 +197,74 @@ int serial_tstc (void)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_getc (void)
+static int s3c44b0_serial_getc(void)
 {
 	int rv;
 
 	for(;;) {
-		rv = serial_tstc();
+		rv = s3c44b0_serial_tstc();
 
 		if(rv > 0)
 			return URXH0;
 	}
 }
 
-void
-serial_puts (const char *s)
+static void s3c44b0_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device s3c44b0_serial_drv = {
+	.name	= "s3c44b0_serial",
+	.start	= s3c44b0_serial_init,
+	.stop	= NULL,
+	.setbrg	= s3c44b0_serial_setbrg,
+	.putc	= s3c44b0_serial_putc,
+	.puts	= s3c44b0_serial_puts,
+	.getc	= s3c44b0_serial_getc,
+	.tstc	= s3c44b0_serial_tstc,
+};
+
+void s3c44b0_serial_initialize(void)
+{
+	serial_register(&s3c44b0_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &s3c44b0_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return s3c44b0_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	s3c44b0_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	s3c44b0_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	s3c44b0_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return s3c44b0_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return s3c44b0_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 60/71] serial: arm: Implement CONFIG_SERIAL_MULTI into sa1100 serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (58 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 59/71] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c44b0 " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 61/71] serial: sh: Implement CONFIG_SERIAL_MULTI into sh " Marek Vasut
                   ` (12 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into sa1100 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the sa1100 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                |    2 ++
 drivers/serial/serial_sa1100.c |   68 +++++++++++++++++++++++++++++++++++-----
 2 files changed, 63 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 1953aaf..3dae01b 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -90,6 +90,7 @@ serial_initfunc(mxc_serial_initialize);
 serial_initfunc(netarm_serial_initialize);
 serial_initfunc(pl01x_serial_initialize);
 serial_initfunc(s3c44b0_serial_initialize);
+serial_initfunc(sa1100_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -158,6 +159,7 @@ void serial_initialize(void)
 	netarm_serial_initialize();
 	pl01x_serial_initialize();
 	s3c44b0_serial_initialize();
+	sa1100_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_sa1100.c b/drivers/serial/serial_sa1100.c
index 5d18875..86e682d 100644
--- a/drivers/serial/serial_sa1100.c
+++ b/drivers/serial/serial_sa1100.c
@@ -30,10 +30,12 @@
 
 #include <common.h>
 #include <SA-1100.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void serial_setbrg (void)
+static void sa1100_serial_setbrg(void)
 {
 	unsigned int reg = 0;
 
@@ -89,7 +91,7 @@ void serial_setbrg (void)
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  *
  */
-int serial_init (void)
+static int sa1100_serial_init(void)
 {
 	serial_setbrg ();
 
@@ -100,7 +102,7 @@ int serial_init (void)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc (const char c)
+static void sa1100_serial_putc(const char c)
 {
 #ifdef CONFIG_SERIAL1
 	/* wait for room in the tx FIFO on SERIAL1 */
@@ -124,7 +126,7 @@ void serial_putc (const char c)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_tstc (void)
+static int sa1100_serial_tstc(void)
 {
 #ifdef CONFIG_SERIAL1
 	return Ser1UTSR1 & UTSR1_RNE;
@@ -138,7 +140,7 @@ int serial_tstc (void)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_getc (void)
+static int sa1100_serial_getc(void)
 {
 #ifdef CONFIG_SERIAL1
 	while (!(Ser1UTSR1 & UTSR1_RNE));
@@ -151,10 +153,62 @@ int serial_getc (void)
 #endif
 }
 
-void
-serial_puts (const char *s)
+static void sa1100_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device sa1100_serial_drv = {
+	.name	= "sa1100_serial",
+	.start	= sa1100_serial_init,
+	.stop	= NULL,
+	.setbrg	= sa1100_serial_setbrg,
+	.putc	= sa1100_serial_putc,
+	.puts	= sa1100_serial_puts,
+	.getc	= sa1100_serial_getc,
+	.tstc	= sa1100_serial_tstc,
+};
+
+void sa1100_serial_initialize(void)
+{
+	serial_register(&sa1100_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &sa1100_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return sa1100_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	sa1100_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	sa1100_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	sa1100_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return sa1100_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return sa1100_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 61/71] serial: sh: Implement CONFIG_SERIAL_MULTI into sh serial driver
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (59 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 60/71] serial: arm: Implement CONFIG_SERIAL_MULTI into sa1100 " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-18  1:01   ` Nobuhiro Iwamatsu
  2012-09-16 23:21 ` [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL Marek Vasut
                   ` (11 subsequent siblings)
  72 siblings, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into sh serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the sh driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Phil Edworthy <PHIL.EDWORTHY@renesas.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
---
 common/serial.c            |    2 ++
 drivers/serial/serial_sh.c |   65 ++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 3dae01b..631af65 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -91,6 +91,7 @@ serial_initfunc(netarm_serial_initialize);
 serial_initfunc(pl01x_serial_initialize);
 serial_initfunc(s3c44b0_serial_initialize);
 serial_initfunc(sa1100_serial_initialize);
+serial_initfunc(sh_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -160,6 +161,7 @@ void serial_initialize(void)
 	pl01x_serial_initialize();
 	s3c44b0_serial_initialize();
 	sa1100_serial_initialize();
+	sh_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_sh.c b/drivers/serial/serial_sh.c
index 13919c6..8c30397 100644
--- a/drivers/serial/serial_sh.c
+++ b/drivers/serial/serial_sh.c
@@ -55,13 +55,13 @@ static struct uart_port sh_sci = {
 	.type		= SCIF_BASE_PORT,
 };
 
-void serial_setbrg(void)
+static void sh_serial_setbrg(void)
 {
 	DECLARE_GLOBAL_DATA_PTR;
 	sci_out(&sh_sci, SCBRR, SCBRR_VALUE(gd->baudrate, CONFIG_SYS_CLK_FREQ));
 }
 
-int serial_init(void)
+static int sh_serial_init(void)
 {
 	sci_out(&sh_sci, SCSCR , SCSCR_INIT(&sh_sci));
 	sci_out(&sh_sci, SCSCR , SCSCR_INIT(&sh_sci));
@@ -127,21 +127,21 @@ void serial_raw_putc(const char c)
 	sci_out(&sh_sci, SCxSR, sci_in(&sh_sci, SCxSR) & ~SCxSR_TEND(&sh_sci));
 }
 
-void serial_putc(const char c)
+static void sh_serial_putc(const char c)
 {
 	if (c == '\n')
 		serial_raw_putc('\r');
 	serial_raw_putc(c);
 }
 
-void serial_puts(const char *s)
+static void sh_serial_puts(const char *s)
 {
 	char c;
 	while ((c = *s++) != 0)
 		serial_putc(c);
 }
 
-int serial_tstc(void)
+static int sh_serial_tstc(void)
 {
 	return serial_rx_fifo_level() ? 1 : 0;
 }
@@ -167,7 +167,7 @@ int serial_getc_check(void)
 	return status & (SCIF_DR | SCxSR_RDxF(&sh_sci));
 }
 
-int serial_getc(void)
+static int sh_serial_getc(void)
 {
 	unsigned short status;
 	char ch;
@@ -187,3 +187,56 @@ int serial_getc(void)
 		handle_error();
 	return ch;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device sh_serial_drv = {
+	.name	= "sh_serial",
+	.start	= sh_serial_init,
+	.stop	= NULL,
+	.setbrg	= sh_serial_setbrg,
+	.putc	= sh_serial_putc,
+	.puts	= sh_serial_puts,
+	.getc	= sh_serial_getc,
+	.tstc	= sh_serial_tstc,
+};
+
+void sh_serial_initialize(void)
+{
+	serial_register(&sh_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &sh_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return sh_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	sh_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	sh_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	sh_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return sh_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return sh_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (60 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 61/71] serial: sh: Implement CONFIG_SERIAL_MULTI into sh " Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-18 17:05   ` Tom Rini
  2012-09-16 23:21 ` [U-Boot] [PATCH 63/71] serial: mxs: spl: Remove empty serial_* functions from SPL code Marek Vasut
                   ` (10 subsequent siblings)
  72 siblings, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Implement empty serial_* functions for SPL without serial
support enabled. This is imperative to haave once serial
multi is enabled unconditionally.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/common/serial.c b/common/serial.c
index 631af65..cef4ba8 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -27,6 +27,16 @@
 #include <post.h>
 #include <linux/compiler.h>
 
+/* Implement prototypes for SPL without serial support */
+#if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_SERIAL_SUPPORT)
+int serial_init(void) { return 0; }
+void serial_setbrg(void) {}
+int serial_getc(void) { return 0; }
+int serial_tstc(void) { return 0; }
+void serial_putc(const char c) {}
+void serial_puts(const char *s) {}
+#else
+
 DECLARE_GLOBAL_DATA_PTR;
 
 static struct serial_device *serial_devices;
@@ -344,3 +354,5 @@ int uart_post_test(int flags)
 	return ret;
 }
 #endif
+
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 63/71] serial: mxs: spl: Remove empty serial_* functions from SPL code
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (61 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 64/71] serial: ns16550: Call usbtty_poll only in non-SPL build Marek Vasut
                   ` (9 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Remove the empty bodies from serial_* functions from MXS SPL code.
These empty implementations are now in common/serial.c instead so
declaring them also in the SPL code would cause a colision once
serial multi is enabled unconditionally.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Stefano Babic <sbabic@denx.de>
---
 arch/arm/cpu/arm926ejs/mxs/spl_boot.c |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_boot.c b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
index ddafddb..51b8625 100644
--- a/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
+++ b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
@@ -122,10 +122,6 @@ inline void board_init_r(gd_t *id, ulong dest_addr)
 		;
 }
 
-#ifndef CONFIG_SPL_SERIAL_SUPPORT
-void serial_putc(const char c) {}
-void serial_puts(const char *s) {}
-#endif
 void hang(void) __attribute__ ((noreturn));
 void hang(void)
 {
-- 
1.7.10.4

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

* [U-Boot] [PATCH 64/71] serial: ns16550: Call usbtty_poll only in non-SPL build
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (62 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 63/71] serial: mxs: spl: Remove empty serial_* functions from SPL code Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 65/71] serial: Use puts() and hang() instead of panic() in SPL Marek Vasut
                   ` (8 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Having both USBTTY and CONFIG_SERIAL_MULTI enabled in SPL, the
usbtty.c file is protected in Makefile to not be compiled into
the SPL. Yet, the ns16550 serial driver does not contain such
protection. Add it to avoid missing symbol error.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 drivers/serial/ns16550.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index facadd2..9027781 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -101,7 +101,7 @@ void NS16550_putc(NS16550_t com_port, char c)
 char NS16550_getc(NS16550_t com_port)
 {
 	while ((serial_in(&com_port->lsr) & UART_LSR_DR) == 0) {
-#ifdef CONFIG_USB_TTY
+#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_USB_TTY)
 		extern void usbtty_poll(void);
 		usbtty_poll();
 #endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 65/71] serial: Use puts() and hang() instead of panic() in SPL
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (63 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 64/71] serial: ns16550: Call usbtty_poll only in non-SPL build Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 66/71] serial: Unconditionally enable CONFIG_SERIAL_MULTI Marek Vasut
                   ` (7 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

If case the get_current() call fails before relocation, the U-Boot
must try to print an error message, fail and either reset or halt.
Such error is critical enough to halt the system, as it means the
system is in very bad state.

This is now also used in SPL, since CONFIG_SERIAL_MULTI is enabled
unconditionally. To avoid compiling whole vsprintf.c into SPL, use
puts() to print error message and hang() to stop the system in case
of SPL build.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index cef4ba8..8e0d8a1 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -230,8 +230,14 @@ static struct serial_device *get_current(void)
 		dev = default_serial_console();
 
 		/* We must have a console device */
-		if (!dev)
-			panic("Cannot find console");
+		if (!dev) {
+#ifdef CONFIG_SPL_BUILD
+			puts("Cannot find console\n");
+			hang();
+#else
+			panic("Cannot find console\n");
+#endif
+		}
 	} else
 		dev = serial_current;
 	return dev;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 66/71] serial: Unconditionally enable CONFIG_SERIAL_MULTI
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (64 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 65/71] serial: Use puts() and hang() instead of panic() in SPL Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 67/71] serial: Remove CONFIG_SERIAL_MULTI from config files Marek Vasut
                   ` (6 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Enable CONFIG_SERIAL_MULTI for all builds of U-Boot. That includes
both SPL builds and non-SPL builds, everything. To avoid poluting
this patch with removal of ifdef-endif constructions containing
CONFIG_SERIAL_MULTI, the CONFIG_SERIAL_MULTI is temporarily added
into CPPFLAGS in config.mk . This will be again removed in following
patch.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/Makefile |    2 +-
 config.mk       |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/Makefile b/common/Makefile
index 57da76f..8b1ee5d 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -32,7 +32,6 @@ COBJS-y += command.o
 COBJS-y += exports.o
 COBJS-$(CONFIG_SYS_HUSH_PARSER) += hush.o
 COBJS-y += s_record.o
-COBJS-$(CONFIG_SERIAL_MULTI) += serial.o
 COBJS-y += xyzModem.o
 
 # core command
@@ -195,6 +194,7 @@ COBJS-y += dlmalloc.o
 COBJS-y += image.o
 COBJS-y += memsize.o
 COBJS-y += stdio.o
+COBJS-$(CONFIG_SERIAL_MULTI) += serial.o
 
 
 COBJS	:= $(sort $(COBJS-y))
diff --git a/config.mk b/config.mk
index c3822a2..88c72f1 100644
--- a/config.mk
+++ b/config.mk
@@ -193,7 +193,7 @@ OBJCFLAGS += --gap-fill=0xff
 gccincdir := $(shell $(CC) -print-file-name=include)
 
 CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS)		\
-	-D__KERNEL__
+	-D__KERNEL__ -DCONFIG_SERIAL_MULTI
 
 # Enable garbage collection of un-used sections for SPL
 ifeq ($(CONFIG_SPL_BUILD),y)
-- 
1.7.10.4

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

* [U-Boot] [PATCH 67/71] serial: Remove CONFIG_SERIAL_MULTI from config files
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (65 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 66/71] serial: Unconditionally enable CONFIG_SERIAL_MULTI Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 68/71] serial: Remove CONFIG_SERIAL_MULTI from serial drivers Marek Vasut
                   ` (5 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Remove any notion of CONFIG_SERIAL_MULTI from board config files.
Since CONFIG_SERIAL_MULTI is now enabled by default, it is useless
to specify this config option in the board config files. Therefore
remove it.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 include/configs/DU440.h               |    1 -
 include/configs/KAREF.h               |    1 -
 include/configs/METROBOX.h            |    1 -
 include/configs/MPC8569MDS.h          |    1 -
 include/configs/P1010RDB.h            |    1 -
 include/configs/P1_P2_RDB.h           |    1 -
 include/configs/P2020COME.h           |    1 -
 include/configs/PMC440.h              |    1 -
 include/configs/TB5200.h              |    1 -
 include/configs/amcc-common.h         |    1 -
 include/configs/bfin_adi_common.h     |    1 -
 include/configs/coreboot.h            |    1 -
 include/configs/eNET.h                |    1 -
 include/configs/harmony.h             |    1 -
 include/configs/jadecpu.h             |    1 -
 include/configs/korat.h               |    1 -
 include/configs/lwmon.h               |    1 -
 include/configs/lwmon5.h              |    1 -
 include/configs/mcc200.h              |    5 -----
 include/configs/medcom.h              |    1 -
 include/configs/omap3_zoom2.h         |    1 -
 include/configs/origen.h              |    1 -
 include/configs/paz00.h               |    1 -
 include/configs/pcs440ep.h            |    1 -
 include/configs/pdm360ng.h            |    3 ---
 include/configs/plutux.h              |    1 -
 include/configs/quad100hd.h           |    1 -
 include/configs/s5p_goni.h            |    1 -
 include/configs/s5pc210_universal.h   |    1 -
 include/configs/sc3.h                 |    1 -
 include/configs/seaboard.h            |    1 -
 include/configs/smdk5250.h            |    1 -
 include/configs/smdkc100.h            |    1 -
 include/configs/smdkv310.h            |    1 -
 include/configs/tec.h                 |    1 -
 include/configs/tegra20-common-post.h |    5 -----
 include/configs/trats.h               |    1 -
 include/configs/trimslice.h           |    1 -
 include/configs/trizepsiv.h           |    1 -
 include/configs/ventana.h             |    1 -
 include/configs/whistler.h            |    1 -
 include/configs/zeus.h                |    1 -
 42 files changed, 52 deletions(-)

diff --git a/include/configs/DU440.h b/include/configs/DU440.h
index 8bd7940..bbe2713 100644
--- a/include/configs/DU440.h
+++ b/include/configs/DU440.h
@@ -93,7 +93,6 @@
 #define CONFIG_SYS_NS16550_CLK		get_serial_clock()
 #undef CONFIG_SYS_EXT_SERIAL_CLOCK
 #define CONFIG_BAUDRATE		115200
-#define CONFIG_SERIAL_MULTI     1
 
 #define CONFIG_SYS_BAUDRATE_TABLE						\
 	{300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
diff --git a/include/configs/KAREF.h b/include/configs/KAREF.h
index 3daf480..546e28b 100644
--- a/include/configs/KAREF.h
+++ b/include/configs/KAREF.h
@@ -96,7 +96,6 @@
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE	1
 #define CONFIG_SYS_NS16550_CLK		get_serial_clock()
-#define CONFIG_SERIAL_MULTI   1
 #define CONFIG_BAUDRATE	      9600
 
 #define CONFIG_SYS_BAUDRATE_TABLE  \
diff --git a/include/configs/METROBOX.h b/include/configs/METROBOX.h
index 34376bc..286f869 100644
--- a/include/configs/METROBOX.h
+++ b/include/configs/METROBOX.h
@@ -158,7 +158,6 @@
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE	1
 #define CONFIG_SYS_NS16550_CLK		get_serial_clock()
-#define CONFIG_SERIAL_MULTI   1
 #define CONFIG_BAUDRATE	      9600
 
 #define CONFIG_SYS_BAUDRATE_TABLE  \
diff --git a/include/configs/MPC8569MDS.h b/include/configs/MPC8569MDS.h
index d973364..acd3276 100644
--- a/include/configs/MPC8569MDS.h
+++ b/include/configs/MPC8569MDS.h
@@ -274,7 +274,6 @@ extern unsigned long get_clock_freq(void);
 
 /* Serial Port */
 #define CONFIG_CONS_INDEX		1
-#define CONFIG_SERIAL_MULTI		1
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE    1
diff --git a/include/configs/P1010RDB.h b/include/configs/P1010RDB.h
index 67dba9f..540f32d 100644
--- a/include/configs/P1010RDB.h
+++ b/include/configs/P1010RDB.h
@@ -453,7 +453,6 @@ extern unsigned long get_sdram_size(void);
 #define CONFIG_NS16550_MIN_FUNCTIONS
 #endif
 
-#define CONFIG_SERIAL_MULTI		/* Enable both serial ports */
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV	/* determine from environment */
 
 #define CONFIG_SYS_BAUDRATE_TABLE	\
diff --git a/include/configs/P1_P2_RDB.h b/include/configs/P1_P2_RDB.h
index ab88166..9db0e87 100644
--- a/include/configs/P1_P2_RDB.h
+++ b/include/configs/P1_P2_RDB.h
@@ -343,7 +343,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 #define CONFIG_NS16550_MIN_FUNCTIONS
 #endif
 
-#define CONFIG_SERIAL_MULTI	1 /* Enable both serial ports */
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV	/* determine from environment */
 
 #define CONFIG_SYS_BAUDRATE_TABLE	\
diff --git a/include/configs/P2020COME.h b/include/configs/P2020COME.h
index d323fb5..c75f86c 100644
--- a/include/configs/P2020COME.h
+++ b/include/configs/P2020COME.h
@@ -201,7 +201,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 #define CONFIG_SYS_NS16550_REG_SIZE	1
 #define CONFIG_SYS_NS16550_CLK		get_bus_freq(0)
 
-#define CONFIG_SERIAL_MULTI	1 /* Enable both serial ports */
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV	/* determine from environment */
 
 #define CONFIG_SYS_BAUDRATE_TABLE   \
diff --git a/include/configs/PMC440.h b/include/configs/PMC440.h
index b820954..3837b8f 100644
--- a/include/configs/PMC440.h
+++ b/include/configs/PMC440.h
@@ -102,7 +102,6 @@
 #define CONFIG_SYS_NS16550_CLK		get_serial_clock()
 #undef CONFIG_SYS_EXT_SERIAL_CLOCK
 #define CONFIG_BAUDRATE		115200
-#define CONFIG_SERIAL_MULTI     1
 
 #define CONFIG_SYS_BAUDRATE_TABLE						\
 	{300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
diff --git a/include/configs/TB5200.h b/include/configs/TB5200.h
index feaadf3..a624c83 100644
--- a/include/configs/TB5200.h
+++ b/include/configs/TB5200.h
@@ -56,7 +56,6 @@
  * Serial console configuration
  */
 #define CONFIG_PSC_CONSOLE	1	/* default console is on PSC1 */
-#define CONFIG_SERIAL_MULTI	1	/* support multiple consoles */
 #define CONFIG_PSC_CONSOLE2	6	/* second console is on PSC6 */
 #define CONFIG_BAUDRATE		115200	/* ... at 115200 bps */
 #define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200, 230400 }
diff --git a/include/configs/amcc-common.h b/include/configs/amcc-common.h
index 056a22a..c9db47a 100644
--- a/include/configs/amcc-common.h
+++ b/include/configs/amcc-common.h
@@ -31,7 +31,6 @@
 /*
  * UART
  */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE	1
diff --git a/include/configs/bfin_adi_common.h b/include/configs/bfin_adi_common.h
index 7132f8f..b635c7d 100644
--- a/include/configs/bfin_adi_common.h
+++ b/include/configs/bfin_adi_common.h
@@ -108,7 +108,6 @@
 #define CONFIG_LOADS_ECHO	1
 #define CONFIG_JTAG_CONSOLE
 #define CONFIG_SILENT_CONSOLE
-#define CONFIG_SERIAL_MULTI
 #ifndef CONFIG_BAUDRATE
 # define CONFIG_BAUDRATE	57600
 #endif
diff --git a/include/configs/coreboot.h b/include/configs/coreboot.h
index 2c65d74..0e89242 100644
--- a/include/configs/coreboot.h
+++ b/include/configs/coreboot.h
@@ -54,7 +54,6 @@
 /*-----------------------------------------------------------------------
  * Serial Configuration
  */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_CONS_INDEX		1
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_SERIAL
diff --git a/include/configs/eNET.h b/include/configs/eNET.h
index d5c9cad..4b1c219 100644
--- a/include/configs/eNET.h
+++ b/include/configs/eNET.h
@@ -55,7 +55,6 @@
 /*-----------------------------------------------------------------------
  * Serial Configuration
  */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_CONS_INDEX			1
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_SERIAL
diff --git a/include/configs/harmony.h b/include/configs/harmony.h
index d0555c1..891c0e4 100644
--- a/include/configs/harmony.h
+++ b/include/configs/harmony.h
@@ -37,7 +37,6 @@
 #define CONFIG_TEGRA20_BOARD_STRING	"NVIDIA Harmony"
 
 /* Board-specific serial config */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_TEGRA20_ENABLE_UARTD
 
 /* UARTD: keyboard satellite board UART, default */
diff --git a/include/configs/jadecpu.h b/include/configs/jadecpu.h
index 7b9d36d..daf37bf 100644
--- a/include/configs/jadecpu.h
+++ b/include/configs/jadecpu.h
@@ -68,7 +68,6 @@
 /*
  * Serial
  */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE		(-4)
diff --git a/include/configs/korat.h b/include/configs/korat.h
index 46335b4..b919aec 100644
--- a/include/configs/korat.h
+++ b/include/configs/korat.h
@@ -102,7 +102,6 @@
 #define CONFIG_SYS_NS16550_CLK		get_serial_clock()
 #define CONFIG_SYS_EXT_SERIAL_CLOCK	11059200	/* ext. 11.059MHz clk	*/
 #define CONFIG_BAUDRATE		115200
-#define CONFIG_SERIAL_MULTI	1
 
 #define CONFIG_SYS_BAUDRATE_TABLE						\
 	{300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
diff --git a/include/configs/lwmon.h b/include/configs/lwmon.h
index 1d89176..ab86053 100644
--- a/include/configs/lwmon.h
+++ b/include/configs/lwmon.h
@@ -60,7 +60,6 @@
 #define CONFIG_LCD_INFO		1	/* ... and some board info	*/
 #define	CONFIG_SPLASH_SCREEN		/* ... with splashscreen support*/
 
-#define CONFIG_SERIAL_MULTI	1
 #define CONFIG_8xx_CONS_SMC2	1	/* Console is on SMC2		*/
 #define CONFIG_8xx_CONS_SCC2	1	/* Console is on SCC2		*/
 
diff --git a/include/configs/lwmon5.h b/include/configs/lwmon5.h
index 497eec4..2d33ebc 100644
--- a/include/configs/lwmon5.h
+++ b/include/configs/lwmon5.h
@@ -121,7 +121,6 @@
 #define CONFIG_SYS_NS16550_CLK		get_serial_clock()
 #undef CONFIG_SYS_EXT_SERIAL_CLOCK		/* no external clock provided	*/
 #define CONFIG_BAUDRATE		115200
-#define CONFIG_SERIAL_MULTI
 
 #define CONFIG_SYS_BAUDRATE_TABLE						\
 	{300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
diff --git a/include/configs/mcc200.h b/include/configs/mcc200.h
index 1867eb6..053e5bc 100644
--- a/include/configs/mcc200.h
+++ b/include/configs/mcc200.h
@@ -76,17 +76,12 @@
  */
 #if !defined(CONFIG_PRS200)
 /* MCC200 configuration: */
-#define CONFIG_SERIAL_MULTI	1
 #define CONFIG_PSC_CONSOLE	1	/* PSC1 may be COM */
 #define CONFIG_PSC_CONSOLE2	2	/* PSC2 is PSoC */
 #else
 /* PRS200 configuration: */
 #define CONFIG_PSC_CONSOLE	1	/* console is on PSC1		*/
 #endif
-#if defined(CONFIG_QUART_CONSOLE) && defined(CONFIG_PSC_CONSOLE) && \
-	!defined(CONFIG_SERIAL_MULTI)
-#error "Select only one console device!"
-#endif
 #define CONFIG_BAUDRATE		115200
 #define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200, 230400 }
 
diff --git a/include/configs/medcom.h b/include/configs/medcom.h
index bce03a4..12b8aef 100644
--- a/include/configs/medcom.h
+++ b/include/configs/medcom.h
@@ -38,7 +38,6 @@
 #define CONFIG_TEGRA20_BOARD_STRING	"Avionic Design Medcom"
 
 /* Board-specific serial config */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_TEGRA20_ENABLE_UARTD	/* UARTD: debug UART */
 #define CONFIG_SYS_NS16550_COM1		NV_PA_APB_UARTD_BASE
 
diff --git a/include/configs/omap3_zoom2.h b/include/configs/omap3_zoom2.h
index a7cc5fc..d681424 100644
--- a/include/configs/omap3_zoom2.h
+++ b/include/configs/omap3_zoom2.h
@@ -76,7 +76,6 @@
  * NS16550 Configuration
  * Zoom2 uses the TL16CP754C on the debug board
  */
-#define CONFIG_SERIAL_MULTI		1
 /*
  * 0 - 1 : first  USB with respect to the left edge of the debug board
  * 2 - 3 : second USB with respect to the left edge of the debug board
diff --git a/include/configs/origen.h b/include/configs/origen.h
index 1ab9834..ff2b24d 100644
--- a/include/configs/origen.h
+++ b/include/configs/origen.h
@@ -63,7 +63,6 @@
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20))
 
 /* select serial console configuration */
-#define CONFIG_SERIAL_MULTI		1
 #define CONFIG_SERIAL2			1	/* use SERIAL 2 */
 #define CONFIG_BAUDRATE			115200
 #define EXYNOS4_DEFAULT_UART_OFFSET	0x020000
diff --git a/include/configs/paz00.h b/include/configs/paz00.h
index 0eb9f3b..dc838c7 100644
--- a/include/configs/paz00.h
+++ b/include/configs/paz00.h
@@ -30,7 +30,6 @@
 #define CONFIG_TEGRA20_BOARD_STRING	"Compal Paz00"
 
 /* Board-specific serial config */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_TEGRA20_ENABLE_UARTA
 #define CONFIG_SYS_NS16550_COM1		NV_PA_APB_UARTA_BASE
 
diff --git a/include/configs/pcs440ep.h b/include/configs/pcs440ep.h
index 26627bb..351ff5a 100644
--- a/include/configs/pcs440ep.h
+++ b/include/configs/pcs440ep.h
@@ -88,7 +88,6 @@
 #define CONFIG_SYS_NS16550_CLK		get_serial_clock()
 #undef CONFIG_SYS_EXT_SERIAL_CLOCK		/* no external clk used		*/
 #define CONFIG_BAUDRATE		115200
-#define CONFIG_SERIAL_MULTI     1
 
 #define CONFIG_SYS_BAUDRATE_TABLE  \
     {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
diff --git a/include/configs/pdm360ng.h b/include/configs/pdm360ng.h
index 8afc3c0..671e9eb 100644
--- a/include/configs/pdm360ng.h
+++ b/include/configs/pdm360ng.h
@@ -298,7 +298,6 @@
 /*
  * Used PSC UART devices
  */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_SYS_PSC1
 #define CONFIG_SYS_PSC4
 #define CONFIG_SYS_PSC6
@@ -434,10 +433,8 @@
 #define CONFIG_KGDB_SER_INDEX	2	/* which serial port to use */
 #endif
 
-#ifdef CONFIG_SERIAL_MULTI
 /* POST support */
 #define CONFIG_POST             (CONFIG_SYS_POST_COPROC)
-#endif
 
 /*
  * Environment Configuration
diff --git a/include/configs/plutux.h b/include/configs/plutux.h
index 42291d4..46eb8cf 100644
--- a/include/configs/plutux.h
+++ b/include/configs/plutux.h
@@ -38,7 +38,6 @@
 #define CONFIG_TEGRA20_BOARD_STRING	"Avionic Design Plutux"
 
 /* Board-specific serial config */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_TEGRA20_ENABLE_UARTD	/* UARTD: debug UART */
 #define CONFIG_SYS_NS16550_COM1		NV_PA_APB_UARTD_BASE
 
diff --git a/include/configs/quad100hd.h b/include/configs/quad100hd.h
index 5d0c385..5f1bb58 100644
--- a/include/configs/quad100hd.h
+++ b/include/configs/quad100hd.h
@@ -113,7 +113,6 @@
 #undef	CONFIG_SYS_EXT_SERIAL_CLOCK			/* external serial clock */
 #define CONFIG_SYS_BASE_BAUD		691200
 #define CONFIG_BAUDRATE		115200
-#define CONFIG_SERIAL_MULTI
 
 /* The following table includes the supported baudrates */
 #define CONFIG_SYS_BAUDRATE_TABLE	\
diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 36f1a57..7e0b302 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -59,7 +59,6 @@
  * select serial console configuration
  */
 #define CONFIG_SERIAL2			1	/* use SERIAL2 */
-#define CONFIG_SERIAL_MULTI		1
 #define CONFIG_BAUDRATE			115200
 
 /* MMC */
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 7727624..5fc6136 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -61,7 +61,6 @@
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20))
 
 /* select serial console configuration */
-#define CONFIG_SERIAL_MULTI	1
 #define CONFIG_SERIAL2		1	/* use SERIAL 2 */
 #define CONFIG_BAUDRATE		115200
 
diff --git a/include/configs/sc3.h b/include/configs/sc3.h
index 2d6e51d..fb74608 100644
--- a/include/configs/sc3.h
+++ b/include/configs/sc3.h
@@ -83,7 +83,6 @@
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE	1
 #define CONFIG_SYS_NS16550_CLK		get_serial_clock()
-#define CONFIG_SERIAL_MULTI
 
 /*
  * define CONFIG_SYS_CLK_FREQ to your base crystal clock in Hz
diff --git a/include/configs/seaboard.h b/include/configs/seaboard.h
index afc4a85..b3b3155 100644
--- a/include/configs/seaboard.h
+++ b/include/configs/seaboard.h
@@ -45,7 +45,6 @@
 #define CONFIG_TEGRA20_BOARD_STRING	"NVIDIA Seaboard"
 
 /* Board-specific serial config */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_TEGRA20_ENABLE_UARTD
 #define CONFIG_SYS_NS16550_COM1		NV_PA_APB_UARTD_BASE
 
diff --git a/include/configs/smdk5250.h b/include/configs/smdk5250.h
index 47369aa..c0f8622 100644
--- a/include/configs/smdk5250.h
+++ b/include/configs/smdk5250.h
@@ -68,7 +68,6 @@
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20))
 
 /* select serial console configuration */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_SERIAL3			/* use SERIAL 3 */
 #define CONFIG_BAUDRATE			115200
 #define EXYNOS5_DEFAULT_UART_OFFSET	0x010000
diff --git a/include/configs/smdkc100.h b/include/configs/smdkc100.h
index 22de344..fb640db 100644
--- a/include/configs/smdkc100.h
+++ b/include/configs/smdkc100.h
@@ -64,7 +64,6 @@
  * select serial console configuration
  */
 #define CONFIG_SERIAL0			1	/* use SERIAL 0 on SMDKC100 */
-#define CONFIG_SERIAL_MULTI		1
 
 /* PWM */
 #define CONFIG_PWM			1
diff --git a/include/configs/smdkv310.h b/include/configs/smdkv310.h
index 602337f..b796b46 100644
--- a/include/configs/smdkv310.h
+++ b/include/configs/smdkv310.h
@@ -62,7 +62,6 @@
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20))
 
 /* select serial console configuration */
-#define CONFIG_SERIAL_MULTI		1
 #define CONFIG_SERIAL1			1	/* use SERIAL 1 */
 #define CONFIG_BAUDRATE			115200
 #define EXYNOS4_DEFAULT_UART_OFFSET	0x010000
diff --git a/include/configs/tec.h b/include/configs/tec.h
index 9b3f88d..2c9bbdc 100644
--- a/include/configs/tec.h
+++ b/include/configs/tec.h
@@ -39,7 +39,6 @@
 #define CONFIG_SYS_BOARD_ODMDATA	0x2b0d8011
 
 /* Board-specific serial config */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_TEGRA20_ENABLE_UARTD	/* UARTD: debug UART */
 #define CONFIG_SYS_NS16550_COM1		NV_PA_APB_UARTD_BASE
 
diff --git a/include/configs/tegra20-common-post.h b/include/configs/tegra20-common-post.h
index 42f270f..2093d0a 100644
--- a/include/configs/tegra20-common-post.h
+++ b/include/configs/tegra20-common-post.h
@@ -154,11 +154,6 @@
 #undef CONFIG_OF_CONTROL
 #endif
 
-/* remove SERIAL_MULTI */
-#ifdef CONFIG_SERIAL_MULTI
-#undef CONFIG_SERIAL_MULTI
-#endif
-
 /* remove I2C support */
 #ifdef CONFIG_TEGRA_I2C
 #undef CONFIG_TEGRA_I2C
diff --git a/include/configs/trats.h b/include/configs/trats.h
index f8da9c0..c195f5d 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -69,7 +69,6 @@
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20))
 
 /* select serial console configuration */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_SERIAL2			/* use SERIAL 2 */
 #define CONFIG_BAUDRATE			115200
 
diff --git a/include/configs/trimslice.h b/include/configs/trimslice.h
index b3c5249..0e50316 100644
--- a/include/configs/trimslice.h
+++ b/include/configs/trimslice.h
@@ -37,7 +37,6 @@
 #define CONFIG_TEGRA20_BOARD_STRING	"Compulab Trimslice"
 
 /* Board-specific serial config */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_TEGRA20_ENABLE_UARTA
 #define CONFIG_TEGRA20_UARTA_GPU
 #define CONFIG_SYS_NS16550_COM1		NV_PA_APB_UARTA_BASE
diff --git a/include/configs/trizepsiv.h b/include/configs/trizepsiv.h
index 47c6a23..bc69c1e 100644
--- a/include/configs/trizepsiv.h
+++ b/include/configs/trizepsiv.h
@@ -64,7 +64,6 @@
  * select serial console configuration
  */
 #define CONFIG_PXA_SERIAL
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_FFUART	       1       /* we use FFUART on Conxs */
 #define CONFIG_BTUART	       1       /* we use BTUART on Conxs */
 #define CONFIG_STUART	       1       /* we use STUART on Conxs */
diff --git a/include/configs/ventana.h b/include/configs/ventana.h
index 25ec2eb..230531d 100644
--- a/include/configs/ventana.h
+++ b/include/configs/ventana.h
@@ -37,7 +37,6 @@
 #define CONFIG_TEGRA20_BOARD_STRING	"NVIDIA Ventana"
 
 /* Board-specific serial config */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_TEGRA20_ENABLE_UARTD
 #define CONFIG_SYS_NS16550_COM1		NV_PA_APB_UARTD_BASE
 
diff --git a/include/configs/whistler.h b/include/configs/whistler.h
index b747d0e..5a8a850 100644
--- a/include/configs/whistler.h
+++ b/include/configs/whistler.h
@@ -37,7 +37,6 @@
 #define CONFIG_TEGRA20_BOARD_STRING	"NVIDIA Whistler"
 
 /* Board-specific serial config */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_TEGRA20_ENABLE_UARTA
 #define CONFIG_TEGRA20_UARTA_UAA_UAB
 #define CONFIG_SYS_NS16550_COM1		NV_PA_APB_UARTA_BASE
diff --git a/include/configs/zeus.h b/include/configs/zeus.h
index 2556e3b..b0c3bd5 100644
--- a/include/configs/zeus.h
+++ b/include/configs/zeus.h
@@ -130,7 +130,6 @@
 #undef	CONFIG_SYS_EXT_SERIAL_CLOCK			/* external serial clock */
 #define CONFIG_SYS_BASE_BAUD	691200
 #define CONFIG_BAUDRATE		115200
-#define CONFIG_SERIAL_MULTI
 
 #define CONFIG_SYS_BAUDRATE_TABLE  \
     {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
-- 
1.7.10.4

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

* [U-Boot] [PATCH 68/71] serial: Remove CONFIG_SERIAL_MULTI from serial drivers
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (66 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 67/71] serial: Remove CONFIG_SERIAL_MULTI from config files Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 69/71] serial: Remove CONFIG_SERIAL_MULTI from remaining sources Marek Vasut
                   ` (4 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Remove the support for not-CONFIG_SERIAL_MULTI part from serial
port drivers and some board files. Since CONFIG_SERIAL_MULTI is
now enabled by default, that part is a dead code. Remove it.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/mips/cpu/mips32/au1x00/au1x00_serial.c |   32 ------
 arch/mips/cpu/mips32/incaip/asc_serial.c    |   32 ------
 arch/mips/cpu/xburst/jz_serial.c            |   32 ------
 arch/powerpc/cpu/mpc512x/serial.c           |   64 +-----------
 arch/powerpc/cpu/mpc5xx/serial.c            |   32 ------
 arch/powerpc/cpu/mpc5xxx/serial.c           |  149 +++++++--------------------
 arch/powerpc/cpu/mpc8220/uart.c             |   32 ------
 arch/powerpc/cpu/mpc8260/serial_scc.c       |   32 ------
 arch/powerpc/cpu/mpc8260/serial_smc.c       |   32 ------
 arch/powerpc/cpu/mpc85xx/serial_scc.c       |   32 ------
 arch/powerpc/cpu/ppc4xx/iop480_uart.c       |   35 -------
 arch/sparc/cpu/leon2/serial.c               |   32 ------
 arch/sparc/cpu/leon3/serial.c               |   32 ------
 board/Marvell/common/serial.c               |   32 ------
 board/amirix/ap1000/serial.c                |   31 ------
 board/bmw/serial.c                          |   32 ------
 board/cogent/serial.c                       |   32 ------
 board/esd/cpci750/serial.c                  |   31 ------
 board/evb64260/serial.c                     |   31 ------
 board/ml2/serial.c                          |   31 ------
 board/pcippc2/sconsole.c                    |   31 ------
 board/pdm360ng/pdm360ng.c                   |    6 --
 board/prodrive/p3mx/serial.c                |   32 ------
 board/trizepsiv/conxs.c                     |    2 -
 drivers/serial/altera_jtag_uart.c           |   32 ------
 drivers/serial/altera_uart.c                |   32 ------
 drivers/serial/atmel_usart.c                |   32 ------
 drivers/serial/lpc32xx_hsuart.c             |   32 ------
 drivers/serial/mcfuart.c                    |   32 ------
 drivers/serial/ns9750_serial.c              |   32 ------
 drivers/serial/opencores_yanu.c             |   32 ------
 drivers/serial/s3c4510b_uart.c              |   32 ------
 drivers/serial/s3c64xx.c                    |   32 ------
 drivers/serial/sandbox.c                    |   32 ------
 drivers/serial/serial.c                     |   95 -----------------
 drivers/serial/serial_clps7111.c            |   32 ------
 drivers/serial/serial_imx.c                 |   32 ------
 drivers/serial/serial_ixp.c                 |   32 ------
 drivers/serial/serial_ks8695.c              |   32 ------
 drivers/serial/serial_lh7a40x.c             |   32 ------
 drivers/serial/serial_lpc2292.c             |   32 ------
 drivers/serial/serial_max3100.c             |   32 ------
 drivers/serial/serial_mxc.c                 |   36 -------
 drivers/serial/serial_netarm.c              |   32 ------
 drivers/serial/serial_pl01x.c               |   32 ------
 drivers/serial/serial_pxa.c                 |   18 ----
 drivers/serial/serial_s3c24x0.c             |   53 ----------
 drivers/serial/serial_s3c44b0.c             |   32 ------
 drivers/serial/serial_sa1100.c              |   32 ------
 drivers/serial/serial_sh.c                  |   32 ------
 drivers/serial/serial_xuartlite.c           |   35 -------
 51 files changed, 39 insertions(+), 1761 deletions(-)

diff --git a/arch/mips/cpu/mips32/au1x00/au1x00_serial.c b/arch/mips/cpu/mips32/au1x00/au1x00_serial.c
index 9682775..0beac98 100644
--- a/arch/mips/cpu/mips32/au1x00/au1x00_serial.c
+++ b/arch/mips/cpu/mips32/au1x00/au1x00_serial.c
@@ -131,7 +131,6 @@ static int au1x00_serial_tstc(void)
 	return 0;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device au1x00_serial_drv = {
 	.name	= "au1x00_serial",
 	.start	= au1x00_serial_init,
@@ -152,34 +151,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &au1x00_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return au1x00_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	au1x00_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	au1x00_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	au1x00_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return au1x00_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return au1x00_serial_tstc();
-}
-#endif
diff --git a/arch/mips/cpu/mips32/incaip/asc_serial.c b/arch/mips/cpu/mips32/incaip/asc_serial.c
index b5f32e2..08949f4 100644
--- a/arch/mips/cpu/mips32/incaip/asc_serial.c
+++ b/arch/mips/cpu/mips32/incaip/asc_serial.c
@@ -286,7 +286,6 @@ static int asc_serial_tstc(void)
     return res;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device asc_serial_drv = {
 	.name	= "asc_serial",
 	.start	= asc_serial_init,
@@ -307,34 +306,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &asc_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return asc_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	asc_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	asc_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	asc_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return asc_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return asc_serial_tstc();
-}
-#endif
diff --git a/arch/mips/cpu/xburst/jz_serial.c b/arch/mips/cpu/xburst/jz_serial.c
index b1e1d27..3199007 100644
--- a/arch/mips/cpu/xburst/jz_serial.c
+++ b/arch/mips/cpu/xburst/jz_serial.c
@@ -115,7 +115,6 @@ static void jz_serial_puts(const char *s)
 		serial_putc(*s++);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device jz_serial_drv = {
 	.name	= "jz_serial",
 	.start	= jz_serial_init,
@@ -136,34 +135,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &jz_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return jz_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	jz_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	jz_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	jz_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return jz_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return jz_serial_tstc();
-}
-#endif
diff --git a/arch/powerpc/cpu/mpc512x/serial.c b/arch/powerpc/cpu/mpc512x/serial.c
index bc10c50..58587fd 100644
--- a/arch/powerpc/cpu/mpc512x/serial.c
+++ b/arch/powerpc/cpu/mpc512x/serial.c
@@ -37,7 +37,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if defined(CONFIG_PSC_CONSOLE) || defined(CONFIG_SERIAL_MULTI)
+#if defined(CONFIG_PSC_CONSOLE)
 
 static void fifo_init (volatile psc512x_t *psc)
 {
@@ -52,7 +52,6 @@ static void fifo_init (volatile psc512x_t *psc)
 	out_be32(&psc->rfintmask, 0);
 	out_be32(&psc->tfintmask, 0);
 
-#if defined(CONFIG_SERIAL_MULTI)
 	switch (((u32)psc & 0xf00) >> 8) {
 	case 0:
 		tfsize = FIFOC_PSC0_TX_SIZE | (FIFOC_PSC0_TX_ADDR << 16);
@@ -105,10 +104,7 @@ static void fifo_init (volatile psc512x_t *psc)
 	default:
 		return;
 	}
-#else
-	tfsize = CONSOLE_FIFO_TX_SIZE | (CONSOLE_FIFO_TX_ADDR << 16);
-	rfsize = CONSOLE_FIFO_RX_SIZE | (CONSOLE_FIFO_RX_ADDR << 16);
-#endif
+
 	out_be32(&psc->tfsize, tfsize);
 	out_be32(&psc->rfsize, rfsize);
 
@@ -155,12 +151,10 @@ int serial_init_dev(unsigned int idx)
 {
 	volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
 	volatile psc512x_t *psc = (psc512x_t *) &im->psc[idx];
-#if defined(CONFIG_SERIAL_MULTI)
 	u32 reg;
 
 	reg = in_be32(&im->clk.sccr[0]);
 	out_be32(&im->clk.sccr[0], reg | CLOCK_SCCR1_PSC_EN(idx));
-#endif
 
 	fifo_init (psc);
 
@@ -285,9 +279,7 @@ int serial_getcts_dev(unsigned int idx)
 
 	return (in_8(&psc->ip) & 0x1) ? 0 : 1;
 }
-#endif /* CONFIG_PSC_CONSOLE || CONFIG_SERIAL_MULTI */
-
-#if defined(CONFIG_SERIAL_MULTI)
+#endif /* CONFIG_PSC_CONSOLE */
 
 #define DECLARE_PSC_SERIAL_FUNCTIONS(port) \
 	int serial##port##_init(void) \
@@ -381,55 +373,6 @@ void mpc512x_serial_initialize(void)
 #endif
 }
 
-#else
-
-void serial_setbrg(void)
-{
-	serial_setbrg_dev(CONFIG_PSC_CONSOLE);
-}
-
-int serial_init(void)
-{
-	return serial_init_dev(CONFIG_PSC_CONSOLE);
-}
-
-void serial_putc(const char c)
-{
-	serial_putc_dev(CONFIG_PSC_CONSOLE, c);
-}
-
-void serial_putc_raw(const char c)
-{
-	serial_putc_raw_dev(CONFIG_PSC_CONSOLE, c);
-}
-
-void serial_puts(const char *s)
-{
-	serial_puts_dev(CONFIG_PSC_CONSOLE, s);
-}
-
-int serial_getc(void)
-{
-	return serial_getc_dev(CONFIG_PSC_CONSOLE);
-}
-
-int serial_tstc(void)
-{
-	return serial_tstc_dev(CONFIG_PSC_CONSOLE);
-}
-
-void serial_setrts(int s)
-{
-	return serial_setrts_dev(CONFIG_PSC_CONSOLE, s);
-}
-
-int serial_getcts(void)
-{
-	return serial_getcts_dev(CONFIG_PSC_CONSOLE);
-}
-#endif /* CONFIG_PSC_CONSOLE */
-
-#if defined(CONFIG_SERIAL_MULTI)
 #include <stdio_dev.h>
 /*
  * Routines for communication with serial devices over PSC
@@ -514,4 +457,3 @@ int read_port(struct stdio_dev *port, char *buf, int size)
 
 	return cnt;
 }
-#endif /* CONFIG_SERIAL_MULTI */
diff --git a/arch/powerpc/cpu/mpc5xx/serial.c b/arch/powerpc/cpu/mpc5xx/serial.c
index dbaacfc..af802f9 100644
--- a/arch/powerpc/cpu/mpc5xx/serial.c
+++ b/arch/powerpc/cpu/mpc5xx/serial.c
@@ -169,7 +169,6 @@ static void mpc5xx_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device mpc5xx_serial_drv = {
 	.name	= "mpc5xx_serial",
 	.start	= mpc5xx_serial_init,
@@ -190,34 +189,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &mpc5xx_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return mpc5xx_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	mpc5xx_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	mpc5xx_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	mpc5xx_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return mpc5xx_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return mpc5xx_serial_tstc();
-}
-#endif
diff --git a/arch/powerpc/cpu/mpc5xxx/serial.c b/arch/powerpc/cpu/mpc5xxx/serial.c
index 9bebff8..eb14161 100644
--- a/arch/powerpc/cpu/mpc5xxx/serial.c
+++ b/arch/powerpc/cpu/mpc5xxx/serial.c
@@ -25,7 +25,7 @@
  * Linux/PPC sources (m8260_tty.c had no copyright info in it).
  *
  * Martin Krause, 8 Jun 2006
- * Added CONFIG_SERIAL_MULTI support
+ * Added SERIAL_MULTI support
  */
 
 /*
@@ -36,10 +36,7 @@
 #include <common.h>
 #include <linux/compiler.h>
 #include <mpc5xxx.h>
-
-#if defined (CONFIG_SERIAL_MULTI)
 #include <serial.h>
-#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -61,11 +58,8 @@ DECLARE_GLOBAL_DATA_PTR;
 #error CONFIG_PSC_CONSOLE must be in 1 ... 6
 #endif
 
-#if defined(CONFIG_SERIAL_MULTI) && !defined(CONFIG_PSC_CONSOLE2)
-#error you must define CONFIG_PSC_CONSOLE2 if CONFIG_SERIAL_MULTI is set
-#endif
+#if defined(CONFIG_PSC_CONSOLE2)
 
-#if defined(CONFIG_SERIAL_MULTI)
 #if CONFIG_PSC_CONSOLE2 == 1
 #define PSC_BASE2 MPC5XXX_PSC1
 #elif CONFIG_PSC_CONSOLE2 == 2
@@ -81,19 +75,12 @@ DECLARE_GLOBAL_DATA_PTR;
 #else
 #error CONFIG_PSC_CONSOLE2 must be in 1 ... 6
 #endif
-#endif /* CONFIG_SERIAL_MULTI */
 
-#if defined(CONFIG_SERIAL_MULTI)
-int serial_init_dev (unsigned long dev_base)
-#else
-int serial_init (void)
 #endif
+
+int serial_init_dev (unsigned long dev_base)
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
-#else
-	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#endif
 	unsigned long baseclk;
 	int div;
 
@@ -127,24 +114,12 @@ int serial_init (void)
 	return (0);
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 void serial_putc_dev (unsigned long dev_base, const char c)
-#else
-void serial_putc(const char c)
-#endif
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
-#else
-	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#endif
 
 	if (c == '\n')
-#if defined(CONFIG_SERIAL_MULTI)
 		serial_putc_dev (dev_base, '\r');
-#else
-		serial_putc('\r');
-#endif
 
 	/* Wait for last character to go. */
 	while (!(psc->psc_status & PSC_SR_TXEMP))
@@ -153,17 +128,9 @@ void serial_putc(const char c)
 	psc->psc_buffer_8 = c;
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 void serial_putc_raw_dev(unsigned long dev_base, const char c)
-#else
-void serial_putc_raw(const char c)
-#endif
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
-#else
-	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#endif
 	/* Wait for last character to go. */
 	while (!(psc->psc_status & PSC_SR_TXEMP))
 		;
@@ -172,32 +139,16 @@ void serial_putc_raw(const char c)
 }
 
 
-#if defined(CONFIG_SERIAL_MULTI)
 void serial_puts_dev (unsigned long dev_base, const char *s)
-#else
-void serial_puts (const char *s)
-#endif
 {
 	while (*s) {
-#if defined(CONFIG_SERIAL_MULTI)
 		serial_putc_dev (dev_base, *s++);
-#else
-		serial_putc (*s++);
-#endif
 	}
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 int serial_getc_dev (unsigned long dev_base)
-#else
-int serial_getc(void)
-#endif
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
-#else
-	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#endif
 
 	/* Wait for a character to arrive. */
 	while (!(psc->psc_status & PSC_SR_RXRDY))
@@ -206,32 +157,16 @@ int serial_getc(void)
 	return psc->psc_buffer_8;
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 int serial_tstc_dev (unsigned long dev_base)
-#else
-int serial_tstc(void)
-#endif
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
-#else
-	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#endif
 
 	return (psc->psc_status & PSC_SR_RXRDY);
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 void serial_setbrg_dev (unsigned long dev_base)
-#else
-void serial_setbrg(void)
-#endif
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
-#else
-	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#endif
 	unsigned long baseclk, div;
 
 	baseclk = (gd->ipb_clk + 16) / 32;
@@ -242,17 +177,9 @@ void serial_setbrg(void)
 	psc->ctlr =  div & 0xff;
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 void serial_setrts_dev (unsigned long dev_base, int s)
-#else
-void serial_setrts(int s)
-#endif
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
-#else
-	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#endif
 
 	if (s) {
 		/* Assert RTS (become LOW) */
@@ -264,78 +191,43 @@ void serial_setrts(int s)
 	}
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 int serial_getcts_dev (unsigned long dev_base)
-#else
-int serial_getcts(void)
-#endif
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
-#else
-	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#endif
 
 	return (psc->ip & 0x1) ? 0 : 1;
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 int serial0_init(void)
 {
 	return (serial_init_dev(PSC_BASE));
 }
 
-int serial1_init(void)
-{
-	return (serial_init_dev(PSC_BASE2));
-}
 void serial0_setbrg (void)
 {
 	serial_setbrg_dev(PSC_BASE);
 }
-void serial1_setbrg (void)
-{
-	serial_setbrg_dev(PSC_BASE2);
-}
 
 void serial0_putc(const char c)
 {
 	serial_putc_dev(PSC_BASE,c);
 }
 
-void serial1_putc(const char c)
-{
-	serial_putc_dev(PSC_BASE2, c);
-}
 void serial0_puts(const char *s)
 {
 	serial_puts_dev(PSC_BASE, s);
 }
 
-void serial1_puts(const char *s)
-{
-	serial_puts_dev(PSC_BASE2, s);
-}
-
 int serial0_getc(void)
 {
 	return(serial_getc_dev(PSC_BASE));
 }
 
-int serial1_getc(void)
-{
-	return(serial_getc_dev(PSC_BASE2));
-}
 int serial0_tstc(void)
 {
 	return (serial_tstc_dev(PSC_BASE));
 }
 
-int serial1_tstc(void)
-{
-	return (serial_tstc_dev(PSC_BASE2));
-}
-
 struct serial_device serial0_device =
 {
 	.name	= "serial0",
@@ -353,6 +245,37 @@ __weak struct serial_device *default_serial_console(void)
 	return &serial0_device;
 }
 
+#ifdef CONFIG_PSC_CONSOLE2
+int serial1_init(void)
+{
+	return serial_init_dev(PSC_BASE2);
+}
+
+void serial1_setbrg(void)
+{
+	serial_setbrg_dev(PSC_BASE2);
+}
+
+void serial1_putc(const char c)
+{
+	serial_putc_dev(PSC_BASE2, c);
+}
+
+void serial1_puts(const char *s)
+{
+	serial_puts_dev(PSC_BASE2, s);
+}
+
+int serial1_getc(void)
+{
+	return serial_getc_dev(PSC_BASE2);
+}
+
+int serial1_tstc(void)
+{
+	return serial_tstc_dev(PSC_BASE2);
+}
+
 struct serial_device serial1_device =
 {
 	.name	= "serial1",
@@ -364,6 +287,6 @@ struct serial_device serial1_device =
 	.putc	= serial1_putc,
 	.puts	= serial1_puts,
 };
-#endif /* CONFIG_SERIAL_MULTI */
+#endif /* CONFIG_PSC_CONSOLE2 */
 
 #endif /* CONFIG_PSC_CONSOLE */
diff --git a/arch/powerpc/cpu/mpc8220/uart.c b/arch/powerpc/cpu/mpc8220/uart.c
index 545c81a..25d4472 100644
--- a/arch/powerpc/cpu/mpc8220/uart.c
+++ b/arch/powerpc/cpu/mpc8220/uart.c
@@ -126,7 +126,6 @@ static void mpc8220_serial_setbrg(void)
 	psc->cr = PSC_CR_RX_ENABLE | PSC_CR_TX_ENABLE;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device mpc8220_serial_drv = {
 	.name	= "mpc8220_serial",
 	.start	= mpc8220_serial_init,
@@ -147,35 +146,4 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &mpc8220_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return mpc8220_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	mpc8220_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	mpc8220_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	mpc8220_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return mpc8220_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return mpc8220_serial_tstc();
-}
-#endif
 #endif /* CONFIG_PSC_CONSOLE */
diff --git a/arch/powerpc/cpu/mpc8260/serial_scc.c b/arch/powerpc/cpu/mpc8260/serial_scc.c
index cfbcd79..954db14 100644
--- a/arch/powerpc/cpu/mpc8260/serial_scc.c
+++ b/arch/powerpc/cpu/mpc8260/serial_scc.c
@@ -261,7 +261,6 @@ static int mpc8260_scc_serial_tstc(void)
 	return ((rbdf->cbd_sc & BD_SC_EMPTY) == 0);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device mpc8260_scc_serial_drv = {
 	.name	= "mpc8260_scc_serial",
 	.start	= mpc8260_scc_serial_init,
@@ -282,37 +281,6 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &mpc8260_scc_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return mpc8260_scc_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	mpc8260_scc_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	mpc8260_scc_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	mpc8260_scc_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return mpc8260_scc_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return mpc8260_scc_serial_tstc();
-}
-#endif
 #endif	/* CONFIG_CONS_ON_SCC */
 
 #if defined(CONFIG_KGDB_ON_SCC)
diff --git a/arch/powerpc/cpu/mpc8260/serial_smc.c b/arch/powerpc/cpu/mpc8260/serial_smc.c
index 012fc98..48f5896 100644
--- a/arch/powerpc/cpu/mpc8260/serial_smc.c
+++ b/arch/powerpc/cpu/mpc8260/serial_smc.c
@@ -264,7 +264,6 @@ static int mpc8260_smc_serial_tstc(void)
 	return !(rtx->rxbd.cbd_sc & BD_SC_EMPTY);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device mpc8260_smc_serial_drv = {
 	.name	= "mpc8260_smc_serial",
 	.start	= mpc8260_smc_serial_init,
@@ -285,37 +284,6 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &mpc8260_smc_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return mpc8260_smc_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	mpc8260_smc_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	mpc8260_smc_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	mpc8260_smc_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return mpc8260_smc_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return mpc8260_smc_serial_tstc();
-}
-#endif
 #endif	/* CONFIG_CONS_ON_SMC */
 
 #if defined(CONFIG_KGDB_ON_SMC)
diff --git a/arch/powerpc/cpu/mpc85xx/serial_scc.c b/arch/powerpc/cpu/mpc85xx/serial_scc.c
index d192642..fe9af55 100644
--- a/arch/powerpc/cpu/mpc85xx/serial_scc.c
+++ b/arch/powerpc/cpu/mpc85xx/serial_scc.c
@@ -262,7 +262,6 @@ static int mpc85xx_serial_tstc(void)
 	return ((rbdf->cbd_sc & BD_SC_EMPTY) == 0);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device mpc85xx_serial_drv = {
 	.name	= "mpc85xx_serial",
 	.start	= mpc85xx_serial_init,
@@ -283,35 +282,4 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &mpc85xx_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return mpc85xx_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	mpc85xx_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	mpc85xx_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	mpc85xx_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return mpc85xx_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return mpc85xx_serial_tstc();
-}
-#endif
 #endif	/* CONFIG_CONS_ON_SCC */
diff --git a/arch/powerpc/cpu/ppc4xx/iop480_uart.c b/arch/powerpc/cpu/ppc4xx/iop480_uart.c
index fb25e15..9473984 100644
--- a/arch/powerpc/cpu/ppc4xx/iop480_uart.c
+++ b/arch/powerpc/cpu/ppc4xx/iop480_uart.c
@@ -26,11 +26,8 @@
 #include <asm/processor.h>
 #include <asm/io.h>
 #include <watchdog.h>
-
-#ifdef CONFIG_SERIAL_MULTI
 #include <serial.h>
 #include <linux/compiler.h>
-#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -234,7 +231,6 @@ static int iop480_serial_tstc(void)
 	return 0;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device iop480_serial_drv = {
 	.name	= "iop480_serial",
 	.start	= iop480_serial_init,
@@ -255,35 +251,4 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &iop480_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return iop480_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	iop480_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	iop480_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	iop480_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return iop480_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return iop480_serial_tstc();
-}
-#endif
 #endif	/* CONFIG_IOP480 */
diff --git a/arch/sparc/cpu/leon2/serial.c b/arch/sparc/cpu/leon2/serial.c
index 61d059b..16fffb6 100644
--- a/arch/sparc/cpu/leon2/serial.c
+++ b/arch/sparc/cpu/leon2/serial.c
@@ -166,7 +166,6 @@ static void leon2_serial_setbrg(void)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device leon2_serial_drv = {
 	.name	= "leon2_serial",
 	.start	= leon2_serial_init,
@@ -187,34 +186,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &leon2_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return leon2_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	leon2_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	leon2_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	leon2_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return leon2_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return leon2_serial_tstc();
-}
-#endif
diff --git a/arch/sparc/cpu/leon3/serial.c b/arch/sparc/cpu/leon3/serial.c
index a110244..c4f3ee8 100644
--- a/arch/sparc/cpu/leon3/serial.c
+++ b/arch/sparc/cpu/leon3/serial.c
@@ -140,7 +140,6 @@ static void leon3_serial_setbrg(void)
 	return;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device leon3_serial_drv = {
 	.name	= "leon3_serial",
 	.start	= leon3_serial_init,
@@ -161,34 +160,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &leon3_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return leon3_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	leon3_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	leon3_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	leon3_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return leon3_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return leon3_serial_tstc();
-}
-#endif
diff --git a/board/Marvell/common/serial.c b/board/Marvell/common/serial.c
index a5231eb..1327c62 100644
--- a/board/Marvell/common/serial.c
+++ b/board/Marvell/common/serial.c
@@ -146,7 +146,6 @@ static void marvell_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device marvell_serial_drv = {
 	.name	= "marvell_serial",
 	.start	= marvell_serial_init,
@@ -167,37 +166,6 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &marvell_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return marvell_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	marvell_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	marvell_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	marvell_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return marvell_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return marvell_serial_tstc();
-}
-#endif
 
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
diff --git a/board/amirix/ap1000/serial.c b/board/amirix/ap1000/serial.c
index 2c2e9f9..a77d332 100644
--- a/board/amirix/ap1000/serial.c
+++ b/board/amirix/ap1000/serial.c
@@ -86,7 +86,6 @@ static void amirix_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device amirix_serial_drv = {
 	.name	= "amirix_serial",
 	.start	= amirix_serial_init,
@@ -107,37 +106,7 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &amirix_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return amirix_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	amirix_serial_setbrg();
-}
 
-void serial_putc(const char c)
-{
-	amirix_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	amirix_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return amirix_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return amirix_serial_tstc();
-}
-#endif
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
 {
diff --git a/board/bmw/serial.c b/board/bmw/serial.c
index 569131f..08f449c 100644
--- a/board/bmw/serial.c
+++ b/board/bmw/serial.c
@@ -83,7 +83,6 @@ static void bmw_serial_setbrg(void)
 	NS16550_reinit (console, clock_divisor);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device bmw_serial_drv = {
 	.name	= "bmw_serial",
 	.start	= bmw_serial_init,
@@ -104,34 +103,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &bmw_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return bmw_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	bmw_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	bmw_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	bmw_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return bmw_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return bmw_serial_tstc();
-}
-#endif
diff --git a/board/cogent/serial.c b/board/cogent/serial.c
index 18a9dbf..cd4a976 100644
--- a/board/cogent/serial.c
+++ b/board/cogent/serial.c
@@ -90,7 +90,6 @@ static int cogent_serial_tstc(void)
 	return ((cma_mb_reg_read (&mbsp->ser_lsr) & LSR_DR) != 0);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device cogent_serial_drv = {
 	.name	= "cogent_serial",
 	.start	= cogent_serial_init,
@@ -111,37 +110,6 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &cogent_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return cogent_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	cogent_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	cogent_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	cogent_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return cogent_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return cogent_serial_tstc();
-}
-#endif
 #endif /* CONS_NONE */
 
 #if defined(CONFIG_CMD_KGDB) && \
diff --git a/board/esd/cpci750/serial.c b/board/esd/cpci750/serial.c
index 9ff7c27..25f8950 100644
--- a/board/esd/cpci750/serial.c
+++ b/board/esd/cpci750/serial.c
@@ -83,7 +83,6 @@ static void cpci750_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device cpci750_serial_drv = {
 	.name	= "cpci750_serial",
 	.start	= cpci750_serial_init,
@@ -104,37 +103,7 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &cpci750_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return cpci750_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	cpci750_serial_setbrg();
-}
 
-void serial_putc(const char c)
-{
-	cpci750_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	cpci750_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return cpci750_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return cpci750_serial_tstc();
-}
-#endif
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
 {
diff --git a/board/evb64260/serial.c b/board/evb64260/serial.c
index cf46a4d..9fd4298 100644
--- a/board/evb64260/serial.c
+++ b/board/evb64260/serial.c
@@ -146,7 +146,6 @@ static void evb64260_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device evb64260_serial_drv = {
 	.name	= "evb64260_serial",
 	.start	= evb64260_serial_init,
@@ -167,37 +166,7 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &evb64260_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return evb64260_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	evb64260_serial_setbrg();
-}
 
-void serial_putc(const char c)
-{
-	evb64260_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	evb64260_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return evb64260_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return evb64260_serial_tstc();
-}
-#endif
 #if defined(CONFIG_CMD_KGDB)
 void
 kgdb_serial_init(void)
diff --git a/board/ml2/serial.c b/board/ml2/serial.c
index 0ed1150..787ff46 100644
--- a/board/ml2/serial.c
+++ b/board/ml2/serial.c
@@ -90,7 +90,6 @@ static void ml2_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device ml2_serial_drv = {
 	.name	= "ml2_serial",
 	.start	= ml2_serial_init,
@@ -111,37 +110,7 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &ml2_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return ml2_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	ml2_serial_setbrg();
-}
 
-void serial_putc(const char c)
-{
-	ml2_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	ml2_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return ml2_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return ml2_serial_tstc();
-}
-#endif
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
 {
diff --git a/board/pcippc2/sconsole.c b/board/pcippc2/sconsole.c
index 0a31963..aa3c908 100644
--- a/board/pcippc2/sconsole.c
+++ b/board/pcippc2/sconsole.c
@@ -115,7 +115,6 @@ static void sconsole_serial_setbrg(void)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device sconsole_serial_drv = {
 	.name	= "sconsole_serial",
 	.start	= sconsole_serial_init,
@@ -136,37 +135,7 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &sconsole_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return sconsole_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	sconsole_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	sconsole_serial_putc(c);
-}
 
-void serial_puts(const char *s)
-{
-	sconsole_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return sconsole_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return sconsole_serial_tstc();
-}
-#endif
 int sconsole_get_baudrate (void)
 {
 	sconsole_buffer_t *sb = SCONSOLE_BUFFER;
diff --git a/board/pdm360ng/pdm360ng.c b/board/pdm360ng/pdm360ng.c
index 2082ad4..a2a1323 100644
--- a/board/pdm360ng/pdm360ng.c
+++ b/board/pdm360ng/pdm360ng.c
@@ -172,9 +172,7 @@ phys_size_t initdram (int board_type)
 	return msize;
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 static int set_lcd_brightness(char *);
-#endif
 
 int misc_init_r(void)
 {
@@ -237,9 +235,7 @@ int misc_init_r(void)
 #endif
 
 #ifdef CONFIG_FSL_DIU_FB
-#if defined(CONFIG_SERIAL_MULTI)
 	set_lcd_brightness(0);
-#endif
 	/* Switch LCD-Backlight and LVDS-Interface on */
 	setbits_be32(&im->gpio.gpdir, 0x01040000);
 	clrsetbits_be32(&im->gpio.gpdat, 0x01000000, 0x00040000);
@@ -608,7 +604,6 @@ void ft_board_setup(void *blob, bd_t *bd)
 }
 #endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
 
-#if defined(CONFIG_SERIAL_MULTI)
 /*
  * If argument is NULL, set the LCD brightness to the
  * value from "brightness" environment variable. Set
@@ -685,4 +680,3 @@ U_BOOT_CMD(lcdbr, 2, 1, cmd_lcd_brightness,
 	"set LCD brightness",
 	"<brightness> - set LCD backlight level to <brightness>.\n"
 );
-#endif /* CONFIG_SERIAL_MULTI */
diff --git a/board/prodrive/p3mx/serial.c b/board/prodrive/p3mx/serial.c
index d3591b4..2f4d294 100644
--- a/board/prodrive/p3mx/serial.c
+++ b/board/prodrive/p3mx/serial.c
@@ -83,7 +83,6 @@ static void p3mx_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device p3mx_serial_drv = {
 	.name	= "p3mx_serial",
 	.start	= p3mx_serial_init,
@@ -104,37 +103,6 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &p3mx_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return p3mx_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	p3mx_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	p3mx_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	p3mx_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return p3mx_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return p3mx_serial_tstc();
-}
-#endif
 
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
diff --git a/board/trizepsiv/conxs.c b/board/trizepsiv/conxs.c
index 8fc3c40..871e052 100644
--- a/board/trizepsiv/conxs.c
+++ b/board/trizepsiv/conxs.c
@@ -120,7 +120,6 @@ int board_init (void)
 
 int board_late_init(void)
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	char *console=getenv("boot_console");
 
 	if ((console == NULL) || (strcmp(console,"serial_btuart") &&
@@ -131,7 +130,6 @@ int board_late_init(void)
 	setenv("stdout",console);
 	setenv("stdin", console);
 	setenv("stderr",console);
-#endif
 	return 0;
 }
 
diff --git a/drivers/serial/altera_jtag_uart.c b/drivers/serial/altera_jtag_uart.c
index d3b6c1c..ec8ca29 100644
--- a/drivers/serial/altera_jtag_uart.c
+++ b/drivers/serial/altera_jtag_uart.c
@@ -83,7 +83,6 @@ static int altera_jtag_serial_getc(void)
 	return (c);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device altera_jtag_serial_drv = {
 	.name	= "altera_jtag_serial",
 	.start	= altera_jtag_serial_init,
@@ -104,34 +103,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &altera_jtag_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return altera_jtag_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	altera_jtag_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	altera_jtag_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	altera_jtag_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return altera_jtag_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return altera_jtag_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c
index 18b820b..700abd6 100644
--- a/drivers/serial/altera_uart.c
+++ b/drivers/serial/altera_uart.c
@@ -99,7 +99,6 @@ static int altera_serial_getc(void)
 	return (readl (&uart->rxdata) & 0x00ff );
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device altera_serial_drv = {
 	.name	= "altera_serial",
 	.start	= altera_serial_init,
@@ -120,34 +119,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &altera_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return altera_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	altera_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	altera_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	altera_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return altera_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return altera_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c
index d49d5d4..1303031 100644
--- a/drivers/serial/atmel_usart.c
+++ b/drivers/serial/atmel_usart.c
@@ -107,7 +107,6 @@ static int atmel_serial_tstc(void)
 	return (readl(&usart->csr) & USART3_BIT(RXRDY)) != 0;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device atmel_serial_drv = {
 	.name	= "atmel_serial",
 	.start	= atmel_serial_init,
@@ -128,34 +127,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &atmel_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return atmel_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	atmel_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	atmel_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	atmel_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return atmel_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return atmel_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/lpc32xx_hsuart.c b/drivers/serial/lpc32xx_hsuart.c
index 536fd46..02429b5 100644
--- a/drivers/serial/lpc32xx_hsuart.c
+++ b/drivers/serial/lpc32xx_hsuart.c
@@ -83,7 +83,6 @@ static void lpc32xx_serial_puts(const char *s)
 		serial_putc(*s++);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device lpc32xx_serial_drv = {
 	.name	= "lpc32xx_serial",
 	.start	= lpc32xx_serial_init,
@@ -104,34 +103,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &lpc32xx_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return lpc32xx_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	lpc32xx_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	lpc32xx_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	lpc32xx_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return lpc32xx_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return lpc32xx_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/mcfuart.c b/drivers/serial/mcfuart.c
index 7e0b765..00a7114 100644
--- a/drivers/serial/mcfuart.c
+++ b/drivers/serial/mcfuart.c
@@ -130,7 +130,6 @@ static void mcf_serial_setbrg(void)
 	uart->ucr = UART_UCR_RX_ENABLED | UART_UCR_TX_ENABLED;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device mcf_serial_drv = {
 	.name	= "mcf_serial",
 	.start	= mcf_serial_init,
@@ -151,34 +150,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &mcf_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return mcf_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	mcf_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	mcf_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	mcf_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return mcf_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return mcf_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/ns9750_serial.c b/drivers/serial/ns9750_serial.c
index 829f6d5..cb545c4 100644
--- a/drivers/serial/ns9750_serial.c
+++ b/drivers/serial/ns9750_serial.c
@@ -209,7 +209,6 @@ static unsigned int calcRxCharGapRegister( void )
 	return NS9750_SER_RX_CHAR_TIMER_TRUN;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device ns9750_serial_drv = {
 	.name	= "ns9750_serial",
 	.start	= ns9750_serial_init,
@@ -230,34 +229,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &ns9750_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return ns9750_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	ns9750_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	ns9750_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	ns9750_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return ns9750_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return ns9750_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/opencores_yanu.c b/drivers/serial/opencores_yanu.c
index a0dd301..49bccf3 100644
--- a/drivers/serial/opencores_yanu.c
+++ b/drivers/serial/opencores_yanu.c
@@ -189,7 +189,6 @@ statoc int oc_serial_getc(void)
 	return(readl(&uart->data) & YANU_DATA_CHAR_MASK);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device oc_serial_drv = {
 	.name	= "oc_serial",
 	.start	= oc_serial_init,
@@ -210,34 +209,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &oc_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return oc_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	oc_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	oc_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	oc_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return oc_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return oc_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/s3c4510b_uart.c b/drivers/serial/s3c4510b_uart.c
index 4f7f98e..423d26e 100644
--- a/drivers/serial/s3c4510b_uart.c
+++ b/drivers/serial/s3c4510b_uart.c
@@ -211,7 +211,6 @@ static void s3c4510b_serial_puts(const char *s)
 
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device s3c4510b_serial_drv = {
 	.name	= "s3c4510b_serial",
 	.start	= s3c4510b_serial_init,
@@ -232,34 +231,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &s3c4510b_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return s3c4510b_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	s3c4510b_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	s3c4510b_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	s3c4510b_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return s3c4510b_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return s3c4510b_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/s3c64xx.c b/drivers/serial/s3c64xx.c
index 823425b..9ab8a28 100644
--- a/drivers/serial/s3c64xx.c
+++ b/drivers/serial/s3c64xx.c
@@ -172,7 +172,6 @@ static void s3c64xx_serial_puts(const char *s)
 		serial_putc(*s++);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device s3c64xx_serial_drv = {
 	.name	= "s3c64xx_serial",
 	.start	= s3c64xx_serial_init,
@@ -193,34 +192,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &s3c64xx_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return s3c64xx_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	s3c64xx_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	s3c64xx_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	s3c64xx_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return s3c64xx_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return s3c64xx_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/sandbox.c b/drivers/serial/sandbox.c
index d60fbba..cb19401 100644
--- a/drivers/serial/sandbox.c
+++ b/drivers/serial/sandbox.c
@@ -64,7 +64,6 @@ static int sandbox_serial_tstc(void)
 	return 0;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device sandbox_serial_drv = {
 	.name	= "sandbox_serial",
 	.start	= sandbox_serial_init,
@@ -85,34 +84,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &sandbox_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return sandbox_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	sandbox_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	sandbox_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	sandbox_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return sandbox_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return sandbox_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index 00ad97c..b5d1248 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -29,20 +29,11 @@
 #include <ns87308.h>
 #endif
 
-#if defined (CONFIG_SERIAL_MULTI)
 #include <serial.h>
-#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
 #if !defined(CONFIG_CONS_INDEX)
-#if defined (CONFIG_SERIAL_MULTI)
-/*   with CONFIG_SERIAL_MULTI we might have no console
- *  on these devices
- */
-#else
-#error	"No console index specified."
-#endif /* CONFIG_SERIAL_MULTI */
 #elif (CONFIG_CONS_INDEX < 1) || (CONFIG_CONS_INDEX > 4)
 #error	"Invalid console index value."
 #endif
@@ -85,8 +76,6 @@ static NS16550_t serial_ports[4] = {
 
 #define PORT	serial_ports[port-1]
 
-#if defined(CONFIG_SERIAL_MULTI)
-
 /* Multi serial device functions */
 #define DECLARE_ESERIAL_FUNCTIONS(port) \
     int  eserial##port##_init (void) {\
@@ -117,8 +106,6 @@ static NS16550_t serial_ports[4] = {
 	.puts	= eserial##port##_puts,		\
 }
 
-#endif /* CONFIG_SERIAL_MULTI */
-
 static int calc_divisor (NS16550_t port)
 {
 #ifdef CONFIG_OMAP1510
@@ -151,36 +138,6 @@ static int calc_divisor (NS16550_t port)
 		(MODE_X_DIV * gd->baudrate);
 }
 
-#if !defined(CONFIG_SERIAL_MULTI)
-int serial_init (void)
-{
-	int clock_divisor;
-
-#ifdef CONFIG_NS87308
-	initialise_ns87308();
-#endif
-
-#ifdef CONFIG_SYS_NS16550_COM1
-	clock_divisor = calc_divisor(serial_ports[0]);
-	NS16550_init(serial_ports[0], clock_divisor);
-#endif
-#ifdef CONFIG_SYS_NS16550_COM2
-	clock_divisor = calc_divisor(serial_ports[1]);
-	NS16550_init(serial_ports[1], clock_divisor);
-#endif
-#ifdef CONFIG_SYS_NS16550_COM3
-	clock_divisor = calc_divisor(serial_ports[2]);
-	NS16550_init(serial_ports[2], clock_divisor);
-#endif
-#ifdef CONFIG_SYS_NS16550_COM4
-	clock_divisor = calc_divisor(serial_ports[3]);
-	NS16550_init(serial_ports[3], clock_divisor);
-#endif
-
-	return (0);
-}
-#endif
-
 void
 _serial_putc(const char c,const int port)
 {
@@ -226,91 +183,41 @@ _serial_setbrg (const int port)
 	NS16550_reinit(PORT, clock_divisor);
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline void
 serial_putc_dev(unsigned int dev_index,const char c)
 {
 	_serial_putc(c,dev_index);
 }
-#else
-void
-serial_putc(const char c)
-{
-	_serial_putc(c,CONFIG_CONS_INDEX);
-}
-#endif
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline void
 serial_putc_raw_dev(unsigned int dev_index,const char c)
 {
 	_serial_putc_raw(c,dev_index);
 }
-#else
-void
-serial_putc_raw(const char c)
-{
-	_serial_putc_raw(c,CONFIG_CONS_INDEX);
-}
-#endif
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline void
 serial_puts_dev(unsigned int dev_index,const char *s)
 {
 	_serial_puts(s,dev_index);
 }
-#else
-void
-serial_puts(const char *s)
-{
-	_serial_puts(s,CONFIG_CONS_INDEX);
-}
-#endif
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline int
 serial_getc_dev(unsigned int dev_index)
 {
 	return _serial_getc(dev_index);
 }
-#else
-int
-serial_getc(void)
-{
-	return _serial_getc(CONFIG_CONS_INDEX);
-}
-#endif
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline int
 serial_tstc_dev(unsigned int dev_index)
 {
 	return _serial_tstc(dev_index);
 }
-#else
-int
-serial_tstc(void)
-{
-	return _serial_tstc(CONFIG_CONS_INDEX);
-}
-#endif
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline void
 serial_setbrg_dev(unsigned int dev_index)
 {
 	_serial_setbrg(dev_index);
 }
-#else
-void
-serial_setbrg(void)
-{
-	_serial_setbrg(CONFIG_CONS_INDEX);
-}
-#endif
-
-#if defined(CONFIG_SERIAL_MULTI)
 
 DECLARE_ESERIAL_FUNCTIONS(1);
 struct serial_device eserial1_device =
@@ -355,5 +262,3 @@ void ns16550_serial_initialize(void)
 	serial_register(&eserial4_device);
 #endif
 }
-
-#endif /* CONFIG_SERIAL_MULTI */
diff --git a/drivers/serial/serial_clps7111.c b/drivers/serial/serial_clps7111.c
index e1bed90..65473e8 100644
--- a/drivers/serial/serial_clps7111.c
+++ b/drivers/serial/serial_clps7111.c
@@ -119,7 +119,6 @@ static void clps7111_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device clps7111_serial_drv = {
 	.name	= "clps7111_serial",
 	.start	= clps7111_serial_init,
@@ -140,34 +139,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &clps7111_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return clps7111_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	clps7111_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	clps7111_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	clps7111_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return clps7111_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return clps7111_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_imx.c b/drivers/serial/serial_imx.c
index d37ec29..6c075b5 100644
--- a/drivers/serial/serial_imx.c
+++ b/drivers/serial/serial_imx.c
@@ -221,7 +221,6 @@ static void imx_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device imx_serial_drv = {
 	.name	= "imx_serial",
 	.start	= imx_serial_init,
@@ -242,34 +241,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &imx_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return imx_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	imx_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	imx_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	imx_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return imx_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return imx_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_ixp.c b/drivers/serial/serial_ixp.c
index 6e3f7f0..c8b3658 100644
--- a/drivers/serial/serial_ixp.c
+++ b/drivers/serial/serial_ixp.c
@@ -128,7 +128,6 @@ static void ixp_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device ixp_serial_drv = {
 	.name	= "ixp_serial",
 	.start	= ixp_serial_init,
@@ -149,34 +148,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &ixp_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return ixp_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	ixp_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	ixp_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	ixp_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return ixp_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return ixp_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_ks8695.c b/drivers/serial/serial_ks8695.c
index b3af388..60e8007 100644
--- a/drivers/serial/serial_ks8695.c
+++ b/drivers/serial/serial_ks8695.c
@@ -118,7 +118,6 @@ static int ks8695_serial_getc(void)
 	return (uartp->RX);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device ks8695_serial_drv = {
 	.name	= "ks8695_serial",
 	.start	= ks8695_serial_init,
@@ -139,34 +138,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &ks8695_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return ks8695_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	ks8695_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	ks8695_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	ks8695_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return ks8695_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return ks8695_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_lh7a40x.c b/drivers/serial/serial_lh7a40x.c
index 6b73606..6c96285 100644
--- a/drivers/serial/serial_lh7a40x.c
+++ b/drivers/serial/serial_lh7a40x.c
@@ -182,7 +182,6 @@ static void lh7a40x_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device lh7a40x_serial_drv = {
 	.name	= "lh7a40x_serial",
 	.start	= lh7a40x_serial_init,
@@ -203,34 +202,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &lh7a40x_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return lh7a40x_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	lh7a40x_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	lh7a40x_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	lh7a40x_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return lh7a40x_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return lh7a40x_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_lpc2292.c b/drivers/serial/serial_lpc2292.c
index 2601ee7..fcab202 100644
--- a/drivers/serial/serial_lpc2292.c
+++ b/drivers/serial/serial_lpc2292.c
@@ -102,7 +102,6 @@ static int lpc2292_serial_tstc(void)
 	return (GET8(U0LSR) & 1);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device lpc2292_serial_drv = {
 	.name	= "lpc2292_serial",
 	.start	= lpc2292_serial_init,
@@ -123,34 +122,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &lpc2292_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return lpc2292_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	lpc2292_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	lpc2292_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	lpc2292_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return lpc2292_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return lpc2292_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_max3100.c b/drivers/serial/serial_max3100.c
index b21fba0..3533cfc 100644
--- a/drivers/serial/serial_max3100.c
+++ b/drivers/serial/serial_max3100.c
@@ -288,7 +288,6 @@ static void max3100_serial_setbrg(void)
 {
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device max3100_serial_drv = {
 	.name	= "max3100_serial",
 	.start	= max3100_serial_init,
@@ -309,34 +308,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &max3100_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return max3100_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	max3100_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	max3100_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	max3100_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return max3100_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return max3100_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
index 0899e9b..b0612f5 100644
--- a/drivers/serial/serial_mxc.c
+++ b/drivers/serial/serial_mxc.c
@@ -32,10 +32,6 @@
 
 #define UART_PHYS	CONFIG_MXC_UART_BASE
 
-#ifdef CONFIG_SERIAL_MULTI
-#warning "MXC driver does not support MULTI serials."
-#endif
-
 /* Register definitions */
 #define URXD  0x0  /* Receiver Register */
 #define UTXD  0x40 /* Transmitter Register */
@@ -226,7 +222,6 @@ static int mxc_serial_init(void)
 	return 0;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device mxc_serial_drv = {
 	.name	= "mxc_serial",
 	.start	= mxc_serial_init,
@@ -247,34 +242,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &mxc_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return mxc_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	mxc_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	mxc_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	mxc_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return mxc_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return mxc_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_netarm.c b/drivers/serial/serial_netarm.c
index ff6612d..d30adc3 100644
--- a/drivers/serial/serial_netarm.c
+++ b/drivers/serial/serial_netarm.c
@@ -189,7 +189,6 @@ static void netarm_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device netarm_serial_drv = {
 	.name	= "netarm_serial",
 	.start	= netarm_serial_init,
@@ -210,34 +209,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &netarm_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return netarm_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	netarm_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	netarm_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	netarm_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return netarm_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return netarm_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c
index beb0c98..7db7b65 100644
--- a/drivers/serial/serial_pl01x.c
+++ b/drivers/serial/serial_pl01x.c
@@ -253,7 +253,6 @@ static int pl01x_tstc (int portnum)
 	return !(readl(&regs->fr) & UART_PL01x_FR_RXFE);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device pl01x_serial_drv = {
 	.name	= "pl01x_serial",
 	.start	= pl01x_serial_init,
@@ -274,34 +273,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &pl01x_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return pl01x_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	pl01x_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	pl01x_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	pl01x_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return pl01x_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return pl01x_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_pxa.c b/drivers/serial/serial_pxa.c
index 46d7689..ad39100 100644
--- a/drivers/serial/serial_pxa.c
+++ b/drivers/serial/serial_pxa.c
@@ -73,20 +73,6 @@ DECLARE_GLOBAL_DATA_PTR;
 #define	HWUART_INDEX	0xff
 #endif
 
-#ifndef CONFIG_SERIAL_MULTI
-#if defined(CONFIG_FFUART)
-#define UART_INDEX	FFUART_INDEX
-#elif defined(CONFIG_BTUART)
-#define UART_INDEX	BTUART_INDEX
-#elif defined(CONFIG_STUART)
-#define UART_INDEX	STUART_INDEX
-#elif defined(CONFIG_HWUART)
-#define UART_INDEX	HWUART_INDEX
-#else
-#error "Please select CONFIG_(FF|BT|ST|HW)UART in board config file."
-#endif
-#endif
-
 static uint32_t pxa_uart_get_baud_divider(void)
 {
 	if (gd->baudrate == 1200)
@@ -297,9 +283,6 @@ void pxa_puts_dev(unsigned int uart_index, const char *s)
 	pxa_uart_multi(btuart, BTUART)
 #endif
 
-#ifndef	CONFIG_SERIAL_MULTI
-	pxa_uart(serial, UART)
-#else
 __weak struct serial_device *default_serial_console(void)
 {
 #if CONFIG_CONS_INDEX == 1
@@ -327,4 +310,3 @@ void pxa_serial_initialize(void)
 	serial_register(&serial_stuart_device);
 #endif
 }
-#endif
diff --git a/drivers/serial/serial_s3c24x0.c b/drivers/serial/serial_s3c24x0.c
index 625c6b7..4d214c3 100644
--- a/drivers/serial/serial_s3c24x0.c
+++ b/drivers/serial/serial_s3c24x0.c
@@ -38,8 +38,6 @@ DECLARE_GLOBAL_DATA_PTR;
 #endif
 
 #include <asm/io.h>
-
-#if defined(CONFIG_SERIAL_MULTI)
 #include <serial.h>
 
 /* Multi serial device functions */
@@ -80,8 +78,6 @@ DECLARE_GLOBAL_DATA_PTR;
 	.puts	= s3serial##port##_puts,		\
 }
 
-#endif /* CONFIG_SERIAL_MULTI */
-
 #ifdef CONFIG_HWFLOW
 static int hwflow;
 #endif
@@ -100,18 +96,10 @@ void _serial_setbrg(const int dev_index)
 		/* Delay */ ;
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline void serial_setbrg_dev(unsigned int dev_index)
 {
 	_serial_setbrg(dev_index);
 }
-#else
-void serial_setbrg(void)
-{
-	_serial_setbrg(UART_NR);
-}
-#endif
-
 
 /* Initialise the serial port. The settings are always 8 data bits, no parity,
  * 1 stop bit, no start bits.
@@ -151,16 +139,6 @@ static int serial_init_dev(const int dev_index)
 	return (0);
 }
 
-#if !defined(CONFIG_SERIAL_MULTI)
-/* Initialise the serial port. The settings are always 8 data bits, no parity,
- * 1 stop bit, no start bits.
- */
-int serial_init(void)
-{
-	return serial_init_dev(UART_NR);
-}
-#endif
-
 /*
  * Read a single byte from the serial port. Returns 1 on success, 0
  * otherwise. When the function is succesfull, the character read is
@@ -176,17 +154,10 @@ int _serial_getc(const int dev_index)
 	return readb(&uart->urxh) & 0xff;
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline int serial_getc_dev(unsigned int dev_index)
 {
 	return _serial_getc(dev_index);
 }
-#else
-int serial_getc(void)
-{
-	return _serial_getc(UART_NR);
-}
-#endif
 
 #ifdef CONFIG_HWFLOW
 int hwflow_onoff(int on)
@@ -246,18 +217,10 @@ void _serial_putc(const char c, const int dev_index)
 		serial_putc('\r');
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline void serial_putc_dev(unsigned int dev_index, const char c)
 {
 	_serial_putc(c, dev_index);
 }
-#else
-void serial_putc(const char c)
-{
-	_serial_putc(c, UART_NR);
-}
-#endif
-
 
 /*
  * Test whether a character is in the RX buffer
@@ -269,17 +232,10 @@ int _serial_tstc(const int dev_index)
 	return readl(&uart->utrstat) & 0x1;
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline int serial_tstc_dev(unsigned int dev_index)
 {
 	return _serial_tstc(dev_index);
 }
-#else
-int serial_tstc(void)
-{
-	return _serial_tstc(UART_NR);
-}
-#endif
 
 void _serial_puts(const char *s, const int dev_index)
 {
@@ -288,19 +244,11 @@ void _serial_puts(const char *s, const int dev_index)
 	}
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline void serial_puts_dev(int dev_index, const char *s)
 {
 	_serial_puts(s, dev_index);
 }
-#else
-void serial_puts(const char *s)
-{
-	_serial_puts(s, UART_NR);
-}
-#endif
 
-#if defined(CONFIG_SERIAL_MULTI)
 DECLARE_S3C_SERIAL_FUNCTIONS(0);
 struct serial_device s3c24xx_serial0_device =
 INIT_S3C_SERIAL_STRUCTURE(0, "s3ser0");
@@ -330,4 +278,3 @@ void s3c24xx_serial_initialize(void)
 	serial_register(&s3c24xx_serial1_device);
 	serial_register(&s3c24xx_serial2_device);
 }
-#endif /* CONFIG_SERIAL_MULTI */
diff --git a/drivers/serial/serial_s3c44b0.c b/drivers/serial/serial_s3c44b0.c
index 8beba1a..a4428e0 100644
--- a/drivers/serial/serial_s3c44b0.c
+++ b/drivers/serial/serial_s3c44b0.c
@@ -216,7 +216,6 @@ static void s3c44b0_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device s3c44b0_serial_drv = {
 	.name	= "s3c44b0_serial",
 	.start	= s3c44b0_serial_init,
@@ -237,34 +236,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &s3c44b0_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return s3c44b0_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	s3c44b0_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	s3c44b0_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	s3c44b0_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return s3c44b0_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return s3c44b0_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_sa1100.c b/drivers/serial/serial_sa1100.c
index 86e682d..c6b34db 100644
--- a/drivers/serial/serial_sa1100.c
+++ b/drivers/serial/serial_sa1100.c
@@ -160,7 +160,6 @@ static void sa1100_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device sa1100_serial_drv = {
 	.name	= "sa1100_serial",
 	.start	= sa1100_serial_init,
@@ -181,34 +180,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &sa1100_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return sa1100_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	sa1100_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	sa1100_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	sa1100_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return sa1100_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return sa1100_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_sh.c b/drivers/serial/serial_sh.c
index 8c30397..640861a 100644
--- a/drivers/serial/serial_sh.c
+++ b/drivers/serial/serial_sh.c
@@ -188,7 +188,6 @@ static int sh_serial_getc(void)
 	return ch;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device sh_serial_drv = {
 	.name	= "sh_serial",
 	.start	= sh_serial_init,
@@ -209,34 +208,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &sh_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return sh_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	sh_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	sh_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	sh_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return sh_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return sh_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_xuartlite.c b/drivers/serial/serial_xuartlite.c
index d90c42d..4a407c2 100644
--- a/drivers/serial/serial_xuartlite.c
+++ b/drivers/serial/serial_xuartlite.c
@@ -89,40 +89,6 @@ int uartlite_serial_tstc(const int port)
 	return in_be32(&regs->status) & SR_RX_FIFO_VALID_DATA;
 }
 
-#if !defined(CONFIG_SERIAL_MULTI)
-int serial_init(void)
-{
-	/* FIXME: Nothing for now. We should initialize fifo, etc */
-	return 0;
-}
-
-void serial_setbrg(void)
-{
-	/* FIXME: what's this for? */
-}
-
-void serial_putc(const char c)
-{
-	uartlite_serial_putc(c, 0);
-}
-
-void serial_puts(const char *s)
-{
-	uartlite_serial_puts(s, 0);
-}
-
-int serial_getc(void)
-{
-	return uartlite_serial_getc(0);
-}
-
-int serial_tstc(void)
-{
-	return uartlite_serial_tstc(0);
-}
-#endif
-
-#if defined(CONFIG_SERIAL_MULTI)
 /* Multi serial device functions */
 #define DECLARE_ESERIAL_FUNCTIONS(port) \
 	int userial##port##_init(void) \
@@ -193,4 +159,3 @@ void uartlite_serial_initialize(void)
 	serial_register(&uartlite_serial3_device);
 #endif /* XILINX_UARTLITE_BASEADDR3 */
 }
-#endif /* CONFIG_SERIAL_MULTI */
-- 
1.7.10.4

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

* [U-Boot] [PATCH 69/71] serial: Remove CONFIG_SERIAL_MULTI from remaining sources
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (67 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 68/71] serial: Remove CONFIG_SERIAL_MULTI from serial drivers Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 70/71] serial: Compile common/serial.c by default Marek Vasut
                   ` (3 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Remove the parts depending either on disabled CONFIG_SERIAL_MULTI
or ifdefs around CONFIG_SERIAL_MULTI parts since CONFIG_SERIAL_MULTI
is now enabled by default.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/arm/lib/board.c             |    2 --
 arch/blackfin/lib/board.c        |    2 --
 arch/m68k/lib/board.c            |    2 --
 arch/microblaze/lib/board.c      |    2 --
 arch/nds32/lib/board.c           |    2 --
 arch/powerpc/lib/board.c         |    2 --
 arch/sandbox/lib/board.c         |    2 --
 arch/x86/lib/board.c             |    2 --
 common/cmd_nvedit.c              |    2 --
 common/fdt_support.c             |    4 ----
 common/iomux.c                   |    2 --
 common/stdio.c                   |    2 --
 include/common.h                 |   12 ------------
 include/serial.h                 |    2 +-
 post/board/pdm360ng/coproc_com.c |    3 ---
 15 files changed, 1 insertion(+), 42 deletions(-)

diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index f1951e8..ee8676c 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -489,9 +489,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 #ifdef CONFIG_CLOCKS
 	set_cpu_clk_info(); /* Setup clock information */
 #endif
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 
 	debug("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
 
diff --git a/arch/blackfin/lib/board.c b/arch/blackfin/lib/board.c
index c380d27..0b31f37 100644
--- a/arch/blackfin/lib/board.c
+++ b/arch/blackfin/lib/board.c
@@ -284,9 +284,7 @@ void board_init_f(ulong bootflag)
 	init_baudrate();
 	serial_early_puts("Serial init\n");
 	serial_init();
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 	serial_early_puts("Console init flash\n");
 	console_init_f();
 	serial_early_puts("End of early debugging\n");
diff --git a/arch/m68k/lib/board.c b/arch/m68k/lib/board.c
index 65a8595..9aefb6d 100644
--- a/arch/m68k/lib/board.c
+++ b/arch/m68k/lib/board.c
@@ -402,9 +402,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
 	gd->flags |= GD_FLG_RELOC;	/* tell others: relocation done */
 
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 
 	debug ("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
 
diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c
index b80250a..6a4e13e 100644
--- a/arch/microblaze/lib/board.c
+++ b/arch/microblaze/lib/board.c
@@ -110,9 +110,7 @@ void board_init (void)
 	 */
 	mem_malloc_init (CONFIG_SYS_MALLOC_BASE, CONFIG_SYS_MALLOC_LEN);
 
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 
 	for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
 		WATCHDOG_RESET ();
diff --git a/arch/nds32/lib/board.c b/arch/nds32/lib/board.c
index 2164a50..ca429c1 100644
--- a/arch/nds32/lib/board.c
+++ b/arch/nds32/lib/board.c
@@ -326,9 +326,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 		(ulong)(&__u_boot_cmd_end - &__u_boot_cmd_start));
 #endif /* defined(CONFIG_NEEDS_MANUAL_RELOC) */
 
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 
 	debug("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
 
diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
index fea310e..67dbae4 100644
--- a/arch/powerpc/lib/board.c
+++ b/arch/powerpc/lib/board.c
@@ -660,9 +660,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 	gd->env_addr += dest_addr - CONFIG_SYS_MONITOR_BASE;
 #endif
 
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 
 	debug("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
 
diff --git a/arch/sandbox/lib/board.c b/arch/sandbox/lib/board.c
index c173bf9..83858c1 100644
--- a/arch/sandbox/lib/board.c
+++ b/arch/sandbox/lib/board.c
@@ -220,9 +220,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 
 	gd->flags |= GD_FLG_RELOC;	/* tell others: relocation done */
 
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 
 #ifdef CONFIG_POST
 	post_output_backlog();
diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
index 90cf7fc..e5caf13 100644
--- a/arch/x86/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -150,9 +150,7 @@ init_fnc_t *init_sequence_r[] = {
 	timer_init,
 	display_banner,
 	display_dram_config,
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize_r,
-#endif
 #ifndef CONFIG_SYS_NO_FLASH
 	flash_init_r,
 #endif
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index fd05e72..28a50b3 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -247,10 +247,8 @@ int _do_env_set(int flag, int argc, char * const argv[])
 		if (console_assign(console, argv[2]) < 0)
 			return 1;
 
-#ifdef CONFIG_SERIAL_MULTI
 		if (serial_assign(argv[2]) < 0)
 			return 1;
-#endif
 #endif /* CONFIG_CONSOLE_MUX */
 	}
 
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 593f16c..1b208af 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -94,7 +94,6 @@ int fdt_find_and_setprop(void *fdt, const char *node, const char *prop,
 
 #ifdef CONFIG_OF_STDOUT_VIA_ALIAS
 
-#ifdef CONFIG_SERIAL_MULTI
 static void fdt_fill_multisername(char *sername, size_t maxlen)
 {
 	const char *outname = stdio_devices[stdout]->name;
@@ -106,9 +105,6 @@ static void fdt_fill_multisername(char *sername, size_t maxlen)
 	if (strcmp(outname + 1, "serial") > 0)
 		strncpy(sername, outname + 1, maxlen);
 }
-#else
-static inline void fdt_fill_multisername(char *sername, size_t maxlen) {}
-#endif /* CONFIG_SERIAL_MULTI */
 
 static int fdt_fixup_stdout(void *fdt, int chosenoff)
 {
diff --git a/common/iomux.c b/common/iomux.c
index 91d98e9..dbc2312 100644
--- a/common/iomux.c
+++ b/common/iomux.c
@@ -135,7 +135,6 @@ int iomux_doenv(const int console, const char *arg)
 		 */
 		if (console_assign(console, start[j]) < 0)
 			continue;
-#ifdef CONFIG_SERIAL_MULTI
 		/*
 		 * This was taken from common/cmd_nvedit.c.
 		 * This will never work because serial_assign() returns
@@ -146,7 +145,6 @@ int iomux_doenv(const int console, const char *arg)
 		 */
 		if (serial_assign(start[j]) < 0)
 			continue;
-#endif
 		cons_set[cs_idx++] = dev;
 	}
 	free(console_args);
diff --git a/common/stdio.c b/common/stdio.c
index 1bf9ba0..605ff3f 100644
--- a/common/stdio.c
+++ b/common/stdio.c
@@ -227,9 +227,7 @@ int stdio_init (void)
 	drv_logbuff_init ();
 #endif
 	drv_system_init ();
-#ifdef CONFIG_SERIAL_MULTI
 	serial_stdio_init ();
-#endif
 #ifdef CONFIG_USB_TTY
 	drv_usbtty_init ();
 #endif
diff --git a/include/common.h b/include/common.h
index 55025c0..b52a8a4 100644
--- a/include/common.h
+++ b/include/common.h
@@ -194,18 +194,6 @@ typedef void (interrupt_handler_t)(void *);
 # endif
 #endif
 
-#ifndef CONFIG_SERIAL_MULTI
-
-#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2) \
- || defined(CONFIG_8xx_CONS_SCC1) || defined(CONFIG_8xx_CONS_SCC2) \
- || defined(CONFIG_8xx_CONS_SCC3) || defined(CONFIG_8xx_CONS_SCC4)
-
-#define CONFIG_SERIAL_MULTI	1
-
-#endif
-
-#endif /* CONFIG_SERIAL_MULTI */
-
 /*
  * General Purpose Utilities
  */
diff --git a/include/serial.h b/include/serial.h
index 96f0a89..003a2ac 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -62,7 +62,7 @@ extern int usbtty_tstc(void);
 
 #endif /* CONFIG_USB_TTY */
 
-#if defined(CONFIG_MPC512X) &&  defined(CONFIG_SERIAL_MULTI)
+#if defined(CONFIG_MPC512X)
 extern struct stdio_dev *open_port(int num, int baudrate);
 extern int close_port(int num);
 extern int write_port(struct stdio_dev *port, char *buf);
diff --git a/post/board/pdm360ng/coproc_com.c b/post/board/pdm360ng/coproc_com.c
index 0755352..b7e02b5 100644
--- a/post/board/pdm360ng/coproc_com.c
+++ b/post/board/pdm360ng/coproc_com.c
@@ -28,8 +28,6 @@
 #include <post.h>
 #include <serial.h>
 
-#if defined(CONFIG_SERIAL_MULTI)
-
 /*
  * Actually the termination sequence of the coprocessor
  * commands is "\r\n" (CR LF), but here we use a side effect of
@@ -94,4 +92,3 @@ int coprocessor_post_test(int flags)
 
 	return 0;
 }
-#endif	/* CONFIG_SERIAL_MULTI */
-- 
1.7.10.4

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

* [U-Boot] [PATCH 70/71] serial: Compile common/serial.c by default
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (68 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 69/71] serial: Remove CONFIG_SERIAL_MULTI from remaining sources Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-16 23:21 ` [U-Boot] [PATCH 71/71] serial: Enhance the manual relocation Marek Vasut
                   ` (2 subsequent siblings)
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Compile common/serial.c by default both into SPL and into non-SPL
builds, since CONFIG_SERIAL_MULTI is now the default state. Also
having common/serial.c in by default now, it's pointless to keep
-DCONFIG_SERIAL_MULTI in CPPFLAGS any longer, so remove it as well.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 common/Makefile |    2 +-
 config.mk       |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/Makefile b/common/Makefile
index 8b1ee5d..7f63f09 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -194,7 +194,7 @@ COBJS-y += dlmalloc.o
 COBJS-y += image.o
 COBJS-y += memsize.o
 COBJS-y += stdio.o
-COBJS-$(CONFIG_SERIAL_MULTI) += serial.o
+COBJS-y += serial.o
 
 
 COBJS	:= $(sort $(COBJS-y))
diff --git a/config.mk b/config.mk
index 88c72f1..c3822a2 100644
--- a/config.mk
+++ b/config.mk
@@ -193,7 +193,7 @@ OBJCFLAGS += --gap-fill=0xff
 gccincdir := $(shell $(CC) -print-file-name=include)
 
 CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS)		\
-	-D__KERNEL__ -DCONFIG_SERIAL_MULTI
+	-D__KERNEL__
 
 # Enable garbage collection of un-used sections for SPL
 ifeq ($(CONFIG_SPL_BUILD),y)
-- 
1.7.10.4

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

* [U-Boot] [PATCH 71/71] serial: Enhance the manual relocation
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (69 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 70/71] serial: Compile common/serial.c by default Marek Vasut
@ 2012-09-16 23:21 ` Marek Vasut
  2012-09-17 22:52 ` [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Tom Rini
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
  72 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-16 23:21 UTC (permalink / raw)
  To: u-boot

Enhance the manual relocation of drivers operations structure by
checking if the entries are NULL and increment them only if they
are not. This allows for setting any entry to NULL and it will
survive the manual relocation.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 common/serial.c |   20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 8e0d8a1..e287a5c 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -106,12 +106,20 @@ serial_initfunc(sh_serial_initialize);
 void serial_register(struct serial_device *dev)
 {
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
-	dev->start += gd->reloc_off;
-	dev->setbrg += gd->reloc_off;
-	dev->getc += gd->reloc_off;
-	dev->tstc += gd->reloc_off;
-	dev->putc += gd->reloc_off;
-	dev->puts += gd->reloc_off;
+	if (dev->start)
+		dev->start += gd->reloc_off;
+	if (dev->stop)
+		dev->stop += gd->reloc_off;
+	if (dev->setbrg)
+		dev->setbrg += gd->reloc_off;
+	if (dev->getc)
+		dev->getc += gd->reloc_off;
+	if (dev->tstc)
+		dev->tstc += gd->reloc_off;
+	if (dev->putc)
+		dev->putc += gd->reloc_off;
+	if (dev->puts)
+		dev->puts += gd->reloc_off;
 #endif
 
 	dev->next = serial_devices;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 41/71] serial: arm: Implement CONFIG_SERIAL_MULTI into atmel serial driver
  2012-09-16 23:21 ` [U-Boot] [PATCH 41/71] serial: arm: Implement CONFIG_SERIAL_MULTI into atmel " Marek Vasut
@ 2012-09-17  6:51   ` Andreas Bießmann
  2012-09-17 10:00     ` Marek Vasut
  2012-09-18 23:45   ` Andreas Bießmann
  1 sibling, 1 reply; 306+ messages in thread
From: Andreas Bießmann @ 2012-09-17  6:51 UTC (permalink / raw)
  To: u-boot

Dear Marek Vasut,

I have to admit that when reading this patch I got attention of your
UDM-serial.txt for the first time. However when reading this patch some
questions come to my mind.

On 17.09.12 01:21, Marek Vasut wrote:
> Implement support for CONFIG_SERIAL_MULTI into atmel serial driver.
> This driver was so far only usable directly, but this patch also adds
> support for the multi method. This allows using more than one serial
> driver alongside the atmel driver. Also, add a weak implementation
> of default_serial_console() returning this driver.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Tom Rini <trini@ti.com>
> Cc: Xu, Hong <Hong.Xu@atmel.com>
> ---
>  common/serial.c              |    2 ++
>  drivers/serial/atmel_usart.c |   67 ++++++++++++++++++++++++++++++++++++++----
>  2 files changed, 63 insertions(+), 6 deletions(-)
> 
> diff --git a/common/serial.c b/common/serial.c
> index e6566da..b880303 100644
> --- a/common/serial.c
> +++ b/common/serial.c
> @@ -71,6 +71,7 @@ serial_initfunc(sconsole_serial_initialize);
>  serial_initfunc(p3mx_serial_initialize);
>  serial_initfunc(altera_jtag_serial_initialize);
>  serial_initfunc(altera_serial_initialize);
> +serial_initfunc(atmel_serial_initialize);
>  
>  void serial_register(struct serial_device *dev)
>  {
> @@ -120,6 +121,7 @@ void serial_initialize(void)
>  	p3mx_serial_initialize();
>  	altera_jtag_serial_initialize();
>  	altera_serial_initialize();
> +	atmel_serial_initialize();
>  
>  	serial_assign(default_serial_console()->name);
>  }
> diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c
> index 943ef70..d49d5d4 100644
> --- a/drivers/serial/atmel_usart.c
> +++ b/drivers/serial/atmel_usart.c
> @@ -20,6 +20,8 @@
>   */
>  #include <common.h>
>  #include <watchdog.h>
> +#include <serial.h>
> +#include <linux/compiler.h>
>  
>  #include <asm/io.h>
>  #include <asm/arch/clk.h>
> @@ -29,7 +31,7 @@
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> -void serial_setbrg(void)
> +static void atmel_serial_setbrg(void)
>  {
>  	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;

shouldn't this USART_BASE be carried by the driver struct in some way? I
wonder how one should implement multiple interfaces later on with this
atmel_serial_xx(void) interface.

>  	unsigned long divisor;
> @@ -45,7 +47,7 @@ void serial_setbrg(void)
>  	writel(USART3_BF(CD, divisor), &usart->brgr);
>  }
>  
> -int serial_init(void)
> +static int atmel_serial_init(void)
>  {
>  	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
>  
> @@ -73,7 +75,7 @@ int serial_init(void)
>  	return 0;
>  }
>  
> -void serial_putc(char c)
> +static void atmel_serial_putc(char c)
>  {
>  	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
>  
> @@ -84,13 +86,13 @@ void serial_putc(char c)
>  	writel(c, &usart->thr);
>  }
>  
> -void serial_puts(const char *s)
> +static void atmel_serial_puts(const char *s)
>  {
>  	while (*s)
>  		serial_putc(*s++);
>  }

I have seen this one in a lot of drivers ... shouldn't we build a
generic one?

>  
> -int serial_getc(void)
> +static int atmel_serial_getc(void)
>  {
>  	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
>  
> @@ -99,8 +101,61 @@ int serial_getc(void)
>  	return readl(&usart->rhr);
>  }
>  
> -int serial_tstc(void)
> +static int atmel_serial_tstc(void)
>  {
>  	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
>  	return (readl(&usart->csr) & USART3_BIT(RXRDY)) != 0;
>  }
> +
> +#ifdef CONFIG_SERIAL_MULTI
> +static struct serial_device atmel_serial_drv = {
> +	.name	= "atmel_serial",

even though here is just one instance shouldn't the name reflect the
multiplicity of this driver (e.g. 'atmel_serial0')?

> +	.start	= atmel_serial_init,
> +	.stop	= NULL,
> +	.setbrg	= atmel_serial_setbrg,
> +	.putc	= atmel_serial_putc,
> +	.puts	= atmel_serial_puts,
> +	.getc	= atmel_serial_getc,
> +	.tstc	= atmel_serial_tstc,

As I understand this struct we need a start/stop/setbgr/... for each
instance we build.
Shouldn't we carry some void* private in this struct instead (I have
none seen in '[PATCH 01/71] serial: Coding style cleanup of struct
serial_device') to be able to reuse the interface with multiple
instances of the same driver class?
I think this is my main objection to this structure. I wonder how
existing SERIAL_MULTI implementations handle the need of private driver
information bound to an instance.

Best regards

Andreas Bie?mann

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

* [U-Boot] [PATCH 41/71] serial: arm: Implement CONFIG_SERIAL_MULTI into atmel serial driver
  2012-09-17  6:51   ` Andreas Bießmann
@ 2012-09-17 10:00     ` Marek Vasut
  2012-09-17 10:21       ` Andreas Bießmann
  0 siblings, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-17 10:00 UTC (permalink / raw)
  To: u-boot

Dear Andreas Bie?mann,

> Dear Marek Vasut,
> 
> I have to admit that when reading this patch I got attention of your
> UDM-serial.txt for the first time. However when reading this patch some
> questions come to my mind.
[...]

> > -void serial_setbrg(void)
> > +static void atmel_serial_setbrg(void)
> > 
> >  {
> >  
> >  	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
> 
> shouldn't this USART_BASE be carried by the driver struct in some way? I
> wonder how one should implement multiple interfaces later on with this
> atmel_serial_xx(void) interface.

We can't rework the whole stdio/serial subsystem right away. All such calls 
(serial_setbrg, serial_putc etc) will be augmented by one more parameter to push 
such information through at runtime. This will be done in subsequent patch, 
stage 1 in only a preparation stage.

> >  	unsigned long divisor;
> > 
> > @@ -45,7 +47,7 @@ void serial_setbrg(void)
> > 
> >  	writel(USART3_BF(CD, divisor), &usart->brgr);
> >  
> >  }
> > 
> > -int serial_init(void)
> > +static int atmel_serial_init(void)
> > 
> >  {
> >  
> >  	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
> > 
> > @@ -73,7 +75,7 @@ int serial_init(void)
> > 
> >  	return 0;
> >  
> >  }
> > 
> > -void serial_putc(char c)
> > +static void atmel_serial_putc(char c)
> > 
> >  {
> >  
> >  	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
> > 
> > @@ -84,13 +86,13 @@ void serial_putc(char c)
> > 
> >  	writel(c, &usart->thr);
> >  
> >  }
> > 
> > -void serial_puts(const char *s)
> > +static void atmel_serial_puts(const char *s)
> > 
> >  {
> >  
> >  	while (*s)
> >  	
> >  		serial_putc(*s++);
> >  
> >  }
> 
> I have seen this one in a lot of drivers ... shouldn't we build a
> generic one?

Indeed, but only in stage 2 or somewhere later ... I have that in mind, but the 
serial subsystem needs a bit of a patching for that.

> > -int serial_getc(void)
> > +static int atmel_serial_getc(void)
> > 
> >  {
> >  
> >  	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
> > 
> > @@ -99,8 +101,61 @@ int serial_getc(void)
> > 
> >  	return readl(&usart->rhr);
> >  
> >  }
> > 
> > -int serial_tstc(void)
> > +static int atmel_serial_tstc(void)
> > 
> >  {
> >  
> >  	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
> >  	return (readl(&usart->csr) & USART3_BIT(RXRDY)) != 0;
> >  
> >  }
> > 
> > +
> > +#ifdef CONFIG_SERIAL_MULTI
> > +static struct serial_device atmel_serial_drv = {
> > +	.name	= "atmel_serial",
> 
> even though here is just one instance shouldn't the name reflect the
> multiplicity of this driver (e.g. 'atmel_serial0')?

This is the name of the driver, not the name of the instance of the driver. I'd 
like to add .id field later on.

> > +	.start	= atmel_serial_init,
> > +	.stop	= NULL,
> > +	.setbrg	= atmel_serial_setbrg,
> > +	.putc	= atmel_serial_putc,
> > +	.puts	= atmel_serial_puts,
> > +	.getc	= atmel_serial_getc,
> > +	.tstc	= atmel_serial_tstc,
> 
> As I understand this struct we need a start/stop/setbgr/... for each
> instance we build.

No, this isn't instance. This are driver ops combined with it's name. I can not 
split it yet.

> Shouldn't we carry some void* private in this struct instead (I have
> none seen in '[PATCH 01/71] serial: Coding style cleanup of struct
> serial_device') to be able to reuse the interface with multiple
> instances of the same driver class?

Yes, but not now, not yet. I'm trying to keep this changes incremental as much 
as possible.

> I think this is my main objection to this structure. I wonder how
> existing SERIAL_MULTI implementations handle the need of private driver
> information bound to an instance.

They have multiple drivers so far and a default_serial_console call. That is 
indeed stupid, but fixing this is not part of this patchset, but a subsequent 
one. This one is only a preparation, trying not to break anything and unify the 
drivers under the serial_multi api, so the further stages can easily continue 
reworking it.

> Best regards
> 
> Andreas Bie?mann

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

* [U-Boot] [PATCH 41/71] serial: arm: Implement CONFIG_SERIAL_MULTI into atmel serial driver
  2012-09-17 10:00     ` Marek Vasut
@ 2012-09-17 10:21       ` Andreas Bießmann
  2012-09-17 10:30         ` Marek Vasut
  0 siblings, 1 reply; 306+ messages in thread
From: Andreas Bießmann @ 2012-09-17 10:21 UTC (permalink / raw)
  To: u-boot

Dear Marek Vasut,

On 17.09.2012 12:00, Marek Vasut wrote:
> Dear Andreas Bie?mann,
> 
>> Dear Marek Vasut,
>>
>> I have to admit that when reading this patch I got attention of your
>> UDM-serial.txt for the first time. However when reading this patch some
>> questions come to my mind.
> [...]
> 
>>> -void serial_setbrg(void)
>>> +static void atmel_serial_setbrg(void)
>>>
>>>  {
>>>  
>>>  	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
>>
>> shouldn't this USART_BASE be carried by the driver struct in some way? I
>> wonder how one should implement multiple interfaces later on with this
>> atmel_serial_xx(void) interface.
> 
> We can't rework the whole stdio/serial subsystem right away. All such calls 
> (serial_setbrg, serial_putc etc) will be augmented by one more parameter to push 
> such information through at runtime. This will be done in subsequent patch, 
> stage 1 in only a preparation stage.

Ok.

<snip>

>>> -void serial_puts(const char *s)
>>> +static void atmel_serial_puts(const char *s)
>>>
>>>  {
>>>  
>>>  	while (*s)
>>>  	
>>>  		serial_putc(*s++);
>>>  
>>>  }
>>
>> I have seen this one in a lot of drivers ... shouldn't we build a
>> generic one?
> 
> Indeed, but only in stage 2 or somewhere later ... I have that in mind, but the 
> serial subsystem needs a bit of a patching for that.

Ok.

<snip>

>>> +
>>> +#ifdef CONFIG_SERIAL_MULTI
>>> +static struct serial_device atmel_serial_drv = {
>>> +	.name	= "atmel_serial",
>>
>> even though here is just one instance shouldn't the name reflect the
>> multiplicity of this driver (e.g. 'atmel_serial0')?
> 
> This is the name of the driver, not the name of the instance of the driver. I'd 
> like to add .id field later on.

Ah, ok. Sounds good.

>>> +	.start	= atmel_serial_init,
>>> +	.stop	= NULL,
>>> +	.setbrg	= atmel_serial_setbrg,
>>> +	.putc	= atmel_serial_putc,
>>> +	.puts	= atmel_serial_puts,
>>> +	.getc	= atmel_serial_getc,
>>> +	.tstc	= atmel_serial_tstc,
>>
>> As I understand this struct we need a start/stop/setbgr/... for each
>> instance we build.
> 
> No, this isn't instance. This are driver ops combined with it's name. I can not 
> split it yet.
> 
>> Shouldn't we carry some void* private in this struct instead (I have
>> none seen in '[PATCH 01/71] serial: Coding style cleanup of struct
>> serial_device') to be able to reuse the interface with multiple
>> instances of the same driver class?
> 
> Yes, but not now, not yet. I'm trying to keep this changes incremental as much 
> as possible.
> 
>> I think this is my main objection to this structure. I wonder how
>> existing SERIAL_MULTI implementations handle the need of private driver
>> information bound to an instance.
> 
> They have multiple drivers so far and a default_serial_console call. That is 
> indeed stupid, but fixing this is not part of this patchset, but a subsequent 
> one. This one is only a preparation, trying not to break anything and unify the 
> drivers under the serial_multi api, so the further stages can easily continue 
> reworking it.

Understood, I'm fine with it. I will run a test on avr32/some at91 board
these days and send my ACK then.

Best regards

Andreas Bie?mann

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

* [U-Boot] [PATCH 41/71] serial: arm: Implement CONFIG_SERIAL_MULTI into atmel serial driver
  2012-09-17 10:21       ` Andreas Bießmann
@ 2012-09-17 10:30         ` Marek Vasut
  0 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-17 10:30 UTC (permalink / raw)
  To: u-boot

Dear Andreas Bie?mann,

[...]

> > They have multiple drivers so far and a default_serial_console call. That
> > is indeed stupid, but fixing this is not part of this patchset, but a
> > subsequent one. This one is only a preparation, trying not to break
> > anything and unify the drivers under the serial_multi api, so the
> > further stages can easily continue reworking it.
> 
> Understood, I'm fine with it. I will run a test on avr32/some at91 board
> these days and send my ACK then.

Thank you!

Please note, I have the subsequent stages planned and some already being worked 
on, but please let's wait with them until this gets into -next.

> Best regards
> 
> Andreas Bie?mann

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 50/71] serial: arm: Implement CONFIG_SERIAL_MULTI into imx serial driver
  2012-09-16 23:21 ` [U-Boot] [PATCH 50/71] serial: arm: Implement CONFIG_SERIAL_MULTI into imx " Marek Vasut
@ 2012-09-17 13:58   ` Stefano Babic
  2012-09-17 14:02     ` Marek Vasut
  0 siblings, 1 reply; 306+ messages in thread
From: Stefano Babic @ 2012-09-17 13:58 UTC (permalink / raw)
  To: u-boot

On 17/09/2012 01:21, Marek Vasut wrote:
> Implement support for CONFIG_SERIAL_MULTI into imx serial driver.
> This driver was so far only usable directly, but this patch also adds
> support for the multi method. This allows using more than one serial
> driver alongside the imx driver. Also, add a weak implementation
> of default_serial_console() returning this driver.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Tom Rini <trini@ti.com>
> Cc: Stefano Babic <sbabic@denx.de>
> ---

Hi Marek,

I have later realized that you pushed this series for u-boot-dm and not
u-boot. Anyway, is there some reason to prohibit to merge them directly
into mainline ? I do not see any special "DM" code here.

Regards,
Stefano

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

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

* [U-Boot] [PATCH 50/71] serial: arm: Implement CONFIG_SERIAL_MULTI into imx serial driver
  2012-09-17 13:58   ` Stefano Babic
@ 2012-09-17 14:02     ` Marek Vasut
  0 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-17 14:02 UTC (permalink / raw)
  To: u-boot

Dear Stefano Babic,

> On 17/09/2012 01:21, Marek Vasut wrote:
> > Implement support for CONFIG_SERIAL_MULTI into imx serial driver.
> > This driver was so far only usable directly, but this patch also adds
> > support for the multi method. This allows using more than one serial
> > driver alongside the imx driver. Also, add a weak implementation
> > of default_serial_console() returning this driver.
> > 
> > Signed-off-by: Marek Vasut <marex@denx.de>
> > Cc: Marek Vasut <marek.vasut@gmail.com>
> > Cc: Tom Rini <trini@ti.com>
> > Cc: Stefano Babic <sbabic@denx.de>
> > ---
> 
> Hi Marek,
> 
> I have later realized that you pushed this series for u-boot-dm and not
> u-boot.

This is for U-Boot, I only CCed the 0000 cover letter for DM to give'em heads up 
;-)

> Anyway, is there some reason to prohibit to merge them directly
> into mainline ? I do not see any special "DM" code here.

Nope, this stage 1 is really only support patchset for later stages which will 
converge this whole subsystem towards easy deployment of DM.

> Regards,
> Stefano

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 42/71] serial: arm: Implement CONFIG_SERIAL_MULTI into lpc32xx serial driver
  2012-09-16 23:21 ` [U-Boot] [PATCH 42/71] serial: arm: Implement CONFIG_SERIAL_MULTI into lpc32xx " Marek Vasut
@ 2012-09-17 22:28   ` Vladimir Zapolskiy
  0 siblings, 0 replies; 306+ messages in thread
From: Vladimir Zapolskiy @ 2012-09-17 22:28 UTC (permalink / raw)
  To: u-boot

On 17.09.2012 02:21, Marek Vasut wrote:
> Implement support for CONFIG_SERIAL_MULTI into lpc32xx serial driver.
> This driver was so far only usable directly, but this patch also adds
> support for the multi method. This allows using more than one serial
> driver alongside the lpc32xx driver. Also, add a weak implementation
> of default_serial_console() returning this driver.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Tom Rini <trini@ti.com>
> Cc: Vladimir Zapolskiy <vz@mleia.com>

Acked-by: Vladimir Zapolskiy <vz@mleia.com>

Thanks,
Vladimir

> ---
>   common/serial.c                 |    2 ++
>   drivers/serial/lpc32xx_hsuart.c |   71 ++++++++++++++++++++++++++-------------
>   2 files changed, 50 insertions(+), 23 deletions(-)
>
> diff --git a/common/serial.c b/common/serial.c
> index b880303..8bc26d8 100644
> --- a/common/serial.c
> +++ b/common/serial.c
> @@ -72,6 +72,7 @@ serial_initfunc(p3mx_serial_initialize);
>   serial_initfunc(altera_jtag_serial_initialize);
>   serial_initfunc(altera_serial_initialize);
>   serial_initfunc(atmel_serial_initialize);
> +serial_initfunc(lpc32xx_serial_initialize);
>
>   void serial_register(struct serial_device *dev)
>   {
> @@ -122,6 +123,7 @@ void serial_initialize(void)
>   	altera_jtag_serial_initialize();
>   	altera_serial_initialize();
>   	atmel_serial_initialize();
> +	lpc32xx_serial_initialize();
>
>   	serial_assign(default_serial_console()->name);
>   }
> diff --git a/drivers/serial/lpc32xx_hsuart.c b/drivers/serial/lpc32xx_hsuart.c
> index 8ce3382..536fd46 100644
> --- a/drivers/serial/lpc32xx_hsuart.c
> +++ b/drivers/serial/lpc32xx_hsuart.c
> @@ -22,12 +22,14 @@
>   #include<asm/arch/clk.h>
>   #include<asm/arch/uart.h>
>   #include<asm/io.h>
> +#include<serial.h>
> +#include<linux/compiler.h>
>
>   DECLARE_GLOBAL_DATA_PTR;
>
>   static struct hsuart_regs *hsuart = (struct hsuart_regs *)HS_UART_BASE;
>
> -static void lpc32xx_hsuart_set_baudrate(void)
> +static void lpc32xx_serial_setbrg(void)
>   {
>   	u32 div;
>
> @@ -39,7 +41,7 @@ static void lpc32xx_hsuart_set_baudrate(void)
>   	writel(div,&hsuart->rate);
>   }
>
> -static int lpc32xx_hsuart_getc(void)
> +static int lpc32xx_serial_getc(void)
>   {
>   	while (!(readl(&hsuart->level)&  HSUART_LEVEL_RX))
>   		/* NOP */;
> @@ -47,7 +49,7 @@ static int lpc32xx_hsuart_getc(void)
>   	return readl(&hsuart->rx)&  HSUART_RX_DATA;
>   }
>
> -static void lpc32xx_hsuart_putc(const char c)
> +static void lpc32xx_serial_putc(const char c)
>   {
>   	writel(c,&hsuart->tx);
>
> @@ -56,7 +58,7 @@ static void lpc32xx_hsuart_putc(const char c)
>   		/* NOP */;
>   }
>
> -static int lpc32xx_hsuart_tstc(void)
> +static int lpc32xx_serial_tstc(void)
>   {
>   	if (readl(&hsuart->level)&  HSUART_LEVEL_RX)
>   		return 1;
> @@ -64,49 +66,72 @@ static int lpc32xx_hsuart_tstc(void)
>   	return 0;
>   }
>
> -static void lpc32xx_hsuart_init(void)
> +static int lpc32xx_serial_init(void)
>   {
> -	lpc32xx_hsuart_set_baudrate();
> +	lpc32xx_serial_setbrg();
>
>   	/* Disable hardware RTS and CTS flow control, set up RX and TX FIFO */
>   	writel(HSUART_CTRL_TMO_16 | HSUART_CTRL_HSU_OFFSET(20) |
>   	       HSUART_CTRL_HSU_RX_TRIG_32 | HSUART_CTRL_HSU_TX_TRIG_0,
>   	&hsuart->ctrl);
> +	return 0;
>   }
>
> -void serial_setbrg(void)
> +static void lpc32xx_serial_puts(const char *s)
>   {
> -	return lpc32xx_hsuart_set_baudrate();
> +	while (*s)
> +		serial_putc(*s++);
>   }
>
> -void serial_putc(const char c)
> +#ifdef CONFIG_SERIAL_MULTI
> +static struct serial_device lpc32xx_serial_drv = {
> +	.name	= "lpc32xx_serial",
> +	.start	= lpc32xx_serial_init,
> +	.stop	= NULL,
> +	.setbrg	= lpc32xx_serial_setbrg,
> +	.putc	= lpc32xx_serial_putc,
> +	.puts	= lpc32xx_serial_puts,
> +	.getc	= lpc32xx_serial_getc,
> +	.tstc	= lpc32xx_serial_tstc,
> +};
> +
> +void lpc32xx_serial_initialize(void)
>   {
> -	lpc32xx_hsuart_putc(c);
> +	serial_register(&lpc32xx_serial_drv);
> +}
>
> -	/* If \n, also do \r */
> -	if (c == '\n')
> -		lpc32xx_hsuart_putc('\r');
> +__weak struct serial_device *default_serial_console(void)
> +{
> +	return&lpc32xx_serial_drv;
> +}
> +#else
> +int serial_init(void)
> +{
> +	return lpc32xx_serial_init();
>   }
>
> -int serial_getc(void)
> +void serial_setbrg(void)
>   {
> -	return lpc32xx_hsuart_getc();
> +	lpc32xx_serial_setbrg();
>   }
>
> -void serial_puts(const char *s)
> +void serial_putc(const char c)
>   {
> -	while (*s)
> -		serial_putc(*s++);
> +	lpc32xx_serial_putc(c);
>   }
>
> -int serial_tstc(void)
> +void serial_puts(const char *s)
>   {
> -	return lpc32xx_hsuart_tstc();
> +	lpc32xx_serial_puts(s);
>   }
>
> -int serial_init(void)
> +int serial_getc(void)
>   {
> -	lpc32xx_hsuart_init();
> +	return lpc32xx_serial_getc();
> +}
>
> -	return 0;
> +int serial_tstc(void)
> +{
> +	return lpc32xx_serial_tstc();
>   }
> +#endif

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

* [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (70 preceding siblings ...)
  2012-09-16 23:21 ` [U-Boot] [PATCH 71/71] serial: Enhance the manual relocation Marek Vasut
@ 2012-09-17 22:52 ` Tom Rini
  2012-09-17 23:12   ` Marek Vasut
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
  72 siblings, 1 reply; 306+ messages in thread
From: Tom Rini @ 2012-09-17 22:52 UTC (permalink / raw)
  To: u-boot

On Mon, Sep 17, 2012 at 01:20:25AM +0200, Marek Vasut wrote:

> This patchset is a STAGE 1 of preparation of the stdio and serial subsys
> for the driver model.
[snip]
> 6) Remove unused code used for the non-multi operation
>    Remove code that was used when CONFIG_SERIAL_MULTI was not selected.
>    Also remove all occurances of CONFIG_SERIAL_MULTI throughout the source
>    tree. Some parts of the code must have been adjusted to cope with this
>    since they were initially only written for non-multi operation. These
>    were minor adjustments mostly in macros though.

So we've simplified the code in that now we only have one way of talking
with the serial ports.  And the drivers are a bit more uniform as well.
Making the difference between drivers be "here is how you poke the
hardware" rather than "here is how I implemented a serial driver and oh,
here is how you poke the hardware" is good.  But what's the next step?
Have you any thoughts on trying to be clever and in the case of only one
port anyways getting the size back?  Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120917/20149e37/attachment.pgp>

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

* [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem
  2012-09-17 22:52 ` [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Tom Rini
@ 2012-09-17 23:12   ` Marek Vasut
  2012-09-18 16:42     ` Tom Rini
  0 siblings, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-17 23:12 UTC (permalink / raw)
  To: u-boot

Dear Tom Rini,

> On Mon, Sep 17, 2012 at 01:20:25AM +0200, Marek Vasut wrote:
> > This patchset is a STAGE 1 of preparation of the stdio and serial subsys
> > for the driver model.
> 
> [snip]
> 
> > 6) Remove unused code used for the non-multi operation
> > 
> >    Remove code that was used when CONFIG_SERIAL_MULTI was not selected.
> >    Also remove all occurances of CONFIG_SERIAL_MULTI throughout the
> >    source tree. Some parts of the code must have been adjusted to cope
> >    with this since they were initially only written for non-multi
> >    operation. These were minor adjustments mostly in macros though.
> 
> So we've simplified the code in that now we only have one way of talking
> with the serial ports.  And the drivers are a bit more uniform as well.
> Making the difference between drivers be "here is how you poke the
> hardware" rather than "here is how I implemented a serial driver and oh,
> here is how you poke the hardware" is good.

Correct

> But what's the next step?

So...

2) Rework stdio, make the creation of struct stdio_dev static instead of dynamic
3) struct serial_device is superset of struct stdio_dev ... make use of it, make 
stdio and serial subsystems closer
4) The massive list of callbacks in serial.c is stupid, pull out the linker 
section maker thingie (thing used to make driver lists there, similar to command 
lists from u-boot) from the DM tree and allow generation of list of serial 
drivers automagically.
=======
5) Flip over to DM, it's only one step away

> Have you any thoughts on trying to be clever and in the case of only one
> port anyways getting the size back?

This has been on my mind for a while after seeing those extra 3k of code all 
around. Yet, I'm afraid this won't play well with the DM's pile of pointers.

On the other hand, my stdio rework (step 2) managed to trim down the size a bit, 
so that might be small compensation.

> Thanks!

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 61/71] serial: sh: Implement CONFIG_SERIAL_MULTI into sh serial driver
  2012-09-16 23:21 ` [U-Boot] [PATCH 61/71] serial: sh: Implement CONFIG_SERIAL_MULTI into sh " Marek Vasut
@ 2012-09-18  1:01   ` Nobuhiro Iwamatsu
  0 siblings, 0 replies; 306+ messages in thread
From: Nobuhiro Iwamatsu @ 2012-09-18  1:01 UTC (permalink / raw)
  To: u-boot

On Mon, Sep 17, 2012 at 8:21 AM, Marek Vasut <marex@denx.de> wrote:
> Implement support for CONFIG_SERIAL_MULTI into sh serial driver.
> This driver was so far only usable directly, but this patch also adds
> support for the multi method. This allows using more than one serial
> driver alongside the sh driver. Also, add a weak implementation
> of default_serial_console() returning this driver.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Tom Rini <trini@ti.com>
> Cc: Phil Edworthy <PHIL.EDWORTHY@renesas.com>
> Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>

Acked-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>

> ---
>  common/serial.c            |    2 ++
>  drivers/serial/serial_sh.c |   65 ++++++++++++++++++++++++++++++++++++++++----
>  2 files changed, 61 insertions(+), 6 deletions(-)
>
> diff --git a/common/serial.c b/common/serial.c
> index 3dae01b..631af65 100644
> --- a/common/serial.c
> +++ b/common/serial.c
> @@ -91,6 +91,7 @@ serial_initfunc(netarm_serial_initialize);
>  serial_initfunc(pl01x_serial_initialize);
>  serial_initfunc(s3c44b0_serial_initialize);
>  serial_initfunc(sa1100_serial_initialize);
> +serial_initfunc(sh_serial_initialize);
>
>  void serial_register(struct serial_device *dev)
>  {
> @@ -160,6 +161,7 @@ void serial_initialize(void)
>         pl01x_serial_initialize();
>         s3c44b0_serial_initialize();
>         sa1100_serial_initialize();
> +       sh_serial_initialize();
>
>         serial_assign(default_serial_console()->name);
>  }
> diff --git a/drivers/serial/serial_sh.c b/drivers/serial/serial_sh.c
> index 13919c6..8c30397 100644
> --- a/drivers/serial/serial_sh.c
> +++ b/drivers/serial/serial_sh.c
> @@ -55,13 +55,13 @@ static struct uart_port sh_sci = {
>         .type           = SCIF_BASE_PORT,
>  };
>
> -void serial_setbrg(void)
> +static void sh_serial_setbrg(void)
>  {
>         DECLARE_GLOBAL_DATA_PTR;
>         sci_out(&sh_sci, SCBRR, SCBRR_VALUE(gd->baudrate, CONFIG_SYS_CLK_FREQ));
>  }
>
> -int serial_init(void)
> +static int sh_serial_init(void)
>  {
>         sci_out(&sh_sci, SCSCR , SCSCR_INIT(&sh_sci));
>         sci_out(&sh_sci, SCSCR , SCSCR_INIT(&sh_sci));
> @@ -127,21 +127,21 @@ void serial_raw_putc(const char c)
>         sci_out(&sh_sci, SCxSR, sci_in(&sh_sci, SCxSR) & ~SCxSR_TEND(&sh_sci));
>  }
>
> -void serial_putc(const char c)
> +static void sh_serial_putc(const char c)
>  {
>         if (c == '\n')
>                 serial_raw_putc('\r');
>         serial_raw_putc(c);
>  }
>
> -void serial_puts(const char *s)
> +static void sh_serial_puts(const char *s)
>  {
>         char c;
>         while ((c = *s++) != 0)
>                 serial_putc(c);
>  }
>
> -int serial_tstc(void)
> +static int sh_serial_tstc(void)
>  {
>         return serial_rx_fifo_level() ? 1 : 0;
>  }
> @@ -167,7 +167,7 @@ int serial_getc_check(void)
>         return status & (SCIF_DR | SCxSR_RDxF(&sh_sci));
>  }
>
> -int serial_getc(void)
> +static int sh_serial_getc(void)
>  {
>         unsigned short status;
>         char ch;
> @@ -187,3 +187,56 @@ int serial_getc(void)
>                 handle_error();
>         return ch;
>  }
> +
> +#ifdef CONFIG_SERIAL_MULTI
> +static struct serial_device sh_serial_drv = {
> +       .name   = "sh_serial",
> +       .start  = sh_serial_init,
> +       .stop   = NULL,
> +       .setbrg = sh_serial_setbrg,
> +       .putc   = sh_serial_putc,
> +       .puts   = sh_serial_puts,
> +       .getc   = sh_serial_getc,
> +       .tstc   = sh_serial_tstc,
> +};
> +
> +void sh_serial_initialize(void)
> +{
> +       serial_register(&sh_serial_drv);
> +}
> +
> +__weak struct serial_device *default_serial_console(void)
> +{
> +       return &sh_serial_drv;
> +}
> +#else
> +int serial_init(void)
> +{
> +       return sh_serial_init();
> +}
> +
> +void serial_setbrg(void)
> +{
> +       sh_serial_setbrg();
> +}
> +
> +void serial_putc(const char c)
> +{
> +       sh_serial_putc(c);
> +}
> +
> +void serial_puts(const char *s)
> +{
> +       sh_serial_puts(s);
> +}
> +
> +int serial_getc(void)
> +{
> +       return sh_serial_getc();
> +}
> +
> +int serial_tstc(void)
> +{
> +       return sh_serial_tstc();
> +}
> +#endif
> --
> 1.7.10.4
>

Best regards,
  Nobuhiro

-- 
Nobuhiro Iwamatsu
   iwamatsu at {nigauri.org / debian.org}
   GPG ID: 40AD1FA6

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

* [U-Boot] [PATCH 12/71] serial: s5p: Move serial registration from serial_initialize()
  2012-09-16 23:20 ` [U-Boot] [PATCH 12/71] serial: s5p: " Marek Vasut
@ 2012-09-18  1:28   ` Minkyu Kang
  0 siblings, 0 replies; 306+ messages in thread
From: Minkyu Kang @ 2012-09-18  1:28 UTC (permalink / raw)
  To: u-boot

Dear Marek,

On 17 September 2012 08:20, Marek Vasut <marex@denx.de> wrote:
> Move the registration of s5p_serialN_device ports from default
> serial_initialize() into driver specific function called from
> serial_initialize(). This slims down the serial_initialize() call
> to a bare tracker of all possible serial port registration routines
> in U-Boot.
>
> The newly implemented s5p_serial_initialize() function, which is
> implemented inside of the serial_s5p driver allows encapsulation
> of s5p_serialN_device within the serial_s5p driver itself.
>
> Also, remove the exports of s5p_serialN_device from include/serial.h
> as they are no longer needed. This is simply because the implementation of
> default_serial_console() is wrapped into the serial_s5p driver and
> the default console is picked by CONFIG_SERIAL<N> macro in config file.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Tom Rini <trini@ti.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> ---
>  common/serial.c             |    8 ++------
>  drivers/serial/serial_s5p.c |    8 ++++++++
>  include/serial.h            |    7 -------
>  3 files changed, 10 insertions(+), 13 deletions(-)
>
>

Acked-by: Minkyu Kang <mk7.kang@samsung.com>

Thanks.
Minkyu Kang.
-- 
from. prom.
www.promsoft.net

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

* [U-Boot] [PATCH 47/71] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c64xx serial driver
  2012-09-16 23:21 ` [U-Boot] [PATCH 47/71] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c64xx " Marek Vasut
@ 2012-09-18  1:30   ` Minkyu Kang
  0 siblings, 0 replies; 306+ messages in thread
From: Minkyu Kang @ 2012-09-18  1:30 UTC (permalink / raw)
  To: u-boot

On 17 September 2012 08:21, Marek Vasut <marex@denx.de> wrote:
> Implement support for CONFIG_SERIAL_MULTI into s3c64xx serial driver.
> This driver was so far only usable directly, but this patch also adds
> support for the multi method. This allows using more than one serial
> driver alongside the s3c64xx driver. Also, add a weak implementation
> of default_serial_console() returning this driver.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Tom Rini <trini@ti.com>
> Cc: John Rigby <john.rigby@linaro.org>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> ---
>  common/serial.c          |    2 ++
>  drivers/serial/s3c64xx.c |   65 +++++++++++++++++++++++++++++++++++++++++-----
>  2 files changed, 61 insertions(+), 6 deletions(-)
>

Acked-by: Minkyu Kang <mk7.kang@samsung.com>

Thanks.
--
from. prom.
www.promsoft.net

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

* [U-Boot] [PATCH 03/71] serial: Properly spell out the structure member names of serial_driver
  2012-09-16 23:20 ` [U-Boot] [PATCH 03/71] serial: Properly spell out the structure member names of serial_driver Marek Vasut
@ 2012-09-18  6:13   ` Michal Simek
  0 siblings, 0 replies; 306+ messages in thread
From: Michal Simek @ 2012-09-18  6:13 UTC (permalink / raw)
  To: u-boot

On 09/17/2012 01:20 AM, Marek Vasut wrote:
> Properly spell out the whole structure member names when an initialized
> varible is instantiated from the struct serial_driver. In case the
> structure definition for struct serial_driver undergoes reordering,
> there will be no impact on variables defined based on this structure.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Tom Rini <trini@ti.com>
> Cc: Anatolij Gustschin <agust@denx.de>
> Cc: Stefan Roese <sr@denx.de>
> Cc: Mike Frysinger <vapier@gentoo.org>
> Cc: C Nauman <cnauman@diagraph.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> Cc: Michal Simek <monstr@monstr.eu>
> ---
>   arch/powerpc/cpu/mpc512x/serial.c  |   18 +++++++++---------
>   arch/powerpc/cpu/mpc5xxx/serial.c  |   32 ++++++++++++++++----------------
>   arch/powerpc/cpu/mpc8xx/serial.c   |   32 ++++++++++++++++----------------
>   board/logicpd/zoom2/zoom2_serial.h |   16 ++++++++--------
>   drivers/serial/serial.c            |   19 ++++++++++---------
>   drivers/serial/serial_pxa.c        |   16 ++++++++--------
>   drivers/serial/serial_s3c24x0.c    |   18 +++++++++---------
>   drivers/serial/serial_s5p.c        |   19 ++++++++++---------
>   drivers/serial/serial_xuartlite.c  |   19 ++++++++++---------
>   9 files changed, 96 insertions(+), 93 deletions(-)

Uartlite part looks good to me.
Acked-by: Michal Simek <monstr@monstr.eu>

Thanks,
Michal


-- 
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian

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

* [U-Boot] [PATCH 13/71] serial: microblaze: Move serial registration from serial_initialize()
  2012-09-16 23:20 ` [U-Boot] [PATCH 13/71] serial: microblaze: " Marek Vasut
@ 2012-09-18  6:14   ` Michal Simek
  0 siblings, 0 replies; 306+ messages in thread
From: Michal Simek @ 2012-09-18  6:14 UTC (permalink / raw)
  To: u-boot

On 09/17/2012 01:20 AM, Marek Vasut wrote:
> Move the registration of xuartlite_serialN_device ports from
> default serial_initialize() into driver specific function called from
> serial_initialize(). This slims down the serial_initialize() call
> to a bare tracker of all possible serial port registration routines
> in U-Boot.
>
> The newly implemented xuartlite_serial_initialize() function, which is
> implemented inside of the serial_xuartlite driver allows encapsulation
> of xuartlite_serialN_device within the serial_xuartlite driver itself.
>
> Also, remove the exports of xuartlite_serialN_device from include/serial.h
> as they are no longer needed. This is simply because the implementation of
> default_serial_console() is wrapped into the serial_xuartlite driver and
> the default console is picked by CONFIG_SERIAL<N> macro in config file.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Tom Rini <trini@ti.com>
> Cc: Michal Simek <monstr@monstr.eu>
> ---
>   common/serial.c                   |   16 ++--------------
>   drivers/serial/serial_xuartlite.c |   16 ++++++++++++++++
>   include/serial.h                  |    7 -------
>   3 files changed, 18 insertions(+), 21 deletions(-)
>
> diff --git a/common/serial.c b/common/serial.c
> index c021c3f..e19a17f 100644
> --- a/common/serial.c
> +++ b/common/serial.c
> @@ -44,6 +44,7 @@ serial_initfunc(mpc8xx_serial_initialize);
>   serial_initfunc(pxa_serial_initialize);
>   serial_initfunc(s3c24xx_serial_initialize);
>   serial_initfunc(s5p_serial_initialize);
> +serial_initfunc(uartlite_serial_initialize);
>
>   void serial_register(struct serial_device *dev)
>   {
> @@ -97,20 +98,7 @@ void serial_initialize(void)
>   #if defined(CONFIG_SYS_BFIN_UART)
>   	serial_register_bfin_uart();
>   #endif
> -#if defined(CONFIG_XILINX_UARTLITE)
> -# ifdef XILINX_UARTLITE_BASEADDR
> -	serial_register(&uartlite_serial0_device);
> -# endif /* XILINX_UARTLITE_BASEADDR */
> -# ifdef XILINX_UARTLITE_BASEADDR1
> -	serial_register(&uartlite_serial1_device);
> -# endif /* XILINX_UARTLITE_BASEADDR1 */
> -# ifdef XILINX_UARTLITE_BASEADDR2
> -	serial_register(&uartlite_serial2_device);
> -# endif /* XILINX_UARTLITE_BASEADDR2 */
> -# ifdef XILINX_UARTLITE_BASEADDR3
> -	serial_register(&uartlite_serial3_device);
> -# endif /* XILINX_UARTLITE_BASEADDR3 */
> -#endif /* CONFIG_XILINX_UARTLITE */
> +	uartlite_serial_initialize();
>   	serial_assign(default_serial_console()->name);
>   }
>
> diff --git a/drivers/serial/serial_xuartlite.c b/drivers/serial/serial_xuartlite.c
> index 2b869c1..d90c42d 100644
> --- a/drivers/serial/serial_xuartlite.c
> +++ b/drivers/serial/serial_xuartlite.c
> @@ -177,4 +177,20 @@ __weak struct serial_device *default_serial_console(void)
>   	return &uartlite_serial3_device;
>   # endif /* XILINX_UARTLITE_BASEADDR3 */
>   }
> +
> +void uartlite_serial_initialize(void)
> +{
> +#ifdef XILINX_UARTLITE_BASEADDR
> +	serial_register(&uartlite_serial0_device);
> +#endif /* XILINX_UARTLITE_BASEADDR */
> +#ifdef XILINX_UARTLITE_BASEADDR1
> +	serial_register(&uartlite_serial1_device);
> +#endif /* XILINX_UARTLITE_BASEADDR1 */
> +#ifdef XILINX_UARTLITE_BASEADDR2
> +	serial_register(&uartlite_serial2_device);
> +#endif /* XILINX_UARTLITE_BASEADDR2 */
> +#ifdef XILINX_UARTLITE_BASEADDR3
> +	serial_register(&uartlite_serial3_device);
> +#endif /* XILINX_UARTLITE_BASEADDR3 */
> +}
>   #endif /* CONFIG_SERIAL_MULTI */
> diff --git a/include/serial.h b/include/serial.h
> index 08a9287..73991a6 100644
> --- a/include/serial.h
> +++ b/include/serial.h
> @@ -49,13 +49,6 @@ extern struct serial_device serial4_device;
>   extern struct serial_device serial6_device;
>   #endif
>
> -#if defined(CONFIG_XILINX_UARTLITE)
> -extern struct serial_device uartlite_serial0_device;
> -extern struct serial_device uartlite_serial1_device;
> -extern struct serial_device uartlite_serial2_device;
> -extern struct serial_device uartlite_serial3_device;
> -#endif
> -
>   #if defined(CONFIG_OMAP3_ZOOM2)
>   extern struct serial_device zoom2_serial_device0;
>   extern struct serial_device zoom2_serial_device1;
>

Acked-by: Michal Simek <monstr@monstr.eu>

Thanks,
Michal


-- 
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian

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

* [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem
  2012-09-17 23:12   ` Marek Vasut
@ 2012-09-18 16:42     ` Tom Rini
  2012-09-18 17:11       ` Marek Vasut
  0 siblings, 1 reply; 306+ messages in thread
From: Tom Rini @ 2012-09-18 16:42 UTC (permalink / raw)
  To: u-boot

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/17/12 16:12, Marek Vasut wrote:
> Dear Tom Rini,
> 
>> On Mon, Sep 17, 2012 at 01:20:25AM +0200, Marek Vasut wrote:
>>> This patchset is a STAGE 1 of preparation of the stdio and 
>>> serial subsys for the driver model.
>> 
>> [snip]
>> 
>>> 6) Remove unused code used for the non-multi operation
>>> 
>>> Remove code that was used when CONFIG_SERIAL_MULTI was not 
>>> selected. Also remove all occurances of CONFIG_SERIAL_MULTI 
>>> throughout the source tree. Some parts of the code must have 
>>> been adjusted to cope with this since they were initially only 
>>> written for non-multi operation. These were minor adjustments 
>>> mostly in macros though.
>> 
>> So we've simplified the code in that now we only have one way of 
>> talking with the serial ports.  And the drivers are a bit more 
>> uniform as well. Making the difference between drivers be "here 
>> is how you poke the hardware" rather than "here is how I 
>> implemented a serial driver and oh, here is how you poke the 
>> hardware" is good.
> 
> Correct
> 
>> But what's the next step?
> 
> So...
> 
> 2) Rework stdio, make the creation of struct stdio_dev static 
> instead of dynamic 3) struct serial_device is superset of struct 
> stdio_dev ... make use of it, make stdio and serial subsystems 
> closer 4) The massive list of callbacks in serial.c is stupid,
> pull out the linker section maker thingie (thing used to make
> driver lists there, similar to command lists from u-boot) from the
> DM tree and allow generation of list of serial drivers
> automagically. ======= 5) Flip over to DM, it's only one step away
> 
>> Have you any thoughts on trying to be clever and in the case of 
>> only one port anyways getting the size back?
> 
> This has been on my mind for a while after seeing those extra 3k
> of code all around. Yet, I'm afraid this won't play well with the
> DM's pile of pointers.
> 
> On the other hand, my stdio rework (step 2) managed to trim down 
> the size a bit, so that might be small compensation.

Can you give us a current example, both to help make sure everyone
understands we won't have too big a growth overall and so that if you
don't shrink it down I can pin you about it later?  Thanks!

- -- 
Tom

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQWKR9AAoJENk4IS6UOR1WvdAP/jAoFi6gJXzg4fso5230f4Kq
nZwtvRJ+gJT4ycUTZvTK0YY6KD0fmKPNgah3xVfAUlSNdnAMz/G/B2yOGekLr801
3MuV1h5BXwKotxbhFBPm1bfoIsCPwBi5nZRJTxuFjVihKhihR0VhHt0sSp5WwGkT
RCNpiDKahj99ZhsKlE9AkTMHZ8xQ+EXgy/WeMeVN5s0sgyG8clIfScKTmCHGIzD6
v0AbVsSyMX3Nm/qX8Mh35mMq6Zc6fQ7lszIzWATjY/9Rg6k40Qb7EH60N79namWh
THyRhDes3OU3KzS1qmEL1wK/AO3YF+2/4xWIniaZZKuB87g5BeG8DCrlGCGXeHpF
s/7sBZ1VOwoRevEaCQnFT2pV5J+i0PNHV3IXfukYFClxfcoK1VxfO7bLDhrmbz+h
xYUDAjJ+9Ytx+aayZi8sOnE4tmPs2ZqBZhw6wjN3VRyxeTgwCbxJN317UsSd5drq
XHuX9/00w7EVcER4NoDsqC8Catos3qVwQdjkkvdWrm3yRlvAgLU4zhCXKunUi+ZZ
BBPEllxOcv3mHSPijyokJNcaezL3T7R7qgIpcoViSU6xt7vaxLQoqSuw4qHSeboC
WJSAKS7F4N5WTtosF4GiQNCQgshFt3xMdG+1GIQNZmRNbug/KWx3G2lXZfCTMPOU
pTjdMe6FIS4E2awXhyOw
=/TmM
-----END PGP SIGNATURE-----

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

* [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL
  2012-09-16 23:21 ` [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL Marek Vasut
@ 2012-09-18 17:05   ` Tom Rini
  2012-09-18 17:13     ` Marek Vasut
  0 siblings, 1 reply; 306+ messages in thread
From: Tom Rini @ 2012-09-18 17:05 UTC (permalink / raw)
  To: u-boot

On Mon, Sep 17, 2012 at 01:21:27AM +0200, Marek Vasut wrote:

> Implement empty serial_* functions for SPL without serial
> support enabled. This is imperative to haave once serial
> multi is enabled unconditionally.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Tom Rini <trini@ti.com>
> ---
>  common/serial.c |   12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/common/serial.c b/common/serial.c
> index 631af65..cef4ba8 100644
> --- a/common/serial.c
> +++ b/common/serial.c
> @@ -27,6 +27,16 @@
>  #include <post.h>
>  #include <linux/compiler.h>
>  
> +/* Implement prototypes for SPL without serial support */
> +#if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_SERIAL_SUPPORT)
> +int serial_init(void) { return 0; }
> +void serial_setbrg(void) {}
> +int serial_getc(void) { return 0; }
> +int serial_tstc(void) { return 0; }
> +void serial_putc(const char c) {}
> +void serial_puts(const char *s) {}

This isn't quite right.  We need to allow for:
- No output SPL, strings collected (so #defined to do{} while (0))
- puts + printf SPL (CONFIG_SPL_SERIAL_SUPPORT +
  CONFIG_SPL_LIBCOMMON_SUPPORT)
- puts only SPL (CONFIG_SPL_SERIAL_SUPPORT + #define puts
  serial_puts/putc).

I'm not asking you to do that, but you will have to adapt to it once
Jose is done with it.  What that means, off the top of my head, is we
can just drop this patch as in the first and last case serial.o will be
garbage-collected (or not built) and in the middle case, this will be
fully used.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120918/0a459e50/attachment.pgp>

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

* [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem
  2012-09-18 16:42     ` Tom Rini
@ 2012-09-18 17:11       ` Marek Vasut
  0 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-18 17:11 UTC (permalink / raw)
  To: u-boot

Dear Tom Rini,

[...]

> > On the other hand, my stdio rework (step 2) managed to trim down
> > the size a bit, so that might be small compensation.
> 
> Can you give us a current example, both to help make sure everyone
> understands we won't have too big a growth overall and so that if you
> don't shrink it down I can pin you about it later?  Thanks!

You're definitelly going to poke me about it later, since the DM will cause a 
size growth. There's no discussion about it and it's a simple fact we have to 
face and accept. If we're going to hunt every kb of growth, we can flat out stop 
the DM and give up, sorry.

Here are some measurements, but they're not final. Something grew a bit and 
something did not grew:

Configuring for omap3_beagle board...
   text    data     bss     dec     hex filename
 326912    8648  266944  602504   93188 ./u-boot
 326657    8764  266792  602213   93065 ./u-boot
  45794    1860  198020  245674   3bfaa ./spl/u-boot-spl
  45817    1868  198020  245705   3bfc9 ./spl/u-boot-spl

You see the SPL grew, U-Boot shrunk. But the size difference is of tens of bytes 
magnitude.

Configuring for sandbox board...
   text    data     bss     dec     hex filename
 138674    6456   28504  173634   2a642 ./u-boot
 139002    6512   28424  173938   2a772 ./u-boot

Configuring for grsim_leon2 board...
   text    data     bss     dec     hex filename
  97058    3384    2640  103082   192aa ./u-boot
  97106    3448    2592  103146   192ea ./u-boot

Configuring for P1020RDB-PC_36BIT_SPIFLASH - Board: p1_p2_rdb_pc, Options: 
P1020RDB,36BIT,SPIFLASH
   text    data     bss     dec     hex filename
 394550   30940  267600  693090   a9362 ./u-boot
 394601   31068  267536  693205   a93d5 ./u-boot

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL
  2012-09-18 17:05   ` Tom Rini
@ 2012-09-18 17:13     ` Marek Vasut
  2012-09-18 17:46       ` Scott Wood
  2012-09-18 17:53       ` Tom Rini
  0 siblings, 2 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-18 17:13 UTC (permalink / raw)
  To: u-boot

Dear Tom Rini,

> On Mon, Sep 17, 2012 at 01:21:27AM +0200, Marek Vasut wrote:
> > Implement empty serial_* functions for SPL without serial
> > support enabled. This is imperative to haave once serial
> > multi is enabled unconditionally.
> > 
> > Signed-off-by: Marek Vasut <marex@denx.de>
> > Cc: Marek Vasut <marek.vasut@gmail.com>
> > Cc: Tom Rini <trini@ti.com>
> > ---
> > 
> >  common/serial.c |   12 ++++++++++++
> >  1 file changed, 12 insertions(+)
> > 
> > diff --git a/common/serial.c b/common/serial.c
> > index 631af65..cef4ba8 100644
> > --- a/common/serial.c
> > +++ b/common/serial.c
> > @@ -27,6 +27,16 @@
> > 
> >  #include <post.h>
> >  #include <linux/compiler.h>
> > 
> > +/* Implement prototypes for SPL without serial support */
> > +#if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_SERIAL_SUPPORT)
> > +int serial_init(void) { return 0; }
> > +void serial_setbrg(void) {}
> > +int serial_getc(void) { return 0; }
> > +int serial_tstc(void) { return 0; }
> > +void serial_putc(const char c) {}
> > +void serial_puts(const char *s) {}
> 
> This isn't quite right.  We need to allow for:
> - No output SPL, strings collected (so #defined to do{} while (0))

Which is not type-checked and will drag in bugs.

> - puts + printf SPL (CONFIG_SPL_SERIAL_SUPPORT +
>   CONFIG_SPL_LIBCOMMON_SUPPORT)
> - puts only SPL (CONFIG_SPL_SERIAL_SUPPORT + #define puts
>   serial_puts/putc).
> 
> I'm not asking you to do that, but you will have to adapt to it once
> Jose is done with it.  What that means, off the top of my head, is we
> can just drop this patch as in the first and last case serial.o will be
> garbage-collected (or not built) and in the middle case, this will be
> fully used.

I can't drop this patch as it will break all of SPL when CONFIG_SERIAL_MULTI is 
unconditionally enabled.

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 08/71] serial: Implement serial_initfunc() macro
  2012-09-16 23:20 ` [U-Boot] [PATCH 08/71] serial: Implement serial_initfunc() macro Marek Vasut
@ 2012-09-18 17:31   ` Tom Rini
  2012-09-18 17:57     ` Marek Vasut
  0 siblings, 1 reply; 306+ messages in thread
From: Tom Rini @ 2012-09-18 17:31 UTC (permalink / raw)
  To: u-boot

On Mon, Sep 17, 2012 at 01:20:33AM +0200, Marek Vasut wrote:

> This macro simplifies declaration of weak aliases for per-driver
> functions, which register these drivers with the serial subsystem.
> The idea here is to push serial_register() calls from serial.c into
> the drivers. To avoid pile of ifdef construct as it is now, create
> weak aliases to these functions, which in case the driver is not
> present alias onto an empty function, which is in turn optimized out
> altogether.

So, did you consider and throw out the idea of something like:
common/serial.c:
void serial_initalize(void) {
  platform_serial_register();
  serial_assign(default_serial_console()->name);
}

And then every serial driver, instead of having to add a new weak
function to common/serial.c and a new function call just defines
platform_serial_register.

Or do you run into platforms that want two different serial drivers AND
you couldn't solve that with a combination of weak functions and
board-specific platform_serial_register?

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120918/d614acba/attachment.pgp>

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

* [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL
  2012-09-18 17:13     ` Marek Vasut
@ 2012-09-18 17:46       ` Scott Wood
  2012-09-18 18:03         ` Marek Vasut
  2012-09-18 17:53       ` Tom Rini
  1 sibling, 1 reply; 306+ messages in thread
From: Scott Wood @ 2012-09-18 17:46 UTC (permalink / raw)
  To: u-boot

On 09/18/2012 12:13:57 PM, Marek Vasut wrote:
> Dear Tom Rini,
> 
> > On Mon, Sep 17, 2012 at 01:21:27AM +0200, Marek Vasut wrote:
> > > Implement empty serial_* functions for SPL without serial
> > > support enabled. This is imperative to haave once serial
> > > multi is enabled unconditionally.
> > >
> > > Signed-off-by: Marek Vasut <marex@denx.de>
> > > Cc: Marek Vasut <marek.vasut@gmail.com>
> > > Cc: Tom Rini <trini@ti.com>
> > > ---
> > >
> > >  common/serial.c |   12 ++++++++++++
> > >  1 file changed, 12 insertions(+)
> > >
> > > diff --git a/common/serial.c b/common/serial.c
> > > index 631af65..cef4ba8 100644
> > > --- a/common/serial.c
> > > +++ b/common/serial.c
> > > @@ -27,6 +27,16 @@
> > >
> > >  #include <post.h>
> > >  #include <linux/compiler.h>
> > >
> > > +/* Implement prototypes for SPL without serial support */
> > > +#if defined(CONFIG_SPL_BUILD) &&  
> !defined(CONFIG_SPL_SERIAL_SUPPORT)
> > > +int serial_init(void) { return 0; }
> > > +void serial_setbrg(void) {}
> > > +int serial_getc(void) { return 0; }
> > > +int serial_tstc(void) { return 0; }
> > > +void serial_putc(const char c) {}
> > > +void serial_puts(const char *s) {}
> >
> > This isn't quite right.  We need to allow for:
> > - No output SPL, strings collected (so #defined to do{} while (0))
> 
> Which is not type-checked and will drag in bugs.

Not all that likely, since most code will either be built with printf  
enabled some of the time, or not contain printf (i.e. it's not quite  
the same situation as debug prints which may be rarely enabled).

An inline function would be fine, but has to be done at the same place  
that normal printf is declared -- whereas a macro could be done after  
the fact.  Unless you use a macro to redirect it to an inline function  
of a different name...

I do not understand why you want to put these stubs in a C file instead  
of a header file, though -- you're preventing code from being optimized  
away, which is important in some SPLs.

-Scott

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

* [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL
  2012-09-18 17:13     ` Marek Vasut
  2012-09-18 17:46       ` Scott Wood
@ 2012-09-18 17:53       ` Tom Rini
  2012-09-18 18:01         ` Marek Vasut
  1 sibling, 1 reply; 306+ messages in thread
From: Tom Rini @ 2012-09-18 17:53 UTC (permalink / raw)
  To: u-boot

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/18/12 10:13, Marek Vasut wrote:
> Dear Tom Rini,
> 
>> On Mon, Sep 17, 2012 at 01:21:27AM +0200, Marek Vasut wrote:
>>> Implement empty serial_* functions for SPL without serial 
>>> support enabled. This is imperative to haave once serial multi 
>>> is enabled unconditionally.
>>> 
>>> Signed-off-by: Marek Vasut <marex@denx.de> Cc: Marek Vasut 
>>> <marek.vasut@gmail.com> Cc: Tom Rini <trini@ti.com> ---
>>> 
>>> common/serial.c |   12 ++++++++++++ 1 file changed, 12 
>>> insertions(+)
>>> 
>>> diff --git a/common/serial.c b/common/serial.c index 
>>> 631af65..cef4ba8 100644 --- a/common/serial.c +++ 
>>> b/common/serial.c @@ -27,6 +27,16 @@
>>> 
>>> #include <post.h> #include <linux/compiler.h>
>>> 
>>> +/* Implement prototypes for SPL without serial support */
>>> +#if defined(CONFIG_SPL_BUILD) && 
>>> !defined(CONFIG_SPL_SERIAL_SUPPORT) +int serial_init(void) { 
>>> return 0; } +void serial_setbrg(void) {} +int
>>> serial_getc(void) { return 0; } +int serial_tstc(void) { return
>>> 0; } +void serial_putc(const char c) {} +void serial_puts(const
>>> char *s) {}
>> 
>> This isn't quite right.  We need to allow for: - No output SPL, 
>> strings collected (so #defined to do{} while (0))
> 
> Which is not type-checked and will drag in bugs.

Scott has addressed this.

>> - puts + printf SPL (CONFIG_SPL_SERIAL_SUPPORT + 
>> CONFIG_SPL_LIBCOMMON_SUPPORT) - puts only SPL 
>> (CONFIG_SPL_SERIAL_SUPPORT + #define puts serial_puts/putc).
>> 
>> I'm not asking you to do that, but you will have to adapt to it 
>> once Jose is done with it.  What that means, off the top of my 
>> head, is we can just drop this patch as in the first and last 
>> case serial.o will be garbage-collected (or not built) and in
>> the middle case, this will be fully used.
> 
> I can't drop this patch as it will break all of SPL when 
> CONFIG_SERIAL_MULTI is unconditionally enabled.

Why is it breaking _all_ of SPL?  Have you run-tested this anywhere,
especially with SPL?  In most cases it should be used and real
functions provided or garbage collected away.

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQWLUQAAoJENk4IS6UOR1WxoAP/3Lto025hWPgi7obJR1nrl63
r84gfCPkVsjqWHmYJl+vFOlyTuEiXaW9K5PWNxRA7xXbm5GbBe90fZBdYVxCSh+f
7KuSJ5jBEItmma9eeva7Af8FRtoC487yM9MpAOUKQ2pKsOiPR7lbiGQamHvWUssA
1BQfALQSlWgdlsk93EHXwxRoQD97ojAfCWPybObpd0C3oYUHVPhOYHS9NtLiRr8e
L58e7XhPksxNEyx29qrbmSwFGE8a4zSeu9SHjCfVk9Z2j2cD0zXpgqbwTe8/U259
31KUoRoLpqbSfOl4jcmZ54lyWZNbh1p45cyZAtOy4JJE99YkE951p342wC7sseQM
AtGqWQidKvHszpiSFkhu2pbTHQbTZfnYA4cvKL4x5S6zXKLEk/Ybfn9RTXQpdnaQ
6yUeYLjHl3bXeVb/JhtD5oouzyCfQmDyVnS4CUTAD4rVBS1CNpjpLa/mDoAcZNJr
zFLtkBW/72toOV7Xy2YsLtiWvw3bL6gKeKueegX5vHRBIx9csHWB3SZc7qMCZyIW
xk3CIhJEru/RsWMAqynCX5lfRSuw2+Zflnq5YJnqeVRY2mdasXewLsvhW2iRRn7n
C/Wf43wU782RK/8KbBYlokiDjV5egipxccW3lOIAr1HtvSQNfQgUDrum4opx+Jrw
nbA1JTydUvu0YSzId43A
=Lc/6
-----END PGP SIGNATURE-----

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

* [U-Boot] [PATCH 08/71] serial: Implement serial_initfunc() macro
  2012-09-18 17:31   ` Tom Rini
@ 2012-09-18 17:57     ` Marek Vasut
  0 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-18 17:57 UTC (permalink / raw)
  To: u-boot

Dear Tom Rini,

> On Mon, Sep 17, 2012 at 01:20:33AM +0200, Marek Vasut wrote:
> > This macro simplifies declaration of weak aliases for per-driver
> > functions, which register these drivers with the serial subsystem.
> > The idea here is to push serial_register() calls from serial.c into
> > the drivers. To avoid pile of ifdef construct as it is now, create
> > weak aliases to these functions, which in case the driver is not
> > present alias onto an empty function, which is in turn optimized out
> > altogether.
> 
> So, did you consider and throw out the idea of something like:
> common/serial.c:
> void serial_initalize(void) {
>   platform_serial_register();
>   serial_assign(default_serial_console()->name);
> }
> 
> And then every serial driver, instead of having to add a new weak
> function to common/serial.c and a new function call just defines
> platform_serial_register.

Yes

> Or do you run into platforms that want two different serial drivers AND
> you couldn't solve that with a combination of weak functions and
> board-specific platform_serial_register?

The point is to allow compiling in any possible combination of serial drivers, 
thus the per-driver separate init call. I'd like to get rid of this once the DM 
is present, since there'll be a method of generating the driver list 
automagically, thus dissolving this all.

So this is pretty much temporary. Yet, you are right, there are a few boards 
(really minor amount, some PPC ancient goo) that do need two drivers in.

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL
  2012-09-18 17:53       ` Tom Rini
@ 2012-09-18 18:01         ` Marek Vasut
  2012-09-18 18:08           ` Tom Rini
  0 siblings, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-18 18:01 UTC (permalink / raw)
  To: u-boot

Dear Tom Rini,

> On 09/18/12 10:13, Marek Vasut wrote:
> > Dear Tom Rini,
> > 
> >> On Mon, Sep 17, 2012 at 01:21:27AM +0200, Marek Vasut wrote:
> >>> Implement empty serial_* functions for SPL without serial
> >>> support enabled. This is imperative to haave once serial multi
> >>> is enabled unconditionally.
> >>> 
> >>> Signed-off-by: Marek Vasut <marex@denx.de> Cc: Marek Vasut
> >>> <marek.vasut@gmail.com> Cc: Tom Rini <trini@ti.com> ---
> >>> 
> >>> common/serial.c |   12 ++++++++++++ 1 file changed, 12
> >>> insertions(+)
> >>> 
> >>> diff --git a/common/serial.c b/common/serial.c index
> >>> 631af65..cef4ba8 100644 --- a/common/serial.c +++
> >>> b/common/serial.c @@ -27,6 +27,16 @@
> >>> 
> >>> #include <post.h> #include <linux/compiler.h>
> >>> 
> >>> +/* Implement prototypes for SPL without serial support */
> >>> +#if defined(CONFIG_SPL_BUILD) &&
> >>> !defined(CONFIG_SPL_SERIAL_SUPPORT) +int serial_init(void) {
> >>> return 0; } +void serial_setbrg(void) {} +int
> >>> serial_getc(void) { return 0; } +int serial_tstc(void) { return
> >>> 0; } +void serial_putc(const char c) {} +void serial_puts(const
> >>> char *s) {}
> >> 
> >> This isn't quite right.  We need to allow for: - No output SPL,
> >> strings collected (so #defined to do{} while (0))
> > 
> > Which is not type-checked and will drag in bugs.
> 
> Scott has addressed this.
> 
> >> - puts + printf SPL (CONFIG_SPL_SERIAL_SUPPORT +
> >> CONFIG_SPL_LIBCOMMON_SUPPORT) - puts only SPL
> >> (CONFIG_SPL_SERIAL_SUPPORT + #define puts serial_puts/putc).
> >> 
> >> I'm not asking you to do that, but you will have to adapt to it
> >> once Jose is done with it.  What that means, off the top of my
> >> head, is we can just drop this patch as in the first and last
> >> case serial.o will be garbage-collected (or not built) and in
> >> the middle case, this will be fully used.
> > 
> > I can't drop this patch as it will break all of SPL when
> > CONFIG_SERIAL_MULTI is unconditionally enabled.
> 
> Why is it breaking _all_ of SPL?  Have you run-tested this anywhere,
> especially with SPL?  In most cases it should be used and real
> functions provided or garbage collected away.

Yes, try compiling m28evk without this patch for example, it's going to break 
it. Because CONFIG_SPL_SERIAL_SUPPORT is disabled, yet it uses code that 
contains references to puts() etc.

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL
  2012-09-18 17:46       ` Scott Wood
@ 2012-09-18 18:03         ` Marek Vasut
  2012-09-18 18:25           ` Scott Wood
  0 siblings, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-18 18:03 UTC (permalink / raw)
  To: u-boot

Dear Scott Wood,

> On 09/18/2012 12:13:57 PM, Marek Vasut wrote:
> > Dear Tom Rini,
> > 
> > > On Mon, Sep 17, 2012 at 01:21:27AM +0200, Marek Vasut wrote:
> > > > Implement empty serial_* functions for SPL without serial
> > > > support enabled. This is imperative to haave once serial
> > > > multi is enabled unconditionally.
> > > > 
> > > > Signed-off-by: Marek Vasut <marex@denx.de>
> > > > Cc: Marek Vasut <marek.vasut@gmail.com>
> > > > Cc: Tom Rini <trini@ti.com>
> > > > ---
> > > > 
> > > >  common/serial.c |   12 ++++++++++++
> > > >  1 file changed, 12 insertions(+)
> > > > 
> > > > diff --git a/common/serial.c b/common/serial.c
> > > > index 631af65..cef4ba8 100644
> > > > --- a/common/serial.c
> > > > +++ b/common/serial.c
> > > > @@ -27,6 +27,16 @@
> > > > 
> > > >  #include <post.h>
> > > >  #include <linux/compiler.h>
> > > > 
> > > > +/* Implement prototypes for SPL without serial support */
> > > > +#if defined(CONFIG_SPL_BUILD) &&
> > 
> > !defined(CONFIG_SPL_SERIAL_SUPPORT)
> > 
> > > > +int serial_init(void) { return 0; }
> > > > +void serial_setbrg(void) {}
> > > > +int serial_getc(void) { return 0; }
> > > > +int serial_tstc(void) { return 0; }
> > > > +void serial_putc(const char c) {}
> > > > +void serial_puts(const char *s) {}
> > > 
> > > This isn't quite right.  We need to allow for:
> > > - No output SPL, strings collected (so #defined to do{} while (0))
> > 
> > Which is not type-checked and will drag in bugs.
> 
> Not all that likely, since most code will either be built with printf
> enabled some of the time, or not contain printf (i.e. it's not quite
> the same situation as debug prints which may be rarely enabled).
> 
> An inline function would be fine, but has to be done at the same place
> that normal printf is declared -- whereas a macro could be done after
> the fact.  Unless you use a macro to redirect it to an inline function
> of a different name...
> 
> I do not understand why you want to put these stubs in a C file instead
> of a header file, though -- you're preventing code from being optimized
> away, which is important in some SPLs.

I'd say the GCC must optimize it out anyway.

And if not, what solution do you suggest, move these into include/serial.h and 
compile serial.c in conditionally?

> -Scott

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL
  2012-09-18 18:01         ` Marek Vasut
@ 2012-09-18 18:08           ` Tom Rini
  2012-09-18 18:24             ` Marek Vasut
  0 siblings, 1 reply; 306+ messages in thread
From: Tom Rini @ 2012-09-18 18:08 UTC (permalink / raw)
  To: u-boot

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/18/12 11:01, Marek Vasut wrote:
> Dear Tom Rini,
> 
>> On 09/18/12 10:13, Marek Vasut wrote:
>>> Dear Tom Rini,
>>> 
>>>> On Mon, Sep 17, 2012 at 01:21:27AM +0200, Marek Vasut wrote:
>>>>> Implement empty serial_* functions for SPL without serial 
>>>>> support enabled. This is imperative to haave once serial
>>>>> multi is enabled unconditionally.
>>>>> 
>>>>> Signed-off-by: Marek Vasut <marex@denx.de> Cc: Marek Vasut 
>>>>> <marek.vasut@gmail.com> Cc: Tom Rini <trini@ti.com> ---
>>>>> 
>>>>> common/serial.c |   12 ++++++++++++ 1 file changed, 12 
>>>>> insertions(+)
>>>>> 
>>>>> diff --git a/common/serial.c b/common/serial.c index 
>>>>> 631af65..cef4ba8 100644 --- a/common/serial.c +++ 
>>>>> b/common/serial.c @@ -27,6 +27,16 @@
>>>>> 
>>>>> #include <post.h> #include <linux/compiler.h>
>>>>> 
>>>>> +/* Implement prototypes for SPL without serial support */ 
>>>>> +#if defined(CONFIG_SPL_BUILD) && 
>>>>> !defined(CONFIG_SPL_SERIAL_SUPPORT) +int serial_init(void)
>>>>> { return 0; } +void serial_setbrg(void) {} +int 
>>>>> serial_getc(void) { return 0; } +int serial_tstc(void) {
>>>>> return 0; } +void serial_putc(const char c) {} +void
>>>>> serial_puts(const char *s) {}
>>>> 
>>>> This isn't quite right.  We need to allow for: - No output
>>>> SPL, strings collected (so #defined to do{} while (0))
>>> 
>>> Which is not type-checked and will drag in bugs.
>> 
>> Scott has addressed this.
>> 
>>>> - puts + printf SPL (CONFIG_SPL_SERIAL_SUPPORT + 
>>>> CONFIG_SPL_LIBCOMMON_SUPPORT) - puts only SPL 
>>>> (CONFIG_SPL_SERIAL_SUPPORT + #define puts serial_puts/putc).
>>>> 
>>>> I'm not asking you to do that, but you will have to adapt to
>>>> it once Jose is done with it.  What that means, off the top
>>>> of my head, is we can just drop this patch as in the first
>>>> and last case serial.o will be garbage-collected (or not
>>>> built) and in the middle case, this will be fully used.
>>> 
>>> I can't drop this patch as it will break all of SPL when 
>>> CONFIG_SERIAL_MULTI is unconditionally enabled.
>> 
>> Why is it breaking _all_ of SPL?  Have you run-tested this
>> anywhere, especially with SPL?  In most cases it should be used
>> and real functions provided or garbage collected away.
> 
> Yes, try compiling m28evk without this patch for example, it's
> going to break it. Because CONFIG_SPL_SERIAL_SUPPORT is disabled,
> yet it uses code that contains references to puts() etc.

Progress!  Now, why isn't this file being garbage collected?  m28evk
is fitting into the first category I said (no output) but now it's not
discarding things that it should be discarding.

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQWLifAAoJENk4IS6UOR1WyiIP/1h3r1OBQ8sxHCq6nuWT7cvQ
6taDBU6780uOY+YsbNgjlImp7lSM30HYxXou2j2kykPcRjUPMzLoYDRZio+8d8RW
ETQcMld8I/OMz52HT6lnjIaqVBOpK42vlRW86LNcxIFOasYlK4qxO3kjKmshu5aC
ct7b5xcHFaqfxLp2EjkUOgmoyPXhNTdsnDVdOTaXG7qGKAffDFCeUHTsBB3kc/S6
w5HwDNTBWZYVMWuTXKXLXh+3h4x+VL1LCxCsnu8R88cEkj7b9DkqGUsUrCDPFqc/
YAqiUqacTa0V9h9XeE/OdZUo7uS04FibPHzvho91LcnBdjOJ7jPLY7k/IJ7guhqp
aRC9UrB/AAPkpLExo32Ksx+7wAJThsfWY6DL5oI76E4FYZP2WaqygBM/WDCbcOK7
6HIGItjGwFpXBCDbawKob395Kt5gK2J43qXR2E7CR4p3ic8liMqsWu5J+TCUVF6b
jxjLZ22Bw5zolUkhUE5u+M+O/rxCjYG0HNTssC1ymYR/jU36p1m6oGqxVN8Voi0R
1ARQB2yY3uuQOqR1URZMzuA94d1Qffnhg3LwSm3cJRH825WNDkxEXq/hvK/4hLbH
DXb79+zRqv7f80jPUEk60sKFI3YzJMvRBaaxjXqOkMFywaNMQjbsnXCmvztoqRqG
A1gmJGTWixOQbrN56DjF
=wRYN
-----END PGP SIGNATURE-----

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

* [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL
  2012-09-18 18:08           ` Tom Rini
@ 2012-09-18 18:24             ` Marek Vasut
  2012-09-18 18:34               ` Tom Rini
  0 siblings, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-18 18:24 UTC (permalink / raw)
  To: u-boot

Dear Tom Rini,

> On 09/18/12 11:01, Marek Vasut wrote:
> > Dear Tom Rini,
> > 
> >> On 09/18/12 10:13, Marek Vasut wrote:
> >>> Dear Tom Rini,
> >>> 
> >>>> On Mon, Sep 17, 2012 at 01:21:27AM +0200, Marek Vasut wrote:
> >>>>> Implement empty serial_* functions for SPL without serial
> >>>>> support enabled. This is imperative to haave once serial
> >>>>> multi is enabled unconditionally.
> >>>>> 
> >>>>> Signed-off-by: Marek Vasut <marex@denx.de> Cc: Marek Vasut
> >>>>> <marek.vasut@gmail.com> Cc: Tom Rini <trini@ti.com> ---
> >>>>> 
> >>>>> common/serial.c |   12 ++++++++++++ 1 file changed, 12
> >>>>> insertions(+)
> >>>>> 
> >>>>> diff --git a/common/serial.c b/common/serial.c index
> >>>>> 631af65..cef4ba8 100644 --- a/common/serial.c +++
> >>>>> b/common/serial.c @@ -27,6 +27,16 @@
> >>>>> 
> >>>>> #include <post.h> #include <linux/compiler.h>
> >>>>> 
> >>>>> +/* Implement prototypes for SPL without serial support */
> >>>>> +#if defined(CONFIG_SPL_BUILD) &&
> >>>>> !defined(CONFIG_SPL_SERIAL_SUPPORT) +int serial_init(void)
> >>>>> { return 0; } +void serial_setbrg(void) {} +int
> >>>>> serial_getc(void) { return 0; } +int serial_tstc(void) {
> >>>>> return 0; } +void serial_putc(const char c) {} +void
> >>>>> serial_puts(const char *s) {}
> >>>> 
> >>>> This isn't quite right.  We need to allow for: - No output
> >>>> SPL, strings collected (so #defined to do{} while (0))
> >>> 
> >>> Which is not type-checked and will drag in bugs.
> >> 
> >> Scott has addressed this.
> >> 
> >>>> - puts + printf SPL (CONFIG_SPL_SERIAL_SUPPORT +
> >>>> CONFIG_SPL_LIBCOMMON_SUPPORT) - puts only SPL
> >>>> (CONFIG_SPL_SERIAL_SUPPORT + #define puts serial_puts/putc).
> >>>> 
> >>>> I'm not asking you to do that, but you will have to adapt to
> >>>> it once Jose is done with it.  What that means, off the top
> >>>> of my head, is we can just drop this patch as in the first
> >>>> and last case serial.o will be garbage-collected (or not
> >>>> built) and in the middle case, this will be fully used.
> >>> 
> >>> I can't drop this patch as it will break all of SPL when
> >>> CONFIG_SERIAL_MULTI is unconditionally enabled.
> >> 
> >> Why is it breaking _all_ of SPL?  Have you run-tested this
> >> anywhere, especially with SPL?  In most cases it should be used
> >> and real functions provided or garbage collected away.
> > 
> > Yes, try compiling m28evk without this patch for example, it's
> > going to break it. Because CONFIG_SPL_SERIAL_SUPPORT is disabled,
> > yet it uses code that contains references to puts() etc.
> 
> Progress!  Now, why isn't this file being garbage collected?

What file?

> m28evk
> is fitting into the first category I said (no output) but now it's not
> discarding things that it should be discarding.

What is not discarding things and what things should be discarded? I believe if 
you're missing symbols, the compiler will error-out. Always.

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL
  2012-09-18 18:03         ` Marek Vasut
@ 2012-09-18 18:25           ` Scott Wood
  2012-09-18 18:33             ` Marek Vasut
  0 siblings, 1 reply; 306+ messages in thread
From: Scott Wood @ 2012-09-18 18:25 UTC (permalink / raw)
  To: u-boot

On 09/18/2012 01:03:17 PM, Marek Vasut wrote:
> Dear Scott Wood,
> 
> > On 09/18/2012 12:13:57 PM, Marek Vasut wrote:
> > > Dear Tom Rini,
> > >
> > > > On Mon, Sep 17, 2012 at 01:21:27AM +0200, Marek Vasut wrote:
> > > > > Implement empty serial_* functions for SPL without serial
> > > > > support enabled. This is imperative to haave once serial
> > > > > multi is enabled unconditionally.
> > > > >
> > > > > Signed-off-by: Marek Vasut <marex@denx.de>
> > > > > Cc: Marek Vasut <marek.vasut@gmail.com>
> > > > > Cc: Tom Rini <trini@ti.com>
> > > > > ---
> > > > >
> > > > >  common/serial.c |   12 ++++++++++++
> > > > >  1 file changed, 12 insertions(+)
> > > > >
> > > > > diff --git a/common/serial.c b/common/serial.c
> > > > > index 631af65..cef4ba8 100644
> > > > > --- a/common/serial.c
> > > > > +++ b/common/serial.c
> > > > > @@ -27,6 +27,16 @@
> > > > >
> > > > >  #include <post.h>
> > > > >  #include <linux/compiler.h>
> > > > >
> > > > > +/* Implement prototypes for SPL without serial support */
> > > > > +#if defined(CONFIG_SPL_BUILD) &&
> > >
> > > !defined(CONFIG_SPL_SERIAL_SUPPORT)
> > >
> > > > > +int serial_init(void) { return 0; }
> > > > > +void serial_setbrg(void) {}
> > > > > +int serial_getc(void) { return 0; }
> > > > > +int serial_tstc(void) { return 0; }
> > > > > +void serial_putc(const char c) {}
> > > > > +void serial_puts(const char *s) {}
> > > >
> > > > This isn't quite right.  We need to allow for:
> > > > - No output SPL, strings collected (so #defined to do{} while  
> (0))
> > >
> > > Which is not type-checked and will drag in bugs.
> >
> > Not all that likely, since most code will either be built with  
> printf
> > enabled some of the time, or not contain printf (i.e. it's not quite
> > the same situation as debug prints which may be rarely enabled).
> >
> > An inline function would be fine, but has to be done at the same  
> place
> > that normal printf is declared -- whereas a macro could be done  
> after
> > the fact.  Unless you use a macro to redirect it to an inline  
> function
> > of a different name...
> >
> > I do not understand why you want to put these stubs in a C file  
> instead
> > of a header file, though -- you're preventing code from being  
> optimized
> > away, which is important in some SPLs.
> 
> I'd say the GCC must optimize it out anyway.

I think I got some wires crossed and was thinking about printf/puts.   
We want those to be optimized away at compile time (not pointed to a  
stub at link time) on an SPL that has no output support, but once  
that's done the low level serial functions shouldn't be referenced  
anymore, right?

-Scott

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

* [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL
  2012-09-18 18:25           ` Scott Wood
@ 2012-09-18 18:33             ` Marek Vasut
  2012-09-18 18:39               ` Tom Rini
  2012-09-18 19:23               ` Scott Wood
  0 siblings, 2 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-18 18:33 UTC (permalink / raw)
  To: u-boot

Dear Scott Wood,

> On 09/18/2012 01:03:17 PM, Marek Vasut wrote:
> > Dear Scott Wood,
> > 
> > > On 09/18/2012 12:13:57 PM, Marek Vasut wrote:
> > > > Dear Tom Rini,
> > > > 
> > > > > On Mon, Sep 17, 2012 at 01:21:27AM +0200, Marek Vasut wrote:
> > > > > > Implement empty serial_* functions for SPL without serial
> > > > > > support enabled. This is imperative to haave once serial
> > > > > > multi is enabled unconditionally.
> > > > > > 
> > > > > > Signed-off-by: Marek Vasut <marex@denx.de>
> > > > > > Cc: Marek Vasut <marek.vasut@gmail.com>
> > > > > > Cc: Tom Rini <trini@ti.com>
> > > > > > ---
> > > > > > 
> > > > > >  common/serial.c |   12 ++++++++++++
> > > > > >  1 file changed, 12 insertions(+)
> > > > > > 
> > > > > > diff --git a/common/serial.c b/common/serial.c
> > > > > > index 631af65..cef4ba8 100644
> > > > > > --- a/common/serial.c
> > > > > > +++ b/common/serial.c
> > > > > > @@ -27,6 +27,16 @@
> > > > > > 
> > > > > >  #include <post.h>
> > > > > >  #include <linux/compiler.h>
> > > > > > 
> > > > > > +/* Implement prototypes for SPL without serial support */
> > > > > > +#if defined(CONFIG_SPL_BUILD) &&
> > > > 
> > > > !defined(CONFIG_SPL_SERIAL_SUPPORT)
> > > > 
> > > > > > +int serial_init(void) { return 0; }
> > > > > > +void serial_setbrg(void) {}
> > > > > > +int serial_getc(void) { return 0; }
> > > > > > +int serial_tstc(void) { return 0; }
> > > > > > +void serial_putc(const char c) {}
> > > > > > +void serial_puts(const char *s) {}
> > > > > 
> > > > > This isn't quite right.  We need to allow for:
> > > > > - No output SPL, strings collected (so #defined to do{} while
> > 
> > (0))
> > 
> > > > Which is not type-checked and will drag in bugs.
> > > 
> > > Not all that likely, since most code will either be built with
> > 
> > printf
> > 
> > > enabled some of the time, or not contain printf (i.e. it's not quite
> > > the same situation as debug prints which may be rarely enabled).
> > > 
> > > An inline function would be fine, but has to be done at the same
> > 
> > place
> > 
> > > that normal printf is declared -- whereas a macro could be done
> > 
> > after
> > 
> > > the fact.  Unless you use a macro to redirect it to an inline
> > 
> > function
> > 
> > > of a different name...
> > > 
> > > I do not understand why you want to put these stubs in a C file
> > 
> > instead
> > 
> > > of a header file, though -- you're preventing code from being
> > 
> > optimized
> > 
> > > away, which is important in some SPLs.
> > 
> > I'd say the GCC must optimize it out anyway.
> 
> I think I got some wires crossed and was thinking about printf/puts.
> We want those to be optimized away at compile time (not pointed to a
> stub at link time) on an SPL that has no output support, but once
> that's done the low level serial functions shouldn't be referenced
> anymore, right?

But if you point them to stubs, that's OK. The compiler will GC these useless 
stubs anyway. But wait, we're getting to LTO here, right?

So the safest bet really is macro in serial.h ?

> -Scott

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

* [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL
  2012-09-18 18:24             ` Marek Vasut
@ 2012-09-18 18:34               ` Tom Rini
  0 siblings, 0 replies; 306+ messages in thread
From: Tom Rini @ 2012-09-18 18:34 UTC (permalink / raw)
  To: u-boot

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/18/12 11:24, Marek Vasut wrote:
> Dear Tom Rini,
> 
>> On 09/18/12 11:01, Marek Vasut wrote:
>>> Dear Tom Rini,
>>> 
>>>> On 09/18/12 10:13, Marek Vasut wrote:
>>>>> Dear Tom Rini,
>>>>> 
>>>>>> On Mon, Sep 17, 2012 at 01:21:27AM +0200, Marek Vasut
>>>>>> wrote:
>>>>>>> Implement empty serial_* functions for SPL without
>>>>>>> serial support enabled. This is imperative to haave
>>>>>>> once serial multi is enabled unconditionally.
>>>>>>> 
>>>>>>> Signed-off-by: Marek Vasut <marex@denx.de> Cc: Marek
>>>>>>> Vasut <marek.vasut@gmail.com> Cc: Tom Rini
>>>>>>> <trini@ti.com> ---
>>>>>>> 
>>>>>>> common/serial.c |   12 ++++++++++++ 1 file changed, 12 
>>>>>>> insertions(+)
>>>>>>> 
>>>>>>> diff --git a/common/serial.c b/common/serial.c index 
>>>>>>> 631af65..cef4ba8 100644 --- a/common/serial.c +++ 
>>>>>>> b/common/serial.c @@ -27,6 +27,16 @@
>>>>>>> 
>>>>>>> #include <post.h> #include <linux/compiler.h>
>>>>>>> 
>>>>>>> +/* Implement prototypes for SPL without serial support
>>>>>>> */ +#if defined(CONFIG_SPL_BUILD) && 
>>>>>>> !defined(CONFIG_SPL_SERIAL_SUPPORT) +int
>>>>>>> serial_init(void) { return 0; } +void
>>>>>>> serial_setbrg(void) {} +int serial_getc(void) { return
>>>>>>> 0; } +int serial_tstc(void) { return 0; } +void
>>>>>>> serial_putc(const char c) {} +void serial_puts(const
>>>>>>> char *s) {}
>>>>>> 
>>>>>> This isn't quite right.  We need to allow for: - No
>>>>>> output SPL, strings collected (so #defined to do{} while
>>>>>> (0))
>>>>> 
>>>>> Which is not type-checked and will drag in bugs.
>>>> 
>>>> Scott has addressed this.
>>>> 
>>>>>> - puts + printf SPL (CONFIG_SPL_SERIAL_SUPPORT + 
>>>>>> CONFIG_SPL_LIBCOMMON_SUPPORT) - puts only SPL 
>>>>>> (CONFIG_SPL_SERIAL_SUPPORT + #define puts
>>>>>> serial_puts/putc).
>>>>>> 
>>>>>> I'm not asking you to do that, but you will have to adapt
>>>>>> to it once Jose is done with it.  What that means, off
>>>>>> the top of my head, is we can just drop this patch as in
>>>>>> the first and last case serial.o will be
>>>>>> garbage-collected (or not built) and in the middle case,
>>>>>> this will be fully used.
>>>>> 
>>>>> I can't drop this patch as it will break all of SPL when 
>>>>> CONFIG_SERIAL_MULTI is unconditionally enabled.
>>>> 
>>>> Why is it breaking _all_ of SPL?  Have you run-tested this 
>>>> anywhere, especially with SPL?  In most cases it should be
>>>> used and real functions provided or garbage collected away.
>>> 
>>> Yes, try compiling m28evk without this patch for example, it's 
>>> going to break it. Because CONFIG_SPL_SERIAL_SUPPORT is
>>> disabled, yet it uses code that contains references to puts()
>>> etc.
>> 
>> Progress!  Now, why isn't this file being garbage collected?
> 
> What file?

common/serial.o since as you point out, m28evk doesn't define any way
to do output.

>> m28evk is fitting into the first category I said (no output) but
>> now it's not discarding things that it should be discarding.
> 
> What is not discarding things and what things should be discarded?
> I believe if you're missing symbols, the compiler will error-out.
> Always.

Nope.  This is fine:
gc_this_function(void) {
  never_define_this_at_link();
  return;
}

And nothing calling gc_this_function means that it's fine that
never_define_this_at_link isn't seen by the linker.

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQWL7QAAoJENk4IS6UOR1W+KgP/jjDmO3c+WfYqEjuEjLMjSAW
qTLZOLdsmsU7HoFa+/fWNgmvvmcJlTgqzo0z5izku2d0xx8TO3R6rpZa9weHXhr1
yuKs+CzP/6A1Kntd8VC0SRUU+Rb4onPPoY0kw0QDL01zug5DBEu+saI08CJRrtki
DLzayRPNoTcppffp1r2nstyAJJWvuYcFO4A3wzR3h5U1lQNHK7Yt8KRtmCFQW1d1
Y98ikHi75PDcSZDjj60OHVhNtaDDcLUu2NWAXrf4gI13WLPxcNXHRTq1uufY38Pv
fNd5wqrC7qDq7I6uomwuy+b6aDYYPqsrh9T/h/tjWO235mA+7Dnkl2qvHrYOOcV6
1zBef8M+vuawVWYZnsJO4k1Cg2Ci9Gl4sPqJVYaSnhhXjQawZbztQpT1P4tN1DEG
8r7mpt6bWGG1nnEgiNWvFZvv798sj2Lh/T0yxAsnX9CgnlxZ7lh+uqirMmUJeUKB
aWiuDJIMqQORXcJIO1tDwtL+2EA5CxofLa11Y0tpT0r2G0cOsQQQfJTQ6K9p4KhB
gkOhRmlPQs12WV+9r6LWuUqDRuIbMjOUHfNOf9eZfKTvptMMRhwT1zCVBdMVwbwO
3e/WpNTDjRLpqj08bs6OHOVO7GvXXtZJGHJJGlJ3a49pHMnqNUjBGSajDYJyHL0O
/75PPDTIXSrUJw1anFC8
=yREs
-----END PGP SIGNATURE-----

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

* [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL
  2012-09-18 18:33             ` Marek Vasut
@ 2012-09-18 18:39               ` Tom Rini
  2012-09-18 18:54                 ` Marek Vasut
  2012-09-18 19:19                 ` Marek Vasut
  2012-09-18 19:23               ` Scott Wood
  1 sibling, 2 replies; 306+ messages in thread
From: Tom Rini @ 2012-09-18 18:39 UTC (permalink / raw)
  To: u-boot

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/18/12 11:33, Marek Vasut wrote:
> Dear Scott Wood,
[snip]
>> I think I got some wires crossed and was thinking about
>> printf/puts. We want those to be optimized away at compile time
>> (not pointed to a stub at link time) on an SPL that has no output
>> support, but once that's done the low level serial functions
>> shouldn't be referenced anymore, right?
> 
> But if you point them to stubs, that's OK. The compiler will GC
> these useless stubs anyway. But wait, we're getting to LTO here,
> right?
> 
> So the safest bet really is macro in serial.h ?

Due to the gcc bug I've mentioned before, yes.  Dummy functions will,
I bet, keep the string constants around.  do {} while(0) will drop
them out entirely.

- -- 
Tom

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQWL/mAAoJENk4IS6UOR1WwXQQAJXFmoGOjTxtuq1PMDYIEUSg
mGwZUgjTDy3wrzVl8xkzuSeRYtqL/vFbThHDVoAiWXcQ2/4Mrcunl3v3UW+QV2ye
KwESGqd05CIUEDxFqihOIKCR2KZHpUkt45Uf6SPOXfB4A0O7N9CuvyxPl2ZFHGxx
ePFwopmX9gL7xO3u1cjAtxtmiCS22ulztW3ROU3+NTsVKA3k4AXW617tjpsPmQzJ
L9N2LX49Z+UGDxh7YW/M4wcD50GlZFyIUY1COyhxeAQXmCXRMeDJdqxU1f3+SG1G
fnWsBPoVdIJEv8XBr+ABNd4DYDZCWsTA7uklvkt2NDh64Lp+Nge5dD92fZJfrKoc
NUWLhXN1U9ko9xbflxlBK94zkmtJfLfvtboK58frjv/H7MlSIuUzbgH4ixq/5ZOM
g5pKFQ2YynrZ0yrjqH8I/v50GsziT+LpAiQnE62Yt2EQMkNCIC1zDz9ikg3MhL63
sxiZPi0mpcbvao6f6l0JIllMkvEWBnM4fGQCWMGGOkjbCqvkSnBNt4BhgAK2ZXuC
kcLkdeOhszdWZxhfK+V0d5U+XQdIJoHdYyVC+6hAEd5iO4++gXgx+8feQV+ZQvSS
8iCdnobNp6XfM6agNOpkJto0+ROqEIyDSUzBAOb3+474fSWBjhhY7ievGxZiKikx
mhsHRYG6ziEdOt4bkQ5H
=m9GH
-----END PGP SIGNATURE-----

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

* [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL
  2012-09-18 18:39               ` Tom Rini
@ 2012-09-18 18:54                 ` Marek Vasut
  2012-09-18 19:19                 ` Marek Vasut
  1 sibling, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-18 18:54 UTC (permalink / raw)
  To: u-boot

Dear Tom Rini,

> On 09/18/12 11:33, Marek Vasut wrote:
> > Dear Scott Wood,
> 
> [snip]
> 
> >> I think I got some wires crossed and was thinking about
> >> printf/puts. We want those to be optimized away at compile time
> >> (not pointed to a stub at link time) on an SPL that has no output
> >> support, but once that's done the low level serial functions
> >> shouldn't be referenced anymore, right?
> > 
> > But if you point them to stubs, that's OK. The compiler will GC
> > these useless stubs anyway. But wait, we're getting to LTO here,
> > right?
> > 
> > So the safest bet really is macro in serial.h ?
> 
> Due to the gcc bug I've mentioned before, yes.  Dummy functions will,
> I bet, keep the string constants around.  do {} while(0) will drop
> them out entirely.

Yea ... the GCC bug, what a crap :-(

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL
  2012-09-18 18:39               ` Tom Rini
  2012-09-18 18:54                 ` Marek Vasut
@ 2012-09-18 19:19                 ` Marek Vasut
  2012-09-18 19:23                   ` Tom Rini
  1 sibling, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-18 19:19 UTC (permalink / raw)
  To: u-boot

Dear Tom Rini,

> On 09/18/12 11:33, Marek Vasut wrote:
> > Dear Scott Wood,
> 
> [snip]
> 
> >> I think I got some wires crossed and was thinking about
> >> printf/puts. We want those to be optimized away at compile time
> >> (not pointed to a stub at link time) on an SPL that has no output
> >> support, but once that's done the low level serial functions
> >> shouldn't be referenced anymore, right?
> > 
> > But if you point them to stubs, that's OK. The compiler will GC
> > these useless stubs anyway. But wait, we're getting to LTO here,
> > right?
> > 
> > So the safest bet really is macro in serial.h ?
> 
> Due to the gcc bug I've mentioned before, yes.  Dummy functions will,
> I bet, keep the string constants around.  do {} while(0) will drop
> them out entirely.

Damn, not much gain on m28evk (with C functionss/with macros), using gcc 4.7.1:

Configuring for m28evk board...
   text    data     bss     dec     hex filename
 418994    7780  288632  715406   aea8e ./u-boot
  11773     788      12   12573    311d ./spl/u-boot-spl

Configuring for m28evk board...
   text    data     bss     dec     hex filename
 418998    7780  288628  715406   aea8e ./u-boot
  11765     788      12   12565    3115 ./spl/u-boot-spl

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL
  2012-09-18 18:33             ` Marek Vasut
  2012-09-18 18:39               ` Tom Rini
@ 2012-09-18 19:23               ` Scott Wood
  2012-09-18 19:24                 ` Marek Vasut
  1 sibling, 1 reply; 306+ messages in thread
From: Scott Wood @ 2012-09-18 19:23 UTC (permalink / raw)
  To: u-boot

On 09/18/2012 01:33:11 PM, Marek Vasut wrote:
> Dear Scott Wood,
> 
> > On 09/18/2012 01:03:17 PM, Marek Vasut wrote:
> > > I'd say the GCC must optimize it out anyway.
> >
> > I think I got some wires crossed and was thinking about printf/puts.
> > We want those to be optimized away at compile time (not pointed to a
> > stub at link time) on an SPL that has no output support, but once
> > that's done the low level serial functions shouldn't be referenced
> > anymore, right?
> 
> But if you point them to stubs, that's OK. The compiler will GC these  
> useless
> stubs anyway. But wait, we're getting to LTO here, right?
> 
> So the safest bet really is macro in serial.h ?

For printf/puts, we want something header-based.  For the serial  
functions it depends on whether we have call sites that do not get GCed.

-Scott

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

* [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL
  2012-09-18 19:19                 ` Marek Vasut
@ 2012-09-18 19:23                   ` Tom Rini
  2012-09-18 19:25                     ` Marek Vasut
  0 siblings, 1 reply; 306+ messages in thread
From: Tom Rini @ 2012-09-18 19:23 UTC (permalink / raw)
  To: u-boot

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/18/12 12:19, Marek Vasut wrote:
> Dear Tom Rini,
> 
>> On 09/18/12 11:33, Marek Vasut wrote:
>>> Dear Scott Wood,
>> 
>> [snip]
>> 
>>>> I think I got some wires crossed and was thinking about 
>>>> printf/puts. We want those to be optimized away at compile 
>>>> time (not pointed to a stub at link time) on an SPL that has 
>>>> no output support, but once that's done the low level serial 
>>>> functions shouldn't be referenced anymore, right?
>>> 
>>> But if you point them to stubs, that's OK. The compiler will GC
>>> these useless stubs anyway. But wait, we're getting to LTO 
>>> here, right?
>>> 
>>> So the safest bet really is macro in serial.h ?
>> 
>> Due to the gcc bug I've mentioned before, yes.  Dummy functions 
>> will, I bet, keep the string constants around.  do {} while(0) 
>> will drop them out entirely.
> 
> Damn, not much gain on m28evk (with C functionss/with macros), 
> using gcc 4.7.1:
> 
> Configuring for m28evk board... text    data     bss     dec hex
> filename 418994    7780  288632  715406   aea8e ./u-boot 11773 788
> 12   12573    311d ./spl/u-boot-spl
> 
> Configuring for m28evk board... text    data     bss     dec hex
> filename 418998    7780  288628  715406   aea8e ./u-boot 11765 788
> 12   12565    3115 ./spl/u-boot-spl

Right, didn't have many strings.  But do you see what I mean now about
not needing this patch as it stands currently?

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQWMojAAoJENk4IS6UOR1Ws/EP/jx1vvg3N2gIlSVRfl6em3ul
VwBi/tLW+mAlF3V/+Ge3h//U9gAef6uDbRlLUngxAvVuHQZZb7gqtf6T9Zw7DDu/
BFLSocaLi99rnEdwEZe4lApJnBP3pZEcLnHiKVvFN+lGSA7G6vEzJemawnxhFdKh
B9MgtxgKEe3EUxdKj8rXaXvPUIO+NpQ/BcI2FLQrJfr8nH0mK6m1yNFEe3VYc64y
3dUTxr1ILS6O2uLvf1ErUdSi7YZOnkAwpyw+mTLF6weCJNisrDCrChjZibeBEtVN
ZdH5ZkKckXegy3N6HM/tDuLGaO5spvxM797gS1tzqesPrMWy+ng9npFwqk6zxM8Y
rtG6G0ddtAk0u6UCEDvoQiYPciNY4F+YhuhesVXZVUe7l09XbZdiDLHXlqR34hVo
9H1qPCfi7DmvRR/mArG4URc9TkbsjsQkZp1s1/3jDFlM6xenM+2SdTy3ncrsMwmx
Ri92BjdOE+VQSdgqexV660yjNB3qYn2AC7/dtgNhaZA7/+p7XSip3NnjTmTr7buL
xoo8sse/sr8viGDCyyWf8Bv/sOvc5pqR0SYu3187BkgkMlAv3Se/lwNT/r+lPqFd
K0w69mMqN+WNEQYHkisE2bKGsuKCWOLt/KTFvDNXQJZsxa4uE2lbNSTXzStsGcAw
rh+d7dV2ylpGxRccUYDb
=dyAB
-----END PGP SIGNATURE-----

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

* [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL
  2012-09-18 19:23               ` Scott Wood
@ 2012-09-18 19:24                 ` Marek Vasut
  0 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-18 19:24 UTC (permalink / raw)
  To: u-boot

Dear Scott Wood,

> On 09/18/2012 01:33:11 PM, Marek Vasut wrote:
> > Dear Scott Wood,
> > 
> > > On 09/18/2012 01:03:17 PM, Marek Vasut wrote:
> > > > I'd say the GCC must optimize it out anyway.
> > > 
> > > I think I got some wires crossed and was thinking about printf/puts.
> > > We want those to be optimized away at compile time (not pointed to a
> > > stub at link time) on an SPL that has no output support, but once
> > > that's done the low level serial functions shouldn't be referenced
> > > anymore, right?
> > 
> > But if you point them to stubs, that's OK. The compiler will GC these
> > useless
> > stubs anyway. But wait, we're getting to LTO here, right?
> > 
> > So the safest bet really is macro in serial.h ?
> 
> For printf/puts, we want something header-based.  For the serial
> functions it depends on whether we have call sites that do not get GCed.

I'm not removing printf() puts() etc. .. only the serial_ goo ... and see my 
other email, not much gain :(

> -Scott

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL
  2012-09-18 19:23                   ` Tom Rini
@ 2012-09-18 19:25                     ` Marek Vasut
  2012-09-18 20:50                       ` Tom Rini
  0 siblings, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-18 19:25 UTC (permalink / raw)
  To: u-boot

Dear Tom Rini,

> On 09/18/12 12:19, Marek Vasut wrote:
> > Dear Tom Rini,
> > 
> >> On 09/18/12 11:33, Marek Vasut wrote:
> >>> Dear Scott Wood,
> >> 
> >> [snip]
> >> 
> >>>> I think I got some wires crossed and was thinking about
> >>>> printf/puts. We want those to be optimized away at compile
> >>>> time (not pointed to a stub at link time) on an SPL that has
> >>>> no output support, but once that's done the low level serial
> >>>> functions shouldn't be referenced anymore, right?
> >>> 
> >>> But if you point them to stubs, that's OK. The compiler will GC
> >>> these useless stubs anyway. But wait, we're getting to LTO
> >>> here, right?
> >>> 
> >>> So the safest bet really is macro in serial.h ?
> >> 
> >> Due to the gcc bug I've mentioned before, yes.  Dummy functions
> >> will, I bet, keep the string constants around.  do {} while(0)
> >> will drop them out entirely.
> > 
> > Damn, not much gain on m28evk (with C functionss/with macros),
> > using gcc 4.7.1:
> > 
> > Configuring for m28evk board... text    data     bss     dec hex
> > filename 418994    7780  288632  715406   aea8e ./u-boot 11773 788
> > 12   12573    311d ./spl/u-boot-spl
> > 
> > Configuring for m28evk board... text    data     bss     dec hex
> > filename 418998    7780  288628  715406   aea8e ./u-boot 11765 788
> > 12   12565    3115 ./spl/u-boot-spl
> 
> Right, didn't have many strings.  But do you see what I mean now about
> not needing this patch as it stands currently?

No, I don't. If I remove this patch, the build breaks either because serial_* is 
defined twice or not defined at all.

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL
  2012-09-18 19:25                     ` Marek Vasut
@ 2012-09-18 20:50                       ` Tom Rini
  2012-09-18 21:19                         ` Marek Vasut
  2012-09-18 22:16                         ` Marek Vasut
  0 siblings, 2 replies; 306+ messages in thread
From: Tom Rini @ 2012-09-18 20:50 UTC (permalink / raw)
  To: u-boot

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/18/12 12:25, Marek Vasut wrote:
> Dear Tom Rini,
> 
>> On 09/18/12 12:19, Marek Vasut wrote:
>>> Dear Tom Rini,
>>> 
>>>> On 09/18/12 11:33, Marek Vasut wrote:
>>>>> Dear Scott Wood,
>>>> 
>>>> [snip]
>>>> 
>>>>>> I think I got some wires crossed and was thinking about 
>>>>>> printf/puts. We want those to be optimized away at
>>>>>> compile time (not pointed to a stub at link time) on an
>>>>>> SPL that has no output support, but once that's done the
>>>>>> low level serial functions shouldn't be referenced
>>>>>> anymore, right?
>>>>> 
>>>>> But if you point them to stubs, that's OK. The compiler
>>>>> will GC these useless stubs anyway. But wait, we're getting
>>>>> to LTO here, right?
>>>>> 
>>>>> So the safest bet really is macro in serial.h ?
>>>> 
>>>> Due to the gcc bug I've mentioned before, yes.  Dummy
>>>> functions will, I bet, keep the string constants around.  do
>>>> {} while(0) will drop them out entirely.
>>> 
>>> Damn, not much gain on m28evk (with C functionss/with macros), 
>>> using gcc 4.7.1:
>>> 
>>> Configuring for m28evk board... text    data     bss     dec
>>> hex filename 418994    7780  288632  715406   aea8e ./u-boot
>>> 11773 788 12   12573    311d ./spl/u-boot-spl
>>> 
>>> Configuring for m28evk board... text    data     bss     dec
>>> hex filename 418998    7780  288628  715406   aea8e ./u-boot
>>> 11765 788 12   12565    3115 ./spl/u-boot-spl
>> 
>> Right, didn't have many strings.  But do you see what I mean now
>> about not needing this patch as it stands currently?
> 
> No, I don't. If I remove this patch, the build breaks either
> because serial_* is defined twice or not defined at all.

m28evk currently, needlessly, defines serial_puts/putc.  I locally
patched master to drop them from arch/arm/cpu/arm926ejs/mxs/spl_boot.c
and the references in common/libcommon.o are correctly
garbage-collected.  They are in fact unused functions today as they're
garbage collected without patching, see spl/u-boot-spl.map after
building.  So again I say, if common/serial.o is NOT being discard in
your series on m28evk there is a bug in your series to fix or a change
to better understand and document (and then see if we can change since
as Scott notes, this needs to work for 4kb boards and that is tight).

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQWN59AAoJENk4IS6UOR1WtG0P/iYMxTtr0X/F6RRhZ9sLlSNt
pj6o+MTd9eO4e64+0A/jyXDuFd9NBvYdsjBKz8iyQFOrUYAyCdKdl+MZ+E3sD57O
gHKVXcfnMS2jnXTvKMabn4Ddjl8FVjLz+YGXFcwqBpcN5KjuyRKJnl4jntrj8QgK
1d9aqYwnQcMbP36ApPS1WRGotAlydhmL9Bw++ebk+j28iBs1KZWiFK1RUCYc1b5T
bverqK4EQTMxOh8KJNvGs5J61bO1BUA3fWHv2kzKo4XEr+XjRkoFVXDb1Tjf1Xlw
ZDaaky+zyq7D4zwZUFJxseDN7dBTuAYNoYj5UhYvkbTO04s60vKzhyuLMDWxyHrx
ABrmisfWB44K6sjQKZUTBvO6gajA8fe9kTg/uaMaG+9h9xyM0oNBfDmDd7/CK6PE
Mi7q9TJ7cOh1DgHrzSrLaO8n5cam4B3XecLH5Rj1uOA5HHCnKExIxWTdeEg4w63b
VQVdgQ7g/2x8TINdjz9oo1B79n+yHlmIHzc64ZNnBAJhVDKM9h9h6FarAvfwLM1B
Ns/vUCrM17vsaduNcvD0ZGDZSk4MOc8dfPLqfLe9rzFH4VAEmTV8qEaFjnbeORiD
jknV1mLAYD1A/eu1AHdwE58OgPgCTKyYxLA4bE/Yldxy1L+E5DUx+nmOnrCNWPPm
dqdGjBg7P4HHZo2mw6oZ
=QI/g
-----END PGP SIGNATURE-----

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

* [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL
  2012-09-18 20:50                       ` Tom Rini
@ 2012-09-18 21:19                         ` Marek Vasut
  2012-09-18 21:51                           ` Scott Wood
  2012-09-18 22:16                         ` Marek Vasut
  1 sibling, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-18 21:19 UTC (permalink / raw)
  To: u-boot

Dear Tom Rini,

> On 09/18/12 12:25, Marek Vasut wrote:
> > Dear Tom Rini,
> > 
> >> On 09/18/12 12:19, Marek Vasut wrote:
> >>> Dear Tom Rini,
> >>> 
> >>>> On 09/18/12 11:33, Marek Vasut wrote:
> >>>>> Dear Scott Wood,
> >>>> 
> >>>> [snip]
> >>>> 
> >>>>>> I think I got some wires crossed and was thinking about
> >>>>>> printf/puts. We want those to be optimized away at
> >>>>>> compile time (not pointed to a stub at link time) on an
> >>>>>> SPL that has no output support, but once that's done the
> >>>>>> low level serial functions shouldn't be referenced
> >>>>>> anymore, right?
> >>>>> 
> >>>>> But if you point them to stubs, that's OK. The compiler
> >>>>> will GC these useless stubs anyway. But wait, we're getting
> >>>>> to LTO here, right?
> >>>>> 
> >>>>> So the safest bet really is macro in serial.h ?
> >>>> 
> >>>> Due to the gcc bug I've mentioned before, yes.  Dummy
> >>>> functions will, I bet, keep the string constants around.  do
> >>>> {} while(0) will drop them out entirely.
> >>> 
> >>> Damn, not much gain on m28evk (with C functionss/with macros),
> >>> using gcc 4.7.1:
> >>> 
> >>> Configuring for m28evk board... text    data     bss     dec
> >>> hex filename 418994    7780  288632  715406   aea8e ./u-boot
> >>> 11773 788 12   12573    311d ./spl/u-boot-spl
> >>> 
> >>> Configuring for m28evk board... text    data     bss     dec
> >>> hex filename 418998    7780  288628  715406   aea8e ./u-boot
> >>> 11765 788 12   12565    3115 ./spl/u-boot-spl
> >> 
> >> Right, didn't have many strings.  But do you see what I mean now
> >> about not needing this patch as it stands currently?
> > 
> > No, I don't. If I remove this patch, the build breaks either
> > because serial_* is defined twice or not defined at all.
> 
> m28evk currently, needlessly, defines serial_puts/putc.  I locally
> patched master to drop them from arch/arm/cpu/arm926ejs/mxs/spl_boot.c
> and the references in common/libcommon.o are correctly
> garbage-collected.  They are in fact unused functions today as they're
> garbage collected without patching, see spl/u-boot-spl.map after
> building.

I'd love to, this is what I get with my patchset when I remove the #ifdef from 
serial.c:

$ ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- ./MAKEALL m28evk
Configuring for m28evk board...
make[1]: *** [/home/marex/U-Boot/u-boot-marex/spl/u-boot-spl] Error 1
make: *** [spl/u-boot-spl.bin] Error 2
arm-linux-gnueabi-size: './u-boot': No such file
common/libcommon.o: In function `get_current':
/home/marex/U-Boot/u-boot-marex/common/serial.c:229: undefined reference to 
`default_serial_console'
make[1]: *** [/home/marex/U-Boot/u-boot-marex/spl/u-boot-spl] Error 1
make: *** [spl/u-boot-spl.bin] Error 2
make: *** Waiting for unfinished jobs....

So someone still has to implement default_serial_console() call. Is that fine ?

> So again I say, if common/serial.o is NOT being discard in
> your series on m28evk there is a bug in your series to fix or a change
> to better understand and document

Ok, I spent hours documenting this series. What else is there to document?

Besides, my team is starting to collect dead weight and we're running behind the 
schedule a lot ... I'm fucked, I'm desperate and I really don't know what to do 
anymore. Pardon if I'm a bit unpleasant to deal with recently.

> (and then see if we can change since
> as Scott notes, this needs to work for 4kb boards and that is tight).

What exactly are the 4k boards?

One more question -- if I have two __weak functions and one non-weak, the non-
weak wins and noone complains, right?

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL
  2012-09-18 21:19                         ` Marek Vasut
@ 2012-09-18 21:51                           ` Scott Wood
  2012-09-19  6:12                             ` Stefan Roese
  0 siblings, 1 reply; 306+ messages in thread
From: Scott Wood @ 2012-09-18 21:51 UTC (permalink / raw)
  To: u-boot

On 09/18/2012 04:19:07 PM, Marek Vasut wrote:
> Dear Tom Rini,
> 
> > (and then see if we can change since
> > as Scott notes, this needs to work for 4kb boards and that is  
> tight).
> 
> What exactly are the 4k boards?

Anything that uses fsl_elbc_nand is 4K.  I think most (all?) of the ppc  
4xx boards are 4K.  fsl_ifc_nand is 8K, though the linker script needs  
some rework to fully take advantage of that.

At least some of the i.MX boards have constraints but I don't know  
exactly what they are.

Maybe some others.

-Scott

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

* [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL
  2012-09-18 20:50                       ` Tom Rini
  2012-09-18 21:19                         ` Marek Vasut
@ 2012-09-18 22:16                         ` Marek Vasut
  1 sibling, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-18 22:16 UTC (permalink / raw)
  To: u-boot

Dear Tom Rini,

> On 09/18/12 12:25, Marek Vasut wrote:
> > Dear Tom Rini,
> > 
> >> On 09/18/12 12:19, Marek Vasut wrote:
> >>> Dear Tom Rini,
> >>> 
> >>>> On 09/18/12 11:33, Marek Vasut wrote:
> >>>>> Dear Scott Wood,
> >>>> 
> >>>> [snip]
> >>>> 
> >>>>>> I think I got some wires crossed and was thinking about
> >>>>>> printf/puts. We want those to be optimized away at
> >>>>>> compile time (not pointed to a stub at link time) on an
> >>>>>> SPL that has no output support, but once that's done the
> >>>>>> low level serial functions shouldn't be referenced
> >>>>>> anymore, right?
> >>>>> 
> >>>>> But if you point them to stubs, that's OK. The compiler
> >>>>> will GC these useless stubs anyway. But wait, we're getting
> >>>>> to LTO here, right?
> >>>>> 
> >>>>> So the safest bet really is macro in serial.h ?
> >>>> 
> >>>> Due to the gcc bug I've mentioned before, yes.  Dummy
> >>>> functions will, I bet, keep the string constants around.  do
> >>>> {} while(0) will drop them out entirely.
> >>> 
> >>> Damn, not much gain on m28evk (with C functionss/with macros),
> >>> using gcc 4.7.1:
> >>> 
> >>> Configuring for m28evk board... text    data     bss     dec
> >>> hex filename 418994    7780  288632  715406   aea8e ./u-boot
> >>> 11773 788 12   12573    311d ./spl/u-boot-spl
> >>> 
> >>> Configuring for m28evk board... text    data     bss     dec
> >>> hex filename 418998    7780  288628  715406   aea8e ./u-boot
> >>> 11765 788 12   12565    3115 ./spl/u-boot-spl
> >> 
> >> Right, didn't have many strings.  But do you see what I mean now
> >> about not needing this patch as it stands currently?
> > 
> > No, I don't. If I remove this patch, the build breaks either
> > because serial_* is defined twice or not defined at all.
> 
> m28evk currently, needlessly, defines serial_puts/putc.  I locally
> patched master to drop them from arch/arm/cpu/arm926ejs/mxs/spl_boot.c
> and the references in common/libcommon.o are correctly
> garbage-collected.  They are in fact unused functions today as they're
> garbage collected without patching, see spl/u-boot-spl.map after
> building.  So again I say, if common/serial.o is NOT being discard in
> your series on m28evk there is a bug in your series to fix or a change
> to better understand and document (and then see if we can change since
> as Scott notes, this needs to work for 4kb boards and that is tight).

Ok, so we cleared this up on jabber, latest ToT works correctly, discard this 
patch.

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 41/71] serial: arm: Implement CONFIG_SERIAL_MULTI into atmel serial driver
  2012-09-16 23:21 ` [U-Boot] [PATCH 41/71] serial: arm: Implement CONFIG_SERIAL_MULTI into atmel " Marek Vasut
  2012-09-17  6:51   ` Andreas Bießmann
@ 2012-09-18 23:45   ` Andreas Bießmann
  1 sibling, 0 replies; 306+ messages in thread
From: Andreas Bießmann @ 2012-09-18 23:45 UTC (permalink / raw)
  To: u-boot

Dear Marek Vasut,

On 17.09.2012 01:21, Marek Vasut wrote:
> Implement support for CONFIG_SERIAL_MULTI into atmel serial driver.
> This driver was so far only usable directly, but this patch also adds
> support for the multi method. This allows using more than one serial
> driver alongside the atmel driver. Also, add a weak implementation
> of default_serial_console() returning this driver.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Tom Rini <trini@ti.com>
> Cc: Xu, Hong <Hong.Xu@atmel.com>
> ---

whole series runtime tested on avr32 and at91sam9260ek, therefore

Acked-by: Andreas Bie?mann <andreas.devel@googlemail.com>

Best regards

Andreas Bie?mann

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

* [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL
  2012-09-18 21:51                           ` Scott Wood
@ 2012-09-19  6:12                             ` Stefan Roese
  2012-09-19 19:14                               ` Scott Wood
  0 siblings, 1 reply; 306+ messages in thread
From: Stefan Roese @ 2012-09-19  6:12 UTC (permalink / raw)
  To: u-boot

On 09/18/2012 11:51 PM, Scott Wood wrote:
>>> (and then see if we can change since
>>> as Scott notes, this needs to work for 4kb boards and that is  
>> tight).
>>
>> What exactly are the 4k boards?
> 
> Anything that uses fsl_elbc_nand is 4K.  I think most (all?) of the ppc  
> 4xx boards are 4K.

Yes. All ppc4xx boards with "old" nand_spl support are 4KiB. And they
don't use serial at all right now.

Thanks,
Stefan

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

* [U-Boot] [PATCH 27/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into iop480 serial driver
  2012-09-16 23:20 ` [U-Boot] [PATCH 27/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into iop480 " Marek Vasut
@ 2012-09-19 10:59   ` Stefan Roese
  0 siblings, 0 replies; 306+ messages in thread
From: Stefan Roese @ 2012-09-19 10:59 UTC (permalink / raw)
  To: u-boot

On 09/17/2012 01:20 AM, Marek Vasut wrote:
> Implement support for CONFIG_SERIAL_MULTI into iop480 serial driver.
> This driver was so far only usable directly, but this patch also adds
> support for the multi method. This allows using more than one serial
> driver alongside the iop480 driver. Also, add a weak implementation
> of default_serial_console() returning this driver.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Tom Rini <trini@ti.com>
> Cc: Anatolij Gustschin <agust@denx.de>
> Cc: Stefan Roese <sr@denx.de>

Acked-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: office at denx.de

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

* [U-Boot] [PATCH 31/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into amirix serial driver
  2012-09-16 23:20 ` [U-Boot] [PATCH 31/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into amirix " Marek Vasut
@ 2012-09-19 11:05   ` Stefan Roese
  2012-09-19 11:27     ` Marek Vasut
  0 siblings, 1 reply; 306+ messages in thread
From: Stefan Roese @ 2012-09-19 11:05 UTC (permalink / raw)
  To: u-boot

On 09/17/2012 01:20 AM, Marek Vasut wrote:
> Implement support for CONFIG_SERIAL_MULTI into amirix serial driver.
> This driver was so far only usable directly, but this patch also adds
> support for the multi method. This allows using more than one serial
> driver alongside the amirix driver. Also, add a weak implementation
> of default_serial_console() returning this driver.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Tom Rini <trini@ti.com>
> Cc: Anatolij Gustschin <agust@denx.de>
> Cc: Stefan Roese <sr@denx.de>

This looks like a standard NS16550 implementation. Why not use the
common driver then? Also, this board doesn't seem actively maintained. I
cc'ed Frank Smith as author of this board port.

Frank, is this board still in production? Or does it make sense to
remove this board from mainline completely?

Thanks,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: office at denx.de

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

* [U-Boot] [PATCH 32/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw serial driver
  2012-09-16 23:20 ` [U-Boot] [PATCH 32/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw " Marek Vasut
@ 2012-09-19 11:09   ` Stefan Roese
  2012-09-19 11:28     ` Marek Vasut
  0 siblings, 1 reply; 306+ messages in thread
From: Stefan Roese @ 2012-09-19 11:09 UTC (permalink / raw)
  To: u-boot

On 09/17/2012 01:20 AM, Marek Vasut wrote:
> Implement support for CONFIG_SERIAL_MULTI into bmw serial driver.
> This driver was so far only usable directly, but this patch also adds
> support for the multi method. This allows using more than one serial
> driver alongside the bmw driver. Also, add a weak implementation
> of default_serial_console() returning this driver.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Tom Rini <trini@ti.com>
> Cc: Anatolij Gustschin <agust@denx.de>
> Cc: Stefan Roese <sr@denx.de>

Again, NS16550 driver here. This code shouldn't be necessary. Also this
board looks quite unmaintained as well. Perhaps its time to remove it
from mainline? Not sure whom to ask, since no maintainer is listed.

Thanks,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: office at denx.de

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

* [U-Boot] [PATCH 36/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into ml2 serial driver
  2012-09-16 23:21 ` [U-Boot] [PATCH 36/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into ml2 " Marek Vasut
@ 2012-09-19 11:21   ` Stefan Roese
  0 siblings, 0 replies; 306+ messages in thread
From: Stefan Roese @ 2012-09-19 11:21 UTC (permalink / raw)
  To: u-boot

On 09/17/2012 01:21 AM, Marek Vasut wrote:
> Implement support for CONFIG_SERIAL_MULTI into ml2 serial driver.
> This driver was so far only usable directly, but this patch also adds
> support for the multi method. This allows using more than one serial
> driver alongside the ml2 driver. Also, add a weak implementation
> of default_serial_console() returning this driver.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Tom Rini <trini@ti.com>
> Cc: Anatolij Gustschin <agust@denx.de>
> Cc: Stefan Roese <sr@denx.de>

Again NS16550 compatible. This file should not be needed. Could be moved
to common driver, but needs testing. Board seems unmaintained, so remove it?

Thanks,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: office at denx.de

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

* [U-Boot] [PATCH 31/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into amirix serial driver
  2012-09-19 11:05   ` Stefan Roese
@ 2012-09-19 11:27     ` Marek Vasut
  0 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-19 11:27 UTC (permalink / raw)
  To: u-boot

Dear Stefan Roese,

> On 09/17/2012 01:20 AM, Marek Vasut wrote:
> > Implement support for CONFIG_SERIAL_MULTI into amirix serial driver.
> > This driver was so far only usable directly, but this patch also adds
> > support for the multi method. This allows using more than one serial
> > driver alongside the amirix driver. Also, add a weak implementation
> > of default_serial_console() returning this driver.
> > 
> > Signed-off-by: Marek Vasut <marex@denx.de>
> > Cc: Marek Vasut <marek.vasut@gmail.com>
> > Cc: Tom Rini <trini@ti.com>
> > Cc: Anatolij Gustschin <agust@denx.de>
> > Cc: Stefan Roese <sr@denx.de>
> 
> This looks like a standard NS16550 implementation. Why not use the
> common driver then? Also, this board doesn't seem actively maintained. I
> cc'ed Frank Smith as author of this board port.
> 
> Frank, is this board still in production? Or does it make sense to
> remove this board from mainline completely?

It's not the only one that reimplements NS16550. I didn't clean it up to avoid 
breakage.

> Thanks,
> Stefan
> 
> --
> DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: office at denx.de

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 32/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw serial driver
  2012-09-19 11:09   ` Stefan Roese
@ 2012-09-19 11:28     ` Marek Vasut
  2012-09-19 11:32       ` Stefan Roese
  0 siblings, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-19 11:28 UTC (permalink / raw)
  To: u-boot

Dear Stefan Roese,

> On 09/17/2012 01:20 AM, Marek Vasut wrote:
> > Implement support for CONFIG_SERIAL_MULTI into bmw serial driver.
> > This driver was so far only usable directly, but this patch also adds
> > support for the multi method. This allows using more than one serial
> > driver alongside the bmw driver. Also, add a weak implementation
> > of default_serial_console() returning this driver.
> > 
> > Signed-off-by: Marek Vasut <marex@denx.de>
> > Cc: Marek Vasut <marek.vasut@gmail.com>
> > Cc: Tom Rini <trini@ti.com>
> > Cc: Anatolij Gustschin <agust@denx.de>
> > Cc: Stefan Roese <sr@denx.de>
> 
> Again, NS16550 driver here. This code shouldn't be necessary. Also this
> board looks quite unmaintained as well. Perhaps its time to remove it
> from mainline? Not sure whom to ask, since no maintainer is listed.

Exactly :-(

Shall we not simply remove all boards that obviously miss maintainer?

> Thanks,
> Stefan
> 
> --
> DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: office at denx.de

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 32/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw serial driver
  2012-09-19 11:28     ` Marek Vasut
@ 2012-09-19 11:32       ` Stefan Roese
  2012-09-19 17:43         ` Tom Rini
  0 siblings, 1 reply; 306+ messages in thread
From: Stefan Roese @ 2012-09-19 11:32 UTC (permalink / raw)
  To: u-boot

Hi Marek,

On 09/19/2012 01:28 PM, Marek Vasut wrote:
>> Again, NS16550 driver here. This code shouldn't be necessary. Also this
>> board looks quite unmaintained as well. Perhaps its time to remove it
>> from mainline? Not sure whom to ask, since no maintainer is listed.
> 
> Exactly :-(
> 
> Shall we not simply remove all boards that obviously miss maintainer?

I'm all for it. I'm currently working on a patch to remove support for
the IOP480 platforms completely (ppc40x derivate). Some other boards
might be good candidates as well...

Thanks,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: office at denx.de

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

* [U-Boot] [PATCH 32/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw serial driver
  2012-09-19 11:32       ` Stefan Roese
@ 2012-09-19 17:43         ` Tom Rini
  2012-09-19 19:32           ` Marek Vasut
  0 siblings, 1 reply; 306+ messages in thread
From: Tom Rini @ 2012-09-19 17:43 UTC (permalink / raw)
  To: u-boot

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/19/12 04:32, Stefan Roese wrote:
> Hi Marek,
> 
> On 09/19/2012 01:28 PM, Marek Vasut wrote:
>>> Again, NS16550 driver here. This code shouldn't be necessary. 
>>> Also this board looks quite unmaintained as well. Perhaps its 
>>> time to remove it from mainline? Not sure whom to ask, since no
>>> maintainer is listed.
>> 
>> Exactly :-(
>> 
>> Shall we not simply remove all boards that obviously miss 
>> maintainer?
> 
> I'm all for it. I'm currently working on a patch to remove support
>  for the IOP480 platforms completely (ppc40x derivate). Some other
>  boards might be good candidates as well...

Since Marek has poked me about this in a few other contexts as well,
let me state my position for the moment.  Whatever boards a custodian
is the de facto maintainer for and they don't believe makes sense to
continue carrying forward in mainline, they can and should submit
patches to remove.  Conversely, if the custodian says "I'm fine
carrying these platforms", that's what they can and should do.

And I have a few other things to say too, so I'll save that for a bit
later once I'm done drafting and considering.

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQWgRQAAoJENk4IS6UOR1WN18P/3avi6PLCEXClbrR5kMqs4aw
Ci3rRozlVIyewGhEk9DmKJev0SQxVeV+LF9MrKtQDi78sW2Mh42xGC8l4zZmSxHe
bOJsmKsrDl68b7kP0aFP9yhcdEZUEVJhXNGcAwAO1DlmlB6zPG6doCMg0T4RpoPp
33nrca7nJnQ9mv8bVmiQ5Qx/qz76TgQSpPZ8jCQIND0LBITdo5PZU9ic4gxt+eDL
O/I+X7cwfs5N8nPD4lzVga2eivWKheByQtJHgz+T/Zh7bEk8oiwlVTwwD7IgoKam
LF6F9zXjSHmc5m23ZClCLp1nDfsIqvqf67AUSCGxHkBpzEVBQLsdP/t17yo2/WNS
D1YWER1Ps3/VpalQpnzy+eTy8RyY4dFFF+UK4HB+q7lSlw3Ykxmc1MTpxKq03dGZ
9F9irTVFRQ4+TpMa3tsjd3MzaGcgJbrOtKjLHf8ULRo2SPnB+S3FpgHEszDphMfz
CxpNih0qruahBEx38ygMDiH+M1msoAyp27pPAFou5m7q73XTIevZmmm4+hCXeXE5
rnUSA00mihajv8FM3MGdG+9khEFN49lBY6FTyclmm4TAM1BpVeG2voN6Ma+yRwI4
FooBJP5nNMSc/tZQNCFiLQIla3SL9CAdJKAL+J/vO0En/Id1p1tpLS5lm95LkVZw
v5XbIZ7XRLYde0VoN76i
=WkII
-----END PGP SIGNATURE-----

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

* [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL
  2012-09-19  6:12                             ` Stefan Roese
@ 2012-09-19 19:14                               ` Scott Wood
  0 siblings, 0 replies; 306+ messages in thread
From: Scott Wood @ 2012-09-19 19:14 UTC (permalink / raw)
  To: u-boot

On 09/19/2012 01:12:17 AM, Stefan Roese wrote:
> On 09/18/2012 11:51 PM, Scott Wood wrote:
> >>> (and then see if we can change since
> >>> as Scott notes, this needs to work for 4kb boards and that is
> >> tight).
> >>
> >> What exactly are the 4k boards?
> >
> > Anything that uses fsl_elbc_nand is 4K.  I think most (all?) of the  
> ppc
> > 4xx boards are 4K.
> 
> Yes. All ppc4xx boards with "old" nand_spl support are 4KiB. And they
> don't use serial at all right now.

The FSL 4K boards use serial (but not printf) with  
CONFIG_NS16550_MIN_FUNCTIONS.

-Scott

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

* [U-Boot] [PATCH 32/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw serial driver
  2012-09-19 17:43         ` Tom Rini
@ 2012-09-19 19:32           ` Marek Vasut
  2012-09-19 22:37             ` Tom Rini
  0 siblings, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-19 19:32 UTC (permalink / raw)
  To: u-boot

Dear Tom Rini,

> On 09/19/12 04:32, Stefan Roese wrote:
> > Hi Marek,
> > 
> > On 09/19/2012 01:28 PM, Marek Vasut wrote:
> >>> Again, NS16550 driver here. This code shouldn't be necessary.
> >>> Also this board looks quite unmaintained as well. Perhaps its
> >>> time to remove it from mainline? Not sure whom to ask, since no
> >>> maintainer is listed.
> >> 
> >> Exactly :-(
> >> 
> >> Shall we not simply remove all boards that obviously miss
> >> maintainer?
> > 
> > I'm all for it. I'm currently working on a patch to remove support
> > 
> >  for the IOP480 platforms completely (ppc40x derivate). Some other
> >  boards might be good candidates as well...
> 
> Since Marek has poked me about this in a few other contexts as well,
> let me state my position for the moment.

I did, yet I was much less polite ;-)

> Whatever boards a custodian

I can't parse this :-(

> is the de facto maintainer for and they don't believe makes sense to
> continue carrying forward in mainline, they can and should submit
> patches to remove.  Conversely, if the custodian says "I'm fine
> carrying these platforms", that's what they can and should do.
> 
> And I have a few other things to say too, so I'll save that for a bit
> later once I'm done drafting and considering.

Drafting what exactly please?

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 32/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw serial driver
  2012-09-19 19:32           ` Marek Vasut
@ 2012-09-19 22:37             ` Tom Rini
  2012-09-19 22:43               ` Marek Vasut
  2012-09-19 22:49               ` Graeme Russ
  0 siblings, 2 replies; 306+ messages in thread
From: Tom Rini @ 2012-09-19 22:37 UTC (permalink / raw)
  To: u-boot

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/19/12 12:32, Marek Vasut wrote:
> Dear Tom Rini,
> 
>> On 09/19/12 04:32, Stefan Roese wrote:
>>> Hi Marek,
>>> 
>>> On 09/19/2012 01:28 PM, Marek Vasut wrote:
>>>>> Again, NS16550 driver here. This code shouldn't be
>>>>> necessary. Also this board looks quite unmaintained as
>>>>> well. Perhaps its time to remove it from mainline? Not sure
>>>>> whom to ask, since no maintainer is listed.
>>>> 
>>>> Exactly :-(
>>>> 
>>>> Shall we not simply remove all boards that obviously miss 
>>>> maintainer?
>>> 
>>> I'm all for it. I'm currently working on a patch to remove
>>> support
>>> 
>>> for the IOP480 platforms completely (ppc40x derivate). Some
>>> other boards might be good candidates as well...
>> 
>> Since Marek has poked me about this in a few other contexts as
>> well, let me state my position for the moment.
> 
> I did, yet I was much less polite ;-)
> 
>> Whatever boards a custodian
> 
> I can't parse this :-(

Well, we have custodians for various areas and board maintainers.
Since not all boards have a maintainer listed, the custodian for the
area is the de facto maintainer.

>> is the de facto maintainer for and they don't believe makes sense
>> to continue carrying forward in mainline, they can and should
>> submit patches to remove.  Conversely, if the custodian says "I'm
>> fine carrying these platforms", that's what they can and should
>> do.
>> 
>> And I have a few other things to say too, so I'll save that for a
>> bit later once I'm done drafting and considering.
> 
> Drafting what exactly please?

A more elaborate set of statements on my feelings about "old" boards
and what needs to happen, in light of the facts that the code is
messy, will require updating for DM and likelyhood of a small but
devoted community around some of them.

- -- 
Tom

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQWkknAAoJENk4IS6UOR1WmJMP/jXzOePKSp2j7th+1ylY+IXw
H1QG+vKRWkXWs90XQLqL0kIUVzZUS1Js1kZeypGmMCmUj+crbb4zTuz2QAN0yL6X
8vIf9oM9CQtoFtdtkrF9NYNHmM22Q1GeEnoOW8dbA+HTLCVSd334cN3qfyYfqoVM
8SZB7+9rqskdjln2gn375QlWK9BI72ammCSNaXMfVPyHNkbuL86Uo1ddhiNvAu3O
tsQ4VFkI8lP6yd122fhWZ95OAM+zLqFD1najwF8LeF3yuxtB1Kh3ssDeOwoH5Ayf
IRN17FYf+tvpfFifITdxq41/vtlfhARz6JjT4yAcaYkEhlzNbh4Frd8YxHGjOsSS
hMf9SkPQiM87C4MA0IBcWkBOVnIOvUsqJJy6uz4tcaxqs5eVUUvdQVKVh2ccfDav
00EFt/x/mOVCkZGB62ku9Iw7fQegT9iGVqYOkmjYD6Ad1Yo/QhVdSbj07xZPZevJ
TXEmRa97LtP4Oax4WcBHLkY5h/rDYJPJLfrHLQMEm2mPVadzBob3oSFZs9H3Qf4J
BzkX9ZgD7YYQCVA73zwfAV5S9VstlT4i0mnYFkOvZSNXSHADptcjCCyvsQ8/Czni
CkGYlr+67UMXM28zASXbfcmitoEbG7GZF/JQFZ/L9JsJrs2fKFqXfMEWnSBm+w4q
urE5QPgZNQmYZn5ZjX26
=K+Oe
-----END PGP SIGNATURE-----

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

* [U-Boot] [PATCH 32/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw serial driver
  2012-09-19 22:37             ` Tom Rini
@ 2012-09-19 22:43               ` Marek Vasut
  2012-09-19 22:49               ` Graeme Russ
  1 sibling, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-19 22:43 UTC (permalink / raw)
  To: u-boot

Dear Tom Rini,

> On 09/19/12 12:32, Marek Vasut wrote:
> > Dear Tom Rini,
> > 
> >> On 09/19/12 04:32, Stefan Roese wrote:
> >>> Hi Marek,
> >>> 
> >>> On 09/19/2012 01:28 PM, Marek Vasut wrote:
> >>>>> Again, NS16550 driver here. This code shouldn't be
> >>>>> necessary. Also this board looks quite unmaintained as
> >>>>> well. Perhaps its time to remove it from mainline? Not sure
> >>>>> whom to ask, since no maintainer is listed.
> >>>> 
> >>>> Exactly :-(
> >>>> 
> >>>> Shall we not simply remove all boards that obviously miss
> >>>> maintainer?
> >>> 
> >>> I'm all for it. I'm currently working on a patch to remove
> >>> support
> >>> 
> >>> for the IOP480 platforms completely (ppc40x derivate). Some
> >>> other boards might be good candidates as well...
> >> 
> >> Since Marek has poked me about this in a few other contexts as
> >> well, let me state my position for the moment.
> > 
> > I did, yet I was much less polite ;-)
> > 
> >> Whatever boards a custodian
> > 
> > I can't parse this :-(
> 
> Well, we have custodians for various areas and board maintainers.
> Since not all boards have a maintainer listed, the custodian for the
> area is the de facto maintainer.

Ok, now I understand.

> >> is the de facto maintainer for and they don't believe makes sense
> >> to continue carrying forward in mainline, they can and should
> >> submit patches to remove.  Conversely, if the custodian says "I'm
> >> fine carrying these platforms", that's what they can and should
> >> do.
> >> 
> >> And I have a few other things to say too, so I'll save that for a
> >> bit later once I'm done drafting and considering.
> > 
> > Drafting what exactly please?
> 
> A more elaborate set of statements on my feelings about "old" boards
> and what needs to happen, in light of the facts that the code is
> messy, will require updating for DM and likelyhood of a small but
> devoted community around some of them.

I see ... eagerly waiting.

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 32/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw serial driver
  2012-09-19 22:37             ` Tom Rini
  2012-09-19 22:43               ` Marek Vasut
@ 2012-09-19 22:49               ` Graeme Russ
  2012-09-19 22:57                 ` Marek Vasut
  2012-09-19 23:16                 ` Tom Rini
  1 sibling, 2 replies; 306+ messages in thread
From: Graeme Russ @ 2012-09-19 22:49 UTC (permalink / raw)
  To: u-boot

Hi Tom,

On Thu, Sep 20, 2012 at 8:37 AM, Tom Rini <trini@ti.com> wrote:

> A more elaborate set of statements on my feelings about "old" boards
> and what needs to happen, in light of the facts that the code is
> messy, will require updating for DM and likelyhood of a small but
> devoted community around some of them.

My gut feeling on this is to either move unmaintained / inactive
boards to a separate board directory, or add a flag to boards.cfg (If
we add a flag to boards.cfg then we can specify that MAKEALL should
skip those boards)

Either way, we can then let them bit-rot (I know, bad words) but at
least if someone comes along with an actual board, they have a place
to start. This is what happened to me with the x86 arch - the existing
code was horribly broken, but at least I had a solid foundation to
start reinvigorating it.

Regards,

Graeme

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

* [U-Boot] [PATCH 32/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw serial driver
  2012-09-19 22:49               ` Graeme Russ
@ 2012-09-19 22:57                 ` Marek Vasut
  2012-09-19 23:03                   ` Scott Wood
  2012-09-19 23:05                   ` Graeme Russ
  2012-09-19 23:16                 ` Tom Rini
  1 sibling, 2 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-19 22:57 UTC (permalink / raw)
  To: u-boot

Dear Graeme Russ,

> Hi Tom,
> 
> On Thu, Sep 20, 2012 at 8:37 AM, Tom Rini <trini@ti.com> wrote:
> > A more elaborate set of statements on my feelings about "old" boards
> > and what needs to happen, in light of the facts that the code is
> > messy, will require updating for DM and likelyhood of a small but
> > devoted community around some of them.
> 
> My gut feeling on this is to either move unmaintained / inactive
> boards to a separate board directory

And hoard crap? No, you can dig them from git history, the objects will still be 
there.

> or add a flag to boards.cfg (If
> we add a flag to boards.cfg then we can specify that MAKEALL should
> skip those boards)
> 
> Either way, we can then let them bit-rot

I disagree

> (I know, bad words) but at
> least if someone comes along with an actual board, they have a place
> to start.

They can retrieve it from git history and re-add it in such unlikely case.

> This is what happened to me with the x86 arch - the existing
> code was horribly broken, but at least I had a solid foundation to
> start reinvigorating it.

It's still horribly broken, but that's partly because of x86 itself is a 
horribly broken CPU :-)

> Regards,
> 
> Graeme

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 32/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw serial driver
  2012-09-19 22:57                 ` Marek Vasut
@ 2012-09-19 23:03                   ` Scott Wood
  2012-09-19 23:05                     ` Marek Vasut
  2012-09-19 23:05                     ` Graeme Russ
  2012-09-19 23:05                   ` Graeme Russ
  1 sibling, 2 replies; 306+ messages in thread
From: Scott Wood @ 2012-09-19 23:03 UTC (permalink / raw)
  To: u-boot

On 09/19/2012 05:57:56 PM, Marek Vasut wrote:
> Dear Graeme Russ,
> 
> > Hi Tom,
> >
> > On Thu, Sep 20, 2012 at 8:37 AM, Tom Rini <trini@ti.com> wrote:
> > > A more elaborate set of statements on my feelings about "old"  
> boards
> > > and what needs to happen, in light of the facts that the code is
> > > messy, will require updating for DM and likelyhood of a small but
> > > devoted community around some of them.
> >
> > My gut feeling on this is to either move unmaintained / inactive
> > boards to a separate board directory
> 
> And hoard crap? No, you can dig them from git history, the objects  
> will still be
> there.
> 
> > or add a flag to boards.cfg (If
> > we add a flag to boards.cfg then we can specify that MAKEALL should
> > skip those boards)
> >
> > Either way, we can then let them bit-rot
> 
> I disagree
> 
> > (I know, bad words) but at
> > least if someone comes along with an actual board, they have a place
> > to start.
> 
> They can retrieve it from git history and re-add it in such unlikely  
> case.
> 
> > This is what happened to me with the x86 arch - the existing
> > code was horribly broken, but at least I had a solid foundation to
> > start reinvigorating it.
> 
> It's still horribly broken, but that's partly because of x86 itself  
> is a
> horribly broken CPU :-)

Maybe have a GRAVEYARD file that lists hardware support and other  
notable features that have been removed, so it's easy for someone to  
tell whether digging through the git history might be fruitful.

-Scott

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

* [U-Boot] [PATCH 32/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw serial driver
  2012-09-19 22:57                 ` Marek Vasut
  2012-09-19 23:03                   ` Scott Wood
@ 2012-09-19 23:05                   ` Graeme Russ
  2012-09-19 23:07                     ` Marek Vasut
  1 sibling, 1 reply; 306+ messages in thread
From: Graeme Russ @ 2012-09-19 23:05 UTC (permalink / raw)
  To: u-boot

Hi Marek,

On Thu, Sep 20, 2012 at 8:57 AM, Marek Vasut <marex@denx.de> wrote:
> Dear Graeme Russ,

>> This is what happened to me with the x86 arch - the existing
>> code was horribly broken, but at least I had a solid foundation to
>> start reinvigorating it.
>
> It's still horribly broken, but that's partly because of x86 itself is a

Only because every other bugger here keeps breaking it because they
don't test the impact of their code, forcing me to go back and keep
fixing it :P

> horribly broken CPU :-)

At least it's cache handling isn't as crap as ARM :P

Regards,

Graeme

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

* [U-Boot] [PATCH 32/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw serial driver
  2012-09-19 23:03                   ` Scott Wood
@ 2012-09-19 23:05                     ` Marek Vasut
  2012-09-19 23:10                       ` Scott Wood
  2012-09-19 23:05                     ` Graeme Russ
  1 sibling, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-19 23:05 UTC (permalink / raw)
  To: u-boot

Dear Scott Wood,

> On 09/19/2012 05:57:56 PM, Marek Vasut wrote:
> > Dear Graeme Russ,
> > 
> > > Hi Tom,
> > > 
> > > On Thu, Sep 20, 2012 at 8:37 AM, Tom Rini <trini@ti.com> wrote:
> > > > A more elaborate set of statements on my feelings about "old"
> > 
> > boards
> > 
> > > > and what needs to happen, in light of the facts that the code is
> > > > messy, will require updating for DM and likelyhood of a small but
> > > > devoted community around some of them.
> > > 
> > > My gut feeling on this is to either move unmaintained / inactive
> > > boards to a separate board directory
> > 
> > And hoard crap? No, you can dig them from git history, the objects
> > will still be
> > there.
> > 
> > > or add a flag to boards.cfg (If
> > > we add a flag to boards.cfg then we can specify that MAKEALL should
> > > skip those boards)
> > > 
> > > Either way, we can then let them bit-rot
> > 
> > I disagree
> > 
> > > (I know, bad words) but at
> > > least if someone comes along with an actual board, they have a place
> > > to start.
> > 
> > They can retrieve it from git history and re-add it in such unlikely
> > case.
> > 
> > > This is what happened to me with the x86 arch - the existing
> > > code was horribly broken, but at least I had a solid foundation to
> > > start reinvigorating it.
> > 
> > It's still horribly broken, but that's partly because of x86 itself
> > is a
> > horribly broken CPU :-)
> 
> Maybe have a GRAVEYARD file that lists hardware support and other
> notable features that have been removed, so it's easy for someone to
> tell whether digging through the git history might be fruitful.

Like doc/README.scrapyard ?

> -Scott

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 32/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw serial driver
  2012-09-19 23:03                   ` Scott Wood
  2012-09-19 23:05                     ` Marek Vasut
@ 2012-09-19 23:05                     ` Graeme Russ
  2012-09-19 23:08                       ` Marek Vasut
  1 sibling, 1 reply; 306+ messages in thread
From: Graeme Russ @ 2012-09-19 23:05 UTC (permalink / raw)
  To: u-boot

Hi Scott,

On Thu, Sep 20, 2012 at 9:03 AM, Scott Wood <scottwood@freescale.com> wrote:
> On 09/19/2012 05:57:56 PM, Marek Vasut wrote:

> Maybe have a GRAVEYARD file that lists hardware support and other notable
> features that have been removed, so it's easy for someone to tell whether
> digging through the git history might be fruitful.

In the immortal words of Monty Python - "We already got one!"

Regards,

Graeme

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

* [U-Boot] [PATCH 32/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw serial driver
  2012-09-19 23:05                   ` Graeme Russ
@ 2012-09-19 23:07                     ` Marek Vasut
  0 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-19 23:07 UTC (permalink / raw)
  To: u-boot

Dear Graeme Russ,

> Hi Marek,
> 
> On Thu, Sep 20, 2012 at 8:57 AM, Marek Vasut <marex@denx.de> wrote:
> > Dear Graeme Russ,
> > 
> >> This is what happened to me with the x86 arch - the existing
> >> code was horribly broken, but at least I had a solid foundation to
> >> start reinvigorating it.
> > 
> > It's still horribly broken, but that's partly because of x86 itself is a
> 
> Only because every other bugger here keeps breaking it because they
> don't test the impact of their code, forcing me to go back and keep
> fixing it :P

Your work is so appreciated, you're our savior :-b

> > horribly broken CPU :-)
> 
> At least it's cache handling isn't as crap as ARM :P

Yep, you're right, we're still missing instructions to flush various insane 
patterns in cache :-b

> Regards,
> 
> Graeme

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 32/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw serial driver
  2012-09-19 23:05                     ` Graeme Russ
@ 2012-09-19 23:08                       ` Marek Vasut
  0 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-19 23:08 UTC (permalink / raw)
  To: u-boot

Dear Graeme Russ,

> Hi Scott,
> 
> On Thu, Sep 20, 2012 at 9:03 AM, Scott Wood <scottwood@freescale.com> wrote:
> > On 09/19/2012 05:57:56 PM, Marek Vasut wrote:
> > 
> > Maybe have a GRAVEYARD file that lists hardware support and other notable
> > features that have been removed, so it's easy for someone to tell whether
> > digging through the git history might be fruitful.
> 
> In the immortal words of Monty Python - "We already got one!"

So say we all %^)
--BSG

> Regards,
> 
> Graeme

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 32/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw serial driver
  2012-09-19 23:05                     ` Marek Vasut
@ 2012-09-19 23:10                       ` Scott Wood
  2012-09-19 23:13                         ` Marek Vasut
  0 siblings, 1 reply; 306+ messages in thread
From: Scott Wood @ 2012-09-19 23:10 UTC (permalink / raw)
  To: u-boot

On 09/19/2012 06:05:22 PM, Marek Vasut wrote:
> Dear Scott Wood,
> 
> > On 09/19/2012 05:57:56 PM, Marek Vasut wrote:
> > > Dear Graeme Russ,
> > >
> > > > Hi Tom,
> > > >
> > > > On Thu, Sep 20, 2012 at 8:37 AM, Tom Rini <trini@ti.com> wrote:
> > > > > A more elaborate set of statements on my feelings about "old"
> > >
> > > boards
> > >
> > > > > and what needs to happen, in light of the facts that the code  
> is
> > > > > messy, will require updating for DM and likelyhood of a small  
> but
> > > > > devoted community around some of them.
> > > >
> > > > My gut feeling on this is to either move unmaintained / inactive
> > > > boards to a separate board directory
> > >
> > > And hoard crap? No, you can dig them from git history, the objects
> > > will still be
> > > there.
> > >
> > > > or add a flag to boards.cfg (If
> > > > we add a flag to boards.cfg then we can specify that MAKEALL  
> should
> > > > skip those boards)
> > > >
> > > > Either way, we can then let them bit-rot
> > >
> > > I disagree
> > >
> > > > (I know, bad words) but at
> > > > least if someone comes along with an actual board, they have a  
> place
> > > > to start.
> > >
> > > They can retrieve it from git history and re-add it in such  
> unlikely
> > > case.
> > >
> > > > This is what happened to me with the x86 arch - the existing
> > > > code was horribly broken, but at least I had a solid foundation  
> to
> > > > start reinvigorating it.
> > >
> > > It's still horribly broken, but that's partly because of x86  
> itself
> > > is a
> > > horribly broken CPU :-)
> >
> > Maybe have a GRAVEYARD file that lists hardware support and other
> > notable features that have been removed, so it's easy for someone to
> > tell whether digging through the git history might be fruitful.
> 
> Like doc/README.scrapyard ?

Heh.  Yes, except maybe more prominent so people would know it exists.  
:-)

That file does seem a bit board-centric; drivers and other things can  
die off too.

-Scott

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

* [U-Boot] [PATCH 32/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw serial driver
  2012-09-19 23:10                       ` Scott Wood
@ 2012-09-19 23:13                         ` Marek Vasut
  0 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-19 23:13 UTC (permalink / raw)
  To: u-boot

Dear Scott Wood,

[...]

> > > Maybe have a GRAVEYARD file that lists hardware support and other
> > > notable features that have been removed, so it's easy for someone to
> > > tell whether digging through the git history might be fruitful.
> > 
> > Like doc/README.scrapyard ?
> 
> Heh.  Yes, except maybe more prominent so people would know it exists.

I'd say we need marketing, advertising and ... maybe something else ;-)

G***le ads for README.scrapyard maybe ? :-)

> :-)
> 
> That file does seem a bit board-centric; drivers and other things can
> die off too.

Yes, indeed ... reformating it might help.

> -Scott

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 32/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw serial driver
  2012-09-19 22:49               ` Graeme Russ
  2012-09-19 22:57                 ` Marek Vasut
@ 2012-09-19 23:16                 ` Tom Rini
  1 sibling, 0 replies; 306+ messages in thread
From: Tom Rini @ 2012-09-19 23:16 UTC (permalink / raw)
  To: u-boot

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/19/12 15:49, Graeme Russ wrote:
> Hi Tom,
> 
> On Thu, Sep 20, 2012 at 8:37 AM, Tom Rini <trini@ti.com> wrote:
> 
>> A more elaborate set of statements on my feelings about "old"
>> boards and what needs to happen, in light of the facts that the
>> code is messy, will require updating for DM and likelyhood of a
>> small but devoted community around some of them.
> 
> My gut feeling on this is to either move unmaintained / inactive 
> boards to a separate board directory, or add a flag to boards.cfg
> (If we add a flag to boards.cfg then we can specify that MAKEALL
> should skip those boards)
> 
> Either way, we can then let them bit-rot (I know, bad words) but
> at least if someone comes along with an actual board, they have a
> place to start. This is what happened to me with the x86 arch - the
> existing code was horribly broken, but at least I had a solid
> foundation to start reinvigorating it.

... and lots of strong opinions follow.  Which is why I wanted a
separate thread (so more folks see it) and we start from what I hope
is a reasoned approach we can all mostly agree on :)

- -- 
Tom

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQWlI/AAoJENk4IS6UOR1WQ2EP/2a2WljteyyB44HvtLJsOsNI
sLOri7YBtE8opmJ7aia4/2lBm6EEyDUGMVlQcSS8jE3EOUfrVEh8R2mLNpEjygDz
WUZLi4o3FEJozd9OgNBuOTkYswsZe1c93lP0NQ/zc4M0jLJHj0JN1ZK7HeAVD0Mo
oJHLSocFuBuY0hpXa26jdFBRcMtKXDQ4YvGexU16Vs8O54bryvDvDhxZxnKy38lP
icVdc9AsAh8pHN8g/RFt++cIaSY64munCKCc1ld1Wx0Fsqpygb27Ikmt5/NqIPyY
1RnqZ0tTXqbsjnpr5lokE3HFXdmriEfiCE8lfc1iAW91SY3YDCQjGrSfE1B1PbsA
L8PthUJLs8dLuhk4ZNlRkBCgIU+9RRX/TMuJOrihukI3Wg9Ui/PUBwJVChmNmwFc
cZHTbilRP09tk4I2rY1OMQbNjMQWjLw25rjXcKEAIQ+UEQ/MoakDKX/JOEcq4blK
AtG0L2na+nb4JmgCraWH/0EoOFuQOLaYLyT6Bm2c4ElzAZ7jxbfSDlc6AB4FHuAL
xxw2nTrm3ij0x2r694hx1BNCQ8KRKSHwTBBTcNDrnjmH1rfKT7v78qiXBfb8w3WA
aMrIfiQBnFwAe2RRaK075Muwze5tPnzKsgPimVEqb3FFCLefOzdFy23lTVTua2g7
7mdQb4WkcWTdS42FXYRi
=E2+c
-----END PGP SIGNATURE-----

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

* [U-Boot] [PATCH 00/70 V2] serial: Massive rework of the serial subsystem
  2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
                   ` (71 preceding siblings ...)
  2012-09-17 22:52 ` [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Tom Rini
@ 2012-09-29  0:30 ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 01/70] serial: Coding style cleanup of struct serial_device Marek Vasut
                     ` (70 more replies)
  72 siblings, 71 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

This patchset is a STAGE 1 of preparation of the stdio and serial subsys
for the driver model.

The idea of this patchset is:

1) Clean up the struct serial_device
   Do a coding style cleanup.
2) Replace .init and .uninit with .start and .stop
   This is to bring struct serial_device much closer to struct stdio_dev
   so later on, these structures can be overlayed and struct serial_device
   can be easily passed to stdio subsystem directly.
3) Do minor cleanups on the PXA and MPC512X
   Basically for PXA this means to remove default_serial_console() call
   from every single PXA board and move it into PXA serial driver. For
   MPC512X, that means properly defining PSC console number.
4) Add support for CONFIG_SERIAL_MULTI into every single driver
   Implement support for both non-multi and multi operation into every
   single serial driver in the U-Boot source tree. This is a vast majority
   of this patchset.
5) Unconditionally enable CONFIG_SERIAL_MULTI
   Enable the multi operation throughout the whole U-Boot tree, both for
   SPL and non-SPL builds. There was also some breakage due to this, so
   this patchset also addresses that with minor fixes.
6) Remove unused code used for the non-multi operation
   Remove code that was used when CONFIG_SERIAL_MULTI was not selected.
   Also remove all occurances of CONFIG_SERIAL_MULTI throughout the source
   tree. Some parts of the code must have been adjusted to cope with this
   since they were initially only written for non-multi operation. These
   were minor adjustments mostly in macros though.

This changeset obviously does mean size growth of U-Boot, therefore some
statistics (stock U-Boot first, patchset last):

Configuring for omap3_beagle board...
   text    data     bss     dec     hex filename
 325687    8456  266888  601031   92bc7 ./u-boot
 326912    8648  266944  602504   93188 ./u-boot
  43082    1812  198020  242914   3b4e2 ./spl/u-boot-spl
  45794    1860  198020  245674   3bfaa ./spl/u-boot-spl

Configuring for P1020RDB-PC_36BIT_SPIFLASH - Board: p1_p2_rdb_pc, Options: P1020RDB,36BIT,SPIFLASH
   text    data     bss     dec     hex filename
 392469   30628  267568  690665   a89e9 ./u-boot
 394550   30940  267600  693090   a9362 ./u-boot

Configuring for grsim_leon2 board...
   text    data     bss     dec     hex filename
  95658    3328    2640  101626   18cfa ./u-boot
  97058    3384    2640  103082   192aa ./u-boot

Configuring for sandbox board...
   text    data     bss     dec     hex filename
 137394    6364   28488  172246   2a0d6 ./u-boot
 138674    6456   28504  173634   2a642 ./u-boot

V2: Rebase on top of current -next

Marek Vasut (70):
  serial: Coding style cleanup of struct serial_device
  serial: Rename .init() and .uninit() in serial_device
  serial: Properly spell out the structure member names of
    serial_driver
  serial: pxa: Implement default_serial_console in serial_pxa.c
  serial: pxa: Make use of default_serial_console in serial_pxa
  serial: pxa: Make local functions static
  serial: mpc512x: Properly define CONFIG_SYS_PSC3 in config files
  serial: Implement serial_initfunc() macro
  serial: mpc8xx: Move serial registration from serial_initialize()
  serial: s3c24xx: Move serial registration from serial_initialize()
  serial: pxa: Move serial registration from serial_initialize()
  serial: s5p: Move serial registration from serial_initialize()
  serial: microblaze: Move serial registration from serial_initialize()
  serial: mpc512x: Move serial registration from serial_initialize()
  serial: ns16550: Move serial registration from serial_initialize()
  serial: bfin: Remove the bfin_serialN_device exports from serial.h
  serial: bfin: Adjust serial_register_bfin_uart()
  serial: zoom2: Remove zoom2 serial prototypes from serial.h
  serial: bfin: Flip the jtag serial console to CONFIG_SERIAL_MULTI
  serial: mips: Implement CONFIG_SERIAL_MULTI into au1x00 serial driver
  serial: mips: Implement CONFIG_SERIAL_MULTI into asc serial driver
  serial: mips: Implement CONFIG_SERIAL_MULTI into JZ serial driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc5xx serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8220 serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8260 serial
    drivers
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc85xx serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into iop480 serial
    driver
  serial: sparc: Implement CONFIG_SERIAL_MULTI into leon2 serial driver
  serial: sparc: Implement CONFIG_SERIAL_MULTI into leon3 serial driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into marvell serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into amirix serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw serial driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into cogent serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into cpci750 serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into evb64260 serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into ml2 serial driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into sconsole serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into p3mx serial
    driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into altera_jtag serial
    driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into altera serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into atmel serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into lpc32xx serial driver
  serial: mcf: Implement CONFIG_SERIAL_MULTI into MCF serial driver
  serial: Implement CONFIG_SERIAL_MULTI into ns9750 serial driver
  serial: oc: Implement CONFIG_SERIAL_MULTI into OpenCores serial
    driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into s3c4510b serial
    driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into s3c64xx serial driver
  serial: sandbox: Implement CONFIG_SERIAL_MULTI into sandbox serial
    driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into clps7111 serial
    driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into imx serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into ixp serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into ks8695 serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into lh7a40x serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into lpc2292 serial driver
  serial: Implement CONFIG_SERIAL_MULTI into max3100 serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into mxc serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into netarm serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into pl01x serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into s3c44b0 serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into sa1100 serial driver
  serial: sh: Implement CONFIG_SERIAL_MULTI into sh serial driver
  serial: mxs: spl: Remove empty serial_* functions from SPL code
  serial: ns16550: Call usbtty_poll only in non-SPL build
  serial: Use puts() and hang() instead of panic() in SPL
  serial: Unconditionally enable CONFIG_SERIAL_MULTI
  serial: Remove CONFIG_SERIAL_MULTI from config files
  serial: Remove CONFIG_SERIAL_MULTI from serial drivers
  serial: Remove CONFIG_SERIAL_MULTI from remaining sources
  serial: Compile common/serial.c by default
  serial: Enhance the manual relocation

 arch/arm/cpu/arm926ejs/mxs/spl_boot.c         |    4 -
 arch/arm/lib/board.c                          |    2 -
 arch/blackfin/cpu/jtag-console.c              |   37 +++-
 arch/blackfin/cpu/serial.c                    |    6 +-
 arch/blackfin/lib/board.c                     |    2 -
 arch/m68k/lib/board.c                         |    2 -
 arch/microblaze/lib/board.c                   |    2 -
 arch/mips/cpu/mips32/au1x00/au1x00_serial.c   |   42 +++--
 arch/mips/cpu/mips32/incaip/asc_serial.c      |   35 +++-
 arch/mips/cpu/xburst/jz_serial.c              |   35 +++-
 arch/nds32/lib/board.c                        |    2 -
 arch/powerpc/cpu/mpc512x/serial.c             |   92 +++-------
 arch/powerpc/cpu/mpc5xx/serial.c              |   69 +++++---
 arch/powerpc/cpu/mpc5xxx/serial.c             |  181 ++++++-------------
 arch/powerpc/cpu/mpc8220/uart.c               |   35 +++-
 arch/powerpc/cpu/mpc8260/serial_scc.c         |   39 +++--
 arch/powerpc/cpu/mpc8260/serial_smc.c         |   39 +++--
 arch/powerpc/cpu/mpc85xx/serial_scc.c         |   39 +++--
 arch/powerpc/cpu/mpc8xx/serial.c              |   43 +++--
 arch/powerpc/cpu/ppc4xx/iop480_uart.c         |   36 +++-
 arch/powerpc/lib/board.c                      |    2 -
 arch/sandbox/lib/board.c                      |    2 -
 arch/sparc/cpu/leon2/serial.c                 |   51 ++++--
 arch/sparc/cpu/leon3/serial.c                 |   51 ++++--
 arch/x86/lib/board.c                          |    2 -
 board/Marvell/common/serial.c                 |   48 ++++--
 board/amirix/ap1000/serial.c                  |   35 +++-
 board/balloon3/balloon3.c                     |    5 -
 board/bmw/serial.c                            |   36 +++-
 board/cogent/serial.c                         |   34 +++-
 board/esd/cpci750/serial.c                    |   36 +++-
 board/evb64260/serial.c                       |   54 +++---
 board/logicpd/zoom2/zoom2_serial.c            |    7 +-
 board/logicpd/zoom2/zoom2_serial.h            |   16 +-
 board/ml2/serial.c                            |   35 +++-
 board/palmld/palmld.c                         |    5 -
 board/palmtc/palmtc.c                         |    5 -
 board/pcippc2/sconsole.c                      |   35 +++-
 board/pdm360ng/pdm360ng.c                     |    6 -
 board/prodrive/p3mx/serial.c                  |   36 +++-
 board/toradex/colibri_pxa270/colibri_pxa270.c |    5 -
 board/trizepsiv/conxs.c                       |    7 -
 board/vpac270/vpac270.c                       |    5 -
 board/zipitz2/zipitz2.c                       |    5 -
 common/Makefile                               |    2 +-
 common/cmd_nvedit.c                           |    2 -
 common/fdt_support.c                          |    4 -
 common/iomux.c                                |    2 -
 common/serial.c                               |  229 +++++++++++++++----------
 common/stdio.c                                |    2 -
 drivers/serial/altera_jtag_uart.c             |   39 ++++-
 drivers/serial/altera_uart.c                  |   51 ++++--
 drivers/serial/atmel_usart.c                  |   35 +++-
 drivers/serial/lpc32xx_hsuart.c               |   57 +++---
 drivers/serial/mcfuart.c                      |   33 +++-
 drivers/serial/ns16550.c                      |    2 +-
 drivers/serial/ns9750_serial.c                |   33 +++-
 drivers/serial/opencores_yanu.c               |   35 +++-
 drivers/serial/s3c4510b_uart.c                |   33 +++-
 drivers/serial/s3c64xx.c                      |   33 +++-
 drivers/serial/sandbox.c                      |   35 +++-
 drivers/serial/serial.c                       |  128 +++-----------
 drivers/serial/serial_clps7111.c              |   34 +++-
 drivers/serial/serial_imx.c                   |   36 +++-
 drivers/serial/serial_ixp.c                   |   36 +++-
 drivers/serial/serial_ks8695.c                |   41 ++++-
 drivers/serial/serial_lh7a40x.c               |   34 +++-
 drivers/serial/serial_lpc2292.c               |   34 +++-
 drivers/serial/serial_max3100.c               |   42 +++--
 drivers/serial/serial_mxc.c                   |   40 +++--
 drivers/serial/serial_netarm.c                |   33 +++-
 drivers/serial/serial_pl01x.c                 |   37 +++-
 drivers/serial/serial_pxa.c                   |   65 ++++---
 drivers/serial/serial_s3c24x0.c               |   78 ++-------
 drivers/serial/serial_s3c44b0.c               |   36 +++-
 drivers/serial/serial_s5p.c                   |   27 ++-
 drivers/serial/serial_sa1100.c                |   36 +++-
 drivers/serial/serial_sh.c                    |   33 +++-
 drivers/serial/serial_xuartlite.c             |   69 +++-----
 include/common.h                              |   12 --
 include/configs/DU440.h                       |    1 -
 include/configs/KAREF.h                       |    1 -
 include/configs/METROBOX.h                    |    1 -
 include/configs/MPC8569MDS.h                  |    1 -
 include/configs/P1010RDB.h                    |    1 -
 include/configs/P1_P2_RDB.h                   |    1 -
 include/configs/P2020COME.h                   |    1 -
 include/configs/PMC440.h                      |    1 -
 include/configs/TB5200.h                      |    1 -
 include/configs/amcc-common.h                 |    1 -
 include/configs/aria.h                        |    1 +
 include/configs/balloon3.h                    |    1 +
 include/configs/bfin_adi_common.h             |    1 -
 include/configs/colibri_pxa270.h              |    1 +
 include/configs/coreboot.h                    |    1 -
 include/configs/eNET.h                        |    1 -
 include/configs/jadecpu.h                     |    1 -
 include/configs/korat.h                       |    1 -
 include/configs/lubbock.h                     |    1 +
 include/configs/lwmon.h                       |    1 -
 include/configs/lwmon5.h                      |    1 -
 include/configs/mcc200.h                      |    5 -
 include/configs/mecp5123.h                    |    1 +
 include/configs/mpc5121ads.h                  |    1 +
 include/configs/omap3_zoom2.h                 |    3 +-
 include/configs/origen.h                      |    1 -
 include/configs/palmld.h                      |    1 +
 include/configs/palmtc.h                      |    1 +
 include/configs/pcs440ep.h                    |    1 -
 include/configs/pdm360ng.h                    |    3 -
 include/configs/pxa255_idp.h                  |    1 +
 include/configs/quad100hd.h                   |    1 -
 include/configs/s5p_goni.h                    |    1 -
 include/configs/s5pc210_universal.h           |    1 -
 include/configs/sc3.h                         |    1 -
 include/configs/smdk5250.h                    |    1 -
 include/configs/smdkc100.h                    |    1 -
 include/configs/smdkv310.h                    |    1 -
 include/configs/tegra-common-post.h           |    5 -
 include/configs/trats.h                       |    1 -
 include/configs/trizepsiv.h                   |    2 +-
 include/configs/vpac270.h                     |    1 +
 include/configs/xaeniax.h                     |    2 +-
 include/configs/zeus.h                        |    1 -
 include/configs/zipitz2.h                     |    1 +
 include/serial.h                              |   79 ++-------
 post/board/pdm360ng/coproc_com.c              |    3 -
 127 files changed, 1728 insertions(+), 1156 deletions(-)

Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Michal Simek <monstr@monstr.eu>
Cc: U-Boot DM <u-boot-dm@lists.denx.de>

-- 
1.7.10.4

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

* [U-Boot] [PATCH 01/70] serial: Coding style cleanup of struct serial_device
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 02/70] serial: Rename .init() and .uninit() in serial_device Marek Vasut
                     ` (69 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Do a simple cleanup of the struct serial_device and align it with
current coding style. Checkpatch now reports no errors.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 include/serial.h |   23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/include/serial.h b/include/serial.h
index d76d6df..5e4e922 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -5,20 +5,19 @@
 
 struct serial_device {
 	/* enough bytes to match alignment of following func pointer */
-	char name[16];
-
-	int  (*init) (void);
-	int  (*uninit) (void);
-	void (*setbrg) (void);
-	int (*getc) (void);
-	int (*tstc) (void);
-	void (*putc) (const char c);
-	void (*puts) (const char *s);
+	char	name[16];
+
+	int	(*init)(void);
+	int	(*uninit)(void);
+	void	(*setbrg)(void);
+	int	(*getc)(void);
+	int	(*tstc)(void);
+	void	(*putc)(const char c);
+	void	(*puts)(const char *s);
 #if CONFIG_POST & CONFIG_SYS_POST_UART
-	void (*loop) (int);
+	void	(*loop)(int);
 #endif
-
-	struct serial_device *next;
+	struct serial_device	*next;
 };
 
 extern struct serial_device serial_smc_device;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 02/70] serial: Rename .init() and .uninit() in serial_device
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 01/70] serial: Coding style cleanup of struct serial_device Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 03/70] serial: Properly spell out the structure member names of serial_driver Marek Vasut
                     ` (68 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Rename .init() to .start() and .uninit() to .stop() in struct
serial_device. This allows aligning struct serial_device with
closer to struct stdio_dev. The real goal here is to allow
these two structures to converge together and eventually make
one to be a superset of the other.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 arch/blackfin/cpu/serial.c |    4 ++--
 common/serial.c            |   16 ++++++++--------
 include/serial.h           |    4 ++--
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/blackfin/cpu/serial.c b/arch/blackfin/cpu/serial.c
index 6603dc0..33677ba 100644
--- a/arch/blackfin/cpu/serial.c
+++ b/arch/blackfin/cpu/serial.c
@@ -236,8 +236,8 @@ static void uart##n##_loop(int state) \
 \
 struct serial_device bfin_serial##n##_device = { \
 	.name   = "bfin_uart"#n, \
-	.init   = uart##n##_init, \
-	.uninit = uart##n##_uninit, \
+	.start  = uart##n##_init, \
+	.stop   = uart##n##_uninit, \
 	.setbrg = uart##n##_setbrg, \
 	.getc   = uart##n##_getc, \
 	.tstc   = uart##n##_tstc, \
diff --git a/common/serial.c b/common/serial.c
index 75cc1bb..5740d4f 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -35,7 +35,7 @@ static struct serial_device *serial_current;
 void serial_register(struct serial_device *dev)
 {
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
-	dev->init += gd->reloc_off;
+	dev->start += gd->reloc_off;
 	dev->setbrg += gd->reloc_off;
 	dev->getc += gd->reloc_off;
 	dev->tstc += gd->reloc_off;
@@ -136,8 +136,8 @@ void serial_stdio_init(void)
 		strcpy(dev.name, s->name);
 		dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT;
 
-		dev.start = s->init;
-		dev.stop = s->uninit;
+		dev.start = s->start;
+		dev.stop = s->stop;
 		dev.putc = s->putc;
 		dev.puts = s->puts;
 		dev.getc = s->getc;
@@ -168,7 +168,7 @@ void serial_reinit_all(void)
 	struct serial_device *s;
 
 	for (s = serial_devices; s; s = s->next)
-		s->init();
+		s->start();
 }
 
 static struct serial_device *get_current(void)
@@ -188,7 +188,7 @@ static struct serial_device *get_current(void)
 
 int serial_init(void)
 {
-	return get_current()->init();
+	return get_current()->start();
 }
 
 void serial_setbrg(void)
@@ -288,9 +288,9 @@ int uart_post_test(int flags)
 		/* Disable loop back */
 		s->loop(0);
 
-		/* XXX: There is no serial_uninit() !? */
-		if (s->uninit)
-			s->uninit();
+		/* XXX: There is no serial_stop() !? */
+		if (s->stop)
+			s->stop();
 	}
 
  done:
diff --git a/include/serial.h b/include/serial.h
index 5e4e922..4d19259 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -7,8 +7,8 @@ struct serial_device {
 	/* enough bytes to match alignment of following func pointer */
 	char	name[16];
 
-	int	(*init)(void);
-	int	(*uninit)(void);
+	int	(*start)(void);
+	int	(*stop)(void);
 	void	(*setbrg)(void);
 	int	(*getc)(void);
 	int	(*tstc)(void);
-- 
1.7.10.4

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

* [U-Boot] [PATCH 03/70] serial: Properly spell out the structure member names of serial_driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 01/70] serial: Coding style cleanup of struct serial_device Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 02/70] serial: Rename .init() and .uninit() in serial_device Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 04/70] serial: pxa: Implement default_serial_console in serial_pxa.c Marek Vasut
                     ` (67 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Properly spell out the whole structure member names when an initialized
varible is instantiated from the struct serial_driver. In case the
structure definition for struct serial_driver undergoes reordering,
there will be no impact on variables defined based on this structure.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: C Nauman <cnauman@diagraph.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Michal Simek <monstr@monstr.eu>
---
 arch/powerpc/cpu/mpc512x/serial.c  |   18 +++++++++---------
 arch/powerpc/cpu/mpc5xxx/serial.c  |   32 ++++++++++++++++----------------
 arch/powerpc/cpu/mpc8xx/serial.c   |   32 ++++++++++++++++----------------
 board/logicpd/zoom2/zoom2_serial.h |   16 ++++++++--------
 drivers/serial/serial.c            |   19 ++++++++++---------
 drivers/serial/serial_pxa.c        |   16 ++++++++--------
 drivers/serial/serial_s3c24x0.c    |   18 +++++++++---------
 drivers/serial/serial_s5p.c        |   19 ++++++++++---------
 drivers/serial/serial_xuartlite.c  |   19 ++++++++++---------
 9 files changed, 96 insertions(+), 93 deletions(-)

diff --git a/arch/powerpc/cpu/mpc512x/serial.c b/arch/powerpc/cpu/mpc512x/serial.c
index 7c53346..f4f52ad 100644
--- a/arch/powerpc/cpu/mpc512x/serial.c
+++ b/arch/powerpc/cpu/mpc512x/serial.c
@@ -319,15 +319,15 @@ int serial_getcts_dev(unsigned int idx)
 		serial_puts_dev(port, s); \
 	}
 
-#define INIT_PSC_SERIAL_STRUCTURE(port, name) { \
-	name, \
-	serial##port##_init, \
-	serial##port##_uninit, \
-	serial##port##_setbrg, \
-	serial##port##_getc, \
-	serial##port##_tstc, \
-	serial##port##_putc, \
-	serial##port##_puts, \
+#define INIT_PSC_SERIAL_STRUCTURE(port, __name) {	\
+	.name	= __name,				\
+	.start	= serial##port##_init,			\
+	.stop	= serial##port##_uninit,		\
+	.setbrg	= serial##port##_setbrg,		\
+	.getc	= serial##port##_getc,			\
+	.tstc	= serial##port##_tstc,			\
+	.putc	= serial##port##_putc,			\
+	.puts	= serial##port##_puts,			\
 }
 
 #if defined(CONFIG_SYS_PSC1)
diff --git a/arch/powerpc/cpu/mpc5xxx/serial.c b/arch/powerpc/cpu/mpc5xxx/serial.c
index aa09f67..9bebff8 100644
--- a/arch/powerpc/cpu/mpc5xxx/serial.c
+++ b/arch/powerpc/cpu/mpc5xxx/serial.c
@@ -338,14 +338,14 @@ int serial1_tstc(void)
 
 struct serial_device serial0_device =
 {
-	"serial0",
-	serial0_init,
-	NULL,
-	serial0_setbrg,
-	serial0_getc,
-	serial0_tstc,
-	serial0_putc,
-	serial0_puts,
+	.name	= "serial0",
+	.start	= serial0_init,
+	.stop	= NULL,
+	.setbrg	= serial0_setbrg,
+	.getc	= serial0_getc,
+	.tstc	= serial0_tstc,
+	.putc	= serial0_putc,
+	.puts	= serial0_puts,
 };
 
 __weak struct serial_device *default_serial_console(void)
@@ -355,14 +355,14 @@ __weak struct serial_device *default_serial_console(void)
 
 struct serial_device serial1_device =
 {
-	"serial1",
-	serial1_init,
-	NULL,
-	serial1_setbrg,
-	serial1_getc,
-	serial1_tstc,
-	serial1_putc,
-	serial1_puts,
+	.name	= "serial1",
+	.start	= serial1_init,
+	.stop	= NULL,
+	.setbrg	= serial1_setbrg,
+	.getc	= serial1_getc,
+	.tstc	= serial1_tstc,
+	.putc	= serial1_putc,
+	.puts	= serial1_puts,
 };
 #endif /* CONFIG_SERIAL_MULTI */
 
diff --git a/arch/powerpc/cpu/mpc8xx/serial.c b/arch/powerpc/cpu/mpc8xx/serial.c
index 9239b24..dc9b323 100644
--- a/arch/powerpc/cpu/mpc8xx/serial.c
+++ b/arch/powerpc/cpu/mpc8xx/serial.c
@@ -390,14 +390,14 @@ smc_tstc(void)
 
 struct serial_device serial_smc_device =
 {
-	"serial_smc",
-	smc_init,
-	NULL,
-	smc_setbrg,
-	smc_getc,
-	smc_tstc,
-	smc_putc,
-	smc_puts,
+	.name	= "serial_smc",
+	.start	= smc_init,
+	.stop	= NULL,
+	.setbrg	= smc_setbrg,
+	.getc	= smc_getc,
+	.tstc	= smc_tstc,
+	.putc	= smc_putc,
+	.puts	= smc_puts,
 };
 
 #endif /* CONFIG_8xx_CONS_SMC1 || CONFIG_8xx_CONS_SMC2 */
@@ -660,14 +660,14 @@ scc_tstc(void)
 
 struct serial_device serial_scc_device =
 {
-	"serial_scc",
-	scc_init,
-	NULL,
-	scc_setbrg,
-	scc_getc,
-	scc_tstc,
-	scc_putc,
-	scc_puts,
+	.name	= "serial_scc",
+	.start	= scc_init,
+	.stop	= NULL,
+	.setbrg	= scc_setbrg,
+	.getc	= scc_getc,
+	.tstc	= scc_tstc,
+	.putc	= scc_putc,
+	.puts	= scc_puts,
 };
 
 #endif	/* CONFIG_8xx_CONS_SCCx */
diff --git a/board/logicpd/zoom2/zoom2_serial.h b/board/logicpd/zoom2/zoom2_serial.h
index 4e30587..61306be 100644
--- a/board/logicpd/zoom2/zoom2_serial.h
+++ b/board/logicpd/zoom2/zoom2_serial.h
@@ -61,14 +61,14 @@ int quad_tstc_##n(void)				\
 }						\
 struct serial_device zoom2_serial_device##n =	\
 {						\
-	N(n),					\
-	quad_init_##n,				\
-	NULL,					\
-	quad_setbrg_##n,			\
-	quad_getc_##n,				\
-	quad_tstc_##n,				\
-	quad_putc_##n,				\
-	quad_puts_##n,				\
+	.name	= N(n),				\
+	.start	= quad_init_##n,		\
+	.stop	= NULL,				\
+	.setbrg	= quad_setbrg_##n,		\
+	.getc	= quad_getc_##n,		\
+	.tstc	= quad_tstc_##n,		\
+	.putc	= quad_putc_##n,		\
+	.puts	= quad_puts_##n,		\
 };
 
 #endif /* ZOOM2_SERIAL_H */
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index b10bab7..9d92dee 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -106,15 +106,16 @@ static NS16550_t serial_ports[4] = {
 	serial_puts_dev(port, s);}
 
 /* Serial device descriptor */
-#define INIT_ESERIAL_STRUCTURE(port, name) {\
-	name,\
-	eserial##port##_init,\
-	NULL,\
-	eserial##port##_setbrg,\
-	eserial##port##_getc,\
-	eserial##port##_tstc,\
-	eserial##port##_putc,\
-	eserial##port##_puts, }
+#define INIT_ESERIAL_STRUCTURE(port, __name) {	\
+	.name	= __name,			\
+	.start	= eserial##port##_init,		\
+	.stop	= NULL,				\
+	.setbrg	= eserial##port##_setbrg,	\
+	.getc	= eserial##port##_getc,		\
+	.tstc	= eserial##port##_tstc,		\
+	.putc	= eserial##port##_putc,		\
+	.puts	= eserial##port##_puts,		\
+}
 
 #endif /* CONFIG_SERIAL_MULTI */
 
diff --git a/drivers/serial/serial_pxa.c b/drivers/serial/serial_pxa.c
index a9976d7..97e3f36 100644
--- a/drivers/serial/serial_pxa.c
+++ b/drivers/serial/serial_pxa.c
@@ -269,14 +269,14 @@ void pxa_puts_dev(unsigned int uart_index, const char *s)
 #define	pxa_uart_desc(uart)						\
 	struct serial_device serial_##uart##_device =			\
 	{								\
-		"serial_"#uart,						\
-		uart##_init,						\
-		NULL,							\
-		uart##_setbrg,						\
-		uart##_getc,						\
-		uart##_tstc,						\
-		uart##_putc,						\
-		uart##_puts,						\
+		.name	= "serial_"#uart,				\
+		.start	= uart##_init,					\
+		.stop	= NULL,						\
+		.setbrg	= uart##_setbrg,				\
+		.getc	= uart##_getc,					\
+		.tstc	= uart##_tstc,					\
+		.putc	= uart##_putc,					\
+		.puts	= uart##_puts,					\
 	};
 
 #define	pxa_uart_multi(uart, UART)					\
diff --git a/drivers/serial/serial_s3c24x0.c b/drivers/serial/serial_s3c24x0.c
index 12bcdd3..fa6aac0 100644
--- a/drivers/serial/serial_s3c24x0.c
+++ b/drivers/serial/serial_s3c24x0.c
@@ -69,15 +69,15 @@ DECLARE_GLOBAL_DATA_PTR;
 		serial_puts_dev(port, s); \
 	}
 
-#define INIT_S3C_SERIAL_STRUCTURE(port, name) { \
-	name, \
-	s3serial##port##_init, \
-	NULL,\
-	s3serial##port##_setbrg, \
-	s3serial##port##_getc, \
-	s3serial##port##_tstc, \
-	s3serial##port##_putc, \
-	s3serial##port##_puts, \
+#define INIT_S3C_SERIAL_STRUCTURE(port, __name) {	\
+	.name	= __name,				\
+	.start	= s3serial##port##_init,		\
+	.stop	= NULL,					\
+	.setbrg	= s3serial##port##_setbrg,		\
+	.getc	= s3serial##port##_getc,		\
+	.tstc	= s3serial##port##_tstc,		\
+	.putc	= s3serial##port##_putc,		\
+	.puts	= s3serial##port##_puts,		\
 }
 
 #endif /* CONFIG_SERIAL_MULTI */
diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c
index 6819bb0..43cbc4f 100644
--- a/drivers/serial/serial_s5p.c
+++ b/drivers/serial/serial_s5p.c
@@ -183,15 +183,16 @@ int s5p_serial##port##_tstc(void) { return serial_tstc_dev(port); } \
 void s5p_serial##port##_putc(const char c) { serial_putc_dev(c, port); } \
 void s5p_serial##port##_puts(const char *s) { serial_puts_dev(s, port); }
 
-#define INIT_S5P_SERIAL_STRUCTURE(port, name) { \
-	name, \
-	s5p_serial##port##_init, \
-	NULL, \
-	s5p_serial##port##_setbrg, \
-	s5p_serial##port##_getc, \
-	s5p_serial##port##_tstc, \
-	s5p_serial##port##_putc, \
-	s5p_serial##port##_puts, }
+#define INIT_S5P_SERIAL_STRUCTURE(port, __name) {	\
+	.name	= __name,				\
+	.start	= s5p_serial##port##_init,		\
+	.stop	= NULL,					\
+	.setbrg	= s5p_serial##port##_setbrg,		\
+	.getc	= s5p_serial##port##_getc,		\
+	.tstc	= s5p_serial##port##_tstc,		\
+	.putc	= s5p_serial##port##_putc,		\
+	.puts	= s5p_serial##port##_puts,		\
+}
 
 DECLARE_S5P_SERIAL_FUNCTIONS(0);
 struct serial_device s5p_serial0_device =
diff --git a/drivers/serial/serial_xuartlite.c b/drivers/serial/serial_xuartlite.c
index 2bdb68b..b3bb066 100644
--- a/drivers/serial/serial_xuartlite.c
+++ b/drivers/serial/serial_xuartlite.c
@@ -144,15 +144,16 @@ int serial_tstc(void)
 				{ uartlite_serial_puts(s, port); }
 
 /* Serial device descriptor */
-#define INIT_ESERIAL_STRUCTURE(port, name) {\
-	name,\
-	userial##port##_init,\
-	NULL,\
-	userial##port##_setbrg,\
-	userial##port##_getc,\
-	userial##port##_tstc,\
-	userial##port##_putc,\
-	userial##port##_puts, }
+#define INIT_ESERIAL_STRUCTURE(port, __name) {	\
+	.name	= __name,			\
+	.start	= userial##port##_init,		\
+	.stop	= NULL,				\
+	.setbrg	= userial##port##_setbrg,	\
+	.getc	= userial##port##_getc,		\
+	.tstc	= userial##port##_tstc,		\
+	.putc	= userial##port##_putc,		\
+	.puts	= userial##port##_puts,		\
+}
 
 DECLARE_ESERIAL_FUNCTIONS(0);
 struct serial_device uartlite_serial0_device =
-- 
1.7.10.4

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

* [U-Boot] [PATCH 04/70] serial: pxa: Implement default_serial_console in serial_pxa.c
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (2 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 03/70] serial: Properly spell out the structure member names of serial_driver Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 05/70] serial: pxa: Make use of default_serial_console in serial_pxa Marek Vasut
                     ` (66 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Implement weak default_serial_console() function in serial_pxa
driver, which gets available in case CONFIG_SERIAL_MULTI is
enabled. This will get helpful in subsequent patches, which will
encapsulate PXA's struct serial_device instances in serial_pxa
driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 drivers/serial/serial_pxa.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/serial/serial_pxa.c b/drivers/serial/serial_pxa.c
index 97e3f36..ad2d77e 100644
--- a/drivers/serial/serial_pxa.c
+++ b/drivers/serial/serial_pxa.c
@@ -36,6 +36,7 @@
 #include <asm/arch/pxa-regs.h>
 #include <asm/arch/regs-uart.h>
 #include <asm/io.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -298,4 +299,19 @@ void pxa_puts_dev(unsigned int uart_index, const char *s)
 
 #ifndef	CONFIG_SERIAL_MULTI
 	pxa_uart(serial, UART)
+#else
+__weak struct serial_device *default_serial_console(void)
+{
+#if CONFIG_CONS_INDEX == 1
+	return &serial_hwuart_device;
+#elif CONFIG_CONS_INDEX == 2
+	return &serial_stuart_device;
+#elif CONFIG_CONS_INDEX == 3
+	return &serial_ffuart_device;
+#elif CONFIG_CONS_INDEX == 4
+	return &serial_btuart_device;
+#else
+#error "Bad CONFIG_CONS_INDEX."
+#endif
+}
 #endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 05/70] serial: pxa: Make use of default_serial_console in serial_pxa
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (3 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 04/70] serial: pxa: Implement default_serial_console in serial_pxa.c Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 06/70] serial: pxa: Make local functions static Marek Vasut
                     ` (65 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Make use of the newly implemented weak default_serial_console in
the serial_pxa driver. This removes all reimplementations of this
function from board files.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 board/balloon3/balloon3.c                     |    5 -----
 board/palmld/palmld.c                         |    5 -----
 board/palmtc/palmtc.c                         |    5 -----
 board/toradex/colibri_pxa270/colibri_pxa270.c |    5 -----
 board/trizepsiv/conxs.c                       |    5 -----
 board/vpac270/vpac270.c                       |    5 -----
 board/zipitz2/zipitz2.c                       |    5 -----
 include/configs/balloon3.h                    |    1 +
 include/configs/colibri_pxa270.h              |    1 +
 include/configs/lubbock.h                     |    1 +
 include/configs/palmld.h                      |    1 +
 include/configs/palmtc.h                      |    1 +
 include/configs/pxa255_idp.h                  |    1 +
 include/configs/trizepsiv.h                   |    1 +
 include/configs/vpac270.h                     |    1 +
 include/configs/xaeniax.h                     |    2 +-
 include/configs/zipitz2.h                     |    1 +
 17 files changed, 10 insertions(+), 36 deletions(-)

diff --git a/board/balloon3/balloon3.c b/board/balloon3/balloon3.c
index f360323..c934988 100644
--- a/board/balloon3/balloon3.c
+++ b/board/balloon3/balloon3.c
@@ -53,11 +53,6 @@ int board_init(void)
 	return 0;
 }
 
-struct serial_device *default_serial_console(void)
-{
-	return &serial_stuart_device;
-}
-
 int dram_init(void)
 {
 	pxa2xx_dram_init();
diff --git a/board/palmld/palmld.c b/board/palmld/palmld.c
index 2f1ad20..57b4f5f 100644
--- a/board/palmld/palmld.c
+++ b/board/palmld/palmld.c
@@ -52,11 +52,6 @@ int board_init(void)
 	return 0;
 }
 
-struct serial_device *default_serial_console(void)
-{
-	return &serial_ffuart_device;
-}
-
 int dram_init(void)
 {
 	pxa2xx_dram_init();
diff --git a/board/palmtc/palmtc.c b/board/palmtc/palmtc.c
index 4adf152..b23eec8 100644
--- a/board/palmtc/palmtc.c
+++ b/board/palmtc/palmtc.c
@@ -51,11 +51,6 @@ int board_init(void)
 	return 0;
 }
 
-struct serial_device *default_serial_console(void)
-{
-	return &serial_ffuart_device;
-}
-
 int dram_init(void)
 {
 	pxa2xx_dram_init();
diff --git a/board/toradex/colibri_pxa270/colibri_pxa270.c b/board/toradex/colibri_pxa270/colibri_pxa270.c
index d72e5d6..a6e13c8 100644
--- a/board/toradex/colibri_pxa270/colibri_pxa270.c
+++ b/board/toradex/colibri_pxa270/colibri_pxa270.c
@@ -29,11 +29,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-struct serial_device *default_serial_console(void)
-{
-	return &serial_ffuart_device;
-}
-
 int board_init(void)
 {
 	/* We have RAM, disable cache */
diff --git a/board/trizepsiv/conxs.c b/board/trizepsiv/conxs.c
index 1291195..8fc3c40 100644
--- a/board/trizepsiv/conxs.c
+++ b/board/trizepsiv/conxs.c
@@ -135,11 +135,6 @@ int board_late_init(void)
 	return 0;
 }
 
-struct serial_device *default_serial_console (void)
-{
-	return &serial_ffuart_device;
-}
-
 int dram_init(void)
 {
 	pxa2xx_dram_init();
diff --git a/board/vpac270/vpac270.c b/board/vpac270/vpac270.c
index dfdab9b..2663534 100644
--- a/board/vpac270/vpac270.c
+++ b/board/vpac270/vpac270.c
@@ -50,11 +50,6 @@ int board_init(void)
 	return 0;
 }
 
-struct serial_device *default_serial_console(void)
-{
-	return &serial_ffuart_device;
-}
-
 int dram_init(void)
 {
 #ifndef	CONFIG_ONENAND
diff --git a/board/zipitz2/zipitz2.c b/board/zipitz2/zipitz2.c
index 82dfa82..579841d 100644
--- a/board/zipitz2/zipitz2.c
+++ b/board/zipitz2/zipitz2.c
@@ -62,11 +62,6 @@ int board_init (void)
 	return 0;
 }
 
-struct serial_device *default_serial_console (void)
-{
-	return &serial_stuart_device;
-}
-
 int dram_init(void)
 {
 	pxa2xx_dram_init();
diff --git a/include/configs/balloon3.h b/include/configs/balloon3.h
index 756f409..0f26a5b 100644
--- a/include/configs/balloon3.h
+++ b/include/configs/balloon3.h
@@ -53,6 +53,7 @@
  */
 #define	CONFIG_PXA_SERIAL
 #define	CONFIG_STUART			1
+#define CONFIG_CONS_INDEX		2
 #define	CONFIG_BAUDRATE			115200
 
 /*
diff --git a/include/configs/colibri_pxa270.h b/include/configs/colibri_pxa270.h
index ae84344..bb8bea7 100644
--- a/include/configs/colibri_pxa270.h
+++ b/include/configs/colibri_pxa270.h
@@ -55,6 +55,7 @@
  */
 #define	CONFIG_PXA_SERIAL
 #define	CONFIG_FFUART			1
+#define CONFIG_CONS_INDEX		3
 #define	CONFIG_BAUDRATE			115200
 
 /*
diff --git a/include/configs/lubbock.h b/include/configs/lubbock.h
index 0a1d1e0..ed64960 100644
--- a/include/configs/lubbock.h
+++ b/include/configs/lubbock.h
@@ -64,6 +64,7 @@
  */
 #define CONFIG_PXA_SERIAL
 #define CONFIG_FFUART	       1       /* we use FFUART on LUBBOCK */
+#define CONFIG_CONS_INDEX	3
 
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
diff --git a/include/configs/palmld.h b/include/configs/palmld.h
index 835121e..c5dd494 100644
--- a/include/configs/palmld.h
+++ b/include/configs/palmld.h
@@ -54,6 +54,7 @@
  */
 #define	CONFIG_PXA_SERIAL
 #define	CONFIG_FFUART			1
+#define CONFIG_CONS_INDEX		3
 #define	CONFIG_BAUDRATE			9600
 
 /*
diff --git a/include/configs/palmtc.h b/include/configs/palmtc.h
index bc88354..6e8d8e9 100644
--- a/include/configs/palmtc.h
+++ b/include/configs/palmtc.h
@@ -58,6 +58,7 @@
  */
 #define	CONFIG_PXA_SERIAL
 #define	CONFIG_FFUART			1
+#define CONFIG_CONS_INDEX		3
 #define	CONFIG_BAUDRATE			115200
 
 /*
diff --git a/include/configs/pxa255_idp.h b/include/configs/pxa255_idp.h
index ce9e7d1..24c5363 100644
--- a/include/configs/pxa255_idp.h
+++ b/include/configs/pxa255_idp.h
@@ -99,6 +99,7 @@
  */
 #define CONFIG_PXA_SERIAL
 #define CONFIG_FFUART	       1       /* we use FFUART on LUBBOCK */
+#define CONFIG_CONS_INDEX	3
 
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
diff --git a/include/configs/trizepsiv.h b/include/configs/trizepsiv.h
index 151059a..47c6a23 100644
--- a/include/configs/trizepsiv.h
+++ b/include/configs/trizepsiv.h
@@ -68,6 +68,7 @@
 #define CONFIG_FFUART	       1       /* we use FFUART on Conxs */
 #define CONFIG_BTUART	       1       /* we use BTUART on Conxs */
 #define CONFIG_STUART	       1       /* we use STUART on Conxs */
+#define CONFIG_CONS_INDEX	3
 
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
diff --git a/include/configs/vpac270.h b/include/configs/vpac270.h
index 424a902..5e948f9 100644
--- a/include/configs/vpac270.h
+++ b/include/configs/vpac270.h
@@ -75,6 +75,7 @@
  */
 #define	CONFIG_PXA_SERIAL
 #define	CONFIG_FFUART			1
+#define CONFIG_CONS_INDEX		3
 #define	CONFIG_BAUDRATE			115200
 
 /*
diff --git a/include/configs/xaeniax.h b/include/configs/xaeniax.h
index e399e95..eee2547 100644
--- a/include/configs/xaeniax.h
+++ b/include/configs/xaeniax.h
@@ -54,7 +54,7 @@
  */
 #define CONFIG_PXA_SERIAL
 #define CONFIG_BTUART	       1       /* we use BTUART on XAENIAX */
-
+#define CONFIG_CONS_INDEX	4
 
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
diff --git a/include/configs/zipitz2.h b/include/configs/zipitz2.h
index 8b7e05b..bf6394a 100644
--- a/include/configs/zipitz2.h
+++ b/include/configs/zipitz2.h
@@ -66,6 +66,7 @@
  */
 #define	CONFIG_PXA_SERIAL
 #define	CONFIG_STUART			1
+#define CONFIG_CONS_INDEX		2
 #define	CONFIG_BAUDRATE			115200
 
 /*
-- 
1.7.10.4

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

* [U-Boot] [PATCH 06/70] serial: pxa: Make local functions static
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (4 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 05/70] serial: pxa: Make use of default_serial_console in serial_pxa Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 07/70] serial: mpc512x: Properly define CONFIG_SYS_PSC3 in config files Marek Vasut
                     ` (64 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Make functions that are local-only static, so no hairy symbols
stick out of the serial_pxa driver file.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 drivers/serial/serial_pxa.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/serial/serial_pxa.c b/drivers/serial/serial_pxa.c
index ad2d77e..bd3b3cf 100644
--- a/drivers/serial/serial_pxa.c
+++ b/drivers/serial/serial_pxa.c
@@ -87,7 +87,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #endif
 #endif
 
-uint32_t pxa_uart_get_baud_divider(void)
+static uint32_t pxa_uart_get_baud_divider(void)
 {
 	if (gd->baudrate == 1200)
 		return 768;
@@ -105,7 +105,7 @@ uint32_t pxa_uart_get_baud_divider(void)
 		return 0;
 }
 
-struct pxa_uart_regs *pxa_uart_index_to_regs(uint32_t uart_index)
+static struct pxa_uart_regs *pxa_uart_index_to_regs(uint32_t uart_index)
 {
 	switch (uart_index) {
 	case FFUART_INDEX: return (struct pxa_uart_regs *)FFUART_BASE;
@@ -117,7 +117,7 @@ struct pxa_uart_regs *pxa_uart_index_to_regs(uint32_t uart_index)
 	}
 }
 
-void pxa_uart_toggle_clock(uint32_t uart_index, int enable)
+static void pxa_uart_toggle_clock(uint32_t uart_index, int enable)
 {
 	uint32_t clk_reg, clk_offset, reg;
 
-- 
1.7.10.4

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

* [U-Boot] [PATCH 07/70] serial: mpc512x: Properly define CONFIG_SYS_PSC3 in config files
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (5 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 06/70] serial: pxa: Make local functions static Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 08/70] serial: Implement serial_initfunc() macro Marek Vasut
                     ` (63 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Some of the boards using the mpc512x serial driver didn't properly
define which PSC console to use. This caused breakage when building
with CONFIG_SERIAL_MULTI enabled. Fix this by defining the default
PSC console.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 include/configs/aria.h       |    1 +
 include/configs/mecp5123.h   |    1 +
 include/configs/mpc5121ads.h |    1 +
 3 files changed, 3 insertions(+)

diff --git a/include/configs/aria.h b/include/configs/aria.h
index b21b495..0b31c50 100644
--- a/include/configs/aria.h
+++ b/include/configs/aria.h
@@ -322,6 +322,7 @@
  * Serial console configuration
  */
 #define CONFIG_PSC_CONSOLE		3	/* console on PSC3 */
+#define CONFIG_SYS_PSC3
 #if CONFIG_PSC_CONSOLE != 3
 #error CONFIG_PSC_CONSOLE must be 3
 #endif
diff --git a/include/configs/mecp5123.h b/include/configs/mecp5123.h
index b41bda9..cafc273 100644
--- a/include/configs/mecp5123.h
+++ b/include/configs/mecp5123.h
@@ -222,6 +222,7 @@
  * Serial console configuration
  */
 #define CONFIG_PSC_CONSOLE	3	/* console is on PSC3 */
+#define CONFIG_SYS_PSC3
 #if CONFIG_PSC_CONSOLE != 3
 #error CONFIG_PSC_CONSOLE must be 3
 #endif
diff --git a/include/configs/mpc5121ads.h b/include/configs/mpc5121ads.h
index 9d1327f..3f55d35 100644
--- a/include/configs/mpc5121ads.h
+++ b/include/configs/mpc5121ads.h
@@ -290,6 +290,7 @@
  * Serial console configuration
  */
 #define CONFIG_PSC_CONSOLE	3	/* console is on PSC3 */
+#define CONFIG_SYS_PSC3
 #if CONFIG_PSC_CONSOLE != 3
 #error CONFIG_PSC_CONSOLE must be 3
 #endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 08/70] serial: Implement serial_initfunc() macro
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (6 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 07/70] serial: mpc512x: Properly define CONFIG_SYS_PSC3 in config files Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 09/70] serial: mpc8xx: Move serial registration from serial_initialize() Marek Vasut
                     ` (62 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

This macro simplifies declaration of weak aliases for per-driver
functions, which register these drivers with the serial subsystem.
The idea here is to push serial_register() calls from serial.c into
the drivers. To avoid pile of ifdef construct as it is now, create
weak aliases to these functions, which in case the driver is not
present alias onto an empty function, which is in turn optimized out
altogether.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>
---
 common/serial.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/common/serial.c b/common/serial.c
index 5740d4f..84dbe50 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -32,6 +32,14 @@ DECLARE_GLOBAL_DATA_PTR;
 static struct serial_device *serial_devices;
 static struct serial_device *serial_current;
 
+static void serial_null(void)
+{
+}
+
+#define serial_initfunc(name)					\
+	void name(void)						\
+		__attribute__((weak, alias("serial_null")));
+
 void serial_register(struct serial_device *dev)
 {
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
-- 
1.7.10.4

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

* [U-Boot] [PATCH 09/70] serial: mpc8xx: Move serial registration from serial_initialize()
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (7 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 08/70] serial: Implement serial_initfunc() macro Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 10/70] serial: s3c24xx: " Marek Vasut
                     ` (61 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Move the registration of serial_smc and serial_scc ports from
default serial_initialize() into CPU specific function called from
serial_initialize(). This slims down the serial_initialize() call
to a bare tracker of all possible serial port registration routines
in U-Boot.

The exports of both serial_scc_device and serial_smc_device can
not yet be removed as they are still used in default_serial_console()
calls.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>
---
 arch/powerpc/cpu/mpc8xx/serial.c |   11 +++++++++++
 common/serial.c                  |   11 +++--------
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/cpu/mpc8xx/serial.c b/arch/powerpc/cpu/mpc8xx/serial.c
index dc9b323..00888e9 100644
--- a/arch/powerpc/cpu/mpc8xx/serial.c
+++ b/arch/powerpc/cpu/mpc8xx/serial.c
@@ -681,6 +681,17 @@ __weak struct serial_device *default_serial_console(void)
 #endif
 }
 
+void mpc8xx_serial_initialize(void)
+{
+#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2)
+	serial_register(&serial_smc_device);
+#endif
+#if	defined(CONFIG_8xx_CONS_SCC1) || defined(CONFIG_8xx_CONS_SCC2) || \
+	defined(CONFIG_8xx_CONS_SCC3) || defined(CONFIG_8xx_CONS_SCC4)
+	serial_register(&serial_scc_device);
+#endif
+}
+
 #ifdef CONFIG_MODEM_SUPPORT
 void disable_putc(void)
 {
diff --git a/common/serial.c b/common/serial.c
index 84dbe50..0187dac 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -40,6 +40,8 @@ static void serial_null(void)
 	void name(void)						\
 		__attribute__((weak, alias("serial_null")));
 
+serial_initfunc(mpc8xx_serial_initialize);
+
 void serial_register(struct serial_device *dev)
 {
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
@@ -57,14 +59,7 @@ void serial_register(struct serial_device *dev)
 
 void serial_initialize(void)
 {
-#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2)
-	serial_register(&serial_smc_device);
-#endif
-#if	defined(CONFIG_8xx_CONS_SCC1) || defined(CONFIG_8xx_CONS_SCC2) || \
-	defined(CONFIG_8xx_CONS_SCC3) || defined(CONFIG_8xx_CONS_SCC4)
-	serial_register(&serial_scc_device);
-#endif
-
+	mpc8xx_serial_initialize();
 #if defined(CONFIG_SYS_NS16550_SERIAL)
 #if defined(CONFIG_SYS_NS16550_COM1)
 	serial_register(&eserial1_device);
-- 
1.7.10.4

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

* [U-Boot] [PATCH 10/70] serial: s3c24xx: Move serial registration from serial_initialize()
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (8 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 09/70] serial: mpc8xx: Move serial registration from serial_initialize() Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 11/70] serial: pxa: " Marek Vasut
                     ` (60 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Move the registration of s3c24xx_serialN_device ports from
default serial_initialize() into driver specific function called from
serial_initialize(). This slims down the serial_initialize() call
to a bare tracker of all possible serial port registration routines
in U-Boot.

The newly implemented s3c24xx_serial_initialize() function, which is
implemented inside of the serial_s3c24xx driver allows encapsulation
of s3c24xx_serialN_device within the serial_s3c24xx driver itself.

Also, remove the exports of s3c24xx_serialN_device from include/serial.h
as they are no longer needed. This is simply because the implementation of
default_serial_console() is wrapped into the serial_s3c24xx driver and
the default console is picked by CONFIG_SERIAL<N> macro in config file.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: C Nauman <cnauman@diagraph.com>
---
 common/serial.c                 |    7 ++-----
 drivers/serial/serial_s3c24x0.c |    7 +++++++
 include/serial.h                |    6 ------
 3 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 0187dac..b210b05 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -41,6 +41,7 @@ static void serial_null(void)
 		__attribute__((weak, alias("serial_null")));
 
 serial_initfunc(mpc8xx_serial_initialize);
+serial_initfunc(s3c24xx_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -83,11 +84,7 @@ void serial_initialize(void)
 #if defined(CONFIG_STUART)
 	serial_register(&serial_stuart_device);
 #endif
-#if defined(CONFIG_S3C2410)
-	serial_register(&s3c24xx_serial0_device);
-	serial_register(&s3c24xx_serial1_device);
-	serial_register(&s3c24xx_serial2_device);
-#endif
+	s3c24xx_serial_initialize();
 #if defined(CONFIG_S5P)
 	serial_register(&s5p_serial0_device);
 	serial_register(&s5p_serial1_device);
diff --git a/drivers/serial/serial_s3c24x0.c b/drivers/serial/serial_s3c24x0.c
index fa6aac0..625c6b7 100644
--- a/drivers/serial/serial_s3c24x0.c
+++ b/drivers/serial/serial_s3c24x0.c
@@ -323,4 +323,11 @@ __weak struct serial_device *default_serial_console(void)
 #error "CONFIG_SERIAL? missing."
 #endif
 }
+
+void s3c24xx_serial_initialize(void)
+{
+	serial_register(&s3c24xx_serial0_device);
+	serial_register(&s3c24xx_serial1_device);
+	serial_register(&s3c24xx_serial2_device);
+}
 #endif /* CONFIG_SERIAL_MULTI */
diff --git a/include/serial.h b/include/serial.h
index 4d19259..1da4ac4 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -57,12 +57,6 @@ extern struct serial_device uartlite_serial2_device;
 extern struct serial_device uartlite_serial3_device;
 #endif
 
-#if defined(CONFIG_S3C2410)
-extern struct serial_device s3c24xx_serial0_device;
-extern struct serial_device s3c24xx_serial1_device;
-extern struct serial_device s3c24xx_serial2_device;
-#endif
-
 #if defined(CONFIG_S5P)
 extern struct serial_device s5p_serial0_device;
 extern struct serial_device s5p_serial1_device;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 11/70] serial: pxa: Move serial registration from serial_initialize()
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (9 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 10/70] serial: s3c24xx: " Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 12/70] serial: s5p: " Marek Vasut
                     ` (59 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Move the registration of serial_XXuart ports from default
serial_initialize() into driver specific function called from
serial_initialize(). This slims down the serial_initialize() call
to a bare tracker of all possible serial port registration routines
in U-Boot.

The newly implemented pxa_serial_initialize() function, which is
implemented inside of the serial_pxa driver allows encapsulation
of serial_XXuart within the serial_pxa driver itself.

Also, remove the exports of serial_XXuart from include/serial.h
as they are no longer needed. This is simply because the implementation of
default_serial_console() is wrapped into the serial_pxa driver and
the default console is picked by CONFIG_CONS_IDX macro in config file.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c             |   11 ++---------
 drivers/serial/serial_pxa.c |   13 +++++++++++++
 include/serial.h            |    4 ----
 3 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index b210b05..d457d23 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -41,6 +41,7 @@ static void serial_null(void)
 		__attribute__((weak, alias("serial_null")));
 
 serial_initfunc(mpc8xx_serial_initialize);
+serial_initfunc(pxa_serial_initialize);
 serial_initfunc(s3c24xx_serial_initialize);
 
 void serial_register(struct serial_device *dev)
@@ -75,15 +76,7 @@ void serial_initialize(void)
 	serial_register(&eserial4_device);
 #endif
 #endif /* CONFIG_SYS_NS16550_SERIAL */
-#if defined(CONFIG_FFUART)
-	serial_register(&serial_ffuart_device);
-#endif
-#if defined(CONFIG_BTUART)
-	serial_register(&serial_btuart_device);
-#endif
-#if defined(CONFIG_STUART)
-	serial_register(&serial_stuart_device);
-#endif
+	pxa_serial_initialize();
 	s3c24xx_serial_initialize();
 #if defined(CONFIG_S5P)
 	serial_register(&s5p_serial0_device);
diff --git a/drivers/serial/serial_pxa.c b/drivers/serial/serial_pxa.c
index bd3b3cf..46d7689 100644
--- a/drivers/serial/serial_pxa.c
+++ b/drivers/serial/serial_pxa.c
@@ -314,4 +314,17 @@ __weak struct serial_device *default_serial_console(void)
 #error "Bad CONFIG_CONS_INDEX."
 #endif
 }
+
+void pxa_serial_initialize(void)
+{
+#if defined(CONFIG_FFUART)
+	serial_register(&serial_ffuart_device);
+#endif
+#if defined(CONFIG_BTUART)
+	serial_register(&serial_btuart_device);
+#endif
+#if defined(CONFIG_STUART)
+	serial_register(&serial_stuart_device);
+#endif
+}
 #endif
diff --git a/include/serial.h b/include/serial.h
index 1da4ac4..8eff282 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -71,10 +71,6 @@ extern struct serial_device zoom2_serial_device2;
 extern struct serial_device zoom2_serial_device3;
 #endif
 
-extern struct serial_device serial_ffuart_device;
-extern struct serial_device serial_btuart_device;
-extern struct serial_device serial_stuart_device;
-
 #if defined(CONFIG_SYS_BFIN_UART)
 extern void serial_register_bfin_uart(void);
 extern struct serial_device bfin_serial0_device;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 12/70] serial: s5p: Move serial registration from serial_initialize()
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (10 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 11/70] serial: pxa: " Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 13/70] serial: microblaze: " Marek Vasut
                     ` (58 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Move the registration of s5p_serialN_device ports from default
serial_initialize() into driver specific function called from
serial_initialize(). This slims down the serial_initialize() call
to a bare tracker of all possible serial port registration routines
in U-Boot.

The newly implemented s5p_serial_initialize() function, which is
implemented inside of the serial_s5p driver allows encapsulation
of s5p_serialN_device within the serial_s5p driver itself.

Also, remove the exports of s5p_serialN_device from include/serial.h
as they are no longer needed. This is simply because the implementation of
default_serial_console() is wrapped into the serial_s5p driver and
the default console is picked by CONFIG_SERIAL<N> macro in config file.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 common/serial.c             |    8 ++------
 drivers/serial/serial_s5p.c |    8 ++++++++
 include/serial.h            |    7 -------
 3 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index d457d23..c021c3f 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -43,6 +43,7 @@ static void serial_null(void)
 serial_initfunc(mpc8xx_serial_initialize);
 serial_initfunc(pxa_serial_initialize);
 serial_initfunc(s3c24xx_serial_initialize);
+serial_initfunc(s5p_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -78,12 +79,7 @@ void serial_initialize(void)
 #endif /* CONFIG_SYS_NS16550_SERIAL */
 	pxa_serial_initialize();
 	s3c24xx_serial_initialize();
-#if defined(CONFIG_S5P)
-	serial_register(&s5p_serial0_device);
-	serial_register(&s5p_serial1_device);
-	serial_register(&s5p_serial2_device);
-	serial_register(&s5p_serial3_device);
-#endif
+	s5p_serial_initialize();
 #if defined(CONFIG_MPC512X)
 #if defined(CONFIG_SYS_PSC1)
 	serial_register(&serial1_device);
diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c
index 43cbc4f..3c41242 100644
--- a/drivers/serial/serial_s5p.c
+++ b/drivers/serial/serial_s5p.c
@@ -221,3 +221,11 @@ __weak struct serial_device *default_serial_console(void)
 #error "CONFIG_SERIAL? missing."
 #endif
 }
+
+void s5p_serial_initialize(void)
+{
+	serial_register(&s5p_serial0_device);
+	serial_register(&s5p_serial1_device);
+	serial_register(&s5p_serial2_device);
+	serial_register(&s5p_serial3_device);
+}
diff --git a/include/serial.h b/include/serial.h
index 8eff282..773eace 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -57,13 +57,6 @@ extern struct serial_device uartlite_serial2_device;
 extern struct serial_device uartlite_serial3_device;
 #endif
 
-#if defined(CONFIG_S5P)
-extern struct serial_device s5p_serial0_device;
-extern struct serial_device s5p_serial1_device;
-extern struct serial_device s5p_serial2_device;
-extern struct serial_device s5p_serial3_device;
-#endif
-
 #if defined(CONFIG_OMAP3_ZOOM2)
 extern struct serial_device zoom2_serial_device0;
 extern struct serial_device zoom2_serial_device1;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 13/70] serial: microblaze: Move serial registration from serial_initialize()
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (11 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 12/70] serial: s5p: " Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 14/70] serial: mpc512x: " Marek Vasut
                     ` (57 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Move the registration of xuartlite_serialN_device ports from
default serial_initialize() into driver specific function called from
serial_initialize(). This slims down the serial_initialize() call
to a bare tracker of all possible serial port registration routines
in U-Boot.

The newly implemented xuartlite_serial_initialize() function, which is
implemented inside of the serial_xuartlite driver allows encapsulation
of xuartlite_serialN_device within the serial_xuartlite driver itself.

Also, remove the exports of xuartlite_serialN_device from include/serial.h
as they are no longer needed. This is simply because the implementation of
default_serial_console() is wrapped into the serial_xuartlite driver and
the default console is picked by CONFIG_SERIAL<N> macro in config file.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Michal Simek <monstr@monstr.eu>
---
 common/serial.c                   |   16 ++--------------
 drivers/serial/serial_xuartlite.c |   16 ++++++++++++++++
 include/serial.h                  |    7 -------
 3 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index c021c3f..e19a17f 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -44,6 +44,7 @@ serial_initfunc(mpc8xx_serial_initialize);
 serial_initfunc(pxa_serial_initialize);
 serial_initfunc(s3c24xx_serial_initialize);
 serial_initfunc(s5p_serial_initialize);
+serial_initfunc(uartlite_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -97,20 +98,7 @@ void serial_initialize(void)
 #if defined(CONFIG_SYS_BFIN_UART)
 	serial_register_bfin_uart();
 #endif
-#if defined(CONFIG_XILINX_UARTLITE)
-# ifdef XILINX_UARTLITE_BASEADDR
-	serial_register(&uartlite_serial0_device);
-# endif /* XILINX_UARTLITE_BASEADDR */
-# ifdef XILINX_UARTLITE_BASEADDR1
-	serial_register(&uartlite_serial1_device);
-# endif /* XILINX_UARTLITE_BASEADDR1 */
-# ifdef XILINX_UARTLITE_BASEADDR2
-	serial_register(&uartlite_serial2_device);
-# endif /* XILINX_UARTLITE_BASEADDR2 */
-# ifdef XILINX_UARTLITE_BASEADDR3
-	serial_register(&uartlite_serial3_device);
-# endif /* XILINX_UARTLITE_BASEADDR3 */
-#endif /* CONFIG_XILINX_UARTLITE */
+	uartlite_serial_initialize();
 	serial_assign(default_serial_console()->name);
 }
 
diff --git a/drivers/serial/serial_xuartlite.c b/drivers/serial/serial_xuartlite.c
index b3bb066..164497e 100644
--- a/drivers/serial/serial_xuartlite.c
+++ b/drivers/serial/serial_xuartlite.c
@@ -181,4 +181,20 @@ __weak struct serial_device *default_serial_console(void)
 
 	return NULL;
 }
+
+void uartlite_serial_initialize(void)
+{
+#ifdef XILINX_UARTLITE_BASEADDR
+	serial_register(&uartlite_serial0_device);
+#endif /* XILINX_UARTLITE_BASEADDR */
+#ifdef XILINX_UARTLITE_BASEADDR1
+	serial_register(&uartlite_serial1_device);
+#endif /* XILINX_UARTLITE_BASEADDR1 */
+#ifdef XILINX_UARTLITE_BASEADDR2
+	serial_register(&uartlite_serial2_device);
+#endif /* XILINX_UARTLITE_BASEADDR2 */
+#ifdef XILINX_UARTLITE_BASEADDR3
+	serial_register(&uartlite_serial3_device);
+#endif /* XILINX_UARTLITE_BASEADDR3 */
+}
 #endif /* CONFIG_SERIAL_MULTI */
diff --git a/include/serial.h b/include/serial.h
index 773eace..51a044d 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -50,13 +50,6 @@ extern struct serial_device serial4_device;
 extern struct serial_device serial6_device;
 #endif
 
-#if defined(CONFIG_XILINX_UARTLITE)
-extern struct serial_device uartlite_serial0_device;
-extern struct serial_device uartlite_serial1_device;
-extern struct serial_device uartlite_serial2_device;
-extern struct serial_device uartlite_serial3_device;
-#endif
-
 #if defined(CONFIG_OMAP3_ZOOM2)
 extern struct serial_device zoom2_serial_device0;
 extern struct serial_device zoom2_serial_device1;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 14/70] serial: mpc512x: Move serial registration from serial_initialize()
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (12 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 13/70] serial: microblaze: " Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 15/70] serial: ns16550: " Marek Vasut
                     ` (56 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Move the registration of serialN_device ports from default
serial_initialize() into driver specific function called from
serial_initialize(). This slims down the serial_initialize() call
to a bare tracker of all possible serial port registration routines
in U-Boot.

The newly implemented mpc512x_serial_initialize() function, which is
implemented inside of the mpc512x serial driver allows encapsulation
of serialN_device within the mpc512x serial driver itself.

Also, remove the exports of serialN_device from include/serial.h
as they are no longer needed. This is simply because the implementation of
default_serial_console() is wrapped into the mpx512x serial driver and
the default console is picked by CONFIG_SERIAL<N> macro in config file.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/powerpc/cpu/mpc512x/serial.c |   16 ++++++++++++++++
 common/serial.c                   |   16 ++--------------
 include/serial.h                  |    7 -------
 3 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/arch/powerpc/cpu/mpc512x/serial.c b/arch/powerpc/cpu/mpc512x/serial.c
index f4f52ad..bc10c50 100644
--- a/arch/powerpc/cpu/mpc512x/serial.c
+++ b/arch/powerpc/cpu/mpc512x/serial.c
@@ -365,6 +365,22 @@ __weak struct serial_device *default_serial_console(void)
 #endif
 }
 
+void mpc512x_serial_initialize(void)
+{
+#if defined(CONFIG_SYS_PSC1)
+	serial_register(&serial1_device);
+#endif
+#if defined(CONFIG_SYS_PSC3)
+	serial_register(&serial3_device);
+#endif
+#if defined(CONFIG_SYS_PSC4)
+	serial_register(&serial4_device);
+#endif
+#if defined(CONFIG_SYS_PSC6)
+	serial_register(&serial6_device);
+#endif
+}
+
 #else
 
 void serial_setbrg(void)
diff --git a/common/serial.c b/common/serial.c
index e19a17f..08c6e2a 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -44,6 +44,7 @@ serial_initfunc(mpc8xx_serial_initialize);
 serial_initfunc(pxa_serial_initialize);
 serial_initfunc(s3c24xx_serial_initialize);
 serial_initfunc(s5p_serial_initialize);
+serial_initfunc(mpc512x_serial_initialize);
 serial_initfunc(uartlite_serial_initialize);
 
 void serial_register(struct serial_device *dev)
@@ -81,20 +82,7 @@ void serial_initialize(void)
 	pxa_serial_initialize();
 	s3c24xx_serial_initialize();
 	s5p_serial_initialize();
-#if defined(CONFIG_MPC512X)
-#if defined(CONFIG_SYS_PSC1)
-	serial_register(&serial1_device);
-#endif
-#if defined(CONFIG_SYS_PSC3)
-	serial_register(&serial3_device);
-#endif
-#if defined(CONFIG_SYS_PSC4)
-	serial_register(&serial4_device);
-#endif
-#if defined(CONFIG_SYS_PSC6)
-	serial_register(&serial6_device);
-#endif
-#endif
+	mpc512x_serial_initialize();
 #if defined(CONFIG_SYS_BFIN_UART)
 	serial_register_bfin_uart();
 #endif
diff --git a/include/serial.h b/include/serial.h
index 51a044d..71822c6 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -43,13 +43,6 @@ extern struct serial_device eserial4_device;
 
 #endif
 
-#if defined(CONFIG_MPC512X)
-extern struct serial_device serial1_device;
-extern struct serial_device serial3_device;
-extern struct serial_device serial4_device;
-extern struct serial_device serial6_device;
-#endif
-
 #if defined(CONFIG_OMAP3_ZOOM2)
 extern struct serial_device zoom2_serial_device0;
 extern struct serial_device zoom2_serial_device1;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 15/70] serial: ns16550: Move serial registration from serial_initialize()
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (13 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 14/70] serial: mpc512x: " Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 16/70] serial: bfin: Remove the bfin_serialN_device exports from serial.h Marek Vasut
                     ` (55 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Move the registration of eserialN_device ports from default
serial_initialize() into driver specific function called from
serial_initialize(). This slims down the serial_initialize() call
to a bare tracker of all possible serial port registration routines
in U-Boot.

The newly implemented ns16550_serial_initialize() function, which is
implemented inside of the ns16550 serial driver allows encapsulation
of eserialN_device within the ns16550 serial driver itself.

Also, remove the exports of eserialN_device from include/serial.h
as they are no longer needed. This is simply because the implementation of
default_serial_console() is wrapped into the ns16550 serial driver and
the default console is picked by CONFIG_SERIAL<N> macro in config file.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Michal Simek <monstr@monstr.eu>
---
 common/serial.c         |   16 ++--------------
 drivers/serial/serial.c |   16 ++++++++++++++++
 include/serial.h        |    8 ++------
 3 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 08c6e2a..faad804 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -41,6 +41,7 @@ static void serial_null(void)
 		__attribute__((weak, alias("serial_null")));
 
 serial_initfunc(mpc8xx_serial_initialize);
+serial_initfunc(ns16550_serial_initialize);
 serial_initfunc(pxa_serial_initialize);
 serial_initfunc(s3c24xx_serial_initialize);
 serial_initfunc(s5p_serial_initialize);
@@ -65,20 +66,7 @@ void serial_register(struct serial_device *dev)
 void serial_initialize(void)
 {
 	mpc8xx_serial_initialize();
-#if defined(CONFIG_SYS_NS16550_SERIAL)
-#if defined(CONFIG_SYS_NS16550_COM1)
-	serial_register(&eserial1_device);
-#endif
-#if defined(CONFIG_SYS_NS16550_COM2)
-	serial_register(&eserial2_device);
-#endif
-#if defined(CONFIG_SYS_NS16550_COM3)
-	serial_register(&eserial3_device);
-#endif
-#if defined(CONFIG_SYS_NS16550_COM4)
-	serial_register(&eserial4_device);
-#endif
-#endif /* CONFIG_SYS_NS16550_SERIAL */
+	ns16550_serial_initialize();
 	pxa_serial_initialize();
 	s3c24xx_serial_initialize();
 	s5p_serial_initialize();
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index 9d92dee..00ad97c 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -340,4 +340,20 @@ __weak struct serial_device *default_serial_console(void)
 #endif
 }
 
+void ns16550_serial_initialize(void)
+{
+#if defined(CONFIG_SYS_NS16550_COM1)
+	serial_register(&eserial1_device);
+#endif
+#if defined(CONFIG_SYS_NS16550_COM2)
+	serial_register(&eserial2_device);
+#endif
+#if defined(CONFIG_SYS_NS16550_COM3)
+	serial_register(&eserial3_device);
+#endif
+#if defined(CONFIG_SYS_NS16550_COM4)
+	serial_register(&eserial4_device);
+#endif
+}
+
 #endif /* CONFIG_SERIAL_MULTI */
diff --git a/include/serial.h b/include/serial.h
index 71822c6..b44fac2 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -34,14 +34,10 @@ extern struct serial_device *default_serial_console(void);
 	defined(CONFIG_MICROBLAZE)
 extern struct serial_device serial0_device;
 extern struct serial_device serial1_device;
-#if defined(CONFIG_SYS_NS16550_SERIAL)
+#endif
+
 extern struct serial_device eserial1_device;
 extern struct serial_device eserial2_device;
-extern struct serial_device eserial3_device;
-extern struct serial_device eserial4_device;
-#endif /* CONFIG_SYS_NS16550_SERIAL */
-
-#endif
 
 #if defined(CONFIG_OMAP3_ZOOM2)
 extern struct serial_device zoom2_serial_device0;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 16/70] serial: bfin: Remove the bfin_serialN_device exports from serial.h
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (14 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 15/70] serial: ns16550: " Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 17/70] serial: bfin: Adjust serial_register_bfin_uart() Marek Vasut
                     ` (54 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Remove the exports from serial.h as they are only used in the blackfin
serial driver. Furthermore, they are only used for registration, which
is handled already inside that driver and default_serial_port() call,
which is also handled in that driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Mike Frysinger <vapier@gentoo.org>
---
 include/serial.h |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/include/serial.h b/include/serial.h
index b44fac2..00efe68 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -48,10 +48,6 @@ extern struct serial_device zoom2_serial_device3;
 
 #if defined(CONFIG_SYS_BFIN_UART)
 extern void serial_register_bfin_uart(void);
-extern struct serial_device bfin_serial0_device;
-extern struct serial_device bfin_serial1_device;
-extern struct serial_device bfin_serial2_device;
-extern struct serial_device bfin_serial3_device;
 #endif
 
 extern void serial_register(struct serial_device *);
-- 
1.7.10.4

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

* [U-Boot] [PATCH 17/70] serial: bfin: Adjust serial_register_bfin_uart()
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (15 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 16/70] serial: bfin: Remove the bfin_serialN_device exports from serial.h Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 18/70] serial: zoom2: Remove zoom2 serial prototypes from serial.h Marek Vasut
                     ` (53 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Rename the serial_register_bfin_uart() to bfin_initialize_serial()
to be consistent with the rest of the naming. Next, remove it's
prototype from serial.h and properly insert it into serial.c as
the rest of the serial initialization functions.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Mike Frysinger <vapier@gentoo.org>
---
 arch/blackfin/cpu/serial.c |    2 +-
 common/serial.c            |    5 ++---
 include/serial.h           |    4 ----
 3 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/arch/blackfin/cpu/serial.c b/arch/blackfin/cpu/serial.c
index 33677ba..64340ec 100644
--- a/arch/blackfin/cpu/serial.c
+++ b/arch/blackfin/cpu/serial.c
@@ -272,7 +272,7 @@ __weak struct serial_device *default_serial_console(void)
 #endif
 }
 
-void serial_register_bfin_uart(void)
+void bfin_serial_initialize(void)
 {
 #ifdef UART0_DLL
 	serial_register(&bfin_serial0_device);
diff --git a/common/serial.c b/common/serial.c
index faad804..0a43c1b 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -45,6 +45,7 @@ serial_initfunc(ns16550_serial_initialize);
 serial_initfunc(pxa_serial_initialize);
 serial_initfunc(s3c24xx_serial_initialize);
 serial_initfunc(s5p_serial_initialize);
+serial_initfunc(bfin_serial_initialize);
 serial_initfunc(mpc512x_serial_initialize);
 serial_initfunc(uartlite_serial_initialize);
 
@@ -71,9 +72,7 @@ void serial_initialize(void)
 	s3c24xx_serial_initialize();
 	s5p_serial_initialize();
 	mpc512x_serial_initialize();
-#if defined(CONFIG_SYS_BFIN_UART)
-	serial_register_bfin_uart();
-#endif
+	bfin_serial_initialize();
 	uartlite_serial_initialize();
 	serial_assign(default_serial_console()->name);
 }
diff --git a/include/serial.h b/include/serial.h
index 00efe68..5f9899e 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -46,10 +46,6 @@ extern struct serial_device zoom2_serial_device2;
 extern struct serial_device zoom2_serial_device3;
 #endif
 
-#if defined(CONFIG_SYS_BFIN_UART)
-extern void serial_register_bfin_uart(void);
-#endif
-
 extern void serial_register(struct serial_device *);
 extern void serial_initialize(void);
 extern void serial_stdio_init(void);
-- 
1.7.10.4

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

* [U-Boot] [PATCH 18/70] serial: zoom2: Remove zoom2 serial prototypes from serial.h
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (16 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 17/70] serial: bfin: Adjust serial_register_bfin_uart() Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 19/70] serial: bfin: Flip the jtag serial console to CONFIG_SERIAL_MULTI Marek Vasut
                     ` (52 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Remove the prototypes for zoom2_serial_deviceN from serial.h . This
can't be done right away, as they are referenced from the zoom2
config file. Therefore, adjust the code so the config file only
specifies number of the port. Then, replace the simple return in
default_serial_console() with a switch across possible values, which
returns the zoom2_serial_deviceN . With such adjustment in place,
the exported prototypes in serial.h can be safely removed.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 board/logicpd/zoom2/zoom2_serial.c |    7 ++++++-
 include/configs/omap3_zoom2.h      |    2 +-
 include/serial.h                   |    7 -------
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/board/logicpd/zoom2/zoom2_serial.c b/board/logicpd/zoom2/zoom2_serial.c
index 74f165f..9b7aea8 100644
--- a/board/logicpd/zoom2/zoom2_serial.c
+++ b/board/logicpd/zoom2/zoom2_serial.c
@@ -135,5 +135,10 @@ QUAD_INIT (3)
 
 struct serial_device *default_serial_console(void)
 {
-	return ZOOM2_DEFAULT_SERIAL_DEVICE;
+	switch (ZOOM2_DEFAULT_SERIAL_DEVICE) {
+	case 0: return &zoom2_serial_device0;
+	case 1: return &zoom2_serial_device1;
+	case 2: return &zoom2_serial_device2;
+	case 3: return &zoom2_serial_device3;
+	}
 }
diff --git a/include/configs/omap3_zoom2.h b/include/configs/omap3_zoom2.h
index 4447dff..a7cc5fc 100644
--- a/include/configs/omap3_zoom2.h
+++ b/include/configs/omap3_zoom2.h
@@ -81,7 +81,7 @@
  * 0 - 1 : first  USB with respect to the left edge of the debug board
  * 2 - 3 : second USB with respect to the left edge of the debug board
  */
-#define ZOOM2_DEFAULT_SERIAL_DEVICE	(&zoom2_serial_device0)
+#define ZOOM2_DEFAULT_SERIAL_DEVICE	0
 
 #define V_NS16550_CLK			(1843200)	/* 1.8432 Mhz */
 
diff --git a/include/serial.h b/include/serial.h
index 5f9899e..01a86b4 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -39,13 +39,6 @@ extern struct serial_device serial1_device;
 extern struct serial_device eserial1_device;
 extern struct serial_device eserial2_device;
 
-#if defined(CONFIG_OMAP3_ZOOM2)
-extern struct serial_device zoom2_serial_device0;
-extern struct serial_device zoom2_serial_device1;
-extern struct serial_device zoom2_serial_device2;
-extern struct serial_device zoom2_serial_device3;
-#endif
-
 extern void serial_register(struct serial_device *);
 extern void serial_initialize(void);
 extern void serial_stdio_init(void);
-- 
1.7.10.4

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

* [U-Boot] [PATCH 19/70] serial: bfin: Flip the jtag serial console to CONFIG_SERIAL_MULTI
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (17 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 18/70] serial: zoom2: Remove zoom2 serial prototypes from serial.h Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 20/70] serial: mips: Implement CONFIG_SERIAL_MULTI into au1x00 serial driver Marek Vasut
                     ` (51 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Rework the emulation of serial console via JTAG from simple ad-hoc
implementation of serial port routines to CONFIG_SERIAL_MULTI and
enable CONFIG_SERIAL_MULTI unconditionally for blackfin.

In order for the JTAG serial console to take precedence over all
other serial ports available in system, implement override for
default_serial_console call returning this JTAG serial console.

This brings in a bit of a growth of size, but eventually will allow
us to unconditionally enable CONFIG_SERIAL_MULTI throughout the whole
U-Boot and maintain only one serial subsystem.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Mike Frysinger <vapier@gentoo.org>
---
 arch/blackfin/cpu/jtag-console.c  |   37 ++++++++++++++++++++++++++++++-------
 common/serial.c                   |    2 ++
 include/configs/bfin_adi_common.h |    2 +-
 3 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/arch/blackfin/cpu/jtag-console.c b/arch/blackfin/cpu/jtag-console.c
index a77358a..7cddb85 100644
--- a/arch/blackfin/cpu/jtag-console.c
+++ b/arch/blackfin/cpu/jtag-console.c
@@ -194,12 +194,35 @@ int drv_jtag_console_init(void)
 }
 
 #ifdef CONFIG_UART_CONSOLE_IS_JTAG
+#include <serial.h>
 /* Since the JTAG is always available (at power on), allow it to fake a UART */
-void serial_set_baud(uint32_t baud) {}
-void serial_setbrg(void)            {}
-int serial_init(void)               { return 0; }
-void serial_putc(const char c)      __attribute__((alias("jtag_putc")));
-void serial_puts(const char *s)     __attribute__((alias("jtag_puts")));
-int serial_tstc(void)               __attribute__((alias("jtag_tstc")));
-int serial_getc(void)               __attribute__((alias("jtag_getc")));
+void jtag_serial_setbrg(void)
+{
+}
+
+int jtag_serial_init(void)
+{
+	return 0;
+}
+
+static struct serial_device serial_jtag_drv = {
+	.name	= "jtag",
+	.start	= jtag_serial_init,
+	.stop	= NULL,
+	.setbrg	= jtag_serial_setbrg,
+	.putc	= jtag_putc,
+	.puts	= jtag_puts,
+	.tstc	= jtag_tstc,
+	.getc	= jtag_getc,
+};
+
+void bfin_jtag_initialize(void)
+{
+	serial_register(&serial_jtag_drv);
+}
+
+struct serial_device *default_serial_console(void)
+{
+	return &serial_jtag_drv;
+}
 #endif
diff --git a/common/serial.c b/common/serial.c
index 0a43c1b..25aeea0 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -46,6 +46,7 @@ serial_initfunc(pxa_serial_initialize);
 serial_initfunc(s3c24xx_serial_initialize);
 serial_initfunc(s5p_serial_initialize);
 serial_initfunc(bfin_serial_initialize);
+serial_initfunc(bfin_jtag_initialize);
 serial_initfunc(mpc512x_serial_initialize);
 serial_initfunc(uartlite_serial_initialize);
 
@@ -73,6 +74,7 @@ void serial_initialize(void)
 	s5p_serial_initialize();
 	mpc512x_serial_initialize();
 	bfin_serial_initialize();
+	bfin_jtag_initialize();
 	uartlite_serial_initialize();
 	serial_assign(default_serial_console()->name);
 }
diff --git a/include/configs/bfin_adi_common.h b/include/configs/bfin_adi_common.h
index 3fbf5c6..7132f8f 100644
--- a/include/configs/bfin_adi_common.h
+++ b/include/configs/bfin_adi_common.h
@@ -108,11 +108,11 @@
 #define CONFIG_LOADS_ECHO	1
 #define CONFIG_JTAG_CONSOLE
 #define CONFIG_SILENT_CONSOLE
+#define CONFIG_SERIAL_MULTI
 #ifndef CONFIG_BAUDRATE
 # define CONFIG_BAUDRATE	57600
 #endif
 #ifndef CONFIG_DEBUG_EARLY_SERIAL
-# define CONFIG_SERIAL_MULTI
 # define CONFIG_SYS_BFIN_UART
 #endif
 
-- 
1.7.10.4

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

* [U-Boot] [PATCH 20/70] serial: mips: Implement CONFIG_SERIAL_MULTI into au1x00 serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (18 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 19/70] serial: bfin: Flip the jtag serial console to CONFIG_SERIAL_MULTI Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 21/70] serial: mips: Implement CONFIG_SERIAL_MULTI into asc " Marek Vasut
                     ` (50 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into au1x00 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the au1x00 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
---
 arch/mips/cpu/mips32/au1x00/au1x00_serial.c |   74 +++++++++++++++++++++++----
 common/serial.c                             |    3 ++
 2 files changed, 67 insertions(+), 10 deletions(-)

diff --git a/arch/mips/cpu/mips32/au1x00/au1x00_serial.c b/arch/mips/cpu/mips32/au1x00/au1x00_serial.c
index c25ba5a..9682775 100644
--- a/arch/mips/cpu/mips32/au1x00/au1x00_serial.c
+++ b/arch/mips/cpu/mips32/au1x00/au1x00_serial.c
@@ -28,6 +28,8 @@
 #include <config.h>
 #include <common.h>
 #include <asm/au1x00.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 /******************************************************************************
 *
@@ -40,7 +42,7 @@
 * RETURNS: N/A
 */
 
-int serial_init (void)
+static int au1x00_serial_init(void)
 {
 	volatile u32 *uart_fifoctl = (volatile u32*)(UART0_ADDR+UART_FCR);
 	volatile u32 *uart_enable = (volatile u32*)(UART0_ADDR+UART_ENABLE);
@@ -63,7 +65,7 @@ int serial_init (void)
 }
 
 
-void serial_setbrg (void)
+static void au1x00_serial_setbrg(void)
 {
 	volatile u32 *uart_clk = (volatile u32*)(UART0_ADDR+UART_CLK);
 	volatile u32 *uart_lcr = (volatile u32*)(UART0_ADDR+UART_LCR);
@@ -87,12 +89,13 @@ void serial_setbrg (void)
 	*uart_lcr = UART_LCR_WLEN8;
 }
 
-void serial_putc (const char c)
+static void au1x00_serial_putc(const char c)
 {
 	volatile u32 *uart_lsr = (volatile u32*)(UART0_ADDR+UART_LSR);
 	volatile u32 *uart_tx = (volatile u32*)(UART0_ADDR+UART_TX);
 
-	if (c == '\n') serial_putc ('\r');
+	if (c == '\n')
+		au1x00_serial_putc('\r');
 
 	/* Wait for fifo to shift out some bytes */
 	while((*uart_lsr&UART_LSR_THRE)==0);
@@ -100,15 +103,13 @@ void serial_putc (const char c)
 	*uart_tx = (u32)c;
 }
 
-void serial_puts (const char *s)
+static void au1x00_serial_puts(const char *s)
 {
 	while (*s)
-	{
-		serial_putc (*s++);
-	}
+		serial_putc(*s++);
 }
 
-int serial_getc (void)
+static int au1x00_serial_getc(void)
 {
 	volatile u32 *uart_rx = (volatile u32*)(UART0_ADDR+UART_RX);
 	char c;
@@ -119,7 +120,7 @@ int serial_getc (void)
 	return c;
 }
 
-int serial_tstc (void)
+static int au1x00_serial_tstc(void)
 {
 	volatile u32 *uart_lsr = (volatile u32*)(UART0_ADDR+UART_LSR);
 
@@ -129,3 +130,56 @@ int serial_tstc (void)
 	}
 	return 0;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device au1x00_serial_drv = {
+	.name	= "au1x00_serial",
+	.start	= au1x00_serial_init,
+	.stop	= NULL,
+	.setbrg	= au1x00_serial_setbrg,
+	.putc	= au1x00_serial_putc,
+	.puts	= au1x00_serial_puts,
+	.getc	= au1x00_serial_getc,
+	.tstc	= au1x00_serial_tstc,
+};
+
+void au1x00_serial_initialize(void)
+{
+	serial_register(&au1x00_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &au1x00_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return au1x00_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	au1x00_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	au1x00_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	au1x00_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return au1x00_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return au1x00_serial_tstc();
+}
+#endif
diff --git a/common/serial.c b/common/serial.c
index 25aeea0..6ddc5fa 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -49,6 +49,7 @@ serial_initfunc(bfin_serial_initialize);
 serial_initfunc(bfin_jtag_initialize);
 serial_initfunc(mpc512x_serial_initialize);
 serial_initfunc(uartlite_serial_initialize);
+serial_initfunc(au1x00_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -76,6 +77,8 @@ void serial_initialize(void)
 	bfin_serial_initialize();
 	bfin_jtag_initialize();
 	uartlite_serial_initialize();
+	au1x00_serial_initialize();
+
 	serial_assign(default_serial_console()->name);
 }
 
-- 
1.7.10.4

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

* [U-Boot] [PATCH 21/70] serial: mips: Implement CONFIG_SERIAL_MULTI into asc serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (19 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 20/70] serial: mips: Implement CONFIG_SERIAL_MULTI into au1x00 serial driver Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 22/70] serial: mips: Implement CONFIG_SERIAL_MULTI into JZ " Marek Vasut
                     ` (49 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into asc serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the asc driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
---
 arch/mips/cpu/mips32/incaip/asc_serial.c |   67 +++++++++++++++++++++++++++---
 common/serial.c                          |    2 +
 2 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/arch/mips/cpu/mips32/incaip/asc_serial.c b/arch/mips/cpu/mips32/incaip/asc_serial.c
index 7239804..b5f32e2 100644
--- a/arch/mips/cpu/mips32/incaip/asc_serial.c
+++ b/arch/mips/cpu/mips32/incaip/asc_serial.c
@@ -5,6 +5,8 @@
 #include <config.h>
 #include <common.h>
 #include <asm/inca-ip.h>
+#include <serial.h>
+#include <linux/compiler.h>
 #include "asc_serial.h"
 
 
@@ -32,7 +34,7 @@ static volatile incaAsc_t *pAsc = (incaAsc_t *)INCA_IP_ASC;
 * RETURNS: N/A
 */
 
-int serial_init (void)
+static int asc_serial_init(void)
 {
     /* we have to set PMU.EN13 bit to enable an ASC device*/
     INCAASC_PMU_ENABLE(13);
@@ -82,7 +84,7 @@ int serial_init (void)
     return 0;
 }
 
-void serial_setbrg (void)
+static void asc_serial_setbrg(void)
 {
     ulong      uiReloadValue, fdv;
     ulong      f_ASC;
@@ -210,7 +212,7 @@ static int serial_setopt (void)
     return 0;
 }
 
-void serial_putc (const char c)
+static void asc_serial_putc(const char c)
 {
     uint txFl = 0;
 
@@ -234,7 +236,7 @@ void serial_putc (const char c)
     }
 }
 
-void serial_puts (const char *s)
+static void asc_serial_puts(const char *s)
 {
     while (*s)
     {
@@ -242,7 +244,7 @@ void serial_puts (const char *s)
     }
 }
 
-int serial_getc (void)
+static int asc_serial_getc(void)
 {
     ulong symbol_mask;
     char c;
@@ -257,7 +259,7 @@ int serial_getc (void)
     return c;
 }
 
-int serial_tstc (void)
+static int asc_serial_tstc(void)
 {
     int res = 1;
 
@@ -283,3 +285,56 @@ int serial_tstc (void)
 
     return res;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device asc_serial_drv = {
+	.name	= "asc_serial",
+	.start	= asc_serial_init,
+	.stop	= NULL,
+	.setbrg	= asc_serial_setbrg,
+	.putc	= asc_serial_putc,
+	.puts	= asc_serial_puts,
+	.getc	= asc_serial_getc,
+	.tstc	= asc_serial_tstc,
+};
+
+void asc_serial_initialize(void)
+{
+	serial_register(&asc_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &asc_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return asc_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	asc_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	asc_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	asc_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return asc_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return asc_serial_tstc();
+}
+#endif
diff --git a/common/serial.c b/common/serial.c
index 6ddc5fa..d6e83f8 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -50,6 +50,7 @@ serial_initfunc(bfin_jtag_initialize);
 serial_initfunc(mpc512x_serial_initialize);
 serial_initfunc(uartlite_serial_initialize);
 serial_initfunc(au1x00_serial_initialize);
+serial_initfunc(asc_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -78,6 +79,7 @@ void serial_initialize(void)
 	bfin_jtag_initialize();
 	uartlite_serial_initialize();
 	au1x00_serial_initialize();
+	asc_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 22/70] serial: mips: Implement CONFIG_SERIAL_MULTI into JZ serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (20 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 21/70] serial: mips: Implement CONFIG_SERIAL_MULTI into asc " Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 23/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc5xx " Marek Vasut
                     ` (48 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into JZ serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the JZ driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
---
 arch/mips/cpu/xburst/jz_serial.c |   67 ++++++++++++++++++++++++++++++++++----
 common/serial.c                  |    2 ++
 2 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/arch/mips/cpu/xburst/jz_serial.c b/arch/mips/cpu/xburst/jz_serial.c
index e6c48e0..b1e1d27 100644
--- a/arch/mips/cpu/xburst/jz_serial.c
+++ b/arch/mips/cpu/xburst/jz_serial.c
@@ -23,6 +23,8 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/jz4740.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 /*
  * serial_init - initialize a channel
@@ -35,7 +37,7 @@
  */
 struct jz4740_uart *uart = (struct jz4740_uart *)CONFIG_SYS_UART_BASE;
 
-int serial_init(void)
+static int jz_serial_init(void)
 {
 	/* Disable port interrupts while changing hardware */
 	writeb(0, &uart->dlhr_ier);
@@ -62,7 +64,7 @@ int serial_init(void)
 	return 0;
 }
 
-void serial_setbrg(void)
+static void jz_serial_setbrg(void)
 {
 	u32 baud_div, tmp;
 
@@ -79,7 +81,7 @@ void serial_setbrg(void)
 	writeb(tmp, &uart->lcr);
 }
 
-int serial_tstc(void)
+static int jz_serial_tstc(void)
 {
 	if (readb(&uart->lsr) & UART_LSR_DR)
 		return 1;
@@ -87,7 +89,7 @@ int serial_tstc(void)
 	return 0;
 }
 
-void serial_putc(const char c)
+static void jz_serial_putc(const char c)
 {
 	if (c == '\n')
 		serial_putc('\r');
@@ -99,7 +101,7 @@ void serial_putc(const char c)
 	writeb((u8)c, &uart->rbr_thr_dllr);
 }
 
-int serial_getc(void)
+static int jz_serial_getc(void)
 {
 	while (!serial_tstc())
 		;
@@ -107,8 +109,61 @@ int serial_getc(void)
 	return readb(&uart->rbr_thr_dllr);
 }
 
-void serial_puts(const char *s)
+static void jz_serial_puts(const char *s)
 {
 	while (*s)
 		serial_putc(*s++);
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device jz_serial_drv = {
+	.name	= "jz_serial",
+	.start	= jz_serial_init,
+	.stop	= NULL,
+	.setbrg	= jz_serial_setbrg,
+	.putc	= jz_serial_putc,
+	.puts	= jz_serial_puts,
+	.getc	= jz_serial_getc,
+	.tstc	= jz_serial_tstc,
+};
+
+void jz_serial_initialize(void)
+{
+	serial_register(&jz_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &jz_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return jz_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	jz_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	jz_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	jz_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return jz_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return jz_serial_tstc();
+}
+#endif
diff --git a/common/serial.c b/common/serial.c
index d6e83f8..dd35a62 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -51,6 +51,7 @@ serial_initfunc(mpc512x_serial_initialize);
 serial_initfunc(uartlite_serial_initialize);
 serial_initfunc(au1x00_serial_initialize);
 serial_initfunc(asc_serial_initialize);
+serial_initfunc(jz_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -80,6 +81,7 @@ void serial_initialize(void)
 	uartlite_serial_initialize();
 	au1x00_serial_initialize();
 	asc_serial_initialize();
+	jz_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 23/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc5xx serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (21 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 22/70] serial: mips: Implement CONFIG_SERIAL_MULTI into JZ " Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 24/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8220 " Marek Vasut
                     ` (47 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into mpc5xx serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the mpc5xx driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/powerpc/cpu/mpc5xx/serial.c |   95 +++++++++++++++++++++++++++++---------
 common/serial.c                  |    2 +
 2 files changed, 76 insertions(+), 21 deletions(-)

diff --git a/arch/powerpc/cpu/mpc5xx/serial.c b/arch/powerpc/cpu/mpc5xx/serial.c
index 88c6db8..dbaacfc 100644
--- a/arch/powerpc/cpu/mpc5xx/serial.c
+++ b/arch/powerpc/cpu/mpc5xx/serial.c
@@ -33,20 +33,40 @@
 #include <watchdog.h>
 #include <command.h>
 #include <mpc5xx.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
- * Local function prototypes
+ * Local functions
  */
 
-static int ready_to_send(void);
+static int ready_to_send(void)
+{
+	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
+	volatile short status;
+
+	do {
+#if defined(CONFIG_5xx_CONS_SCI1)
+		status = immr->im_qsmcm.qsmcm_sc1sr;
+#else
+		status = immr->im_qsmcm.qsmcm_sc2sr;
+#endif
+
+#if defined(CONFIG_WATCHDOG)
+		reset_5xx_watchdog (immr);
+#endif
+	} while ((status & SCI_TDRE) == 0);
+	return 1;
+
+}
 
 /*
  * Minimal global serial functions needed to use one of the SCI modules.
  */
 
-int serial_init (void)
+static int mpc5xx_serial_init(void)
 {
 	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
 
@@ -63,7 +83,7 @@ int serial_init (void)
 	return 0;
 }
 
-void serial_putc(const char c)
+static void mpc5xx_serial_putc(const char c)
 {
 	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
 
@@ -85,7 +105,7 @@ void serial_putc(const char c)
 	}
 }
 
-int serial_getc(void)
+static int mpc5xx_serial_getc(void)
 {
 	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
 	volatile short status;
@@ -113,7 +133,7 @@ int serial_getc(void)
 	return	tmp;
 }
 
-int serial_tstc()
+static int mpc5xx_serial_tstc()
 {
 	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
 	short status;
@@ -127,7 +147,7 @@ int serial_tstc()
 	return (status & SCI_RDRF);
 }
 
-void serial_setbrg (void)
+static void mpc5xx_serial_setbrg(void)
 {
 	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
 	short scxbr;
@@ -141,7 +161,7 @@ void serial_setbrg (void)
 #endif
 }
 
-void serial_puts (const char *s)
+static void mpc5xx_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc(*s);
@@ -149,22 +169,55 @@ void serial_puts (const char *s)
 	}
 }
 
-int ready_to_send(void)
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device mpc5xx_serial_drv = {
+	.name	= "mpc5xx_serial",
+	.start	= mpc5xx_serial_init,
+	.stop	= NULL,
+	.setbrg	= mpc5xx_serial_setbrg,
+	.putc	= mpc5xx_serial_putc,
+	.puts	= mpc5xx_serial_puts,
+	.getc	= mpc5xx_serial_getc,
+	.tstc	= mpc5xx_serial_tstc,
+};
+
+void mpc5xx_serial_initialize(void)
 {
-	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
-	volatile short status;
+	serial_register(&mpc5xx_serial_drv);
+}
 
-	do {
-#if defined(CONFIG_5xx_CONS_SCI1)
-		status = immr->im_qsmcm.qsmcm_sc1sr;
+__weak struct serial_device *default_serial_console(void)
+{
+	return &mpc5xx_serial_drv;
+}
 #else
-		status = immr->im_qsmcm.qsmcm_sc2sr;
-#endif
+int serial_init(void)
+{
+	return mpc5xx_serial_init();
+}
 
-#if defined(CONFIG_WATCHDOG)
-		reset_5xx_watchdog (immr);
-#endif
-	} while ((status & SCI_TDRE) == 0);
-	return 1;
+void serial_setbrg(void)
+{
+	mpc5xx_serial_setbrg();
+}
 
+void serial_putc(const char c)
+{
+	mpc5xx_serial_putc(c);
 }
+
+void serial_puts(const char *s)
+{
+	mpc5xx_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return mpc5xx_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return mpc5xx_serial_tstc();
+}
+#endif
diff --git a/common/serial.c b/common/serial.c
index dd35a62..69fa583 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -52,6 +52,7 @@ serial_initfunc(uartlite_serial_initialize);
 serial_initfunc(au1x00_serial_initialize);
 serial_initfunc(asc_serial_initialize);
 serial_initfunc(jz_serial_initialize);
+serial_initfunc(mpc5xx_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -82,6 +83,7 @@ void serial_initialize(void)
 	au1x00_serial_initialize();
 	asc_serial_initialize();
 	jz_serial_initialize();
+	mpc5xx_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 24/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8220 serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (22 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 23/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc5xx " Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 25/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8260 serial drivers Marek Vasut
                     ` (46 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into mpc8220 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the mpc8220 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/powerpc/cpu/mpc8220/uart.c |   67 +++++++++++++++++++++++++++++++++++----
 common/serial.c                 |    2 ++
 2 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/cpu/mpc8220/uart.c b/arch/powerpc/cpu/mpc8220/uart.c
index 0c4b536..545c81a 100644
--- a/arch/powerpc/cpu/mpc8220/uart.c
+++ b/arch/powerpc/cpu/mpc8220/uart.c
@@ -29,13 +29,15 @@
 
 #include <common.h>
 #include <mpc8220.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
 #define PSC_BASE   MMAP_PSC1
 
 #if defined(CONFIG_PSC_CONSOLE)
-int serial_init (void)
+static int mpc8220_serial_init(void)
 {
 	volatile psc8220_t *psc = (psc8220_t *) PSC_BASE;
 	u32 counter;
@@ -69,7 +71,7 @@ int serial_init (void)
 	return (0);
 }
 
-void serial_putc (const char c)
+static void mpc8220_serial_putc(const char c)
 {
 	volatile psc8220_t *psc = (psc8220_t *) PSC_BASE;
 
@@ -82,14 +84,14 @@ void serial_putc (const char c)
 	psc->xmitbuf[0] = c;
 }
 
-void serial_puts (const char *s)
+static void mpc8220_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
-int serial_getc (void)
+static int mpc8220_serial_getc(void)
 {
 	volatile psc8220_t *psc = (psc8220_t *) PSC_BASE;
 
@@ -98,14 +100,14 @@ int serial_getc (void)
 	return psc->xmitbuf[2];
 }
 
-int serial_tstc (void)
+static int mpc8220_serial_tstc(void)
 {
 	volatile psc8220_t *psc = (psc8220_t *) PSC_BASE;
 
 	return (psc->sr_csr & PSC_SR_RXRDY);
 }
 
-void serial_setbrg (void)
+static void mpc8220_serial_setbrg(void)
 {
 	volatile psc8220_t *psc = (psc8220_t *) PSC_BASE;
 	u32 counter;
@@ -123,4 +125,57 @@ void serial_setbrg (void)
 
 	psc->cr = PSC_CR_RX_ENABLE | PSC_CR_TX_ENABLE;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device mpc8220_serial_drv = {
+	.name	= "mpc8220_serial",
+	.start	= mpc8220_serial_init,
+	.stop	= NULL,
+	.setbrg	= mpc8220_serial_setbrg,
+	.putc	= mpc8220_serial_putc,
+	.puts	= mpc8220_serial_puts,
+	.getc	= mpc8220_serial_getc,
+	.tstc	= mpc8220_serial_tstc,
+};
+
+void mpc8220_serial_initialize(void)
+{
+	serial_register(&mpc8220_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &mpc8220_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return mpc8220_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	mpc8220_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	mpc8220_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	mpc8220_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return mpc8220_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return mpc8220_serial_tstc();
+}
+#endif
 #endif /* CONFIG_PSC_CONSOLE */
diff --git a/common/serial.c b/common/serial.c
index 69fa583..db06f97 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -53,6 +53,7 @@ serial_initfunc(au1x00_serial_initialize);
 serial_initfunc(asc_serial_initialize);
 serial_initfunc(jz_serial_initialize);
 serial_initfunc(mpc5xx_serial_initialize);
+serial_initfunc(mpc8220_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -84,6 +85,7 @@ void serial_initialize(void)
 	asc_serial_initialize();
 	jz_serial_initialize();
 	mpc5xx_serial_initialize();
+	mpc8220_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 25/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8260 serial drivers
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (23 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 24/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8220 " Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 26/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc85xx serial driver Marek Vasut
                     ` (45 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into both SCC and SMC mpc8260
serial drivers. These drivers were so far only usable directly, but this
patch also adds support for the multi method. This allows using more than
one serial driver alongside the mpc8260 drivers. Also, add a weak
implementation of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/powerpc/cpu/mpc8260/serial_scc.c |   71 ++++++++++++++++++++++++++++-----
 arch/powerpc/cpu/mpc8260/serial_smc.c |   71 ++++++++++++++++++++++++++++-----
 common/serial.c                       |    4 ++
 3 files changed, 124 insertions(+), 22 deletions(-)

diff --git a/arch/powerpc/cpu/mpc8260/serial_scc.c b/arch/powerpc/cpu/mpc8260/serial_scc.c
index 4ab6a28..cfbcd79 100644
--- a/arch/powerpc/cpu/mpc8260/serial_scc.c
+++ b/arch/powerpc/cpu/mpc8260/serial_scc.c
@@ -31,6 +31,8 @@
 #include <common.h>
 #include <mpc8260.h>
 #include <asm/cpm_8260.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -82,7 +84,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #endif
 
-int serial_init (void)
+static int mpc8260_scc_serial_init(void)
 {
 	volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
 	volatile scc_t *sp;
@@ -180,8 +182,7 @@ int serial_init (void)
 	return (0);
 }
 
-void
-serial_setbrg (void)
+static void mpc8260_scc_serial_setbrg(void)
 {
 #if defined(CONFIG_CONS_USE_EXTC)
 	m8260_cpm_extcbrg(SCC_INDEX, gd->baudrate,
@@ -191,8 +192,7 @@ serial_setbrg (void)
 #endif
 }
 
-void
-serial_putc(const char c)
+static void mpc8260_scc_serial_putc(const char c)
 {
 	volatile scc_uart_t	*up;
 	volatile cbd_t		*tbdf;
@@ -217,16 +217,14 @@ serial_putc(const char c)
 	tbdf->cbd_sc |= BD_SC_READY;
 }
 
-void
-serial_puts (const char *s)
+static void mpc8260_scc_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
-int
-serial_getc(void)
+static int mpc8260_scc_serial_getc(void)
 {
 	volatile cbd_t		*rbdf;
 	volatile scc_uart_t	*up;
@@ -250,8 +248,7 @@ serial_getc(void)
 	return (c);
 }
 
-int
-serial_tstc()
+static int mpc8260_scc_serial_tstc(void)
 {
 	volatile cbd_t		*rbdf;
 	volatile scc_uart_t	*up;
@@ -264,6 +261,58 @@ serial_tstc()
 	return ((rbdf->cbd_sc & BD_SC_EMPTY) == 0);
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device mpc8260_scc_serial_drv = {
+	.name	= "mpc8260_scc_serial",
+	.start	= mpc8260_scc_serial_init,
+	.stop	= NULL,
+	.setbrg	= mpc8260_scc_serial_setbrg,
+	.putc	= mpc8260_scc_serial_putc,
+	.puts	= mpc8260_scc_serial_puts,
+	.getc	= mpc8260_scc_serial_getc,
+	.tstc	= mpc8260_scc_serial_tstc,
+};
+
+void mpc8260_scc_serial_initialize(void)
+{
+	serial_register(&mpc8260_scc_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &mpc8260_scc_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return mpc8260_scc_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	mpc8260_scc_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	mpc8260_scc_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	mpc8260_scc_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return mpc8260_scc_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return mpc8260_scc_serial_tstc();
+}
+#endif
 #endif	/* CONFIG_CONS_ON_SCC */
 
 #if defined(CONFIG_KGDB_ON_SCC)
diff --git a/arch/powerpc/cpu/mpc8260/serial_smc.c b/arch/powerpc/cpu/mpc8260/serial_smc.c
index 7b6eaba..012fc98 100644
--- a/arch/powerpc/cpu/mpc8260/serial_smc.c
+++ b/arch/powerpc/cpu/mpc8260/serial_smc.c
@@ -33,6 +33,8 @@
 #include <common.h>
 #include <mpc8260.h>
 #include <asm/cpm_8260.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -91,7 +93,7 @@ static unsigned char brg_map[] = {
 	3,	/* BRG1 for SCC4 */
 };
 
-int serial_init (void)
+static int mpc8260_smc_serial_init(void)
 {
 	volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
 	volatile smc_t *sp;
@@ -183,8 +185,7 @@ int serial_init (void)
 	return (0);
 }
 
-void
-serial_setbrg (void)
+static void mpc8260_smc_serial_setbrg(void)
 {
 #if defined(CONFIG_CONS_USE_EXTC)
 	m8260_cpm_extcbrg(brg_map[SMC_INDEX], gd->baudrate,
@@ -194,8 +195,7 @@ serial_setbrg (void)
 #endif
 }
 
-void
-serial_putc(const char c)
+static void mpc8260_smc_serial_putc(const char c)
 {
 	volatile smc_uart_t	*up;
 	volatile immap_t	*im = (immap_t *)CONFIG_SYS_IMMR;
@@ -216,16 +216,14 @@ serial_putc(const char c)
 	rtx->txbd.cbd_sc |= BD_SC_READY;
 }
 
-void
-serial_puts (const char *s)
+static void mpc8260_smc_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
-int
-serial_getc(void)
+static int mpc8260_smc_serial_getc(void)
 {
 	volatile smc_uart_t	*up;
 	volatile immap_t	*im = (immap_t *)CONFIG_SYS_IMMR;
@@ -254,8 +252,7 @@ serial_getc(void)
 	return(c);
 }
 
-int
-serial_tstc()
+static int mpc8260_smc_serial_tstc(void)
 {
 	volatile smc_uart_t	*up;
 	volatile immap_t	*im = (immap_t *)CONFIG_SYS_IMMR;
@@ -267,6 +264,58 @@ serial_tstc()
 	return !(rtx->rxbd.cbd_sc & BD_SC_EMPTY);
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device mpc8260_smc_serial_drv = {
+	.name	= "mpc8260_smc_serial",
+	.start	= mpc8260_smc_serial_init,
+	.stop	= NULL,
+	.setbrg	= mpc8260_smc_serial_setbrg,
+	.putc	= mpc8260_smc_serial_putc,
+	.puts	= mpc8260_smc_serial_puts,
+	.getc	= mpc8260_smc_serial_getc,
+	.tstc	= mpc8260_smc_serial_tstc,
+};
+
+void mpc8260_smc_serial_initialize(void)
+{
+	serial_register(&mpc8260_smc_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &mpc8260_smc_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return mpc8260_smc_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	mpc8260_smc_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	mpc8260_smc_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	mpc8260_smc_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return mpc8260_smc_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return mpc8260_smc_serial_tstc();
+}
+#endif
 #endif	/* CONFIG_CONS_ON_SMC */
 
 #if defined(CONFIG_KGDB_ON_SMC)
diff --git a/common/serial.c b/common/serial.c
index db06f97..5c8cbdd 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -54,6 +54,8 @@ serial_initfunc(asc_serial_initialize);
 serial_initfunc(jz_serial_initialize);
 serial_initfunc(mpc5xx_serial_initialize);
 serial_initfunc(mpc8220_serial_initialize);
+serial_initfunc(mpc8260_scc_serial_initialize);
+serial_initfunc(mpc8260_smc_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -86,6 +88,8 @@ void serial_initialize(void)
 	jz_serial_initialize();
 	mpc5xx_serial_initialize();
 	mpc8220_serial_initialize();
+	mpc8260_scc_serial_initialize();
+	mpc8260_smc_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 26/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc85xx serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (24 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 25/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8260 serial drivers Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 27/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into iop480 " Marek Vasut
                     ` (44 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into mpc85xx serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the mpc85xx driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/powerpc/cpu/mpc85xx/serial_scc.c |   71 ++++++++++++++++++++++++++++-----
 common/serial.c                       |    2 +
 2 files changed, 62 insertions(+), 11 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/serial_scc.c b/arch/powerpc/cpu/mpc85xx/serial_scc.c
index 2dab212..d192642 100644
--- a/arch/powerpc/cpu/mpc85xx/serial_scc.c
+++ b/arch/powerpc/cpu/mpc85xx/serial_scc.c
@@ -34,6 +34,8 @@
 
 #include <common.h>
 #include <asm/cpm_85xx.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -85,7 +87,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #endif
 
-int serial_init (void)
+static int mpc85xx_serial_init(void)
 {
 	volatile ccsr_cpm_t *cpm = (ccsr_cpm_t *)CONFIG_SYS_MPC85xx_CPM_ADDR;
 	volatile ccsr_cpm_scc_t *sp;
@@ -184,8 +186,7 @@ int serial_init (void)
 	return (0);
 }
 
-void
-serial_setbrg (void)
+static void mpc85xx_serial_setbrg(void)
 {
 #if defined(CONFIG_CONS_USE_EXTC)
 	m8560_cpm_extcbrg(SCC_INDEX, gd->baudrate,
@@ -195,8 +196,7 @@ serial_setbrg (void)
 #endif
 }
 
-void
-serial_putc(const char c)
+static void mpc85xx_serial_putc(const char c)
 {
 	volatile scc_uart_t	*up;
 	volatile cbd_t		*tbdf;
@@ -220,16 +220,14 @@ serial_putc(const char c)
 	tbdf->cbd_sc |= BD_SC_READY;
 }
 
-void
-serial_puts (const char *s)
+static void mpc85xx_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
-int
-serial_getc(void)
+static int mpc85xx_serial_getc(void)
 {
 	volatile cbd_t		*rbdf;
 	volatile scc_uart_t	*up;
@@ -252,8 +250,7 @@ serial_getc(void)
 	return (c);
 }
 
-int
-serial_tstc()
+static int mpc85xx_serial_tstc(void)
 {
 	volatile cbd_t		*rbdf;
 	volatile scc_uart_t	*up;
@@ -265,4 +262,56 @@ serial_tstc()
 	return ((rbdf->cbd_sc & BD_SC_EMPTY) == 0);
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device mpc85xx_serial_drv = {
+	.name	= "mpc85xx_serial",
+	.start	= mpc85xx_serial_init,
+	.stop	= NULL,
+	.setbrg	= mpc85xx_serial_setbrg,
+	.putc	= mpc85xx_serial_putc,
+	.puts	= mpc85xx_serial_puts,
+	.getc	= mpc85xx_serial_getc,
+	.tstc	= mpc85xx_serial_tstc,
+};
+
+void mpc85xx_serial_initialize(void)
+{
+	serial_register(&mpc85xx_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &mpc85xx_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return mpc85xx_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	mpc85xx_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	mpc85xx_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	mpc85xx_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return mpc85xx_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return mpc85xx_serial_tstc();
+}
+#endif
 #endif	/* CONFIG_CONS_ON_SCC */
diff --git a/common/serial.c b/common/serial.c
index 5c8cbdd..aeae51d 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -56,6 +56,7 @@ serial_initfunc(mpc5xx_serial_initialize);
 serial_initfunc(mpc8220_serial_initialize);
 serial_initfunc(mpc8260_scc_serial_initialize);
 serial_initfunc(mpc8260_smc_serial_initialize);
+serial_initfunc(mpc85xx_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -90,6 +91,7 @@ void serial_initialize(void)
 	mpc8220_serial_initialize();
 	mpc8260_scc_serial_initialize();
 	mpc8260_smc_serial_initialize();
+	mpc85xx_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 27/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into iop480 serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (25 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 26/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc85xx serial driver Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 28/70] serial: sparc: Implement CONFIG_SERIAL_MULTI into leon2 " Marek Vasut
                     ` (43 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into iop480 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the iop480 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/powerpc/cpu/ppc4xx/iop480_uart.c |   65 ++++++++++++++++++++++++++++++---
 common/serial.c                       |    2 +
 2 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/cpu/ppc4xx/iop480_uart.c b/arch/powerpc/cpu/ppc4xx/iop480_uart.c
index 027ca30..fb25e15 100644
--- a/arch/powerpc/cpu/ppc4xx/iop480_uart.c
+++ b/arch/powerpc/cpu/ppc4xx/iop480_uart.c
@@ -29,6 +29,7 @@
 
 #ifdef CONFIG_SERIAL_MULTI
 #include <serial.h>
+#include <linux/compiler.h>
 #endif
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -132,7 +133,7 @@ DECLARE_GLOBAL_DATA_PTR;
  * as serial console interface.
  */
 
-int serial_init (void)
+static int iop480_serial_init(void)
 {
 	unsigned short br_reg;
 
@@ -153,7 +154,7 @@ int serial_init (void)
 	return (0);
 }
 
-void serial_setbrg (void)
+static void iop480_serial_setbrg(void)
 {
 	unsigned short br_reg;
 
@@ -165,7 +166,7 @@ void serial_setbrg (void)
 	      ((br_reg & 0xff00) >> 8)); /* ... */
 }
 
-void serial_putc (const char c)
+static void iop480_serial_putc(const char c)
 {
 	if (c == '\n')
 		serial_putc ('\r');
@@ -182,14 +183,14 @@ void serial_putc (const char c)
 	}
 }
 
-void serial_puts (const char *s)
+static void iop480_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
-int serial_getc ()
+static int iop480_serial_getc(void)
 {
 	unsigned char status = 0;
 
@@ -212,7 +213,7 @@ int serial_getc ()
 	return (0x000000ff & (int) in_8((u8 *)asyncRxBufferport1));
 }
 
-int serial_tstc ()
+static int iop480_serial_tstc(void)
 {
 	unsigned char status;
 
@@ -233,4 +234,56 @@ int serial_tstc ()
 	return 0;
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device iop480_serial_drv = {
+	.name	= "iop480_serial",
+	.start	= iop480_serial_init,
+	.stop	= NULL,
+	.setbrg	= iop480_serial_setbrg,
+	.putc	= iop480_serial_putc,
+	.puts	= iop480_serial_puts,
+	.getc	= iop480_serial_getc,
+	.tstc	= iop480_serial_tstc,
+};
+
+void iop480_serial_initialize(void)
+{
+	serial_register(&iop480_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &iop480_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return iop480_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	iop480_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	iop480_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	iop480_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return iop480_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return iop480_serial_tstc();
+}
+#endif
 #endif	/* CONFIG_IOP480 */
diff --git a/common/serial.c b/common/serial.c
index aeae51d..398ad30 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -57,6 +57,7 @@ serial_initfunc(mpc8220_serial_initialize);
 serial_initfunc(mpc8260_scc_serial_initialize);
 serial_initfunc(mpc8260_smc_serial_initialize);
 serial_initfunc(mpc85xx_serial_initialize);
+serial_initfunc(iop480_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -92,6 +93,7 @@ void serial_initialize(void)
 	mpc8260_scc_serial_initialize();
 	mpc8260_smc_serial_initialize();
 	mpc85xx_serial_initialize();
+	iop480_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 28/70] serial: sparc: Implement CONFIG_SERIAL_MULTI into leon2 serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (26 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 27/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into iop480 " Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 29/70] serial: sparc: Implement CONFIG_SERIAL_MULTI into leon3 " Marek Vasut
                     ` (42 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into leon2 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the leon2 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Peter Tyser <ptyser@xes-inc.com>
---
 arch/sparc/cpu/leon2/serial.c |   83 ++++++++++++++++++++++++++++++++++-------
 common/serial.c               |    2 +
 2 files changed, 71 insertions(+), 14 deletions(-)

diff --git a/arch/sparc/cpu/leon2/serial.c b/arch/sparc/cpu/leon2/serial.c
index 4f41b8e..61d059b 100644
--- a/arch/sparc/cpu/leon2/serial.c
+++ b/arch/sparc/cpu/leon2/serial.c
@@ -26,6 +26,8 @@
 #include <common.h>
 #include <asm/processor.h>
 #include <asm/leon.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -39,7 +41,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #define READ_DWORD(var) SPARC_NOCACHE_READ_DWORD((unsigned int)&(var))
 #endif
 
-int serial_init(void)
+static int leon2_serial_init(void)
 {
 	LEON2_regs *leon2 = (LEON2_regs *) LEON2_PREGS;
 	LEON2_Uart_regs *regs;
@@ -72,15 +74,7 @@ int serial_init(void)
 	return 0;
 }
 
-void serial_putc(const char c)
-{
-	if (c == '\n')
-		serial_putc_raw('\r');
-
-	serial_putc_raw(c);
-}
-
-void serial_putc_raw(const char c)
+static void leon2_serial_putc_raw(const char c)
 {
 	LEON2_regs *leon2 = (LEON2_regs *) LEON2_PREGS;
 	LEON2_Uart_regs *regs;
@@ -103,14 +97,22 @@ void serial_putc_raw(const char c)
 #endif
 }
 
-void serial_puts(const char *s)
+static void leon2_serial_putc(const char c)
+{
+	if (c == '\n')
+		leon2_serial_putc_raw('\r');
+
+	leon2_serial_putc_raw(c);
+}
+
+static void leon2_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc(*s++);
 	}
 }
 
-int serial_getc(void)
+static int leon2_serial_getc(void)
 {
 	LEON2_regs *leon2 = (LEON2_regs *) LEON2_PREGS;
 	LEON2_Uart_regs *regs;
@@ -128,7 +130,7 @@ int serial_getc(void)
 	return READ_WORD(regs->UART_Channel);
 }
 
-int serial_tstc(void)
+static int leon2_serial_tstc(void)
 {
 	LEON2_regs *leon2 = (LEON2_regs *) LEON2_PREGS;
 	LEON2_Uart_regs *regs;
@@ -143,7 +145,7 @@ int serial_tstc(void)
 }
 
 /* set baud rate for uart */
-void serial_setbrg(void)
+static void leon2_serial_setbrg(void)
 {
 	/* update baud rate settings, read it from gd->baudrate */
 	unsigned int scaler;
@@ -163,3 +165,56 @@ void serial_setbrg(void)
 		regs->UART_Scaler = scaler;
 	}
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device leon2_serial_drv = {
+	.name	= "leon2_serial",
+	.start	= leon2_serial_init,
+	.stop	= NULL,
+	.setbrg	= leon2_serial_setbrg,
+	.putc	= leon2_serial_putc,
+	.puts	= leon2_serial_puts,
+	.getc	= leon2_serial_getc,
+	.tstc	= leon2_serial_tstc,
+};
+
+void leon2_serial_initialize(void)
+{
+	serial_register(&leon2_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &leon2_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return leon2_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	leon2_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	leon2_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	leon2_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return leon2_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return leon2_serial_tstc();
+}
+#endif
diff --git a/common/serial.c b/common/serial.c
index 398ad30..8848126 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -58,6 +58,7 @@ serial_initfunc(mpc8260_scc_serial_initialize);
 serial_initfunc(mpc8260_smc_serial_initialize);
 serial_initfunc(mpc85xx_serial_initialize);
 serial_initfunc(iop480_serial_initialize);
+serial_initfunc(leon2_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -94,6 +95,7 @@ void serial_initialize(void)
 	mpc8260_smc_serial_initialize();
 	mpc85xx_serial_initialize();
 	iop480_serial_initialize();
+	leon2_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 29/70] serial: sparc: Implement CONFIG_SERIAL_MULTI into leon3 serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (27 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 28/70] serial: sparc: Implement CONFIG_SERIAL_MULTI into leon2 " Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 30/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into marvell " Marek Vasut
                     ` (41 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into leon3 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the leon3 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Peter Tyser <ptyser@xes-inc.com>
---
 arch/sparc/cpu/leon3/serial.c |   83 ++++++++++++++++++++++++++++++++++-------
 common/serial.c               |    2 +
 2 files changed, 71 insertions(+), 14 deletions(-)

diff --git a/arch/sparc/cpu/leon3/serial.c b/arch/sparc/cpu/leon3/serial.c
index 4b2fcb8..a110244 100644
--- a/arch/sparc/cpu/leon3/serial.c
+++ b/arch/sparc/cpu/leon3/serial.c
@@ -27,6 +27,8 @@
 #include <asm/processor.h>
 #include <asm/leon.h>
 #include <ambapp.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -42,7 +44,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 ambapp_dev_apbuart *leon3_apbuart = NULL;
 
-int serial_init(void)
+static int leon3_serial_init(void)
 {
 	ambapp_apbdev apbdev;
 	unsigned int tmp;
@@ -72,15 +74,7 @@ int serial_init(void)
 	return -1;		/* didn't find hardware */
 }
 
-void serial_putc(const char c)
-{
-	if (c == '\n')
-		serial_putc_raw('\r');
-
-	serial_putc_raw(c);
-}
-
-void serial_putc_raw(const char c)
+static void leon3_serial_putc_raw(const char c)
 {
 	if (!leon3_apbuart)
 		return;
@@ -97,14 +91,22 @@ void serial_putc_raw(const char c)
 #endif
 }
 
-void serial_puts(const char *s)
+static void leon3_serial_putc(const char c)
+{
+	if (c == '\n')
+		leon3_serial_putc_raw('\r');
+
+	leon3_serial_putc_raw(c);
+}
+
+static void leon3_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc(*s++);
 	}
 }
 
-int serial_getc(void)
+static int leon3_serial_getc(void)
 {
 	if (!leon3_apbuart)
 		return 0;
@@ -116,7 +118,7 @@ int serial_getc(void)
 	return READ_WORD(leon3_apbuart->data);
 }
 
-int serial_tstc(void)
+static int leon3_serial_tstc(void)
 {
 	if (leon3_apbuart)
 		return (READ_WORD(leon3_apbuart->status) &
@@ -125,7 +127,7 @@ int serial_tstc(void)
 }
 
 /* set baud rate for uart */
-void serial_setbrg(void)
+static void leon3_serial_setbrg(void)
 {
 	/* update baud rate settings, read it from gd->baudrate */
 	unsigned int scaler;
@@ -137,3 +139,56 @@ void serial_setbrg(void)
 	}
 	return;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device leon3_serial_drv = {
+	.name	= "leon3_serial",
+	.start	= leon3_serial_init,
+	.stop	= NULL,
+	.setbrg	= leon3_serial_setbrg,
+	.putc	= leon3_serial_putc,
+	.puts	= leon3_serial_puts,
+	.getc	= leon3_serial_getc,
+	.tstc	= leon3_serial_tstc,
+};
+
+void leon3_serial_initialize(void)
+{
+	serial_register(&leon3_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &leon3_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return leon3_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	leon3_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	leon3_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	leon3_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return leon3_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return leon3_serial_tstc();
+}
+#endif
diff --git a/common/serial.c b/common/serial.c
index 8848126..4907009 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -59,6 +59,7 @@ serial_initfunc(mpc8260_smc_serial_initialize);
 serial_initfunc(mpc85xx_serial_initialize);
 serial_initfunc(iop480_serial_initialize);
 serial_initfunc(leon2_serial_initialize);
+serial_initfunc(leon3_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -96,6 +97,7 @@ void serial_initialize(void)
 	mpc85xx_serial_initialize();
 	iop480_serial_initialize();
 	leon2_serial_initialize();
+	leon3_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 30/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into marvell serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (28 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 29/70] serial: sparc: Implement CONFIG_SERIAL_MULTI into leon3 " Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 31/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into amirix " Marek Vasut
                     ` (40 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into marvell serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the marvell driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/Marvell/common/serial.c |   80 ++++++++++++++++++++++++++++++++++-------
 common/serial.c               |    2 ++
 2 files changed, 69 insertions(+), 13 deletions(-)

diff --git a/board/Marvell/common/serial.c b/board/Marvell/common/serial.c
index 3e7f406..a5231eb 100644
--- a/board/Marvell/common/serial.c
+++ b/board/Marvell/common/serial.c
@@ -32,6 +32,9 @@
 
 #include <common.h>
 #include <command.h>
+#include <serial.h>
+#include <linux/compiler.h>
+
 #include "../include/memory.h"
 #include "serial.h"
 
@@ -48,9 +51,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_MPSC
-
-
-int serial_init (void)
+static int marvell_serial_init(void)
 {
 #if (defined CONFIG_SYS_INIT_CHAN1) || (defined CONFIG_SYS_INIT_CHAN2)
 	int clock_divisor = 230400 / gd->baudrate;
@@ -68,7 +69,7 @@ int serial_init (void)
 	return (0);
 }
 
-void serial_putc (const char c)
+static void marvell_serial_putc(const char c)
 {
 	if (c == '\n')
 		mpsc_putchar ('\r');
@@ -76,24 +77,24 @@ void serial_putc (const char c)
 	mpsc_putchar (c);
 }
 
-int serial_getc (void)
+static int marvell_serial_getc(void)
 {
 	return mpsc_getchar ();
 }
 
-int serial_tstc (void)
+static int marvell_serial_tstc(void)
 {
 	return mpsc_test_char ();
 }
 
-void serial_setbrg (void)
+static void marvell_serial_setbrg(void)
 {
 	galbrg_set_baudrate (CONFIG_MPSC_PORT, gd->baudrate);
 }
 
 #else  /* ! CONFIG_MPSC */
 
-int serial_init (void)
+static int marvell_serial_init(void)
 {
 	int clock_divisor = 230400 / gd->baudrate;
 
@@ -106,7 +107,7 @@ int serial_init (void)
 	return (0);
 }
 
-void serial_putc (const char c)
+static void marvell_serial_putc(const char c)
 {
 	if (c == '\n')
 		NS16550_putc (COM_PORTS[CONFIG_SYS_DUART_CHAN], '\r');
@@ -114,17 +115,17 @@ void serial_putc (const char c)
 	NS16550_putc (COM_PORTS[CONFIG_SYS_DUART_CHAN], c);
 }
 
-int serial_getc (void)
+static int marvell_serial_getc(void)
 {
 	return NS16550_getc (COM_PORTS[CONFIG_SYS_DUART_CHAN]);
 }
 
-int serial_tstc (void)
+static int marvell_serial_tstc(void)
 {
 	return NS16550_tstc (COM_PORTS[CONFIG_SYS_DUART_CHAN]);
 }
 
-void serial_setbrg (void)
+static void marvell_serial_setbrg(void)
 {
 	int clock_divisor = 230400 / gd->baudrate;
 
@@ -138,13 +139,66 @@ void serial_setbrg (void)
 
 #endif /* CONFIG_MPSC */
 
-void serial_puts (const char *s)
+static void marvell_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device marvell_serial_drv = {
+	.name	= "marvell_serial",
+	.start	= marvell_serial_init,
+	.stop	= NULL,
+	.setbrg	= marvell_serial_setbrg,
+	.putc	= marvell_serial_putc,
+	.puts	= marvell_serial_puts,
+	.getc	= marvell_serial_getc,
+	.tstc	= marvell_serial_tstc,
+};
+
+void marvell_serial_initialize(void)
+{
+	serial_register(&marvell_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &marvell_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return marvell_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	marvell_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	marvell_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	marvell_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return marvell_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return marvell_serial_tstc();
+}
+#endif
+
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
 {
diff --git a/common/serial.c b/common/serial.c
index 4907009..0288b49 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -60,6 +60,7 @@ serial_initfunc(mpc85xx_serial_initialize);
 serial_initfunc(iop480_serial_initialize);
 serial_initfunc(leon2_serial_initialize);
 serial_initfunc(leon3_serial_initialize);
+serial_initfunc(marvell_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -98,6 +99,7 @@ void serial_initialize(void)
 	iop480_serial_initialize();
 	leon2_serial_initialize();
 	leon3_serial_initialize();
+	marvell_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 31/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into amirix serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (29 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 30/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into marvell " Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 32/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw " Marek Vasut
                     ` (39 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into amirix serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the amirix driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/amirix/ap1000/serial.c |   66 ++++++++++++++++++++++++++++++++++++++----
 common/serial.c              |    2 ++
 2 files changed, 62 insertions(+), 6 deletions(-)

diff --git a/board/amirix/ap1000/serial.c b/board/amirix/ap1000/serial.c
index 87003be..2c2e9f9 100644
--- a/board/amirix/ap1000/serial.c
+++ b/board/amirix/ap1000/serial.c
@@ -24,6 +24,8 @@
 #include <asm/processor.h>
 #include <command.h>
 #include <config.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 #include <ns16550.h>
 
@@ -36,7 +38,7 @@ const NS16550_t COM_PORTS[] =
 #define CONFIG_SYS_DUART_CHAN gComPort
 static int gComPort = 0;
 
-int serial_init (void)
+static int amirix_serial_init(void)
 {
 	int clock_divisor = CONFIG_SYS_NS16550_CLK / 16 / gd->baudrate;
 
@@ -46,7 +48,7 @@ int serial_init (void)
 	return 0;
 }
 
-void serial_putc (const char c)
+static void amirix_serial_putc(const char c)
 {
 	if (c == '\n') {
 		NS16550_putc (COM_PORTS[CONFIG_SYS_DUART_CHAN], '\r');
@@ -55,17 +57,17 @@ void serial_putc (const char c)
 	NS16550_putc (COM_PORTS[CONFIG_SYS_DUART_CHAN], c);
 }
 
-int serial_getc (void)
+static int amirix_serial_getc(void)
 {
 	return NS16550_getc (COM_PORTS[CONFIG_SYS_DUART_CHAN]);
 }
 
-int serial_tstc (void)
+static int amirix_serial_tstc(void)
 {
 	return NS16550_tstc (COM_PORTS[CONFIG_SYS_DUART_CHAN]);
 }
 
-void serial_setbrg (void)
+static void amirix_serial_setbrg(void)
 {
 	int clock_divisor = CONFIG_SYS_NS16550_CLK / 16 / gd->baudrate;
 
@@ -77,13 +79,65 @@ void serial_setbrg (void)
 #endif
 }
 
-void serial_puts (const char *s)
+static void amirix_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device amirix_serial_drv = {
+	.name	= "amirix_serial",
+	.start	= amirix_serial_init,
+	.stop	= NULL,
+	.setbrg	= amirix_serial_setbrg,
+	.putc	= amirix_serial_putc,
+	.puts	= amirix_serial_puts,
+	.getc	= amirix_serial_getc,
+	.tstc	= amirix_serial_tstc,
+};
+
+void amirix_serial_initialize(void)
+{
+	serial_register(&amirix_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &amirix_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return amirix_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	amirix_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	amirix_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	amirix_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return amirix_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return amirix_serial_tstc();
+}
+#endif
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
 {
diff --git a/common/serial.c b/common/serial.c
index 0288b49..6a09139 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -61,6 +61,7 @@ serial_initfunc(iop480_serial_initialize);
 serial_initfunc(leon2_serial_initialize);
 serial_initfunc(leon3_serial_initialize);
 serial_initfunc(marvell_serial_initialize);
+serial_initfunc(amirix_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -100,6 +101,7 @@ void serial_initialize(void)
 	leon2_serial_initialize();
 	leon3_serial_initialize();
 	marvell_serial_initialize();
+	amirix_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 32/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (30 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 31/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into amirix " Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 33/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into cogent " Marek Vasut
                     ` (38 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into bmw serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the bmw driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/bmw/serial.c |   68 +++++++++++++++++++++++++++++++++++++++++++++++-----
 common/serial.c    |    2 ++
 2 files changed, 64 insertions(+), 6 deletions(-)

diff --git a/board/bmw/serial.c b/board/bmw/serial.c
index 0c97f12..569131f 100644
--- a/board/bmw/serial.c
+++ b/board/bmw/serial.c
@@ -22,6 +22,9 @@
  */
 
 #include <common.h>
+#include <serial.h>
+#include <linux/compiler.h>
+
 #include "ns16550.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -38,7 +41,7 @@ static struct NS16550 *console =
 
 extern ulong get_bus_freq (ulong);
 
-int serial_init (void)
+static int bmw_serial_init(void)
 {
 	int clock_divisor = gd->bus_clk / 16 / gd->baudrate;
 
@@ -47,7 +50,7 @@ int serial_init (void)
 	return (0);
 }
 
-void serial_putc (const char c)
+static void bmw_serial_putc(const char c)
 {
 	if (c == '\n') {
 		serial_putc ('\r');
@@ -55,7 +58,7 @@ void serial_putc (const char c)
 	NS16550_putc (console, c);
 }
 
-void serial_puts (const char *s)
+static void bmw_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
@@ -63,19 +66,72 @@ void serial_puts (const char *s)
 }
 
 
-int serial_getc (void)
+static int bmw_serial_getc(void)
 {
 	return NS16550_getc (console);
 }
 
-int serial_tstc (void)
+static int bmw_serial_tstc(void)
 {
 	return NS16550_tstc (console);
 }
 
-void serial_setbrg (void)
+static void bmw_serial_setbrg(void)
 {
 	int clock_divisor = get_bus_freq (0) / 16 / gd->baudrate;
 
 	NS16550_reinit (console, clock_divisor);
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device bmw_serial_drv = {
+	.name	= "bmw_serial",
+	.start	= bmw_serial_init,
+	.stop	= NULL,
+	.setbrg	= bmw_serial_setbrg,
+	.putc	= bmw_serial_putc,
+	.puts	= bmw_serial_puts,
+	.getc	= bmw_serial_getc,
+	.tstc	= bmw_serial_tstc,
+};
+
+void bmw_serial_initialize(void)
+{
+	serial_register(&bmw_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &bmw_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return bmw_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	bmw_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	bmw_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	bmw_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return bmw_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return bmw_serial_tstc();
+}
+#endif
diff --git a/common/serial.c b/common/serial.c
index 6a09139..19d3a6f 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -62,6 +62,7 @@ serial_initfunc(leon2_serial_initialize);
 serial_initfunc(leon3_serial_initialize);
 serial_initfunc(marvell_serial_initialize);
 serial_initfunc(amirix_serial_initialize);
+serial_initfunc(bmw_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -102,6 +103,7 @@ void serial_initialize(void)
 	leon3_serial_initialize();
 	marvell_serial_initialize();
 	amirix_serial_initialize();
+	bmw_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 33/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into cogent serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (31 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 32/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw " Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 34/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into cpci750 " Marek Vasut
                     ` (37 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into cogent serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the cogent driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/cogent/serial.c |   66 ++++++++++++++++++++++++++++++++++++++++++++-----
 common/serial.c       |    2 ++
 2 files changed, 62 insertions(+), 6 deletions(-)

diff --git a/board/cogent/serial.c b/board/cogent/serial.c
index d9c27be..18a9dbf 100644
--- a/board/cogent/serial.c
+++ b/board/cogent/serial.c
@@ -5,6 +5,8 @@
 
 #include <common.h>
 #include <board/cogent/serial.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -25,7 +27,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #error CONFIG_CONS_INDEX must be configured for Cogent motherboard serial
 #endif
 
-int serial_init (void)
+static int cogent_serial_init(void)
 {
 	cma_mb_serial *mbsp = (cma_mb_serial *) CMA_MB_SERIAL_BASE;
 
@@ -38,7 +40,7 @@ int serial_init (void)
 	return (0);
 }
 
-void serial_setbrg (void)
+static void cogent_serial_setbrg(void)
 {
 	cma_mb_serial *mbsp = (cma_mb_serial *) CMA_MB_SERIAL_BASE;
 	unsigned int divisor;
@@ -54,7 +56,7 @@ void serial_setbrg (void)
 	cma_mb_reg_write (&mbsp->ser_lcr, lcr);	/* unset DLAB */
 }
 
-void serial_putc (const char c)
+static void cogent_serial_putc(const char c)
 {
 	cma_mb_serial *mbsp = (cma_mb_serial *) CMA_MB_SERIAL_BASE;
 
@@ -66,13 +68,13 @@ void serial_putc (const char c)
 	cma_mb_reg_write (&mbsp->ser_thr, c);
 }
 
-void serial_puts (const char *s)
+static void cogent_serial_puts(const char *s)
 {
 	while (*s != '\0')
 		serial_putc (*s++);
 }
 
-int serial_getc (void)
+static int cogent_serial_getc(void)
 {
 	cma_mb_serial *mbsp = (cma_mb_serial *) CMA_MB_SERIAL_BASE;
 
@@ -81,13 +83,65 @@ int serial_getc (void)
 	return ((int) cma_mb_reg_read (&mbsp->ser_rhr) & 0x7f);
 }
 
-int serial_tstc (void)
+static int cogent_serial_tstc(void)
 {
 	cma_mb_serial *mbsp = (cma_mb_serial *) CMA_MB_SERIAL_BASE;
 
 	return ((cma_mb_reg_read (&mbsp->ser_lsr) & LSR_DR) != 0);
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device cogent_serial_drv = {
+	.name	= "cogent_serial",
+	.start	= cogent_serial_init,
+	.stop	= NULL,
+	.setbrg	= cogent_serial_setbrg,
+	.putc	= cogent_serial_putc,
+	.puts	= cogent_serial_puts,
+	.getc	= cogent_serial_getc,
+	.tstc	= cogent_serial_tstc,
+};
+
+void cogent_serial_initialize(void)
+{
+	serial_register(&cogent_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &cogent_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return cogent_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	cogent_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	cogent_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	cogent_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return cogent_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return cogent_serial_tstc();
+}
+#endif
 #endif /* CONS_NONE */
 
 #if defined(CONFIG_CMD_KGDB) && \
diff --git a/common/serial.c b/common/serial.c
index 19d3a6f..a51ce99 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -63,6 +63,7 @@ serial_initfunc(leon3_serial_initialize);
 serial_initfunc(marvell_serial_initialize);
 serial_initfunc(amirix_serial_initialize);
 serial_initfunc(bmw_serial_initialize);
+serial_initfunc(cogent_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -104,6 +105,7 @@ void serial_initialize(void)
 	marvell_serial_initialize();
 	amirix_serial_initialize();
 	bmw_serial_initialize();
+	cogent_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 34/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into cpci750 serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (32 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 33/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into cogent " Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 35/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into evb64260 " Marek Vasut
                     ` (36 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into cpci750 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the cpci750 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/esd/cpci750/serial.c |   67 ++++++++++++++++++++++++++++++++++++++++----
 common/serial.c            |    2 ++
 2 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/board/esd/cpci750/serial.c b/board/esd/cpci750/serial.c
index e1af37e..9ff7c27 100644
--- a/board/esd/cpci750/serial.c
+++ b/board/esd/cpci750/serial.c
@@ -35,6 +35,9 @@
 
 #include <common.h>
 #include <command.h>
+#include <serial.h>
+#include <linux/compiler.h>
+
 #include "../../Marvell/include/memory.h"
 #include "serial.h"
 
@@ -42,14 +45,14 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int serial_init (void)
+static int cpci750_serial_init(void)
 {
 	mpsc_init (gd->baudrate);
 
 	return (0);
 }
 
-void serial_putc (const char c)
+static void cpci750_serial_putc(const char c)
 {
 	if (c == '\n')
 		mpsc_putchar ('\r');
@@ -57,29 +60,81 @@ void serial_putc (const char c)
 	mpsc_putchar (c);
 }
 
-int serial_getc (void)
+static int cpci750_serial_getc(void)
 {
 	return mpsc_getchar ();
 }
 
-int serial_tstc (void)
+static int cpci750_serial_tstc(void)
 {
 	return mpsc_test_char ();
 }
 
-void serial_setbrg (void)
+static void cpci750_serial_setbrg(void)
 {
 	galbrg_set_baudrate (CONFIG_MPSC_PORT, gd->baudrate);
 }
 
 
-void serial_puts (const char *s)
+static void cpci750_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device cpci750_serial_drv = {
+	.name	= "cpci750_serial",
+	.start	= cpci750_serial_init,
+	.stop	= NULL,
+	.setbrg	= cpci750_serial_setbrg,
+	.putc	= cpci750_serial_putc,
+	.puts	= cpci750_serial_puts,
+	.getc	= cpci750_serial_getc,
+	.tstc	= cpci750_serial_tstc,
+};
+
+void cpci750_serial_initialize(void)
+{
+	serial_register(&cpci750_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &cpci750_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return cpci750_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	cpci750_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	cpci750_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	cpci750_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return cpci750_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return cpci750_serial_tstc();
+}
+#endif
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
 {
diff --git a/common/serial.c b/common/serial.c
index a51ce99..c77d3ba 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -64,6 +64,7 @@ serial_initfunc(marvell_serial_initialize);
 serial_initfunc(amirix_serial_initialize);
 serial_initfunc(bmw_serial_initialize);
 serial_initfunc(cogent_serial_initialize);
+serial_initfunc(cpci750_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -106,6 +107,7 @@ void serial_initialize(void)
 	amirix_serial_initialize();
 	bmw_serial_initialize();
 	cogent_serial_initialize();
+	cpci750_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 35/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into evb64260 serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (33 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 34/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into cpci750 " Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 36/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into ml2 " Marek Vasut
                     ` (35 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into evb64260 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the evb64260 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/evb64260/serial.c |   85 ++++++++++++++++++++++++++++++++++++-----------
 common/serial.c         |    2 ++
 2 files changed, 67 insertions(+), 20 deletions(-)

diff --git a/board/evb64260/serial.c b/board/evb64260/serial.c
index 9d71115..cf46a4d 100644
--- a/board/evb64260/serial.c
+++ b/board/evb64260/serial.c
@@ -30,6 +30,8 @@
 #include <common.h>
 #include <command.h>
 #include <galileo/memory.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 #if (defined CONFIG_SYS_INIT_CHAN1) || (defined CONFIG_SYS_INIT_CHAN2)
 #include <ns16550.h>
@@ -48,7 +50,7 @@ const NS16550_t COM_PORTS[] = { (NS16550_t) CONFIG_SYS_NS16550_COM1,
 
 #ifdef CONFIG_MPSC
 
-int serial_init (void)
+static int evb64260_serial_init(void)
 {
 #if (defined CONFIG_SYS_INIT_CHAN1) || (defined CONFIG_SYS_INIT_CHAN2)
 	int clock_divisor = CONFIG_SYS_NS16550_CLK / 16 / gd->baudrate;
@@ -66,8 +68,7 @@ int serial_init (void)
 	return (0);
 }
 
-void
-serial_putc(const char c)
+static void evb64260_serial_putc(const char c)
 {
 	if (c == '\n')
 		mpsc_putchar('\r');
@@ -75,27 +76,24 @@ serial_putc(const char c)
 	mpsc_putchar(c);
 }
 
-int
-serial_getc(void)
+static int evb64260_serial_getc(void)
 {
 	return mpsc_getchar();
 }
 
-int
-serial_tstc(void)
+static int evb64260_serial_tstc(void)
 {
 	return mpsc_test_char();
 }
 
-void
-serial_setbrg (void)
+static void evb64260_serial_setbrg(void)
 {
 	galbrg_set_baudrate(CONFIG_MPSC_PORT, gd->baudrate);
 }
 
 #else /* ! CONFIG_MPSC */
 
-int serial_init (void)
+static int evb64260_serial_init(void)
 {
 	int clock_divisor = CONFIG_SYS_NS16550_CLK / 16 / gd->baudrate;
 
@@ -109,8 +107,7 @@ int serial_init (void)
 	return (0);
 }
 
-void
-serial_putc(const char c)
+static void evb64260_serial_putc(const char c)
 {
 	if (c == '\n')
 		NS16550_putc(COM_PORTS[CONFIG_SYS_DUART_CHAN], '\r');
@@ -118,20 +115,17 @@ serial_putc(const char c)
 	NS16550_putc(COM_PORTS[CONFIG_SYS_DUART_CHAN], c);
 }
 
-int
-serial_getc(void)
+static int evb64260_serial_getc(void)
 {
 	return NS16550_getc(COM_PORTS[CONFIG_SYS_DUART_CHAN]);
 }
 
-int
-serial_tstc(void)
+static int evb64260_serial_tstc(void)
 {
 	return NS16550_tstc(COM_PORTS[CONFIG_SYS_DUART_CHAN]);
 }
 
-void
-serial_setbrg (void)
+static void evb64260_serial_setbrg(void)
 {
 	int clock_divisor = CONFIG_SYS_NS16550_CLK / 16 / gd->baudrate;
 
@@ -145,14 +139,65 @@ serial_setbrg (void)
 
 #endif /* CONFIG_MPSC */
 
-void
-serial_puts (const char *s)
+static void evb64260_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device evb64260_serial_drv = {
+	.name	= "evb64260_serial",
+	.start	= evb64260_serial_init,
+	.stop	= NULL,
+	.setbrg	= evb64260_serial_setbrg,
+	.putc	= evb64260_serial_putc,
+	.puts	= evb64260_serial_puts,
+	.getc	= evb64260_serial_getc,
+	.tstc	= evb64260_serial_tstc,
+};
+
+void evb64260_serial_initialize(void)
+{
+	serial_register(&evb64260_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &evb64260_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return evb64260_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	evb64260_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	evb64260_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	evb64260_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return evb64260_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return evb64260_serial_tstc();
+}
+#endif
 #if defined(CONFIG_CMD_KGDB)
 void
 kgdb_serial_init(void)
diff --git a/common/serial.c b/common/serial.c
index c77d3ba..2acf4c1 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -65,6 +65,7 @@ serial_initfunc(amirix_serial_initialize);
 serial_initfunc(bmw_serial_initialize);
 serial_initfunc(cogent_serial_initialize);
 serial_initfunc(cpci750_serial_initialize);
+serial_initfunc(evb64260_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -108,6 +109,7 @@ void serial_initialize(void)
 	bmw_serial_initialize();
 	cogent_serial_initialize();
 	cpci750_serial_initialize();
+	evb64260_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 36/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into ml2 serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (34 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 35/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into evb64260 " Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 37/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into sconsole " Marek Vasut
                     ` (34 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into ml2 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the ml2 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/ml2/serial.c |   66 +++++++++++++++++++++++++++++++++++++++++++++++-----
 common/serial.c    |    2 ++
 2 files changed, 62 insertions(+), 6 deletions(-)

diff --git a/board/ml2/serial.c b/board/ml2/serial.c
index d9113ab..0ed1150 100644
--- a/board/ml2/serial.c
+++ b/board/ml2/serial.c
@@ -24,6 +24,8 @@
 #include <asm/processor.h>
 #include <command.h>
 #include <configs/ML2.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 #if (defined CONFIG_SYS_INIT_CHAN1) || (defined CONFIG_SYS_INIT_CHAN2)
 #include <ns16550.h>
@@ -37,7 +39,7 @@ const NS16550_t COM_PORTS[] = { (NS16550_t) CONFIG_SYS_NS16550_COM1,
 };
 #endif
 
-int serial_init (void)
+static int ml2_serial_init(void)
 {
 	int clock_divisor = CONFIG_SYS_NS16550_CLK / 16 / gd->baudrate;
 
@@ -51,7 +53,7 @@ int serial_init (void)
 
 }
 
-void serial_putc (const char c)
+static void ml2_serial_putc(const char c)
 {
 	if (c == '\n')
 		NS16550_putc (COM_PORTS[CONFIG_SYS_DUART_CHAN], '\r');
@@ -59,17 +61,17 @@ void serial_putc (const char c)
 	NS16550_putc (COM_PORTS[CONFIG_SYS_DUART_CHAN], c);
 }
 
-int serial_getc (void)
+static int ml2_serial_getc(void)
 {
 	return NS16550_getc (COM_PORTS[CONFIG_SYS_DUART_CHAN]);
 }
 
-int serial_tstc (void)
+static int ml2_serial_tstc(void)
 {
 	return NS16550_tstc (COM_PORTS[CONFIG_SYS_DUART_CHAN]);
 }
 
-void serial_setbrg (void)
+static void ml2_serial_setbrg(void)
 {
 	int clock_divisor = CONFIG_SYS_NS16550_CLK / 16 / gd->baudrate;
 
@@ -81,13 +83,65 @@ void serial_setbrg (void)
 #endif
 }
 
-void serial_puts (const char *s)
+static void ml2_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device ml2_serial_drv = {
+	.name	= "ml2_serial",
+	.start	= ml2_serial_init,
+	.stop	= NULL,
+	.setbrg	= ml2_serial_setbrg,
+	.putc	= ml2_serial_putc,
+	.puts	= ml2_serial_puts,
+	.getc	= ml2_serial_getc,
+	.tstc	= ml2_serial_tstc,
+};
+
+void ml2_serial_initialize(void)
+{
+	serial_register(&ml2_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &ml2_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return ml2_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	ml2_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	ml2_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	ml2_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return ml2_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return ml2_serial_tstc();
+}
+#endif
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
 {
diff --git a/common/serial.c b/common/serial.c
index 2acf4c1..393e296 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -66,6 +66,7 @@ serial_initfunc(bmw_serial_initialize);
 serial_initfunc(cogent_serial_initialize);
 serial_initfunc(cpci750_serial_initialize);
 serial_initfunc(evb64260_serial_initialize);
+serial_initfunc(ml2_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -110,6 +111,7 @@ void serial_initialize(void)
 	cogent_serial_initialize();
 	cpci750_serial_initialize();
 	evb64260_serial_initialize();
+	ml2_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 37/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into sconsole serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (35 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 36/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into ml2 " Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 38/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into p3mx " Marek Vasut
                     ` (33 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into sconsole serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the sconsole driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/pcippc2/sconsole.c |   66 +++++++++++++++++++++++++++++++++++++++++-----
 common/serial.c          |    2 ++
 2 files changed, 62 insertions(+), 6 deletions(-)

diff --git a/board/pcippc2/sconsole.c b/board/pcippc2/sconsole.c
index 6ef38f4..0a31963 100644
--- a/board/pcippc2/sconsole.c
+++ b/board/pcippc2/sconsole.c
@@ -23,6 +23,8 @@
 
 #include <config.h>
 #include <common.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 #include "sconsole.h"
 
@@ -34,7 +36,7 @@ int	(*sconsole_getc) (void) = 0;
 int	(*sconsole_tstc) (void) = 0;
 void	(*sconsole_setbrg) (void) = 0;
 
-int serial_init (void)
+static int sconsole_serial_init(void)
 {
 	sconsole_buffer_t *sb = SCONSOLE_BUFFER;
 
@@ -46,7 +48,7 @@ int serial_init (void)
 	return (0);
 }
 
-void serial_putc (char c)
+static void sconsole_serial_putc(char c)
 {
 	if (sconsole_putc) {
 		(*sconsole_putc) (c);
@@ -65,7 +67,7 @@ void serial_putc (char c)
 	}
 }
 
-void serial_puts (const char *s)
+static void sconsole_serial_puts(const char *s)
 {
 	if (sconsole_puts) {
 		(*sconsole_puts) (s);
@@ -84,7 +86,7 @@ void serial_puts (const char *s)
 	}
 }
 
-int serial_getc (void)
+static int sconsole_serial_getc(void)
 {
 	if (sconsole_getc) {
 		return (*sconsole_getc) ();
@@ -93,7 +95,7 @@ int serial_getc (void)
 	}
 }
 
-int serial_tstc (void)
+static int sconsole_serial_tstc(void)
 {
 	if (sconsole_tstc) {
 		return (*sconsole_tstc) ();
@@ -102,7 +104,7 @@ int serial_tstc (void)
 	}
 }
 
-void serial_setbrg (void)
+static void sconsole_serial_setbrg(void)
 {
 	if (sconsole_setbrg) {
 		(*sconsole_setbrg) ();
@@ -113,6 +115,58 @@ void serial_setbrg (void)
 	}
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device sconsole_serial_drv = {
+	.name	= "sconsole_serial",
+	.start	= sconsole_serial_init,
+	.stop	= NULL,
+	.setbrg	= sconsole_serial_setbrg,
+	.putc	= sconsole_serial_putc,
+	.puts	= sconsole_serial_puts,
+	.getc	= sconsole_serial_getc,
+	.tstc	= sconsole_serial_tstc,
+};
+
+void sconsole_serial_initialize(void)
+{
+	serial_register(&sconsole_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &sconsole_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return sconsole_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	sconsole_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	sconsole_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	sconsole_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return sconsole_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return sconsole_serial_tstc();
+}
+#endif
 int sconsole_get_baudrate (void)
 {
 	sconsole_buffer_t *sb = SCONSOLE_BUFFER;
diff --git a/common/serial.c b/common/serial.c
index 393e296..d9cd3bf 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -67,6 +67,7 @@ serial_initfunc(cogent_serial_initialize);
 serial_initfunc(cpci750_serial_initialize);
 serial_initfunc(evb64260_serial_initialize);
 serial_initfunc(ml2_serial_initialize);
+serial_initfunc(sconsole_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -112,6 +113,7 @@ void serial_initialize(void)
 	cpci750_serial_initialize();
 	evb64260_serial_initialize();
 	ml2_serial_initialize();
+	sconsole_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 38/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into p3mx serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (36 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 37/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into sconsole " Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 39/70] serial: arm: Implement CONFIG_SERIAL_MULTI into altera_jtag " Marek Vasut
                     ` (32 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into p3mx serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the p3mx driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/prodrive/p3mx/serial.c |   68 ++++++++++++++++++++++++++++++++++++++----
 common/serial.c              |    2 ++
 2 files changed, 64 insertions(+), 6 deletions(-)

diff --git a/board/prodrive/p3mx/serial.c b/board/prodrive/p3mx/serial.c
index e1af37e..d3591b4 100644
--- a/board/prodrive/p3mx/serial.c
+++ b/board/prodrive/p3mx/serial.c
@@ -35,6 +35,9 @@
 
 #include <common.h>
 #include <command.h>
+#include <serial.h>
+#include <linux/compiler.h>
+
 #include "../../Marvell/include/memory.h"
 #include "serial.h"
 
@@ -42,14 +45,14 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int serial_init (void)
+static int p3mx_serial_init(void)
 {
 	mpsc_init (gd->baudrate);
 
 	return (0);
 }
 
-void serial_putc (const char c)
+static void p3mx_serial_putc(const char c)
 {
 	if (c == '\n')
 		mpsc_putchar ('\r');
@@ -57,29 +60,82 @@ void serial_putc (const char c)
 	mpsc_putchar (c);
 }
 
-int serial_getc (void)
+static int p3mx_serial_getc(void)
 {
 	return mpsc_getchar ();
 }
 
-int serial_tstc (void)
+static int p3mx_serial_tstc(void)
 {
 	return mpsc_test_char ();
 }
 
-void serial_setbrg (void)
+static void p3mx_serial_setbrg(void)
 {
 	galbrg_set_baudrate (CONFIG_MPSC_PORT, gd->baudrate);
 }
 
 
-void serial_puts (const char *s)
+static void p3mx_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device p3mx_serial_drv = {
+	.name	= "p3mx_serial",
+	.start	= p3mx_serial_init,
+	.stop	= NULL,
+	.setbrg	= p3mx_serial_setbrg,
+	.putc	= p3mx_serial_putc,
+	.puts	= p3mx_serial_puts,
+	.getc	= p3mx_serial_getc,
+	.tstc	= p3mx_serial_tstc,
+};
+
+void p3mx_serial_initialize(void)
+{
+	serial_register(&p3mx_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &p3mx_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return p3mx_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	p3mx_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	p3mx_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	p3mx_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return p3mx_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return p3mx_serial_tstc();
+}
+#endif
+
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
 {
diff --git a/common/serial.c b/common/serial.c
index d9cd3bf..2d6ba05 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -68,6 +68,7 @@ serial_initfunc(cpci750_serial_initialize);
 serial_initfunc(evb64260_serial_initialize);
 serial_initfunc(ml2_serial_initialize);
 serial_initfunc(sconsole_serial_initialize);
+serial_initfunc(p3mx_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -114,6 +115,7 @@ void serial_initialize(void)
 	evb64260_serial_initialize();
 	ml2_serial_initialize();
 	sconsole_serial_initialize();
+	p3mx_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 39/70] serial: arm: Implement CONFIG_SERIAL_MULTI into altera_jtag serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (37 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 38/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into p3mx " Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 40/70] serial: arm: Implement CONFIG_SERIAL_MULTI into altera " Marek Vasut
                     ` (31 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into altera_jtag serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the altera_jtag driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Thomas Chou <thomas@wytron.com.tw>
---
 common/serial.c                   |    2 ++
 drivers/serial/altera_jtag_uart.c |   71 +++++++++++++++++++++++++++++++++----
 2 files changed, 67 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 2d6ba05..24879ec 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -69,6 +69,7 @@ serial_initfunc(evb64260_serial_initialize);
 serial_initfunc(ml2_serial_initialize);
 serial_initfunc(sconsole_serial_initialize);
 serial_initfunc(p3mx_serial_initialize);
+serial_initfunc(altera_jtag_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -116,6 +117,7 @@ void serial_initialize(void)
 	ml2_serial_initialize();
 	sconsole_serial_initialize();
 	p3mx_serial_initialize();
+	altera_jtag_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/altera_jtag_uart.c b/drivers/serial/altera_jtag_uart.c
index 2980e4d..d3b6c1c 100644
--- a/drivers/serial/altera_jtag_uart.c
+++ b/drivers/serial/altera_jtag_uart.c
@@ -33,10 +33,16 @@ DECLARE_GLOBAL_DATA_PTR;
  *-----------------------------------------------------------------*/
 static nios_jtag_t *jtag = (nios_jtag_t *)CONFIG_SYS_NIOS_CONSOLE;
 
-void serial_setbrg( void ){ return; }
-int serial_init( void ) { return(0);}
+static void altera_jtag_serial_setbrg(void)
+{
+}
+
+static int altera_jtag_serial_init(void)
+{
+	return 0;
+}
 
-void serial_putc (char c)
+static void altera_jtag_serial_putc(char c)
 {
 	while (1) {
 		unsigned st = readl(&jtag->control);
@@ -51,18 +57,18 @@ void serial_putc (char c)
 	writel ((unsigned char)c, &jtag->data);
 }
 
-void serial_puts (const char *s)
+static void altera_jtag_serial_puts(const char *s)
 {
 	while (*s != 0)
 		serial_putc (*s++);
 }
 
-int serial_tstc (void)
+static int altera_jtag_serial_tstc(void)
 {
 	return ( readl (&jtag->control) & NIOS_JTAG_RRDY);
 }
 
-int serial_getc (void)
+static int altera_jtag_serial_getc(void)
 {
 	int c;
 	unsigned val;
@@ -76,3 +82,56 @@ int serial_getc (void)
 	c = val & 0x0ff;
 	return (c);
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device altera_jtag_serial_drv = {
+	.name	= "altera_jtag_serial",
+	.start	= altera_jtag_serial_init,
+	.stop	= NULL,
+	.setbrg	= altera_jtag_serial_setbrg,
+	.putc	= altera_jtag_serial_putc,
+	.puts	= altera_jtag_serial_puts,
+	.getc	= altera_jtag_serial_getc,
+	.tstc	= altera_jtag_serial_tstc,
+};
+
+void altera_jtag_serial_initialize(void)
+{
+	serial_register(&altera_jtag_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &altera_jtag_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return altera_jtag_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	altera_jtag_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	altera_jtag_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	altera_jtag_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return altera_jtag_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return altera_jtag_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 40/70] serial: arm: Implement CONFIG_SERIAL_MULTI into altera serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (38 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 39/70] serial: arm: Implement CONFIG_SERIAL_MULTI into altera_jtag " Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 41/70] serial: arm: Implement CONFIG_SERIAL_MULTI into atmel " Marek Vasut
                     ` (30 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into altera serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the altera driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Scott McNutt <smcnutt@psyent.com>
---
 common/serial.c              |    2 +
 drivers/serial/altera_uart.c |   83 ++++++++++++++++++++++++++++++++++++------
 2 files changed, 73 insertions(+), 12 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 24879ec..e6566da 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -70,6 +70,7 @@ serial_initfunc(ml2_serial_initialize);
 serial_initfunc(sconsole_serial_initialize);
 serial_initfunc(p3mx_serial_initialize);
 serial_initfunc(altera_jtag_serial_initialize);
+serial_initfunc(altera_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -118,6 +119,7 @@ void serial_initialize(void)
 	sconsole_serial_initialize();
 	p3mx_serial_initialize();
 	altera_jtag_serial_initialize();
+	altera_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c
index 045f119..18b820b 100644
--- a/drivers/serial/altera_uart.c
+++ b/drivers/serial/altera_uart.c
@@ -37,27 +37,33 @@ static nios_uart_t *uart = (nios_uart_t *) CONFIG_SYS_NIOS_CONSOLE;
 
 #if defined(CONFIG_SYS_NIOS_FIXEDBAUD)
 
-/* Everything's already setup for fixed-baud PTF
+/*
+ * Everything's already setup for fixed-baud PTF
  * assignment
  */
-void serial_setbrg (void){ return; }
-int serial_init (void) { return (0);}
+static void altera_serial_setbrg(void)
+{
+}
+
+static int altera_serial_init(void)
+{
+	return 0;
+}
 
 #else
 
-void serial_setbrg (void)
+static void altera_serial_setbrg(void)
 {
 	unsigned div;
 
 	div = (CONFIG_SYS_CLK_FREQ/gd->baudrate)-1;
 	writel (div, &uart->divisor);
-	return;
 }
 
-int serial_init (void)
+static int altera_serial_init(void)
 {
-	serial_setbrg ();
-	return (0);
+	serial_setbrg();
+	return 0;
 }
 
 #endif /* CONFIG_SYS_NIOS_FIXEDBAUD */
@@ -65,7 +71,7 @@ int serial_init (void)
 /*-----------------------------------------------------------------------
  * UART CONSOLE
  *---------------------------------------------------------------------*/
-void serial_putc (char c)
+static void altera_serial_putc(char c)
 {
 	if (c == '\n')
 		serial_putc ('\r');
@@ -74,21 +80,74 @@ void serial_putc (char c)
 	writel ((unsigned char)c, &uart->txdata);
 }
 
-void serial_puts (const char *s)
+static void altera_serial_puts(const char *s)
 {
 	while (*s != 0) {
 		serial_putc (*s++);
 	}
 }
 
-int serial_tstc (void)
+static int altera_serial_tstc(void)
 {
 	return (readl (&uart->status) & NIOS_UART_RRDY);
 }
 
-int serial_getc (void)
+static int altera_serial_getc(void)
 {
 	while (serial_tstc () == 0)
 		WATCHDOG_RESET ();
 	return (readl (&uart->rxdata) & 0x00ff );
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device altera_serial_drv = {
+	.name	= "altera_serial",
+	.start	= altera_serial_init,
+	.stop	= NULL,
+	.setbrg	= altera_serial_setbrg,
+	.putc	= altera_serial_putc,
+	.puts	= altera_serial_puts,
+	.getc	= altera_serial_getc,
+	.tstc	= altera_serial_tstc,
+};
+
+void altera_serial_initialize(void)
+{
+	serial_register(&altera_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &altera_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return altera_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	altera_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	altera_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	altera_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return altera_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return altera_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 41/70] serial: arm: Implement CONFIG_SERIAL_MULTI into atmel serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (39 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 40/70] serial: arm: Implement CONFIG_SERIAL_MULTI into altera " Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:30   ` [U-Boot] [PATCH 42/70] serial: arm: Implement CONFIG_SERIAL_MULTI into lpc32xx " Marek Vasut
                     ` (29 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into atmel serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the atmel driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Xu, Hong <Hong.Xu@atmel.com>
---
 common/serial.c              |    2 ++
 drivers/serial/atmel_usart.c |   67 ++++++++++++++++++++++++++++++++++++++----
 2 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index e6566da..b880303 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -71,6 +71,7 @@ serial_initfunc(sconsole_serial_initialize);
 serial_initfunc(p3mx_serial_initialize);
 serial_initfunc(altera_jtag_serial_initialize);
 serial_initfunc(altera_serial_initialize);
+serial_initfunc(atmel_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -120,6 +121,7 @@ void serial_initialize(void)
 	p3mx_serial_initialize();
 	altera_jtag_serial_initialize();
 	altera_serial_initialize();
+	atmel_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c
index 943ef70..d49d5d4 100644
--- a/drivers/serial/atmel_usart.c
+++ b/drivers/serial/atmel_usart.c
@@ -20,6 +20,8 @@
  */
 #include <common.h>
 #include <watchdog.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 #include <asm/io.h>
 #include <asm/arch/clk.h>
@@ -29,7 +31,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void serial_setbrg(void)
+static void atmel_serial_setbrg(void)
 {
 	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
 	unsigned long divisor;
@@ -45,7 +47,7 @@ void serial_setbrg(void)
 	writel(USART3_BF(CD, divisor), &usart->brgr);
 }
 
-int serial_init(void)
+static int atmel_serial_init(void)
 {
 	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
 
@@ -73,7 +75,7 @@ int serial_init(void)
 	return 0;
 }
 
-void serial_putc(char c)
+static void atmel_serial_putc(char c)
 {
 	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
 
@@ -84,13 +86,13 @@ void serial_putc(char c)
 	writel(c, &usart->thr);
 }
 
-void serial_puts(const char *s)
+static void atmel_serial_puts(const char *s)
 {
 	while (*s)
 		serial_putc(*s++);
 }
 
-int serial_getc(void)
+static int atmel_serial_getc(void)
 {
 	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
 
@@ -99,8 +101,61 @@ int serial_getc(void)
 	return readl(&usart->rhr);
 }
 
-int serial_tstc(void)
+static int atmel_serial_tstc(void)
 {
 	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
 	return (readl(&usart->csr) & USART3_BIT(RXRDY)) != 0;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device atmel_serial_drv = {
+	.name	= "atmel_serial",
+	.start	= atmel_serial_init,
+	.stop	= NULL,
+	.setbrg	= atmel_serial_setbrg,
+	.putc	= atmel_serial_putc,
+	.puts	= atmel_serial_puts,
+	.getc	= atmel_serial_getc,
+	.tstc	= atmel_serial_tstc,
+};
+
+void atmel_serial_initialize(void)
+{
+	serial_register(&atmel_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &atmel_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return atmel_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	atmel_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	atmel_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	atmel_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return atmel_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return atmel_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 42/70] serial: arm: Implement CONFIG_SERIAL_MULTI into lpc32xx serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (40 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 41/70] serial: arm: Implement CONFIG_SERIAL_MULTI into atmel " Marek Vasut
@ 2012-09-29  0:30   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 43/70] serial: mcf: Implement CONFIG_SERIAL_MULTI into MCF " Marek Vasut
                     ` (28 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:30 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into lpc32xx serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the lpc32xx driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Vladimir Zapolskiy <vz@mleia.com>
---
 common/serial.c                 |    2 ++
 drivers/serial/lpc32xx_hsuart.c |   71 ++++++++++++++++++++++++++-------------
 2 files changed, 50 insertions(+), 23 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index b880303..8bc26d8 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -72,6 +72,7 @@ serial_initfunc(p3mx_serial_initialize);
 serial_initfunc(altera_jtag_serial_initialize);
 serial_initfunc(altera_serial_initialize);
 serial_initfunc(atmel_serial_initialize);
+serial_initfunc(lpc32xx_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -122,6 +123,7 @@ void serial_initialize(void)
 	altera_jtag_serial_initialize();
 	altera_serial_initialize();
 	atmel_serial_initialize();
+	lpc32xx_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/lpc32xx_hsuart.c b/drivers/serial/lpc32xx_hsuart.c
index 8ce3382..536fd46 100644
--- a/drivers/serial/lpc32xx_hsuart.c
+++ b/drivers/serial/lpc32xx_hsuart.c
@@ -22,12 +22,14 @@
 #include <asm/arch/clk.h>
 #include <asm/arch/uart.h>
 #include <asm/io.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
 static struct hsuart_regs *hsuart = (struct hsuart_regs *)HS_UART_BASE;
 
-static void lpc32xx_hsuart_set_baudrate(void)
+static void lpc32xx_serial_setbrg(void)
 {
 	u32 div;
 
@@ -39,7 +41,7 @@ static void lpc32xx_hsuart_set_baudrate(void)
 	writel(div, &hsuart->rate);
 }
 
-static int lpc32xx_hsuart_getc(void)
+static int lpc32xx_serial_getc(void)
 {
 	while (!(readl(&hsuart->level) & HSUART_LEVEL_RX))
 		/* NOP */;
@@ -47,7 +49,7 @@ static int lpc32xx_hsuart_getc(void)
 	return readl(&hsuart->rx) & HSUART_RX_DATA;
 }
 
-static void lpc32xx_hsuart_putc(const char c)
+static void lpc32xx_serial_putc(const char c)
 {
 	writel(c, &hsuart->tx);
 
@@ -56,7 +58,7 @@ static void lpc32xx_hsuart_putc(const char c)
 		/* NOP */;
 }
 
-static int lpc32xx_hsuart_tstc(void)
+static int lpc32xx_serial_tstc(void)
 {
 	if (readl(&hsuart->level) & HSUART_LEVEL_RX)
 		return 1;
@@ -64,49 +66,72 @@ static int lpc32xx_hsuart_tstc(void)
 	return 0;
 }
 
-static void lpc32xx_hsuart_init(void)
+static int lpc32xx_serial_init(void)
 {
-	lpc32xx_hsuart_set_baudrate();
+	lpc32xx_serial_setbrg();
 
 	/* Disable hardware RTS and CTS flow control, set up RX and TX FIFO */
 	writel(HSUART_CTRL_TMO_16 | HSUART_CTRL_HSU_OFFSET(20) |
 	       HSUART_CTRL_HSU_RX_TRIG_32 | HSUART_CTRL_HSU_TX_TRIG_0,
 	       &hsuart->ctrl);
+	return 0;
 }
 
-void serial_setbrg(void)
+static void lpc32xx_serial_puts(const char *s)
 {
-	return lpc32xx_hsuart_set_baudrate();
+	while (*s)
+		serial_putc(*s++);
 }
 
-void serial_putc(const char c)
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device lpc32xx_serial_drv = {
+	.name	= "lpc32xx_serial",
+	.start	= lpc32xx_serial_init,
+	.stop	= NULL,
+	.setbrg	= lpc32xx_serial_setbrg,
+	.putc	= lpc32xx_serial_putc,
+	.puts	= lpc32xx_serial_puts,
+	.getc	= lpc32xx_serial_getc,
+	.tstc	= lpc32xx_serial_tstc,
+};
+
+void lpc32xx_serial_initialize(void)
 {
-	lpc32xx_hsuart_putc(c);
+	serial_register(&lpc32xx_serial_drv);
+}
 
-	/* If \n, also do \r */
-	if (c == '\n')
-		lpc32xx_hsuart_putc('\r');
+__weak struct serial_device *default_serial_console(void)
+{
+	return &lpc32xx_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return lpc32xx_serial_init();
 }
 
-int serial_getc(void)
+void serial_setbrg(void)
 {
-	return lpc32xx_hsuart_getc();
+	lpc32xx_serial_setbrg();
 }
 
-void serial_puts(const char *s)
+void serial_putc(const char c)
 {
-	while (*s)
-		serial_putc(*s++);
+	lpc32xx_serial_putc(c);
 }
 
-int serial_tstc(void)
+void serial_puts(const char *s)
 {
-	return lpc32xx_hsuart_tstc();
+	lpc32xx_serial_puts(s);
 }
 
-int serial_init(void)
+int serial_getc(void)
 {
-	lpc32xx_hsuart_init();
+	return lpc32xx_serial_getc();
+}
 
-	return 0;
+int serial_tstc(void)
+{
+	return lpc32xx_serial_tstc();
 }
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 43/70] serial: mcf: Implement CONFIG_SERIAL_MULTI into MCF serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (41 preceding siblings ...)
  2012-09-29  0:30   ` [U-Boot] [PATCH 42/70] serial: arm: Implement CONFIG_SERIAL_MULTI into lpc32xx " Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 44/70] serial: Implement CONFIG_SERIAL_MULTI into ns9750 " Marek Vasut
                     ` (27 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into MCF serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the MCF driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: TsiChung Liew <tsicliew@gmail.com>
---
 common/serial.c          |    2 ++
 drivers/serial/mcfuart.c |   65 +++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 8bc26d8..fa16dce 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -73,6 +73,7 @@ serial_initfunc(altera_jtag_serial_initialize);
 serial_initfunc(altera_serial_initialize);
 serial_initfunc(atmel_serial_initialize);
 serial_initfunc(lpc32xx_serial_initialize);
+serial_initfunc(mcf_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -124,6 +125,7 @@ void serial_initialize(void)
 	altera_serial_initialize();
 	atmel_serial_initialize();
 	lpc32xx_serial_initialize();
+	mcf_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/mcfuart.c b/drivers/serial/mcfuart.c
index d93b24b..7e0b765 100644
--- a/drivers/serial/mcfuart.c
+++ b/drivers/serial/mcfuart.c
@@ -36,7 +36,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 extern void uart_port_conf(int port);
 
-int serial_init(void)
+static int mcf_serial_init(void)
 {
 	volatile uart_t *uart;
 	u32 counter;
@@ -74,7 +74,7 @@ int serial_init(void)
 	return (0);
 }
 
-void serial_putc(const char c)
+static void mcf_serial_putc(const char c)
 {
 	volatile uart_t *uart = (volatile uart_t *)(CONFIG_SYS_UART_BASE);
 
@@ -87,14 +87,14 @@ void serial_putc(const char c)
 	uart->utb = c;
 }
 
-void serial_puts(const char *s)
+static void mcf_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc(*s++);
 	}
 }
 
-int serial_getc(void)
+static int mcf_serial_getc(void)
 {
 	volatile uart_t *uart = (volatile uart_t *)(CONFIG_SYS_UART_BASE);
 
@@ -103,14 +103,14 @@ int serial_getc(void)
 	return uart->urb;
 }
 
-int serial_tstc(void)
+static int mcf_serial_tstc(void)
 {
 	volatile uart_t *uart = (volatile uart_t *)(CONFIG_SYS_UART_BASE);
 
 	return (uart->usr & UART_USR_RXRDY);
 }
 
-void serial_setbrg(void)
+static void mcf_serial_setbrg(void)
 {
 	volatile uart_t *uart = (volatile uart_t *)(CONFIG_SYS_UART_BASE);
 	u32 counter;
@@ -129,3 +129,56 @@ void serial_setbrg(void)
 
 	uart->ucr = UART_UCR_RX_ENABLED | UART_UCR_TX_ENABLED;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device mcf_serial_drv = {
+	.name	= "mcf_serial",
+	.start	= mcf_serial_init,
+	.stop	= NULL,
+	.setbrg	= mcf_serial_setbrg,
+	.putc	= mcf_serial_putc,
+	.puts	= mcf_serial_puts,
+	.getc	= mcf_serial_getc,
+	.tstc	= mcf_serial_tstc,
+};
+
+void mcf_serial_initialize(void)
+{
+	serial_register(&mcf_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &mcf_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return mcf_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	mcf_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	mcf_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	mcf_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return mcf_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return mcf_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 44/70] serial: Implement CONFIG_SERIAL_MULTI into ns9750 serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (42 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 43/70] serial: mcf: Implement CONFIG_SERIAL_MULTI into MCF " Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 45/70] serial: oc: Implement CONFIG_SERIAL_MULTI into OpenCores " Marek Vasut
                     ` (26 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into ns9750 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the ns9750 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                |    2 ++
 drivers/serial/ns9750_serial.c |   65 ++++++++++++++++++++++++++++++++++++----
 2 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index fa16dce..c6a275d 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -74,6 +74,7 @@ serial_initfunc(altera_serial_initialize);
 serial_initfunc(atmel_serial_initialize);
 serial_initfunc(lpc32xx_serial_initialize);
 serial_initfunc(mcf_serial_initialize);
+serial_initfunc(ns9750_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -126,6 +127,7 @@ void serial_initialize(void)
 	atmel_serial_initialize();
 	lpc32xx_serial_initialize();
 	mcf_serial_initialize();
+	ns9750_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/ns9750_serial.c b/drivers/serial/ns9750_serial.c
index e9645a0..829f6d5 100644
--- a/drivers/serial/ns9750_serial.c
+++ b/drivers/serial/ns9750_serial.c
@@ -52,7 +52,7 @@ static unsigned int unCharCache; /* unCharCache is only valid if
  * @Descr: configures GPIOs and UART. Requires BBUS Master Reset turned off
  ***********************************************************************/
 
-int serial_init( void )
+static int ns9750_serial_init(void)
 {
 	unsigned int aunGPIOTxD[] = { 0, 8, 40, 44 };
 	unsigned int aunGPIORxD[] = { 1, 9, 41, 45 };
@@ -85,7 +85,7 @@ int serial_init( void )
  * @Descr: writes one character to the FIFO. Blocks until FIFO is not full
  ***********************************************************************/
 
-void serial_putc( const char c )
+static void ns9750_serial_putc(const char c)
 {
 	if (c == '\n')
 		serial_putc( '\r' );
@@ -105,7 +105,7 @@ void serial_putc( const char c )
  * @Descr: writes non-zero string to the FIFO.
  ***********************************************************************/
 
-void serial_puts( const char *s )
+static void ns9750_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc( *s++ );
@@ -118,7 +118,7 @@ void serial_puts( const char *s )
  * @Descr: performs only 8bit accesses to the FIFO. No error handling
  ***********************************************************************/
 
-int serial_getc( void )
+static int ns9750_serial_getc(void)
 {
 	int i;
 
@@ -142,7 +142,7 @@ int serial_getc( void )
  *	   unCharCache and the numbers of characters in cCharsAvailable
  ***********************************************************************/
 
-int serial_tstc( void )
+static int ns9750_serial_tstc(void)
 {
 	unsigned int unRegCache;
 
@@ -171,7 +171,7 @@ int serial_tstc( void )
 	return 0;
 }
 
-void serial_setbrg( void )
+static void ns9750_serial_setbrg(void)
 {
 	*get_ser_reg_addr_channel( NS9750_SER_BITRATE, CONSOLE ) =
 		calcBitrateRegister();
@@ -208,3 +208,56 @@ static unsigned int calcRxCharGapRegister( void )
 {
 	return NS9750_SER_RX_CHAR_TIMER_TRUN;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device ns9750_serial_drv = {
+	.name	= "ns9750_serial",
+	.start	= ns9750_serial_init,
+	.stop	= NULL,
+	.setbrg	= ns9750_serial_setbrg,
+	.putc	= ns9750_serial_putc,
+	.puts	= ns9750_serial_puts,
+	.getc	= ns9750_serial_getc,
+	.tstc	= ns9750_serial_tstc,
+};
+
+void ns9750_serial_initialize(void)
+{
+	serial_register(&ns9750_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &ns9750_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return ns9750_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	ns9750_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	ns9750_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	ns9750_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return ns9750_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return ns9750_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 45/70] serial: oc: Implement CONFIG_SERIAL_MULTI into OpenCores serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (43 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 44/70] serial: Implement CONFIG_SERIAL_MULTI into ns9750 " Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 46/70] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c4510b " Marek Vasut
                     ` (25 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into OpenCores serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the OpenCores driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Scott McNutt <smcnutt@psyent.com>
---
 common/serial.c                 |    2 ++
 drivers/serial/opencores_yanu.c |   67 +++++++++++++++++++++++++++++++++++----
 2 files changed, 62 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index c6a275d..f217093 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -75,6 +75,7 @@ serial_initfunc(atmel_serial_initialize);
 serial_initfunc(lpc32xx_serial_initialize);
 serial_initfunc(mcf_serial_initialize);
 serial_initfunc(ns9750_serial_initialize);
+serial_initfunc(oc_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -128,6 +129,7 @@ void serial_initialize(void)
 	lpc32xx_serial_initialize();
 	mcf_serial_initialize();
 	ns9750_serial_initialize();
+	oc_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/opencores_yanu.c b/drivers/serial/opencores_yanu.c
index f383011..a0dd301 100644
--- a/drivers/serial/opencores_yanu.c
+++ b/drivers/serial/opencores_yanu.c
@@ -37,7 +37,7 @@ static yanu_uart_t *uart = (yanu_uart_t *)CONFIG_SYS_NIOS_CONSOLE;
 
 /* Everything's already setup for fixed-baud PTF assignment*/
 
-void serial_setbrg (void)
+static void oc_serial_setbrg(void)
 {
 	int n, k;
 	const unsigned max_uns = 0xFFFFFFFF;
@@ -68,7 +68,7 @@ void serial_setbrg (void)
 
 #else
 
-void serial_setbrg (void)
+static void oc_serial_setbrg(void)
 {
 	int n, k;
 	const unsigned max_uns = 0xFFFFFFFF;
@@ -100,7 +100,7 @@ void serial_setbrg (void)
 
 #endif /* CONFIG_SYS_NIOS_FIXEDBAUD */
 
-int serial_init (void)
+static int oc_serial_init(void)
 {
 	unsigned action,control;
 
@@ -141,7 +141,7 @@ int serial_init (void)
 /*-----------------------------------------------------------------------
  * YANU CONSOLE
  *---------------------------------------------------------------------*/
-void serial_putc (char c)
+static void oc_serial_putc(char c)
 {
 	int tx_chars;
 	unsigned status;
@@ -161,7 +161,7 @@ void serial_putc (char c)
 	writel((unsigned char)c, &uart->data);
 }
 
-void serial_puts (const char *s)
+static void oc_serial_puts(const char *s)
 {
 	while (*s != 0) {
 		serial_putc (*s++);
@@ -169,7 +169,7 @@ void serial_puts (const char *s)
 }
 
 
-int serial_tstc(void)
+static int oc_serial_tstc(void)
 {
 	unsigned status ;
 
@@ -178,7 +178,7 @@ int serial_tstc(void)
 		 ((1 << YANU_RFIFO_CHARS_N) - 1)) > 0);
 }
 
-int serial_getc (void)
+statoc int oc_serial_getc(void)
 {
 	while (serial_tstc() == 0)
 		WATCHDOG_RESET ();
@@ -188,3 +188,56 @@ int serial_getc (void)
 
 	return(readl(&uart->data) & YANU_DATA_CHAR_MASK);
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device oc_serial_drv = {
+	.name	= "oc_serial",
+	.start	= oc_serial_init,
+	.stop	= NULL,
+	.setbrg	= oc_serial_setbrg,
+	.putc	= oc_serial_putc,
+	.puts	= oc_serial_puts,
+	.getc	= oc_serial_getc,
+	.tstc	= oc_serial_tstc,
+};
+
+void oc_serial_initialize(void)
+{
+	serial_register(&oc_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &oc_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return oc_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	oc_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	oc_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	oc_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return oc_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return oc_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 46/70] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c4510b serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (44 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 45/70] serial: oc: Implement CONFIG_SERIAL_MULTI into OpenCores " Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 47/70] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c64xx " Marek Vasut
                     ` (24 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into s3c4510b serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the s3c4510b driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                |    2 ++
 drivers/serial/s3c4510b_uart.c |   65 ++++++++++++++++++++++++++++++++++++----
 2 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index f217093..d0a20e9 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -76,6 +76,7 @@ serial_initfunc(lpc32xx_serial_initialize);
 serial_initfunc(mcf_serial_initialize);
 serial_initfunc(ns9750_serial_initialize);
 serial_initfunc(oc_serial_initialize);
+serial_initfunc(s3c4510b_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -130,6 +131,7 @@ void serial_initialize(void)
 	mcf_serial_initialize();
 	ns9750_serial_initialize();
 	oc_serial_initialize();
+	s3c4510b_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/s3c4510b_uart.c b/drivers/serial/s3c4510b_uart.c
index aa378e1..4f7f98e 100644
--- a/drivers/serial/s3c4510b_uart.c
+++ b/drivers/serial/s3c4510b_uart.c
@@ -80,7 +80,7 @@ static int serial_flush_output(void)
 }
 
 
-void serial_setbrg (void)
+static void s3c4510b_serial_setbrg(void)
 {
 	UART_LINE_CTRL ulctrl;
 	UART_CTRL      uctrl;
@@ -135,7 +135,7 @@ void serial_setbrg (void)
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  *
  */
-int serial_init (void)
+static int s3c4510b_serial_init(void)
 {
 
 #if   CONFIG_SERIAL1 == 1
@@ -155,7 +155,7 @@ int serial_init (void)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc (const char c)
+static void s3c4510_serial_putc(const char c)
 {
 	/* wait for room in the transmit FIFO */
 	while( !uart->m_stat.bf.txBufEmpty);
@@ -174,7 +174,7 @@ void serial_putc (const char c)
  * Test if an input byte is ready from the serial port. Returns non-zero on
  * success, 0 otherwise.
  */
-int serial_tstc (void)
+static int s3c4510b_serial_tstc(void)
 {
 	return uart->m_stat.bf.rxReady;
 }
@@ -184,7 +184,7 @@ int serial_tstc (void)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_getc (void)
+static int s3c4510b_serial_getc(void)
 {
 	int rv;
 
@@ -197,7 +197,7 @@ int serial_getc (void)
 	}
 }
 
-void serial_puts (const char *s)
+static void s3c4510b_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
@@ -210,3 +210,56 @@ void serial_puts (const char *s)
 	uart->m_ctrl.bf.sendBreak = 0;
 
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device s3c4510b_serial_drv = {
+	.name	= "s3c4510b_serial",
+	.start	= s3c4510b_serial_init,
+	.stop	= NULL,
+	.setbrg	= s3c4510b_serial_setbrg,
+	.putc	= s3c4510b_serial_putc,
+	.puts	= s3c4510b_serial_puts,
+	.getc	= s3c4510b_serial_getc,
+	.tstc	= s3c4510b_serial_tstc,
+};
+
+void s3c4510b_serial_initialize(void)
+{
+	serial_register(&s3c4510b_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &s3c4510b_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return s3c4510b_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	s3c4510b_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	s3c4510b_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	s3c4510b_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return s3c4510b_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return s3c4510b_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 47/70] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c64xx serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (45 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 46/70] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c4510b " Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 48/70] serial: sandbox: Implement CONFIG_SERIAL_MULTI into sandbox " Marek Vasut
                     ` (23 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into s3c64xx serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the s3c64xx driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: John Rigby <john.rigby@linaro.org>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 common/serial.c          |    2 ++
 drivers/serial/s3c64xx.c |   65 +++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index d0a20e9..93d6a08 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -77,6 +77,7 @@ serial_initfunc(mcf_serial_initialize);
 serial_initfunc(ns9750_serial_initialize);
 serial_initfunc(oc_serial_initialize);
 serial_initfunc(s3c4510b_serial_initialize);
+serial_initfunc(s3c64xx_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -132,6 +133,7 @@ void serial_initialize(void)
 	ns9750_serial_initialize();
 	oc_serial_initialize();
 	s3c4510b_serial_initialize();
+	s3c64xx_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/s3c64xx.c b/drivers/serial/s3c64xx.c
index a88e930..823425b 100644
--- a/drivers/serial/s3c64xx.c
+++ b/drivers/serial/s3c64xx.c
@@ -68,7 +68,7 @@ static const int udivslot[] = {
 	0xffdf,
 };
 
-void serial_setbrg(void)
+static void s3c64xx_serial_setbrg(void)
 {
 	s3c64xx_uart *const uart = s3c64xx_get_base_uart(UART_NR);
 	u32 pclk = get_PCLK();
@@ -88,7 +88,7 @@ void serial_setbrg(void)
  * Initialise the serial port with the given baudrate. The settings
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  */
-int serial_init(void)
+static int s3c64xx_serial_init(void)
 {
 	s3c64xx_uart *const uart = s3c64xx_get_base_uart(UART_NR);
 
@@ -110,7 +110,7 @@ int serial_init(void)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_getc(void)
+static int s3c64xx_serial_getc(void)
 {
 	s3c64xx_uart *const uart = s3c64xx_get_base_uart(UART_NR);
 
@@ -137,7 +137,7 @@ void enable_putc(void)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc(const char c)
+static void s3c64xx_serial_putc(const char c)
 {
 	s3c64xx_uart *const uart = s3c64xx_get_base_uart(UART_NR);
 
@@ -159,15 +159,68 @@ void serial_putc(const char c)
 /*
  * Test whether a character is in the RX buffer
  */
-int serial_tstc(void)
+static int s3c64xx_serial_tstc(void)
 {
 	s3c64xx_uart *const uart = s3c64xx_get_base_uart(UART_NR);
 
 	return uart->UTRSTAT & 0x1;
 }
 
-void serial_puts(const char *s)
+static void s3c64xx_serial_puts(const char *s)
 {
 	while (*s)
 		serial_putc(*s++);
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device s3c64xx_serial_drv = {
+	.name	= "s3c64xx_serial",
+	.start	= s3c64xx_serial_init,
+	.stop	= NULL,
+	.setbrg	= s3c64xx_serial_setbrg,
+	.putc	= s3c64xx_serial_putc,
+	.puts	= s3c64xx_serial_puts,
+	.getc	= s3c64xx_serial_getc,
+	.tstc	= s3c64xx_serial_tstc,
+};
+
+void s3c64xx_serial_initialize(void)
+{
+	serial_register(&s3c64xx_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &s3c64xx_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return s3c64xx_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	s3c64xx_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	s3c64xx_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	s3c64xx_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return s3c64xx_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return s3c64xx_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 48/70] serial: sandbox: Implement CONFIG_SERIAL_MULTI into sandbox serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (46 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 47/70] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c64xx " Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 49/70] serial: arm: Implement CONFIG_SERIAL_MULTI into clps7111 " Marek Vasut
                     ` (22 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into sandbox serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the sandbox driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Mike Frysinger <vapier@gentoo.org>
---
 common/serial.c          |    2 ++
 drivers/serial/sandbox.c |   67 +++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 93d6a08..a7a3234 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -78,6 +78,7 @@ serial_initfunc(ns9750_serial_initialize);
 serial_initfunc(oc_serial_initialize);
 serial_initfunc(s3c4510b_serial_initialize);
 serial_initfunc(s3c64xx_serial_initialize);
+serial_initfunc(sandbox_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -134,6 +135,7 @@ void serial_initialize(void)
 	oc_serial_initialize();
 	s3c4510b_serial_initialize();
 	s3c64xx_serial_initialize();
+	sandbox_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/sandbox.c b/drivers/serial/sandbox.c
index 1927c16..d60fbba 100644
--- a/drivers/serial/sandbox.c
+++ b/drivers/serial/sandbox.c
@@ -27,28 +27,30 @@
 
 #include <common.h>
 #include <os.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
-int serial_init(void)
+static int sandbox_serial_init(void)
 {
 	os_tty_raw(0);
 	return 0;
 }
 
-void serial_setbrg(void)
+static void sandbox_serial_setbrg(void)
 {
 }
 
-void serial_putc(const char ch)
+static void sandbox_serial_putc(const char ch)
 {
 	os_write(1, &ch, 1);
 }
 
-void serial_puts(const char *str)
+static void sandbox_serial_puts(const char *str)
 {
 	os_write(1, str, strlen(str));
 }
 
-int serial_getc(void)
+static int sandbox_serial_getc(void)
 {
 	char buf;
 	ssize_t count;
@@ -57,7 +59,60 @@ int serial_getc(void)
 	return count == 1 ? buf : 0;
 }
 
-int serial_tstc(void)
+static int sandbox_serial_tstc(void)
 {
 	return 0;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device sandbox_serial_drv = {
+	.name	= "sandbox_serial",
+	.start	= sandbox_serial_init,
+	.stop	= NULL,
+	.setbrg	= sandbox_serial_setbrg,
+	.putc	= sandbox_serial_putc,
+	.puts	= sandbox_serial_puts,
+	.getc	= sandbox_serial_getc,
+	.tstc	= sandbox_serial_tstc,
+};
+
+void sandbox_serial_initialize(void)
+{
+	serial_register(&sandbox_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &sandbox_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return sandbox_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	sandbox_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	sandbox_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	sandbox_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return sandbox_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return sandbox_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 49/70] serial: arm: Implement CONFIG_SERIAL_MULTI into clps7111 serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (47 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 48/70] serial: sandbox: Implement CONFIG_SERIAL_MULTI into sandbox " Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 50/70] serial: arm: Implement CONFIG_SERIAL_MULTI into imx " Marek Vasut
                     ` (21 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into clps7111 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the clps7111 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                  |    2 ++
 drivers/serial/serial_clps7111.c |   66 ++++++++++++++++++++++++++++++++++----
 2 files changed, 61 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index a7a3234..4471262 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -79,6 +79,7 @@ serial_initfunc(oc_serial_initialize);
 serial_initfunc(s3c4510b_serial_initialize);
 serial_initfunc(s3c64xx_serial_initialize);
 serial_initfunc(sandbox_serial_initialize);
+serial_initfunc(clps7111_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -136,6 +137,7 @@ void serial_initialize(void)
 	s3c4510b_serial_initialize();
 	s3c64xx_serial_initialize();
 	sandbox_serial_initialize();
+	clps7111_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_clps7111.c b/drivers/serial/serial_clps7111.c
index a6aecad..e1bed90 100644
--- a/drivers/serial/serial_clps7111.c
+++ b/drivers/serial/serial_clps7111.c
@@ -33,7 +33,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void serial_setbrg (void)
+static void clps7111_serial_setbrg(void)
 {
 	unsigned int reg = 0;
 
@@ -63,7 +63,7 @@ void serial_setbrg (void)
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  *
  */
-int serial_init (void)
+static int clps7111_serial_init(void)
 {
 	serial_setbrg ();
 
@@ -74,7 +74,7 @@ int serial_init (void)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc (const char c)
+static void clps7111_serial_putc(const char c)
 {
 	int tmo;
 
@@ -95,7 +95,7 @@ void serial_putc (const char c)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_tstc (void)
+static int clps7111_serial_tstc(void)
 {
 	return !(IO_SYSFLG1 & SYSFLG1_URXFE);
 }
@@ -105,17 +105,69 @@ int serial_tstc (void)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_getc (void)
+static int clps7111_serial_getc(void)
 {
 	while (IO_SYSFLG1 & SYSFLG1_URXFE);
 
 	return IO_UARTDR1 & 0xff;
 }
 
-void
-serial_puts (const char *s)
+static void clps7111_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device clps7111_serial_drv = {
+	.name	= "clps7111_serial",
+	.start	= clps7111_serial_init,
+	.stop	= NULL,
+	.setbrg	= clps7111_serial_setbrg,
+	.putc	= clps7111_serial_putc,
+	.puts	= clps7111_serial_puts,
+	.getc	= clps7111_serial_getc,
+	.tstc	= clps7111_serial_tstc,
+};
+
+void clps7111_serial_initialize(void)
+{
+	serial_register(&clps7111_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &clps7111_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return clps7111_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	clps7111_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	clps7111_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	clps7111_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return clps7111_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return clps7111_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 50/70] serial: arm: Implement CONFIG_SERIAL_MULTI into imx serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (48 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 49/70] serial: arm: Implement CONFIG_SERIAL_MULTI into clps7111 " Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 51/70] serial: arm: Implement CONFIG_SERIAL_MULTI into ixp " Marek Vasut
                     ` (20 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into imx serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the imx driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Stefano Babic <sbabic@denx.de>
---
 common/serial.c             |    2 ++
 drivers/serial/serial_imx.c |   68 ++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 63 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 4471262..cb8eacf 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -80,6 +80,7 @@ serial_initfunc(s3c4510b_serial_initialize);
 serial_initfunc(s3c64xx_serial_initialize);
 serial_initfunc(sandbox_serial_initialize);
 serial_initfunc(clps7111_serial_initialize);
+serial_initfunc(imx_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -138,6 +139,7 @@ void serial_initialize(void)
 	s3c64xx_serial_initialize();
 	sandbox_serial_initialize();
 	clps7111_serial_initialize();
+	imx_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_imx.c b/drivers/serial/serial_imx.c
index b9ca748..d37ec29 100644
--- a/drivers/serial/serial_imx.c
+++ b/drivers/serial/serial_imx.c
@@ -19,6 +19,8 @@
 
 #include <common.h>
 #include <asm/arch/imx-regs.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 #if defined CONFIG_IMX_SERIAL1
 #define UART_BASE IMX_UART1_BASE
@@ -50,7 +52,7 @@ struct imx_serial {
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void serial_setbrg (void)
+static void imx_serial_setbrg(void)
 {
 	serial_init();
 }
@@ -62,7 +64,7 @@ extern void imx_gpio_mode(int gpio_mode);
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  *
  */
-int serial_init (void)
+static int imx_serial_init(void)
 {
 	volatile struct imx_serial* base = (struct imx_serial *)UART_BASE;
 	unsigned int ufcr_rfdiv;
@@ -163,7 +165,7 @@ int serial_init (void)
  * otherwise. When the function is successful, the character read is
  * written into its argument c.
  */
-int serial_getc (void)
+static int imx_serial_getc(void)
 {
 	volatile struct imx_serial* base = (struct imx_serial *)UART_BASE;
 	unsigned char ch;
@@ -185,7 +187,7 @@ int hwflow_onoff(int on)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc (const char c)
+static void imx_serial_putc(const char c)
 {
 	volatile struct imx_serial* base = (struct imx_serial *)UART_BASE;
 
@@ -202,7 +204,7 @@ void serial_putc (const char c)
 /*
  * Test whether a character is in the RX buffer
  */
-int serial_tstc (void)
+static int imx_serial_tstc(void)
 {
 	volatile struct imx_serial* base = (struct imx_serial *)UART_BASE;
 
@@ -212,10 +214,62 @@ int serial_tstc (void)
 	return 1;
 }
 
-void
-serial_puts (const char *s)
+static void imx_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device imx_serial_drv = {
+	.name	= "imx_serial",
+	.start	= imx_serial_init,
+	.stop	= NULL,
+	.setbrg	= imx_serial_setbrg,
+	.putc	= imx_serial_putc,
+	.puts	= imx_serial_puts,
+	.getc	= imx_serial_getc,
+	.tstc	= imx_serial_tstc,
+};
+
+void imx_serial_initialize(void)
+{
+	serial_register(&imx_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &imx_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return imx_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	imx_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	imx_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	imx_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return imx_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return imx_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 51/70] serial: arm: Implement CONFIG_SERIAL_MULTI into ixp serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (49 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 50/70] serial: arm: Implement CONFIG_SERIAL_MULTI into imx " Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 52/70] serial: arm: Implement CONFIG_SERIAL_MULTI into ks8695 " Marek Vasut
                     ` (19 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into ixp serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the ixp driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Michael Schwingen <michael@schwingen.org>
---
 common/serial.c             |    2 ++
 drivers/serial/serial_ixp.c |   68 ++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 63 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index cb8eacf..3d8fa7f 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -81,6 +81,7 @@ serial_initfunc(s3c64xx_serial_initialize);
 serial_initfunc(sandbox_serial_initialize);
 serial_initfunc(clps7111_serial_initialize);
 serial_initfunc(imx_serial_initialize);
+serial_initfunc(ixp_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -140,6 +141,7 @@ void serial_initialize(void)
 	sandbox_serial_initialize();
 	clps7111_serial_initialize();
 	imx_serial_initialize();
+	ixp_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_ixp.c b/drivers/serial/serial_ixp.c
index a9acd47..6e3f7f0 100644
--- a/drivers/serial/serial_ixp.c
+++ b/drivers/serial/serial_ixp.c
@@ -31,6 +31,8 @@
 #include <common.h>
 #include <asm/arch/ixp425.h>
 #include <watchdog.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 /*
  *               14.7456 MHz
@@ -41,7 +43,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void serial_setbrg (void)
+static void ixp_serial_setbrg(void)
 {
 	unsigned int quot = 0;
 	int uart = CONFIG_SYS_IXP425_CONSOLE;
@@ -72,7 +74,7 @@ void serial_setbrg (void)
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  *
  */
-int serial_init (void)
+static int ixp_serial_init(void)
 {
 	serial_setbrg ();
 
@@ -83,7 +85,7 @@ int serial_init (void)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc (const char c)
+static void ixp_serial_putc(const char c)
 {
 	/* wait for room in the tx FIFO on UART */
 	while ((LSR(CONFIG_SYS_IXP425_CONSOLE) & LSR_TEMT) == 0)
@@ -101,7 +103,7 @@ void serial_putc (const char c)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_tstc (void)
+static int ixp_serial_tstc(void)
 {
 	return LSR(CONFIG_SYS_IXP425_CONSOLE) & LSR_DR;
 }
@@ -111,7 +113,7 @@ int serial_tstc (void)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_getc (void)
+static int ixp_serial_getc(void)
 {
 	while (!(LSR(CONFIG_SYS_IXP425_CONSOLE) & LSR_DR))
 		WATCHDOG_RESET();	/* Reset HW Watchdog, if needed */
@@ -119,10 +121,62 @@ int serial_getc (void)
 	return (char) RBR(CONFIG_SYS_IXP425_CONSOLE) & 0xff;
 }
 
-void
-serial_puts (const char *s)
+static void ixp_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device ixp_serial_drv = {
+	.name	= "ixp_serial",
+	.start	= ixp_serial_init,
+	.stop	= NULL,
+	.setbrg	= ixp_serial_setbrg,
+	.putc	= ixp_serial_putc,
+	.puts	= ixp_serial_puts,
+	.getc	= ixp_serial_getc,
+	.tstc	= ixp_serial_tstc,
+};
+
+void ixp_serial_initialize(void)
+{
+	serial_register(&ixp_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &ixp_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return ixp_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	ixp_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	ixp_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	ixp_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return ixp_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return ixp_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 52/70] serial: arm: Implement CONFIG_SERIAL_MULTI into ks8695 serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (50 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 51/70] serial: arm: Implement CONFIG_SERIAL_MULTI into ixp " Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 53/70] serial: arm: Implement CONFIG_SERIAL_MULTI into lh7a40x " Marek Vasut
                     ` (18 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into ks8695 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the ks8695 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                |    2 ++
 drivers/serial/serial_ks8695.c |   73 +++++++++++++++++++++++++++++++++++-----
 2 files changed, 66 insertions(+), 9 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 3d8fa7f..21c8ac3 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -82,6 +82,7 @@ serial_initfunc(sandbox_serial_initialize);
 serial_initfunc(clps7111_serial_initialize);
 serial_initfunc(imx_serial_initialize);
 serial_initfunc(ixp_serial_initialize);
+serial_initfunc(ks8695_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -142,6 +143,7 @@ void serial_initialize(void)
 	clps7111_serial_initialize();
 	imx_serial_initialize();
 	ixp_serial_initialize();
+	ks8695_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_ks8695.c b/drivers/serial/serial_ks8695.c
index aacd1be..b3af388 100644
--- a/drivers/serial/serial_ks8695.c
+++ b/drivers/serial/serial_ks8695.c
@@ -20,6 +20,8 @@
 
 #include <common.h>
 #include <asm/arch/platform.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 #ifndef CONFIG_SERIAL1
 #error "Bad: you didn't configure serial ..."
@@ -54,7 +56,7 @@ struct ks8695uart {
 int serial_console = 1;
 
 
-void serial_setbrg(void)
+static void ks8695_serial_setbrg(void)
 {
 	volatile struct ks8695uart *uartp = KS8695_UART_ADDR;
 
@@ -63,14 +65,14 @@ void serial_setbrg(void)
 	uartp->LCR = KS8695_UART_LINEC_WLEN8;
 }
 
-int serial_init(void)
+static int ks8695_serial_init(void)
 {
 	serial_console = 1;
 	serial_setbrg();
 	return 0;
 }
 
-void serial_raw_putc(const char c)
+static void ks8695_serial_raw_putc(const char c)
 {
 	volatile struct ks8695uart *uartp = KS8695_UART_ADDR;
 	int i;
@@ -83,16 +85,16 @@ void serial_raw_putc(const char c)
 	uartp->TX = c;
 }
 
-void serial_putc(const char c)
+static void ks8695_serial_putc(const char c)
 {
 	if (serial_console) {
-		serial_raw_putc(c);
+		ks8695_serial_raw_putc(c);
 		if (c == '\n')
-			serial_raw_putc('\r');
+			ks8695_serial_raw_putc('\r');
 	}
 }
 
-int serial_tstc(void)
+static int ks8695_serial_tstc(void)
 {
 	volatile struct ks8695uart *uartp = KS8695_UART_ADDR;
 	if (serial_console)
@@ -100,14 +102,14 @@ int serial_tstc(void)
 	return 0;
 }
 
-void serial_puts(const char *s)
+static void ks8695_serial_puts(const char *s)
 {
 	char c;
 	while ((c = *s++) != 0)
 		serial_putc(c);
 }
 
-int serial_getc(void)
+static int ks8695_serial_getc(void)
 {
 	volatile struct ks8695uart *uartp = KS8695_UART_ADDR;
 
@@ -115,3 +117,56 @@ int serial_getc(void)
 		;
 	return (uartp->RX);
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device ks8695_serial_drv = {
+	.name	= "ks8695_serial",
+	.start	= ks8695_serial_init,
+	.stop	= NULL,
+	.setbrg	= ks8695_serial_setbrg,
+	.putc	= ks8695_serial_putc,
+	.puts	= ks8695_serial_puts,
+	.getc	= ks8695_serial_getc,
+	.tstc	= ks8695_serial_tstc,
+};
+
+void ks8695_serial_initialize(void)
+{
+	serial_register(&ks8695_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &ks8695_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return ks8695_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	ks8695_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	ks8695_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	ks8695_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return ks8695_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return ks8695_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 53/70] serial: arm: Implement CONFIG_SERIAL_MULTI into lh7a40x serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (51 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 52/70] serial: arm: Implement CONFIG_SERIAL_MULTI into ks8695 " Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 54/70] serial: arm: Implement CONFIG_SERIAL_MULTI into lpc2292 " Marek Vasut
                     ` (17 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into lh7a40x serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the lh7a40x driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                 |    2 ++
 drivers/serial/serial_lh7a40x.c |   66 ++++++++++++++++++++++++++++++++++-----
 2 files changed, 61 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 21c8ac3..59a8650 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -83,6 +83,7 @@ serial_initfunc(clps7111_serial_initialize);
 serial_initfunc(imx_serial_initialize);
 serial_initfunc(ixp_serial_initialize);
 serial_initfunc(ks8695_serial_initialize);
+serial_initfunc(lh7a40x_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -144,6 +145,7 @@ void serial_initialize(void)
 	imx_serial_initialize();
 	ixp_serial_initialize();
 	ks8695_serial_initialize();
+	lh7a40x_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_lh7a40x.c b/drivers/serial/serial_lh7a40x.c
index 4767489..6b73606 100644
--- a/drivers/serial/serial_lh7a40x.c
+++ b/drivers/serial/serial_lh7a40x.c
@@ -33,7 +33,7 @@ DECLARE_GLOBAL_DATA_PTR;
 # error "No console configured ... "
 #endif
 
-void serial_setbrg (void)
+static void lh7a40x_serial_setbrg(void)
 {
 	lh7a40x_uart_t* uart = LH7A40X_UART_PTR(UART_CONSOLE);
 	int i;
@@ -61,7 +61,7 @@ void serial_setbrg (void)
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  *
  */
-int serial_init (void)
+static int lh7a40x_serial_init(void)
 {
 	lh7a40x_uart_t* uart = LH7A40X_UART_PTR(UART_CONSOLE);
 
@@ -95,7 +95,7 @@ int serial_init (void)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_getc (void)
+static int lh7a40x_serial_getc(void)
 {
 	lh7a40x_uart_t* uart = LH7A40X_UART_PTR(UART_CONSOLE);
 
@@ -141,7 +141,7 @@ void enable_putc(void)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc (const char c)
+static void lh7a40x_serial_putc(const char c)
 {
 	lh7a40x_uart_t* uart = LH7A40X_UART_PTR(UART_CONSOLE);
 
@@ -168,17 +168,69 @@ void serial_putc (const char c)
 /*
  * Test whether a character is in the RX buffer
  */
-int serial_tstc (void)
+static int lh7a40x_serial_tstc(void)
 {
 	lh7a40x_uart_t* uart = LH7A40X_UART_PTR(UART_CONSOLE);
 
 	return(!(uart->status & UART_RXFE));
 }
 
-void
-serial_puts (const char *s)
+static void lh7a40x_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device lh7a40x_serial_drv = {
+	.name	= "lh7a40x_serial",
+	.start	= lh7a40x_serial_init,
+	.stop	= NULL,
+	.setbrg	= lh7a40x_serial_setbrg,
+	.putc	= lh7a40x_serial_putc,
+	.puts	= lh7a40x_serial_puts,
+	.getc	= lh7a40x_serial_getc,
+	.tstc	= lh7a40x_serial_tstc,
+};
+
+void lh7a40x_serial_initialize(void)
+{
+	serial_register(&lh7a40x_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &lh7a40x_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return lh7a40x_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	lh7a40x_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	lh7a40x_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	lh7a40x_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return lh7a40x_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return lh7a40x_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 54/70] serial: arm: Implement CONFIG_SERIAL_MULTI into lpc2292 serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (52 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 53/70] serial: arm: Implement CONFIG_SERIAL_MULTI into lh7a40x " Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 55/70] serial: Implement CONFIG_SERIAL_MULTI into max3100 " Marek Vasut
                     ` (16 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into lpc2292 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the lpc2292 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                 |    2 ++
 drivers/serial/serial_lpc2292.c |   66 ++++++++++++++++++++++++++++++++++-----
 2 files changed, 61 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 59a8650..23c8d22 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -84,6 +84,7 @@ serial_initfunc(imx_serial_initialize);
 serial_initfunc(ixp_serial_initialize);
 serial_initfunc(ks8695_serial_initialize);
 serial_initfunc(lh7a40x_serial_initialize);
+serial_initfunc(lpc2292_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -146,6 +147,7 @@ void serial_initialize(void)
 	ixp_serial_initialize();
 	ks8695_serial_initialize();
 	lh7a40x_serial_initialize();
+	lpc2292_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_lpc2292.c b/drivers/serial/serial_lpc2292.c
index e3a60b6..2601ee7 100644
--- a/drivers/serial/serial_lpc2292.c
+++ b/drivers/serial/serial_lpc2292.c
@@ -33,7 +33,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void serial_setbrg (void)
+static void lpc2292_serial_setbrg(void)
 {
 	unsigned short divisor = 0;
 
@@ -57,7 +57,7 @@ void serial_setbrg (void)
 	PUT8(U0FCR, 1);		/* Enable RX and TX FIFOs */
 }
 
-int serial_init (void)
+static int lpc2292_serial_init(void)
 {
 	unsigned long pinsel0;
 
@@ -71,7 +71,7 @@ int serial_init (void)
 	return (0);
 }
 
-void serial_putc (const char c)
+static void lpc2292_serial_putc(const char c)
 {
 	if (c == '\n')
 	{
@@ -83,14 +83,13 @@ void serial_putc (const char c)
 	PUT8(U0THR, c);
 }
 
-int serial_getc (void)
+static int lpc2292_serial_getc(void)
 {
 	while((GET8(U0LSR) & 1) == 0);
 	return GET8(U0RBR);
 }
 
-void
-serial_puts (const char *s)
+static void lpc2292_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
@@ -98,7 +97,60 @@ serial_puts (const char *s)
 }
 
 /* Test if there is a byte to read */
-int serial_tstc (void)
+static int lpc2292_serial_tstc(void)
 {
 	return (GET8(U0LSR) & 1);
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device lpc2292_serial_drv = {
+	.name	= "lpc2292_serial",
+	.start	= lpc2292_serial_init,
+	.stop	= NULL,
+	.setbrg	= lpc2292_serial_setbrg,
+	.putc	= lpc2292_serial_putc,
+	.puts	= lpc2292_serial_puts,
+	.getc	= lpc2292_serial_getc,
+	.tstc	= lpc2292_serial_tstc,
+};
+
+void lpc2292_serial_initialize(void)
+{
+	serial_register(&lpc2292_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &lpc2292_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return lpc2292_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	lpc2292_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	lpc2292_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	lpc2292_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return lpc2292_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return lpc2292_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 55/70] serial: Implement CONFIG_SERIAL_MULTI into max3100 serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (53 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 54/70] serial: arm: Implement CONFIG_SERIAL_MULTI into lpc2292 " Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 56/70] serial: arm: Implement CONFIG_SERIAL_MULTI into mxc " Marek Vasut
                     ` (15 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into max3100 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the max3100 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                 |    2 ++
 drivers/serial/serial_max3100.c |   72 +++++++++++++++++++++++++++++++--------
 2 files changed, 60 insertions(+), 14 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 23c8d22..f007d13 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -85,6 +85,7 @@ serial_initfunc(ixp_serial_initialize);
 serial_initfunc(ks8695_serial_initialize);
 serial_initfunc(lh7a40x_serial_initialize);
 serial_initfunc(lpc2292_serial_initialize);
+serial_initfunc(max3100_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -148,6 +149,7 @@ void serial_initialize(void)
 	ks8695_serial_initialize();
 	lh7a40x_serial_initialize();
 	lpc2292_serial_initialize();
+	max3100_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_max3100.c b/drivers/serial/serial_max3100.c
index 4abc271..b21fba0 100644
--- a/drivers/serial/serial_max3100.c
+++ b/drivers/serial/serial_max3100.c
@@ -25,6 +25,8 @@
 
 #include <common.h>
 #include <watchdog.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -149,7 +151,7 @@ static int rxfifo_in;
 static int rxfifo_out;
 static unsigned char rxfifo_buf[16];
 
-static void max3100_putc(int c)
+static void max3100_serial_putc_raw(int c)
 {
 	unsigned int rx;
 
@@ -164,7 +166,7 @@ static void max3100_putc(int c)
 	}
 }
 
-static int max3100_getc(void)
+static int max3100_serial_getc(void)
 {
 	int c;
 	unsigned int rx;
@@ -190,7 +192,7 @@ static int max3100_getc(void)
 	return c;
 }
 
-static int max3100_tstc(void)
+static int max3100_serial_tstc(void)
 {
 	unsigned int rx;
 
@@ -213,7 +215,7 @@ static int max3100_tstc(void)
 	return 1;
 }
 
-int serial_init(void)
+static int max3100_serial_init(void)
 {
 	unsigned int wconf, rconf;
 	int i;
@@ -268,31 +270,73 @@ int serial_init(void)
 	return (0);
 }
 
-void serial_putc(const char c)
+static void max3100_serial_putc(const char c)
 {
 	if (c == '\n')
-		max3100_putc('\r');
+		max3100_serial_putc_raw('\r');
 
-	max3100_putc(c);
+	max3100_serial_putc_raw(c);
 }
 
-void serial_puts(const char *s)
+static void max3100_serial_puts(const char *s)
 {
 	while (*s)
-		serial_putc (*s++);
+		max3100_serial_putc_raw(*s++);
 }
 
-int serial_getc(void)
+static void max3100_serial_setbrg(void)
 {
-	return max3100_getc();
 }
 
-int serial_tstc(void)
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device max3100_serial_drv = {
+	.name	= "max3100_serial",
+	.start	= max3100_serial_init,
+	.stop	= NULL,
+	.setbrg	= max3100_serial_setbrg,
+	.putc	= max3100_serial_putc,
+	.puts	= max3100_serial_puts,
+	.getc	= max3100_serial_getc,
+	.tstc	= max3100_serial_tstc,
+};
+
+void max3100_serial_initialize(void)
+{
+	serial_register(&max3100_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &max3100_serial_drv;
+}
+#else
+int serial_init(void)
 {
-	return max3100_tstc();
+	return max3100_serial_init();
 }
 
-/* XXX WTF? */
 void serial_setbrg(void)
 {
+	max3100_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	max3100_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	max3100_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return max3100_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return max3100_serial_tstc();
 }
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 56/70] serial: arm: Implement CONFIG_SERIAL_MULTI into mxc serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (54 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 55/70] serial: Implement CONFIG_SERIAL_MULTI into max3100 " Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 57/70] serial: arm: Implement CONFIG_SERIAL_MULTI into netarm " Marek Vasut
                     ` (14 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into mxc serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the mxc driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Stefano Babic <sbabic@denx.de>
---
 common/serial.c             |    2 ++
 drivers/serial/serial_mxc.c |   68 ++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 63 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index f007d13..566a3cc 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -86,6 +86,7 @@ serial_initfunc(ks8695_serial_initialize);
 serial_initfunc(lh7a40x_serial_initialize);
 serial_initfunc(lpc2292_serial_initialize);
 serial_initfunc(max3100_serial_initialize);
+serial_initfunc(mxc_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -150,6 +151,7 @@ void serial_initialize(void)
 	lh7a40x_serial_initialize();
 	lpc2292_serial_initialize();
 	max3100_serial_initialize();
+	mxc_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
index af00b9c..0899e9b 100644
--- a/drivers/serial/serial_mxc.c
+++ b/drivers/serial/serial_mxc.c
@@ -21,6 +21,8 @@
 #include <watchdog.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/clock.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 #define __REG(x)     (*((volatile u32 *)(x)))
 
@@ -145,7 +147,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void serial_setbrg (void)
+static void mxc_serial_setbrg(void)
 {
 	u32 clk = imx_get_uartclk();
 
@@ -158,14 +160,14 @@ void serial_setbrg (void)
 
 }
 
-int serial_getc (void)
+static int mxc_serial_getc(void)
 {
 	while (__REG(UART_PHYS + UTS) & UTS_RXEMPTY)
 		WATCHDOG_RESET();
 	return (__REG(UART_PHYS + URXD) & URXD_RX_DATA); /* mask out status from upper word */
 }
 
-void serial_putc (const char c)
+static void mxc_serial_putc(const char c)
 {
 	__REG(UART_PHYS + UTXD) = c;
 
@@ -181,7 +183,7 @@ void serial_putc (const char c)
 /*
  * Test whether a character is in the RX buffer
  */
-int serial_tstc (void)
+static int mxc_serial_tstc(void)
 {
 	/* If receive fifo is empty, return false */
 	if (__REG(UART_PHYS + UTS) & UTS_RXEMPTY)
@@ -189,8 +191,7 @@ int serial_tstc (void)
 	return 1;
 }
 
-void
-serial_puts (const char *s)
+static void mxc_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
@@ -202,7 +203,7 @@ serial_puts (const char *s)
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  *
  */
-int serial_init (void)
+static int mxc_serial_init(void)
 {
 	__REG(UART_PHYS + UCR1) = 0x0;
 	__REG(UART_PHYS + UCR2) = 0x0;
@@ -224,3 +225,56 @@ int serial_init (void)
 
 	return 0;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device mxc_serial_drv = {
+	.name	= "mxc_serial",
+	.start	= mxc_serial_init,
+	.stop	= NULL,
+	.setbrg	= mxc_serial_setbrg,
+	.putc	= mxc_serial_putc,
+	.puts	= mxc_serial_puts,
+	.getc	= mxc_serial_getc,
+	.tstc	= mxc_serial_tstc,
+};
+
+void mxc_serial_initialize(void)
+{
+	serial_register(&mxc_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &mxc_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return mxc_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	mxc_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	mxc_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	mxc_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return mxc_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return mxc_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 57/70] serial: arm: Implement CONFIG_SERIAL_MULTI into netarm serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (55 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 56/70] serial: arm: Implement CONFIG_SERIAL_MULTI into mxc " Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 58/70] serial: arm: Implement CONFIG_SERIAL_MULTI into pl01x " Marek Vasut
                     ` (13 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into netarm serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the netarm driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Stefano Babic <sbabic@denx.de>
---
 common/serial.c                |    2 ++
 drivers/serial/serial_netarm.c |   65 ++++++++++++++++++++++++++++++++++++----
 2 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 566a3cc..c033cf0 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -87,6 +87,7 @@ serial_initfunc(lh7a40x_serial_initialize);
 serial_initfunc(lpc2292_serial_initialize);
 serial_initfunc(max3100_serial_initialize);
 serial_initfunc(mxc_serial_initialize);
+serial_initfunc(netarm_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -152,6 +153,7 @@ void serial_initialize(void)
 	lpc2292_serial_initialize();
 	max3100_serial_initialize();
 	mxc_serial_initialize();
+	netarm_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_netarm.c b/drivers/serial/serial_netarm.c
index d04790d..ff6612d 100644
--- a/drivers/serial/serial_netarm.c
+++ b/drivers/serial/serial_netarm.c
@@ -59,7 +59,7 @@ extern void _netarm_led_FAIL1(void);
 /*
  * Setup both serial i/f with given baudrate
  */
-void serial_setbrg (void)
+static void netarm_serial_setbrg(void)
 {
 	/* set 0 ... make sure pins are configured for serial */
 #if !defined(CONFIG_NETARM_NS7520)
@@ -108,7 +108,7 @@ void serial_setbrg (void)
  * Initialise the serial port with the given baudrate. The settings
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  */
-int serial_init (void)
+static int netarm_serial_init(void)
 {
 	serial_setbrg ();
 	return 0;
@@ -118,7 +118,7 @@ int serial_init (void)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc (const char c)
+static void netarm_serial_putc(const char c)
 {
 	volatile unsigned char *fifo;
 
@@ -135,7 +135,7 @@ void serial_putc (const char c)
  * Test of a single byte from the serial port. Returns 1 on success, 0
  * otherwise.
  */
-int serial_tstc(void)
+static int netarm_serial_tstc(void)
 {
 	return serial_reg_ch1->status_a & NETARM_SER_STATA_RX_RDY;
 }
@@ -144,7 +144,7 @@ int serial_tstc(void)
  * Read a single byte from the serial port. Returns 1 on success, 0
  * otherwise.
  */
-int serial_getc (void)
+static int netarm_serial_getc(void)
 {
 	unsigned int ch_uint;
 	volatile unsigned int *fifo;
@@ -182,9 +182,62 @@ int serial_getc (void)
 	return ch_uint & 0xff;
 }
 
-void serial_puts (const char *s)
+static void netarm_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device netarm_serial_drv = {
+	.name	= "netarm_serial",
+	.start	= netarm_serial_init,
+	.stop	= NULL,
+	.setbrg	= netarm_serial_setbrg,
+	.putc	= netarm_serial_putc,
+	.puts	= netarm_serial_puts,
+	.getc	= netarm_serial_getc,
+	.tstc	= netarm_serial_tstc,
+};
+
+void netarm_serial_initialize(void)
+{
+	serial_register(&netarm_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &netarm_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return netarm_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	netarm_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	netarm_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	netarm_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return netarm_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return netarm_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 58/70] serial: arm: Implement CONFIG_SERIAL_MULTI into pl01x serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (56 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 57/70] serial: arm: Implement CONFIG_SERIAL_MULTI into netarm " Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 59/70] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c44b0 " Marek Vasut
                     ` (12 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into pl01x serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the pl01x driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Mathieu J. Poirier <mathieu.poirier@linaro.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: John Rigby <john.rigby@linaro.org>
Cc: Rabin Vincent <rabin.vincent@stericsson.com>
---
 common/serial.c               |    2 ++
 drivers/serial/serial_pl01x.c |   69 ++++++++++++++++++++++++++++++++++++-----
 2 files changed, 64 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index c033cf0..48e6044 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -88,6 +88,7 @@ serial_initfunc(lpc2292_serial_initialize);
 serial_initfunc(max3100_serial_initialize);
 serial_initfunc(mxc_serial_initialize);
 serial_initfunc(netarm_serial_initialize);
+serial_initfunc(pl01x_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -154,6 +155,7 @@ void serial_initialize(void)
 	max3100_serial_initialize();
 	mxc_serial_initialize();
 	netarm_serial_initialize();
+	pl01x_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c
index d4c5137..beb0c98 100644
--- a/drivers/serial/serial_pl01x.c
+++ b/drivers/serial/serial_pl01x.c
@@ -30,6 +30,8 @@
 #include <common.h>
 #include <watchdog.h>
 #include <asm/io.h>
+#include <serial.h>
+#include <linux/compiler.h>
 #include "serial_pl01x.h"
 
 /*
@@ -54,7 +56,7 @@ static struct pl01x_regs *pl01x_get_regs(int portnum)
 
 #ifdef CONFIG_PL010_SERIAL
 
-int serial_init (void)
+static int pl01x_serial_init(void)
 {
 	struct pl01x_regs *regs = pl01x_get_regs(CONSOLE_PORT);
 	unsigned int divisor;
@@ -104,7 +106,7 @@ int serial_init (void)
 
 #ifdef CONFIG_PL011_SERIAL
 
-int serial_init (void)
+static int pl01x_serial_init(void)
 {
 	struct pl01x_regs *regs = pl01x_get_regs(CONSOLE_PORT);
 	unsigned int temp;
@@ -169,7 +171,7 @@ int serial_init (void)
 
 #endif /* CONFIG_PL011_SERIAL */
 
-void serial_putc (const char c)
+static void pl01x_serial_putc(const char c)
 {
 	if (c == '\n')
 		pl01x_putc (CONSOLE_PORT, '\r');
@@ -177,24 +179,24 @@ void serial_putc (const char c)
 	pl01x_putc (CONSOLE_PORT, c);
 }
 
-void serial_puts (const char *s)
+static void pl01x_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
-int serial_getc (void)
+static int pl01x_serial_getc(void)
 {
 	return pl01x_getc (CONSOLE_PORT);
 }
 
-int serial_tstc (void)
+static int pl01x_serial_tstc(void)
 {
 	return pl01x_tstc (CONSOLE_PORT);
 }
 
-void serial_setbrg (void)
+static void pl01x_serial_setbrg(void)
 {
 	struct pl01x_regs *regs = pl01x_get_regs(CONSOLE_PORT);
 
@@ -250,3 +252,56 @@ static int pl01x_tstc (int portnum)
 	WATCHDOG_RESET();
 	return !(readl(&regs->fr) & UART_PL01x_FR_RXFE);
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device pl01x_serial_drv = {
+	.name	= "pl01x_serial",
+	.start	= pl01x_serial_init,
+	.stop	= NULL,
+	.setbrg	= pl01x_serial_setbrg,
+	.putc	= pl01x_serial_putc,
+	.puts	= pl01x_serial_puts,
+	.getc	= pl01x_serial_getc,
+	.tstc	= pl01x_serial_tstc,
+};
+
+void pl01x_serial_initialize(void)
+{
+	serial_register(&pl01x_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &pl01x_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return pl01x_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	pl01x_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	pl01x_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	pl01x_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return pl01x_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return pl01x_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 59/70] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c44b0 serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (57 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 58/70] serial: arm: Implement CONFIG_SERIAL_MULTI into pl01x " Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 60/70] serial: arm: Implement CONFIG_SERIAL_MULTI into sa1100 " Marek Vasut
                     ` (11 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into s3c44b0 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the s3c44b0 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                 |    2 ++
 drivers/serial/serial_s3c44b0.c |   68 ++++++++++++++++++++++++++++++++++-----
 2 files changed, 62 insertions(+), 8 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 48e6044..1953aaf 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -89,6 +89,7 @@ serial_initfunc(max3100_serial_initialize);
 serial_initfunc(mxc_serial_initialize);
 serial_initfunc(netarm_serial_initialize);
 serial_initfunc(pl01x_serial_initialize);
+serial_initfunc(s3c44b0_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -156,6 +157,7 @@ void serial_initialize(void)
 	mxc_serial_initialize();
 	netarm_serial_initialize();
 	pl01x_serial_initialize();
+	s3c44b0_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_s3c44b0.c b/drivers/serial/serial_s3c44b0.c
index 95d0266..8beba1a 100644
--- a/drivers/serial/serial_s3c44b0.c
+++ b/drivers/serial/serial_s3c44b0.c
@@ -68,7 +68,7 @@ static int serial_flush_output(void)
 }
 
 
-void serial_setbrg (void)
+static void s3c44b0_serial_setbrg(void)
 {
 	u32 divisor = 0;
 
@@ -156,7 +156,7 @@ void serial_setbrg (void)
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  *
  */
-int serial_init (void)
+static int s3c44b0_serial_init(void)
 {
 	serial_setbrg ();
 
@@ -167,7 +167,7 @@ int serial_init (void)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc (const char c)
+static void s3c44b0_serial_putc(const char c)
 {
 	/* wait for room in the transmit FIFO */
 	while(!(UTRSTAT0 & 0x02));
@@ -187,7 +187,7 @@ void serial_putc (const char c)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_tstc (void)
+static int s3c44b0_serial_tstc(void)
 {
 	return (UTRSTAT0 & 0x01);
 }
@@ -197,22 +197,74 @@ int serial_tstc (void)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_getc (void)
+static int s3c44b0_serial_getc(void)
 {
 	int rv;
 
 	for(;;) {
-		rv = serial_tstc();
+		rv = s3c44b0_serial_tstc();
 
 		if(rv > 0)
 			return URXH0;
 	}
 }
 
-void
-serial_puts (const char *s)
+static void s3c44b0_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device s3c44b0_serial_drv = {
+	.name	= "s3c44b0_serial",
+	.start	= s3c44b0_serial_init,
+	.stop	= NULL,
+	.setbrg	= s3c44b0_serial_setbrg,
+	.putc	= s3c44b0_serial_putc,
+	.puts	= s3c44b0_serial_puts,
+	.getc	= s3c44b0_serial_getc,
+	.tstc	= s3c44b0_serial_tstc,
+};
+
+void s3c44b0_serial_initialize(void)
+{
+	serial_register(&s3c44b0_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &s3c44b0_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return s3c44b0_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	s3c44b0_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	s3c44b0_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	s3c44b0_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return s3c44b0_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return s3c44b0_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 60/70] serial: arm: Implement CONFIG_SERIAL_MULTI into sa1100 serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (58 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 59/70] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c44b0 " Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 61/70] serial: sh: Implement CONFIG_SERIAL_MULTI into sh " Marek Vasut
                     ` (10 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into sa1100 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the sa1100 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                |    2 ++
 drivers/serial/serial_sa1100.c |   68 +++++++++++++++++++++++++++++++++++-----
 2 files changed, 63 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 1953aaf..3dae01b 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -90,6 +90,7 @@ serial_initfunc(mxc_serial_initialize);
 serial_initfunc(netarm_serial_initialize);
 serial_initfunc(pl01x_serial_initialize);
 serial_initfunc(s3c44b0_serial_initialize);
+serial_initfunc(sa1100_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -158,6 +159,7 @@ void serial_initialize(void)
 	netarm_serial_initialize();
 	pl01x_serial_initialize();
 	s3c44b0_serial_initialize();
+	sa1100_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_sa1100.c b/drivers/serial/serial_sa1100.c
index 5d18875..86e682d 100644
--- a/drivers/serial/serial_sa1100.c
+++ b/drivers/serial/serial_sa1100.c
@@ -30,10 +30,12 @@
 
 #include <common.h>
 #include <SA-1100.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void serial_setbrg (void)
+static void sa1100_serial_setbrg(void)
 {
 	unsigned int reg = 0;
 
@@ -89,7 +91,7 @@ void serial_setbrg (void)
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  *
  */
-int serial_init (void)
+static int sa1100_serial_init(void)
 {
 	serial_setbrg ();
 
@@ -100,7 +102,7 @@ int serial_init (void)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc (const char c)
+static void sa1100_serial_putc(const char c)
 {
 #ifdef CONFIG_SERIAL1
 	/* wait for room in the tx FIFO on SERIAL1 */
@@ -124,7 +126,7 @@ void serial_putc (const char c)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_tstc (void)
+static int sa1100_serial_tstc(void)
 {
 #ifdef CONFIG_SERIAL1
 	return Ser1UTSR1 & UTSR1_RNE;
@@ -138,7 +140,7 @@ int serial_tstc (void)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_getc (void)
+static int sa1100_serial_getc(void)
 {
 #ifdef CONFIG_SERIAL1
 	while (!(Ser1UTSR1 & UTSR1_RNE));
@@ -151,10 +153,62 @@ int serial_getc (void)
 #endif
 }
 
-void
-serial_puts (const char *s)
+static void sa1100_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device sa1100_serial_drv = {
+	.name	= "sa1100_serial",
+	.start	= sa1100_serial_init,
+	.stop	= NULL,
+	.setbrg	= sa1100_serial_setbrg,
+	.putc	= sa1100_serial_putc,
+	.puts	= sa1100_serial_puts,
+	.getc	= sa1100_serial_getc,
+	.tstc	= sa1100_serial_tstc,
+};
+
+void sa1100_serial_initialize(void)
+{
+	serial_register(&sa1100_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &sa1100_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return sa1100_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	sa1100_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	sa1100_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	sa1100_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return sa1100_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return sa1100_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 61/70] serial: sh: Implement CONFIG_SERIAL_MULTI into sh serial driver
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (59 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 60/70] serial: arm: Implement CONFIG_SERIAL_MULTI into sa1100 " Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 62/70] serial: mxs: spl: Remove empty serial_* functions from SPL code Marek Vasut
                     ` (9 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into sh serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the sh driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Phil Edworthy <PHIL.EDWORTHY@renesas.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
---
 common/serial.c            |    2 ++
 drivers/serial/serial_sh.c |   65 ++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 3dae01b..631af65 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -91,6 +91,7 @@ serial_initfunc(netarm_serial_initialize);
 serial_initfunc(pl01x_serial_initialize);
 serial_initfunc(s3c44b0_serial_initialize);
 serial_initfunc(sa1100_serial_initialize);
+serial_initfunc(sh_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -160,6 +161,7 @@ void serial_initialize(void)
 	pl01x_serial_initialize();
 	s3c44b0_serial_initialize();
 	sa1100_serial_initialize();
+	sh_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_sh.c b/drivers/serial/serial_sh.c
index 13919c6..8c30397 100644
--- a/drivers/serial/serial_sh.c
+++ b/drivers/serial/serial_sh.c
@@ -55,13 +55,13 @@ static struct uart_port sh_sci = {
 	.type		= SCIF_BASE_PORT,
 };
 
-void serial_setbrg(void)
+static void sh_serial_setbrg(void)
 {
 	DECLARE_GLOBAL_DATA_PTR;
 	sci_out(&sh_sci, SCBRR, SCBRR_VALUE(gd->baudrate, CONFIG_SYS_CLK_FREQ));
 }
 
-int serial_init(void)
+static int sh_serial_init(void)
 {
 	sci_out(&sh_sci, SCSCR , SCSCR_INIT(&sh_sci));
 	sci_out(&sh_sci, SCSCR , SCSCR_INIT(&sh_sci));
@@ -127,21 +127,21 @@ void serial_raw_putc(const char c)
 	sci_out(&sh_sci, SCxSR, sci_in(&sh_sci, SCxSR) & ~SCxSR_TEND(&sh_sci));
 }
 
-void serial_putc(const char c)
+static void sh_serial_putc(const char c)
 {
 	if (c == '\n')
 		serial_raw_putc('\r');
 	serial_raw_putc(c);
 }
 
-void serial_puts(const char *s)
+static void sh_serial_puts(const char *s)
 {
 	char c;
 	while ((c = *s++) != 0)
 		serial_putc(c);
 }
 
-int serial_tstc(void)
+static int sh_serial_tstc(void)
 {
 	return serial_rx_fifo_level() ? 1 : 0;
 }
@@ -167,7 +167,7 @@ int serial_getc_check(void)
 	return status & (SCIF_DR | SCxSR_RDxF(&sh_sci));
 }
 
-int serial_getc(void)
+static int sh_serial_getc(void)
 {
 	unsigned short status;
 	char ch;
@@ -187,3 +187,56 @@ int serial_getc(void)
 		handle_error();
 	return ch;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device sh_serial_drv = {
+	.name	= "sh_serial",
+	.start	= sh_serial_init,
+	.stop	= NULL,
+	.setbrg	= sh_serial_setbrg,
+	.putc	= sh_serial_putc,
+	.puts	= sh_serial_puts,
+	.getc	= sh_serial_getc,
+	.tstc	= sh_serial_tstc,
+};
+
+void sh_serial_initialize(void)
+{
+	serial_register(&sh_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &sh_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return sh_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	sh_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	sh_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	sh_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return sh_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return sh_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 62/70] serial: mxs: spl: Remove empty serial_* functions from SPL code
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (60 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 61/70] serial: sh: Implement CONFIG_SERIAL_MULTI into sh " Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 63/70] serial: ns16550: Call usbtty_poll only in non-SPL build Marek Vasut
                     ` (8 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Remove the empty bodies from serial_* functions from MXS SPL code.
These empty implementations are now in common/serial.c instead so
declaring them also in the SPL code would cause a colision once
serial multi is enabled unconditionally.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Stefano Babic <sbabic@denx.de>
---
 arch/arm/cpu/arm926ejs/mxs/spl_boot.c |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_boot.c b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
index ad66c57..8ea7c36 100644
--- a/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
+++ b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
@@ -124,10 +124,6 @@ inline void board_init_r(gd_t *id, ulong dest_addr)
 		;
 }
 
-#ifndef CONFIG_SPL_SERIAL_SUPPORT
-void serial_putc(const char c) {}
-void serial_puts(const char *s) {}
-#endif
 void hang(void) __attribute__ ((noreturn));
 void hang(void)
 {
-- 
1.7.10.4

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

* [U-Boot] [PATCH 63/70] serial: ns16550: Call usbtty_poll only in non-SPL build
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (61 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 62/70] serial: mxs: spl: Remove empty serial_* functions from SPL code Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 64/70] serial: Use puts() and hang() instead of panic() in SPL Marek Vasut
                     ` (7 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Having both USBTTY and CONFIG_SERIAL_MULTI enabled in SPL, the
usbtty.c file is protected in Makefile to not be compiled into
the SPL. Yet, the ns16550 serial driver does not contain such
protection. Add it to avoid missing symbol error.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 drivers/serial/ns16550.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index facadd2..9027781 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -101,7 +101,7 @@ void NS16550_putc(NS16550_t com_port, char c)
 char NS16550_getc(NS16550_t com_port)
 {
 	while ((serial_in(&com_port->lsr) & UART_LSR_DR) == 0) {
-#ifdef CONFIG_USB_TTY
+#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_USB_TTY)
 		extern void usbtty_poll(void);
 		usbtty_poll();
 #endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 64/70] serial: Use puts() and hang() instead of panic() in SPL
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (62 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 63/70] serial: ns16550: Call usbtty_poll only in non-SPL build Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 65/70] serial: Unconditionally enable CONFIG_SERIAL_MULTI Marek Vasut
                     ` (6 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

If case the get_current() call fails before relocation, the U-Boot
must try to print an error message, fail and either reset or halt.
Such error is critical enough to halt the system, as it means the
system is in very bad state.

This is now also used in SPL, since CONFIG_SERIAL_MULTI is enabled
unconditionally. To avoid compiling whole vsprintf.c into SPL, use
puts() to print error message and hang() to stop the system in case
of SPL build.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 631af65..91c7269 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -220,8 +220,14 @@ static struct serial_device *get_current(void)
 		dev = default_serial_console();
 
 		/* We must have a console device */
-		if (!dev)
-			panic("Cannot find console");
+		if (!dev) {
+#ifdef CONFIG_SPL_BUILD
+			puts("Cannot find console\n");
+			hang();
+#else
+			panic("Cannot find console\n");
+#endif
+		}
 	} else
 		dev = serial_current;
 	return dev;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 65/70] serial: Unconditionally enable CONFIG_SERIAL_MULTI
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (63 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 64/70] serial: Use puts() and hang() instead of panic() in SPL Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 66/70] serial: Remove CONFIG_SERIAL_MULTI from config files Marek Vasut
                     ` (5 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Enable CONFIG_SERIAL_MULTI for all builds of U-Boot. That includes
both SPL builds and non-SPL builds, everything. To avoid poluting
this patch with removal of ifdef-endif constructions containing
CONFIG_SERIAL_MULTI, the CONFIG_SERIAL_MULTI is temporarily added
into CPPFLAGS in config.mk . This will be again removed in following
patch.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/Makefile |    2 +-
 config.mk       |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/Makefile b/common/Makefile
index b56df1d..290ed02 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -32,7 +32,6 @@ COBJS-y += command.o
 COBJS-y += exports.o
 COBJS-$(CONFIG_SYS_HUSH_PARSER) += hush.o
 COBJS-y += s_record.o
-COBJS-$(CONFIG_SERIAL_MULTI) += serial.o
 COBJS-y += xyzModem.o
 COBJS-y += cmd_disk.o
 
@@ -203,6 +202,7 @@ COBJS-y += dlmalloc.o
 COBJS-y += image.o
 COBJS-y += memsize.o
 COBJS-y += stdio.o
+COBJS-$(CONFIG_SERIAL_MULTI) += serial.o
 
 
 COBJS	:= $(sort $(COBJS-y))
diff --git a/config.mk b/config.mk
index c3822a2..88c72f1 100644
--- a/config.mk
+++ b/config.mk
@@ -193,7 +193,7 @@ OBJCFLAGS += --gap-fill=0xff
 gccincdir := $(shell $(CC) -print-file-name=include)
 
 CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS)		\
-	-D__KERNEL__
+	-D__KERNEL__ -DCONFIG_SERIAL_MULTI
 
 # Enable garbage collection of un-used sections for SPL
 ifeq ($(CONFIG_SPL_BUILD),y)
-- 
1.7.10.4

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

* [U-Boot] [PATCH 66/70] serial: Remove CONFIG_SERIAL_MULTI from config files
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (64 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 65/70] serial: Unconditionally enable CONFIG_SERIAL_MULTI Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 67/70] serial: Remove CONFIG_SERIAL_MULTI from serial drivers Marek Vasut
                     ` (4 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Remove any notion of CONFIG_SERIAL_MULTI from board config files.
Since CONFIG_SERIAL_MULTI is now enabled by default, it is useless
to specify this config option in the board config files. Therefore
remove it.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 include/configs/DU440.h             |    1 -
 include/configs/KAREF.h             |    1 -
 include/configs/METROBOX.h          |    1 -
 include/configs/MPC8569MDS.h        |    1 -
 include/configs/P1010RDB.h          |    1 -
 include/configs/P1_P2_RDB.h         |    1 -
 include/configs/P2020COME.h         |    1 -
 include/configs/PMC440.h            |    1 -
 include/configs/TB5200.h            |    1 -
 include/configs/amcc-common.h       |    1 -
 include/configs/bfin_adi_common.h   |    1 -
 include/configs/coreboot.h          |    1 -
 include/configs/eNET.h              |    1 -
 include/configs/jadecpu.h           |    1 -
 include/configs/korat.h             |    1 -
 include/configs/lwmon.h             |    1 -
 include/configs/lwmon5.h            |    1 -
 include/configs/mcc200.h            |    5 -----
 include/configs/omap3_zoom2.h       |    1 -
 include/configs/origen.h            |    1 -
 include/configs/pcs440ep.h          |    1 -
 include/configs/pdm360ng.h          |    3 ---
 include/configs/quad100hd.h         |    1 -
 include/configs/s5p_goni.h          |    1 -
 include/configs/s5pc210_universal.h |    1 -
 include/configs/sc3.h               |    1 -
 include/configs/smdk5250.h          |    1 -
 include/configs/smdkc100.h          |    1 -
 include/configs/smdkv310.h          |    1 -
 include/configs/tegra-common-post.h |    5 -----
 include/configs/trats.h             |    1 -
 include/configs/trizepsiv.h         |    1 -
 include/configs/zeus.h              |    1 -
 33 files changed, 43 deletions(-)

diff --git a/include/configs/DU440.h b/include/configs/DU440.h
index 8bd7940..bbe2713 100644
--- a/include/configs/DU440.h
+++ b/include/configs/DU440.h
@@ -93,7 +93,6 @@
 #define CONFIG_SYS_NS16550_CLK		get_serial_clock()
 #undef CONFIG_SYS_EXT_SERIAL_CLOCK
 #define CONFIG_BAUDRATE		115200
-#define CONFIG_SERIAL_MULTI     1
 
 #define CONFIG_SYS_BAUDRATE_TABLE						\
 	{300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
diff --git a/include/configs/KAREF.h b/include/configs/KAREF.h
index 3daf480..546e28b 100644
--- a/include/configs/KAREF.h
+++ b/include/configs/KAREF.h
@@ -96,7 +96,6 @@
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE	1
 #define CONFIG_SYS_NS16550_CLK		get_serial_clock()
-#define CONFIG_SERIAL_MULTI   1
 #define CONFIG_BAUDRATE	      9600
 
 #define CONFIG_SYS_BAUDRATE_TABLE  \
diff --git a/include/configs/METROBOX.h b/include/configs/METROBOX.h
index 34376bc..286f869 100644
--- a/include/configs/METROBOX.h
+++ b/include/configs/METROBOX.h
@@ -158,7 +158,6 @@
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE	1
 #define CONFIG_SYS_NS16550_CLK		get_serial_clock()
-#define CONFIG_SERIAL_MULTI   1
 #define CONFIG_BAUDRATE	      9600
 
 #define CONFIG_SYS_BAUDRATE_TABLE  \
diff --git a/include/configs/MPC8569MDS.h b/include/configs/MPC8569MDS.h
index d973364..acd3276 100644
--- a/include/configs/MPC8569MDS.h
+++ b/include/configs/MPC8569MDS.h
@@ -274,7 +274,6 @@ extern unsigned long get_clock_freq(void);
 
 /* Serial Port */
 #define CONFIG_CONS_INDEX		1
-#define CONFIG_SERIAL_MULTI		1
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE    1
diff --git a/include/configs/P1010RDB.h b/include/configs/P1010RDB.h
index 67dba9f..540f32d 100644
--- a/include/configs/P1010RDB.h
+++ b/include/configs/P1010RDB.h
@@ -453,7 +453,6 @@ extern unsigned long get_sdram_size(void);
 #define CONFIG_NS16550_MIN_FUNCTIONS
 #endif
 
-#define CONFIG_SERIAL_MULTI		/* Enable both serial ports */
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV	/* determine from environment */
 
 #define CONFIG_SYS_BAUDRATE_TABLE	\
diff --git a/include/configs/P1_P2_RDB.h b/include/configs/P1_P2_RDB.h
index ab88166..9db0e87 100644
--- a/include/configs/P1_P2_RDB.h
+++ b/include/configs/P1_P2_RDB.h
@@ -343,7 +343,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 #define CONFIG_NS16550_MIN_FUNCTIONS
 #endif
 
-#define CONFIG_SERIAL_MULTI	1 /* Enable both serial ports */
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV	/* determine from environment */
 
 #define CONFIG_SYS_BAUDRATE_TABLE	\
diff --git a/include/configs/P2020COME.h b/include/configs/P2020COME.h
index d323fb5..c75f86c 100644
--- a/include/configs/P2020COME.h
+++ b/include/configs/P2020COME.h
@@ -201,7 +201,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 #define CONFIG_SYS_NS16550_REG_SIZE	1
 #define CONFIG_SYS_NS16550_CLK		get_bus_freq(0)
 
-#define CONFIG_SERIAL_MULTI	1 /* Enable both serial ports */
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV	/* determine from environment */
 
 #define CONFIG_SYS_BAUDRATE_TABLE   \
diff --git a/include/configs/PMC440.h b/include/configs/PMC440.h
index b820954..3837b8f 100644
--- a/include/configs/PMC440.h
+++ b/include/configs/PMC440.h
@@ -102,7 +102,6 @@
 #define CONFIG_SYS_NS16550_CLK		get_serial_clock()
 #undef CONFIG_SYS_EXT_SERIAL_CLOCK
 #define CONFIG_BAUDRATE		115200
-#define CONFIG_SERIAL_MULTI     1
 
 #define CONFIG_SYS_BAUDRATE_TABLE						\
 	{300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
diff --git a/include/configs/TB5200.h b/include/configs/TB5200.h
index feaadf3..a624c83 100644
--- a/include/configs/TB5200.h
+++ b/include/configs/TB5200.h
@@ -56,7 +56,6 @@
  * Serial console configuration
  */
 #define CONFIG_PSC_CONSOLE	1	/* default console is on PSC1 */
-#define CONFIG_SERIAL_MULTI	1	/* support multiple consoles */
 #define CONFIG_PSC_CONSOLE2	6	/* second console is on PSC6 */
 #define CONFIG_BAUDRATE		115200	/* ... at 115200 bps */
 #define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200, 230400 }
diff --git a/include/configs/amcc-common.h b/include/configs/amcc-common.h
index 056a22a..c9db47a 100644
--- a/include/configs/amcc-common.h
+++ b/include/configs/amcc-common.h
@@ -31,7 +31,6 @@
 /*
  * UART
  */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE	1
diff --git a/include/configs/bfin_adi_common.h b/include/configs/bfin_adi_common.h
index 7132f8f..b635c7d 100644
--- a/include/configs/bfin_adi_common.h
+++ b/include/configs/bfin_adi_common.h
@@ -108,7 +108,6 @@
 #define CONFIG_LOADS_ECHO	1
 #define CONFIG_JTAG_CONSOLE
 #define CONFIG_SILENT_CONSOLE
-#define CONFIG_SERIAL_MULTI
 #ifndef CONFIG_BAUDRATE
 # define CONFIG_BAUDRATE	57600
 #endif
diff --git a/include/configs/coreboot.h b/include/configs/coreboot.h
index 2c65d74..0e89242 100644
--- a/include/configs/coreboot.h
+++ b/include/configs/coreboot.h
@@ -54,7 +54,6 @@
 /*-----------------------------------------------------------------------
  * Serial Configuration
  */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_CONS_INDEX		1
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_SERIAL
diff --git a/include/configs/eNET.h b/include/configs/eNET.h
index d5c9cad..4b1c219 100644
--- a/include/configs/eNET.h
+++ b/include/configs/eNET.h
@@ -55,7 +55,6 @@
 /*-----------------------------------------------------------------------
  * Serial Configuration
  */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_CONS_INDEX			1
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_SERIAL
diff --git a/include/configs/jadecpu.h b/include/configs/jadecpu.h
index 7b9d36d..daf37bf 100644
--- a/include/configs/jadecpu.h
+++ b/include/configs/jadecpu.h
@@ -68,7 +68,6 @@
 /*
  * Serial
  */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE		(-4)
diff --git a/include/configs/korat.h b/include/configs/korat.h
index 46335b4..b919aec 100644
--- a/include/configs/korat.h
+++ b/include/configs/korat.h
@@ -102,7 +102,6 @@
 #define CONFIG_SYS_NS16550_CLK		get_serial_clock()
 #define CONFIG_SYS_EXT_SERIAL_CLOCK	11059200	/* ext. 11.059MHz clk	*/
 #define CONFIG_BAUDRATE		115200
-#define CONFIG_SERIAL_MULTI	1
 
 #define CONFIG_SYS_BAUDRATE_TABLE						\
 	{300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
diff --git a/include/configs/lwmon.h b/include/configs/lwmon.h
index 1d89176..ab86053 100644
--- a/include/configs/lwmon.h
+++ b/include/configs/lwmon.h
@@ -60,7 +60,6 @@
 #define CONFIG_LCD_INFO		1	/* ... and some board info	*/
 #define	CONFIG_SPLASH_SCREEN		/* ... with splashscreen support*/
 
-#define CONFIG_SERIAL_MULTI	1
 #define CONFIG_8xx_CONS_SMC2	1	/* Console is on SMC2		*/
 #define CONFIG_8xx_CONS_SCC2	1	/* Console is on SCC2		*/
 
diff --git a/include/configs/lwmon5.h b/include/configs/lwmon5.h
index 497eec4..2d33ebc 100644
--- a/include/configs/lwmon5.h
+++ b/include/configs/lwmon5.h
@@ -121,7 +121,6 @@
 #define CONFIG_SYS_NS16550_CLK		get_serial_clock()
 #undef CONFIG_SYS_EXT_SERIAL_CLOCK		/* no external clock provided	*/
 #define CONFIG_BAUDRATE		115200
-#define CONFIG_SERIAL_MULTI
 
 #define CONFIG_SYS_BAUDRATE_TABLE						\
 	{300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
diff --git a/include/configs/mcc200.h b/include/configs/mcc200.h
index 1867eb6..053e5bc 100644
--- a/include/configs/mcc200.h
+++ b/include/configs/mcc200.h
@@ -76,17 +76,12 @@
  */
 #if !defined(CONFIG_PRS200)
 /* MCC200 configuration: */
-#define CONFIG_SERIAL_MULTI	1
 #define CONFIG_PSC_CONSOLE	1	/* PSC1 may be COM */
 #define CONFIG_PSC_CONSOLE2	2	/* PSC2 is PSoC */
 #else
 /* PRS200 configuration: */
 #define CONFIG_PSC_CONSOLE	1	/* console is on PSC1		*/
 #endif
-#if defined(CONFIG_QUART_CONSOLE) && defined(CONFIG_PSC_CONSOLE) && \
-	!defined(CONFIG_SERIAL_MULTI)
-#error "Select only one console device!"
-#endif
 #define CONFIG_BAUDRATE		115200
 #define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200, 230400 }
 
diff --git a/include/configs/omap3_zoom2.h b/include/configs/omap3_zoom2.h
index a7cc5fc..d681424 100644
--- a/include/configs/omap3_zoom2.h
+++ b/include/configs/omap3_zoom2.h
@@ -76,7 +76,6 @@
  * NS16550 Configuration
  * Zoom2 uses the TL16CP754C on the debug board
  */
-#define CONFIG_SERIAL_MULTI		1
 /*
  * 0 - 1 : first  USB with respect to the left edge of the debug board
  * 2 - 3 : second USB with respect to the left edge of the debug board
diff --git a/include/configs/origen.h b/include/configs/origen.h
index 1ab9834..ff2b24d 100644
--- a/include/configs/origen.h
+++ b/include/configs/origen.h
@@ -63,7 +63,6 @@
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20))
 
 /* select serial console configuration */
-#define CONFIG_SERIAL_MULTI		1
 #define CONFIG_SERIAL2			1	/* use SERIAL 2 */
 #define CONFIG_BAUDRATE			115200
 #define EXYNOS4_DEFAULT_UART_OFFSET	0x020000
diff --git a/include/configs/pcs440ep.h b/include/configs/pcs440ep.h
index 26627bb..351ff5a 100644
--- a/include/configs/pcs440ep.h
+++ b/include/configs/pcs440ep.h
@@ -88,7 +88,6 @@
 #define CONFIG_SYS_NS16550_CLK		get_serial_clock()
 #undef CONFIG_SYS_EXT_SERIAL_CLOCK		/* no external clk used		*/
 #define CONFIG_BAUDRATE		115200
-#define CONFIG_SERIAL_MULTI     1
 
 #define CONFIG_SYS_BAUDRATE_TABLE  \
     {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
diff --git a/include/configs/pdm360ng.h b/include/configs/pdm360ng.h
index 8afc3c0..671e9eb 100644
--- a/include/configs/pdm360ng.h
+++ b/include/configs/pdm360ng.h
@@ -298,7 +298,6 @@
 /*
  * Used PSC UART devices
  */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_SYS_PSC1
 #define CONFIG_SYS_PSC4
 #define CONFIG_SYS_PSC6
@@ -434,10 +433,8 @@
 #define CONFIG_KGDB_SER_INDEX	2	/* which serial port to use */
 #endif
 
-#ifdef CONFIG_SERIAL_MULTI
 /* POST support */
 #define CONFIG_POST             (CONFIG_SYS_POST_COPROC)
-#endif
 
 /*
  * Environment Configuration
diff --git a/include/configs/quad100hd.h b/include/configs/quad100hd.h
index 5d0c385..5f1bb58 100644
--- a/include/configs/quad100hd.h
+++ b/include/configs/quad100hd.h
@@ -113,7 +113,6 @@
 #undef	CONFIG_SYS_EXT_SERIAL_CLOCK			/* external serial clock */
 #define CONFIG_SYS_BASE_BAUD		691200
 #define CONFIG_BAUDRATE		115200
-#define CONFIG_SERIAL_MULTI
 
 /* The following table includes the supported baudrates */
 #define CONFIG_SYS_BAUDRATE_TABLE	\
diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 36f1a57..7e0b302 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -59,7 +59,6 @@
  * select serial console configuration
  */
 #define CONFIG_SERIAL2			1	/* use SERIAL2 */
-#define CONFIG_SERIAL_MULTI		1
 #define CONFIG_BAUDRATE			115200
 
 /* MMC */
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 7727624..5fc6136 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -61,7 +61,6 @@
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20))
 
 /* select serial console configuration */
-#define CONFIG_SERIAL_MULTI	1
 #define CONFIG_SERIAL2		1	/* use SERIAL 2 */
 #define CONFIG_BAUDRATE		115200
 
diff --git a/include/configs/sc3.h b/include/configs/sc3.h
index 2d6e51d..fb74608 100644
--- a/include/configs/sc3.h
+++ b/include/configs/sc3.h
@@ -83,7 +83,6 @@
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE	1
 #define CONFIG_SYS_NS16550_CLK		get_serial_clock()
-#define CONFIG_SERIAL_MULTI
 
 /*
  * define CONFIG_SYS_CLK_FREQ to your base crystal clock in Hz
diff --git a/include/configs/smdk5250.h b/include/configs/smdk5250.h
index 47369aa..c0f8622 100644
--- a/include/configs/smdk5250.h
+++ b/include/configs/smdk5250.h
@@ -68,7 +68,6 @@
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20))
 
 /* select serial console configuration */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_SERIAL3			/* use SERIAL 3 */
 #define CONFIG_BAUDRATE			115200
 #define EXYNOS5_DEFAULT_UART_OFFSET	0x010000
diff --git a/include/configs/smdkc100.h b/include/configs/smdkc100.h
index 22de344..fb640db 100644
--- a/include/configs/smdkc100.h
+++ b/include/configs/smdkc100.h
@@ -64,7 +64,6 @@
  * select serial console configuration
  */
 #define CONFIG_SERIAL0			1	/* use SERIAL 0 on SMDKC100 */
-#define CONFIG_SERIAL_MULTI		1
 
 /* PWM */
 #define CONFIG_PWM			1
diff --git a/include/configs/smdkv310.h b/include/configs/smdkv310.h
index 602337f..b796b46 100644
--- a/include/configs/smdkv310.h
+++ b/include/configs/smdkv310.h
@@ -62,7 +62,6 @@
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20))
 
 /* select serial console configuration */
-#define CONFIG_SERIAL_MULTI		1
 #define CONFIG_SERIAL1			1	/* use SERIAL 1 */
 #define CONFIG_BAUDRATE			115200
 #define EXYNOS4_DEFAULT_UART_OFFSET	0x010000
diff --git a/include/configs/tegra-common-post.h b/include/configs/tegra-common-post.h
index 168b64b..a01b2a7 100644
--- a/include/configs/tegra-common-post.h
+++ b/include/configs/tegra-common-post.h
@@ -154,11 +154,6 @@
 #undef CONFIG_OF_CONTROL
 #endif
 
-/* remove SERIAL_MULTI */
-#ifdef CONFIG_SERIAL_MULTI
-#undef CONFIG_SERIAL_MULTI
-#endif
-
 /* remove I2C support */
 #ifdef CONFIG_TEGRA_I2C
 #undef CONFIG_TEGRA_I2C
diff --git a/include/configs/trats.h b/include/configs/trats.h
index b3b5a3d..d7808aa 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -69,7 +69,6 @@
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20))
 
 /* select serial console configuration */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_SERIAL2			/* use SERIAL 2 */
 #define CONFIG_BAUDRATE			115200
 
diff --git a/include/configs/trizepsiv.h b/include/configs/trizepsiv.h
index 47c6a23..bc69c1e 100644
--- a/include/configs/trizepsiv.h
+++ b/include/configs/trizepsiv.h
@@ -64,7 +64,6 @@
  * select serial console configuration
  */
 #define CONFIG_PXA_SERIAL
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_FFUART	       1       /* we use FFUART on Conxs */
 #define CONFIG_BTUART	       1       /* we use BTUART on Conxs */
 #define CONFIG_STUART	       1       /* we use STUART on Conxs */
diff --git a/include/configs/zeus.h b/include/configs/zeus.h
index 2556e3b..b0c3bd5 100644
--- a/include/configs/zeus.h
+++ b/include/configs/zeus.h
@@ -130,7 +130,6 @@
 #undef	CONFIG_SYS_EXT_SERIAL_CLOCK			/* external serial clock */
 #define CONFIG_SYS_BASE_BAUD	691200
 #define CONFIG_BAUDRATE		115200
-#define CONFIG_SERIAL_MULTI
 
 #define CONFIG_SYS_BAUDRATE_TABLE  \
     {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
-- 
1.7.10.4

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

* [U-Boot] [PATCH 67/70] serial: Remove CONFIG_SERIAL_MULTI from serial drivers
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (65 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 66/70] serial: Remove CONFIG_SERIAL_MULTI from config files Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 68/70] serial: Remove CONFIG_SERIAL_MULTI from remaining sources Marek Vasut
                     ` (3 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Remove the support for not-CONFIG_SERIAL_MULTI part from serial
port drivers and some board files. Since CONFIG_SERIAL_MULTI is
now enabled by default, that part is a dead code. Remove it.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/mips/cpu/mips32/au1x00/au1x00_serial.c |   32 ------
 arch/mips/cpu/mips32/incaip/asc_serial.c    |   32 ------
 arch/mips/cpu/xburst/jz_serial.c            |   32 ------
 arch/powerpc/cpu/mpc512x/serial.c           |   64 +-----------
 arch/powerpc/cpu/mpc5xx/serial.c            |   32 ------
 arch/powerpc/cpu/mpc5xxx/serial.c           |  149 +++++++--------------------
 arch/powerpc/cpu/mpc8220/uart.c             |   32 ------
 arch/powerpc/cpu/mpc8260/serial_scc.c       |   32 ------
 arch/powerpc/cpu/mpc8260/serial_smc.c       |   32 ------
 arch/powerpc/cpu/mpc85xx/serial_scc.c       |   32 ------
 arch/powerpc/cpu/ppc4xx/iop480_uart.c       |   35 -------
 arch/sparc/cpu/leon2/serial.c               |   32 ------
 arch/sparc/cpu/leon3/serial.c               |   32 ------
 board/Marvell/common/serial.c               |   32 ------
 board/amirix/ap1000/serial.c                |   31 ------
 board/bmw/serial.c                          |   32 ------
 board/cogent/serial.c                       |   32 ------
 board/esd/cpci750/serial.c                  |   31 ------
 board/evb64260/serial.c                     |   31 ------
 board/ml2/serial.c                          |   31 ------
 board/pcippc2/sconsole.c                    |   31 ------
 board/pdm360ng/pdm360ng.c                   |    6 --
 board/prodrive/p3mx/serial.c                |   32 ------
 board/trizepsiv/conxs.c                     |    2 -
 drivers/serial/altera_jtag_uart.c           |   32 ------
 drivers/serial/altera_uart.c                |   32 ------
 drivers/serial/atmel_usart.c                |   32 ------
 drivers/serial/lpc32xx_hsuart.c             |   32 ------
 drivers/serial/mcfuart.c                    |   32 ------
 drivers/serial/ns9750_serial.c              |   32 ------
 drivers/serial/opencores_yanu.c             |   32 ------
 drivers/serial/s3c4510b_uart.c              |   32 ------
 drivers/serial/s3c64xx.c                    |   32 ------
 drivers/serial/sandbox.c                    |   32 ------
 drivers/serial/serial.c                     |   95 -----------------
 drivers/serial/serial_clps7111.c            |   32 ------
 drivers/serial/serial_imx.c                 |   32 ------
 drivers/serial/serial_ixp.c                 |   32 ------
 drivers/serial/serial_ks8695.c              |   32 ------
 drivers/serial/serial_lh7a40x.c             |   32 ------
 drivers/serial/serial_lpc2292.c             |   32 ------
 drivers/serial/serial_max3100.c             |   32 ------
 drivers/serial/serial_mxc.c                 |   36 -------
 drivers/serial/serial_netarm.c              |   32 ------
 drivers/serial/serial_pl01x.c               |   32 ------
 drivers/serial/serial_pxa.c                 |   18 ----
 drivers/serial/serial_s3c24x0.c             |   53 ----------
 drivers/serial/serial_s3c44b0.c             |   32 ------
 drivers/serial/serial_sa1100.c              |   32 ------
 drivers/serial/serial_sh.c                  |   32 ------
 drivers/serial/serial_xuartlite.c           |   34 ------
 51 files changed, 39 insertions(+), 1760 deletions(-)

diff --git a/arch/mips/cpu/mips32/au1x00/au1x00_serial.c b/arch/mips/cpu/mips32/au1x00/au1x00_serial.c
index 9682775..0beac98 100644
--- a/arch/mips/cpu/mips32/au1x00/au1x00_serial.c
+++ b/arch/mips/cpu/mips32/au1x00/au1x00_serial.c
@@ -131,7 +131,6 @@ static int au1x00_serial_tstc(void)
 	return 0;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device au1x00_serial_drv = {
 	.name	= "au1x00_serial",
 	.start	= au1x00_serial_init,
@@ -152,34 +151,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &au1x00_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return au1x00_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	au1x00_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	au1x00_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	au1x00_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return au1x00_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return au1x00_serial_tstc();
-}
-#endif
diff --git a/arch/mips/cpu/mips32/incaip/asc_serial.c b/arch/mips/cpu/mips32/incaip/asc_serial.c
index b5f32e2..08949f4 100644
--- a/arch/mips/cpu/mips32/incaip/asc_serial.c
+++ b/arch/mips/cpu/mips32/incaip/asc_serial.c
@@ -286,7 +286,6 @@ static int asc_serial_tstc(void)
     return res;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device asc_serial_drv = {
 	.name	= "asc_serial",
 	.start	= asc_serial_init,
@@ -307,34 +306,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &asc_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return asc_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	asc_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	asc_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	asc_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return asc_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return asc_serial_tstc();
-}
-#endif
diff --git a/arch/mips/cpu/xburst/jz_serial.c b/arch/mips/cpu/xburst/jz_serial.c
index b1e1d27..3199007 100644
--- a/arch/mips/cpu/xburst/jz_serial.c
+++ b/arch/mips/cpu/xburst/jz_serial.c
@@ -115,7 +115,6 @@ static void jz_serial_puts(const char *s)
 		serial_putc(*s++);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device jz_serial_drv = {
 	.name	= "jz_serial",
 	.start	= jz_serial_init,
@@ -136,34 +135,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &jz_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return jz_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	jz_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	jz_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	jz_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return jz_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return jz_serial_tstc();
-}
-#endif
diff --git a/arch/powerpc/cpu/mpc512x/serial.c b/arch/powerpc/cpu/mpc512x/serial.c
index bc10c50..58587fd 100644
--- a/arch/powerpc/cpu/mpc512x/serial.c
+++ b/arch/powerpc/cpu/mpc512x/serial.c
@@ -37,7 +37,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if defined(CONFIG_PSC_CONSOLE) || defined(CONFIG_SERIAL_MULTI)
+#if defined(CONFIG_PSC_CONSOLE)
 
 static void fifo_init (volatile psc512x_t *psc)
 {
@@ -52,7 +52,6 @@ static void fifo_init (volatile psc512x_t *psc)
 	out_be32(&psc->rfintmask, 0);
 	out_be32(&psc->tfintmask, 0);
 
-#if defined(CONFIG_SERIAL_MULTI)
 	switch (((u32)psc & 0xf00) >> 8) {
 	case 0:
 		tfsize = FIFOC_PSC0_TX_SIZE | (FIFOC_PSC0_TX_ADDR << 16);
@@ -105,10 +104,7 @@ static void fifo_init (volatile psc512x_t *psc)
 	default:
 		return;
 	}
-#else
-	tfsize = CONSOLE_FIFO_TX_SIZE | (CONSOLE_FIFO_TX_ADDR << 16);
-	rfsize = CONSOLE_FIFO_RX_SIZE | (CONSOLE_FIFO_RX_ADDR << 16);
-#endif
+
 	out_be32(&psc->tfsize, tfsize);
 	out_be32(&psc->rfsize, rfsize);
 
@@ -155,12 +151,10 @@ int serial_init_dev(unsigned int idx)
 {
 	volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
 	volatile psc512x_t *psc = (psc512x_t *) &im->psc[idx];
-#if defined(CONFIG_SERIAL_MULTI)
 	u32 reg;
 
 	reg = in_be32(&im->clk.sccr[0]);
 	out_be32(&im->clk.sccr[0], reg | CLOCK_SCCR1_PSC_EN(idx));
-#endif
 
 	fifo_init (psc);
 
@@ -285,9 +279,7 @@ int serial_getcts_dev(unsigned int idx)
 
 	return (in_8(&psc->ip) & 0x1) ? 0 : 1;
 }
-#endif /* CONFIG_PSC_CONSOLE || CONFIG_SERIAL_MULTI */
-
-#if defined(CONFIG_SERIAL_MULTI)
+#endif /* CONFIG_PSC_CONSOLE */
 
 #define DECLARE_PSC_SERIAL_FUNCTIONS(port) \
 	int serial##port##_init(void) \
@@ -381,55 +373,6 @@ void mpc512x_serial_initialize(void)
 #endif
 }
 
-#else
-
-void serial_setbrg(void)
-{
-	serial_setbrg_dev(CONFIG_PSC_CONSOLE);
-}
-
-int serial_init(void)
-{
-	return serial_init_dev(CONFIG_PSC_CONSOLE);
-}
-
-void serial_putc(const char c)
-{
-	serial_putc_dev(CONFIG_PSC_CONSOLE, c);
-}
-
-void serial_putc_raw(const char c)
-{
-	serial_putc_raw_dev(CONFIG_PSC_CONSOLE, c);
-}
-
-void serial_puts(const char *s)
-{
-	serial_puts_dev(CONFIG_PSC_CONSOLE, s);
-}
-
-int serial_getc(void)
-{
-	return serial_getc_dev(CONFIG_PSC_CONSOLE);
-}
-
-int serial_tstc(void)
-{
-	return serial_tstc_dev(CONFIG_PSC_CONSOLE);
-}
-
-void serial_setrts(int s)
-{
-	return serial_setrts_dev(CONFIG_PSC_CONSOLE, s);
-}
-
-int serial_getcts(void)
-{
-	return serial_getcts_dev(CONFIG_PSC_CONSOLE);
-}
-#endif /* CONFIG_PSC_CONSOLE */
-
-#if defined(CONFIG_SERIAL_MULTI)
 #include <stdio_dev.h>
 /*
  * Routines for communication with serial devices over PSC
@@ -514,4 +457,3 @@ int read_port(struct stdio_dev *port, char *buf, int size)
 
 	return cnt;
 }
-#endif /* CONFIG_SERIAL_MULTI */
diff --git a/arch/powerpc/cpu/mpc5xx/serial.c b/arch/powerpc/cpu/mpc5xx/serial.c
index dbaacfc..af802f9 100644
--- a/arch/powerpc/cpu/mpc5xx/serial.c
+++ b/arch/powerpc/cpu/mpc5xx/serial.c
@@ -169,7 +169,6 @@ static void mpc5xx_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device mpc5xx_serial_drv = {
 	.name	= "mpc5xx_serial",
 	.start	= mpc5xx_serial_init,
@@ -190,34 +189,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &mpc5xx_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return mpc5xx_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	mpc5xx_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	mpc5xx_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	mpc5xx_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return mpc5xx_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return mpc5xx_serial_tstc();
-}
-#endif
diff --git a/arch/powerpc/cpu/mpc5xxx/serial.c b/arch/powerpc/cpu/mpc5xxx/serial.c
index 9bebff8..eb14161 100644
--- a/arch/powerpc/cpu/mpc5xxx/serial.c
+++ b/arch/powerpc/cpu/mpc5xxx/serial.c
@@ -25,7 +25,7 @@
  * Linux/PPC sources (m8260_tty.c had no copyright info in it).
  *
  * Martin Krause, 8 Jun 2006
- * Added CONFIG_SERIAL_MULTI support
+ * Added SERIAL_MULTI support
  */
 
 /*
@@ -36,10 +36,7 @@
 #include <common.h>
 #include <linux/compiler.h>
 #include <mpc5xxx.h>
-
-#if defined (CONFIG_SERIAL_MULTI)
 #include <serial.h>
-#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -61,11 +58,8 @@ DECLARE_GLOBAL_DATA_PTR;
 #error CONFIG_PSC_CONSOLE must be in 1 ... 6
 #endif
 
-#if defined(CONFIG_SERIAL_MULTI) && !defined(CONFIG_PSC_CONSOLE2)
-#error you must define CONFIG_PSC_CONSOLE2 if CONFIG_SERIAL_MULTI is set
-#endif
+#if defined(CONFIG_PSC_CONSOLE2)
 
-#if defined(CONFIG_SERIAL_MULTI)
 #if CONFIG_PSC_CONSOLE2 == 1
 #define PSC_BASE2 MPC5XXX_PSC1
 #elif CONFIG_PSC_CONSOLE2 == 2
@@ -81,19 +75,12 @@ DECLARE_GLOBAL_DATA_PTR;
 #else
 #error CONFIG_PSC_CONSOLE2 must be in 1 ... 6
 #endif
-#endif /* CONFIG_SERIAL_MULTI */
 
-#if defined(CONFIG_SERIAL_MULTI)
-int serial_init_dev (unsigned long dev_base)
-#else
-int serial_init (void)
 #endif
+
+int serial_init_dev (unsigned long dev_base)
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
-#else
-	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#endif
 	unsigned long baseclk;
 	int div;
 
@@ -127,24 +114,12 @@ int serial_init (void)
 	return (0);
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 void serial_putc_dev (unsigned long dev_base, const char c)
-#else
-void serial_putc(const char c)
-#endif
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
-#else
-	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#endif
 
 	if (c == '\n')
-#if defined(CONFIG_SERIAL_MULTI)
 		serial_putc_dev (dev_base, '\r');
-#else
-		serial_putc('\r');
-#endif
 
 	/* Wait for last character to go. */
 	while (!(psc->psc_status & PSC_SR_TXEMP))
@@ -153,17 +128,9 @@ void serial_putc(const char c)
 	psc->psc_buffer_8 = c;
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 void serial_putc_raw_dev(unsigned long dev_base, const char c)
-#else
-void serial_putc_raw(const char c)
-#endif
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
-#else
-	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#endif
 	/* Wait for last character to go. */
 	while (!(psc->psc_status & PSC_SR_TXEMP))
 		;
@@ -172,32 +139,16 @@ void serial_putc_raw(const char c)
 }
 
 
-#if defined(CONFIG_SERIAL_MULTI)
 void serial_puts_dev (unsigned long dev_base, const char *s)
-#else
-void serial_puts (const char *s)
-#endif
 {
 	while (*s) {
-#if defined(CONFIG_SERIAL_MULTI)
 		serial_putc_dev (dev_base, *s++);
-#else
-		serial_putc (*s++);
-#endif
 	}
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 int serial_getc_dev (unsigned long dev_base)
-#else
-int serial_getc(void)
-#endif
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
-#else
-	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#endif
 
 	/* Wait for a character to arrive. */
 	while (!(psc->psc_status & PSC_SR_RXRDY))
@@ -206,32 +157,16 @@ int serial_getc(void)
 	return psc->psc_buffer_8;
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 int serial_tstc_dev (unsigned long dev_base)
-#else
-int serial_tstc(void)
-#endif
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
-#else
-	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#endif
 
 	return (psc->psc_status & PSC_SR_RXRDY);
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 void serial_setbrg_dev (unsigned long dev_base)
-#else
-void serial_setbrg(void)
-#endif
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
-#else
-	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#endif
 	unsigned long baseclk, div;
 
 	baseclk = (gd->ipb_clk + 16) / 32;
@@ -242,17 +177,9 @@ void serial_setbrg(void)
 	psc->ctlr =  div & 0xff;
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 void serial_setrts_dev (unsigned long dev_base, int s)
-#else
-void serial_setrts(int s)
-#endif
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
-#else
-	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#endif
 
 	if (s) {
 		/* Assert RTS (become LOW) */
@@ -264,78 +191,43 @@ void serial_setrts(int s)
 	}
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 int serial_getcts_dev (unsigned long dev_base)
-#else
-int serial_getcts(void)
-#endif
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
-#else
-	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#endif
 
 	return (psc->ip & 0x1) ? 0 : 1;
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 int serial0_init(void)
 {
 	return (serial_init_dev(PSC_BASE));
 }
 
-int serial1_init(void)
-{
-	return (serial_init_dev(PSC_BASE2));
-}
 void serial0_setbrg (void)
 {
 	serial_setbrg_dev(PSC_BASE);
 }
-void serial1_setbrg (void)
-{
-	serial_setbrg_dev(PSC_BASE2);
-}
 
 void serial0_putc(const char c)
 {
 	serial_putc_dev(PSC_BASE,c);
 }
 
-void serial1_putc(const char c)
-{
-	serial_putc_dev(PSC_BASE2, c);
-}
 void serial0_puts(const char *s)
 {
 	serial_puts_dev(PSC_BASE, s);
 }
 
-void serial1_puts(const char *s)
-{
-	serial_puts_dev(PSC_BASE2, s);
-}
-
 int serial0_getc(void)
 {
 	return(serial_getc_dev(PSC_BASE));
 }
 
-int serial1_getc(void)
-{
-	return(serial_getc_dev(PSC_BASE2));
-}
 int serial0_tstc(void)
 {
 	return (serial_tstc_dev(PSC_BASE));
 }
 
-int serial1_tstc(void)
-{
-	return (serial_tstc_dev(PSC_BASE2));
-}
-
 struct serial_device serial0_device =
 {
 	.name	= "serial0",
@@ -353,6 +245,37 @@ __weak struct serial_device *default_serial_console(void)
 	return &serial0_device;
 }
 
+#ifdef CONFIG_PSC_CONSOLE2
+int serial1_init(void)
+{
+	return serial_init_dev(PSC_BASE2);
+}
+
+void serial1_setbrg(void)
+{
+	serial_setbrg_dev(PSC_BASE2);
+}
+
+void serial1_putc(const char c)
+{
+	serial_putc_dev(PSC_BASE2, c);
+}
+
+void serial1_puts(const char *s)
+{
+	serial_puts_dev(PSC_BASE2, s);
+}
+
+int serial1_getc(void)
+{
+	return serial_getc_dev(PSC_BASE2);
+}
+
+int serial1_tstc(void)
+{
+	return serial_tstc_dev(PSC_BASE2);
+}
+
 struct serial_device serial1_device =
 {
 	.name	= "serial1",
@@ -364,6 +287,6 @@ struct serial_device serial1_device =
 	.putc	= serial1_putc,
 	.puts	= serial1_puts,
 };
-#endif /* CONFIG_SERIAL_MULTI */
+#endif /* CONFIG_PSC_CONSOLE2 */
 
 #endif /* CONFIG_PSC_CONSOLE */
diff --git a/arch/powerpc/cpu/mpc8220/uart.c b/arch/powerpc/cpu/mpc8220/uart.c
index 545c81a..25d4472 100644
--- a/arch/powerpc/cpu/mpc8220/uart.c
+++ b/arch/powerpc/cpu/mpc8220/uart.c
@@ -126,7 +126,6 @@ static void mpc8220_serial_setbrg(void)
 	psc->cr = PSC_CR_RX_ENABLE | PSC_CR_TX_ENABLE;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device mpc8220_serial_drv = {
 	.name	= "mpc8220_serial",
 	.start	= mpc8220_serial_init,
@@ -147,35 +146,4 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &mpc8220_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return mpc8220_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	mpc8220_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	mpc8220_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	mpc8220_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return mpc8220_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return mpc8220_serial_tstc();
-}
-#endif
 #endif /* CONFIG_PSC_CONSOLE */
diff --git a/arch/powerpc/cpu/mpc8260/serial_scc.c b/arch/powerpc/cpu/mpc8260/serial_scc.c
index cfbcd79..954db14 100644
--- a/arch/powerpc/cpu/mpc8260/serial_scc.c
+++ b/arch/powerpc/cpu/mpc8260/serial_scc.c
@@ -261,7 +261,6 @@ static int mpc8260_scc_serial_tstc(void)
 	return ((rbdf->cbd_sc & BD_SC_EMPTY) == 0);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device mpc8260_scc_serial_drv = {
 	.name	= "mpc8260_scc_serial",
 	.start	= mpc8260_scc_serial_init,
@@ -282,37 +281,6 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &mpc8260_scc_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return mpc8260_scc_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	mpc8260_scc_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	mpc8260_scc_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	mpc8260_scc_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return mpc8260_scc_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return mpc8260_scc_serial_tstc();
-}
-#endif
 #endif	/* CONFIG_CONS_ON_SCC */
 
 #if defined(CONFIG_KGDB_ON_SCC)
diff --git a/arch/powerpc/cpu/mpc8260/serial_smc.c b/arch/powerpc/cpu/mpc8260/serial_smc.c
index 012fc98..48f5896 100644
--- a/arch/powerpc/cpu/mpc8260/serial_smc.c
+++ b/arch/powerpc/cpu/mpc8260/serial_smc.c
@@ -264,7 +264,6 @@ static int mpc8260_smc_serial_tstc(void)
 	return !(rtx->rxbd.cbd_sc & BD_SC_EMPTY);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device mpc8260_smc_serial_drv = {
 	.name	= "mpc8260_smc_serial",
 	.start	= mpc8260_smc_serial_init,
@@ -285,37 +284,6 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &mpc8260_smc_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return mpc8260_smc_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	mpc8260_smc_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	mpc8260_smc_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	mpc8260_smc_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return mpc8260_smc_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return mpc8260_smc_serial_tstc();
-}
-#endif
 #endif	/* CONFIG_CONS_ON_SMC */
 
 #if defined(CONFIG_KGDB_ON_SMC)
diff --git a/arch/powerpc/cpu/mpc85xx/serial_scc.c b/arch/powerpc/cpu/mpc85xx/serial_scc.c
index d192642..fe9af55 100644
--- a/arch/powerpc/cpu/mpc85xx/serial_scc.c
+++ b/arch/powerpc/cpu/mpc85xx/serial_scc.c
@@ -262,7 +262,6 @@ static int mpc85xx_serial_tstc(void)
 	return ((rbdf->cbd_sc & BD_SC_EMPTY) == 0);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device mpc85xx_serial_drv = {
 	.name	= "mpc85xx_serial",
 	.start	= mpc85xx_serial_init,
@@ -283,35 +282,4 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &mpc85xx_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return mpc85xx_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	mpc85xx_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	mpc85xx_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	mpc85xx_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return mpc85xx_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return mpc85xx_serial_tstc();
-}
-#endif
 #endif	/* CONFIG_CONS_ON_SCC */
diff --git a/arch/powerpc/cpu/ppc4xx/iop480_uart.c b/arch/powerpc/cpu/ppc4xx/iop480_uart.c
index fb25e15..9473984 100644
--- a/arch/powerpc/cpu/ppc4xx/iop480_uart.c
+++ b/arch/powerpc/cpu/ppc4xx/iop480_uart.c
@@ -26,11 +26,8 @@
 #include <asm/processor.h>
 #include <asm/io.h>
 #include <watchdog.h>
-
-#ifdef CONFIG_SERIAL_MULTI
 #include <serial.h>
 #include <linux/compiler.h>
-#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -234,7 +231,6 @@ static int iop480_serial_tstc(void)
 	return 0;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device iop480_serial_drv = {
 	.name	= "iop480_serial",
 	.start	= iop480_serial_init,
@@ -255,35 +251,4 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &iop480_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return iop480_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	iop480_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	iop480_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	iop480_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return iop480_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return iop480_serial_tstc();
-}
-#endif
 #endif	/* CONFIG_IOP480 */
diff --git a/arch/sparc/cpu/leon2/serial.c b/arch/sparc/cpu/leon2/serial.c
index 61d059b..16fffb6 100644
--- a/arch/sparc/cpu/leon2/serial.c
+++ b/arch/sparc/cpu/leon2/serial.c
@@ -166,7 +166,6 @@ static void leon2_serial_setbrg(void)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device leon2_serial_drv = {
 	.name	= "leon2_serial",
 	.start	= leon2_serial_init,
@@ -187,34 +186,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &leon2_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return leon2_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	leon2_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	leon2_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	leon2_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return leon2_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return leon2_serial_tstc();
-}
-#endif
diff --git a/arch/sparc/cpu/leon3/serial.c b/arch/sparc/cpu/leon3/serial.c
index a110244..c4f3ee8 100644
--- a/arch/sparc/cpu/leon3/serial.c
+++ b/arch/sparc/cpu/leon3/serial.c
@@ -140,7 +140,6 @@ static void leon3_serial_setbrg(void)
 	return;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device leon3_serial_drv = {
 	.name	= "leon3_serial",
 	.start	= leon3_serial_init,
@@ -161,34 +160,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &leon3_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return leon3_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	leon3_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	leon3_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	leon3_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return leon3_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return leon3_serial_tstc();
-}
-#endif
diff --git a/board/Marvell/common/serial.c b/board/Marvell/common/serial.c
index a5231eb..1327c62 100644
--- a/board/Marvell/common/serial.c
+++ b/board/Marvell/common/serial.c
@@ -146,7 +146,6 @@ static void marvell_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device marvell_serial_drv = {
 	.name	= "marvell_serial",
 	.start	= marvell_serial_init,
@@ -167,37 +166,6 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &marvell_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return marvell_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	marvell_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	marvell_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	marvell_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return marvell_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return marvell_serial_tstc();
-}
-#endif
 
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
diff --git a/board/amirix/ap1000/serial.c b/board/amirix/ap1000/serial.c
index 2c2e9f9..a77d332 100644
--- a/board/amirix/ap1000/serial.c
+++ b/board/amirix/ap1000/serial.c
@@ -86,7 +86,6 @@ static void amirix_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device amirix_serial_drv = {
 	.name	= "amirix_serial",
 	.start	= amirix_serial_init,
@@ -107,37 +106,7 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &amirix_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return amirix_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	amirix_serial_setbrg();
-}
 
-void serial_putc(const char c)
-{
-	amirix_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	amirix_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return amirix_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return amirix_serial_tstc();
-}
-#endif
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
 {
diff --git a/board/bmw/serial.c b/board/bmw/serial.c
index 569131f..08f449c 100644
--- a/board/bmw/serial.c
+++ b/board/bmw/serial.c
@@ -83,7 +83,6 @@ static void bmw_serial_setbrg(void)
 	NS16550_reinit (console, clock_divisor);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device bmw_serial_drv = {
 	.name	= "bmw_serial",
 	.start	= bmw_serial_init,
@@ -104,34 +103,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &bmw_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return bmw_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	bmw_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	bmw_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	bmw_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return bmw_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return bmw_serial_tstc();
-}
-#endif
diff --git a/board/cogent/serial.c b/board/cogent/serial.c
index 18a9dbf..cd4a976 100644
--- a/board/cogent/serial.c
+++ b/board/cogent/serial.c
@@ -90,7 +90,6 @@ static int cogent_serial_tstc(void)
 	return ((cma_mb_reg_read (&mbsp->ser_lsr) & LSR_DR) != 0);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device cogent_serial_drv = {
 	.name	= "cogent_serial",
 	.start	= cogent_serial_init,
@@ -111,37 +110,6 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &cogent_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return cogent_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	cogent_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	cogent_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	cogent_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return cogent_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return cogent_serial_tstc();
-}
-#endif
 #endif /* CONS_NONE */
 
 #if defined(CONFIG_CMD_KGDB) && \
diff --git a/board/esd/cpci750/serial.c b/board/esd/cpci750/serial.c
index 9ff7c27..25f8950 100644
--- a/board/esd/cpci750/serial.c
+++ b/board/esd/cpci750/serial.c
@@ -83,7 +83,6 @@ static void cpci750_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device cpci750_serial_drv = {
 	.name	= "cpci750_serial",
 	.start	= cpci750_serial_init,
@@ -104,37 +103,7 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &cpci750_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return cpci750_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	cpci750_serial_setbrg();
-}
 
-void serial_putc(const char c)
-{
-	cpci750_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	cpci750_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return cpci750_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return cpci750_serial_tstc();
-}
-#endif
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
 {
diff --git a/board/evb64260/serial.c b/board/evb64260/serial.c
index cf46a4d..9fd4298 100644
--- a/board/evb64260/serial.c
+++ b/board/evb64260/serial.c
@@ -146,7 +146,6 @@ static void evb64260_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device evb64260_serial_drv = {
 	.name	= "evb64260_serial",
 	.start	= evb64260_serial_init,
@@ -167,37 +166,7 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &evb64260_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return evb64260_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	evb64260_serial_setbrg();
-}
 
-void serial_putc(const char c)
-{
-	evb64260_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	evb64260_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return evb64260_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return evb64260_serial_tstc();
-}
-#endif
 #if defined(CONFIG_CMD_KGDB)
 void
 kgdb_serial_init(void)
diff --git a/board/ml2/serial.c b/board/ml2/serial.c
index 0ed1150..787ff46 100644
--- a/board/ml2/serial.c
+++ b/board/ml2/serial.c
@@ -90,7 +90,6 @@ static void ml2_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device ml2_serial_drv = {
 	.name	= "ml2_serial",
 	.start	= ml2_serial_init,
@@ -111,37 +110,7 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &ml2_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return ml2_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	ml2_serial_setbrg();
-}
 
-void serial_putc(const char c)
-{
-	ml2_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	ml2_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return ml2_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return ml2_serial_tstc();
-}
-#endif
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
 {
diff --git a/board/pcippc2/sconsole.c b/board/pcippc2/sconsole.c
index 0a31963..aa3c908 100644
--- a/board/pcippc2/sconsole.c
+++ b/board/pcippc2/sconsole.c
@@ -115,7 +115,6 @@ static void sconsole_serial_setbrg(void)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device sconsole_serial_drv = {
 	.name	= "sconsole_serial",
 	.start	= sconsole_serial_init,
@@ -136,37 +135,7 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &sconsole_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return sconsole_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	sconsole_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	sconsole_serial_putc(c);
-}
 
-void serial_puts(const char *s)
-{
-	sconsole_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return sconsole_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return sconsole_serial_tstc();
-}
-#endif
 int sconsole_get_baudrate (void)
 {
 	sconsole_buffer_t *sb = SCONSOLE_BUFFER;
diff --git a/board/pdm360ng/pdm360ng.c b/board/pdm360ng/pdm360ng.c
index 2082ad4..a2a1323 100644
--- a/board/pdm360ng/pdm360ng.c
+++ b/board/pdm360ng/pdm360ng.c
@@ -172,9 +172,7 @@ phys_size_t initdram (int board_type)
 	return msize;
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 static int set_lcd_brightness(char *);
-#endif
 
 int misc_init_r(void)
 {
@@ -237,9 +235,7 @@ int misc_init_r(void)
 #endif
 
 #ifdef CONFIG_FSL_DIU_FB
-#if defined(CONFIG_SERIAL_MULTI)
 	set_lcd_brightness(0);
-#endif
 	/* Switch LCD-Backlight and LVDS-Interface on */
 	setbits_be32(&im->gpio.gpdir, 0x01040000);
 	clrsetbits_be32(&im->gpio.gpdat, 0x01000000, 0x00040000);
@@ -608,7 +604,6 @@ void ft_board_setup(void *blob, bd_t *bd)
 }
 #endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
 
-#if defined(CONFIG_SERIAL_MULTI)
 /*
  * If argument is NULL, set the LCD brightness to the
  * value from "brightness" environment variable. Set
@@ -685,4 +680,3 @@ U_BOOT_CMD(lcdbr, 2, 1, cmd_lcd_brightness,
 	"set LCD brightness",
 	"<brightness> - set LCD backlight level to <brightness>.\n"
 );
-#endif /* CONFIG_SERIAL_MULTI */
diff --git a/board/prodrive/p3mx/serial.c b/board/prodrive/p3mx/serial.c
index d3591b4..2f4d294 100644
--- a/board/prodrive/p3mx/serial.c
+++ b/board/prodrive/p3mx/serial.c
@@ -83,7 +83,6 @@ static void p3mx_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device p3mx_serial_drv = {
 	.name	= "p3mx_serial",
 	.start	= p3mx_serial_init,
@@ -104,37 +103,6 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &p3mx_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return p3mx_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	p3mx_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	p3mx_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	p3mx_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return p3mx_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return p3mx_serial_tstc();
-}
-#endif
 
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
diff --git a/board/trizepsiv/conxs.c b/board/trizepsiv/conxs.c
index 8fc3c40..871e052 100644
--- a/board/trizepsiv/conxs.c
+++ b/board/trizepsiv/conxs.c
@@ -120,7 +120,6 @@ int board_init (void)
 
 int board_late_init(void)
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	char *console=getenv("boot_console");
 
 	if ((console == NULL) || (strcmp(console,"serial_btuart") &&
@@ -131,7 +130,6 @@ int board_late_init(void)
 	setenv("stdout",console);
 	setenv("stdin", console);
 	setenv("stderr",console);
-#endif
 	return 0;
 }
 
diff --git a/drivers/serial/altera_jtag_uart.c b/drivers/serial/altera_jtag_uart.c
index d3b6c1c..ec8ca29 100644
--- a/drivers/serial/altera_jtag_uart.c
+++ b/drivers/serial/altera_jtag_uart.c
@@ -83,7 +83,6 @@ static int altera_jtag_serial_getc(void)
 	return (c);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device altera_jtag_serial_drv = {
 	.name	= "altera_jtag_serial",
 	.start	= altera_jtag_serial_init,
@@ -104,34 +103,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &altera_jtag_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return altera_jtag_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	altera_jtag_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	altera_jtag_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	altera_jtag_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return altera_jtag_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return altera_jtag_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c
index 18b820b..700abd6 100644
--- a/drivers/serial/altera_uart.c
+++ b/drivers/serial/altera_uart.c
@@ -99,7 +99,6 @@ static int altera_serial_getc(void)
 	return (readl (&uart->rxdata) & 0x00ff );
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device altera_serial_drv = {
 	.name	= "altera_serial",
 	.start	= altera_serial_init,
@@ -120,34 +119,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &altera_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return altera_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	altera_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	altera_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	altera_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return altera_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return altera_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c
index d49d5d4..1303031 100644
--- a/drivers/serial/atmel_usart.c
+++ b/drivers/serial/atmel_usart.c
@@ -107,7 +107,6 @@ static int atmel_serial_tstc(void)
 	return (readl(&usart->csr) & USART3_BIT(RXRDY)) != 0;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device atmel_serial_drv = {
 	.name	= "atmel_serial",
 	.start	= atmel_serial_init,
@@ -128,34 +127,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &atmel_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return atmel_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	atmel_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	atmel_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	atmel_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return atmel_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return atmel_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/lpc32xx_hsuart.c b/drivers/serial/lpc32xx_hsuart.c
index 536fd46..02429b5 100644
--- a/drivers/serial/lpc32xx_hsuart.c
+++ b/drivers/serial/lpc32xx_hsuart.c
@@ -83,7 +83,6 @@ static void lpc32xx_serial_puts(const char *s)
 		serial_putc(*s++);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device lpc32xx_serial_drv = {
 	.name	= "lpc32xx_serial",
 	.start	= lpc32xx_serial_init,
@@ -104,34 +103,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &lpc32xx_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return lpc32xx_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	lpc32xx_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	lpc32xx_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	lpc32xx_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return lpc32xx_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return lpc32xx_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/mcfuart.c b/drivers/serial/mcfuart.c
index 7e0b765..00a7114 100644
--- a/drivers/serial/mcfuart.c
+++ b/drivers/serial/mcfuart.c
@@ -130,7 +130,6 @@ static void mcf_serial_setbrg(void)
 	uart->ucr = UART_UCR_RX_ENABLED | UART_UCR_TX_ENABLED;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device mcf_serial_drv = {
 	.name	= "mcf_serial",
 	.start	= mcf_serial_init,
@@ -151,34 +150,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &mcf_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return mcf_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	mcf_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	mcf_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	mcf_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return mcf_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return mcf_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/ns9750_serial.c b/drivers/serial/ns9750_serial.c
index 829f6d5..cb545c4 100644
--- a/drivers/serial/ns9750_serial.c
+++ b/drivers/serial/ns9750_serial.c
@@ -209,7 +209,6 @@ static unsigned int calcRxCharGapRegister( void )
 	return NS9750_SER_RX_CHAR_TIMER_TRUN;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device ns9750_serial_drv = {
 	.name	= "ns9750_serial",
 	.start	= ns9750_serial_init,
@@ -230,34 +229,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &ns9750_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return ns9750_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	ns9750_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	ns9750_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	ns9750_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return ns9750_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return ns9750_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/opencores_yanu.c b/drivers/serial/opencores_yanu.c
index a0dd301..49bccf3 100644
--- a/drivers/serial/opencores_yanu.c
+++ b/drivers/serial/opencores_yanu.c
@@ -189,7 +189,6 @@ statoc int oc_serial_getc(void)
 	return(readl(&uart->data) & YANU_DATA_CHAR_MASK);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device oc_serial_drv = {
 	.name	= "oc_serial",
 	.start	= oc_serial_init,
@@ -210,34 +209,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &oc_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return oc_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	oc_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	oc_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	oc_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return oc_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return oc_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/s3c4510b_uart.c b/drivers/serial/s3c4510b_uart.c
index 4f7f98e..423d26e 100644
--- a/drivers/serial/s3c4510b_uart.c
+++ b/drivers/serial/s3c4510b_uart.c
@@ -211,7 +211,6 @@ static void s3c4510b_serial_puts(const char *s)
 
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device s3c4510b_serial_drv = {
 	.name	= "s3c4510b_serial",
 	.start	= s3c4510b_serial_init,
@@ -232,34 +231,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &s3c4510b_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return s3c4510b_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	s3c4510b_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	s3c4510b_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	s3c4510b_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return s3c4510b_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return s3c4510b_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/s3c64xx.c b/drivers/serial/s3c64xx.c
index 823425b..9ab8a28 100644
--- a/drivers/serial/s3c64xx.c
+++ b/drivers/serial/s3c64xx.c
@@ -172,7 +172,6 @@ static void s3c64xx_serial_puts(const char *s)
 		serial_putc(*s++);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device s3c64xx_serial_drv = {
 	.name	= "s3c64xx_serial",
 	.start	= s3c64xx_serial_init,
@@ -193,34 +192,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &s3c64xx_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return s3c64xx_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	s3c64xx_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	s3c64xx_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	s3c64xx_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return s3c64xx_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return s3c64xx_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/sandbox.c b/drivers/serial/sandbox.c
index d60fbba..cb19401 100644
--- a/drivers/serial/sandbox.c
+++ b/drivers/serial/sandbox.c
@@ -64,7 +64,6 @@ static int sandbox_serial_tstc(void)
 	return 0;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device sandbox_serial_drv = {
 	.name	= "sandbox_serial",
 	.start	= sandbox_serial_init,
@@ -85,34 +84,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &sandbox_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return sandbox_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	sandbox_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	sandbox_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	sandbox_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return sandbox_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return sandbox_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index 00ad97c..b5d1248 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -29,20 +29,11 @@
 #include <ns87308.h>
 #endif
 
-#if defined (CONFIG_SERIAL_MULTI)
 #include <serial.h>
-#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
 #if !defined(CONFIG_CONS_INDEX)
-#if defined (CONFIG_SERIAL_MULTI)
-/*   with CONFIG_SERIAL_MULTI we might have no console
- *  on these devices
- */
-#else
-#error	"No console index specified."
-#endif /* CONFIG_SERIAL_MULTI */
 #elif (CONFIG_CONS_INDEX < 1) || (CONFIG_CONS_INDEX > 4)
 #error	"Invalid console index value."
 #endif
@@ -85,8 +76,6 @@ static NS16550_t serial_ports[4] = {
 
 #define PORT	serial_ports[port-1]
 
-#if defined(CONFIG_SERIAL_MULTI)
-
 /* Multi serial device functions */
 #define DECLARE_ESERIAL_FUNCTIONS(port) \
     int  eserial##port##_init (void) {\
@@ -117,8 +106,6 @@ static NS16550_t serial_ports[4] = {
 	.puts	= eserial##port##_puts,		\
 }
 
-#endif /* CONFIG_SERIAL_MULTI */
-
 static int calc_divisor (NS16550_t port)
 {
 #ifdef CONFIG_OMAP1510
@@ -151,36 +138,6 @@ static int calc_divisor (NS16550_t port)
 		(MODE_X_DIV * gd->baudrate);
 }
 
-#if !defined(CONFIG_SERIAL_MULTI)
-int serial_init (void)
-{
-	int clock_divisor;
-
-#ifdef CONFIG_NS87308
-	initialise_ns87308();
-#endif
-
-#ifdef CONFIG_SYS_NS16550_COM1
-	clock_divisor = calc_divisor(serial_ports[0]);
-	NS16550_init(serial_ports[0], clock_divisor);
-#endif
-#ifdef CONFIG_SYS_NS16550_COM2
-	clock_divisor = calc_divisor(serial_ports[1]);
-	NS16550_init(serial_ports[1], clock_divisor);
-#endif
-#ifdef CONFIG_SYS_NS16550_COM3
-	clock_divisor = calc_divisor(serial_ports[2]);
-	NS16550_init(serial_ports[2], clock_divisor);
-#endif
-#ifdef CONFIG_SYS_NS16550_COM4
-	clock_divisor = calc_divisor(serial_ports[3]);
-	NS16550_init(serial_ports[3], clock_divisor);
-#endif
-
-	return (0);
-}
-#endif
-
 void
 _serial_putc(const char c,const int port)
 {
@@ -226,91 +183,41 @@ _serial_setbrg (const int port)
 	NS16550_reinit(PORT, clock_divisor);
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline void
 serial_putc_dev(unsigned int dev_index,const char c)
 {
 	_serial_putc(c,dev_index);
 }
-#else
-void
-serial_putc(const char c)
-{
-	_serial_putc(c,CONFIG_CONS_INDEX);
-}
-#endif
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline void
 serial_putc_raw_dev(unsigned int dev_index,const char c)
 {
 	_serial_putc_raw(c,dev_index);
 }
-#else
-void
-serial_putc_raw(const char c)
-{
-	_serial_putc_raw(c,CONFIG_CONS_INDEX);
-}
-#endif
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline void
 serial_puts_dev(unsigned int dev_index,const char *s)
 {
 	_serial_puts(s,dev_index);
 }
-#else
-void
-serial_puts(const char *s)
-{
-	_serial_puts(s,CONFIG_CONS_INDEX);
-}
-#endif
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline int
 serial_getc_dev(unsigned int dev_index)
 {
 	return _serial_getc(dev_index);
 }
-#else
-int
-serial_getc(void)
-{
-	return _serial_getc(CONFIG_CONS_INDEX);
-}
-#endif
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline int
 serial_tstc_dev(unsigned int dev_index)
 {
 	return _serial_tstc(dev_index);
 }
-#else
-int
-serial_tstc(void)
-{
-	return _serial_tstc(CONFIG_CONS_INDEX);
-}
-#endif
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline void
 serial_setbrg_dev(unsigned int dev_index)
 {
 	_serial_setbrg(dev_index);
 }
-#else
-void
-serial_setbrg(void)
-{
-	_serial_setbrg(CONFIG_CONS_INDEX);
-}
-#endif
-
-#if defined(CONFIG_SERIAL_MULTI)
 
 DECLARE_ESERIAL_FUNCTIONS(1);
 struct serial_device eserial1_device =
@@ -355,5 +262,3 @@ void ns16550_serial_initialize(void)
 	serial_register(&eserial4_device);
 #endif
 }
-
-#endif /* CONFIG_SERIAL_MULTI */
diff --git a/drivers/serial/serial_clps7111.c b/drivers/serial/serial_clps7111.c
index e1bed90..65473e8 100644
--- a/drivers/serial/serial_clps7111.c
+++ b/drivers/serial/serial_clps7111.c
@@ -119,7 +119,6 @@ static void clps7111_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device clps7111_serial_drv = {
 	.name	= "clps7111_serial",
 	.start	= clps7111_serial_init,
@@ -140,34 +139,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &clps7111_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return clps7111_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	clps7111_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	clps7111_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	clps7111_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return clps7111_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return clps7111_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_imx.c b/drivers/serial/serial_imx.c
index d37ec29..6c075b5 100644
--- a/drivers/serial/serial_imx.c
+++ b/drivers/serial/serial_imx.c
@@ -221,7 +221,6 @@ static void imx_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device imx_serial_drv = {
 	.name	= "imx_serial",
 	.start	= imx_serial_init,
@@ -242,34 +241,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &imx_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return imx_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	imx_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	imx_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	imx_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return imx_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return imx_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_ixp.c b/drivers/serial/serial_ixp.c
index 6e3f7f0..c8b3658 100644
--- a/drivers/serial/serial_ixp.c
+++ b/drivers/serial/serial_ixp.c
@@ -128,7 +128,6 @@ static void ixp_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device ixp_serial_drv = {
 	.name	= "ixp_serial",
 	.start	= ixp_serial_init,
@@ -149,34 +148,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &ixp_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return ixp_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	ixp_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	ixp_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	ixp_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return ixp_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return ixp_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_ks8695.c b/drivers/serial/serial_ks8695.c
index b3af388..60e8007 100644
--- a/drivers/serial/serial_ks8695.c
+++ b/drivers/serial/serial_ks8695.c
@@ -118,7 +118,6 @@ static int ks8695_serial_getc(void)
 	return (uartp->RX);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device ks8695_serial_drv = {
 	.name	= "ks8695_serial",
 	.start	= ks8695_serial_init,
@@ -139,34 +138,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &ks8695_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return ks8695_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	ks8695_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	ks8695_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	ks8695_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return ks8695_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return ks8695_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_lh7a40x.c b/drivers/serial/serial_lh7a40x.c
index 6b73606..6c96285 100644
--- a/drivers/serial/serial_lh7a40x.c
+++ b/drivers/serial/serial_lh7a40x.c
@@ -182,7 +182,6 @@ static void lh7a40x_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device lh7a40x_serial_drv = {
 	.name	= "lh7a40x_serial",
 	.start	= lh7a40x_serial_init,
@@ -203,34 +202,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &lh7a40x_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return lh7a40x_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	lh7a40x_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	lh7a40x_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	lh7a40x_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return lh7a40x_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return lh7a40x_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_lpc2292.c b/drivers/serial/serial_lpc2292.c
index 2601ee7..fcab202 100644
--- a/drivers/serial/serial_lpc2292.c
+++ b/drivers/serial/serial_lpc2292.c
@@ -102,7 +102,6 @@ static int lpc2292_serial_tstc(void)
 	return (GET8(U0LSR) & 1);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device lpc2292_serial_drv = {
 	.name	= "lpc2292_serial",
 	.start	= lpc2292_serial_init,
@@ -123,34 +122,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &lpc2292_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return lpc2292_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	lpc2292_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	lpc2292_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	lpc2292_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return lpc2292_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return lpc2292_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_max3100.c b/drivers/serial/serial_max3100.c
index b21fba0..3533cfc 100644
--- a/drivers/serial/serial_max3100.c
+++ b/drivers/serial/serial_max3100.c
@@ -288,7 +288,6 @@ static void max3100_serial_setbrg(void)
 {
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device max3100_serial_drv = {
 	.name	= "max3100_serial",
 	.start	= max3100_serial_init,
@@ -309,34 +308,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &max3100_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return max3100_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	max3100_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	max3100_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	max3100_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return max3100_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return max3100_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
index 0899e9b..b0612f5 100644
--- a/drivers/serial/serial_mxc.c
+++ b/drivers/serial/serial_mxc.c
@@ -32,10 +32,6 @@
 
 #define UART_PHYS	CONFIG_MXC_UART_BASE
 
-#ifdef CONFIG_SERIAL_MULTI
-#warning "MXC driver does not support MULTI serials."
-#endif
-
 /* Register definitions */
 #define URXD  0x0  /* Receiver Register */
 #define UTXD  0x40 /* Transmitter Register */
@@ -226,7 +222,6 @@ static int mxc_serial_init(void)
 	return 0;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device mxc_serial_drv = {
 	.name	= "mxc_serial",
 	.start	= mxc_serial_init,
@@ -247,34 +242,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &mxc_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return mxc_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	mxc_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	mxc_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	mxc_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return mxc_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return mxc_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_netarm.c b/drivers/serial/serial_netarm.c
index ff6612d..d30adc3 100644
--- a/drivers/serial/serial_netarm.c
+++ b/drivers/serial/serial_netarm.c
@@ -189,7 +189,6 @@ static void netarm_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device netarm_serial_drv = {
 	.name	= "netarm_serial",
 	.start	= netarm_serial_init,
@@ -210,34 +209,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &netarm_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return netarm_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	netarm_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	netarm_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	netarm_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return netarm_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return netarm_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c
index beb0c98..7db7b65 100644
--- a/drivers/serial/serial_pl01x.c
+++ b/drivers/serial/serial_pl01x.c
@@ -253,7 +253,6 @@ static int pl01x_tstc (int portnum)
 	return !(readl(&regs->fr) & UART_PL01x_FR_RXFE);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device pl01x_serial_drv = {
 	.name	= "pl01x_serial",
 	.start	= pl01x_serial_init,
@@ -274,34 +273,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &pl01x_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return pl01x_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	pl01x_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	pl01x_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	pl01x_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return pl01x_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return pl01x_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_pxa.c b/drivers/serial/serial_pxa.c
index 46d7689..ad39100 100644
--- a/drivers/serial/serial_pxa.c
+++ b/drivers/serial/serial_pxa.c
@@ -73,20 +73,6 @@ DECLARE_GLOBAL_DATA_PTR;
 #define	HWUART_INDEX	0xff
 #endif
 
-#ifndef CONFIG_SERIAL_MULTI
-#if defined(CONFIG_FFUART)
-#define UART_INDEX	FFUART_INDEX
-#elif defined(CONFIG_BTUART)
-#define UART_INDEX	BTUART_INDEX
-#elif defined(CONFIG_STUART)
-#define UART_INDEX	STUART_INDEX
-#elif defined(CONFIG_HWUART)
-#define UART_INDEX	HWUART_INDEX
-#else
-#error "Please select CONFIG_(FF|BT|ST|HW)UART in board config file."
-#endif
-#endif
-
 static uint32_t pxa_uart_get_baud_divider(void)
 {
 	if (gd->baudrate == 1200)
@@ -297,9 +283,6 @@ void pxa_puts_dev(unsigned int uart_index, const char *s)
 	pxa_uart_multi(btuart, BTUART)
 #endif
 
-#ifndef	CONFIG_SERIAL_MULTI
-	pxa_uart(serial, UART)
-#else
 __weak struct serial_device *default_serial_console(void)
 {
 #if CONFIG_CONS_INDEX == 1
@@ -327,4 +310,3 @@ void pxa_serial_initialize(void)
 	serial_register(&serial_stuart_device);
 #endif
 }
-#endif
diff --git a/drivers/serial/serial_s3c24x0.c b/drivers/serial/serial_s3c24x0.c
index 625c6b7..4d214c3 100644
--- a/drivers/serial/serial_s3c24x0.c
+++ b/drivers/serial/serial_s3c24x0.c
@@ -38,8 +38,6 @@ DECLARE_GLOBAL_DATA_PTR;
 #endif
 
 #include <asm/io.h>
-
-#if defined(CONFIG_SERIAL_MULTI)
 #include <serial.h>
 
 /* Multi serial device functions */
@@ -80,8 +78,6 @@ DECLARE_GLOBAL_DATA_PTR;
 	.puts	= s3serial##port##_puts,		\
 }
 
-#endif /* CONFIG_SERIAL_MULTI */
-
 #ifdef CONFIG_HWFLOW
 static int hwflow;
 #endif
@@ -100,18 +96,10 @@ void _serial_setbrg(const int dev_index)
 		/* Delay */ ;
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline void serial_setbrg_dev(unsigned int dev_index)
 {
 	_serial_setbrg(dev_index);
 }
-#else
-void serial_setbrg(void)
-{
-	_serial_setbrg(UART_NR);
-}
-#endif
-
 
 /* Initialise the serial port. The settings are always 8 data bits, no parity,
  * 1 stop bit, no start bits.
@@ -151,16 +139,6 @@ static int serial_init_dev(const int dev_index)
 	return (0);
 }
 
-#if !defined(CONFIG_SERIAL_MULTI)
-/* Initialise the serial port. The settings are always 8 data bits, no parity,
- * 1 stop bit, no start bits.
- */
-int serial_init(void)
-{
-	return serial_init_dev(UART_NR);
-}
-#endif
-
 /*
  * Read a single byte from the serial port. Returns 1 on success, 0
  * otherwise. When the function is succesfull, the character read is
@@ -176,17 +154,10 @@ int _serial_getc(const int dev_index)
 	return readb(&uart->urxh) & 0xff;
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline int serial_getc_dev(unsigned int dev_index)
 {
 	return _serial_getc(dev_index);
 }
-#else
-int serial_getc(void)
-{
-	return _serial_getc(UART_NR);
-}
-#endif
 
 #ifdef CONFIG_HWFLOW
 int hwflow_onoff(int on)
@@ -246,18 +217,10 @@ void _serial_putc(const char c, const int dev_index)
 		serial_putc('\r');
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline void serial_putc_dev(unsigned int dev_index, const char c)
 {
 	_serial_putc(c, dev_index);
 }
-#else
-void serial_putc(const char c)
-{
-	_serial_putc(c, UART_NR);
-}
-#endif
-
 
 /*
  * Test whether a character is in the RX buffer
@@ -269,17 +232,10 @@ int _serial_tstc(const int dev_index)
 	return readl(&uart->utrstat) & 0x1;
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline int serial_tstc_dev(unsigned int dev_index)
 {
 	return _serial_tstc(dev_index);
 }
-#else
-int serial_tstc(void)
-{
-	return _serial_tstc(UART_NR);
-}
-#endif
 
 void _serial_puts(const char *s, const int dev_index)
 {
@@ -288,19 +244,11 @@ void _serial_puts(const char *s, const int dev_index)
 	}
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline void serial_puts_dev(int dev_index, const char *s)
 {
 	_serial_puts(s, dev_index);
 }
-#else
-void serial_puts(const char *s)
-{
-	_serial_puts(s, UART_NR);
-}
-#endif
 
-#if defined(CONFIG_SERIAL_MULTI)
 DECLARE_S3C_SERIAL_FUNCTIONS(0);
 struct serial_device s3c24xx_serial0_device =
 INIT_S3C_SERIAL_STRUCTURE(0, "s3ser0");
@@ -330,4 +278,3 @@ void s3c24xx_serial_initialize(void)
 	serial_register(&s3c24xx_serial1_device);
 	serial_register(&s3c24xx_serial2_device);
 }
-#endif /* CONFIG_SERIAL_MULTI */
diff --git a/drivers/serial/serial_s3c44b0.c b/drivers/serial/serial_s3c44b0.c
index 8beba1a..a4428e0 100644
--- a/drivers/serial/serial_s3c44b0.c
+++ b/drivers/serial/serial_s3c44b0.c
@@ -216,7 +216,6 @@ static void s3c44b0_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device s3c44b0_serial_drv = {
 	.name	= "s3c44b0_serial",
 	.start	= s3c44b0_serial_init,
@@ -237,34 +236,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &s3c44b0_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return s3c44b0_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	s3c44b0_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	s3c44b0_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	s3c44b0_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return s3c44b0_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return s3c44b0_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_sa1100.c b/drivers/serial/serial_sa1100.c
index 86e682d..c6b34db 100644
--- a/drivers/serial/serial_sa1100.c
+++ b/drivers/serial/serial_sa1100.c
@@ -160,7 +160,6 @@ static void sa1100_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device sa1100_serial_drv = {
 	.name	= "sa1100_serial",
 	.start	= sa1100_serial_init,
@@ -181,34 +180,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &sa1100_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return sa1100_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	sa1100_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	sa1100_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	sa1100_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return sa1100_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return sa1100_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_sh.c b/drivers/serial/serial_sh.c
index 8c30397..640861a 100644
--- a/drivers/serial/serial_sh.c
+++ b/drivers/serial/serial_sh.c
@@ -188,7 +188,6 @@ static int sh_serial_getc(void)
 	return ch;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device sh_serial_drv = {
 	.name	= "sh_serial",
 	.start	= sh_serial_init,
@@ -209,34 +208,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &sh_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return sh_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	sh_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	sh_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	sh_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return sh_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return sh_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_xuartlite.c b/drivers/serial/serial_xuartlite.c
index 164497e..9cc0b7f 100644
--- a/drivers/serial/serial_xuartlite.c
+++ b/drivers/serial/serial_xuartlite.c
@@ -96,39 +96,6 @@ static int uartlite_serial_init(const int port)
 	return -1;
 }
 
-#if !defined(CONFIG_SERIAL_MULTI)
-int serial_init(void)
-{
-	return uartlite_serial_init(0);
-}
-
-void serial_setbrg(void)
-{
-	/* FIXME: what's this for? */
-}
-
-void serial_putc(const char c)
-{
-	uartlite_serial_putc(c, 0);
-}
-
-void serial_puts(const char *s)
-{
-	uartlite_serial_puts(s, 0);
-}
-
-int serial_getc(void)
-{
-	return uartlite_serial_getc(0);
-}
-
-int serial_tstc(void)
-{
-	return uartlite_serial_tstc(0);
-}
-#endif
-
-#if defined(CONFIG_SERIAL_MULTI)
 /* Multi serial device functions */
 #define DECLARE_ESERIAL_FUNCTIONS(port) \
 	int userial##port##_init(void) \
@@ -197,4 +164,3 @@ void uartlite_serial_initialize(void)
 	serial_register(&uartlite_serial3_device);
 #endif /* XILINX_UARTLITE_BASEADDR3 */
 }
-#endif /* CONFIG_SERIAL_MULTI */
-- 
1.7.10.4

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

* [U-Boot] [PATCH 68/70] serial: Remove CONFIG_SERIAL_MULTI from remaining sources
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (66 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 67/70] serial: Remove CONFIG_SERIAL_MULTI from serial drivers Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 69/70] serial: Compile common/serial.c by default Marek Vasut
                     ` (2 subsequent siblings)
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Remove the parts depending either on disabled CONFIG_SERIAL_MULTI
or ifdefs around CONFIG_SERIAL_MULTI parts since CONFIG_SERIAL_MULTI
is now enabled by default.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/arm/lib/board.c             |    2 --
 arch/blackfin/lib/board.c        |    2 --
 arch/m68k/lib/board.c            |    2 --
 arch/microblaze/lib/board.c      |    2 --
 arch/nds32/lib/board.c           |    2 --
 arch/powerpc/lib/board.c         |    2 --
 arch/sandbox/lib/board.c         |    2 --
 arch/x86/lib/board.c             |    2 --
 common/cmd_nvedit.c              |    2 --
 common/fdt_support.c             |    4 ----
 common/iomux.c                   |    2 --
 common/stdio.c                   |    2 --
 include/common.h                 |   12 ------------
 include/serial.h                 |    2 +-
 post/board/pdm360ng/coproc_com.c |    3 ---
 15 files changed, 1 insertion(+), 42 deletions(-)

diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 109a1ac..0b47ab3 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -492,9 +492,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 #ifdef CONFIG_CLOCKS
 	set_cpu_clk_info(); /* Setup clock information */
 #endif
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 
 	debug("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
 
diff --git a/arch/blackfin/lib/board.c b/arch/blackfin/lib/board.c
index c380d27..0b31f37 100644
--- a/arch/blackfin/lib/board.c
+++ b/arch/blackfin/lib/board.c
@@ -284,9 +284,7 @@ void board_init_f(ulong bootflag)
 	init_baudrate();
 	serial_early_puts("Serial init\n");
 	serial_init();
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 	serial_early_puts("Console init flash\n");
 	console_init_f();
 	serial_early_puts("End of early debugging\n");
diff --git a/arch/m68k/lib/board.c b/arch/m68k/lib/board.c
index 2add630..67c9a13 100644
--- a/arch/m68k/lib/board.c
+++ b/arch/m68k/lib/board.c
@@ -401,9 +401,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
 	gd->flags |= GD_FLG_RELOC;	/* tell others: relocation done */
 
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 
 	debug ("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
 
diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c
index 674b573..efd63cd 100644
--- a/arch/microblaze/lib/board.c
+++ b/arch/microblaze/lib/board.c
@@ -108,9 +108,7 @@ void board_init_f(ulong not_used)
 	 */
 	mem_malloc_init (CONFIG_SYS_MALLOC_BASE, CONFIG_SYS_MALLOC_LEN);
 
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 
 	for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
 		WATCHDOG_RESET ();
diff --git a/arch/nds32/lib/board.c b/arch/nds32/lib/board.c
index 17d3ee0..89900fe 100644
--- a/arch/nds32/lib/board.c
+++ b/arch/nds32/lib/board.c
@@ -324,9 +324,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 		(ulong)(&__u_boot_cmd_end - &__u_boot_cmd_start));
 #endif /* defined(CONFIG_NEEDS_MANUAL_RELOC) */
 
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 
 	debug("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
 
diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
index 07feaf5..b860141 100644
--- a/arch/powerpc/lib/board.c
+++ b/arch/powerpc/lib/board.c
@@ -672,9 +672,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 	gd->env_addr += dest_addr - CONFIG_SYS_MONITOR_BASE;
 #endif
 
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 
 	debug("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
 
diff --git a/arch/sandbox/lib/board.c b/arch/sandbox/lib/board.c
index c173bf9..83858c1 100644
--- a/arch/sandbox/lib/board.c
+++ b/arch/sandbox/lib/board.c
@@ -220,9 +220,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 
 	gd->flags |= GD_FLG_RELOC;	/* tell others: relocation done */
 
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 
 #ifdef CONFIG_POST
 	post_output_backlog();
diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
index 90cf7fc..e5caf13 100644
--- a/arch/x86/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -150,9 +150,7 @@ init_fnc_t *init_sequence_r[] = {
 	timer_init,
 	display_banner,
 	display_dram_config,
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize_r,
-#endif
 #ifndef CONFIG_SYS_NO_FLASH
 	flash_init_r,
 #endif
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 3474bc6..1d67f20 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -237,10 +237,8 @@ int env_check_apply(const char *name, const char *oldval,
 		if (console_assign(console, newval) < 0)
 			return 1;
 
-#ifdef CONFIG_SERIAL_MULTI
 		if (serial_assign(newval) < 0)
 			return 1;
-#endif
 #endif /* CONFIG_CONSOLE_MUX */
 	}
 
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 593f16c..1b208af 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -94,7 +94,6 @@ int fdt_find_and_setprop(void *fdt, const char *node, const char *prop,
 
 #ifdef CONFIG_OF_STDOUT_VIA_ALIAS
 
-#ifdef CONFIG_SERIAL_MULTI
 static void fdt_fill_multisername(char *sername, size_t maxlen)
 {
 	const char *outname = stdio_devices[stdout]->name;
@@ -106,9 +105,6 @@ static void fdt_fill_multisername(char *sername, size_t maxlen)
 	if (strcmp(outname + 1, "serial") > 0)
 		strncpy(sername, outname + 1, maxlen);
 }
-#else
-static inline void fdt_fill_multisername(char *sername, size_t maxlen) {}
-#endif /* CONFIG_SERIAL_MULTI */
 
 static int fdt_fixup_stdout(void *fdt, int chosenoff)
 {
diff --git a/common/iomux.c b/common/iomux.c
index 91d98e9..dbc2312 100644
--- a/common/iomux.c
+++ b/common/iomux.c
@@ -135,7 +135,6 @@ int iomux_doenv(const int console, const char *arg)
 		 */
 		if (console_assign(console, start[j]) < 0)
 			continue;
-#ifdef CONFIG_SERIAL_MULTI
 		/*
 		 * This was taken from common/cmd_nvedit.c.
 		 * This will never work because serial_assign() returns
@@ -146,7 +145,6 @@ int iomux_doenv(const int console, const char *arg)
 		 */
 		if (serial_assign(start[j]) < 0)
 			continue;
-#endif
 		cons_set[cs_idx++] = dev;
 	}
 	free(console_args);
diff --git a/common/stdio.c b/common/stdio.c
index 1bf9ba0..605ff3f 100644
--- a/common/stdio.c
+++ b/common/stdio.c
@@ -227,9 +227,7 @@ int stdio_init (void)
 	drv_logbuff_init ();
 #endif
 	drv_system_init ();
-#ifdef CONFIG_SERIAL_MULTI
 	serial_stdio_init ();
-#endif
 #ifdef CONFIG_USB_TTY
 	drv_usbtty_init ();
 #endif
diff --git a/include/common.h b/include/common.h
index 55025c0..b52a8a4 100644
--- a/include/common.h
+++ b/include/common.h
@@ -194,18 +194,6 @@ typedef void (interrupt_handler_t)(void *);
 # endif
 #endif
 
-#ifndef CONFIG_SERIAL_MULTI
-
-#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2) \
- || defined(CONFIG_8xx_CONS_SCC1) || defined(CONFIG_8xx_CONS_SCC2) \
- || defined(CONFIG_8xx_CONS_SCC3) || defined(CONFIG_8xx_CONS_SCC4)
-
-#define CONFIG_SERIAL_MULTI	1
-
-#endif
-
-#endif /* CONFIG_SERIAL_MULTI */
-
 /*
  * General Purpose Utilities
  */
diff --git a/include/serial.h b/include/serial.h
index 01a86b4..a8d23f5 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -63,7 +63,7 @@ extern int usbtty_tstc(void);
 
 #endif /* CONFIG_USB_TTY */
 
-#if defined(CONFIG_MPC512X) &&  defined(CONFIG_SERIAL_MULTI)
+#if defined(CONFIG_MPC512X)
 extern struct stdio_dev *open_port(int num, int baudrate);
 extern int close_port(int num);
 extern int write_port(struct stdio_dev *port, char *buf);
diff --git a/post/board/pdm360ng/coproc_com.c b/post/board/pdm360ng/coproc_com.c
index 0755352..b7e02b5 100644
--- a/post/board/pdm360ng/coproc_com.c
+++ b/post/board/pdm360ng/coproc_com.c
@@ -28,8 +28,6 @@
 #include <post.h>
 #include <serial.h>
 
-#if defined(CONFIG_SERIAL_MULTI)
-
 /*
  * Actually the termination sequence of the coprocessor
  * commands is "\r\n" (CR LF), but here we use a side effect of
@@ -94,4 +92,3 @@ int coprocessor_post_test(int flags)
 
 	return 0;
 }
-#endif	/* CONFIG_SERIAL_MULTI */
-- 
1.7.10.4

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

* [U-Boot] [PATCH 69/70] serial: Compile common/serial.c by default
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (67 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 68/70] serial: Remove CONFIG_SERIAL_MULTI from remaining sources Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29  0:31   ` [U-Boot] [PATCH 70/70] serial: Enhance the manual relocation Marek Vasut
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Compile common/serial.c by default both into SPL and into non-SPL
builds, since CONFIG_SERIAL_MULTI is now the default state. Also
having common/serial.c in by default now, it's pointless to keep
-DCONFIG_SERIAL_MULTI in CPPFLAGS any longer, so remove it as well.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 common/Makefile |    2 +-
 config.mk       |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/Makefile b/common/Makefile
index 290ed02..907118c 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -202,7 +202,7 @@ COBJS-y += dlmalloc.o
 COBJS-y += image.o
 COBJS-y += memsize.o
 COBJS-y += stdio.o
-COBJS-$(CONFIG_SERIAL_MULTI) += serial.o
+COBJS-y += serial.o
 
 
 COBJS	:= $(sort $(COBJS-y))
diff --git a/config.mk b/config.mk
index 88c72f1..c3822a2 100644
--- a/config.mk
+++ b/config.mk
@@ -193,7 +193,7 @@ OBJCFLAGS += --gap-fill=0xff
 gccincdir := $(shell $(CC) -print-file-name=include)
 
 CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS)		\
-	-D__KERNEL__ -DCONFIG_SERIAL_MULTI
+	-D__KERNEL__
 
 # Enable garbage collection of un-used sections for SPL
 ifeq ($(CONFIG_SPL_BUILD),y)
-- 
1.7.10.4

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

* [U-Boot] [PATCH 70/70] serial: Enhance the manual relocation
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (68 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 69/70] serial: Compile common/serial.c by default Marek Vasut
@ 2012-09-29  0:31   ` Marek Vasut
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
  70 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29  0:31 UTC (permalink / raw)
  To: u-boot

Enhance the manual relocation of drivers operations structure by
checking if the entries are NULL and increment them only if they
are not. This allows for setting any entry to NULL and it will
survive the manual relocation.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 common/serial.c |   20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 91c7269..9550cbd 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -96,12 +96,20 @@ serial_initfunc(sh_serial_initialize);
 void serial_register(struct serial_device *dev)
 {
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
-	dev->start += gd->reloc_off;
-	dev->setbrg += gd->reloc_off;
-	dev->getc += gd->reloc_off;
-	dev->tstc += gd->reloc_off;
-	dev->putc += gd->reloc_off;
-	dev->puts += gd->reloc_off;
+	if (dev->start)
+		dev->start += gd->reloc_off;
+	if (dev->stop)
+		dev->stop += gd->reloc_off;
+	if (dev->setbrg)
+		dev->setbrg += gd->reloc_off;
+	if (dev->getc)
+		dev->getc += gd->reloc_off;
+	if (dev->tstc)
+		dev->tstc += gd->reloc_off;
+	if (dev->putc)
+		dev->putc += gd->reloc_off;
+	if (dev->puts)
+		dev->puts += gd->reloc_off;
 #endif
 
 	dev->next = serial_devices;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem
  2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
                     ` (69 preceding siblings ...)
  2012-09-29  0:31   ` [U-Boot] [PATCH 70/70] serial: Enhance the manual relocation Marek Vasut
@ 2012-09-29 21:51   ` Marek Vasut
  2012-09-29 21:51     ` [U-Boot] [PATCH 01/72] serial: Coding style cleanup of struct serial_device Marek Vasut
                       ` (73 more replies)
  70 siblings, 74 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:51 UTC (permalink / raw)
  To: u-boot

This patchset is a STAGE 1 of preparation of the stdio and serial subsys
for the driver model.

The idea of this patchset is:

1) Clean up the struct serial_device
   Do a coding style cleanup.
2) Replace .init and .uninit with .start and .stop
   This is to bring struct serial_device much closer to struct stdio_dev
   so later on, these structures can be overlayed and struct serial_device
   can be easily passed to stdio subsystem directly.
3) Do minor cleanups on the PXA and MPC512X
   Basically for PXA this means to remove default_serial_console() call
   from every single PXA board and move it into PXA serial driver. For
   MPC512X, that means properly defining PSC console number.
4) Add support for CONFIG_SERIAL_MULTI into every single driver
   Implement support for both non-multi and multi operation into every
   single serial driver in the U-Boot source tree. This is a vast majority
   of this patchset.
5) Unconditionally enable CONFIG_SERIAL_MULTI
   Enable the multi operation throughout the whole U-Boot tree, both for
   SPL and non-SPL builds. There was also some breakage due to this, so
   this patchset also addresses that with minor fixes.
6) Remove unused code used for the non-multi operation
   Remove code that was used when CONFIG_SERIAL_MULTI was not selected.
   Also remove all occurances of CONFIG_SERIAL_MULTI throughout the source
   tree. Some parts of the code must have been adjusted to cope with this
   since they were initially only written for non-multi operation. These
   were minor adjustments mostly in macros though.

This changeset obviously does mean size growth of U-Boot, therefore some
statistics (stock U-Boot first, patchset last):

Configuring for omap3_beagle board...
   text    data     bss     dec     hex filename
 325687    8456  266888  601031   92bc7 ./u-boot
 326912    8648  266944  602504   93188 ./u-boot
  43082    1812  198020  242914   3b4e2 ./spl/u-boot-spl
  45794    1860  198020  245674   3bfaa ./spl/u-boot-spl

Configuring for P1020RDB-PC_36BIT_SPIFLASH - Board: p1_p2_rdb_pc, Options: P1020RDB,36BIT,SPIFLASH
   text    data     bss     dec     hex filename
 392469   30628  267568  690665   a89e9 ./u-boot
 394550   30940  267600  693090   a9362 ./u-boot

Configuring for grsim_leon2 board...
   text    data     bss     dec     hex filename
  95658    3328    2640  101626   18cfa ./u-boot
  97058    3384    2640  103082   192aa ./u-boot

Configuring for sandbox board...
   text    data     bss     dec     hex filename
 137394    6364   28488  172246   2a0d6 ./u-boot
 138674    6456   28504  173634   2a642 ./u-boot

V2: Rebase on top of current -next
V3: - Fix problem with new SPL framework (2 new patches)
    - mv drivers/serial/serial{,-ns16550}.c to make clear
      what that driver really is [ 0065/0072 ]
    - Move common/serial.c do drivers/serial, since it really has
      to link with libserial.o, not libcommon.o [ 0066/0072 ]

Marek Vasut (72):
  serial: Coding style cleanup of struct serial_device
  serial: Rename .init() and .uninit() in serial_device
  serial: Properly spell out the structure member names of
    serial_driver
  serial: pxa: Implement default_serial_console in serial_pxa.c
  serial: pxa: Make use of default_serial_console in serial_pxa
  serial: pxa: Make local functions static
  serial: mpc512x: Properly define CONFIG_SYS_PSC3 in config files
  serial: Implement serial_initfunc() macro
  serial: mpc8xx: Move serial registration from serial_initialize()
  serial: s3c24xx: Move serial registration from serial_initialize()
  serial: pxa: Move serial registration from serial_initialize()
  serial: s5p: Move serial registration from serial_initialize()
  serial: microblaze: Move serial registration from serial_initialize()
  serial: mpc512x: Move serial registration from serial_initialize()
  serial: ns16550: Move serial registration from serial_initialize()
  serial: bfin: Remove the bfin_serialN_device exports from serial.h
  serial: bfin: Adjust serial_register_bfin_uart()
  serial: zoom2: Remove zoom2 serial prototypes from serial.h
  serial: bfin: Flip the jtag serial console to CONFIG_SERIAL_MULTI
  serial: mips: Implement CONFIG_SERIAL_MULTI into au1x00 serial driver
  serial: mips: Implement CONFIG_SERIAL_MULTI into asc serial driver
  serial: mips: Implement CONFIG_SERIAL_MULTI into JZ serial driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc5xx serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8220 serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8260 serial
    drivers
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc85xx serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into iop480 serial
    driver
  serial: sparc: Implement CONFIG_SERIAL_MULTI into leon2 serial driver
  serial: sparc: Implement CONFIG_SERIAL_MULTI into leon3 serial driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into marvell serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into amirix serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw serial driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into cogent serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into cpci750 serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into evb64260 serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into ml2 serial driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into sconsole serial
    driver
  serial: powerpc: Implement CONFIG_SERIAL_MULTI into p3mx serial
    driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into altera_jtag serial
    driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into altera serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into atmel serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into lpc32xx serial driver
  serial: mcf: Implement CONFIG_SERIAL_MULTI into MCF serial driver
  serial: Implement CONFIG_SERIAL_MULTI into ns9750 serial driver
  serial: oc: Implement CONFIG_SERIAL_MULTI into OpenCores serial
    driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into s3c4510b serial
    driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into s3c64xx serial driver
  serial: sandbox: Implement CONFIG_SERIAL_MULTI into sandbox serial
    driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into clps7111 serial
    driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into imx serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into ixp serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into ks8695 serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into lh7a40x serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into lpc2292 serial driver
  serial: Implement CONFIG_SERIAL_MULTI into max3100 serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into mxc serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into netarm serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into pl01x serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into s3c44b0 serial driver
  serial: arm: Implement CONFIG_SERIAL_MULTI into sa1100 serial driver
  serial: sh: Implement CONFIG_SERIAL_MULTI into sh serial driver
  serial: mxs: spl: Remove empty serial_* functions from SPL code
  serial: Use puts() and hang() instead of panic() in SPL
  serial: ns16550: Call usbtty_poll only in non-SPL build
  serial: ns16550: Rename serial.c to serial_ns16550.c
  serial: Move common/serial.c to drivers/serial/
  serial: Unconditionally enable CONFIG_SERIAL_MULTI
  serial: Remove CONFIG_SERIAL_MULTI from config files
  serial: Remove CONFIG_SERIAL_MULTI from serial drivers
  serial: Remove CONFIG_SERIAL_MULTI from remaining sources
  serial: Compile drivers/serial/serial.c by default
  serial: Enhance the manual relocation

 arch/arm/cpu/arm926ejs/mxs/spl_boot.c         |    4 -
 arch/arm/lib/board.c                          |    2 -
 arch/blackfin/cpu/jtag-console.c              |   37 +-
 arch/blackfin/cpu/serial.c                    |    6 +-
 arch/blackfin/lib/board.c                     |    2 -
 arch/m68k/lib/board.c                         |    2 -
 arch/microblaze/lib/board.c                   |    2 -
 arch/mips/cpu/mips32/au1x00/au1x00_serial.c   |   42 +-
 arch/mips/cpu/mips32/incaip/asc_serial.c      |   35 +-
 arch/mips/cpu/xburst/jz_serial.c              |   35 +-
 arch/nds32/lib/board.c                        |    2 -
 arch/powerpc/cpu/mpc512x/serial.c             |   92 ++---
 arch/powerpc/cpu/mpc5xx/serial.c              |   69 ++--
 arch/powerpc/cpu/mpc5xxx/serial.c             |  181 +++-----
 arch/powerpc/cpu/mpc8220/uart.c               |   35 +-
 arch/powerpc/cpu/mpc8260/serial_scc.c         |   39 +-
 arch/powerpc/cpu/mpc8260/serial_smc.c         |   39 +-
 arch/powerpc/cpu/mpc85xx/serial_scc.c         |   39 +-
 arch/powerpc/cpu/mpc8xx/serial.c              |   43 +-
 arch/powerpc/cpu/ppc4xx/iop480_uart.c         |   36 +-
 arch/powerpc/lib/board.c                      |    2 -
 arch/sandbox/lib/board.c                      |    2 -
 arch/sparc/cpu/leon2/serial.c                 |   51 ++-
 arch/sparc/cpu/leon3/serial.c                 |   51 ++-
 arch/x86/lib/board.c                          |    2 -
 board/Marvell/common/serial.c                 |   48 ++-
 board/amirix/ap1000/serial.c                  |   35 +-
 board/balloon3/balloon3.c                     |    5 -
 board/bmw/serial.c                            |   36 +-
 board/cogent/serial.c                         |   34 +-
 board/esd/cpci750/serial.c                    |   36 +-
 board/evb64260/serial.c                       |   54 ++-
 board/logicpd/zoom2/zoom2_serial.c            |    7 +-
 board/logicpd/zoom2/zoom2_serial.h            |   16 +-
 board/ml2/serial.c                            |   35 +-
 board/palmld/palmld.c                         |    5 -
 board/palmtc/palmtc.c                         |    5 -
 board/pcippc2/sconsole.c                      |   35 +-
 board/pdm360ng/pdm360ng.c                     |    6 -
 board/prodrive/p3mx/serial.c                  |   36 +-
 board/toradex/colibri_pxa270/colibri_pxa270.c |    5 -
 board/trizepsiv/conxs.c                       |    7 -
 board/vpac270/vpac270.c                       |    5 -
 board/zipitz2/zipitz2.c                       |    5 -
 common/Makefile                               |    1 -
 common/cmd_nvedit.c                           |    2 -
 common/fdt_support.c                          |    4 -
 common/iomux.c                                |    2 -
 common/serial.c                               |  305 --------------
 common/stdio.c                                |    2 -
 drivers/serial/Makefile                       |    4 +-
 drivers/serial/altera_jtag_uart.c             |   39 +-
 drivers/serial/altera_uart.c                  |   51 ++-
 drivers/serial/atmel_usart.c                  |   35 +-
 drivers/serial/lpc32xx_hsuart.c               |   57 ++-
 drivers/serial/mcfuart.c                      |   33 +-
 drivers/serial/ns16550.c                      |    2 +-
 drivers/serial/ns9750_serial.c                |   33 +-
 drivers/serial/opencores_yanu.c               |   35 +-
 drivers/serial/s3c4510b_uart.c                |   33 +-
 drivers/serial/s3c64xx.c                      |   33 +-
 drivers/serial/sandbox.c                      |   35 +-
 drivers/serial/serial.c                       |  550 +++++++++++++------------
 drivers/serial/serial_clps7111.c              |   34 +-
 drivers/serial/serial_imx.c                   |   36 +-
 drivers/serial/serial_ixp.c                   |   36 +-
 drivers/serial/serial_ks8695.c                |   41 +-
 drivers/serial/serial_lh7a40x.c               |   34 +-
 drivers/serial/serial_lpc2292.c               |   34 +-
 drivers/serial/serial_max3100.c               |   42 +-
 drivers/serial/serial_mxc.c                   |   40 +-
 drivers/serial/serial_netarm.c                |   33 +-
 drivers/serial/serial_ns16550.c               |  264 ++++++++++++
 drivers/serial/serial_pl01x.c                 |   37 +-
 drivers/serial/serial_pxa.c                   |   65 +--
 drivers/serial/serial_s3c24x0.c               |   78 +---
 drivers/serial/serial_s3c44b0.c               |   36 +-
 drivers/serial/serial_s5p.c                   |   27 +-
 drivers/serial/serial_sa1100.c                |   36 +-
 drivers/serial/serial_sh.c                    |   33 +-
 drivers/serial/serial_xuartlite.c             |   69 ++--
 include/common.h                              |   12 -
 include/configs/DU440.h                       |    1 -
 include/configs/KAREF.h                       |    1 -
 include/configs/METROBOX.h                    |    1 -
 include/configs/MPC8569MDS.h                  |    1 -
 include/configs/P1010RDB.h                    |    1 -
 include/configs/P1_P2_RDB.h                   |    1 -
 include/configs/P2020COME.h                   |    1 -
 include/configs/PMC440.h                      |    1 -
 include/configs/TB5200.h                      |    1 -
 include/configs/amcc-common.h                 |    1 -
 include/configs/aria.h                        |    1 +
 include/configs/balloon3.h                    |    1 +
 include/configs/bfin_adi_common.h             |    1 -
 include/configs/colibri_pxa270.h              |    1 +
 include/configs/coreboot.h                    |    1 -
 include/configs/eNET.h                        |    1 -
 include/configs/harmony.h                     |    1 -
 include/configs/jadecpu.h                     |    1 -
 include/configs/korat.h                       |    1 -
 include/configs/lubbock.h                     |    1 +
 include/configs/lwmon.h                       |    1 -
 include/configs/lwmon5.h                      |    1 -
 include/configs/mcc200.h                      |    5 -
 include/configs/mecp5123.h                    |    1 +
 include/configs/medcom.h                      |    1 -
 include/configs/mpc5121ads.h                  |    1 +
 include/configs/omap3_zoom2.h                 |    3 +-
 include/configs/origen.h                      |    1 -
 include/configs/palmld.h                      |    1 +
 include/configs/palmtc.h                      |    1 +
 include/configs/paz00.h                       |    1 -
 include/configs/pcs440ep.h                    |    1 -
 include/configs/pdm360ng.h                    |    3 -
 include/configs/plutux.h                      |    1 -
 include/configs/pxa255_idp.h                  |    1 +
 include/configs/quad100hd.h                   |    1 -
 include/configs/s5p_goni.h                    |    1 -
 include/configs/s5pc210_universal.h           |    1 -
 include/configs/sc3.h                         |    1 -
 include/configs/seaboard.h                    |    1 -
 include/configs/smdk5250.h                    |    1 -
 include/configs/smdkc100.h                    |    1 -
 include/configs/smdkv310.h                    |    1 -
 include/configs/tec.h                         |    1 -
 include/configs/tegra-common-post.h           |    5 -
 include/configs/trats.h                       |    1 -
 include/configs/trimslice.h                   |    1 -
 include/configs/trizepsiv.h                   |    2 +-
 include/configs/ventana.h                     |    1 -
 include/configs/vpac270.h                     |    1 +
 include/configs/whistler.h                    |    1 -
 include/configs/xaeniax.h                     |    2 +-
 include/configs/zeus.h                        |    1 -
 include/configs/zipitz2.h                     |    1 +
 include/serial.h                              |   79 +---
 post/board/pdm360ng/coproc_com.c              |    3 -
 138 files changed, 2111 insertions(+), 1547 deletions(-)
 delete mode 100644 common/serial.c
 create mode 100644 drivers/serial/serial_ns16550.c

Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Michal Simek <monstr@monstr.eu>
Cc: U-Boot DM <u-boot-dm@lists.denx.de>

-- 
1.7.10.4

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

* [U-Boot] [PATCH 01/72] serial: Coding style cleanup of struct serial_device
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
@ 2012-09-29 21:51     ` Marek Vasut
  2012-09-29 21:51     ` [U-Boot] [PATCH 02/72] serial: Rename .init() and .uninit() in serial_device Marek Vasut
                       ` (72 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:51 UTC (permalink / raw)
  To: u-boot

Do a simple cleanup of the struct serial_device and align it with
current coding style. Checkpatch now reports no errors.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 include/serial.h |   23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/include/serial.h b/include/serial.h
index d76d6df..5e4e922 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -5,20 +5,19 @@
 
 struct serial_device {
 	/* enough bytes to match alignment of following func pointer */
-	char name[16];
-
-	int  (*init) (void);
-	int  (*uninit) (void);
-	void (*setbrg) (void);
-	int (*getc) (void);
-	int (*tstc) (void);
-	void (*putc) (const char c);
-	void (*puts) (const char *s);
+	char	name[16];
+
+	int	(*init)(void);
+	int	(*uninit)(void);
+	void	(*setbrg)(void);
+	int	(*getc)(void);
+	int	(*tstc)(void);
+	void	(*putc)(const char c);
+	void	(*puts)(const char *s);
 #if CONFIG_POST & CONFIG_SYS_POST_UART
-	void (*loop) (int);
+	void	(*loop)(int);
 #endif
-
-	struct serial_device *next;
+	struct serial_device	*next;
 };
 
 extern struct serial_device serial_smc_device;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 02/72] serial: Rename .init() and .uninit() in serial_device
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
  2012-09-29 21:51     ` [U-Boot] [PATCH 01/72] serial: Coding style cleanup of struct serial_device Marek Vasut
@ 2012-09-29 21:51     ` Marek Vasut
  2012-09-29 21:51     ` [U-Boot] [PATCH 03/72] serial: Properly spell out the structure member names of serial_driver Marek Vasut
                       ` (71 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:51 UTC (permalink / raw)
  To: u-boot

Rename .init() to .start() and .uninit() to .stop() in struct
serial_device. This allows aligning struct serial_device with
closer to struct stdio_dev. The real goal here is to allow
these two structures to converge together and eventually make
one to be a superset of the other.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 arch/blackfin/cpu/serial.c |    4 ++--
 common/serial.c            |   16 ++++++++--------
 include/serial.h           |    4 ++--
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/blackfin/cpu/serial.c b/arch/blackfin/cpu/serial.c
index 6603dc0..33677ba 100644
--- a/arch/blackfin/cpu/serial.c
+++ b/arch/blackfin/cpu/serial.c
@@ -236,8 +236,8 @@ static void uart##n##_loop(int state) \
 \
 struct serial_device bfin_serial##n##_device = { \
 	.name   = "bfin_uart"#n, \
-	.init   = uart##n##_init, \
-	.uninit = uart##n##_uninit, \
+	.start  = uart##n##_init, \
+	.stop   = uart##n##_uninit, \
 	.setbrg = uart##n##_setbrg, \
 	.getc   = uart##n##_getc, \
 	.tstc   = uart##n##_tstc, \
diff --git a/common/serial.c b/common/serial.c
index 75cc1bb..5740d4f 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -35,7 +35,7 @@ static struct serial_device *serial_current;
 void serial_register(struct serial_device *dev)
 {
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
-	dev->init += gd->reloc_off;
+	dev->start += gd->reloc_off;
 	dev->setbrg += gd->reloc_off;
 	dev->getc += gd->reloc_off;
 	dev->tstc += gd->reloc_off;
@@ -136,8 +136,8 @@ void serial_stdio_init(void)
 		strcpy(dev.name, s->name);
 		dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT;
 
-		dev.start = s->init;
-		dev.stop = s->uninit;
+		dev.start = s->start;
+		dev.stop = s->stop;
 		dev.putc = s->putc;
 		dev.puts = s->puts;
 		dev.getc = s->getc;
@@ -168,7 +168,7 @@ void serial_reinit_all(void)
 	struct serial_device *s;
 
 	for (s = serial_devices; s; s = s->next)
-		s->init();
+		s->start();
 }
 
 static struct serial_device *get_current(void)
@@ -188,7 +188,7 @@ static struct serial_device *get_current(void)
 
 int serial_init(void)
 {
-	return get_current()->init();
+	return get_current()->start();
 }
 
 void serial_setbrg(void)
@@ -288,9 +288,9 @@ int uart_post_test(int flags)
 		/* Disable loop back */
 		s->loop(0);
 
-		/* XXX: There is no serial_uninit() !? */
-		if (s->uninit)
-			s->uninit();
+		/* XXX: There is no serial_stop() !? */
+		if (s->stop)
+			s->stop();
 	}
 
  done:
diff --git a/include/serial.h b/include/serial.h
index 5e4e922..4d19259 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -7,8 +7,8 @@ struct serial_device {
 	/* enough bytes to match alignment of following func pointer */
 	char	name[16];
 
-	int	(*init)(void);
-	int	(*uninit)(void);
+	int	(*start)(void);
+	int	(*stop)(void);
 	void	(*setbrg)(void);
 	int	(*getc)(void);
 	int	(*tstc)(void);
-- 
1.7.10.4

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

* [U-Boot] [PATCH 03/72] serial: Properly spell out the structure member names of serial_driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
  2012-09-29 21:51     ` [U-Boot] [PATCH 01/72] serial: Coding style cleanup of struct serial_device Marek Vasut
  2012-09-29 21:51     ` [U-Boot] [PATCH 02/72] serial: Rename .init() and .uninit() in serial_device Marek Vasut
@ 2012-09-29 21:51     ` Marek Vasut
  2012-09-29 21:51     ` [U-Boot] [PATCH 04/72] serial: pxa: Implement default_serial_console in serial_pxa.c Marek Vasut
                       ` (70 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:51 UTC (permalink / raw)
  To: u-boot

Properly spell out the whole structure member names when an initialized
varible is instantiated from the struct serial_driver. In case the
structure definition for struct serial_driver undergoes reordering,
there will be no impact on variables defined based on this structure.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: C Nauman <cnauman@diagraph.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Michal Simek <monstr@monstr.eu>
---
 arch/powerpc/cpu/mpc512x/serial.c  |   18 +++++++++---------
 arch/powerpc/cpu/mpc5xxx/serial.c  |   32 ++++++++++++++++----------------
 arch/powerpc/cpu/mpc8xx/serial.c   |   32 ++++++++++++++++----------------
 board/logicpd/zoom2/zoom2_serial.h |   16 ++++++++--------
 drivers/serial/serial.c            |   19 ++++++++++---------
 drivers/serial/serial_pxa.c        |   16 ++++++++--------
 drivers/serial/serial_s3c24x0.c    |   18 +++++++++---------
 drivers/serial/serial_s5p.c        |   19 ++++++++++---------
 drivers/serial/serial_xuartlite.c  |   19 ++++++++++---------
 9 files changed, 96 insertions(+), 93 deletions(-)

diff --git a/arch/powerpc/cpu/mpc512x/serial.c b/arch/powerpc/cpu/mpc512x/serial.c
index 7c53346..f4f52ad 100644
--- a/arch/powerpc/cpu/mpc512x/serial.c
+++ b/arch/powerpc/cpu/mpc512x/serial.c
@@ -319,15 +319,15 @@ int serial_getcts_dev(unsigned int idx)
 		serial_puts_dev(port, s); \
 	}
 
-#define INIT_PSC_SERIAL_STRUCTURE(port, name) { \
-	name, \
-	serial##port##_init, \
-	serial##port##_uninit, \
-	serial##port##_setbrg, \
-	serial##port##_getc, \
-	serial##port##_tstc, \
-	serial##port##_putc, \
-	serial##port##_puts, \
+#define INIT_PSC_SERIAL_STRUCTURE(port, __name) {	\
+	.name	= __name,				\
+	.start	= serial##port##_init,			\
+	.stop	= serial##port##_uninit,		\
+	.setbrg	= serial##port##_setbrg,		\
+	.getc	= serial##port##_getc,			\
+	.tstc	= serial##port##_tstc,			\
+	.putc	= serial##port##_putc,			\
+	.puts	= serial##port##_puts,			\
 }
 
 #if defined(CONFIG_SYS_PSC1)
diff --git a/arch/powerpc/cpu/mpc5xxx/serial.c b/arch/powerpc/cpu/mpc5xxx/serial.c
index aa09f67..9bebff8 100644
--- a/arch/powerpc/cpu/mpc5xxx/serial.c
+++ b/arch/powerpc/cpu/mpc5xxx/serial.c
@@ -338,14 +338,14 @@ int serial1_tstc(void)
 
 struct serial_device serial0_device =
 {
-	"serial0",
-	serial0_init,
-	NULL,
-	serial0_setbrg,
-	serial0_getc,
-	serial0_tstc,
-	serial0_putc,
-	serial0_puts,
+	.name	= "serial0",
+	.start	= serial0_init,
+	.stop	= NULL,
+	.setbrg	= serial0_setbrg,
+	.getc	= serial0_getc,
+	.tstc	= serial0_tstc,
+	.putc	= serial0_putc,
+	.puts	= serial0_puts,
 };
 
 __weak struct serial_device *default_serial_console(void)
@@ -355,14 +355,14 @@ __weak struct serial_device *default_serial_console(void)
 
 struct serial_device serial1_device =
 {
-	"serial1",
-	serial1_init,
-	NULL,
-	serial1_setbrg,
-	serial1_getc,
-	serial1_tstc,
-	serial1_putc,
-	serial1_puts,
+	.name	= "serial1",
+	.start	= serial1_init,
+	.stop	= NULL,
+	.setbrg	= serial1_setbrg,
+	.getc	= serial1_getc,
+	.tstc	= serial1_tstc,
+	.putc	= serial1_putc,
+	.puts	= serial1_puts,
 };
 #endif /* CONFIG_SERIAL_MULTI */
 
diff --git a/arch/powerpc/cpu/mpc8xx/serial.c b/arch/powerpc/cpu/mpc8xx/serial.c
index 9239b24..dc9b323 100644
--- a/arch/powerpc/cpu/mpc8xx/serial.c
+++ b/arch/powerpc/cpu/mpc8xx/serial.c
@@ -390,14 +390,14 @@ smc_tstc(void)
 
 struct serial_device serial_smc_device =
 {
-	"serial_smc",
-	smc_init,
-	NULL,
-	smc_setbrg,
-	smc_getc,
-	smc_tstc,
-	smc_putc,
-	smc_puts,
+	.name	= "serial_smc",
+	.start	= smc_init,
+	.stop	= NULL,
+	.setbrg	= smc_setbrg,
+	.getc	= smc_getc,
+	.tstc	= smc_tstc,
+	.putc	= smc_putc,
+	.puts	= smc_puts,
 };
 
 #endif /* CONFIG_8xx_CONS_SMC1 || CONFIG_8xx_CONS_SMC2 */
@@ -660,14 +660,14 @@ scc_tstc(void)
 
 struct serial_device serial_scc_device =
 {
-	"serial_scc",
-	scc_init,
-	NULL,
-	scc_setbrg,
-	scc_getc,
-	scc_tstc,
-	scc_putc,
-	scc_puts,
+	.name	= "serial_scc",
+	.start	= scc_init,
+	.stop	= NULL,
+	.setbrg	= scc_setbrg,
+	.getc	= scc_getc,
+	.tstc	= scc_tstc,
+	.putc	= scc_putc,
+	.puts	= scc_puts,
 };
 
 #endif	/* CONFIG_8xx_CONS_SCCx */
diff --git a/board/logicpd/zoom2/zoom2_serial.h b/board/logicpd/zoom2/zoom2_serial.h
index 4e30587..61306be 100644
--- a/board/logicpd/zoom2/zoom2_serial.h
+++ b/board/logicpd/zoom2/zoom2_serial.h
@@ -61,14 +61,14 @@ int quad_tstc_##n(void)				\
 }						\
 struct serial_device zoom2_serial_device##n =	\
 {						\
-	N(n),					\
-	quad_init_##n,				\
-	NULL,					\
-	quad_setbrg_##n,			\
-	quad_getc_##n,				\
-	quad_tstc_##n,				\
-	quad_putc_##n,				\
-	quad_puts_##n,				\
+	.name	= N(n),				\
+	.start	= quad_init_##n,		\
+	.stop	= NULL,				\
+	.setbrg	= quad_setbrg_##n,		\
+	.getc	= quad_getc_##n,		\
+	.tstc	= quad_tstc_##n,		\
+	.putc	= quad_putc_##n,		\
+	.puts	= quad_puts_##n,		\
 };
 
 #endif /* ZOOM2_SERIAL_H */
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index b10bab7..9d92dee 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -106,15 +106,16 @@ static NS16550_t serial_ports[4] = {
 	serial_puts_dev(port, s);}
 
 /* Serial device descriptor */
-#define INIT_ESERIAL_STRUCTURE(port, name) {\
-	name,\
-	eserial##port##_init,\
-	NULL,\
-	eserial##port##_setbrg,\
-	eserial##port##_getc,\
-	eserial##port##_tstc,\
-	eserial##port##_putc,\
-	eserial##port##_puts, }
+#define INIT_ESERIAL_STRUCTURE(port, __name) {	\
+	.name	= __name,			\
+	.start	= eserial##port##_init,		\
+	.stop	= NULL,				\
+	.setbrg	= eserial##port##_setbrg,	\
+	.getc	= eserial##port##_getc,		\
+	.tstc	= eserial##port##_tstc,		\
+	.putc	= eserial##port##_putc,		\
+	.puts	= eserial##port##_puts,		\
+}
 
 #endif /* CONFIG_SERIAL_MULTI */
 
diff --git a/drivers/serial/serial_pxa.c b/drivers/serial/serial_pxa.c
index a9976d7..97e3f36 100644
--- a/drivers/serial/serial_pxa.c
+++ b/drivers/serial/serial_pxa.c
@@ -269,14 +269,14 @@ void pxa_puts_dev(unsigned int uart_index, const char *s)
 #define	pxa_uart_desc(uart)						\
 	struct serial_device serial_##uart##_device =			\
 	{								\
-		"serial_"#uart,						\
-		uart##_init,						\
-		NULL,							\
-		uart##_setbrg,						\
-		uart##_getc,						\
-		uart##_tstc,						\
-		uart##_putc,						\
-		uart##_puts,						\
+		.name	= "serial_"#uart,				\
+		.start	= uart##_init,					\
+		.stop	= NULL,						\
+		.setbrg	= uart##_setbrg,				\
+		.getc	= uart##_getc,					\
+		.tstc	= uart##_tstc,					\
+		.putc	= uart##_putc,					\
+		.puts	= uart##_puts,					\
 	};
 
 #define	pxa_uart_multi(uart, UART)					\
diff --git a/drivers/serial/serial_s3c24x0.c b/drivers/serial/serial_s3c24x0.c
index 12bcdd3..fa6aac0 100644
--- a/drivers/serial/serial_s3c24x0.c
+++ b/drivers/serial/serial_s3c24x0.c
@@ -69,15 +69,15 @@ DECLARE_GLOBAL_DATA_PTR;
 		serial_puts_dev(port, s); \
 	}
 
-#define INIT_S3C_SERIAL_STRUCTURE(port, name) { \
-	name, \
-	s3serial##port##_init, \
-	NULL,\
-	s3serial##port##_setbrg, \
-	s3serial##port##_getc, \
-	s3serial##port##_tstc, \
-	s3serial##port##_putc, \
-	s3serial##port##_puts, \
+#define INIT_S3C_SERIAL_STRUCTURE(port, __name) {	\
+	.name	= __name,				\
+	.start	= s3serial##port##_init,		\
+	.stop	= NULL,					\
+	.setbrg	= s3serial##port##_setbrg,		\
+	.getc	= s3serial##port##_getc,		\
+	.tstc	= s3serial##port##_tstc,		\
+	.putc	= s3serial##port##_putc,		\
+	.puts	= s3serial##port##_puts,		\
 }
 
 #endif /* CONFIG_SERIAL_MULTI */
diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c
index 6819bb0..43cbc4f 100644
--- a/drivers/serial/serial_s5p.c
+++ b/drivers/serial/serial_s5p.c
@@ -183,15 +183,16 @@ int s5p_serial##port##_tstc(void) { return serial_tstc_dev(port); } \
 void s5p_serial##port##_putc(const char c) { serial_putc_dev(c, port); } \
 void s5p_serial##port##_puts(const char *s) { serial_puts_dev(s, port); }
 
-#define INIT_S5P_SERIAL_STRUCTURE(port, name) { \
-	name, \
-	s5p_serial##port##_init, \
-	NULL, \
-	s5p_serial##port##_setbrg, \
-	s5p_serial##port##_getc, \
-	s5p_serial##port##_tstc, \
-	s5p_serial##port##_putc, \
-	s5p_serial##port##_puts, }
+#define INIT_S5P_SERIAL_STRUCTURE(port, __name) {	\
+	.name	= __name,				\
+	.start	= s5p_serial##port##_init,		\
+	.stop	= NULL,					\
+	.setbrg	= s5p_serial##port##_setbrg,		\
+	.getc	= s5p_serial##port##_getc,		\
+	.tstc	= s5p_serial##port##_tstc,		\
+	.putc	= s5p_serial##port##_putc,		\
+	.puts	= s5p_serial##port##_puts,		\
+}
 
 DECLARE_S5P_SERIAL_FUNCTIONS(0);
 struct serial_device s5p_serial0_device =
diff --git a/drivers/serial/serial_xuartlite.c b/drivers/serial/serial_xuartlite.c
index 2bdb68b..b3bb066 100644
--- a/drivers/serial/serial_xuartlite.c
+++ b/drivers/serial/serial_xuartlite.c
@@ -144,15 +144,16 @@ int serial_tstc(void)
 				{ uartlite_serial_puts(s, port); }
 
 /* Serial device descriptor */
-#define INIT_ESERIAL_STRUCTURE(port, name) {\
-	name,\
-	userial##port##_init,\
-	NULL,\
-	userial##port##_setbrg,\
-	userial##port##_getc,\
-	userial##port##_tstc,\
-	userial##port##_putc,\
-	userial##port##_puts, }
+#define INIT_ESERIAL_STRUCTURE(port, __name) {	\
+	.name	= __name,			\
+	.start	= userial##port##_init,		\
+	.stop	= NULL,				\
+	.setbrg	= userial##port##_setbrg,	\
+	.getc	= userial##port##_getc,		\
+	.tstc	= userial##port##_tstc,		\
+	.putc	= userial##port##_putc,		\
+	.puts	= userial##port##_puts,		\
+}
 
 DECLARE_ESERIAL_FUNCTIONS(0);
 struct serial_device uartlite_serial0_device =
-- 
1.7.10.4

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

* [U-Boot] [PATCH 04/72] serial: pxa: Implement default_serial_console in serial_pxa.c
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (2 preceding siblings ...)
  2012-09-29 21:51     ` [U-Boot] [PATCH 03/72] serial: Properly spell out the structure member names of serial_driver Marek Vasut
@ 2012-09-29 21:51     ` Marek Vasut
  2012-09-29 21:51     ` [U-Boot] [PATCH 05/72] serial: pxa: Make use of default_serial_console in serial_pxa Marek Vasut
                       ` (69 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:51 UTC (permalink / raw)
  To: u-boot

Implement weak default_serial_console() function in serial_pxa
driver, which gets available in case CONFIG_SERIAL_MULTI is
enabled. This will get helpful in subsequent patches, which will
encapsulate PXA's struct serial_device instances in serial_pxa
driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 drivers/serial/serial_pxa.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/serial/serial_pxa.c b/drivers/serial/serial_pxa.c
index 97e3f36..ad2d77e 100644
--- a/drivers/serial/serial_pxa.c
+++ b/drivers/serial/serial_pxa.c
@@ -36,6 +36,7 @@
 #include <asm/arch/pxa-regs.h>
 #include <asm/arch/regs-uart.h>
 #include <asm/io.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -298,4 +299,19 @@ void pxa_puts_dev(unsigned int uart_index, const char *s)
 
 #ifndef	CONFIG_SERIAL_MULTI
 	pxa_uart(serial, UART)
+#else
+__weak struct serial_device *default_serial_console(void)
+{
+#if CONFIG_CONS_INDEX == 1
+	return &serial_hwuart_device;
+#elif CONFIG_CONS_INDEX == 2
+	return &serial_stuart_device;
+#elif CONFIG_CONS_INDEX == 3
+	return &serial_ffuart_device;
+#elif CONFIG_CONS_INDEX == 4
+	return &serial_btuart_device;
+#else
+#error "Bad CONFIG_CONS_INDEX."
+#endif
+}
 #endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 05/72] serial: pxa: Make use of default_serial_console in serial_pxa
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (3 preceding siblings ...)
  2012-09-29 21:51     ` [U-Boot] [PATCH 04/72] serial: pxa: Implement default_serial_console in serial_pxa.c Marek Vasut
@ 2012-09-29 21:51     ` Marek Vasut
  2012-09-29 21:51     ` [U-Boot] [PATCH 06/72] serial: pxa: Make local functions static Marek Vasut
                       ` (68 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:51 UTC (permalink / raw)
  To: u-boot

Make use of the newly implemented weak default_serial_console in
the serial_pxa driver. This removes all reimplementations of this
function from board files.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 board/balloon3/balloon3.c                     |    5 -----
 board/palmld/palmld.c                         |    5 -----
 board/palmtc/palmtc.c                         |    5 -----
 board/toradex/colibri_pxa270/colibri_pxa270.c |    5 -----
 board/trizepsiv/conxs.c                       |    5 -----
 board/vpac270/vpac270.c                       |    5 -----
 board/zipitz2/zipitz2.c                       |    5 -----
 include/configs/balloon3.h                    |    1 +
 include/configs/colibri_pxa270.h              |    1 +
 include/configs/lubbock.h                     |    1 +
 include/configs/palmld.h                      |    1 +
 include/configs/palmtc.h                      |    1 +
 include/configs/pxa255_idp.h                  |    1 +
 include/configs/trizepsiv.h                   |    1 +
 include/configs/vpac270.h                     |    1 +
 include/configs/xaeniax.h                     |    2 +-
 include/configs/zipitz2.h                     |    1 +
 17 files changed, 10 insertions(+), 36 deletions(-)

diff --git a/board/balloon3/balloon3.c b/board/balloon3/balloon3.c
index f360323..c934988 100644
--- a/board/balloon3/balloon3.c
+++ b/board/balloon3/balloon3.c
@@ -53,11 +53,6 @@ int board_init(void)
 	return 0;
 }
 
-struct serial_device *default_serial_console(void)
-{
-	return &serial_stuart_device;
-}
-
 int dram_init(void)
 {
 	pxa2xx_dram_init();
diff --git a/board/palmld/palmld.c b/board/palmld/palmld.c
index 2f1ad20..57b4f5f 100644
--- a/board/palmld/palmld.c
+++ b/board/palmld/palmld.c
@@ -52,11 +52,6 @@ int board_init(void)
 	return 0;
 }
 
-struct serial_device *default_serial_console(void)
-{
-	return &serial_ffuart_device;
-}
-
 int dram_init(void)
 {
 	pxa2xx_dram_init();
diff --git a/board/palmtc/palmtc.c b/board/palmtc/palmtc.c
index 4adf152..b23eec8 100644
--- a/board/palmtc/palmtc.c
+++ b/board/palmtc/palmtc.c
@@ -51,11 +51,6 @@ int board_init(void)
 	return 0;
 }
 
-struct serial_device *default_serial_console(void)
-{
-	return &serial_ffuart_device;
-}
-
 int dram_init(void)
 {
 	pxa2xx_dram_init();
diff --git a/board/toradex/colibri_pxa270/colibri_pxa270.c b/board/toradex/colibri_pxa270/colibri_pxa270.c
index d72e5d6..a6e13c8 100644
--- a/board/toradex/colibri_pxa270/colibri_pxa270.c
+++ b/board/toradex/colibri_pxa270/colibri_pxa270.c
@@ -29,11 +29,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-struct serial_device *default_serial_console(void)
-{
-	return &serial_ffuart_device;
-}
-
 int board_init(void)
 {
 	/* We have RAM, disable cache */
diff --git a/board/trizepsiv/conxs.c b/board/trizepsiv/conxs.c
index 1291195..8fc3c40 100644
--- a/board/trizepsiv/conxs.c
+++ b/board/trizepsiv/conxs.c
@@ -135,11 +135,6 @@ int board_late_init(void)
 	return 0;
 }
 
-struct serial_device *default_serial_console (void)
-{
-	return &serial_ffuart_device;
-}
-
 int dram_init(void)
 {
 	pxa2xx_dram_init();
diff --git a/board/vpac270/vpac270.c b/board/vpac270/vpac270.c
index dfdab9b..2663534 100644
--- a/board/vpac270/vpac270.c
+++ b/board/vpac270/vpac270.c
@@ -50,11 +50,6 @@ int board_init(void)
 	return 0;
 }
 
-struct serial_device *default_serial_console(void)
-{
-	return &serial_ffuart_device;
-}
-
 int dram_init(void)
 {
 #ifndef	CONFIG_ONENAND
diff --git a/board/zipitz2/zipitz2.c b/board/zipitz2/zipitz2.c
index 82dfa82..579841d 100644
--- a/board/zipitz2/zipitz2.c
+++ b/board/zipitz2/zipitz2.c
@@ -62,11 +62,6 @@ int board_init (void)
 	return 0;
 }
 
-struct serial_device *default_serial_console (void)
-{
-	return &serial_stuart_device;
-}
-
 int dram_init(void)
 {
 	pxa2xx_dram_init();
diff --git a/include/configs/balloon3.h b/include/configs/balloon3.h
index 756f409..0f26a5b 100644
--- a/include/configs/balloon3.h
+++ b/include/configs/balloon3.h
@@ -53,6 +53,7 @@
  */
 #define	CONFIG_PXA_SERIAL
 #define	CONFIG_STUART			1
+#define CONFIG_CONS_INDEX		2
 #define	CONFIG_BAUDRATE			115200
 
 /*
diff --git a/include/configs/colibri_pxa270.h b/include/configs/colibri_pxa270.h
index ae84344..bb8bea7 100644
--- a/include/configs/colibri_pxa270.h
+++ b/include/configs/colibri_pxa270.h
@@ -55,6 +55,7 @@
  */
 #define	CONFIG_PXA_SERIAL
 #define	CONFIG_FFUART			1
+#define CONFIG_CONS_INDEX		3
 #define	CONFIG_BAUDRATE			115200
 
 /*
diff --git a/include/configs/lubbock.h b/include/configs/lubbock.h
index 0a1d1e0..ed64960 100644
--- a/include/configs/lubbock.h
+++ b/include/configs/lubbock.h
@@ -64,6 +64,7 @@
  */
 #define CONFIG_PXA_SERIAL
 #define CONFIG_FFUART	       1       /* we use FFUART on LUBBOCK */
+#define CONFIG_CONS_INDEX	3
 
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
diff --git a/include/configs/palmld.h b/include/configs/palmld.h
index 835121e..c5dd494 100644
--- a/include/configs/palmld.h
+++ b/include/configs/palmld.h
@@ -54,6 +54,7 @@
  */
 #define	CONFIG_PXA_SERIAL
 #define	CONFIG_FFUART			1
+#define CONFIG_CONS_INDEX		3
 #define	CONFIG_BAUDRATE			9600
 
 /*
diff --git a/include/configs/palmtc.h b/include/configs/palmtc.h
index bc88354..6e8d8e9 100644
--- a/include/configs/palmtc.h
+++ b/include/configs/palmtc.h
@@ -58,6 +58,7 @@
  */
 #define	CONFIG_PXA_SERIAL
 #define	CONFIG_FFUART			1
+#define CONFIG_CONS_INDEX		3
 #define	CONFIG_BAUDRATE			115200
 
 /*
diff --git a/include/configs/pxa255_idp.h b/include/configs/pxa255_idp.h
index ce9e7d1..24c5363 100644
--- a/include/configs/pxa255_idp.h
+++ b/include/configs/pxa255_idp.h
@@ -99,6 +99,7 @@
  */
 #define CONFIG_PXA_SERIAL
 #define CONFIG_FFUART	       1       /* we use FFUART on LUBBOCK */
+#define CONFIG_CONS_INDEX	3
 
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
diff --git a/include/configs/trizepsiv.h b/include/configs/trizepsiv.h
index 151059a..47c6a23 100644
--- a/include/configs/trizepsiv.h
+++ b/include/configs/trizepsiv.h
@@ -68,6 +68,7 @@
 #define CONFIG_FFUART	       1       /* we use FFUART on Conxs */
 #define CONFIG_BTUART	       1       /* we use BTUART on Conxs */
 #define CONFIG_STUART	       1       /* we use STUART on Conxs */
+#define CONFIG_CONS_INDEX	3
 
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
diff --git a/include/configs/vpac270.h b/include/configs/vpac270.h
index 424a902..5e948f9 100644
--- a/include/configs/vpac270.h
+++ b/include/configs/vpac270.h
@@ -75,6 +75,7 @@
  */
 #define	CONFIG_PXA_SERIAL
 #define	CONFIG_FFUART			1
+#define CONFIG_CONS_INDEX		3
 #define	CONFIG_BAUDRATE			115200
 
 /*
diff --git a/include/configs/xaeniax.h b/include/configs/xaeniax.h
index e399e95..eee2547 100644
--- a/include/configs/xaeniax.h
+++ b/include/configs/xaeniax.h
@@ -54,7 +54,7 @@
  */
 #define CONFIG_PXA_SERIAL
 #define CONFIG_BTUART	       1       /* we use BTUART on XAENIAX */
-
+#define CONFIG_CONS_INDEX	4
 
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
diff --git a/include/configs/zipitz2.h b/include/configs/zipitz2.h
index 8b7e05b..bf6394a 100644
--- a/include/configs/zipitz2.h
+++ b/include/configs/zipitz2.h
@@ -66,6 +66,7 @@
  */
 #define	CONFIG_PXA_SERIAL
 #define	CONFIG_STUART			1
+#define CONFIG_CONS_INDEX		2
 #define	CONFIG_BAUDRATE			115200
 
 /*
-- 
1.7.10.4

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

* [U-Boot] [PATCH 06/72] serial: pxa: Make local functions static
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (4 preceding siblings ...)
  2012-09-29 21:51     ` [U-Boot] [PATCH 05/72] serial: pxa: Make use of default_serial_console in serial_pxa Marek Vasut
@ 2012-09-29 21:51     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 07/72] serial: mpc512x: Properly define CONFIG_SYS_PSC3 in config files Marek Vasut
                       ` (67 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:51 UTC (permalink / raw)
  To: u-boot

Make functions that are local-only static, so no hairy symbols
stick out of the serial_pxa driver file.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 drivers/serial/serial_pxa.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/serial/serial_pxa.c b/drivers/serial/serial_pxa.c
index ad2d77e..bd3b3cf 100644
--- a/drivers/serial/serial_pxa.c
+++ b/drivers/serial/serial_pxa.c
@@ -87,7 +87,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #endif
 #endif
 
-uint32_t pxa_uart_get_baud_divider(void)
+static uint32_t pxa_uart_get_baud_divider(void)
 {
 	if (gd->baudrate == 1200)
 		return 768;
@@ -105,7 +105,7 @@ uint32_t pxa_uart_get_baud_divider(void)
 		return 0;
 }
 
-struct pxa_uart_regs *pxa_uart_index_to_regs(uint32_t uart_index)
+static struct pxa_uart_regs *pxa_uart_index_to_regs(uint32_t uart_index)
 {
 	switch (uart_index) {
 	case FFUART_INDEX: return (struct pxa_uart_regs *)FFUART_BASE;
@@ -117,7 +117,7 @@ struct pxa_uart_regs *pxa_uart_index_to_regs(uint32_t uart_index)
 	}
 }
 
-void pxa_uart_toggle_clock(uint32_t uart_index, int enable)
+static void pxa_uart_toggle_clock(uint32_t uart_index, int enable)
 {
 	uint32_t clk_reg, clk_offset, reg;
 
-- 
1.7.10.4

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

* [U-Boot] [PATCH 07/72] serial: mpc512x: Properly define CONFIG_SYS_PSC3 in config files
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (5 preceding siblings ...)
  2012-09-29 21:51     ` [U-Boot] [PATCH 06/72] serial: pxa: Make local functions static Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 08/72] serial: Implement serial_initfunc() macro Marek Vasut
                       ` (66 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Some of the boards using the mpc512x serial driver didn't properly
define which PSC console to use. This caused breakage when building
with CONFIG_SERIAL_MULTI enabled. Fix this by defining the default
PSC console.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 include/configs/aria.h       |    1 +
 include/configs/mecp5123.h   |    1 +
 include/configs/mpc5121ads.h |    1 +
 3 files changed, 3 insertions(+)

diff --git a/include/configs/aria.h b/include/configs/aria.h
index b21b495..0b31c50 100644
--- a/include/configs/aria.h
+++ b/include/configs/aria.h
@@ -322,6 +322,7 @@
  * Serial console configuration
  */
 #define CONFIG_PSC_CONSOLE		3	/* console on PSC3 */
+#define CONFIG_SYS_PSC3
 #if CONFIG_PSC_CONSOLE != 3
 #error CONFIG_PSC_CONSOLE must be 3
 #endif
diff --git a/include/configs/mecp5123.h b/include/configs/mecp5123.h
index b41bda9..cafc273 100644
--- a/include/configs/mecp5123.h
+++ b/include/configs/mecp5123.h
@@ -222,6 +222,7 @@
  * Serial console configuration
  */
 #define CONFIG_PSC_CONSOLE	3	/* console is on PSC3 */
+#define CONFIG_SYS_PSC3
 #if CONFIG_PSC_CONSOLE != 3
 #error CONFIG_PSC_CONSOLE must be 3
 #endif
diff --git a/include/configs/mpc5121ads.h b/include/configs/mpc5121ads.h
index 9d1327f..3f55d35 100644
--- a/include/configs/mpc5121ads.h
+++ b/include/configs/mpc5121ads.h
@@ -290,6 +290,7 @@
  * Serial console configuration
  */
 #define CONFIG_PSC_CONSOLE	3	/* console is on PSC3 */
+#define CONFIG_SYS_PSC3
 #if CONFIG_PSC_CONSOLE != 3
 #error CONFIG_PSC_CONSOLE must be 3
 #endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 08/72] serial: Implement serial_initfunc() macro
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (6 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 07/72] serial: mpc512x: Properly define CONFIG_SYS_PSC3 in config files Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 09/72] serial: mpc8xx: Move serial registration from serial_initialize() Marek Vasut
                       ` (65 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

This macro simplifies declaration of weak aliases for per-driver
functions, which register these drivers with the serial subsystem.
The idea here is to push serial_register() calls from serial.c into
the drivers. To avoid pile of ifdef construct as it is now, create
weak aliases to these functions, which in case the driver is not
present alias onto an empty function, which is in turn optimized out
altogether.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>
---
 common/serial.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/common/serial.c b/common/serial.c
index 5740d4f..84dbe50 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -32,6 +32,14 @@ DECLARE_GLOBAL_DATA_PTR;
 static struct serial_device *serial_devices;
 static struct serial_device *serial_current;
 
+static void serial_null(void)
+{
+}
+
+#define serial_initfunc(name)					\
+	void name(void)						\
+		__attribute__((weak, alias("serial_null")));
+
 void serial_register(struct serial_device *dev)
 {
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
-- 
1.7.10.4

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

* [U-Boot] [PATCH 09/72] serial: mpc8xx: Move serial registration from serial_initialize()
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (7 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 08/72] serial: Implement serial_initfunc() macro Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 10/72] serial: s3c24xx: " Marek Vasut
                       ` (64 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Move the registration of serial_smc and serial_scc ports from
default serial_initialize() into CPU specific function called from
serial_initialize(). This slims down the serial_initialize() call
to a bare tracker of all possible serial port registration routines
in U-Boot.

The exports of both serial_scc_device and serial_smc_device can
not yet be removed as they are still used in default_serial_console()
calls.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>
---
 arch/powerpc/cpu/mpc8xx/serial.c |   11 +++++++++++
 common/serial.c                  |   11 +++--------
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/cpu/mpc8xx/serial.c b/arch/powerpc/cpu/mpc8xx/serial.c
index dc9b323..00888e9 100644
--- a/arch/powerpc/cpu/mpc8xx/serial.c
+++ b/arch/powerpc/cpu/mpc8xx/serial.c
@@ -681,6 +681,17 @@ __weak struct serial_device *default_serial_console(void)
 #endif
 }
 
+void mpc8xx_serial_initialize(void)
+{
+#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2)
+	serial_register(&serial_smc_device);
+#endif
+#if	defined(CONFIG_8xx_CONS_SCC1) || defined(CONFIG_8xx_CONS_SCC2) || \
+	defined(CONFIG_8xx_CONS_SCC3) || defined(CONFIG_8xx_CONS_SCC4)
+	serial_register(&serial_scc_device);
+#endif
+}
+
 #ifdef CONFIG_MODEM_SUPPORT
 void disable_putc(void)
 {
diff --git a/common/serial.c b/common/serial.c
index 84dbe50..0187dac 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -40,6 +40,8 @@ static void serial_null(void)
 	void name(void)						\
 		__attribute__((weak, alias("serial_null")));
 
+serial_initfunc(mpc8xx_serial_initialize);
+
 void serial_register(struct serial_device *dev)
 {
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
@@ -57,14 +59,7 @@ void serial_register(struct serial_device *dev)
 
 void serial_initialize(void)
 {
-#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2)
-	serial_register(&serial_smc_device);
-#endif
-#if	defined(CONFIG_8xx_CONS_SCC1) || defined(CONFIG_8xx_CONS_SCC2) || \
-	defined(CONFIG_8xx_CONS_SCC3) || defined(CONFIG_8xx_CONS_SCC4)
-	serial_register(&serial_scc_device);
-#endif
-
+	mpc8xx_serial_initialize();
 #if defined(CONFIG_SYS_NS16550_SERIAL)
 #if defined(CONFIG_SYS_NS16550_COM1)
 	serial_register(&eserial1_device);
-- 
1.7.10.4

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

* [U-Boot] [PATCH 10/72] serial: s3c24xx: Move serial registration from serial_initialize()
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (8 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 09/72] serial: mpc8xx: Move serial registration from serial_initialize() Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 11/72] serial: pxa: " Marek Vasut
                       ` (63 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Move the registration of s3c24xx_serialN_device ports from
default serial_initialize() into driver specific function called from
serial_initialize(). This slims down the serial_initialize() call
to a bare tracker of all possible serial port registration routines
in U-Boot.

The newly implemented s3c24xx_serial_initialize() function, which is
implemented inside of the serial_s3c24xx driver allows encapsulation
of s3c24xx_serialN_device within the serial_s3c24xx driver itself.

Also, remove the exports of s3c24xx_serialN_device from include/serial.h
as they are no longer needed. This is simply because the implementation of
default_serial_console() is wrapped into the serial_s3c24xx driver and
the default console is picked by CONFIG_SERIAL<N> macro in config file.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: C Nauman <cnauman@diagraph.com>
---
 common/serial.c                 |    7 ++-----
 drivers/serial/serial_s3c24x0.c |    7 +++++++
 include/serial.h                |    6 ------
 3 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 0187dac..b210b05 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -41,6 +41,7 @@ static void serial_null(void)
 		__attribute__((weak, alias("serial_null")));
 
 serial_initfunc(mpc8xx_serial_initialize);
+serial_initfunc(s3c24xx_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -83,11 +84,7 @@ void serial_initialize(void)
 #if defined(CONFIG_STUART)
 	serial_register(&serial_stuart_device);
 #endif
-#if defined(CONFIG_S3C2410)
-	serial_register(&s3c24xx_serial0_device);
-	serial_register(&s3c24xx_serial1_device);
-	serial_register(&s3c24xx_serial2_device);
-#endif
+	s3c24xx_serial_initialize();
 #if defined(CONFIG_S5P)
 	serial_register(&s5p_serial0_device);
 	serial_register(&s5p_serial1_device);
diff --git a/drivers/serial/serial_s3c24x0.c b/drivers/serial/serial_s3c24x0.c
index fa6aac0..625c6b7 100644
--- a/drivers/serial/serial_s3c24x0.c
+++ b/drivers/serial/serial_s3c24x0.c
@@ -323,4 +323,11 @@ __weak struct serial_device *default_serial_console(void)
 #error "CONFIG_SERIAL? missing."
 #endif
 }
+
+void s3c24xx_serial_initialize(void)
+{
+	serial_register(&s3c24xx_serial0_device);
+	serial_register(&s3c24xx_serial1_device);
+	serial_register(&s3c24xx_serial2_device);
+}
 #endif /* CONFIG_SERIAL_MULTI */
diff --git a/include/serial.h b/include/serial.h
index 4d19259..1da4ac4 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -57,12 +57,6 @@ extern struct serial_device uartlite_serial2_device;
 extern struct serial_device uartlite_serial3_device;
 #endif
 
-#if defined(CONFIG_S3C2410)
-extern struct serial_device s3c24xx_serial0_device;
-extern struct serial_device s3c24xx_serial1_device;
-extern struct serial_device s3c24xx_serial2_device;
-#endif
-
 #if defined(CONFIG_S5P)
 extern struct serial_device s5p_serial0_device;
 extern struct serial_device s5p_serial1_device;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 11/72] serial: pxa: Move serial registration from serial_initialize()
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (9 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 10/72] serial: s3c24xx: " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 12/72] serial: s5p: " Marek Vasut
                       ` (62 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Move the registration of serial_XXuart ports from default
serial_initialize() into driver specific function called from
serial_initialize(). This slims down the serial_initialize() call
to a bare tracker of all possible serial port registration routines
in U-Boot.

The newly implemented pxa_serial_initialize() function, which is
implemented inside of the serial_pxa driver allows encapsulation
of serial_XXuart within the serial_pxa driver itself.

Also, remove the exports of serial_XXuart from include/serial.h
as they are no longer needed. This is simply because the implementation of
default_serial_console() is wrapped into the serial_pxa driver and
the default console is picked by CONFIG_CONS_IDX macro in config file.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c             |   11 ++---------
 drivers/serial/serial_pxa.c |   13 +++++++++++++
 include/serial.h            |    4 ----
 3 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index b210b05..d457d23 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -41,6 +41,7 @@ static void serial_null(void)
 		__attribute__((weak, alias("serial_null")));
 
 serial_initfunc(mpc8xx_serial_initialize);
+serial_initfunc(pxa_serial_initialize);
 serial_initfunc(s3c24xx_serial_initialize);
 
 void serial_register(struct serial_device *dev)
@@ -75,15 +76,7 @@ void serial_initialize(void)
 	serial_register(&eserial4_device);
 #endif
 #endif /* CONFIG_SYS_NS16550_SERIAL */
-#if defined(CONFIG_FFUART)
-	serial_register(&serial_ffuart_device);
-#endif
-#if defined(CONFIG_BTUART)
-	serial_register(&serial_btuart_device);
-#endif
-#if defined(CONFIG_STUART)
-	serial_register(&serial_stuart_device);
-#endif
+	pxa_serial_initialize();
 	s3c24xx_serial_initialize();
 #if defined(CONFIG_S5P)
 	serial_register(&s5p_serial0_device);
diff --git a/drivers/serial/serial_pxa.c b/drivers/serial/serial_pxa.c
index bd3b3cf..46d7689 100644
--- a/drivers/serial/serial_pxa.c
+++ b/drivers/serial/serial_pxa.c
@@ -314,4 +314,17 @@ __weak struct serial_device *default_serial_console(void)
 #error "Bad CONFIG_CONS_INDEX."
 #endif
 }
+
+void pxa_serial_initialize(void)
+{
+#if defined(CONFIG_FFUART)
+	serial_register(&serial_ffuart_device);
+#endif
+#if defined(CONFIG_BTUART)
+	serial_register(&serial_btuart_device);
+#endif
+#if defined(CONFIG_STUART)
+	serial_register(&serial_stuart_device);
+#endif
+}
 #endif
diff --git a/include/serial.h b/include/serial.h
index 1da4ac4..8eff282 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -71,10 +71,6 @@ extern struct serial_device zoom2_serial_device2;
 extern struct serial_device zoom2_serial_device3;
 #endif
 
-extern struct serial_device serial_ffuart_device;
-extern struct serial_device serial_btuart_device;
-extern struct serial_device serial_stuart_device;
-
 #if defined(CONFIG_SYS_BFIN_UART)
 extern void serial_register_bfin_uart(void);
 extern struct serial_device bfin_serial0_device;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 12/72] serial: s5p: Move serial registration from serial_initialize()
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (10 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 11/72] serial: pxa: " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 13/72] serial: microblaze: " Marek Vasut
                       ` (61 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Move the registration of s5p_serialN_device ports from default
serial_initialize() into driver specific function called from
serial_initialize(). This slims down the serial_initialize() call
to a bare tracker of all possible serial port registration routines
in U-Boot.

The newly implemented s5p_serial_initialize() function, which is
implemented inside of the serial_s5p driver allows encapsulation
of s5p_serialN_device within the serial_s5p driver itself.

Also, remove the exports of s5p_serialN_device from include/serial.h
as they are no longer needed. This is simply because the implementation of
default_serial_console() is wrapped into the serial_s5p driver and
the default console is picked by CONFIG_SERIAL<N> macro in config file.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 common/serial.c             |    8 ++------
 drivers/serial/serial_s5p.c |    8 ++++++++
 include/serial.h            |    7 -------
 3 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index d457d23..c021c3f 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -43,6 +43,7 @@ static void serial_null(void)
 serial_initfunc(mpc8xx_serial_initialize);
 serial_initfunc(pxa_serial_initialize);
 serial_initfunc(s3c24xx_serial_initialize);
+serial_initfunc(s5p_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -78,12 +79,7 @@ void serial_initialize(void)
 #endif /* CONFIG_SYS_NS16550_SERIAL */
 	pxa_serial_initialize();
 	s3c24xx_serial_initialize();
-#if defined(CONFIG_S5P)
-	serial_register(&s5p_serial0_device);
-	serial_register(&s5p_serial1_device);
-	serial_register(&s5p_serial2_device);
-	serial_register(&s5p_serial3_device);
-#endif
+	s5p_serial_initialize();
 #if defined(CONFIG_MPC512X)
 #if defined(CONFIG_SYS_PSC1)
 	serial_register(&serial1_device);
diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c
index 43cbc4f..3c41242 100644
--- a/drivers/serial/serial_s5p.c
+++ b/drivers/serial/serial_s5p.c
@@ -221,3 +221,11 @@ __weak struct serial_device *default_serial_console(void)
 #error "CONFIG_SERIAL? missing."
 #endif
 }
+
+void s5p_serial_initialize(void)
+{
+	serial_register(&s5p_serial0_device);
+	serial_register(&s5p_serial1_device);
+	serial_register(&s5p_serial2_device);
+	serial_register(&s5p_serial3_device);
+}
diff --git a/include/serial.h b/include/serial.h
index 8eff282..773eace 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -57,13 +57,6 @@ extern struct serial_device uartlite_serial2_device;
 extern struct serial_device uartlite_serial3_device;
 #endif
 
-#if defined(CONFIG_S5P)
-extern struct serial_device s5p_serial0_device;
-extern struct serial_device s5p_serial1_device;
-extern struct serial_device s5p_serial2_device;
-extern struct serial_device s5p_serial3_device;
-#endif
-
 #if defined(CONFIG_OMAP3_ZOOM2)
 extern struct serial_device zoom2_serial_device0;
 extern struct serial_device zoom2_serial_device1;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 13/72] serial: microblaze: Move serial registration from serial_initialize()
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (11 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 12/72] serial: s5p: " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 14/72] serial: mpc512x: " Marek Vasut
                       ` (60 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Move the registration of xuartlite_serialN_device ports from
default serial_initialize() into driver specific function called from
serial_initialize(). This slims down the serial_initialize() call
to a bare tracker of all possible serial port registration routines
in U-Boot.

The newly implemented xuartlite_serial_initialize() function, which is
implemented inside of the serial_xuartlite driver allows encapsulation
of xuartlite_serialN_device within the serial_xuartlite driver itself.

Also, remove the exports of xuartlite_serialN_device from include/serial.h
as they are no longer needed. This is simply because the implementation of
default_serial_console() is wrapped into the serial_xuartlite driver and
the default console is picked by CONFIG_SERIAL<N> macro in config file.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Michal Simek <monstr@monstr.eu>
---
 common/serial.c                   |   16 ++--------------
 drivers/serial/serial_xuartlite.c |   16 ++++++++++++++++
 include/serial.h                  |    7 -------
 3 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index c021c3f..e19a17f 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -44,6 +44,7 @@ serial_initfunc(mpc8xx_serial_initialize);
 serial_initfunc(pxa_serial_initialize);
 serial_initfunc(s3c24xx_serial_initialize);
 serial_initfunc(s5p_serial_initialize);
+serial_initfunc(uartlite_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -97,20 +98,7 @@ void serial_initialize(void)
 #if defined(CONFIG_SYS_BFIN_UART)
 	serial_register_bfin_uart();
 #endif
-#if defined(CONFIG_XILINX_UARTLITE)
-# ifdef XILINX_UARTLITE_BASEADDR
-	serial_register(&uartlite_serial0_device);
-# endif /* XILINX_UARTLITE_BASEADDR */
-# ifdef XILINX_UARTLITE_BASEADDR1
-	serial_register(&uartlite_serial1_device);
-# endif /* XILINX_UARTLITE_BASEADDR1 */
-# ifdef XILINX_UARTLITE_BASEADDR2
-	serial_register(&uartlite_serial2_device);
-# endif /* XILINX_UARTLITE_BASEADDR2 */
-# ifdef XILINX_UARTLITE_BASEADDR3
-	serial_register(&uartlite_serial3_device);
-# endif /* XILINX_UARTLITE_BASEADDR3 */
-#endif /* CONFIG_XILINX_UARTLITE */
+	uartlite_serial_initialize();
 	serial_assign(default_serial_console()->name);
 }
 
diff --git a/drivers/serial/serial_xuartlite.c b/drivers/serial/serial_xuartlite.c
index b3bb066..164497e 100644
--- a/drivers/serial/serial_xuartlite.c
+++ b/drivers/serial/serial_xuartlite.c
@@ -181,4 +181,20 @@ __weak struct serial_device *default_serial_console(void)
 
 	return NULL;
 }
+
+void uartlite_serial_initialize(void)
+{
+#ifdef XILINX_UARTLITE_BASEADDR
+	serial_register(&uartlite_serial0_device);
+#endif /* XILINX_UARTLITE_BASEADDR */
+#ifdef XILINX_UARTLITE_BASEADDR1
+	serial_register(&uartlite_serial1_device);
+#endif /* XILINX_UARTLITE_BASEADDR1 */
+#ifdef XILINX_UARTLITE_BASEADDR2
+	serial_register(&uartlite_serial2_device);
+#endif /* XILINX_UARTLITE_BASEADDR2 */
+#ifdef XILINX_UARTLITE_BASEADDR3
+	serial_register(&uartlite_serial3_device);
+#endif /* XILINX_UARTLITE_BASEADDR3 */
+}
 #endif /* CONFIG_SERIAL_MULTI */
diff --git a/include/serial.h b/include/serial.h
index 773eace..51a044d 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -50,13 +50,6 @@ extern struct serial_device serial4_device;
 extern struct serial_device serial6_device;
 #endif
 
-#if defined(CONFIG_XILINX_UARTLITE)
-extern struct serial_device uartlite_serial0_device;
-extern struct serial_device uartlite_serial1_device;
-extern struct serial_device uartlite_serial2_device;
-extern struct serial_device uartlite_serial3_device;
-#endif
-
 #if defined(CONFIG_OMAP3_ZOOM2)
 extern struct serial_device zoom2_serial_device0;
 extern struct serial_device zoom2_serial_device1;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 14/72] serial: mpc512x: Move serial registration from serial_initialize()
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (12 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 13/72] serial: microblaze: " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 15/72] serial: ns16550: " Marek Vasut
                       ` (59 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Move the registration of serialN_device ports from default
serial_initialize() into driver specific function called from
serial_initialize(). This slims down the serial_initialize() call
to a bare tracker of all possible serial port registration routines
in U-Boot.

The newly implemented mpc512x_serial_initialize() function, which is
implemented inside of the mpc512x serial driver allows encapsulation
of serialN_device within the mpc512x serial driver itself.

Also, remove the exports of serialN_device from include/serial.h
as they are no longer needed. This is simply because the implementation of
default_serial_console() is wrapped into the mpx512x serial driver and
the default console is picked by CONFIG_SERIAL<N> macro in config file.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/powerpc/cpu/mpc512x/serial.c |   16 ++++++++++++++++
 common/serial.c                   |   16 ++--------------
 include/serial.h                  |    7 -------
 3 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/arch/powerpc/cpu/mpc512x/serial.c b/arch/powerpc/cpu/mpc512x/serial.c
index f4f52ad..bc10c50 100644
--- a/arch/powerpc/cpu/mpc512x/serial.c
+++ b/arch/powerpc/cpu/mpc512x/serial.c
@@ -365,6 +365,22 @@ __weak struct serial_device *default_serial_console(void)
 #endif
 }
 
+void mpc512x_serial_initialize(void)
+{
+#if defined(CONFIG_SYS_PSC1)
+	serial_register(&serial1_device);
+#endif
+#if defined(CONFIG_SYS_PSC3)
+	serial_register(&serial3_device);
+#endif
+#if defined(CONFIG_SYS_PSC4)
+	serial_register(&serial4_device);
+#endif
+#if defined(CONFIG_SYS_PSC6)
+	serial_register(&serial6_device);
+#endif
+}
+
 #else
 
 void serial_setbrg(void)
diff --git a/common/serial.c b/common/serial.c
index e19a17f..08c6e2a 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -44,6 +44,7 @@ serial_initfunc(mpc8xx_serial_initialize);
 serial_initfunc(pxa_serial_initialize);
 serial_initfunc(s3c24xx_serial_initialize);
 serial_initfunc(s5p_serial_initialize);
+serial_initfunc(mpc512x_serial_initialize);
 serial_initfunc(uartlite_serial_initialize);
 
 void serial_register(struct serial_device *dev)
@@ -81,20 +82,7 @@ void serial_initialize(void)
 	pxa_serial_initialize();
 	s3c24xx_serial_initialize();
 	s5p_serial_initialize();
-#if defined(CONFIG_MPC512X)
-#if defined(CONFIG_SYS_PSC1)
-	serial_register(&serial1_device);
-#endif
-#if defined(CONFIG_SYS_PSC3)
-	serial_register(&serial3_device);
-#endif
-#if defined(CONFIG_SYS_PSC4)
-	serial_register(&serial4_device);
-#endif
-#if defined(CONFIG_SYS_PSC6)
-	serial_register(&serial6_device);
-#endif
-#endif
+	mpc512x_serial_initialize();
 #if defined(CONFIG_SYS_BFIN_UART)
 	serial_register_bfin_uart();
 #endif
diff --git a/include/serial.h b/include/serial.h
index 51a044d..71822c6 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -43,13 +43,6 @@ extern struct serial_device eserial4_device;
 
 #endif
 
-#if defined(CONFIG_MPC512X)
-extern struct serial_device serial1_device;
-extern struct serial_device serial3_device;
-extern struct serial_device serial4_device;
-extern struct serial_device serial6_device;
-#endif
-
 #if defined(CONFIG_OMAP3_ZOOM2)
 extern struct serial_device zoom2_serial_device0;
 extern struct serial_device zoom2_serial_device1;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 15/72] serial: ns16550: Move serial registration from serial_initialize()
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (13 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 14/72] serial: mpc512x: " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 16/72] serial: bfin: Remove the bfin_serialN_device exports from serial.h Marek Vasut
                       ` (58 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Move the registration of eserialN_device ports from default
serial_initialize() into driver specific function called from
serial_initialize(). This slims down the serial_initialize() call
to a bare tracker of all possible serial port registration routines
in U-Boot.

The newly implemented ns16550_serial_initialize() function, which is
implemented inside of the ns16550 serial driver allows encapsulation
of eserialN_device within the ns16550 serial driver itself.

Also, remove the exports of eserialN_device from include/serial.h
as they are no longer needed. This is simply because the implementation of
default_serial_console() is wrapped into the ns16550 serial driver and
the default console is picked by CONFIG_SERIAL<N> macro in config file.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Michal Simek <monstr@monstr.eu>
---
 common/serial.c         |   16 ++--------------
 drivers/serial/serial.c |   16 ++++++++++++++++
 include/serial.h        |    8 ++------
 3 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 08c6e2a..faad804 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -41,6 +41,7 @@ static void serial_null(void)
 		__attribute__((weak, alias("serial_null")));
 
 serial_initfunc(mpc8xx_serial_initialize);
+serial_initfunc(ns16550_serial_initialize);
 serial_initfunc(pxa_serial_initialize);
 serial_initfunc(s3c24xx_serial_initialize);
 serial_initfunc(s5p_serial_initialize);
@@ -65,20 +66,7 @@ void serial_register(struct serial_device *dev)
 void serial_initialize(void)
 {
 	mpc8xx_serial_initialize();
-#if defined(CONFIG_SYS_NS16550_SERIAL)
-#if defined(CONFIG_SYS_NS16550_COM1)
-	serial_register(&eserial1_device);
-#endif
-#if defined(CONFIG_SYS_NS16550_COM2)
-	serial_register(&eserial2_device);
-#endif
-#if defined(CONFIG_SYS_NS16550_COM3)
-	serial_register(&eserial3_device);
-#endif
-#if defined(CONFIG_SYS_NS16550_COM4)
-	serial_register(&eserial4_device);
-#endif
-#endif /* CONFIG_SYS_NS16550_SERIAL */
+	ns16550_serial_initialize();
 	pxa_serial_initialize();
 	s3c24xx_serial_initialize();
 	s5p_serial_initialize();
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index 9d92dee..00ad97c 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -340,4 +340,20 @@ __weak struct serial_device *default_serial_console(void)
 #endif
 }
 
+void ns16550_serial_initialize(void)
+{
+#if defined(CONFIG_SYS_NS16550_COM1)
+	serial_register(&eserial1_device);
+#endif
+#if defined(CONFIG_SYS_NS16550_COM2)
+	serial_register(&eserial2_device);
+#endif
+#if defined(CONFIG_SYS_NS16550_COM3)
+	serial_register(&eserial3_device);
+#endif
+#if defined(CONFIG_SYS_NS16550_COM4)
+	serial_register(&eserial4_device);
+#endif
+}
+
 #endif /* CONFIG_SERIAL_MULTI */
diff --git a/include/serial.h b/include/serial.h
index 71822c6..b44fac2 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -34,14 +34,10 @@ extern struct serial_device *default_serial_console(void);
 	defined(CONFIG_MICROBLAZE)
 extern struct serial_device serial0_device;
 extern struct serial_device serial1_device;
-#if defined(CONFIG_SYS_NS16550_SERIAL)
+#endif
+
 extern struct serial_device eserial1_device;
 extern struct serial_device eserial2_device;
-extern struct serial_device eserial3_device;
-extern struct serial_device eserial4_device;
-#endif /* CONFIG_SYS_NS16550_SERIAL */
-
-#endif
 
 #if defined(CONFIG_OMAP3_ZOOM2)
 extern struct serial_device zoom2_serial_device0;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 16/72] serial: bfin: Remove the bfin_serialN_device exports from serial.h
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (14 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 15/72] serial: ns16550: " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 17/72] serial: bfin: Adjust serial_register_bfin_uart() Marek Vasut
                       ` (57 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Remove the exports from serial.h as they are only used in the blackfin
serial driver. Furthermore, they are only used for registration, which
is handled already inside that driver and default_serial_port() call,
which is also handled in that driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Mike Frysinger <vapier@gentoo.org>
---
 include/serial.h |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/include/serial.h b/include/serial.h
index b44fac2..00efe68 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -48,10 +48,6 @@ extern struct serial_device zoom2_serial_device3;
 
 #if defined(CONFIG_SYS_BFIN_UART)
 extern void serial_register_bfin_uart(void);
-extern struct serial_device bfin_serial0_device;
-extern struct serial_device bfin_serial1_device;
-extern struct serial_device bfin_serial2_device;
-extern struct serial_device bfin_serial3_device;
 #endif
 
 extern void serial_register(struct serial_device *);
-- 
1.7.10.4

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

* [U-Boot] [PATCH 17/72] serial: bfin: Adjust serial_register_bfin_uart()
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (15 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 16/72] serial: bfin: Remove the bfin_serialN_device exports from serial.h Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 18/72] serial: zoom2: Remove zoom2 serial prototypes from serial.h Marek Vasut
                       ` (56 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Rename the serial_register_bfin_uart() to bfin_initialize_serial()
to be consistent with the rest of the naming. Next, remove it's
prototype from serial.h and properly insert it into serial.c as
the rest of the serial initialization functions.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Mike Frysinger <vapier@gentoo.org>
---
 arch/blackfin/cpu/serial.c |    2 +-
 common/serial.c            |    5 ++---
 include/serial.h           |    4 ----
 3 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/arch/blackfin/cpu/serial.c b/arch/blackfin/cpu/serial.c
index 33677ba..64340ec 100644
--- a/arch/blackfin/cpu/serial.c
+++ b/arch/blackfin/cpu/serial.c
@@ -272,7 +272,7 @@ __weak struct serial_device *default_serial_console(void)
 #endif
 }
 
-void serial_register_bfin_uart(void)
+void bfin_serial_initialize(void)
 {
 #ifdef UART0_DLL
 	serial_register(&bfin_serial0_device);
diff --git a/common/serial.c b/common/serial.c
index faad804..0a43c1b 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -45,6 +45,7 @@ serial_initfunc(ns16550_serial_initialize);
 serial_initfunc(pxa_serial_initialize);
 serial_initfunc(s3c24xx_serial_initialize);
 serial_initfunc(s5p_serial_initialize);
+serial_initfunc(bfin_serial_initialize);
 serial_initfunc(mpc512x_serial_initialize);
 serial_initfunc(uartlite_serial_initialize);
 
@@ -71,9 +72,7 @@ void serial_initialize(void)
 	s3c24xx_serial_initialize();
 	s5p_serial_initialize();
 	mpc512x_serial_initialize();
-#if defined(CONFIG_SYS_BFIN_UART)
-	serial_register_bfin_uart();
-#endif
+	bfin_serial_initialize();
 	uartlite_serial_initialize();
 	serial_assign(default_serial_console()->name);
 }
diff --git a/include/serial.h b/include/serial.h
index 00efe68..5f9899e 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -46,10 +46,6 @@ extern struct serial_device zoom2_serial_device2;
 extern struct serial_device zoom2_serial_device3;
 #endif
 
-#if defined(CONFIG_SYS_BFIN_UART)
-extern void serial_register_bfin_uart(void);
-#endif
-
 extern void serial_register(struct serial_device *);
 extern void serial_initialize(void);
 extern void serial_stdio_init(void);
-- 
1.7.10.4

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

* [U-Boot] [PATCH 18/72] serial: zoom2: Remove zoom2 serial prototypes from serial.h
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (16 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 17/72] serial: bfin: Adjust serial_register_bfin_uart() Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 19/72] serial: bfin: Flip the jtag serial console to CONFIG_SERIAL_MULTI Marek Vasut
                       ` (55 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Remove the prototypes for zoom2_serial_deviceN from serial.h . This
can't be done right away, as they are referenced from the zoom2
config file. Therefore, adjust the code so the config file only
specifies number of the port. Then, replace the simple return in
default_serial_console() with a switch across possible values, which
returns the zoom2_serial_deviceN . With such adjustment in place,
the exported prototypes in serial.h can be safely removed.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 board/logicpd/zoom2/zoom2_serial.c |    7 ++++++-
 include/configs/omap3_zoom2.h      |    2 +-
 include/serial.h                   |    7 -------
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/board/logicpd/zoom2/zoom2_serial.c b/board/logicpd/zoom2/zoom2_serial.c
index 74f165f..9b7aea8 100644
--- a/board/logicpd/zoom2/zoom2_serial.c
+++ b/board/logicpd/zoom2/zoom2_serial.c
@@ -135,5 +135,10 @@ QUAD_INIT (3)
 
 struct serial_device *default_serial_console(void)
 {
-	return ZOOM2_DEFAULT_SERIAL_DEVICE;
+	switch (ZOOM2_DEFAULT_SERIAL_DEVICE) {
+	case 0: return &zoom2_serial_device0;
+	case 1: return &zoom2_serial_device1;
+	case 2: return &zoom2_serial_device2;
+	case 3: return &zoom2_serial_device3;
+	}
 }
diff --git a/include/configs/omap3_zoom2.h b/include/configs/omap3_zoom2.h
index 4447dff..a7cc5fc 100644
--- a/include/configs/omap3_zoom2.h
+++ b/include/configs/omap3_zoom2.h
@@ -81,7 +81,7 @@
  * 0 - 1 : first  USB with respect to the left edge of the debug board
  * 2 - 3 : second USB with respect to the left edge of the debug board
  */
-#define ZOOM2_DEFAULT_SERIAL_DEVICE	(&zoom2_serial_device0)
+#define ZOOM2_DEFAULT_SERIAL_DEVICE	0
 
 #define V_NS16550_CLK			(1843200)	/* 1.8432 Mhz */
 
diff --git a/include/serial.h b/include/serial.h
index 5f9899e..01a86b4 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -39,13 +39,6 @@ extern struct serial_device serial1_device;
 extern struct serial_device eserial1_device;
 extern struct serial_device eserial2_device;
 
-#if defined(CONFIG_OMAP3_ZOOM2)
-extern struct serial_device zoom2_serial_device0;
-extern struct serial_device zoom2_serial_device1;
-extern struct serial_device zoom2_serial_device2;
-extern struct serial_device zoom2_serial_device3;
-#endif
-
 extern void serial_register(struct serial_device *);
 extern void serial_initialize(void);
 extern void serial_stdio_init(void);
-- 
1.7.10.4

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

* [U-Boot] [PATCH 19/72] serial: bfin: Flip the jtag serial console to CONFIG_SERIAL_MULTI
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (17 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 18/72] serial: zoom2: Remove zoom2 serial prototypes from serial.h Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 20/72] serial: mips: Implement CONFIG_SERIAL_MULTI into au1x00 serial driver Marek Vasut
                       ` (54 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Rework the emulation of serial console via JTAG from simple ad-hoc
implementation of serial port routines to CONFIG_SERIAL_MULTI and
enable CONFIG_SERIAL_MULTI unconditionally for blackfin.

In order for the JTAG serial console to take precedence over all
other serial ports available in system, implement override for
default_serial_console call returning this JTAG serial console.

This brings in a bit of a growth of size, but eventually will allow
us to unconditionally enable CONFIG_SERIAL_MULTI throughout the whole
U-Boot and maintain only one serial subsystem.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Mike Frysinger <vapier@gentoo.org>
---
 arch/blackfin/cpu/jtag-console.c  |   37 ++++++++++++++++++++++++++++++-------
 common/serial.c                   |    2 ++
 include/configs/bfin_adi_common.h |    2 +-
 3 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/arch/blackfin/cpu/jtag-console.c b/arch/blackfin/cpu/jtag-console.c
index a77358a..7cddb85 100644
--- a/arch/blackfin/cpu/jtag-console.c
+++ b/arch/blackfin/cpu/jtag-console.c
@@ -194,12 +194,35 @@ int drv_jtag_console_init(void)
 }
 
 #ifdef CONFIG_UART_CONSOLE_IS_JTAG
+#include <serial.h>
 /* Since the JTAG is always available (at power on), allow it to fake a UART */
-void serial_set_baud(uint32_t baud) {}
-void serial_setbrg(void)            {}
-int serial_init(void)               { return 0; }
-void serial_putc(const char c)      __attribute__((alias("jtag_putc")));
-void serial_puts(const char *s)     __attribute__((alias("jtag_puts")));
-int serial_tstc(void)               __attribute__((alias("jtag_tstc")));
-int serial_getc(void)               __attribute__((alias("jtag_getc")));
+void jtag_serial_setbrg(void)
+{
+}
+
+int jtag_serial_init(void)
+{
+	return 0;
+}
+
+static struct serial_device serial_jtag_drv = {
+	.name	= "jtag",
+	.start	= jtag_serial_init,
+	.stop	= NULL,
+	.setbrg	= jtag_serial_setbrg,
+	.putc	= jtag_putc,
+	.puts	= jtag_puts,
+	.tstc	= jtag_tstc,
+	.getc	= jtag_getc,
+};
+
+void bfin_jtag_initialize(void)
+{
+	serial_register(&serial_jtag_drv);
+}
+
+struct serial_device *default_serial_console(void)
+{
+	return &serial_jtag_drv;
+}
 #endif
diff --git a/common/serial.c b/common/serial.c
index 0a43c1b..25aeea0 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -46,6 +46,7 @@ serial_initfunc(pxa_serial_initialize);
 serial_initfunc(s3c24xx_serial_initialize);
 serial_initfunc(s5p_serial_initialize);
 serial_initfunc(bfin_serial_initialize);
+serial_initfunc(bfin_jtag_initialize);
 serial_initfunc(mpc512x_serial_initialize);
 serial_initfunc(uartlite_serial_initialize);
 
@@ -73,6 +74,7 @@ void serial_initialize(void)
 	s5p_serial_initialize();
 	mpc512x_serial_initialize();
 	bfin_serial_initialize();
+	bfin_jtag_initialize();
 	uartlite_serial_initialize();
 	serial_assign(default_serial_console()->name);
 }
diff --git a/include/configs/bfin_adi_common.h b/include/configs/bfin_adi_common.h
index 3fbf5c6..7132f8f 100644
--- a/include/configs/bfin_adi_common.h
+++ b/include/configs/bfin_adi_common.h
@@ -108,11 +108,11 @@
 #define CONFIG_LOADS_ECHO	1
 #define CONFIG_JTAG_CONSOLE
 #define CONFIG_SILENT_CONSOLE
+#define CONFIG_SERIAL_MULTI
 #ifndef CONFIG_BAUDRATE
 # define CONFIG_BAUDRATE	57600
 #endif
 #ifndef CONFIG_DEBUG_EARLY_SERIAL
-# define CONFIG_SERIAL_MULTI
 # define CONFIG_SYS_BFIN_UART
 #endif
 
-- 
1.7.10.4

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

* [U-Boot] [PATCH 20/72] serial: mips: Implement CONFIG_SERIAL_MULTI into au1x00 serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (18 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 19/72] serial: bfin: Flip the jtag serial console to CONFIG_SERIAL_MULTI Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 21/72] serial: mips: Implement CONFIG_SERIAL_MULTI into asc " Marek Vasut
                       ` (53 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into au1x00 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the au1x00 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
---
 arch/mips/cpu/mips32/au1x00/au1x00_serial.c |   74 +++++++++++++++++++++++----
 common/serial.c                             |    3 ++
 2 files changed, 67 insertions(+), 10 deletions(-)

diff --git a/arch/mips/cpu/mips32/au1x00/au1x00_serial.c b/arch/mips/cpu/mips32/au1x00/au1x00_serial.c
index c25ba5a..9682775 100644
--- a/arch/mips/cpu/mips32/au1x00/au1x00_serial.c
+++ b/arch/mips/cpu/mips32/au1x00/au1x00_serial.c
@@ -28,6 +28,8 @@
 #include <config.h>
 #include <common.h>
 #include <asm/au1x00.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 /******************************************************************************
 *
@@ -40,7 +42,7 @@
 * RETURNS: N/A
 */
 
-int serial_init (void)
+static int au1x00_serial_init(void)
 {
 	volatile u32 *uart_fifoctl = (volatile u32*)(UART0_ADDR+UART_FCR);
 	volatile u32 *uart_enable = (volatile u32*)(UART0_ADDR+UART_ENABLE);
@@ -63,7 +65,7 @@ int serial_init (void)
 }
 
 
-void serial_setbrg (void)
+static void au1x00_serial_setbrg(void)
 {
 	volatile u32 *uart_clk = (volatile u32*)(UART0_ADDR+UART_CLK);
 	volatile u32 *uart_lcr = (volatile u32*)(UART0_ADDR+UART_LCR);
@@ -87,12 +89,13 @@ void serial_setbrg (void)
 	*uart_lcr = UART_LCR_WLEN8;
 }
 
-void serial_putc (const char c)
+static void au1x00_serial_putc(const char c)
 {
 	volatile u32 *uart_lsr = (volatile u32*)(UART0_ADDR+UART_LSR);
 	volatile u32 *uart_tx = (volatile u32*)(UART0_ADDR+UART_TX);
 
-	if (c == '\n') serial_putc ('\r');
+	if (c == '\n')
+		au1x00_serial_putc('\r');
 
 	/* Wait for fifo to shift out some bytes */
 	while((*uart_lsr&UART_LSR_THRE)==0);
@@ -100,15 +103,13 @@ void serial_putc (const char c)
 	*uart_tx = (u32)c;
 }
 
-void serial_puts (const char *s)
+static void au1x00_serial_puts(const char *s)
 {
 	while (*s)
-	{
-		serial_putc (*s++);
-	}
+		serial_putc(*s++);
 }
 
-int serial_getc (void)
+static int au1x00_serial_getc(void)
 {
 	volatile u32 *uart_rx = (volatile u32*)(UART0_ADDR+UART_RX);
 	char c;
@@ -119,7 +120,7 @@ int serial_getc (void)
 	return c;
 }
 
-int serial_tstc (void)
+static int au1x00_serial_tstc(void)
 {
 	volatile u32 *uart_lsr = (volatile u32*)(UART0_ADDR+UART_LSR);
 
@@ -129,3 +130,56 @@ int serial_tstc (void)
 	}
 	return 0;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device au1x00_serial_drv = {
+	.name	= "au1x00_serial",
+	.start	= au1x00_serial_init,
+	.stop	= NULL,
+	.setbrg	= au1x00_serial_setbrg,
+	.putc	= au1x00_serial_putc,
+	.puts	= au1x00_serial_puts,
+	.getc	= au1x00_serial_getc,
+	.tstc	= au1x00_serial_tstc,
+};
+
+void au1x00_serial_initialize(void)
+{
+	serial_register(&au1x00_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &au1x00_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return au1x00_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	au1x00_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	au1x00_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	au1x00_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return au1x00_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return au1x00_serial_tstc();
+}
+#endif
diff --git a/common/serial.c b/common/serial.c
index 25aeea0..6ddc5fa 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -49,6 +49,7 @@ serial_initfunc(bfin_serial_initialize);
 serial_initfunc(bfin_jtag_initialize);
 serial_initfunc(mpc512x_serial_initialize);
 serial_initfunc(uartlite_serial_initialize);
+serial_initfunc(au1x00_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -76,6 +77,8 @@ void serial_initialize(void)
 	bfin_serial_initialize();
 	bfin_jtag_initialize();
 	uartlite_serial_initialize();
+	au1x00_serial_initialize();
+
 	serial_assign(default_serial_console()->name);
 }
 
-- 
1.7.10.4

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

* [U-Boot] [PATCH 21/72] serial: mips: Implement CONFIG_SERIAL_MULTI into asc serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (19 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 20/72] serial: mips: Implement CONFIG_SERIAL_MULTI into au1x00 serial driver Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 22/72] serial: mips: Implement CONFIG_SERIAL_MULTI into JZ " Marek Vasut
                       ` (52 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into asc serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the asc driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
---
 arch/mips/cpu/mips32/incaip/asc_serial.c |   67 +++++++++++++++++++++++++++---
 common/serial.c                          |    2 +
 2 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/arch/mips/cpu/mips32/incaip/asc_serial.c b/arch/mips/cpu/mips32/incaip/asc_serial.c
index 7239804..b5f32e2 100644
--- a/arch/mips/cpu/mips32/incaip/asc_serial.c
+++ b/arch/mips/cpu/mips32/incaip/asc_serial.c
@@ -5,6 +5,8 @@
 #include <config.h>
 #include <common.h>
 #include <asm/inca-ip.h>
+#include <serial.h>
+#include <linux/compiler.h>
 #include "asc_serial.h"
 
 
@@ -32,7 +34,7 @@ static volatile incaAsc_t *pAsc = (incaAsc_t *)INCA_IP_ASC;
 * RETURNS: N/A
 */
 
-int serial_init (void)
+static int asc_serial_init(void)
 {
     /* we have to set PMU.EN13 bit to enable an ASC device*/
     INCAASC_PMU_ENABLE(13);
@@ -82,7 +84,7 @@ int serial_init (void)
     return 0;
 }
 
-void serial_setbrg (void)
+static void asc_serial_setbrg(void)
 {
     ulong      uiReloadValue, fdv;
     ulong      f_ASC;
@@ -210,7 +212,7 @@ static int serial_setopt (void)
     return 0;
 }
 
-void serial_putc (const char c)
+static void asc_serial_putc(const char c)
 {
     uint txFl = 0;
 
@@ -234,7 +236,7 @@ void serial_putc (const char c)
     }
 }
 
-void serial_puts (const char *s)
+static void asc_serial_puts(const char *s)
 {
     while (*s)
     {
@@ -242,7 +244,7 @@ void serial_puts (const char *s)
     }
 }
 
-int serial_getc (void)
+static int asc_serial_getc(void)
 {
     ulong symbol_mask;
     char c;
@@ -257,7 +259,7 @@ int serial_getc (void)
     return c;
 }
 
-int serial_tstc (void)
+static int asc_serial_tstc(void)
 {
     int res = 1;
 
@@ -283,3 +285,56 @@ int serial_tstc (void)
 
     return res;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device asc_serial_drv = {
+	.name	= "asc_serial",
+	.start	= asc_serial_init,
+	.stop	= NULL,
+	.setbrg	= asc_serial_setbrg,
+	.putc	= asc_serial_putc,
+	.puts	= asc_serial_puts,
+	.getc	= asc_serial_getc,
+	.tstc	= asc_serial_tstc,
+};
+
+void asc_serial_initialize(void)
+{
+	serial_register(&asc_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &asc_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return asc_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	asc_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	asc_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	asc_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return asc_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return asc_serial_tstc();
+}
+#endif
diff --git a/common/serial.c b/common/serial.c
index 6ddc5fa..d6e83f8 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -50,6 +50,7 @@ serial_initfunc(bfin_jtag_initialize);
 serial_initfunc(mpc512x_serial_initialize);
 serial_initfunc(uartlite_serial_initialize);
 serial_initfunc(au1x00_serial_initialize);
+serial_initfunc(asc_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -78,6 +79,7 @@ void serial_initialize(void)
 	bfin_jtag_initialize();
 	uartlite_serial_initialize();
 	au1x00_serial_initialize();
+	asc_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 22/72] serial: mips: Implement CONFIG_SERIAL_MULTI into JZ serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (20 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 21/72] serial: mips: Implement CONFIG_SERIAL_MULTI into asc " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 23/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc5xx " Marek Vasut
                       ` (51 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into JZ serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the JZ driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
---
 arch/mips/cpu/xburst/jz_serial.c |   67 ++++++++++++++++++++++++++++++++++----
 common/serial.c                  |    2 ++
 2 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/arch/mips/cpu/xburst/jz_serial.c b/arch/mips/cpu/xburst/jz_serial.c
index e6c48e0..b1e1d27 100644
--- a/arch/mips/cpu/xburst/jz_serial.c
+++ b/arch/mips/cpu/xburst/jz_serial.c
@@ -23,6 +23,8 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/jz4740.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 /*
  * serial_init - initialize a channel
@@ -35,7 +37,7 @@
  */
 struct jz4740_uart *uart = (struct jz4740_uart *)CONFIG_SYS_UART_BASE;
 
-int serial_init(void)
+static int jz_serial_init(void)
 {
 	/* Disable port interrupts while changing hardware */
 	writeb(0, &uart->dlhr_ier);
@@ -62,7 +64,7 @@ int serial_init(void)
 	return 0;
 }
 
-void serial_setbrg(void)
+static void jz_serial_setbrg(void)
 {
 	u32 baud_div, tmp;
 
@@ -79,7 +81,7 @@ void serial_setbrg(void)
 	writeb(tmp, &uart->lcr);
 }
 
-int serial_tstc(void)
+static int jz_serial_tstc(void)
 {
 	if (readb(&uart->lsr) & UART_LSR_DR)
 		return 1;
@@ -87,7 +89,7 @@ int serial_tstc(void)
 	return 0;
 }
 
-void serial_putc(const char c)
+static void jz_serial_putc(const char c)
 {
 	if (c == '\n')
 		serial_putc('\r');
@@ -99,7 +101,7 @@ void serial_putc(const char c)
 	writeb((u8)c, &uart->rbr_thr_dllr);
 }
 
-int serial_getc(void)
+static int jz_serial_getc(void)
 {
 	while (!serial_tstc())
 		;
@@ -107,8 +109,61 @@ int serial_getc(void)
 	return readb(&uart->rbr_thr_dllr);
 }
 
-void serial_puts(const char *s)
+static void jz_serial_puts(const char *s)
 {
 	while (*s)
 		serial_putc(*s++);
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device jz_serial_drv = {
+	.name	= "jz_serial",
+	.start	= jz_serial_init,
+	.stop	= NULL,
+	.setbrg	= jz_serial_setbrg,
+	.putc	= jz_serial_putc,
+	.puts	= jz_serial_puts,
+	.getc	= jz_serial_getc,
+	.tstc	= jz_serial_tstc,
+};
+
+void jz_serial_initialize(void)
+{
+	serial_register(&jz_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &jz_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return jz_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	jz_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	jz_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	jz_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return jz_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return jz_serial_tstc();
+}
+#endif
diff --git a/common/serial.c b/common/serial.c
index d6e83f8..dd35a62 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -51,6 +51,7 @@ serial_initfunc(mpc512x_serial_initialize);
 serial_initfunc(uartlite_serial_initialize);
 serial_initfunc(au1x00_serial_initialize);
 serial_initfunc(asc_serial_initialize);
+serial_initfunc(jz_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -80,6 +81,7 @@ void serial_initialize(void)
 	uartlite_serial_initialize();
 	au1x00_serial_initialize();
 	asc_serial_initialize();
+	jz_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 23/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc5xx serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (21 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 22/72] serial: mips: Implement CONFIG_SERIAL_MULTI into JZ " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-10-02  7:07       ` [U-Boot] [PATCH 23/72 V2] " Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 24/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8220 " Marek Vasut
                       ` (50 subsequent siblings)
  73 siblings, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into mpc5xx serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the mpc5xx driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/powerpc/cpu/mpc5xx/serial.c |   95 +++++++++++++++++++++++++++++---------
 common/serial.c                  |    2 +
 2 files changed, 76 insertions(+), 21 deletions(-)

diff --git a/arch/powerpc/cpu/mpc5xx/serial.c b/arch/powerpc/cpu/mpc5xx/serial.c
index 88c6db8..dbaacfc 100644
--- a/arch/powerpc/cpu/mpc5xx/serial.c
+++ b/arch/powerpc/cpu/mpc5xx/serial.c
@@ -33,20 +33,40 @@
 #include <watchdog.h>
 #include <command.h>
 #include <mpc5xx.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
- * Local function prototypes
+ * Local functions
  */
 
-static int ready_to_send(void);
+static int ready_to_send(void)
+{
+	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
+	volatile short status;
+
+	do {
+#if defined(CONFIG_5xx_CONS_SCI1)
+		status = immr->im_qsmcm.qsmcm_sc1sr;
+#else
+		status = immr->im_qsmcm.qsmcm_sc2sr;
+#endif
+
+#if defined(CONFIG_WATCHDOG)
+		reset_5xx_watchdog (immr);
+#endif
+	} while ((status & SCI_TDRE) == 0);
+	return 1;
+
+}
 
 /*
  * Minimal global serial functions needed to use one of the SCI modules.
  */
 
-int serial_init (void)
+static int mpc5xx_serial_init(void)
 {
 	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
 
@@ -63,7 +83,7 @@ int serial_init (void)
 	return 0;
 }
 
-void serial_putc(const char c)
+static void mpc5xx_serial_putc(const char c)
 {
 	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
 
@@ -85,7 +105,7 @@ void serial_putc(const char c)
 	}
 }
 
-int serial_getc(void)
+static int mpc5xx_serial_getc(void)
 {
 	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
 	volatile short status;
@@ -113,7 +133,7 @@ int serial_getc(void)
 	return	tmp;
 }
 
-int serial_tstc()
+static int mpc5xx_serial_tstc()
 {
 	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
 	short status;
@@ -127,7 +147,7 @@ int serial_tstc()
 	return (status & SCI_RDRF);
 }
 
-void serial_setbrg (void)
+static void mpc5xx_serial_setbrg(void)
 {
 	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
 	short scxbr;
@@ -141,7 +161,7 @@ void serial_setbrg (void)
 #endif
 }
 
-void serial_puts (const char *s)
+static void mpc5xx_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc(*s);
@@ -149,22 +169,55 @@ void serial_puts (const char *s)
 	}
 }
 
-int ready_to_send(void)
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device mpc5xx_serial_drv = {
+	.name	= "mpc5xx_serial",
+	.start	= mpc5xx_serial_init,
+	.stop	= NULL,
+	.setbrg	= mpc5xx_serial_setbrg,
+	.putc	= mpc5xx_serial_putc,
+	.puts	= mpc5xx_serial_puts,
+	.getc	= mpc5xx_serial_getc,
+	.tstc	= mpc5xx_serial_tstc,
+};
+
+void mpc5xx_serial_initialize(void)
 {
-	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
-	volatile short status;
+	serial_register(&mpc5xx_serial_drv);
+}
 
-	do {
-#if defined(CONFIG_5xx_CONS_SCI1)
-		status = immr->im_qsmcm.qsmcm_sc1sr;
+__weak struct serial_device *default_serial_console(void)
+{
+	return &mpc5xx_serial_drv;
+}
 #else
-		status = immr->im_qsmcm.qsmcm_sc2sr;
-#endif
+int serial_init(void)
+{
+	return mpc5xx_serial_init();
+}
 
-#if defined(CONFIG_WATCHDOG)
-		reset_5xx_watchdog (immr);
-#endif
-	} while ((status & SCI_TDRE) == 0);
-	return 1;
+void serial_setbrg(void)
+{
+	mpc5xx_serial_setbrg();
+}
 
+void serial_putc(const char c)
+{
+	mpc5xx_serial_putc(c);
 }
+
+void serial_puts(const char *s)
+{
+	mpc5xx_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return mpc5xx_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return mpc5xx_serial_tstc();
+}
+#endif
diff --git a/common/serial.c b/common/serial.c
index dd35a62..69fa583 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -52,6 +52,7 @@ serial_initfunc(uartlite_serial_initialize);
 serial_initfunc(au1x00_serial_initialize);
 serial_initfunc(asc_serial_initialize);
 serial_initfunc(jz_serial_initialize);
+serial_initfunc(mpc5xx_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -82,6 +83,7 @@ void serial_initialize(void)
 	au1x00_serial_initialize();
 	asc_serial_initialize();
 	jz_serial_initialize();
+	mpc5xx_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 24/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8220 serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (22 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 23/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc5xx " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 25/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8260 serial drivers Marek Vasut
                       ` (49 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into mpc8220 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the mpc8220 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/powerpc/cpu/mpc8220/uart.c |   67 +++++++++++++++++++++++++++++++++++----
 common/serial.c                 |    2 ++
 2 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/cpu/mpc8220/uart.c b/arch/powerpc/cpu/mpc8220/uart.c
index 0c4b536..545c81a 100644
--- a/arch/powerpc/cpu/mpc8220/uart.c
+++ b/arch/powerpc/cpu/mpc8220/uart.c
@@ -29,13 +29,15 @@
 
 #include <common.h>
 #include <mpc8220.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
 #define PSC_BASE   MMAP_PSC1
 
 #if defined(CONFIG_PSC_CONSOLE)
-int serial_init (void)
+static int mpc8220_serial_init(void)
 {
 	volatile psc8220_t *psc = (psc8220_t *) PSC_BASE;
 	u32 counter;
@@ -69,7 +71,7 @@ int serial_init (void)
 	return (0);
 }
 
-void serial_putc (const char c)
+static void mpc8220_serial_putc(const char c)
 {
 	volatile psc8220_t *psc = (psc8220_t *) PSC_BASE;
 
@@ -82,14 +84,14 @@ void serial_putc (const char c)
 	psc->xmitbuf[0] = c;
 }
 
-void serial_puts (const char *s)
+static void mpc8220_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
-int serial_getc (void)
+static int mpc8220_serial_getc(void)
 {
 	volatile psc8220_t *psc = (psc8220_t *) PSC_BASE;
 
@@ -98,14 +100,14 @@ int serial_getc (void)
 	return psc->xmitbuf[2];
 }
 
-int serial_tstc (void)
+static int mpc8220_serial_tstc(void)
 {
 	volatile psc8220_t *psc = (psc8220_t *) PSC_BASE;
 
 	return (psc->sr_csr & PSC_SR_RXRDY);
 }
 
-void serial_setbrg (void)
+static void mpc8220_serial_setbrg(void)
 {
 	volatile psc8220_t *psc = (psc8220_t *) PSC_BASE;
 	u32 counter;
@@ -123,4 +125,57 @@ void serial_setbrg (void)
 
 	psc->cr = PSC_CR_RX_ENABLE | PSC_CR_TX_ENABLE;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device mpc8220_serial_drv = {
+	.name	= "mpc8220_serial",
+	.start	= mpc8220_serial_init,
+	.stop	= NULL,
+	.setbrg	= mpc8220_serial_setbrg,
+	.putc	= mpc8220_serial_putc,
+	.puts	= mpc8220_serial_puts,
+	.getc	= mpc8220_serial_getc,
+	.tstc	= mpc8220_serial_tstc,
+};
+
+void mpc8220_serial_initialize(void)
+{
+	serial_register(&mpc8220_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &mpc8220_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return mpc8220_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	mpc8220_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	mpc8220_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	mpc8220_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return mpc8220_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return mpc8220_serial_tstc();
+}
+#endif
 #endif /* CONFIG_PSC_CONSOLE */
diff --git a/common/serial.c b/common/serial.c
index 69fa583..db06f97 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -53,6 +53,7 @@ serial_initfunc(au1x00_serial_initialize);
 serial_initfunc(asc_serial_initialize);
 serial_initfunc(jz_serial_initialize);
 serial_initfunc(mpc5xx_serial_initialize);
+serial_initfunc(mpc8220_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -84,6 +85,7 @@ void serial_initialize(void)
 	asc_serial_initialize();
 	jz_serial_initialize();
 	mpc5xx_serial_initialize();
+	mpc8220_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 25/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8260 serial drivers
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (23 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 24/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8220 " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-10-01 23:22       ` [U-Boot] [PATCH 25/72 V2] " Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 26/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc85xx serial driver Marek Vasut
                       ` (48 subsequent siblings)
  73 siblings, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into both SCC and SMC mpc8260
serial drivers. These drivers were so far only usable directly, but this
patch also adds support for the multi method. This allows using more than
one serial driver alongside the mpc8260 drivers. Also, add a weak
implementation of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/powerpc/cpu/mpc8260/serial_scc.c |   71 ++++++++++++++++++++++++++++-----
 arch/powerpc/cpu/mpc8260/serial_smc.c |   71 ++++++++++++++++++++++++++++-----
 common/serial.c                       |    4 ++
 3 files changed, 124 insertions(+), 22 deletions(-)

diff --git a/arch/powerpc/cpu/mpc8260/serial_scc.c b/arch/powerpc/cpu/mpc8260/serial_scc.c
index 4ab6a28..cfbcd79 100644
--- a/arch/powerpc/cpu/mpc8260/serial_scc.c
+++ b/arch/powerpc/cpu/mpc8260/serial_scc.c
@@ -31,6 +31,8 @@
 #include <common.h>
 #include <mpc8260.h>
 #include <asm/cpm_8260.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -82,7 +84,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #endif
 
-int serial_init (void)
+static int mpc8260_scc_serial_init(void)
 {
 	volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
 	volatile scc_t *sp;
@@ -180,8 +182,7 @@ int serial_init (void)
 	return (0);
 }
 
-void
-serial_setbrg (void)
+static void mpc8260_scc_serial_setbrg(void)
 {
 #if defined(CONFIG_CONS_USE_EXTC)
 	m8260_cpm_extcbrg(SCC_INDEX, gd->baudrate,
@@ -191,8 +192,7 @@ serial_setbrg (void)
 #endif
 }
 
-void
-serial_putc(const char c)
+static void mpc8260_scc_serial_putc(const char c)
 {
 	volatile scc_uart_t	*up;
 	volatile cbd_t		*tbdf;
@@ -217,16 +217,14 @@ serial_putc(const char c)
 	tbdf->cbd_sc |= BD_SC_READY;
 }
 
-void
-serial_puts (const char *s)
+static void mpc8260_scc_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
-int
-serial_getc(void)
+static int mpc8260_scc_serial_getc(void)
 {
 	volatile cbd_t		*rbdf;
 	volatile scc_uart_t	*up;
@@ -250,8 +248,7 @@ serial_getc(void)
 	return (c);
 }
 
-int
-serial_tstc()
+static int mpc8260_scc_serial_tstc(void)
 {
 	volatile cbd_t		*rbdf;
 	volatile scc_uart_t	*up;
@@ -264,6 +261,58 @@ serial_tstc()
 	return ((rbdf->cbd_sc & BD_SC_EMPTY) == 0);
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device mpc8260_scc_serial_drv = {
+	.name	= "mpc8260_scc_serial",
+	.start	= mpc8260_scc_serial_init,
+	.stop	= NULL,
+	.setbrg	= mpc8260_scc_serial_setbrg,
+	.putc	= mpc8260_scc_serial_putc,
+	.puts	= mpc8260_scc_serial_puts,
+	.getc	= mpc8260_scc_serial_getc,
+	.tstc	= mpc8260_scc_serial_tstc,
+};
+
+void mpc8260_scc_serial_initialize(void)
+{
+	serial_register(&mpc8260_scc_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &mpc8260_scc_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return mpc8260_scc_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	mpc8260_scc_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	mpc8260_scc_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	mpc8260_scc_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return mpc8260_scc_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return mpc8260_scc_serial_tstc();
+}
+#endif
 #endif	/* CONFIG_CONS_ON_SCC */
 
 #if defined(CONFIG_KGDB_ON_SCC)
diff --git a/arch/powerpc/cpu/mpc8260/serial_smc.c b/arch/powerpc/cpu/mpc8260/serial_smc.c
index 7b6eaba..012fc98 100644
--- a/arch/powerpc/cpu/mpc8260/serial_smc.c
+++ b/arch/powerpc/cpu/mpc8260/serial_smc.c
@@ -33,6 +33,8 @@
 #include <common.h>
 #include <mpc8260.h>
 #include <asm/cpm_8260.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -91,7 +93,7 @@ static unsigned char brg_map[] = {
 	3,	/* BRG1 for SCC4 */
 };
 
-int serial_init (void)
+static int mpc8260_smc_serial_init(void)
 {
 	volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
 	volatile smc_t *sp;
@@ -183,8 +185,7 @@ int serial_init (void)
 	return (0);
 }
 
-void
-serial_setbrg (void)
+static void mpc8260_smc_serial_setbrg(void)
 {
 #if defined(CONFIG_CONS_USE_EXTC)
 	m8260_cpm_extcbrg(brg_map[SMC_INDEX], gd->baudrate,
@@ -194,8 +195,7 @@ serial_setbrg (void)
 #endif
 }
 
-void
-serial_putc(const char c)
+static void mpc8260_smc_serial_putc(const char c)
 {
 	volatile smc_uart_t	*up;
 	volatile immap_t	*im = (immap_t *)CONFIG_SYS_IMMR;
@@ -216,16 +216,14 @@ serial_putc(const char c)
 	rtx->txbd.cbd_sc |= BD_SC_READY;
 }
 
-void
-serial_puts (const char *s)
+static void mpc8260_smc_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
-int
-serial_getc(void)
+static int mpc8260_smc_serial_getc(void)
 {
 	volatile smc_uart_t	*up;
 	volatile immap_t	*im = (immap_t *)CONFIG_SYS_IMMR;
@@ -254,8 +252,7 @@ serial_getc(void)
 	return(c);
 }
 
-int
-serial_tstc()
+static int mpc8260_smc_serial_tstc(void)
 {
 	volatile smc_uart_t	*up;
 	volatile immap_t	*im = (immap_t *)CONFIG_SYS_IMMR;
@@ -267,6 +264,58 @@ serial_tstc()
 	return !(rtx->rxbd.cbd_sc & BD_SC_EMPTY);
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device mpc8260_smc_serial_drv = {
+	.name	= "mpc8260_smc_serial",
+	.start	= mpc8260_smc_serial_init,
+	.stop	= NULL,
+	.setbrg	= mpc8260_smc_serial_setbrg,
+	.putc	= mpc8260_smc_serial_putc,
+	.puts	= mpc8260_smc_serial_puts,
+	.getc	= mpc8260_smc_serial_getc,
+	.tstc	= mpc8260_smc_serial_tstc,
+};
+
+void mpc8260_smc_serial_initialize(void)
+{
+	serial_register(&mpc8260_smc_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &mpc8260_smc_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return mpc8260_smc_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	mpc8260_smc_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	mpc8260_smc_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	mpc8260_smc_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return mpc8260_smc_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return mpc8260_smc_serial_tstc();
+}
+#endif
 #endif	/* CONFIG_CONS_ON_SMC */
 
 #if defined(CONFIG_KGDB_ON_SMC)
diff --git a/common/serial.c b/common/serial.c
index db06f97..5c8cbdd 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -54,6 +54,8 @@ serial_initfunc(asc_serial_initialize);
 serial_initfunc(jz_serial_initialize);
 serial_initfunc(mpc5xx_serial_initialize);
 serial_initfunc(mpc8220_serial_initialize);
+serial_initfunc(mpc8260_scc_serial_initialize);
+serial_initfunc(mpc8260_smc_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -86,6 +88,8 @@ void serial_initialize(void)
 	jz_serial_initialize();
 	mpc5xx_serial_initialize();
 	mpc8220_serial_initialize();
+	mpc8260_scc_serial_initialize();
+	mpc8260_smc_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 26/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc85xx serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (24 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 25/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8260 serial drivers Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 27/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into iop480 " Marek Vasut
                       ` (47 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into mpc85xx serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the mpc85xx driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/powerpc/cpu/mpc85xx/serial_scc.c |   71 ++++++++++++++++++++++++++++-----
 common/serial.c                       |    2 +
 2 files changed, 62 insertions(+), 11 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/serial_scc.c b/arch/powerpc/cpu/mpc85xx/serial_scc.c
index 2dab212..d192642 100644
--- a/arch/powerpc/cpu/mpc85xx/serial_scc.c
+++ b/arch/powerpc/cpu/mpc85xx/serial_scc.c
@@ -34,6 +34,8 @@
 
 #include <common.h>
 #include <asm/cpm_85xx.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -85,7 +87,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #endif
 
-int serial_init (void)
+static int mpc85xx_serial_init(void)
 {
 	volatile ccsr_cpm_t *cpm = (ccsr_cpm_t *)CONFIG_SYS_MPC85xx_CPM_ADDR;
 	volatile ccsr_cpm_scc_t *sp;
@@ -184,8 +186,7 @@ int serial_init (void)
 	return (0);
 }
 
-void
-serial_setbrg (void)
+static void mpc85xx_serial_setbrg(void)
 {
 #if defined(CONFIG_CONS_USE_EXTC)
 	m8560_cpm_extcbrg(SCC_INDEX, gd->baudrate,
@@ -195,8 +196,7 @@ serial_setbrg (void)
 #endif
 }
 
-void
-serial_putc(const char c)
+static void mpc85xx_serial_putc(const char c)
 {
 	volatile scc_uart_t	*up;
 	volatile cbd_t		*tbdf;
@@ -220,16 +220,14 @@ serial_putc(const char c)
 	tbdf->cbd_sc |= BD_SC_READY;
 }
 
-void
-serial_puts (const char *s)
+static void mpc85xx_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
-int
-serial_getc(void)
+static int mpc85xx_serial_getc(void)
 {
 	volatile cbd_t		*rbdf;
 	volatile scc_uart_t	*up;
@@ -252,8 +250,7 @@ serial_getc(void)
 	return (c);
 }
 
-int
-serial_tstc()
+static int mpc85xx_serial_tstc(void)
 {
 	volatile cbd_t		*rbdf;
 	volatile scc_uart_t	*up;
@@ -265,4 +262,56 @@ serial_tstc()
 	return ((rbdf->cbd_sc & BD_SC_EMPTY) == 0);
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device mpc85xx_serial_drv = {
+	.name	= "mpc85xx_serial",
+	.start	= mpc85xx_serial_init,
+	.stop	= NULL,
+	.setbrg	= mpc85xx_serial_setbrg,
+	.putc	= mpc85xx_serial_putc,
+	.puts	= mpc85xx_serial_puts,
+	.getc	= mpc85xx_serial_getc,
+	.tstc	= mpc85xx_serial_tstc,
+};
+
+void mpc85xx_serial_initialize(void)
+{
+	serial_register(&mpc85xx_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &mpc85xx_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return mpc85xx_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	mpc85xx_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	mpc85xx_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	mpc85xx_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return mpc85xx_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return mpc85xx_serial_tstc();
+}
+#endif
 #endif	/* CONFIG_CONS_ON_SCC */
diff --git a/common/serial.c b/common/serial.c
index 5c8cbdd..aeae51d 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -56,6 +56,7 @@ serial_initfunc(mpc5xx_serial_initialize);
 serial_initfunc(mpc8220_serial_initialize);
 serial_initfunc(mpc8260_scc_serial_initialize);
 serial_initfunc(mpc8260_smc_serial_initialize);
+serial_initfunc(mpc85xx_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -90,6 +91,7 @@ void serial_initialize(void)
 	mpc8220_serial_initialize();
 	mpc8260_scc_serial_initialize();
 	mpc8260_smc_serial_initialize();
+	mpc85xx_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 27/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into iop480 serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (25 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 26/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc85xx serial driver Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 28/72] serial: sparc: Implement CONFIG_SERIAL_MULTI into leon2 " Marek Vasut
                       ` (46 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into iop480 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the iop480 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/powerpc/cpu/ppc4xx/iop480_uart.c |   65 ++++++++++++++++++++++++++++++---
 common/serial.c                       |    2 +
 2 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/cpu/ppc4xx/iop480_uart.c b/arch/powerpc/cpu/ppc4xx/iop480_uart.c
index 027ca30..fb25e15 100644
--- a/arch/powerpc/cpu/ppc4xx/iop480_uart.c
+++ b/arch/powerpc/cpu/ppc4xx/iop480_uart.c
@@ -29,6 +29,7 @@
 
 #ifdef CONFIG_SERIAL_MULTI
 #include <serial.h>
+#include <linux/compiler.h>
 #endif
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -132,7 +133,7 @@ DECLARE_GLOBAL_DATA_PTR;
  * as serial console interface.
  */
 
-int serial_init (void)
+static int iop480_serial_init(void)
 {
 	unsigned short br_reg;
 
@@ -153,7 +154,7 @@ int serial_init (void)
 	return (0);
 }
 
-void serial_setbrg (void)
+static void iop480_serial_setbrg(void)
 {
 	unsigned short br_reg;
 
@@ -165,7 +166,7 @@ void serial_setbrg (void)
 	      ((br_reg & 0xff00) >> 8)); /* ... */
 }
 
-void serial_putc (const char c)
+static void iop480_serial_putc(const char c)
 {
 	if (c == '\n')
 		serial_putc ('\r');
@@ -182,14 +183,14 @@ void serial_putc (const char c)
 	}
 }
 
-void serial_puts (const char *s)
+static void iop480_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
-int serial_getc ()
+static int iop480_serial_getc(void)
 {
 	unsigned char status = 0;
 
@@ -212,7 +213,7 @@ int serial_getc ()
 	return (0x000000ff & (int) in_8((u8 *)asyncRxBufferport1));
 }
 
-int serial_tstc ()
+static int iop480_serial_tstc(void)
 {
 	unsigned char status;
 
@@ -233,4 +234,56 @@ int serial_tstc ()
 	return 0;
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device iop480_serial_drv = {
+	.name	= "iop480_serial",
+	.start	= iop480_serial_init,
+	.stop	= NULL,
+	.setbrg	= iop480_serial_setbrg,
+	.putc	= iop480_serial_putc,
+	.puts	= iop480_serial_puts,
+	.getc	= iop480_serial_getc,
+	.tstc	= iop480_serial_tstc,
+};
+
+void iop480_serial_initialize(void)
+{
+	serial_register(&iop480_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &iop480_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return iop480_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	iop480_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	iop480_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	iop480_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return iop480_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return iop480_serial_tstc();
+}
+#endif
 #endif	/* CONFIG_IOP480 */
diff --git a/common/serial.c b/common/serial.c
index aeae51d..398ad30 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -57,6 +57,7 @@ serial_initfunc(mpc8220_serial_initialize);
 serial_initfunc(mpc8260_scc_serial_initialize);
 serial_initfunc(mpc8260_smc_serial_initialize);
 serial_initfunc(mpc85xx_serial_initialize);
+serial_initfunc(iop480_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -92,6 +93,7 @@ void serial_initialize(void)
 	mpc8260_scc_serial_initialize();
 	mpc8260_smc_serial_initialize();
 	mpc85xx_serial_initialize();
+	iop480_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 28/72] serial: sparc: Implement CONFIG_SERIAL_MULTI into leon2 serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (26 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 27/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into iop480 " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 29/72] serial: sparc: Implement CONFIG_SERIAL_MULTI into leon3 " Marek Vasut
                       ` (45 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into leon2 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the leon2 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Peter Tyser <ptyser@xes-inc.com>
---
 arch/sparc/cpu/leon2/serial.c |   83 ++++++++++++++++++++++++++++++++++-------
 common/serial.c               |    2 +
 2 files changed, 71 insertions(+), 14 deletions(-)

diff --git a/arch/sparc/cpu/leon2/serial.c b/arch/sparc/cpu/leon2/serial.c
index 4f41b8e..61d059b 100644
--- a/arch/sparc/cpu/leon2/serial.c
+++ b/arch/sparc/cpu/leon2/serial.c
@@ -26,6 +26,8 @@
 #include <common.h>
 #include <asm/processor.h>
 #include <asm/leon.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -39,7 +41,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #define READ_DWORD(var) SPARC_NOCACHE_READ_DWORD((unsigned int)&(var))
 #endif
 
-int serial_init(void)
+static int leon2_serial_init(void)
 {
 	LEON2_regs *leon2 = (LEON2_regs *) LEON2_PREGS;
 	LEON2_Uart_regs *regs;
@@ -72,15 +74,7 @@ int serial_init(void)
 	return 0;
 }
 
-void serial_putc(const char c)
-{
-	if (c == '\n')
-		serial_putc_raw('\r');
-
-	serial_putc_raw(c);
-}
-
-void serial_putc_raw(const char c)
+static void leon2_serial_putc_raw(const char c)
 {
 	LEON2_regs *leon2 = (LEON2_regs *) LEON2_PREGS;
 	LEON2_Uart_regs *regs;
@@ -103,14 +97,22 @@ void serial_putc_raw(const char c)
 #endif
 }
 
-void serial_puts(const char *s)
+static void leon2_serial_putc(const char c)
+{
+	if (c == '\n')
+		leon2_serial_putc_raw('\r');
+
+	leon2_serial_putc_raw(c);
+}
+
+static void leon2_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc(*s++);
 	}
 }
 
-int serial_getc(void)
+static int leon2_serial_getc(void)
 {
 	LEON2_regs *leon2 = (LEON2_regs *) LEON2_PREGS;
 	LEON2_Uart_regs *regs;
@@ -128,7 +130,7 @@ int serial_getc(void)
 	return READ_WORD(regs->UART_Channel);
 }
 
-int serial_tstc(void)
+static int leon2_serial_tstc(void)
 {
 	LEON2_regs *leon2 = (LEON2_regs *) LEON2_PREGS;
 	LEON2_Uart_regs *regs;
@@ -143,7 +145,7 @@ int serial_tstc(void)
 }
 
 /* set baud rate for uart */
-void serial_setbrg(void)
+static void leon2_serial_setbrg(void)
 {
 	/* update baud rate settings, read it from gd->baudrate */
 	unsigned int scaler;
@@ -163,3 +165,56 @@ void serial_setbrg(void)
 		regs->UART_Scaler = scaler;
 	}
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device leon2_serial_drv = {
+	.name	= "leon2_serial",
+	.start	= leon2_serial_init,
+	.stop	= NULL,
+	.setbrg	= leon2_serial_setbrg,
+	.putc	= leon2_serial_putc,
+	.puts	= leon2_serial_puts,
+	.getc	= leon2_serial_getc,
+	.tstc	= leon2_serial_tstc,
+};
+
+void leon2_serial_initialize(void)
+{
+	serial_register(&leon2_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &leon2_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return leon2_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	leon2_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	leon2_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	leon2_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return leon2_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return leon2_serial_tstc();
+}
+#endif
diff --git a/common/serial.c b/common/serial.c
index 398ad30..8848126 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -58,6 +58,7 @@ serial_initfunc(mpc8260_scc_serial_initialize);
 serial_initfunc(mpc8260_smc_serial_initialize);
 serial_initfunc(mpc85xx_serial_initialize);
 serial_initfunc(iop480_serial_initialize);
+serial_initfunc(leon2_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -94,6 +95,7 @@ void serial_initialize(void)
 	mpc8260_smc_serial_initialize();
 	mpc85xx_serial_initialize();
 	iop480_serial_initialize();
+	leon2_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 29/72] serial: sparc: Implement CONFIG_SERIAL_MULTI into leon3 serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (27 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 28/72] serial: sparc: Implement CONFIG_SERIAL_MULTI into leon2 " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 30/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into marvell " Marek Vasut
                       ` (44 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into leon3 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the leon3 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Peter Tyser <ptyser@xes-inc.com>
---
 arch/sparc/cpu/leon3/serial.c |   83 ++++++++++++++++++++++++++++++++++-------
 common/serial.c               |    2 +
 2 files changed, 71 insertions(+), 14 deletions(-)

diff --git a/arch/sparc/cpu/leon3/serial.c b/arch/sparc/cpu/leon3/serial.c
index 4b2fcb8..a110244 100644
--- a/arch/sparc/cpu/leon3/serial.c
+++ b/arch/sparc/cpu/leon3/serial.c
@@ -27,6 +27,8 @@
 #include <asm/processor.h>
 #include <asm/leon.h>
 #include <ambapp.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -42,7 +44,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 ambapp_dev_apbuart *leon3_apbuart = NULL;
 
-int serial_init(void)
+static int leon3_serial_init(void)
 {
 	ambapp_apbdev apbdev;
 	unsigned int tmp;
@@ -72,15 +74,7 @@ int serial_init(void)
 	return -1;		/* didn't find hardware */
 }
 
-void serial_putc(const char c)
-{
-	if (c == '\n')
-		serial_putc_raw('\r');
-
-	serial_putc_raw(c);
-}
-
-void serial_putc_raw(const char c)
+static void leon3_serial_putc_raw(const char c)
 {
 	if (!leon3_apbuart)
 		return;
@@ -97,14 +91,22 @@ void serial_putc_raw(const char c)
 #endif
 }
 
-void serial_puts(const char *s)
+static void leon3_serial_putc(const char c)
+{
+	if (c == '\n')
+		leon3_serial_putc_raw('\r');
+
+	leon3_serial_putc_raw(c);
+}
+
+static void leon3_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc(*s++);
 	}
 }
 
-int serial_getc(void)
+static int leon3_serial_getc(void)
 {
 	if (!leon3_apbuart)
 		return 0;
@@ -116,7 +118,7 @@ int serial_getc(void)
 	return READ_WORD(leon3_apbuart->data);
 }
 
-int serial_tstc(void)
+static int leon3_serial_tstc(void)
 {
 	if (leon3_apbuart)
 		return (READ_WORD(leon3_apbuart->status) &
@@ -125,7 +127,7 @@ int serial_tstc(void)
 }
 
 /* set baud rate for uart */
-void serial_setbrg(void)
+static void leon3_serial_setbrg(void)
 {
 	/* update baud rate settings, read it from gd->baudrate */
 	unsigned int scaler;
@@ -137,3 +139,56 @@ void serial_setbrg(void)
 	}
 	return;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device leon3_serial_drv = {
+	.name	= "leon3_serial",
+	.start	= leon3_serial_init,
+	.stop	= NULL,
+	.setbrg	= leon3_serial_setbrg,
+	.putc	= leon3_serial_putc,
+	.puts	= leon3_serial_puts,
+	.getc	= leon3_serial_getc,
+	.tstc	= leon3_serial_tstc,
+};
+
+void leon3_serial_initialize(void)
+{
+	serial_register(&leon3_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &leon3_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return leon3_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	leon3_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	leon3_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	leon3_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return leon3_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return leon3_serial_tstc();
+}
+#endif
diff --git a/common/serial.c b/common/serial.c
index 8848126..4907009 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -59,6 +59,7 @@ serial_initfunc(mpc8260_smc_serial_initialize);
 serial_initfunc(mpc85xx_serial_initialize);
 serial_initfunc(iop480_serial_initialize);
 serial_initfunc(leon2_serial_initialize);
+serial_initfunc(leon3_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -96,6 +97,7 @@ void serial_initialize(void)
 	mpc85xx_serial_initialize();
 	iop480_serial_initialize();
 	leon2_serial_initialize();
+	leon3_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 30/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into marvell serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (28 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 29/72] serial: sparc: Implement CONFIG_SERIAL_MULTI into leon3 " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 31/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into amirix " Marek Vasut
                       ` (43 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into marvell serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the marvell driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/Marvell/common/serial.c |   80 ++++++++++++++++++++++++++++++++++-------
 common/serial.c               |    2 ++
 2 files changed, 69 insertions(+), 13 deletions(-)

diff --git a/board/Marvell/common/serial.c b/board/Marvell/common/serial.c
index 3e7f406..a5231eb 100644
--- a/board/Marvell/common/serial.c
+++ b/board/Marvell/common/serial.c
@@ -32,6 +32,9 @@
 
 #include <common.h>
 #include <command.h>
+#include <serial.h>
+#include <linux/compiler.h>
+
 #include "../include/memory.h"
 #include "serial.h"
 
@@ -48,9 +51,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_MPSC
-
-
-int serial_init (void)
+static int marvell_serial_init(void)
 {
 #if (defined CONFIG_SYS_INIT_CHAN1) || (defined CONFIG_SYS_INIT_CHAN2)
 	int clock_divisor = 230400 / gd->baudrate;
@@ -68,7 +69,7 @@ int serial_init (void)
 	return (0);
 }
 
-void serial_putc (const char c)
+static void marvell_serial_putc(const char c)
 {
 	if (c == '\n')
 		mpsc_putchar ('\r');
@@ -76,24 +77,24 @@ void serial_putc (const char c)
 	mpsc_putchar (c);
 }
 
-int serial_getc (void)
+static int marvell_serial_getc(void)
 {
 	return mpsc_getchar ();
 }
 
-int serial_tstc (void)
+static int marvell_serial_tstc(void)
 {
 	return mpsc_test_char ();
 }
 
-void serial_setbrg (void)
+static void marvell_serial_setbrg(void)
 {
 	galbrg_set_baudrate (CONFIG_MPSC_PORT, gd->baudrate);
 }
 
 #else  /* ! CONFIG_MPSC */
 
-int serial_init (void)
+static int marvell_serial_init(void)
 {
 	int clock_divisor = 230400 / gd->baudrate;
 
@@ -106,7 +107,7 @@ int serial_init (void)
 	return (0);
 }
 
-void serial_putc (const char c)
+static void marvell_serial_putc(const char c)
 {
 	if (c == '\n')
 		NS16550_putc (COM_PORTS[CONFIG_SYS_DUART_CHAN], '\r');
@@ -114,17 +115,17 @@ void serial_putc (const char c)
 	NS16550_putc (COM_PORTS[CONFIG_SYS_DUART_CHAN], c);
 }
 
-int serial_getc (void)
+static int marvell_serial_getc(void)
 {
 	return NS16550_getc (COM_PORTS[CONFIG_SYS_DUART_CHAN]);
 }
 
-int serial_tstc (void)
+static int marvell_serial_tstc(void)
 {
 	return NS16550_tstc (COM_PORTS[CONFIG_SYS_DUART_CHAN]);
 }
 
-void serial_setbrg (void)
+static void marvell_serial_setbrg(void)
 {
 	int clock_divisor = 230400 / gd->baudrate;
 
@@ -138,13 +139,66 @@ void serial_setbrg (void)
 
 #endif /* CONFIG_MPSC */
 
-void serial_puts (const char *s)
+static void marvell_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device marvell_serial_drv = {
+	.name	= "marvell_serial",
+	.start	= marvell_serial_init,
+	.stop	= NULL,
+	.setbrg	= marvell_serial_setbrg,
+	.putc	= marvell_serial_putc,
+	.puts	= marvell_serial_puts,
+	.getc	= marvell_serial_getc,
+	.tstc	= marvell_serial_tstc,
+};
+
+void marvell_serial_initialize(void)
+{
+	serial_register(&marvell_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &marvell_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return marvell_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	marvell_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	marvell_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	marvell_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return marvell_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return marvell_serial_tstc();
+}
+#endif
+
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
 {
diff --git a/common/serial.c b/common/serial.c
index 4907009..0288b49 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -60,6 +60,7 @@ serial_initfunc(mpc85xx_serial_initialize);
 serial_initfunc(iop480_serial_initialize);
 serial_initfunc(leon2_serial_initialize);
 serial_initfunc(leon3_serial_initialize);
+serial_initfunc(marvell_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -98,6 +99,7 @@ void serial_initialize(void)
 	iop480_serial_initialize();
 	leon2_serial_initialize();
 	leon3_serial_initialize();
+	marvell_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 31/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into amirix serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (29 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 30/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into marvell " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 32/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw " Marek Vasut
                       ` (42 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into amirix serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the amirix driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/amirix/ap1000/serial.c |   66 ++++++++++++++++++++++++++++++++++++++----
 common/serial.c              |    2 ++
 2 files changed, 62 insertions(+), 6 deletions(-)

diff --git a/board/amirix/ap1000/serial.c b/board/amirix/ap1000/serial.c
index 87003be..2c2e9f9 100644
--- a/board/amirix/ap1000/serial.c
+++ b/board/amirix/ap1000/serial.c
@@ -24,6 +24,8 @@
 #include <asm/processor.h>
 #include <command.h>
 #include <config.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 #include <ns16550.h>
 
@@ -36,7 +38,7 @@ const NS16550_t COM_PORTS[] =
 #define CONFIG_SYS_DUART_CHAN gComPort
 static int gComPort = 0;
 
-int serial_init (void)
+static int amirix_serial_init(void)
 {
 	int clock_divisor = CONFIG_SYS_NS16550_CLK / 16 / gd->baudrate;
 
@@ -46,7 +48,7 @@ int serial_init (void)
 	return 0;
 }
 
-void serial_putc (const char c)
+static void amirix_serial_putc(const char c)
 {
 	if (c == '\n') {
 		NS16550_putc (COM_PORTS[CONFIG_SYS_DUART_CHAN], '\r');
@@ -55,17 +57,17 @@ void serial_putc (const char c)
 	NS16550_putc (COM_PORTS[CONFIG_SYS_DUART_CHAN], c);
 }
 
-int serial_getc (void)
+static int amirix_serial_getc(void)
 {
 	return NS16550_getc (COM_PORTS[CONFIG_SYS_DUART_CHAN]);
 }
 
-int serial_tstc (void)
+static int amirix_serial_tstc(void)
 {
 	return NS16550_tstc (COM_PORTS[CONFIG_SYS_DUART_CHAN]);
 }
 
-void serial_setbrg (void)
+static void amirix_serial_setbrg(void)
 {
 	int clock_divisor = CONFIG_SYS_NS16550_CLK / 16 / gd->baudrate;
 
@@ -77,13 +79,65 @@ void serial_setbrg (void)
 #endif
 }
 
-void serial_puts (const char *s)
+static void amirix_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device amirix_serial_drv = {
+	.name	= "amirix_serial",
+	.start	= amirix_serial_init,
+	.stop	= NULL,
+	.setbrg	= amirix_serial_setbrg,
+	.putc	= amirix_serial_putc,
+	.puts	= amirix_serial_puts,
+	.getc	= amirix_serial_getc,
+	.tstc	= amirix_serial_tstc,
+};
+
+void amirix_serial_initialize(void)
+{
+	serial_register(&amirix_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &amirix_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return amirix_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	amirix_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	amirix_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	amirix_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return amirix_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return amirix_serial_tstc();
+}
+#endif
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
 {
diff --git a/common/serial.c b/common/serial.c
index 0288b49..6a09139 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -61,6 +61,7 @@ serial_initfunc(iop480_serial_initialize);
 serial_initfunc(leon2_serial_initialize);
 serial_initfunc(leon3_serial_initialize);
 serial_initfunc(marvell_serial_initialize);
+serial_initfunc(amirix_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -100,6 +101,7 @@ void serial_initialize(void)
 	leon2_serial_initialize();
 	leon3_serial_initialize();
 	marvell_serial_initialize();
+	amirix_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 32/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (30 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 31/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into amirix " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 33/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into cogent " Marek Vasut
                       ` (41 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into bmw serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the bmw driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/bmw/serial.c |   68 +++++++++++++++++++++++++++++++++++++++++++++++-----
 common/serial.c    |    2 ++
 2 files changed, 64 insertions(+), 6 deletions(-)

diff --git a/board/bmw/serial.c b/board/bmw/serial.c
index 0c97f12..569131f 100644
--- a/board/bmw/serial.c
+++ b/board/bmw/serial.c
@@ -22,6 +22,9 @@
  */
 
 #include <common.h>
+#include <serial.h>
+#include <linux/compiler.h>
+
 #include "ns16550.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -38,7 +41,7 @@ static struct NS16550 *console =
 
 extern ulong get_bus_freq (ulong);
 
-int serial_init (void)
+static int bmw_serial_init(void)
 {
 	int clock_divisor = gd->bus_clk / 16 / gd->baudrate;
 
@@ -47,7 +50,7 @@ int serial_init (void)
 	return (0);
 }
 
-void serial_putc (const char c)
+static void bmw_serial_putc(const char c)
 {
 	if (c == '\n') {
 		serial_putc ('\r');
@@ -55,7 +58,7 @@ void serial_putc (const char c)
 	NS16550_putc (console, c);
 }
 
-void serial_puts (const char *s)
+static void bmw_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
@@ -63,19 +66,72 @@ void serial_puts (const char *s)
 }
 
 
-int serial_getc (void)
+static int bmw_serial_getc(void)
 {
 	return NS16550_getc (console);
 }
 
-int serial_tstc (void)
+static int bmw_serial_tstc(void)
 {
 	return NS16550_tstc (console);
 }
 
-void serial_setbrg (void)
+static void bmw_serial_setbrg(void)
 {
 	int clock_divisor = get_bus_freq (0) / 16 / gd->baudrate;
 
 	NS16550_reinit (console, clock_divisor);
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device bmw_serial_drv = {
+	.name	= "bmw_serial",
+	.start	= bmw_serial_init,
+	.stop	= NULL,
+	.setbrg	= bmw_serial_setbrg,
+	.putc	= bmw_serial_putc,
+	.puts	= bmw_serial_puts,
+	.getc	= bmw_serial_getc,
+	.tstc	= bmw_serial_tstc,
+};
+
+void bmw_serial_initialize(void)
+{
+	serial_register(&bmw_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &bmw_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return bmw_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	bmw_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	bmw_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	bmw_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return bmw_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return bmw_serial_tstc();
+}
+#endif
diff --git a/common/serial.c b/common/serial.c
index 6a09139..19d3a6f 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -62,6 +62,7 @@ serial_initfunc(leon2_serial_initialize);
 serial_initfunc(leon3_serial_initialize);
 serial_initfunc(marvell_serial_initialize);
 serial_initfunc(amirix_serial_initialize);
+serial_initfunc(bmw_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -102,6 +103,7 @@ void serial_initialize(void)
 	leon3_serial_initialize();
 	marvell_serial_initialize();
 	amirix_serial_initialize();
+	bmw_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 33/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into cogent serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (31 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 32/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 34/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into cpci750 " Marek Vasut
                       ` (40 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into cogent serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the cogent driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/cogent/serial.c |   66 ++++++++++++++++++++++++++++++++++++++++++++-----
 common/serial.c       |    2 ++
 2 files changed, 62 insertions(+), 6 deletions(-)

diff --git a/board/cogent/serial.c b/board/cogent/serial.c
index d9c27be..18a9dbf 100644
--- a/board/cogent/serial.c
+++ b/board/cogent/serial.c
@@ -5,6 +5,8 @@
 
 #include <common.h>
 #include <board/cogent/serial.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -25,7 +27,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #error CONFIG_CONS_INDEX must be configured for Cogent motherboard serial
 #endif
 
-int serial_init (void)
+static int cogent_serial_init(void)
 {
 	cma_mb_serial *mbsp = (cma_mb_serial *) CMA_MB_SERIAL_BASE;
 
@@ -38,7 +40,7 @@ int serial_init (void)
 	return (0);
 }
 
-void serial_setbrg (void)
+static void cogent_serial_setbrg(void)
 {
 	cma_mb_serial *mbsp = (cma_mb_serial *) CMA_MB_SERIAL_BASE;
 	unsigned int divisor;
@@ -54,7 +56,7 @@ void serial_setbrg (void)
 	cma_mb_reg_write (&mbsp->ser_lcr, lcr);	/* unset DLAB */
 }
 
-void serial_putc (const char c)
+static void cogent_serial_putc(const char c)
 {
 	cma_mb_serial *mbsp = (cma_mb_serial *) CMA_MB_SERIAL_BASE;
 
@@ -66,13 +68,13 @@ void serial_putc (const char c)
 	cma_mb_reg_write (&mbsp->ser_thr, c);
 }
 
-void serial_puts (const char *s)
+static void cogent_serial_puts(const char *s)
 {
 	while (*s != '\0')
 		serial_putc (*s++);
 }
 
-int serial_getc (void)
+static int cogent_serial_getc(void)
 {
 	cma_mb_serial *mbsp = (cma_mb_serial *) CMA_MB_SERIAL_BASE;
 
@@ -81,13 +83,65 @@ int serial_getc (void)
 	return ((int) cma_mb_reg_read (&mbsp->ser_rhr) & 0x7f);
 }
 
-int serial_tstc (void)
+static int cogent_serial_tstc(void)
 {
 	cma_mb_serial *mbsp = (cma_mb_serial *) CMA_MB_SERIAL_BASE;
 
 	return ((cma_mb_reg_read (&mbsp->ser_lsr) & LSR_DR) != 0);
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device cogent_serial_drv = {
+	.name	= "cogent_serial",
+	.start	= cogent_serial_init,
+	.stop	= NULL,
+	.setbrg	= cogent_serial_setbrg,
+	.putc	= cogent_serial_putc,
+	.puts	= cogent_serial_puts,
+	.getc	= cogent_serial_getc,
+	.tstc	= cogent_serial_tstc,
+};
+
+void cogent_serial_initialize(void)
+{
+	serial_register(&cogent_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &cogent_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return cogent_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	cogent_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	cogent_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	cogent_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return cogent_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return cogent_serial_tstc();
+}
+#endif
 #endif /* CONS_NONE */
 
 #if defined(CONFIG_CMD_KGDB) && \
diff --git a/common/serial.c b/common/serial.c
index 19d3a6f..a51ce99 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -63,6 +63,7 @@ serial_initfunc(leon3_serial_initialize);
 serial_initfunc(marvell_serial_initialize);
 serial_initfunc(amirix_serial_initialize);
 serial_initfunc(bmw_serial_initialize);
+serial_initfunc(cogent_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -104,6 +105,7 @@ void serial_initialize(void)
 	marvell_serial_initialize();
 	amirix_serial_initialize();
 	bmw_serial_initialize();
+	cogent_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 34/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into cpci750 serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (32 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 33/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into cogent " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 35/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into evb64260 " Marek Vasut
                       ` (39 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into cpci750 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the cpci750 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/esd/cpci750/serial.c |   67 ++++++++++++++++++++++++++++++++++++++++----
 common/serial.c            |    2 ++
 2 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/board/esd/cpci750/serial.c b/board/esd/cpci750/serial.c
index e1af37e..9ff7c27 100644
--- a/board/esd/cpci750/serial.c
+++ b/board/esd/cpci750/serial.c
@@ -35,6 +35,9 @@
 
 #include <common.h>
 #include <command.h>
+#include <serial.h>
+#include <linux/compiler.h>
+
 #include "../../Marvell/include/memory.h"
 #include "serial.h"
 
@@ -42,14 +45,14 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int serial_init (void)
+static int cpci750_serial_init(void)
 {
 	mpsc_init (gd->baudrate);
 
 	return (0);
 }
 
-void serial_putc (const char c)
+static void cpci750_serial_putc(const char c)
 {
 	if (c == '\n')
 		mpsc_putchar ('\r');
@@ -57,29 +60,81 @@ void serial_putc (const char c)
 	mpsc_putchar (c);
 }
 
-int serial_getc (void)
+static int cpci750_serial_getc(void)
 {
 	return mpsc_getchar ();
 }
 
-int serial_tstc (void)
+static int cpci750_serial_tstc(void)
 {
 	return mpsc_test_char ();
 }
 
-void serial_setbrg (void)
+static void cpci750_serial_setbrg(void)
 {
 	galbrg_set_baudrate (CONFIG_MPSC_PORT, gd->baudrate);
 }
 
 
-void serial_puts (const char *s)
+static void cpci750_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device cpci750_serial_drv = {
+	.name	= "cpci750_serial",
+	.start	= cpci750_serial_init,
+	.stop	= NULL,
+	.setbrg	= cpci750_serial_setbrg,
+	.putc	= cpci750_serial_putc,
+	.puts	= cpci750_serial_puts,
+	.getc	= cpci750_serial_getc,
+	.tstc	= cpci750_serial_tstc,
+};
+
+void cpci750_serial_initialize(void)
+{
+	serial_register(&cpci750_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &cpci750_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return cpci750_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	cpci750_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	cpci750_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	cpci750_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return cpci750_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return cpci750_serial_tstc();
+}
+#endif
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
 {
diff --git a/common/serial.c b/common/serial.c
index a51ce99..c77d3ba 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -64,6 +64,7 @@ serial_initfunc(marvell_serial_initialize);
 serial_initfunc(amirix_serial_initialize);
 serial_initfunc(bmw_serial_initialize);
 serial_initfunc(cogent_serial_initialize);
+serial_initfunc(cpci750_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -106,6 +107,7 @@ void serial_initialize(void)
 	amirix_serial_initialize();
 	bmw_serial_initialize();
 	cogent_serial_initialize();
+	cpci750_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 35/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into evb64260 serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (33 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 34/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into cpci750 " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 36/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into ml2 " Marek Vasut
                       ` (38 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into evb64260 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the evb64260 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/evb64260/serial.c |   85 ++++++++++++++++++++++++++++++++++++-----------
 common/serial.c         |    2 ++
 2 files changed, 67 insertions(+), 20 deletions(-)

diff --git a/board/evb64260/serial.c b/board/evb64260/serial.c
index 9d71115..cf46a4d 100644
--- a/board/evb64260/serial.c
+++ b/board/evb64260/serial.c
@@ -30,6 +30,8 @@
 #include <common.h>
 #include <command.h>
 #include <galileo/memory.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 #if (defined CONFIG_SYS_INIT_CHAN1) || (defined CONFIG_SYS_INIT_CHAN2)
 #include <ns16550.h>
@@ -48,7 +50,7 @@ const NS16550_t COM_PORTS[] = { (NS16550_t) CONFIG_SYS_NS16550_COM1,
 
 #ifdef CONFIG_MPSC
 
-int serial_init (void)
+static int evb64260_serial_init(void)
 {
 #if (defined CONFIG_SYS_INIT_CHAN1) || (defined CONFIG_SYS_INIT_CHAN2)
 	int clock_divisor = CONFIG_SYS_NS16550_CLK / 16 / gd->baudrate;
@@ -66,8 +68,7 @@ int serial_init (void)
 	return (0);
 }
 
-void
-serial_putc(const char c)
+static void evb64260_serial_putc(const char c)
 {
 	if (c == '\n')
 		mpsc_putchar('\r');
@@ -75,27 +76,24 @@ serial_putc(const char c)
 	mpsc_putchar(c);
 }
 
-int
-serial_getc(void)
+static int evb64260_serial_getc(void)
 {
 	return mpsc_getchar();
 }
 
-int
-serial_tstc(void)
+static int evb64260_serial_tstc(void)
 {
 	return mpsc_test_char();
 }
 
-void
-serial_setbrg (void)
+static void evb64260_serial_setbrg(void)
 {
 	galbrg_set_baudrate(CONFIG_MPSC_PORT, gd->baudrate);
 }
 
 #else /* ! CONFIG_MPSC */
 
-int serial_init (void)
+static int evb64260_serial_init(void)
 {
 	int clock_divisor = CONFIG_SYS_NS16550_CLK / 16 / gd->baudrate;
 
@@ -109,8 +107,7 @@ int serial_init (void)
 	return (0);
 }
 
-void
-serial_putc(const char c)
+static void evb64260_serial_putc(const char c)
 {
 	if (c == '\n')
 		NS16550_putc(COM_PORTS[CONFIG_SYS_DUART_CHAN], '\r');
@@ -118,20 +115,17 @@ serial_putc(const char c)
 	NS16550_putc(COM_PORTS[CONFIG_SYS_DUART_CHAN], c);
 }
 
-int
-serial_getc(void)
+static int evb64260_serial_getc(void)
 {
 	return NS16550_getc(COM_PORTS[CONFIG_SYS_DUART_CHAN]);
 }
 
-int
-serial_tstc(void)
+static int evb64260_serial_tstc(void)
 {
 	return NS16550_tstc(COM_PORTS[CONFIG_SYS_DUART_CHAN]);
 }
 
-void
-serial_setbrg (void)
+static void evb64260_serial_setbrg(void)
 {
 	int clock_divisor = CONFIG_SYS_NS16550_CLK / 16 / gd->baudrate;
 
@@ -145,14 +139,65 @@ serial_setbrg (void)
 
 #endif /* CONFIG_MPSC */
 
-void
-serial_puts (const char *s)
+static void evb64260_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device evb64260_serial_drv = {
+	.name	= "evb64260_serial",
+	.start	= evb64260_serial_init,
+	.stop	= NULL,
+	.setbrg	= evb64260_serial_setbrg,
+	.putc	= evb64260_serial_putc,
+	.puts	= evb64260_serial_puts,
+	.getc	= evb64260_serial_getc,
+	.tstc	= evb64260_serial_tstc,
+};
+
+void evb64260_serial_initialize(void)
+{
+	serial_register(&evb64260_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &evb64260_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return evb64260_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	evb64260_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	evb64260_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	evb64260_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return evb64260_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return evb64260_serial_tstc();
+}
+#endif
 #if defined(CONFIG_CMD_KGDB)
 void
 kgdb_serial_init(void)
diff --git a/common/serial.c b/common/serial.c
index c77d3ba..2acf4c1 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -65,6 +65,7 @@ serial_initfunc(amirix_serial_initialize);
 serial_initfunc(bmw_serial_initialize);
 serial_initfunc(cogent_serial_initialize);
 serial_initfunc(cpci750_serial_initialize);
+serial_initfunc(evb64260_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -108,6 +109,7 @@ void serial_initialize(void)
 	bmw_serial_initialize();
 	cogent_serial_initialize();
 	cpci750_serial_initialize();
+	evb64260_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 36/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into ml2 serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (34 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 35/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into evb64260 " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 37/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into sconsole " Marek Vasut
                       ` (37 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into ml2 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the ml2 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/ml2/serial.c |   66 +++++++++++++++++++++++++++++++++++++++++++++++-----
 common/serial.c    |    2 ++
 2 files changed, 62 insertions(+), 6 deletions(-)

diff --git a/board/ml2/serial.c b/board/ml2/serial.c
index d9113ab..0ed1150 100644
--- a/board/ml2/serial.c
+++ b/board/ml2/serial.c
@@ -24,6 +24,8 @@
 #include <asm/processor.h>
 #include <command.h>
 #include <configs/ML2.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 #if (defined CONFIG_SYS_INIT_CHAN1) || (defined CONFIG_SYS_INIT_CHAN2)
 #include <ns16550.h>
@@ -37,7 +39,7 @@ const NS16550_t COM_PORTS[] = { (NS16550_t) CONFIG_SYS_NS16550_COM1,
 };
 #endif
 
-int serial_init (void)
+static int ml2_serial_init(void)
 {
 	int clock_divisor = CONFIG_SYS_NS16550_CLK / 16 / gd->baudrate;
 
@@ -51,7 +53,7 @@ int serial_init (void)
 
 }
 
-void serial_putc (const char c)
+static void ml2_serial_putc(const char c)
 {
 	if (c == '\n')
 		NS16550_putc (COM_PORTS[CONFIG_SYS_DUART_CHAN], '\r');
@@ -59,17 +61,17 @@ void serial_putc (const char c)
 	NS16550_putc (COM_PORTS[CONFIG_SYS_DUART_CHAN], c);
 }
 
-int serial_getc (void)
+static int ml2_serial_getc(void)
 {
 	return NS16550_getc (COM_PORTS[CONFIG_SYS_DUART_CHAN]);
 }
 
-int serial_tstc (void)
+static int ml2_serial_tstc(void)
 {
 	return NS16550_tstc (COM_PORTS[CONFIG_SYS_DUART_CHAN]);
 }
 
-void serial_setbrg (void)
+static void ml2_serial_setbrg(void)
 {
 	int clock_divisor = CONFIG_SYS_NS16550_CLK / 16 / gd->baudrate;
 
@@ -81,13 +83,65 @@ void serial_setbrg (void)
 #endif
 }
 
-void serial_puts (const char *s)
+static void ml2_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device ml2_serial_drv = {
+	.name	= "ml2_serial",
+	.start	= ml2_serial_init,
+	.stop	= NULL,
+	.setbrg	= ml2_serial_setbrg,
+	.putc	= ml2_serial_putc,
+	.puts	= ml2_serial_puts,
+	.getc	= ml2_serial_getc,
+	.tstc	= ml2_serial_tstc,
+};
+
+void ml2_serial_initialize(void)
+{
+	serial_register(&ml2_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &ml2_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return ml2_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	ml2_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	ml2_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	ml2_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return ml2_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return ml2_serial_tstc();
+}
+#endif
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
 {
diff --git a/common/serial.c b/common/serial.c
index 2acf4c1..393e296 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -66,6 +66,7 @@ serial_initfunc(bmw_serial_initialize);
 serial_initfunc(cogent_serial_initialize);
 serial_initfunc(cpci750_serial_initialize);
 serial_initfunc(evb64260_serial_initialize);
+serial_initfunc(ml2_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -110,6 +111,7 @@ void serial_initialize(void)
 	cogent_serial_initialize();
 	cpci750_serial_initialize();
 	evb64260_serial_initialize();
+	ml2_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 37/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into sconsole serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (35 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 36/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into ml2 " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 38/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into p3mx " Marek Vasut
                       ` (36 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into sconsole serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the sconsole driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/pcippc2/sconsole.c |   66 +++++++++++++++++++++++++++++++++++++++++-----
 common/serial.c          |    2 ++
 2 files changed, 62 insertions(+), 6 deletions(-)

diff --git a/board/pcippc2/sconsole.c b/board/pcippc2/sconsole.c
index 6ef38f4..0a31963 100644
--- a/board/pcippc2/sconsole.c
+++ b/board/pcippc2/sconsole.c
@@ -23,6 +23,8 @@
 
 #include <config.h>
 #include <common.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 #include "sconsole.h"
 
@@ -34,7 +36,7 @@ int	(*sconsole_getc) (void) = 0;
 int	(*sconsole_tstc) (void) = 0;
 void	(*sconsole_setbrg) (void) = 0;
 
-int serial_init (void)
+static int sconsole_serial_init(void)
 {
 	sconsole_buffer_t *sb = SCONSOLE_BUFFER;
 
@@ -46,7 +48,7 @@ int serial_init (void)
 	return (0);
 }
 
-void serial_putc (char c)
+static void sconsole_serial_putc(char c)
 {
 	if (sconsole_putc) {
 		(*sconsole_putc) (c);
@@ -65,7 +67,7 @@ void serial_putc (char c)
 	}
 }
 
-void serial_puts (const char *s)
+static void sconsole_serial_puts(const char *s)
 {
 	if (sconsole_puts) {
 		(*sconsole_puts) (s);
@@ -84,7 +86,7 @@ void serial_puts (const char *s)
 	}
 }
 
-int serial_getc (void)
+static int sconsole_serial_getc(void)
 {
 	if (sconsole_getc) {
 		return (*sconsole_getc) ();
@@ -93,7 +95,7 @@ int serial_getc (void)
 	}
 }
 
-int serial_tstc (void)
+static int sconsole_serial_tstc(void)
 {
 	if (sconsole_tstc) {
 		return (*sconsole_tstc) ();
@@ -102,7 +104,7 @@ int serial_tstc (void)
 	}
 }
 
-void serial_setbrg (void)
+static void sconsole_serial_setbrg(void)
 {
 	if (sconsole_setbrg) {
 		(*sconsole_setbrg) ();
@@ -113,6 +115,58 @@ void serial_setbrg (void)
 	}
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device sconsole_serial_drv = {
+	.name	= "sconsole_serial",
+	.start	= sconsole_serial_init,
+	.stop	= NULL,
+	.setbrg	= sconsole_serial_setbrg,
+	.putc	= sconsole_serial_putc,
+	.puts	= sconsole_serial_puts,
+	.getc	= sconsole_serial_getc,
+	.tstc	= sconsole_serial_tstc,
+};
+
+void sconsole_serial_initialize(void)
+{
+	serial_register(&sconsole_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &sconsole_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return sconsole_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	sconsole_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	sconsole_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	sconsole_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return sconsole_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return sconsole_serial_tstc();
+}
+#endif
 int sconsole_get_baudrate (void)
 {
 	sconsole_buffer_t *sb = SCONSOLE_BUFFER;
diff --git a/common/serial.c b/common/serial.c
index 393e296..d9cd3bf 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -67,6 +67,7 @@ serial_initfunc(cogent_serial_initialize);
 serial_initfunc(cpci750_serial_initialize);
 serial_initfunc(evb64260_serial_initialize);
 serial_initfunc(ml2_serial_initialize);
+serial_initfunc(sconsole_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -112,6 +113,7 @@ void serial_initialize(void)
 	cpci750_serial_initialize();
 	evb64260_serial_initialize();
 	ml2_serial_initialize();
+	sconsole_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 38/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into p3mx serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (36 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 37/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into sconsole " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 39/72] serial: arm: Implement CONFIG_SERIAL_MULTI into altera_jtag " Marek Vasut
                       ` (35 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into p3mx serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the p3mx driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 board/prodrive/p3mx/serial.c |   68 ++++++++++++++++++++++++++++++++++++++----
 common/serial.c              |    2 ++
 2 files changed, 64 insertions(+), 6 deletions(-)

diff --git a/board/prodrive/p3mx/serial.c b/board/prodrive/p3mx/serial.c
index e1af37e..d3591b4 100644
--- a/board/prodrive/p3mx/serial.c
+++ b/board/prodrive/p3mx/serial.c
@@ -35,6 +35,9 @@
 
 #include <common.h>
 #include <command.h>
+#include <serial.h>
+#include <linux/compiler.h>
+
 #include "../../Marvell/include/memory.h"
 #include "serial.h"
 
@@ -42,14 +45,14 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int serial_init (void)
+static int p3mx_serial_init(void)
 {
 	mpsc_init (gd->baudrate);
 
 	return (0);
 }
 
-void serial_putc (const char c)
+static void p3mx_serial_putc(const char c)
 {
 	if (c == '\n')
 		mpsc_putchar ('\r');
@@ -57,29 +60,82 @@ void serial_putc (const char c)
 	mpsc_putchar (c);
 }
 
-int serial_getc (void)
+static int p3mx_serial_getc(void)
 {
 	return mpsc_getchar ();
 }
 
-int serial_tstc (void)
+static int p3mx_serial_tstc(void)
 {
 	return mpsc_test_char ();
 }
 
-void serial_setbrg (void)
+static void p3mx_serial_setbrg(void)
 {
 	galbrg_set_baudrate (CONFIG_MPSC_PORT, gd->baudrate);
 }
 
 
-void serial_puts (const char *s)
+static void p3mx_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device p3mx_serial_drv = {
+	.name	= "p3mx_serial",
+	.start	= p3mx_serial_init,
+	.stop	= NULL,
+	.setbrg	= p3mx_serial_setbrg,
+	.putc	= p3mx_serial_putc,
+	.puts	= p3mx_serial_puts,
+	.getc	= p3mx_serial_getc,
+	.tstc	= p3mx_serial_tstc,
+};
+
+void p3mx_serial_initialize(void)
+{
+	serial_register(&p3mx_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &p3mx_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return p3mx_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	p3mx_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	p3mx_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	p3mx_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return p3mx_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return p3mx_serial_tstc();
+}
+#endif
+
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
 {
diff --git a/common/serial.c b/common/serial.c
index d9cd3bf..2d6ba05 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -68,6 +68,7 @@ serial_initfunc(cpci750_serial_initialize);
 serial_initfunc(evb64260_serial_initialize);
 serial_initfunc(ml2_serial_initialize);
 serial_initfunc(sconsole_serial_initialize);
+serial_initfunc(p3mx_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -114,6 +115,7 @@ void serial_initialize(void)
 	evb64260_serial_initialize();
 	ml2_serial_initialize();
 	sconsole_serial_initialize();
+	p3mx_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 39/72] serial: arm: Implement CONFIG_SERIAL_MULTI into altera_jtag serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (37 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 38/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into p3mx " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 40/72] serial: arm: Implement CONFIG_SERIAL_MULTI into altera " Marek Vasut
                       ` (34 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into altera_jtag serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the altera_jtag driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Thomas Chou <thomas@wytron.com.tw>
---
 common/serial.c                   |    2 ++
 drivers/serial/altera_jtag_uart.c |   71 +++++++++++++++++++++++++++++++++----
 2 files changed, 67 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 2d6ba05..24879ec 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -69,6 +69,7 @@ serial_initfunc(evb64260_serial_initialize);
 serial_initfunc(ml2_serial_initialize);
 serial_initfunc(sconsole_serial_initialize);
 serial_initfunc(p3mx_serial_initialize);
+serial_initfunc(altera_jtag_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -116,6 +117,7 @@ void serial_initialize(void)
 	ml2_serial_initialize();
 	sconsole_serial_initialize();
 	p3mx_serial_initialize();
+	altera_jtag_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/altera_jtag_uart.c b/drivers/serial/altera_jtag_uart.c
index 2980e4d..d3b6c1c 100644
--- a/drivers/serial/altera_jtag_uart.c
+++ b/drivers/serial/altera_jtag_uart.c
@@ -33,10 +33,16 @@ DECLARE_GLOBAL_DATA_PTR;
  *-----------------------------------------------------------------*/
 static nios_jtag_t *jtag = (nios_jtag_t *)CONFIG_SYS_NIOS_CONSOLE;
 
-void serial_setbrg( void ){ return; }
-int serial_init( void ) { return(0);}
+static void altera_jtag_serial_setbrg(void)
+{
+}
+
+static int altera_jtag_serial_init(void)
+{
+	return 0;
+}
 
-void serial_putc (char c)
+static void altera_jtag_serial_putc(char c)
 {
 	while (1) {
 		unsigned st = readl(&jtag->control);
@@ -51,18 +57,18 @@ void serial_putc (char c)
 	writel ((unsigned char)c, &jtag->data);
 }
 
-void serial_puts (const char *s)
+static void altera_jtag_serial_puts(const char *s)
 {
 	while (*s != 0)
 		serial_putc (*s++);
 }
 
-int serial_tstc (void)
+static int altera_jtag_serial_tstc(void)
 {
 	return ( readl (&jtag->control) & NIOS_JTAG_RRDY);
 }
 
-int serial_getc (void)
+static int altera_jtag_serial_getc(void)
 {
 	int c;
 	unsigned val;
@@ -76,3 +82,56 @@ int serial_getc (void)
 	c = val & 0x0ff;
 	return (c);
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device altera_jtag_serial_drv = {
+	.name	= "altera_jtag_serial",
+	.start	= altera_jtag_serial_init,
+	.stop	= NULL,
+	.setbrg	= altera_jtag_serial_setbrg,
+	.putc	= altera_jtag_serial_putc,
+	.puts	= altera_jtag_serial_puts,
+	.getc	= altera_jtag_serial_getc,
+	.tstc	= altera_jtag_serial_tstc,
+};
+
+void altera_jtag_serial_initialize(void)
+{
+	serial_register(&altera_jtag_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &altera_jtag_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return altera_jtag_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	altera_jtag_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	altera_jtag_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	altera_jtag_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return altera_jtag_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return altera_jtag_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 40/72] serial: arm: Implement CONFIG_SERIAL_MULTI into altera serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (38 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 39/72] serial: arm: Implement CONFIG_SERIAL_MULTI into altera_jtag " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 41/72] serial: arm: Implement CONFIG_SERIAL_MULTI into atmel " Marek Vasut
                       ` (33 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into altera serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the altera driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Scott McNutt <smcnutt@psyent.com>
---
 common/serial.c              |    2 +
 drivers/serial/altera_uart.c |   83 ++++++++++++++++++++++++++++++++++++------
 2 files changed, 73 insertions(+), 12 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 24879ec..e6566da 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -70,6 +70,7 @@ serial_initfunc(ml2_serial_initialize);
 serial_initfunc(sconsole_serial_initialize);
 serial_initfunc(p3mx_serial_initialize);
 serial_initfunc(altera_jtag_serial_initialize);
+serial_initfunc(altera_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -118,6 +119,7 @@ void serial_initialize(void)
 	sconsole_serial_initialize();
 	p3mx_serial_initialize();
 	altera_jtag_serial_initialize();
+	altera_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c
index 045f119..18b820b 100644
--- a/drivers/serial/altera_uart.c
+++ b/drivers/serial/altera_uart.c
@@ -37,27 +37,33 @@ static nios_uart_t *uart = (nios_uart_t *) CONFIG_SYS_NIOS_CONSOLE;
 
 #if defined(CONFIG_SYS_NIOS_FIXEDBAUD)
 
-/* Everything's already setup for fixed-baud PTF
+/*
+ * Everything's already setup for fixed-baud PTF
  * assignment
  */
-void serial_setbrg (void){ return; }
-int serial_init (void) { return (0);}
+static void altera_serial_setbrg(void)
+{
+}
+
+static int altera_serial_init(void)
+{
+	return 0;
+}
 
 #else
 
-void serial_setbrg (void)
+static void altera_serial_setbrg(void)
 {
 	unsigned div;
 
 	div = (CONFIG_SYS_CLK_FREQ/gd->baudrate)-1;
 	writel (div, &uart->divisor);
-	return;
 }
 
-int serial_init (void)
+static int altera_serial_init(void)
 {
-	serial_setbrg ();
-	return (0);
+	serial_setbrg();
+	return 0;
 }
 
 #endif /* CONFIG_SYS_NIOS_FIXEDBAUD */
@@ -65,7 +71,7 @@ int serial_init (void)
 /*-----------------------------------------------------------------------
  * UART CONSOLE
  *---------------------------------------------------------------------*/
-void serial_putc (char c)
+static void altera_serial_putc(char c)
 {
 	if (c == '\n')
 		serial_putc ('\r');
@@ -74,21 +80,74 @@ void serial_putc (char c)
 	writel ((unsigned char)c, &uart->txdata);
 }
 
-void serial_puts (const char *s)
+static void altera_serial_puts(const char *s)
 {
 	while (*s != 0) {
 		serial_putc (*s++);
 	}
 }
 
-int serial_tstc (void)
+static int altera_serial_tstc(void)
 {
 	return (readl (&uart->status) & NIOS_UART_RRDY);
 }
 
-int serial_getc (void)
+static int altera_serial_getc(void)
 {
 	while (serial_tstc () == 0)
 		WATCHDOG_RESET ();
 	return (readl (&uart->rxdata) & 0x00ff );
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device altera_serial_drv = {
+	.name	= "altera_serial",
+	.start	= altera_serial_init,
+	.stop	= NULL,
+	.setbrg	= altera_serial_setbrg,
+	.putc	= altera_serial_putc,
+	.puts	= altera_serial_puts,
+	.getc	= altera_serial_getc,
+	.tstc	= altera_serial_tstc,
+};
+
+void altera_serial_initialize(void)
+{
+	serial_register(&altera_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &altera_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return altera_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	altera_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	altera_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	altera_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return altera_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return altera_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 41/72] serial: arm: Implement CONFIG_SERIAL_MULTI into atmel serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (39 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 40/72] serial: arm: Implement CONFIG_SERIAL_MULTI into altera " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 42/72] serial: arm: Implement CONFIG_SERIAL_MULTI into lpc32xx " Marek Vasut
                       ` (32 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into atmel serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the atmel driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Xu, Hong <Hong.Xu@atmel.com>
---
 common/serial.c              |    2 ++
 drivers/serial/atmel_usart.c |   67 ++++++++++++++++++++++++++++++++++++++----
 2 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index e6566da..b880303 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -71,6 +71,7 @@ serial_initfunc(sconsole_serial_initialize);
 serial_initfunc(p3mx_serial_initialize);
 serial_initfunc(altera_jtag_serial_initialize);
 serial_initfunc(altera_serial_initialize);
+serial_initfunc(atmel_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -120,6 +121,7 @@ void serial_initialize(void)
 	p3mx_serial_initialize();
 	altera_jtag_serial_initialize();
 	altera_serial_initialize();
+	atmel_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c
index 943ef70..d49d5d4 100644
--- a/drivers/serial/atmel_usart.c
+++ b/drivers/serial/atmel_usart.c
@@ -20,6 +20,8 @@
  */
 #include <common.h>
 #include <watchdog.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 #include <asm/io.h>
 #include <asm/arch/clk.h>
@@ -29,7 +31,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void serial_setbrg(void)
+static void atmel_serial_setbrg(void)
 {
 	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
 	unsigned long divisor;
@@ -45,7 +47,7 @@ void serial_setbrg(void)
 	writel(USART3_BF(CD, divisor), &usart->brgr);
 }
 
-int serial_init(void)
+static int atmel_serial_init(void)
 {
 	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
 
@@ -73,7 +75,7 @@ int serial_init(void)
 	return 0;
 }
 
-void serial_putc(char c)
+static void atmel_serial_putc(char c)
 {
 	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
 
@@ -84,13 +86,13 @@ void serial_putc(char c)
 	writel(c, &usart->thr);
 }
 
-void serial_puts(const char *s)
+static void atmel_serial_puts(const char *s)
 {
 	while (*s)
 		serial_putc(*s++);
 }
 
-int serial_getc(void)
+static int atmel_serial_getc(void)
 {
 	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
 
@@ -99,8 +101,61 @@ int serial_getc(void)
 	return readl(&usart->rhr);
 }
 
-int serial_tstc(void)
+static int atmel_serial_tstc(void)
 {
 	atmel_usart3_t *usart = (atmel_usart3_t *)CONFIG_USART_BASE;
 	return (readl(&usart->csr) & USART3_BIT(RXRDY)) != 0;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device atmel_serial_drv = {
+	.name	= "atmel_serial",
+	.start	= atmel_serial_init,
+	.stop	= NULL,
+	.setbrg	= atmel_serial_setbrg,
+	.putc	= atmel_serial_putc,
+	.puts	= atmel_serial_puts,
+	.getc	= atmel_serial_getc,
+	.tstc	= atmel_serial_tstc,
+};
+
+void atmel_serial_initialize(void)
+{
+	serial_register(&atmel_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &atmel_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return atmel_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	atmel_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	atmel_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	atmel_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return atmel_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return atmel_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 42/72] serial: arm: Implement CONFIG_SERIAL_MULTI into lpc32xx serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (40 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 41/72] serial: arm: Implement CONFIG_SERIAL_MULTI into atmel " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 43/72] serial: mcf: Implement CONFIG_SERIAL_MULTI into MCF " Marek Vasut
                       ` (31 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into lpc32xx serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the lpc32xx driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Vladimir Zapolskiy <vz@mleia.com>
---
 common/serial.c                 |    2 ++
 drivers/serial/lpc32xx_hsuart.c |   71 ++++++++++++++++++++++++++-------------
 2 files changed, 50 insertions(+), 23 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index b880303..8bc26d8 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -72,6 +72,7 @@ serial_initfunc(p3mx_serial_initialize);
 serial_initfunc(altera_jtag_serial_initialize);
 serial_initfunc(altera_serial_initialize);
 serial_initfunc(atmel_serial_initialize);
+serial_initfunc(lpc32xx_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -122,6 +123,7 @@ void serial_initialize(void)
 	altera_jtag_serial_initialize();
 	altera_serial_initialize();
 	atmel_serial_initialize();
+	lpc32xx_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/lpc32xx_hsuart.c b/drivers/serial/lpc32xx_hsuart.c
index 8ce3382..536fd46 100644
--- a/drivers/serial/lpc32xx_hsuart.c
+++ b/drivers/serial/lpc32xx_hsuart.c
@@ -22,12 +22,14 @@
 #include <asm/arch/clk.h>
 #include <asm/arch/uart.h>
 #include <asm/io.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
 static struct hsuart_regs *hsuart = (struct hsuart_regs *)HS_UART_BASE;
 
-static void lpc32xx_hsuart_set_baudrate(void)
+static void lpc32xx_serial_setbrg(void)
 {
 	u32 div;
 
@@ -39,7 +41,7 @@ static void lpc32xx_hsuart_set_baudrate(void)
 	writel(div, &hsuart->rate);
 }
 
-static int lpc32xx_hsuart_getc(void)
+static int lpc32xx_serial_getc(void)
 {
 	while (!(readl(&hsuart->level) & HSUART_LEVEL_RX))
 		/* NOP */;
@@ -47,7 +49,7 @@ static int lpc32xx_hsuart_getc(void)
 	return readl(&hsuart->rx) & HSUART_RX_DATA;
 }
 
-static void lpc32xx_hsuart_putc(const char c)
+static void lpc32xx_serial_putc(const char c)
 {
 	writel(c, &hsuart->tx);
 
@@ -56,7 +58,7 @@ static void lpc32xx_hsuart_putc(const char c)
 		/* NOP */;
 }
 
-static int lpc32xx_hsuart_tstc(void)
+static int lpc32xx_serial_tstc(void)
 {
 	if (readl(&hsuart->level) & HSUART_LEVEL_RX)
 		return 1;
@@ -64,49 +66,72 @@ static int lpc32xx_hsuart_tstc(void)
 	return 0;
 }
 
-static void lpc32xx_hsuart_init(void)
+static int lpc32xx_serial_init(void)
 {
-	lpc32xx_hsuart_set_baudrate();
+	lpc32xx_serial_setbrg();
 
 	/* Disable hardware RTS and CTS flow control, set up RX and TX FIFO */
 	writel(HSUART_CTRL_TMO_16 | HSUART_CTRL_HSU_OFFSET(20) |
 	       HSUART_CTRL_HSU_RX_TRIG_32 | HSUART_CTRL_HSU_TX_TRIG_0,
 	       &hsuart->ctrl);
+	return 0;
 }
 
-void serial_setbrg(void)
+static void lpc32xx_serial_puts(const char *s)
 {
-	return lpc32xx_hsuart_set_baudrate();
+	while (*s)
+		serial_putc(*s++);
 }
 
-void serial_putc(const char c)
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device lpc32xx_serial_drv = {
+	.name	= "lpc32xx_serial",
+	.start	= lpc32xx_serial_init,
+	.stop	= NULL,
+	.setbrg	= lpc32xx_serial_setbrg,
+	.putc	= lpc32xx_serial_putc,
+	.puts	= lpc32xx_serial_puts,
+	.getc	= lpc32xx_serial_getc,
+	.tstc	= lpc32xx_serial_tstc,
+};
+
+void lpc32xx_serial_initialize(void)
 {
-	lpc32xx_hsuart_putc(c);
+	serial_register(&lpc32xx_serial_drv);
+}
 
-	/* If \n, also do \r */
-	if (c == '\n')
-		lpc32xx_hsuart_putc('\r');
+__weak struct serial_device *default_serial_console(void)
+{
+	return &lpc32xx_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return lpc32xx_serial_init();
 }
 
-int serial_getc(void)
+void serial_setbrg(void)
 {
-	return lpc32xx_hsuart_getc();
+	lpc32xx_serial_setbrg();
 }
 
-void serial_puts(const char *s)
+void serial_putc(const char c)
 {
-	while (*s)
-		serial_putc(*s++);
+	lpc32xx_serial_putc(c);
 }
 
-int serial_tstc(void)
+void serial_puts(const char *s)
 {
-	return lpc32xx_hsuart_tstc();
+	lpc32xx_serial_puts(s);
 }
 
-int serial_init(void)
+int serial_getc(void)
 {
-	lpc32xx_hsuart_init();
+	return lpc32xx_serial_getc();
+}
 
-	return 0;
+int serial_tstc(void)
+{
+	return lpc32xx_serial_tstc();
 }
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 43/72] serial: mcf: Implement CONFIG_SERIAL_MULTI into MCF serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (41 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 42/72] serial: arm: Implement CONFIG_SERIAL_MULTI into lpc32xx " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 44/72] serial: Implement CONFIG_SERIAL_MULTI into ns9750 " Marek Vasut
                       ` (30 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into MCF serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the MCF driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: TsiChung Liew <tsicliew@gmail.com>
---
 common/serial.c          |    2 ++
 drivers/serial/mcfuart.c |   65 +++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 8bc26d8..fa16dce 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -73,6 +73,7 @@ serial_initfunc(altera_jtag_serial_initialize);
 serial_initfunc(altera_serial_initialize);
 serial_initfunc(atmel_serial_initialize);
 serial_initfunc(lpc32xx_serial_initialize);
+serial_initfunc(mcf_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -124,6 +125,7 @@ void serial_initialize(void)
 	altera_serial_initialize();
 	atmel_serial_initialize();
 	lpc32xx_serial_initialize();
+	mcf_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/mcfuart.c b/drivers/serial/mcfuart.c
index d93b24b..7e0b765 100644
--- a/drivers/serial/mcfuart.c
+++ b/drivers/serial/mcfuart.c
@@ -36,7 +36,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 extern void uart_port_conf(int port);
 
-int serial_init(void)
+static int mcf_serial_init(void)
 {
 	volatile uart_t *uart;
 	u32 counter;
@@ -74,7 +74,7 @@ int serial_init(void)
 	return (0);
 }
 
-void serial_putc(const char c)
+static void mcf_serial_putc(const char c)
 {
 	volatile uart_t *uart = (volatile uart_t *)(CONFIG_SYS_UART_BASE);
 
@@ -87,14 +87,14 @@ void serial_putc(const char c)
 	uart->utb = c;
 }
 
-void serial_puts(const char *s)
+static void mcf_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc(*s++);
 	}
 }
 
-int serial_getc(void)
+static int mcf_serial_getc(void)
 {
 	volatile uart_t *uart = (volatile uart_t *)(CONFIG_SYS_UART_BASE);
 
@@ -103,14 +103,14 @@ int serial_getc(void)
 	return uart->urb;
 }
 
-int serial_tstc(void)
+static int mcf_serial_tstc(void)
 {
 	volatile uart_t *uart = (volatile uart_t *)(CONFIG_SYS_UART_BASE);
 
 	return (uart->usr & UART_USR_RXRDY);
 }
 
-void serial_setbrg(void)
+static void mcf_serial_setbrg(void)
 {
 	volatile uart_t *uart = (volatile uart_t *)(CONFIG_SYS_UART_BASE);
 	u32 counter;
@@ -129,3 +129,56 @@ void serial_setbrg(void)
 
 	uart->ucr = UART_UCR_RX_ENABLED | UART_UCR_TX_ENABLED;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device mcf_serial_drv = {
+	.name	= "mcf_serial",
+	.start	= mcf_serial_init,
+	.stop	= NULL,
+	.setbrg	= mcf_serial_setbrg,
+	.putc	= mcf_serial_putc,
+	.puts	= mcf_serial_puts,
+	.getc	= mcf_serial_getc,
+	.tstc	= mcf_serial_tstc,
+};
+
+void mcf_serial_initialize(void)
+{
+	serial_register(&mcf_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &mcf_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return mcf_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	mcf_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	mcf_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	mcf_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return mcf_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return mcf_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 44/72] serial: Implement CONFIG_SERIAL_MULTI into ns9750 serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (42 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 43/72] serial: mcf: Implement CONFIG_SERIAL_MULTI into MCF " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 45/72] serial: oc: Implement CONFIG_SERIAL_MULTI into OpenCores " Marek Vasut
                       ` (29 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into ns9750 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the ns9750 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                |    2 ++
 drivers/serial/ns9750_serial.c |   65 ++++++++++++++++++++++++++++++++++++----
 2 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index fa16dce..c6a275d 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -74,6 +74,7 @@ serial_initfunc(altera_serial_initialize);
 serial_initfunc(atmel_serial_initialize);
 serial_initfunc(lpc32xx_serial_initialize);
 serial_initfunc(mcf_serial_initialize);
+serial_initfunc(ns9750_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -126,6 +127,7 @@ void serial_initialize(void)
 	atmel_serial_initialize();
 	lpc32xx_serial_initialize();
 	mcf_serial_initialize();
+	ns9750_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/ns9750_serial.c b/drivers/serial/ns9750_serial.c
index e9645a0..829f6d5 100644
--- a/drivers/serial/ns9750_serial.c
+++ b/drivers/serial/ns9750_serial.c
@@ -52,7 +52,7 @@ static unsigned int unCharCache; /* unCharCache is only valid if
  * @Descr: configures GPIOs and UART. Requires BBUS Master Reset turned off
  ***********************************************************************/
 
-int serial_init( void )
+static int ns9750_serial_init(void)
 {
 	unsigned int aunGPIOTxD[] = { 0, 8, 40, 44 };
 	unsigned int aunGPIORxD[] = { 1, 9, 41, 45 };
@@ -85,7 +85,7 @@ int serial_init( void )
  * @Descr: writes one character to the FIFO. Blocks until FIFO is not full
  ***********************************************************************/
 
-void serial_putc( const char c )
+static void ns9750_serial_putc(const char c)
 {
 	if (c == '\n')
 		serial_putc( '\r' );
@@ -105,7 +105,7 @@ void serial_putc( const char c )
  * @Descr: writes non-zero string to the FIFO.
  ***********************************************************************/
 
-void serial_puts( const char *s )
+static void ns9750_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc( *s++ );
@@ -118,7 +118,7 @@ void serial_puts( const char *s )
  * @Descr: performs only 8bit accesses to the FIFO. No error handling
  ***********************************************************************/
 
-int serial_getc( void )
+static int ns9750_serial_getc(void)
 {
 	int i;
 
@@ -142,7 +142,7 @@ int serial_getc( void )
  *	   unCharCache and the numbers of characters in cCharsAvailable
  ***********************************************************************/
 
-int serial_tstc( void )
+static int ns9750_serial_tstc(void)
 {
 	unsigned int unRegCache;
 
@@ -171,7 +171,7 @@ int serial_tstc( void )
 	return 0;
 }
 
-void serial_setbrg( void )
+static void ns9750_serial_setbrg(void)
 {
 	*get_ser_reg_addr_channel( NS9750_SER_BITRATE, CONSOLE ) =
 		calcBitrateRegister();
@@ -208,3 +208,56 @@ static unsigned int calcRxCharGapRegister( void )
 {
 	return NS9750_SER_RX_CHAR_TIMER_TRUN;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device ns9750_serial_drv = {
+	.name	= "ns9750_serial",
+	.start	= ns9750_serial_init,
+	.stop	= NULL,
+	.setbrg	= ns9750_serial_setbrg,
+	.putc	= ns9750_serial_putc,
+	.puts	= ns9750_serial_puts,
+	.getc	= ns9750_serial_getc,
+	.tstc	= ns9750_serial_tstc,
+};
+
+void ns9750_serial_initialize(void)
+{
+	serial_register(&ns9750_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &ns9750_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return ns9750_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	ns9750_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	ns9750_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	ns9750_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return ns9750_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return ns9750_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 45/72] serial: oc: Implement CONFIG_SERIAL_MULTI into OpenCores serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (43 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 44/72] serial: Implement CONFIG_SERIAL_MULTI into ns9750 " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 46/72] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c4510b " Marek Vasut
                       ` (28 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into OpenCores serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the OpenCores driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Scott McNutt <smcnutt@psyent.com>
---
 common/serial.c                 |    2 ++
 drivers/serial/opencores_yanu.c |   67 +++++++++++++++++++++++++++++++++++----
 2 files changed, 62 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index c6a275d..f217093 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -75,6 +75,7 @@ serial_initfunc(atmel_serial_initialize);
 serial_initfunc(lpc32xx_serial_initialize);
 serial_initfunc(mcf_serial_initialize);
 serial_initfunc(ns9750_serial_initialize);
+serial_initfunc(oc_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -128,6 +129,7 @@ void serial_initialize(void)
 	lpc32xx_serial_initialize();
 	mcf_serial_initialize();
 	ns9750_serial_initialize();
+	oc_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/opencores_yanu.c b/drivers/serial/opencores_yanu.c
index f383011..a0dd301 100644
--- a/drivers/serial/opencores_yanu.c
+++ b/drivers/serial/opencores_yanu.c
@@ -37,7 +37,7 @@ static yanu_uart_t *uart = (yanu_uart_t *)CONFIG_SYS_NIOS_CONSOLE;
 
 /* Everything's already setup for fixed-baud PTF assignment*/
 
-void serial_setbrg (void)
+static void oc_serial_setbrg(void)
 {
 	int n, k;
 	const unsigned max_uns = 0xFFFFFFFF;
@@ -68,7 +68,7 @@ void serial_setbrg (void)
 
 #else
 
-void serial_setbrg (void)
+static void oc_serial_setbrg(void)
 {
 	int n, k;
 	const unsigned max_uns = 0xFFFFFFFF;
@@ -100,7 +100,7 @@ void serial_setbrg (void)
 
 #endif /* CONFIG_SYS_NIOS_FIXEDBAUD */
 
-int serial_init (void)
+static int oc_serial_init(void)
 {
 	unsigned action,control;
 
@@ -141,7 +141,7 @@ int serial_init (void)
 /*-----------------------------------------------------------------------
  * YANU CONSOLE
  *---------------------------------------------------------------------*/
-void serial_putc (char c)
+static void oc_serial_putc(char c)
 {
 	int tx_chars;
 	unsigned status;
@@ -161,7 +161,7 @@ void serial_putc (char c)
 	writel((unsigned char)c, &uart->data);
 }
 
-void serial_puts (const char *s)
+static void oc_serial_puts(const char *s)
 {
 	while (*s != 0) {
 		serial_putc (*s++);
@@ -169,7 +169,7 @@ void serial_puts (const char *s)
 }
 
 
-int serial_tstc(void)
+static int oc_serial_tstc(void)
 {
 	unsigned status ;
 
@@ -178,7 +178,7 @@ int serial_tstc(void)
 		 ((1 << YANU_RFIFO_CHARS_N) - 1)) > 0);
 }
 
-int serial_getc (void)
+statoc int oc_serial_getc(void)
 {
 	while (serial_tstc() == 0)
 		WATCHDOG_RESET ();
@@ -188,3 +188,56 @@ int serial_getc (void)
 
 	return(readl(&uart->data) & YANU_DATA_CHAR_MASK);
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device oc_serial_drv = {
+	.name	= "oc_serial",
+	.start	= oc_serial_init,
+	.stop	= NULL,
+	.setbrg	= oc_serial_setbrg,
+	.putc	= oc_serial_putc,
+	.puts	= oc_serial_puts,
+	.getc	= oc_serial_getc,
+	.tstc	= oc_serial_tstc,
+};
+
+void oc_serial_initialize(void)
+{
+	serial_register(&oc_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &oc_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return oc_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	oc_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	oc_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	oc_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return oc_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return oc_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 46/72] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c4510b serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (44 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 45/72] serial: oc: Implement CONFIG_SERIAL_MULTI into OpenCores " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 47/72] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c64xx " Marek Vasut
                       ` (27 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into s3c4510b serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the s3c4510b driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                |    2 ++
 drivers/serial/s3c4510b_uart.c |   65 ++++++++++++++++++++++++++++++++++++----
 2 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index f217093..d0a20e9 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -76,6 +76,7 @@ serial_initfunc(lpc32xx_serial_initialize);
 serial_initfunc(mcf_serial_initialize);
 serial_initfunc(ns9750_serial_initialize);
 serial_initfunc(oc_serial_initialize);
+serial_initfunc(s3c4510b_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -130,6 +131,7 @@ void serial_initialize(void)
 	mcf_serial_initialize();
 	ns9750_serial_initialize();
 	oc_serial_initialize();
+	s3c4510b_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/s3c4510b_uart.c b/drivers/serial/s3c4510b_uart.c
index aa378e1..4f7f98e 100644
--- a/drivers/serial/s3c4510b_uart.c
+++ b/drivers/serial/s3c4510b_uart.c
@@ -80,7 +80,7 @@ static int serial_flush_output(void)
 }
 
 
-void serial_setbrg (void)
+static void s3c4510b_serial_setbrg(void)
 {
 	UART_LINE_CTRL ulctrl;
 	UART_CTRL      uctrl;
@@ -135,7 +135,7 @@ void serial_setbrg (void)
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  *
  */
-int serial_init (void)
+static int s3c4510b_serial_init(void)
 {
 
 #if   CONFIG_SERIAL1 == 1
@@ -155,7 +155,7 @@ int serial_init (void)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc (const char c)
+static void s3c4510_serial_putc(const char c)
 {
 	/* wait for room in the transmit FIFO */
 	while( !uart->m_stat.bf.txBufEmpty);
@@ -174,7 +174,7 @@ void serial_putc (const char c)
  * Test if an input byte is ready from the serial port. Returns non-zero on
  * success, 0 otherwise.
  */
-int serial_tstc (void)
+static int s3c4510b_serial_tstc(void)
 {
 	return uart->m_stat.bf.rxReady;
 }
@@ -184,7 +184,7 @@ int serial_tstc (void)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_getc (void)
+static int s3c4510b_serial_getc(void)
 {
 	int rv;
 
@@ -197,7 +197,7 @@ int serial_getc (void)
 	}
 }
 
-void serial_puts (const char *s)
+static void s3c4510b_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
@@ -210,3 +210,56 @@ void serial_puts (const char *s)
 	uart->m_ctrl.bf.sendBreak = 0;
 
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device s3c4510b_serial_drv = {
+	.name	= "s3c4510b_serial",
+	.start	= s3c4510b_serial_init,
+	.stop	= NULL,
+	.setbrg	= s3c4510b_serial_setbrg,
+	.putc	= s3c4510b_serial_putc,
+	.puts	= s3c4510b_serial_puts,
+	.getc	= s3c4510b_serial_getc,
+	.tstc	= s3c4510b_serial_tstc,
+};
+
+void s3c4510b_serial_initialize(void)
+{
+	serial_register(&s3c4510b_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &s3c4510b_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return s3c4510b_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	s3c4510b_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	s3c4510b_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	s3c4510b_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return s3c4510b_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return s3c4510b_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 47/72] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c64xx serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (45 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 46/72] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c4510b " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 48/72] serial: sandbox: Implement CONFIG_SERIAL_MULTI into sandbox " Marek Vasut
                       ` (26 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into s3c64xx serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the s3c64xx driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: John Rigby <john.rigby@linaro.org>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 common/serial.c          |    2 ++
 drivers/serial/s3c64xx.c |   65 +++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index d0a20e9..93d6a08 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -77,6 +77,7 @@ serial_initfunc(mcf_serial_initialize);
 serial_initfunc(ns9750_serial_initialize);
 serial_initfunc(oc_serial_initialize);
 serial_initfunc(s3c4510b_serial_initialize);
+serial_initfunc(s3c64xx_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -132,6 +133,7 @@ void serial_initialize(void)
 	ns9750_serial_initialize();
 	oc_serial_initialize();
 	s3c4510b_serial_initialize();
+	s3c64xx_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/s3c64xx.c b/drivers/serial/s3c64xx.c
index a88e930..823425b 100644
--- a/drivers/serial/s3c64xx.c
+++ b/drivers/serial/s3c64xx.c
@@ -68,7 +68,7 @@ static const int udivslot[] = {
 	0xffdf,
 };
 
-void serial_setbrg(void)
+static void s3c64xx_serial_setbrg(void)
 {
 	s3c64xx_uart *const uart = s3c64xx_get_base_uart(UART_NR);
 	u32 pclk = get_PCLK();
@@ -88,7 +88,7 @@ void serial_setbrg(void)
  * Initialise the serial port with the given baudrate. The settings
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  */
-int serial_init(void)
+static int s3c64xx_serial_init(void)
 {
 	s3c64xx_uart *const uart = s3c64xx_get_base_uart(UART_NR);
 
@@ -110,7 +110,7 @@ int serial_init(void)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_getc(void)
+static int s3c64xx_serial_getc(void)
 {
 	s3c64xx_uart *const uart = s3c64xx_get_base_uart(UART_NR);
 
@@ -137,7 +137,7 @@ void enable_putc(void)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc(const char c)
+static void s3c64xx_serial_putc(const char c)
 {
 	s3c64xx_uart *const uart = s3c64xx_get_base_uart(UART_NR);
 
@@ -159,15 +159,68 @@ void serial_putc(const char c)
 /*
  * Test whether a character is in the RX buffer
  */
-int serial_tstc(void)
+static int s3c64xx_serial_tstc(void)
 {
 	s3c64xx_uart *const uart = s3c64xx_get_base_uart(UART_NR);
 
 	return uart->UTRSTAT & 0x1;
 }
 
-void serial_puts(const char *s)
+static void s3c64xx_serial_puts(const char *s)
 {
 	while (*s)
 		serial_putc(*s++);
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device s3c64xx_serial_drv = {
+	.name	= "s3c64xx_serial",
+	.start	= s3c64xx_serial_init,
+	.stop	= NULL,
+	.setbrg	= s3c64xx_serial_setbrg,
+	.putc	= s3c64xx_serial_putc,
+	.puts	= s3c64xx_serial_puts,
+	.getc	= s3c64xx_serial_getc,
+	.tstc	= s3c64xx_serial_tstc,
+};
+
+void s3c64xx_serial_initialize(void)
+{
+	serial_register(&s3c64xx_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &s3c64xx_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return s3c64xx_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	s3c64xx_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	s3c64xx_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	s3c64xx_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return s3c64xx_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return s3c64xx_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 48/72] serial: sandbox: Implement CONFIG_SERIAL_MULTI into sandbox serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (46 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 47/72] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c64xx " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 49/72] serial: arm: Implement CONFIG_SERIAL_MULTI into clps7111 " Marek Vasut
                       ` (25 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into sandbox serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the sandbox driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Mike Frysinger <vapier@gentoo.org>
---
 common/serial.c          |    2 ++
 drivers/serial/sandbox.c |   67 +++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 63 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 93d6a08..a7a3234 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -78,6 +78,7 @@ serial_initfunc(ns9750_serial_initialize);
 serial_initfunc(oc_serial_initialize);
 serial_initfunc(s3c4510b_serial_initialize);
 serial_initfunc(s3c64xx_serial_initialize);
+serial_initfunc(sandbox_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -134,6 +135,7 @@ void serial_initialize(void)
 	oc_serial_initialize();
 	s3c4510b_serial_initialize();
 	s3c64xx_serial_initialize();
+	sandbox_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/sandbox.c b/drivers/serial/sandbox.c
index 1927c16..d60fbba 100644
--- a/drivers/serial/sandbox.c
+++ b/drivers/serial/sandbox.c
@@ -27,28 +27,30 @@
 
 #include <common.h>
 #include <os.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
-int serial_init(void)
+static int sandbox_serial_init(void)
 {
 	os_tty_raw(0);
 	return 0;
 }
 
-void serial_setbrg(void)
+static void sandbox_serial_setbrg(void)
 {
 }
 
-void serial_putc(const char ch)
+static void sandbox_serial_putc(const char ch)
 {
 	os_write(1, &ch, 1);
 }
 
-void serial_puts(const char *str)
+static void sandbox_serial_puts(const char *str)
 {
 	os_write(1, str, strlen(str));
 }
 
-int serial_getc(void)
+static int sandbox_serial_getc(void)
 {
 	char buf;
 	ssize_t count;
@@ -57,7 +59,60 @@ int serial_getc(void)
 	return count == 1 ? buf : 0;
 }
 
-int serial_tstc(void)
+static int sandbox_serial_tstc(void)
 {
 	return 0;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device sandbox_serial_drv = {
+	.name	= "sandbox_serial",
+	.start	= sandbox_serial_init,
+	.stop	= NULL,
+	.setbrg	= sandbox_serial_setbrg,
+	.putc	= sandbox_serial_putc,
+	.puts	= sandbox_serial_puts,
+	.getc	= sandbox_serial_getc,
+	.tstc	= sandbox_serial_tstc,
+};
+
+void sandbox_serial_initialize(void)
+{
+	serial_register(&sandbox_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &sandbox_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return sandbox_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	sandbox_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	sandbox_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	sandbox_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return sandbox_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return sandbox_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 49/72] serial: arm: Implement CONFIG_SERIAL_MULTI into clps7111 serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (47 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 48/72] serial: sandbox: Implement CONFIG_SERIAL_MULTI into sandbox " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 50/72] serial: arm: Implement CONFIG_SERIAL_MULTI into imx " Marek Vasut
                       ` (24 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into clps7111 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the clps7111 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                  |    2 ++
 drivers/serial/serial_clps7111.c |   66 ++++++++++++++++++++++++++++++++++----
 2 files changed, 61 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index a7a3234..4471262 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -79,6 +79,7 @@ serial_initfunc(oc_serial_initialize);
 serial_initfunc(s3c4510b_serial_initialize);
 serial_initfunc(s3c64xx_serial_initialize);
 serial_initfunc(sandbox_serial_initialize);
+serial_initfunc(clps7111_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -136,6 +137,7 @@ void serial_initialize(void)
 	s3c4510b_serial_initialize();
 	s3c64xx_serial_initialize();
 	sandbox_serial_initialize();
+	clps7111_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_clps7111.c b/drivers/serial/serial_clps7111.c
index a6aecad..e1bed90 100644
--- a/drivers/serial/serial_clps7111.c
+++ b/drivers/serial/serial_clps7111.c
@@ -33,7 +33,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void serial_setbrg (void)
+static void clps7111_serial_setbrg(void)
 {
 	unsigned int reg = 0;
 
@@ -63,7 +63,7 @@ void serial_setbrg (void)
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  *
  */
-int serial_init (void)
+static int clps7111_serial_init(void)
 {
 	serial_setbrg ();
 
@@ -74,7 +74,7 @@ int serial_init (void)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc (const char c)
+static void clps7111_serial_putc(const char c)
 {
 	int tmo;
 
@@ -95,7 +95,7 @@ void serial_putc (const char c)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_tstc (void)
+static int clps7111_serial_tstc(void)
 {
 	return !(IO_SYSFLG1 & SYSFLG1_URXFE);
 }
@@ -105,17 +105,69 @@ int serial_tstc (void)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_getc (void)
+static int clps7111_serial_getc(void)
 {
 	while (IO_SYSFLG1 & SYSFLG1_URXFE);
 
 	return IO_UARTDR1 & 0xff;
 }
 
-void
-serial_puts (const char *s)
+static void clps7111_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device clps7111_serial_drv = {
+	.name	= "clps7111_serial",
+	.start	= clps7111_serial_init,
+	.stop	= NULL,
+	.setbrg	= clps7111_serial_setbrg,
+	.putc	= clps7111_serial_putc,
+	.puts	= clps7111_serial_puts,
+	.getc	= clps7111_serial_getc,
+	.tstc	= clps7111_serial_tstc,
+};
+
+void clps7111_serial_initialize(void)
+{
+	serial_register(&clps7111_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &clps7111_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return clps7111_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	clps7111_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	clps7111_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	clps7111_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return clps7111_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return clps7111_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 50/72] serial: arm: Implement CONFIG_SERIAL_MULTI into imx serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (48 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 49/72] serial: arm: Implement CONFIG_SERIAL_MULTI into clps7111 " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 51/72] serial: arm: Implement CONFIG_SERIAL_MULTI into ixp " Marek Vasut
                       ` (23 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into imx serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the imx driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Stefano Babic <sbabic@denx.de>
---
 common/serial.c             |    2 ++
 drivers/serial/serial_imx.c |   68 ++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 63 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 4471262..cb8eacf 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -80,6 +80,7 @@ serial_initfunc(s3c4510b_serial_initialize);
 serial_initfunc(s3c64xx_serial_initialize);
 serial_initfunc(sandbox_serial_initialize);
 serial_initfunc(clps7111_serial_initialize);
+serial_initfunc(imx_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -138,6 +139,7 @@ void serial_initialize(void)
 	s3c64xx_serial_initialize();
 	sandbox_serial_initialize();
 	clps7111_serial_initialize();
+	imx_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_imx.c b/drivers/serial/serial_imx.c
index b9ca748..d37ec29 100644
--- a/drivers/serial/serial_imx.c
+++ b/drivers/serial/serial_imx.c
@@ -19,6 +19,8 @@
 
 #include <common.h>
 #include <asm/arch/imx-regs.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 #if defined CONFIG_IMX_SERIAL1
 #define UART_BASE IMX_UART1_BASE
@@ -50,7 +52,7 @@ struct imx_serial {
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void serial_setbrg (void)
+static void imx_serial_setbrg(void)
 {
 	serial_init();
 }
@@ -62,7 +64,7 @@ extern void imx_gpio_mode(int gpio_mode);
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  *
  */
-int serial_init (void)
+static int imx_serial_init(void)
 {
 	volatile struct imx_serial* base = (struct imx_serial *)UART_BASE;
 	unsigned int ufcr_rfdiv;
@@ -163,7 +165,7 @@ int serial_init (void)
  * otherwise. When the function is successful, the character read is
  * written into its argument c.
  */
-int serial_getc (void)
+static int imx_serial_getc(void)
 {
 	volatile struct imx_serial* base = (struct imx_serial *)UART_BASE;
 	unsigned char ch;
@@ -185,7 +187,7 @@ int hwflow_onoff(int on)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc (const char c)
+static void imx_serial_putc(const char c)
 {
 	volatile struct imx_serial* base = (struct imx_serial *)UART_BASE;
 
@@ -202,7 +204,7 @@ void serial_putc (const char c)
 /*
  * Test whether a character is in the RX buffer
  */
-int serial_tstc (void)
+static int imx_serial_tstc(void)
 {
 	volatile struct imx_serial* base = (struct imx_serial *)UART_BASE;
 
@@ -212,10 +214,62 @@ int serial_tstc (void)
 	return 1;
 }
 
-void
-serial_puts (const char *s)
+static void imx_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device imx_serial_drv = {
+	.name	= "imx_serial",
+	.start	= imx_serial_init,
+	.stop	= NULL,
+	.setbrg	= imx_serial_setbrg,
+	.putc	= imx_serial_putc,
+	.puts	= imx_serial_puts,
+	.getc	= imx_serial_getc,
+	.tstc	= imx_serial_tstc,
+};
+
+void imx_serial_initialize(void)
+{
+	serial_register(&imx_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &imx_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return imx_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	imx_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	imx_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	imx_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return imx_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return imx_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 51/72] serial: arm: Implement CONFIG_SERIAL_MULTI into ixp serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (49 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 50/72] serial: arm: Implement CONFIG_SERIAL_MULTI into imx " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 52/72] serial: arm: Implement CONFIG_SERIAL_MULTI into ks8695 " Marek Vasut
                       ` (22 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into ixp serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the ixp driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Michael Schwingen <michael@schwingen.org>
---
 common/serial.c             |    2 ++
 drivers/serial/serial_ixp.c |   68 ++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 63 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index cb8eacf..3d8fa7f 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -81,6 +81,7 @@ serial_initfunc(s3c64xx_serial_initialize);
 serial_initfunc(sandbox_serial_initialize);
 serial_initfunc(clps7111_serial_initialize);
 serial_initfunc(imx_serial_initialize);
+serial_initfunc(ixp_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -140,6 +141,7 @@ void serial_initialize(void)
 	sandbox_serial_initialize();
 	clps7111_serial_initialize();
 	imx_serial_initialize();
+	ixp_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_ixp.c b/drivers/serial/serial_ixp.c
index a9acd47..6e3f7f0 100644
--- a/drivers/serial/serial_ixp.c
+++ b/drivers/serial/serial_ixp.c
@@ -31,6 +31,8 @@
 #include <common.h>
 #include <asm/arch/ixp425.h>
 #include <watchdog.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 /*
  *               14.7456 MHz
@@ -41,7 +43,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void serial_setbrg (void)
+static void ixp_serial_setbrg(void)
 {
 	unsigned int quot = 0;
 	int uart = CONFIG_SYS_IXP425_CONSOLE;
@@ -72,7 +74,7 @@ void serial_setbrg (void)
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  *
  */
-int serial_init (void)
+static int ixp_serial_init(void)
 {
 	serial_setbrg ();
 
@@ -83,7 +85,7 @@ int serial_init (void)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc (const char c)
+static void ixp_serial_putc(const char c)
 {
 	/* wait for room in the tx FIFO on UART */
 	while ((LSR(CONFIG_SYS_IXP425_CONSOLE) & LSR_TEMT) == 0)
@@ -101,7 +103,7 @@ void serial_putc (const char c)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_tstc (void)
+static int ixp_serial_tstc(void)
 {
 	return LSR(CONFIG_SYS_IXP425_CONSOLE) & LSR_DR;
 }
@@ -111,7 +113,7 @@ int serial_tstc (void)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_getc (void)
+static int ixp_serial_getc(void)
 {
 	while (!(LSR(CONFIG_SYS_IXP425_CONSOLE) & LSR_DR))
 		WATCHDOG_RESET();	/* Reset HW Watchdog, if needed */
@@ -119,10 +121,62 @@ int serial_getc (void)
 	return (char) RBR(CONFIG_SYS_IXP425_CONSOLE) & 0xff;
 }
 
-void
-serial_puts (const char *s)
+static void ixp_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device ixp_serial_drv = {
+	.name	= "ixp_serial",
+	.start	= ixp_serial_init,
+	.stop	= NULL,
+	.setbrg	= ixp_serial_setbrg,
+	.putc	= ixp_serial_putc,
+	.puts	= ixp_serial_puts,
+	.getc	= ixp_serial_getc,
+	.tstc	= ixp_serial_tstc,
+};
+
+void ixp_serial_initialize(void)
+{
+	serial_register(&ixp_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &ixp_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return ixp_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	ixp_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	ixp_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	ixp_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return ixp_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return ixp_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 52/72] serial: arm: Implement CONFIG_SERIAL_MULTI into ks8695 serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (50 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 51/72] serial: arm: Implement CONFIG_SERIAL_MULTI into ixp " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 53/72] serial: arm: Implement CONFIG_SERIAL_MULTI into lh7a40x " Marek Vasut
                       ` (21 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into ks8695 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the ks8695 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                |    2 ++
 drivers/serial/serial_ks8695.c |   73 +++++++++++++++++++++++++++++++++++-----
 2 files changed, 66 insertions(+), 9 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 3d8fa7f..21c8ac3 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -82,6 +82,7 @@ serial_initfunc(sandbox_serial_initialize);
 serial_initfunc(clps7111_serial_initialize);
 serial_initfunc(imx_serial_initialize);
 serial_initfunc(ixp_serial_initialize);
+serial_initfunc(ks8695_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -142,6 +143,7 @@ void serial_initialize(void)
 	clps7111_serial_initialize();
 	imx_serial_initialize();
 	ixp_serial_initialize();
+	ks8695_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_ks8695.c b/drivers/serial/serial_ks8695.c
index aacd1be..b3af388 100644
--- a/drivers/serial/serial_ks8695.c
+++ b/drivers/serial/serial_ks8695.c
@@ -20,6 +20,8 @@
 
 #include <common.h>
 #include <asm/arch/platform.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 #ifndef CONFIG_SERIAL1
 #error "Bad: you didn't configure serial ..."
@@ -54,7 +56,7 @@ struct ks8695uart {
 int serial_console = 1;
 
 
-void serial_setbrg(void)
+static void ks8695_serial_setbrg(void)
 {
 	volatile struct ks8695uart *uartp = KS8695_UART_ADDR;
 
@@ -63,14 +65,14 @@ void serial_setbrg(void)
 	uartp->LCR = KS8695_UART_LINEC_WLEN8;
 }
 
-int serial_init(void)
+static int ks8695_serial_init(void)
 {
 	serial_console = 1;
 	serial_setbrg();
 	return 0;
 }
 
-void serial_raw_putc(const char c)
+static void ks8695_serial_raw_putc(const char c)
 {
 	volatile struct ks8695uart *uartp = KS8695_UART_ADDR;
 	int i;
@@ -83,16 +85,16 @@ void serial_raw_putc(const char c)
 	uartp->TX = c;
 }
 
-void serial_putc(const char c)
+static void ks8695_serial_putc(const char c)
 {
 	if (serial_console) {
-		serial_raw_putc(c);
+		ks8695_serial_raw_putc(c);
 		if (c == '\n')
-			serial_raw_putc('\r');
+			ks8695_serial_raw_putc('\r');
 	}
 }
 
-int serial_tstc(void)
+static int ks8695_serial_tstc(void)
 {
 	volatile struct ks8695uart *uartp = KS8695_UART_ADDR;
 	if (serial_console)
@@ -100,14 +102,14 @@ int serial_tstc(void)
 	return 0;
 }
 
-void serial_puts(const char *s)
+static void ks8695_serial_puts(const char *s)
 {
 	char c;
 	while ((c = *s++) != 0)
 		serial_putc(c);
 }
 
-int serial_getc(void)
+static int ks8695_serial_getc(void)
 {
 	volatile struct ks8695uart *uartp = KS8695_UART_ADDR;
 
@@ -115,3 +117,56 @@ int serial_getc(void)
 		;
 	return (uartp->RX);
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device ks8695_serial_drv = {
+	.name	= "ks8695_serial",
+	.start	= ks8695_serial_init,
+	.stop	= NULL,
+	.setbrg	= ks8695_serial_setbrg,
+	.putc	= ks8695_serial_putc,
+	.puts	= ks8695_serial_puts,
+	.getc	= ks8695_serial_getc,
+	.tstc	= ks8695_serial_tstc,
+};
+
+void ks8695_serial_initialize(void)
+{
+	serial_register(&ks8695_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &ks8695_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return ks8695_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	ks8695_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	ks8695_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	ks8695_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return ks8695_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return ks8695_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 53/72] serial: arm: Implement CONFIG_SERIAL_MULTI into lh7a40x serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (51 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 52/72] serial: arm: Implement CONFIG_SERIAL_MULTI into ks8695 " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 54/72] serial: arm: Implement CONFIG_SERIAL_MULTI into lpc2292 " Marek Vasut
                       ` (20 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into lh7a40x serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the lh7a40x driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                 |    2 ++
 drivers/serial/serial_lh7a40x.c |   66 ++++++++++++++++++++++++++++++++++-----
 2 files changed, 61 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 21c8ac3..59a8650 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -83,6 +83,7 @@ serial_initfunc(clps7111_serial_initialize);
 serial_initfunc(imx_serial_initialize);
 serial_initfunc(ixp_serial_initialize);
 serial_initfunc(ks8695_serial_initialize);
+serial_initfunc(lh7a40x_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -144,6 +145,7 @@ void serial_initialize(void)
 	imx_serial_initialize();
 	ixp_serial_initialize();
 	ks8695_serial_initialize();
+	lh7a40x_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_lh7a40x.c b/drivers/serial/serial_lh7a40x.c
index 4767489..6b73606 100644
--- a/drivers/serial/serial_lh7a40x.c
+++ b/drivers/serial/serial_lh7a40x.c
@@ -33,7 +33,7 @@ DECLARE_GLOBAL_DATA_PTR;
 # error "No console configured ... "
 #endif
 
-void serial_setbrg (void)
+static void lh7a40x_serial_setbrg(void)
 {
 	lh7a40x_uart_t* uart = LH7A40X_UART_PTR(UART_CONSOLE);
 	int i;
@@ -61,7 +61,7 @@ void serial_setbrg (void)
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  *
  */
-int serial_init (void)
+static int lh7a40x_serial_init(void)
 {
 	lh7a40x_uart_t* uart = LH7A40X_UART_PTR(UART_CONSOLE);
 
@@ -95,7 +95,7 @@ int serial_init (void)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_getc (void)
+static int lh7a40x_serial_getc(void)
 {
 	lh7a40x_uart_t* uart = LH7A40X_UART_PTR(UART_CONSOLE);
 
@@ -141,7 +141,7 @@ void enable_putc(void)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc (const char c)
+static void lh7a40x_serial_putc(const char c)
 {
 	lh7a40x_uart_t* uart = LH7A40X_UART_PTR(UART_CONSOLE);
 
@@ -168,17 +168,69 @@ void serial_putc (const char c)
 /*
  * Test whether a character is in the RX buffer
  */
-int serial_tstc (void)
+static int lh7a40x_serial_tstc(void)
 {
 	lh7a40x_uart_t* uart = LH7A40X_UART_PTR(UART_CONSOLE);
 
 	return(!(uart->status & UART_RXFE));
 }
 
-void
-serial_puts (const char *s)
+static void lh7a40x_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device lh7a40x_serial_drv = {
+	.name	= "lh7a40x_serial",
+	.start	= lh7a40x_serial_init,
+	.stop	= NULL,
+	.setbrg	= lh7a40x_serial_setbrg,
+	.putc	= lh7a40x_serial_putc,
+	.puts	= lh7a40x_serial_puts,
+	.getc	= lh7a40x_serial_getc,
+	.tstc	= lh7a40x_serial_tstc,
+};
+
+void lh7a40x_serial_initialize(void)
+{
+	serial_register(&lh7a40x_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &lh7a40x_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return lh7a40x_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	lh7a40x_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	lh7a40x_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	lh7a40x_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return lh7a40x_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return lh7a40x_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 54/72] serial: arm: Implement CONFIG_SERIAL_MULTI into lpc2292 serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (52 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 53/72] serial: arm: Implement CONFIG_SERIAL_MULTI into lh7a40x " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 55/72] serial: Implement CONFIG_SERIAL_MULTI into max3100 " Marek Vasut
                       ` (19 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into lpc2292 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the lpc2292 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                 |    2 ++
 drivers/serial/serial_lpc2292.c |   66 ++++++++++++++++++++++++++++++++++-----
 2 files changed, 61 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 59a8650..23c8d22 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -84,6 +84,7 @@ serial_initfunc(imx_serial_initialize);
 serial_initfunc(ixp_serial_initialize);
 serial_initfunc(ks8695_serial_initialize);
 serial_initfunc(lh7a40x_serial_initialize);
+serial_initfunc(lpc2292_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -146,6 +147,7 @@ void serial_initialize(void)
 	ixp_serial_initialize();
 	ks8695_serial_initialize();
 	lh7a40x_serial_initialize();
+	lpc2292_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_lpc2292.c b/drivers/serial/serial_lpc2292.c
index e3a60b6..2601ee7 100644
--- a/drivers/serial/serial_lpc2292.c
+++ b/drivers/serial/serial_lpc2292.c
@@ -33,7 +33,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void serial_setbrg (void)
+static void lpc2292_serial_setbrg(void)
 {
 	unsigned short divisor = 0;
 
@@ -57,7 +57,7 @@ void serial_setbrg (void)
 	PUT8(U0FCR, 1);		/* Enable RX and TX FIFOs */
 }
 
-int serial_init (void)
+static int lpc2292_serial_init(void)
 {
 	unsigned long pinsel0;
 
@@ -71,7 +71,7 @@ int serial_init (void)
 	return (0);
 }
 
-void serial_putc (const char c)
+static void lpc2292_serial_putc(const char c)
 {
 	if (c == '\n')
 	{
@@ -83,14 +83,13 @@ void serial_putc (const char c)
 	PUT8(U0THR, c);
 }
 
-int serial_getc (void)
+static int lpc2292_serial_getc(void)
 {
 	while((GET8(U0LSR) & 1) == 0);
 	return GET8(U0RBR);
 }
 
-void
-serial_puts (const char *s)
+static void lpc2292_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
@@ -98,7 +97,60 @@ serial_puts (const char *s)
 }
 
 /* Test if there is a byte to read */
-int serial_tstc (void)
+static int lpc2292_serial_tstc(void)
 {
 	return (GET8(U0LSR) & 1);
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device lpc2292_serial_drv = {
+	.name	= "lpc2292_serial",
+	.start	= lpc2292_serial_init,
+	.stop	= NULL,
+	.setbrg	= lpc2292_serial_setbrg,
+	.putc	= lpc2292_serial_putc,
+	.puts	= lpc2292_serial_puts,
+	.getc	= lpc2292_serial_getc,
+	.tstc	= lpc2292_serial_tstc,
+};
+
+void lpc2292_serial_initialize(void)
+{
+	serial_register(&lpc2292_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &lpc2292_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return lpc2292_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	lpc2292_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	lpc2292_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	lpc2292_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return lpc2292_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return lpc2292_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 55/72] serial: Implement CONFIG_SERIAL_MULTI into max3100 serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (53 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 54/72] serial: arm: Implement CONFIG_SERIAL_MULTI into lpc2292 " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 56/72] serial: arm: Implement CONFIG_SERIAL_MULTI into mxc " Marek Vasut
                       ` (18 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into max3100 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the max3100 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                 |    2 ++
 drivers/serial/serial_max3100.c |   72 +++++++++++++++++++++++++++++++--------
 2 files changed, 60 insertions(+), 14 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 23c8d22..f007d13 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -85,6 +85,7 @@ serial_initfunc(ixp_serial_initialize);
 serial_initfunc(ks8695_serial_initialize);
 serial_initfunc(lh7a40x_serial_initialize);
 serial_initfunc(lpc2292_serial_initialize);
+serial_initfunc(max3100_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -148,6 +149,7 @@ void serial_initialize(void)
 	ks8695_serial_initialize();
 	lh7a40x_serial_initialize();
 	lpc2292_serial_initialize();
+	max3100_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_max3100.c b/drivers/serial/serial_max3100.c
index 4abc271..b21fba0 100644
--- a/drivers/serial/serial_max3100.c
+++ b/drivers/serial/serial_max3100.c
@@ -25,6 +25,8 @@
 
 #include <common.h>
 #include <watchdog.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -149,7 +151,7 @@ static int rxfifo_in;
 static int rxfifo_out;
 static unsigned char rxfifo_buf[16];
 
-static void max3100_putc(int c)
+static void max3100_serial_putc_raw(int c)
 {
 	unsigned int rx;
 
@@ -164,7 +166,7 @@ static void max3100_putc(int c)
 	}
 }
 
-static int max3100_getc(void)
+static int max3100_serial_getc(void)
 {
 	int c;
 	unsigned int rx;
@@ -190,7 +192,7 @@ static int max3100_getc(void)
 	return c;
 }
 
-static int max3100_tstc(void)
+static int max3100_serial_tstc(void)
 {
 	unsigned int rx;
 
@@ -213,7 +215,7 @@ static int max3100_tstc(void)
 	return 1;
 }
 
-int serial_init(void)
+static int max3100_serial_init(void)
 {
 	unsigned int wconf, rconf;
 	int i;
@@ -268,31 +270,73 @@ int serial_init(void)
 	return (0);
 }
 
-void serial_putc(const char c)
+static void max3100_serial_putc(const char c)
 {
 	if (c == '\n')
-		max3100_putc('\r');
+		max3100_serial_putc_raw('\r');
 
-	max3100_putc(c);
+	max3100_serial_putc_raw(c);
 }
 
-void serial_puts(const char *s)
+static void max3100_serial_puts(const char *s)
 {
 	while (*s)
-		serial_putc (*s++);
+		max3100_serial_putc_raw(*s++);
 }
 
-int serial_getc(void)
+static void max3100_serial_setbrg(void)
 {
-	return max3100_getc();
 }
 
-int serial_tstc(void)
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device max3100_serial_drv = {
+	.name	= "max3100_serial",
+	.start	= max3100_serial_init,
+	.stop	= NULL,
+	.setbrg	= max3100_serial_setbrg,
+	.putc	= max3100_serial_putc,
+	.puts	= max3100_serial_puts,
+	.getc	= max3100_serial_getc,
+	.tstc	= max3100_serial_tstc,
+};
+
+void max3100_serial_initialize(void)
+{
+	serial_register(&max3100_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &max3100_serial_drv;
+}
+#else
+int serial_init(void)
 {
-	return max3100_tstc();
+	return max3100_serial_init();
 }
 
-/* XXX WTF? */
 void serial_setbrg(void)
 {
+	max3100_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	max3100_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	max3100_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return max3100_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return max3100_serial_tstc();
 }
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 56/72] serial: arm: Implement CONFIG_SERIAL_MULTI into mxc serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (54 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 55/72] serial: Implement CONFIG_SERIAL_MULTI into max3100 " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 57/72] serial: arm: Implement CONFIG_SERIAL_MULTI into netarm " Marek Vasut
                       ` (17 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into mxc serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the mxc driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Stefano Babic <sbabic@denx.de>
---
 common/serial.c             |    2 ++
 drivers/serial/serial_mxc.c |   68 ++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 63 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index f007d13..566a3cc 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -86,6 +86,7 @@ serial_initfunc(ks8695_serial_initialize);
 serial_initfunc(lh7a40x_serial_initialize);
 serial_initfunc(lpc2292_serial_initialize);
 serial_initfunc(max3100_serial_initialize);
+serial_initfunc(mxc_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -150,6 +151,7 @@ void serial_initialize(void)
 	lh7a40x_serial_initialize();
 	lpc2292_serial_initialize();
 	max3100_serial_initialize();
+	mxc_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
index af00b9c..0899e9b 100644
--- a/drivers/serial/serial_mxc.c
+++ b/drivers/serial/serial_mxc.c
@@ -21,6 +21,8 @@
 #include <watchdog.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/clock.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 #define __REG(x)     (*((volatile u32 *)(x)))
 
@@ -145,7 +147,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void serial_setbrg (void)
+static void mxc_serial_setbrg(void)
 {
 	u32 clk = imx_get_uartclk();
 
@@ -158,14 +160,14 @@ void serial_setbrg (void)
 
 }
 
-int serial_getc (void)
+static int mxc_serial_getc(void)
 {
 	while (__REG(UART_PHYS + UTS) & UTS_RXEMPTY)
 		WATCHDOG_RESET();
 	return (__REG(UART_PHYS + URXD) & URXD_RX_DATA); /* mask out status from upper word */
 }
 
-void serial_putc (const char c)
+static void mxc_serial_putc(const char c)
 {
 	__REG(UART_PHYS + UTXD) = c;
 
@@ -181,7 +183,7 @@ void serial_putc (const char c)
 /*
  * Test whether a character is in the RX buffer
  */
-int serial_tstc (void)
+static int mxc_serial_tstc(void)
 {
 	/* If receive fifo is empty, return false */
 	if (__REG(UART_PHYS + UTS) & UTS_RXEMPTY)
@@ -189,8 +191,7 @@ int serial_tstc (void)
 	return 1;
 }
 
-void
-serial_puts (const char *s)
+static void mxc_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
@@ -202,7 +203,7 @@ serial_puts (const char *s)
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  *
  */
-int serial_init (void)
+static int mxc_serial_init(void)
 {
 	__REG(UART_PHYS + UCR1) = 0x0;
 	__REG(UART_PHYS + UCR2) = 0x0;
@@ -224,3 +225,56 @@ int serial_init (void)
 
 	return 0;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device mxc_serial_drv = {
+	.name	= "mxc_serial",
+	.start	= mxc_serial_init,
+	.stop	= NULL,
+	.setbrg	= mxc_serial_setbrg,
+	.putc	= mxc_serial_putc,
+	.puts	= mxc_serial_puts,
+	.getc	= mxc_serial_getc,
+	.tstc	= mxc_serial_tstc,
+};
+
+void mxc_serial_initialize(void)
+{
+	serial_register(&mxc_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &mxc_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return mxc_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	mxc_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	mxc_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	mxc_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return mxc_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return mxc_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 57/72] serial: arm: Implement CONFIG_SERIAL_MULTI into netarm serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (55 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 56/72] serial: arm: Implement CONFIG_SERIAL_MULTI into mxc " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 58/72] serial: arm: Implement CONFIG_SERIAL_MULTI into pl01x " Marek Vasut
                       ` (16 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into netarm serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the netarm driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Stefano Babic <sbabic@denx.de>
---
 common/serial.c                |    2 ++
 drivers/serial/serial_netarm.c |   65 ++++++++++++++++++++++++++++++++++++----
 2 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 566a3cc..c033cf0 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -87,6 +87,7 @@ serial_initfunc(lh7a40x_serial_initialize);
 serial_initfunc(lpc2292_serial_initialize);
 serial_initfunc(max3100_serial_initialize);
 serial_initfunc(mxc_serial_initialize);
+serial_initfunc(netarm_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -152,6 +153,7 @@ void serial_initialize(void)
 	lpc2292_serial_initialize();
 	max3100_serial_initialize();
 	mxc_serial_initialize();
+	netarm_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_netarm.c b/drivers/serial/serial_netarm.c
index d04790d..ff6612d 100644
--- a/drivers/serial/serial_netarm.c
+++ b/drivers/serial/serial_netarm.c
@@ -59,7 +59,7 @@ extern void _netarm_led_FAIL1(void);
 /*
  * Setup both serial i/f with given baudrate
  */
-void serial_setbrg (void)
+static void netarm_serial_setbrg(void)
 {
 	/* set 0 ... make sure pins are configured for serial */
 #if !defined(CONFIG_NETARM_NS7520)
@@ -108,7 +108,7 @@ void serial_setbrg (void)
  * Initialise the serial port with the given baudrate. The settings
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  */
-int serial_init (void)
+static int netarm_serial_init(void)
 {
 	serial_setbrg ();
 	return 0;
@@ -118,7 +118,7 @@ int serial_init (void)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc (const char c)
+static void netarm_serial_putc(const char c)
 {
 	volatile unsigned char *fifo;
 
@@ -135,7 +135,7 @@ void serial_putc (const char c)
  * Test of a single byte from the serial port. Returns 1 on success, 0
  * otherwise.
  */
-int serial_tstc(void)
+static int netarm_serial_tstc(void)
 {
 	return serial_reg_ch1->status_a & NETARM_SER_STATA_RX_RDY;
 }
@@ -144,7 +144,7 @@ int serial_tstc(void)
  * Read a single byte from the serial port. Returns 1 on success, 0
  * otherwise.
  */
-int serial_getc (void)
+static int netarm_serial_getc(void)
 {
 	unsigned int ch_uint;
 	volatile unsigned int *fifo;
@@ -182,9 +182,62 @@ int serial_getc (void)
 	return ch_uint & 0xff;
 }
 
-void serial_puts (const char *s)
+static void netarm_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device netarm_serial_drv = {
+	.name	= "netarm_serial",
+	.start	= netarm_serial_init,
+	.stop	= NULL,
+	.setbrg	= netarm_serial_setbrg,
+	.putc	= netarm_serial_putc,
+	.puts	= netarm_serial_puts,
+	.getc	= netarm_serial_getc,
+	.tstc	= netarm_serial_tstc,
+};
+
+void netarm_serial_initialize(void)
+{
+	serial_register(&netarm_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &netarm_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return netarm_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	netarm_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	netarm_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	netarm_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return netarm_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return netarm_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 58/72] serial: arm: Implement CONFIG_SERIAL_MULTI into pl01x serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (56 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 57/72] serial: arm: Implement CONFIG_SERIAL_MULTI into netarm " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 59/72] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c44b0 " Marek Vasut
                       ` (15 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into pl01x serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the pl01x driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Mathieu J. Poirier <mathieu.poirier@linaro.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: John Rigby <john.rigby@linaro.org>
Cc: Rabin Vincent <rabin.vincent@stericsson.com>
---
 common/serial.c               |    2 ++
 drivers/serial/serial_pl01x.c |   69 ++++++++++++++++++++++++++++++++++++-----
 2 files changed, 64 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index c033cf0..48e6044 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -88,6 +88,7 @@ serial_initfunc(lpc2292_serial_initialize);
 serial_initfunc(max3100_serial_initialize);
 serial_initfunc(mxc_serial_initialize);
 serial_initfunc(netarm_serial_initialize);
+serial_initfunc(pl01x_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -154,6 +155,7 @@ void serial_initialize(void)
 	max3100_serial_initialize();
 	mxc_serial_initialize();
 	netarm_serial_initialize();
+	pl01x_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c
index d4c5137..beb0c98 100644
--- a/drivers/serial/serial_pl01x.c
+++ b/drivers/serial/serial_pl01x.c
@@ -30,6 +30,8 @@
 #include <common.h>
 #include <watchdog.h>
 #include <asm/io.h>
+#include <serial.h>
+#include <linux/compiler.h>
 #include "serial_pl01x.h"
 
 /*
@@ -54,7 +56,7 @@ static struct pl01x_regs *pl01x_get_regs(int portnum)
 
 #ifdef CONFIG_PL010_SERIAL
 
-int serial_init (void)
+static int pl01x_serial_init(void)
 {
 	struct pl01x_regs *regs = pl01x_get_regs(CONSOLE_PORT);
 	unsigned int divisor;
@@ -104,7 +106,7 @@ int serial_init (void)
 
 #ifdef CONFIG_PL011_SERIAL
 
-int serial_init (void)
+static int pl01x_serial_init(void)
 {
 	struct pl01x_regs *regs = pl01x_get_regs(CONSOLE_PORT);
 	unsigned int temp;
@@ -169,7 +171,7 @@ int serial_init (void)
 
 #endif /* CONFIG_PL011_SERIAL */
 
-void serial_putc (const char c)
+static void pl01x_serial_putc(const char c)
 {
 	if (c == '\n')
 		pl01x_putc (CONSOLE_PORT, '\r');
@@ -177,24 +179,24 @@ void serial_putc (const char c)
 	pl01x_putc (CONSOLE_PORT, c);
 }
 
-void serial_puts (const char *s)
+static void pl01x_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
-int serial_getc (void)
+static int pl01x_serial_getc(void)
 {
 	return pl01x_getc (CONSOLE_PORT);
 }
 
-int serial_tstc (void)
+static int pl01x_serial_tstc(void)
 {
 	return pl01x_tstc (CONSOLE_PORT);
 }
 
-void serial_setbrg (void)
+static void pl01x_serial_setbrg(void)
 {
 	struct pl01x_regs *regs = pl01x_get_regs(CONSOLE_PORT);
 
@@ -250,3 +252,56 @@ static int pl01x_tstc (int portnum)
 	WATCHDOG_RESET();
 	return !(readl(&regs->fr) & UART_PL01x_FR_RXFE);
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device pl01x_serial_drv = {
+	.name	= "pl01x_serial",
+	.start	= pl01x_serial_init,
+	.stop	= NULL,
+	.setbrg	= pl01x_serial_setbrg,
+	.putc	= pl01x_serial_putc,
+	.puts	= pl01x_serial_puts,
+	.getc	= pl01x_serial_getc,
+	.tstc	= pl01x_serial_tstc,
+};
+
+void pl01x_serial_initialize(void)
+{
+	serial_register(&pl01x_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &pl01x_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return pl01x_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	pl01x_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	pl01x_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	pl01x_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return pl01x_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return pl01x_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 59/72] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c44b0 serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (57 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 58/72] serial: arm: Implement CONFIG_SERIAL_MULTI into pl01x " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 60/72] serial: arm: Implement CONFIG_SERIAL_MULTI into sa1100 " Marek Vasut
                       ` (14 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into s3c44b0 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the s3c44b0 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                 |    2 ++
 drivers/serial/serial_s3c44b0.c |   68 ++++++++++++++++++++++++++++++++++-----
 2 files changed, 62 insertions(+), 8 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 48e6044..1953aaf 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -89,6 +89,7 @@ serial_initfunc(max3100_serial_initialize);
 serial_initfunc(mxc_serial_initialize);
 serial_initfunc(netarm_serial_initialize);
 serial_initfunc(pl01x_serial_initialize);
+serial_initfunc(s3c44b0_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -156,6 +157,7 @@ void serial_initialize(void)
 	mxc_serial_initialize();
 	netarm_serial_initialize();
 	pl01x_serial_initialize();
+	s3c44b0_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_s3c44b0.c b/drivers/serial/serial_s3c44b0.c
index 95d0266..8beba1a 100644
--- a/drivers/serial/serial_s3c44b0.c
+++ b/drivers/serial/serial_s3c44b0.c
@@ -68,7 +68,7 @@ static int serial_flush_output(void)
 }
 
 
-void serial_setbrg (void)
+static void s3c44b0_serial_setbrg(void)
 {
 	u32 divisor = 0;
 
@@ -156,7 +156,7 @@ void serial_setbrg (void)
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  *
  */
-int serial_init (void)
+static int s3c44b0_serial_init(void)
 {
 	serial_setbrg ();
 
@@ -167,7 +167,7 @@ int serial_init (void)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc (const char c)
+static void s3c44b0_serial_putc(const char c)
 {
 	/* wait for room in the transmit FIFO */
 	while(!(UTRSTAT0 & 0x02));
@@ -187,7 +187,7 @@ void serial_putc (const char c)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_tstc (void)
+static int s3c44b0_serial_tstc(void)
 {
 	return (UTRSTAT0 & 0x01);
 }
@@ -197,22 +197,74 @@ int serial_tstc (void)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_getc (void)
+static int s3c44b0_serial_getc(void)
 {
 	int rv;
 
 	for(;;) {
-		rv = serial_tstc();
+		rv = s3c44b0_serial_tstc();
 
 		if(rv > 0)
 			return URXH0;
 	}
 }
 
-void
-serial_puts (const char *s)
+static void s3c44b0_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device s3c44b0_serial_drv = {
+	.name	= "s3c44b0_serial",
+	.start	= s3c44b0_serial_init,
+	.stop	= NULL,
+	.setbrg	= s3c44b0_serial_setbrg,
+	.putc	= s3c44b0_serial_putc,
+	.puts	= s3c44b0_serial_puts,
+	.getc	= s3c44b0_serial_getc,
+	.tstc	= s3c44b0_serial_tstc,
+};
+
+void s3c44b0_serial_initialize(void)
+{
+	serial_register(&s3c44b0_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &s3c44b0_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return s3c44b0_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	s3c44b0_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	s3c44b0_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	s3c44b0_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return s3c44b0_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return s3c44b0_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 60/72] serial: arm: Implement CONFIG_SERIAL_MULTI into sa1100 serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (58 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 59/72] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c44b0 " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 61/72] serial: sh: Implement CONFIG_SERIAL_MULTI into sh " Marek Vasut
                       ` (13 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into sa1100 serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the sa1100 driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c                |    2 ++
 drivers/serial/serial_sa1100.c |   68 +++++++++++++++++++++++++++++++++++-----
 2 files changed, 63 insertions(+), 7 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 1953aaf..3dae01b 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -90,6 +90,7 @@ serial_initfunc(mxc_serial_initialize);
 serial_initfunc(netarm_serial_initialize);
 serial_initfunc(pl01x_serial_initialize);
 serial_initfunc(s3c44b0_serial_initialize);
+serial_initfunc(sa1100_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -158,6 +159,7 @@ void serial_initialize(void)
 	netarm_serial_initialize();
 	pl01x_serial_initialize();
 	s3c44b0_serial_initialize();
+	sa1100_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_sa1100.c b/drivers/serial/serial_sa1100.c
index 5d18875..86e682d 100644
--- a/drivers/serial/serial_sa1100.c
+++ b/drivers/serial/serial_sa1100.c
@@ -30,10 +30,12 @@
 
 #include <common.h>
 #include <SA-1100.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void serial_setbrg (void)
+static void sa1100_serial_setbrg(void)
 {
 	unsigned int reg = 0;
 
@@ -89,7 +91,7 @@ void serial_setbrg (void)
  * are always 8 data bits, no parity, 1 stop bit, no start bits.
  *
  */
-int serial_init (void)
+static int sa1100_serial_init(void)
 {
 	serial_setbrg ();
 
@@ -100,7 +102,7 @@ int serial_init (void)
 /*
  * Output a single byte to the serial port.
  */
-void serial_putc (const char c)
+static void sa1100_serial_putc(const char c)
 {
 #ifdef CONFIG_SERIAL1
 	/* wait for room in the tx FIFO on SERIAL1 */
@@ -124,7 +126,7 @@ void serial_putc (const char c)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_tstc (void)
+static int sa1100_serial_tstc(void)
 {
 #ifdef CONFIG_SERIAL1
 	return Ser1UTSR1 & UTSR1_RNE;
@@ -138,7 +140,7 @@ int serial_tstc (void)
  * otherwise. When the function is succesfull, the character read is
  * written into its argument c.
  */
-int serial_getc (void)
+static int sa1100_serial_getc(void)
 {
 #ifdef CONFIG_SERIAL1
 	while (!(Ser1UTSR1 & UTSR1_RNE));
@@ -151,10 +153,62 @@ int serial_getc (void)
 #endif
 }
 
-void
-serial_puts (const char *s)
+static void sa1100_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device sa1100_serial_drv = {
+	.name	= "sa1100_serial",
+	.start	= sa1100_serial_init,
+	.stop	= NULL,
+	.setbrg	= sa1100_serial_setbrg,
+	.putc	= sa1100_serial_putc,
+	.puts	= sa1100_serial_puts,
+	.getc	= sa1100_serial_getc,
+	.tstc	= sa1100_serial_tstc,
+};
+
+void sa1100_serial_initialize(void)
+{
+	serial_register(&sa1100_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &sa1100_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return sa1100_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	sa1100_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	sa1100_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	sa1100_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return sa1100_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return sa1100_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 61/72] serial: sh: Implement CONFIG_SERIAL_MULTI into sh serial driver
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (59 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 60/72] serial: arm: Implement CONFIG_SERIAL_MULTI into sa1100 " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 62/72] serial: mxs: spl: Remove empty serial_* functions from SPL code Marek Vasut
                       ` (12 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into sh serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the sh driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Phil Edworthy <PHIL.EDWORTHY@renesas.com>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
---
 common/serial.c            |    2 ++
 drivers/serial/serial_sh.c |   65 ++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 61 insertions(+), 6 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 3dae01b..631af65 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -91,6 +91,7 @@ serial_initfunc(netarm_serial_initialize);
 serial_initfunc(pl01x_serial_initialize);
 serial_initfunc(s3c44b0_serial_initialize);
 serial_initfunc(sa1100_serial_initialize);
+serial_initfunc(sh_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -160,6 +161,7 @@ void serial_initialize(void)
 	pl01x_serial_initialize();
 	s3c44b0_serial_initialize();
 	sa1100_serial_initialize();
+	sh_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/serial_sh.c b/drivers/serial/serial_sh.c
index 13919c6..8c30397 100644
--- a/drivers/serial/serial_sh.c
+++ b/drivers/serial/serial_sh.c
@@ -55,13 +55,13 @@ static struct uart_port sh_sci = {
 	.type		= SCIF_BASE_PORT,
 };
 
-void serial_setbrg(void)
+static void sh_serial_setbrg(void)
 {
 	DECLARE_GLOBAL_DATA_PTR;
 	sci_out(&sh_sci, SCBRR, SCBRR_VALUE(gd->baudrate, CONFIG_SYS_CLK_FREQ));
 }
 
-int serial_init(void)
+static int sh_serial_init(void)
 {
 	sci_out(&sh_sci, SCSCR , SCSCR_INIT(&sh_sci));
 	sci_out(&sh_sci, SCSCR , SCSCR_INIT(&sh_sci));
@@ -127,21 +127,21 @@ void serial_raw_putc(const char c)
 	sci_out(&sh_sci, SCxSR, sci_in(&sh_sci, SCxSR) & ~SCxSR_TEND(&sh_sci));
 }
 
-void serial_putc(const char c)
+static void sh_serial_putc(const char c)
 {
 	if (c == '\n')
 		serial_raw_putc('\r');
 	serial_raw_putc(c);
 }
 
-void serial_puts(const char *s)
+static void sh_serial_puts(const char *s)
 {
 	char c;
 	while ((c = *s++) != 0)
 		serial_putc(c);
 }
 
-int serial_tstc(void)
+static int sh_serial_tstc(void)
 {
 	return serial_rx_fifo_level() ? 1 : 0;
 }
@@ -167,7 +167,7 @@ int serial_getc_check(void)
 	return status & (SCIF_DR | SCxSR_RDxF(&sh_sci));
 }
 
-int serial_getc(void)
+static int sh_serial_getc(void)
 {
 	unsigned short status;
 	char ch;
@@ -187,3 +187,56 @@ int serial_getc(void)
 		handle_error();
 	return ch;
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device sh_serial_drv = {
+	.name	= "sh_serial",
+	.start	= sh_serial_init,
+	.stop	= NULL,
+	.setbrg	= sh_serial_setbrg,
+	.putc	= sh_serial_putc,
+	.puts	= sh_serial_puts,
+	.getc	= sh_serial_getc,
+	.tstc	= sh_serial_tstc,
+};
+
+void sh_serial_initialize(void)
+{
+	serial_register(&sh_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &sh_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return sh_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	sh_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	sh_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	sh_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return sh_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return sh_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 62/72] serial: mxs: spl: Remove empty serial_* functions from SPL code
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (60 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 61/72] serial: sh: Implement CONFIG_SERIAL_MULTI into sh " Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 63/72] serial: Use puts() and hang() instead of panic() in SPL Marek Vasut
                       ` (11 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Remove the empty bodies from serial_* functions from MXS SPL code.
These empty implementations are now in common/serial.c instead so
declaring them also in the SPL code would cause a colision once
serial multi is enabled unconditionally.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Stefano Babic <sbabic@denx.de>
---
 arch/arm/cpu/arm926ejs/mxs/spl_boot.c |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_boot.c b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
index ad66c57..8ea7c36 100644
--- a/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
+++ b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
@@ -124,10 +124,6 @@ inline void board_init_r(gd_t *id, ulong dest_addr)
 		;
 }
 
-#ifndef CONFIG_SPL_SERIAL_SUPPORT
-void serial_putc(const char c) {}
-void serial_puts(const char *s) {}
-#endif
 void hang(void) __attribute__ ((noreturn));
 void hang(void)
 {
-- 
1.7.10.4

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

* [U-Boot] [PATCH 63/72] serial: Use puts() and hang() instead of panic() in SPL
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (61 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 62/72] serial: mxs: spl: Remove empty serial_* functions from SPL code Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 64/72] serial: ns16550: Call usbtty_poll only in non-SPL build Marek Vasut
                       ` (10 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

If case the get_current() call fails before relocation, the U-Boot
must try to print an error message, fail and either reset or halt.
Such error is critical enough to halt the system, as it means the
system is in very bad state.

This is now also used in SPL, since CONFIG_SERIAL_MULTI is enabled
unconditionally. To avoid compiling whole vsprintf.c into SPL, use
puts() to print error message and hang() to stop the system in case
of SPL build.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/serial.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/common/serial.c b/common/serial.c
index 631af65..91c7269 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -220,8 +220,14 @@ static struct serial_device *get_current(void)
 		dev = default_serial_console();
 
 		/* We must have a console device */
-		if (!dev)
-			panic("Cannot find console");
+		if (!dev) {
+#ifdef CONFIG_SPL_BUILD
+			puts("Cannot find console\n");
+			hang();
+#else
+			panic("Cannot find console\n");
+#endif
+		}
 	} else
 		dev = serial_current;
 	return dev;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 64/72] serial: ns16550: Call usbtty_poll only in non-SPL build
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (62 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 63/72] serial: Use puts() and hang() instead of panic() in SPL Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:52     ` [U-Boot] [PATCH 65/72] serial: ns16550: Rename serial.c to serial_ns16550.c Marek Vasut
                       ` (9 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Having both USBTTY and CONFIG_SERIAL_MULTI enabled in SPL, the
usbtty.c file is protected in Makefile to not be compiled into
the SPL. Yet, the ns16550 serial driver does not contain such
protection. Add it to avoid missing symbol error.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 drivers/serial/ns16550.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index facadd2..9027781 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -101,7 +101,7 @@ void NS16550_putc(NS16550_t com_port, char c)
 char NS16550_getc(NS16550_t com_port)
 {
 	while ((serial_in(&com_port->lsr) & UART_LSR_DR) == 0) {
-#ifdef CONFIG_USB_TTY
+#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_USB_TTY)
 		extern void usbtty_poll(void);
 		usbtty_poll();
 #endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 65/72] serial: ns16550: Rename serial.c to serial_ns16550.c
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (63 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 64/72] serial: ns16550: Call usbtty_poll only in non-SPL build Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-30  8:52       ` Michal Simek
  2012-10-01 16:52       ` Tom Rini
  2012-09-29 21:52     ` [U-Boot] [PATCH 66/72] serial: Move common/serial.c to drivers/serial/ Marek Vasut
                       ` (8 subsequent siblings)
  73 siblings, 2 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

This serial driver had wrong name of the source file for some time
now. The name of the driver was serial.c instead of any more logical
and fitting name. Thus, rename the driver source file to serial_ns16550.c
and be done with it.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Michal Simek <monstr@monstr.eu>
---
 drivers/serial/Makefile         |    2 +-
 drivers/serial/serial.c         |  359 ---------------------------------------
 drivers/serial/serial_ns16550.c |  359 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 360 insertions(+), 360 deletions(-)
 delete mode 100644 drivers/serial/serial.c
 create mode 100644 drivers/serial/serial_ns16550.c

diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index 65d0f23..d93e81b 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -37,7 +37,7 @@ COBJS-$(CONFIG_SYS_NS16550) += ns16550.o
 COBJS-$(CONFIG_DRIVER_S3C4510_UART) += s3c4510b_uart.o
 COBJS-$(CONFIG_S3C64XX) += s3c64xx.o
 COBJS-$(CONFIG_S5P) += serial_s5p.o
-COBJS-$(CONFIG_SYS_NS16550_SERIAL) += serial.o
+COBJS-$(CONFIG_SYS_NS16550_SERIAL) += serial_ns16550.o
 COBJS-$(CONFIG_CLPS7111_SERIAL) += serial_clps7111.o
 COBJS-$(CONFIG_IMX_SERIAL) += serial_imx.o
 COBJS-$(CONFIG_IXP_SERIAL) += serial_ixp.o
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
deleted file mode 100644
index 00ad97c..0000000
--- a/drivers/serial/serial.c
+++ /dev/null
@@ -1,359 +0,0 @@
-/*
- * (C) Copyright 2000
- * Rob Taylor, Flying Pig Systems. robt at flyingpig.com.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * 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
- */
-
-#include <common.h>
-#include <linux/compiler.h>
-
-#include <ns16550.h>
-#ifdef CONFIG_NS87308
-#include <ns87308.h>
-#endif
-
-#if defined (CONFIG_SERIAL_MULTI)
-#include <serial.h>
-#endif
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#if !defined(CONFIG_CONS_INDEX)
-#if defined (CONFIG_SERIAL_MULTI)
-/*   with CONFIG_SERIAL_MULTI we might have no console
- *  on these devices
- */
-#else
-#error	"No console index specified."
-#endif /* CONFIG_SERIAL_MULTI */
-#elif (CONFIG_CONS_INDEX < 1) || (CONFIG_CONS_INDEX > 4)
-#error	"Invalid console index value."
-#endif
-
-#if CONFIG_CONS_INDEX == 1 && !defined(CONFIG_SYS_NS16550_COM1)
-#error	"Console port 1 defined but not configured."
-#elif CONFIG_CONS_INDEX == 2 && !defined(CONFIG_SYS_NS16550_COM2)
-#error	"Console port 2 defined but not configured."
-#elif CONFIG_CONS_INDEX == 3 && !defined(CONFIG_SYS_NS16550_COM3)
-#error	"Console port 3 defined but not configured."
-#elif CONFIG_CONS_INDEX == 4 && !defined(CONFIG_SYS_NS16550_COM4)
-#error	"Console port 4 defined but not configured."
-#endif
-
-/* Note: The port number specified in the functions is 1 based.
- *	 the array is 0 based.
- */
-static NS16550_t serial_ports[4] = {
-#ifdef CONFIG_SYS_NS16550_COM1
-	(NS16550_t)CONFIG_SYS_NS16550_COM1,
-#else
-	NULL,
-#endif
-#ifdef CONFIG_SYS_NS16550_COM2
-	(NS16550_t)CONFIG_SYS_NS16550_COM2,
-#else
-	NULL,
-#endif
-#ifdef CONFIG_SYS_NS16550_COM3
-	(NS16550_t)CONFIG_SYS_NS16550_COM3,
-#else
-	NULL,
-#endif
-#ifdef CONFIG_SYS_NS16550_COM4
-	(NS16550_t)CONFIG_SYS_NS16550_COM4
-#else
-	NULL
-#endif
-};
-
-#define PORT	serial_ports[port-1]
-
-#if defined(CONFIG_SERIAL_MULTI)
-
-/* Multi serial device functions */
-#define DECLARE_ESERIAL_FUNCTIONS(port) \
-    int  eserial##port##_init (void) {\
-	int clock_divisor; \
-	clock_divisor = calc_divisor(serial_ports[port-1]); \
-	NS16550_init(serial_ports[port-1], clock_divisor); \
-	return(0);}\
-    void eserial##port##_setbrg (void) {\
-	serial_setbrg_dev(port);}\
-    int  eserial##port##_getc (void) {\
-	return serial_getc_dev(port);}\
-    int  eserial##port##_tstc (void) {\
-	return serial_tstc_dev(port);}\
-    void eserial##port##_putc (const char c) {\
-	serial_putc_dev(port, c);}\
-    void eserial##port##_puts (const char *s) {\
-	serial_puts_dev(port, s);}
-
-/* Serial device descriptor */
-#define INIT_ESERIAL_STRUCTURE(port, __name) {	\
-	.name	= __name,			\
-	.start	= eserial##port##_init,		\
-	.stop	= NULL,				\
-	.setbrg	= eserial##port##_setbrg,	\
-	.getc	= eserial##port##_getc,		\
-	.tstc	= eserial##port##_tstc,		\
-	.putc	= eserial##port##_putc,		\
-	.puts	= eserial##port##_puts,		\
-}
-
-#endif /* CONFIG_SERIAL_MULTI */
-
-static int calc_divisor (NS16550_t port)
-{
-#ifdef CONFIG_OMAP1510
-	/* If can't cleanly clock 115200 set div to 1 */
-	if ((CONFIG_SYS_NS16550_CLK == 12000000) && (gd->baudrate == 115200)) {
-		port->osc_12m_sel = OSC_12M_SEL;	/* enable 6.5 * divisor */
-		return (1);				/* return 1 for base divisor */
-	}
-	port->osc_12m_sel = 0;			/* clear if previsouly set */
-#endif
-#ifdef CONFIG_OMAP1610
-	/* If can't cleanly clock 115200 set div to 1 */
-	if ((CONFIG_SYS_NS16550_CLK == 48000000) && (gd->baudrate == 115200)) {
-		return (26);		/* return 26 for base divisor */
-	}
-#endif
-
-#ifdef CONFIG_APTIX
-#define MODE_X_DIV 13
-#else
-#define MODE_X_DIV 16
-#endif
-
-	/* Compute divisor value. Normally, we should simply return:
-	 *   CONFIG_SYS_NS16550_CLK) / MODE_X_DIV / gd->baudrate
-	 * but we need to round that value by adding 0.5.
-	 * Rounding is especially important at high baud rates.
-	 */
-	return (CONFIG_SYS_NS16550_CLK + (gd->baudrate * (MODE_X_DIV / 2))) /
-		(MODE_X_DIV * gd->baudrate);
-}
-
-#if !defined(CONFIG_SERIAL_MULTI)
-int serial_init (void)
-{
-	int clock_divisor;
-
-#ifdef CONFIG_NS87308
-	initialise_ns87308();
-#endif
-
-#ifdef CONFIG_SYS_NS16550_COM1
-	clock_divisor = calc_divisor(serial_ports[0]);
-	NS16550_init(serial_ports[0], clock_divisor);
-#endif
-#ifdef CONFIG_SYS_NS16550_COM2
-	clock_divisor = calc_divisor(serial_ports[1]);
-	NS16550_init(serial_ports[1], clock_divisor);
-#endif
-#ifdef CONFIG_SYS_NS16550_COM3
-	clock_divisor = calc_divisor(serial_ports[2]);
-	NS16550_init(serial_ports[2], clock_divisor);
-#endif
-#ifdef CONFIG_SYS_NS16550_COM4
-	clock_divisor = calc_divisor(serial_ports[3]);
-	NS16550_init(serial_ports[3], clock_divisor);
-#endif
-
-	return (0);
-}
-#endif
-
-void
-_serial_putc(const char c,const int port)
-{
-	if (c == '\n')
-		NS16550_putc(PORT, '\r');
-
-	NS16550_putc(PORT, c);
-}
-
-void
-_serial_putc_raw(const char c,const int port)
-{
-	NS16550_putc(PORT, c);
-}
-
-void
-_serial_puts (const char *s,const int port)
-{
-	while (*s) {
-		_serial_putc (*s++,port);
-	}
-}
-
-
-int
-_serial_getc(const int port)
-{
-	return NS16550_getc(PORT);
-}
-
-int
-_serial_tstc(const int port)
-{
-	return NS16550_tstc(PORT);
-}
-
-void
-_serial_setbrg (const int port)
-{
-	int clock_divisor;
-
-	clock_divisor = calc_divisor(PORT);
-	NS16550_reinit(PORT, clock_divisor);
-}
-
-#if defined(CONFIG_SERIAL_MULTI)
-static inline void
-serial_putc_dev(unsigned int dev_index,const char c)
-{
-	_serial_putc(c,dev_index);
-}
-#else
-void
-serial_putc(const char c)
-{
-	_serial_putc(c,CONFIG_CONS_INDEX);
-}
-#endif
-
-#if defined(CONFIG_SERIAL_MULTI)
-static inline void
-serial_putc_raw_dev(unsigned int dev_index,const char c)
-{
-	_serial_putc_raw(c,dev_index);
-}
-#else
-void
-serial_putc_raw(const char c)
-{
-	_serial_putc_raw(c,CONFIG_CONS_INDEX);
-}
-#endif
-
-#if defined(CONFIG_SERIAL_MULTI)
-static inline void
-serial_puts_dev(unsigned int dev_index,const char *s)
-{
-	_serial_puts(s,dev_index);
-}
-#else
-void
-serial_puts(const char *s)
-{
-	_serial_puts(s,CONFIG_CONS_INDEX);
-}
-#endif
-
-#if defined(CONFIG_SERIAL_MULTI)
-static inline int
-serial_getc_dev(unsigned int dev_index)
-{
-	return _serial_getc(dev_index);
-}
-#else
-int
-serial_getc(void)
-{
-	return _serial_getc(CONFIG_CONS_INDEX);
-}
-#endif
-
-#if defined(CONFIG_SERIAL_MULTI)
-static inline int
-serial_tstc_dev(unsigned int dev_index)
-{
-	return _serial_tstc(dev_index);
-}
-#else
-int
-serial_tstc(void)
-{
-	return _serial_tstc(CONFIG_CONS_INDEX);
-}
-#endif
-
-#if defined(CONFIG_SERIAL_MULTI)
-static inline void
-serial_setbrg_dev(unsigned int dev_index)
-{
-	_serial_setbrg(dev_index);
-}
-#else
-void
-serial_setbrg(void)
-{
-	_serial_setbrg(CONFIG_CONS_INDEX);
-}
-#endif
-
-#if defined(CONFIG_SERIAL_MULTI)
-
-DECLARE_ESERIAL_FUNCTIONS(1);
-struct serial_device eserial1_device =
-	INIT_ESERIAL_STRUCTURE(1, "eserial0");
-DECLARE_ESERIAL_FUNCTIONS(2);
-struct serial_device eserial2_device =
-	INIT_ESERIAL_STRUCTURE(2, "eserial1");
-DECLARE_ESERIAL_FUNCTIONS(3);
-struct serial_device eserial3_device =
-	INIT_ESERIAL_STRUCTURE(3, "eserial2");
-DECLARE_ESERIAL_FUNCTIONS(4);
-struct serial_device eserial4_device =
-	INIT_ESERIAL_STRUCTURE(4, "eserial3");
-
-__weak struct serial_device *default_serial_console(void)
-{
-#if CONFIG_CONS_INDEX == 1
-	return &eserial1_device;
-#elif CONFIG_CONS_INDEX == 2
-	return &eserial2_device;
-#elif CONFIG_CONS_INDEX == 3
-	return &eserial3_device;
-#elif CONFIG_CONS_INDEX == 4
-	return &eserial4_device;
-#else
-#error "Bad CONFIG_CONS_INDEX."
-#endif
-}
-
-void ns16550_serial_initialize(void)
-{
-#if defined(CONFIG_SYS_NS16550_COM1)
-	serial_register(&eserial1_device);
-#endif
-#if defined(CONFIG_SYS_NS16550_COM2)
-	serial_register(&eserial2_device);
-#endif
-#if defined(CONFIG_SYS_NS16550_COM3)
-	serial_register(&eserial3_device);
-#endif
-#if defined(CONFIG_SYS_NS16550_COM4)
-	serial_register(&eserial4_device);
-#endif
-}
-
-#endif /* CONFIG_SERIAL_MULTI */
diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
new file mode 100644
index 0000000..00ad97c
--- /dev/null
+++ b/drivers/serial/serial_ns16550.c
@@ -0,0 +1,359 @@
+/*
+ * (C) Copyright 2000
+ * Rob Taylor, Flying Pig Systems. robt at flyingpig.com.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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
+ */
+
+#include <common.h>
+#include <linux/compiler.h>
+
+#include <ns16550.h>
+#ifdef CONFIG_NS87308
+#include <ns87308.h>
+#endif
+
+#if defined (CONFIG_SERIAL_MULTI)
+#include <serial.h>
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#if !defined(CONFIG_CONS_INDEX)
+#if defined (CONFIG_SERIAL_MULTI)
+/*   with CONFIG_SERIAL_MULTI we might have no console
+ *  on these devices
+ */
+#else
+#error	"No console index specified."
+#endif /* CONFIG_SERIAL_MULTI */
+#elif (CONFIG_CONS_INDEX < 1) || (CONFIG_CONS_INDEX > 4)
+#error	"Invalid console index value."
+#endif
+
+#if CONFIG_CONS_INDEX == 1 && !defined(CONFIG_SYS_NS16550_COM1)
+#error	"Console port 1 defined but not configured."
+#elif CONFIG_CONS_INDEX == 2 && !defined(CONFIG_SYS_NS16550_COM2)
+#error	"Console port 2 defined but not configured."
+#elif CONFIG_CONS_INDEX == 3 && !defined(CONFIG_SYS_NS16550_COM3)
+#error	"Console port 3 defined but not configured."
+#elif CONFIG_CONS_INDEX == 4 && !defined(CONFIG_SYS_NS16550_COM4)
+#error	"Console port 4 defined but not configured."
+#endif
+
+/* Note: The port number specified in the functions is 1 based.
+ *	 the array is 0 based.
+ */
+static NS16550_t serial_ports[4] = {
+#ifdef CONFIG_SYS_NS16550_COM1
+	(NS16550_t)CONFIG_SYS_NS16550_COM1,
+#else
+	NULL,
+#endif
+#ifdef CONFIG_SYS_NS16550_COM2
+	(NS16550_t)CONFIG_SYS_NS16550_COM2,
+#else
+	NULL,
+#endif
+#ifdef CONFIG_SYS_NS16550_COM3
+	(NS16550_t)CONFIG_SYS_NS16550_COM3,
+#else
+	NULL,
+#endif
+#ifdef CONFIG_SYS_NS16550_COM4
+	(NS16550_t)CONFIG_SYS_NS16550_COM4
+#else
+	NULL
+#endif
+};
+
+#define PORT	serial_ports[port-1]
+
+#if defined(CONFIG_SERIAL_MULTI)
+
+/* Multi serial device functions */
+#define DECLARE_ESERIAL_FUNCTIONS(port) \
+    int  eserial##port##_init (void) {\
+	int clock_divisor; \
+	clock_divisor = calc_divisor(serial_ports[port-1]); \
+	NS16550_init(serial_ports[port-1], clock_divisor); \
+	return(0);}\
+    void eserial##port##_setbrg (void) {\
+	serial_setbrg_dev(port);}\
+    int  eserial##port##_getc (void) {\
+	return serial_getc_dev(port);}\
+    int  eserial##port##_tstc (void) {\
+	return serial_tstc_dev(port);}\
+    void eserial##port##_putc (const char c) {\
+	serial_putc_dev(port, c);}\
+    void eserial##port##_puts (const char *s) {\
+	serial_puts_dev(port, s);}
+
+/* Serial device descriptor */
+#define INIT_ESERIAL_STRUCTURE(port, __name) {	\
+	.name	= __name,			\
+	.start	= eserial##port##_init,		\
+	.stop	= NULL,				\
+	.setbrg	= eserial##port##_setbrg,	\
+	.getc	= eserial##port##_getc,		\
+	.tstc	= eserial##port##_tstc,		\
+	.putc	= eserial##port##_putc,		\
+	.puts	= eserial##port##_puts,		\
+}
+
+#endif /* CONFIG_SERIAL_MULTI */
+
+static int calc_divisor (NS16550_t port)
+{
+#ifdef CONFIG_OMAP1510
+	/* If can't cleanly clock 115200 set div to 1 */
+	if ((CONFIG_SYS_NS16550_CLK == 12000000) && (gd->baudrate == 115200)) {
+		port->osc_12m_sel = OSC_12M_SEL;	/* enable 6.5 * divisor */
+		return (1);				/* return 1 for base divisor */
+	}
+	port->osc_12m_sel = 0;			/* clear if previsouly set */
+#endif
+#ifdef CONFIG_OMAP1610
+	/* If can't cleanly clock 115200 set div to 1 */
+	if ((CONFIG_SYS_NS16550_CLK == 48000000) && (gd->baudrate == 115200)) {
+		return (26);		/* return 26 for base divisor */
+	}
+#endif
+
+#ifdef CONFIG_APTIX
+#define MODE_X_DIV 13
+#else
+#define MODE_X_DIV 16
+#endif
+
+	/* Compute divisor value. Normally, we should simply return:
+	 *   CONFIG_SYS_NS16550_CLK) / MODE_X_DIV / gd->baudrate
+	 * but we need to round that value by adding 0.5.
+	 * Rounding is especially important at high baud rates.
+	 */
+	return (CONFIG_SYS_NS16550_CLK + (gd->baudrate * (MODE_X_DIV / 2))) /
+		(MODE_X_DIV * gd->baudrate);
+}
+
+#if !defined(CONFIG_SERIAL_MULTI)
+int serial_init (void)
+{
+	int clock_divisor;
+
+#ifdef CONFIG_NS87308
+	initialise_ns87308();
+#endif
+
+#ifdef CONFIG_SYS_NS16550_COM1
+	clock_divisor = calc_divisor(serial_ports[0]);
+	NS16550_init(serial_ports[0], clock_divisor);
+#endif
+#ifdef CONFIG_SYS_NS16550_COM2
+	clock_divisor = calc_divisor(serial_ports[1]);
+	NS16550_init(serial_ports[1], clock_divisor);
+#endif
+#ifdef CONFIG_SYS_NS16550_COM3
+	clock_divisor = calc_divisor(serial_ports[2]);
+	NS16550_init(serial_ports[2], clock_divisor);
+#endif
+#ifdef CONFIG_SYS_NS16550_COM4
+	clock_divisor = calc_divisor(serial_ports[3]);
+	NS16550_init(serial_ports[3], clock_divisor);
+#endif
+
+	return (0);
+}
+#endif
+
+void
+_serial_putc(const char c,const int port)
+{
+	if (c == '\n')
+		NS16550_putc(PORT, '\r');
+
+	NS16550_putc(PORT, c);
+}
+
+void
+_serial_putc_raw(const char c,const int port)
+{
+	NS16550_putc(PORT, c);
+}
+
+void
+_serial_puts (const char *s,const int port)
+{
+	while (*s) {
+		_serial_putc (*s++,port);
+	}
+}
+
+
+int
+_serial_getc(const int port)
+{
+	return NS16550_getc(PORT);
+}
+
+int
+_serial_tstc(const int port)
+{
+	return NS16550_tstc(PORT);
+}
+
+void
+_serial_setbrg (const int port)
+{
+	int clock_divisor;
+
+	clock_divisor = calc_divisor(PORT);
+	NS16550_reinit(PORT, clock_divisor);
+}
+
+#if defined(CONFIG_SERIAL_MULTI)
+static inline void
+serial_putc_dev(unsigned int dev_index,const char c)
+{
+	_serial_putc(c,dev_index);
+}
+#else
+void
+serial_putc(const char c)
+{
+	_serial_putc(c,CONFIG_CONS_INDEX);
+}
+#endif
+
+#if defined(CONFIG_SERIAL_MULTI)
+static inline void
+serial_putc_raw_dev(unsigned int dev_index,const char c)
+{
+	_serial_putc_raw(c,dev_index);
+}
+#else
+void
+serial_putc_raw(const char c)
+{
+	_serial_putc_raw(c,CONFIG_CONS_INDEX);
+}
+#endif
+
+#if defined(CONFIG_SERIAL_MULTI)
+static inline void
+serial_puts_dev(unsigned int dev_index,const char *s)
+{
+	_serial_puts(s,dev_index);
+}
+#else
+void
+serial_puts(const char *s)
+{
+	_serial_puts(s,CONFIG_CONS_INDEX);
+}
+#endif
+
+#if defined(CONFIG_SERIAL_MULTI)
+static inline int
+serial_getc_dev(unsigned int dev_index)
+{
+	return _serial_getc(dev_index);
+}
+#else
+int
+serial_getc(void)
+{
+	return _serial_getc(CONFIG_CONS_INDEX);
+}
+#endif
+
+#if defined(CONFIG_SERIAL_MULTI)
+static inline int
+serial_tstc_dev(unsigned int dev_index)
+{
+	return _serial_tstc(dev_index);
+}
+#else
+int
+serial_tstc(void)
+{
+	return _serial_tstc(CONFIG_CONS_INDEX);
+}
+#endif
+
+#if defined(CONFIG_SERIAL_MULTI)
+static inline void
+serial_setbrg_dev(unsigned int dev_index)
+{
+	_serial_setbrg(dev_index);
+}
+#else
+void
+serial_setbrg(void)
+{
+	_serial_setbrg(CONFIG_CONS_INDEX);
+}
+#endif
+
+#if defined(CONFIG_SERIAL_MULTI)
+
+DECLARE_ESERIAL_FUNCTIONS(1);
+struct serial_device eserial1_device =
+	INIT_ESERIAL_STRUCTURE(1, "eserial0");
+DECLARE_ESERIAL_FUNCTIONS(2);
+struct serial_device eserial2_device =
+	INIT_ESERIAL_STRUCTURE(2, "eserial1");
+DECLARE_ESERIAL_FUNCTIONS(3);
+struct serial_device eserial3_device =
+	INIT_ESERIAL_STRUCTURE(3, "eserial2");
+DECLARE_ESERIAL_FUNCTIONS(4);
+struct serial_device eserial4_device =
+	INIT_ESERIAL_STRUCTURE(4, "eserial3");
+
+__weak struct serial_device *default_serial_console(void)
+{
+#if CONFIG_CONS_INDEX == 1
+	return &eserial1_device;
+#elif CONFIG_CONS_INDEX == 2
+	return &eserial2_device;
+#elif CONFIG_CONS_INDEX == 3
+	return &eserial3_device;
+#elif CONFIG_CONS_INDEX == 4
+	return &eserial4_device;
+#else
+#error "Bad CONFIG_CONS_INDEX."
+#endif
+}
+
+void ns16550_serial_initialize(void)
+{
+#if defined(CONFIG_SYS_NS16550_COM1)
+	serial_register(&eserial1_device);
+#endif
+#if defined(CONFIG_SYS_NS16550_COM2)
+	serial_register(&eserial2_device);
+#endif
+#if defined(CONFIG_SYS_NS16550_COM3)
+	serial_register(&eserial3_device);
+#endif
+#if defined(CONFIG_SYS_NS16550_COM4)
+	serial_register(&eserial4_device);
+#endif
+}
+
+#endif /* CONFIG_SERIAL_MULTI */
-- 
1.7.10.4

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

* [U-Boot] [PATCH 66/72] serial: Move common/serial.c to drivers/serial/
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (64 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 65/72] serial: ns16550: Rename serial.c to serial_ns16550.c Marek Vasut
@ 2012-09-29 21:52     ` Marek Vasut
  2012-09-29 21:53     ` [U-Boot] [PATCH 67/72] serial: Unconditionally enable CONFIG_SERIAL_MULTI Marek Vasut
                       ` (7 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:52 UTC (permalink / raw)
  To: u-boot

Move the common/serial.c into driver/serial/, since this file
provides serial multiplexing functions and it is imperative to
be linked with libserial.o instead of libcommon.o.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 common/Makefile         |    1 -
 common/serial.c         |  352 -----------------------------------------------
 drivers/serial/Makefile |    4 +
 drivers/serial/serial.c |  352 +++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 356 insertions(+), 353 deletions(-)
 delete mode 100644 common/serial.c
 create mode 100644 drivers/serial/serial.c

diff --git a/common/Makefile b/common/Makefile
index b56df1d..6afe131 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -32,7 +32,6 @@ COBJS-y += command.o
 COBJS-y += exports.o
 COBJS-$(CONFIG_SYS_HUSH_PARSER) += hush.o
 COBJS-y += s_record.o
-COBJS-$(CONFIG_SERIAL_MULTI) += serial.o
 COBJS-y += xyzModem.o
 COBJS-y += cmd_disk.o
 
diff --git a/common/serial.c b/common/serial.c
deleted file mode 100644
index 91c7269..0000000
--- a/common/serial.c
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- * (C) Copyright 2004
- * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * 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
- */
-
-#include <common.h>
-#include <serial.h>
-#include <stdio_dev.h>
-#include <post.h>
-#include <linux/compiler.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-static struct serial_device *serial_devices;
-static struct serial_device *serial_current;
-
-static void serial_null(void)
-{
-}
-
-#define serial_initfunc(name)					\
-	void name(void)						\
-		__attribute__((weak, alias("serial_null")));
-
-serial_initfunc(mpc8xx_serial_initialize);
-serial_initfunc(ns16550_serial_initialize);
-serial_initfunc(pxa_serial_initialize);
-serial_initfunc(s3c24xx_serial_initialize);
-serial_initfunc(s5p_serial_initialize);
-serial_initfunc(bfin_serial_initialize);
-serial_initfunc(bfin_jtag_initialize);
-serial_initfunc(mpc512x_serial_initialize);
-serial_initfunc(uartlite_serial_initialize);
-serial_initfunc(au1x00_serial_initialize);
-serial_initfunc(asc_serial_initialize);
-serial_initfunc(jz_serial_initialize);
-serial_initfunc(mpc5xx_serial_initialize);
-serial_initfunc(mpc8220_serial_initialize);
-serial_initfunc(mpc8260_scc_serial_initialize);
-serial_initfunc(mpc8260_smc_serial_initialize);
-serial_initfunc(mpc85xx_serial_initialize);
-serial_initfunc(iop480_serial_initialize);
-serial_initfunc(leon2_serial_initialize);
-serial_initfunc(leon3_serial_initialize);
-serial_initfunc(marvell_serial_initialize);
-serial_initfunc(amirix_serial_initialize);
-serial_initfunc(bmw_serial_initialize);
-serial_initfunc(cogent_serial_initialize);
-serial_initfunc(cpci750_serial_initialize);
-serial_initfunc(evb64260_serial_initialize);
-serial_initfunc(ml2_serial_initialize);
-serial_initfunc(sconsole_serial_initialize);
-serial_initfunc(p3mx_serial_initialize);
-serial_initfunc(altera_jtag_serial_initialize);
-serial_initfunc(altera_serial_initialize);
-serial_initfunc(atmel_serial_initialize);
-serial_initfunc(lpc32xx_serial_initialize);
-serial_initfunc(mcf_serial_initialize);
-serial_initfunc(ns9750_serial_initialize);
-serial_initfunc(oc_serial_initialize);
-serial_initfunc(s3c4510b_serial_initialize);
-serial_initfunc(s3c64xx_serial_initialize);
-serial_initfunc(sandbox_serial_initialize);
-serial_initfunc(clps7111_serial_initialize);
-serial_initfunc(imx_serial_initialize);
-serial_initfunc(ixp_serial_initialize);
-serial_initfunc(ks8695_serial_initialize);
-serial_initfunc(lh7a40x_serial_initialize);
-serial_initfunc(lpc2292_serial_initialize);
-serial_initfunc(max3100_serial_initialize);
-serial_initfunc(mxc_serial_initialize);
-serial_initfunc(netarm_serial_initialize);
-serial_initfunc(pl01x_serial_initialize);
-serial_initfunc(s3c44b0_serial_initialize);
-serial_initfunc(sa1100_serial_initialize);
-serial_initfunc(sh_serial_initialize);
-
-void serial_register(struct serial_device *dev)
-{
-#ifdef CONFIG_NEEDS_MANUAL_RELOC
-	dev->start += gd->reloc_off;
-	dev->setbrg += gd->reloc_off;
-	dev->getc += gd->reloc_off;
-	dev->tstc += gd->reloc_off;
-	dev->putc += gd->reloc_off;
-	dev->puts += gd->reloc_off;
-#endif
-
-	dev->next = serial_devices;
-	serial_devices = dev;
-}
-
-void serial_initialize(void)
-{
-	mpc8xx_serial_initialize();
-	ns16550_serial_initialize();
-	pxa_serial_initialize();
-	s3c24xx_serial_initialize();
-	s5p_serial_initialize();
-	mpc512x_serial_initialize();
-	bfin_serial_initialize();
-	bfin_jtag_initialize();
-	uartlite_serial_initialize();
-	au1x00_serial_initialize();
-	asc_serial_initialize();
-	jz_serial_initialize();
-	mpc5xx_serial_initialize();
-	mpc8220_serial_initialize();
-	mpc8260_scc_serial_initialize();
-	mpc8260_smc_serial_initialize();
-	mpc85xx_serial_initialize();
-	iop480_serial_initialize();
-	leon2_serial_initialize();
-	leon3_serial_initialize();
-	marvell_serial_initialize();
-	amirix_serial_initialize();
-	bmw_serial_initialize();
-	cogent_serial_initialize();
-	cpci750_serial_initialize();
-	evb64260_serial_initialize();
-	ml2_serial_initialize();
-	sconsole_serial_initialize();
-	p3mx_serial_initialize();
-	altera_jtag_serial_initialize();
-	altera_serial_initialize();
-	atmel_serial_initialize();
-	lpc32xx_serial_initialize();
-	mcf_serial_initialize();
-	ns9750_serial_initialize();
-	oc_serial_initialize();
-	s3c4510b_serial_initialize();
-	s3c64xx_serial_initialize();
-	sandbox_serial_initialize();
-	clps7111_serial_initialize();
-	imx_serial_initialize();
-	ixp_serial_initialize();
-	ks8695_serial_initialize();
-	lh7a40x_serial_initialize();
-	lpc2292_serial_initialize();
-	max3100_serial_initialize();
-	mxc_serial_initialize();
-	netarm_serial_initialize();
-	pl01x_serial_initialize();
-	s3c44b0_serial_initialize();
-	sa1100_serial_initialize();
-	sh_serial_initialize();
-
-	serial_assign(default_serial_console()->name);
-}
-
-void serial_stdio_init(void)
-{
-	struct stdio_dev dev;
-	struct serial_device *s = serial_devices;
-
-	while (s) {
-		memset(&dev, 0, sizeof(dev));
-
-		strcpy(dev.name, s->name);
-		dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT;
-
-		dev.start = s->start;
-		dev.stop = s->stop;
-		dev.putc = s->putc;
-		dev.puts = s->puts;
-		dev.getc = s->getc;
-		dev.tstc = s->tstc;
-
-		stdio_register(&dev);
-
-		s = s->next;
-	}
-}
-
-int serial_assign(const char *name)
-{
-	struct serial_device *s;
-
-	for (s = serial_devices; s; s = s->next) {
-		if (strcmp(s->name, name) == 0) {
-			serial_current = s;
-			return 0;
-		}
-	}
-
-	return 1;
-}
-
-void serial_reinit_all(void)
-{
-	struct serial_device *s;
-
-	for (s = serial_devices; s; s = s->next)
-		s->start();
-}
-
-static struct serial_device *get_current(void)
-{
-	struct serial_device *dev;
-
-	if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
-		dev = default_serial_console();
-
-		/* We must have a console device */
-		if (!dev) {
-#ifdef CONFIG_SPL_BUILD
-			puts("Cannot find console\n");
-			hang();
-#else
-			panic("Cannot find console\n");
-#endif
-		}
-	} else
-		dev = serial_current;
-	return dev;
-}
-
-int serial_init(void)
-{
-	return get_current()->start();
-}
-
-void serial_setbrg(void)
-{
-	get_current()->setbrg();
-}
-
-int serial_getc(void)
-{
-	return get_current()->getc();
-}
-
-int serial_tstc(void)
-{
-	return get_current()->tstc();
-}
-
-void serial_putc(const char c)
-{
-	get_current()->putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	get_current()->puts(s);
-}
-
-#if CONFIG_POST & CONFIG_SYS_POST_UART
-static const int bauds[] = CONFIG_SYS_BAUDRATE_TABLE;
-
-/* Mark weak until post/cpu/.../uart.c migrate over */
-__weak
-int uart_post_test(int flags)
-{
-	unsigned char c;
-	int ret, saved_baud, b;
-	struct serial_device *saved_dev, *s;
-	bd_t *bd = gd->bd;
-
-	/* Save current serial state */
-	ret = 0;
-	saved_dev = serial_current;
-	saved_baud = bd->bi_baudrate;
-
-	for (s = serial_devices; s; s = s->next) {
-		/* If this driver doesn't support loop back, skip it */
-		if (!s->loop)
-			continue;
-
-		/* Test the next device */
-		serial_current = s;
-
-		ret = serial_init();
-		if (ret)
-			goto done;
-
-		/* Consume anything that happens to be queued */
-		while (serial_tstc())
-			serial_getc();
-
-		/* Enable loop back */
-		s->loop(1);
-
-		/* Test every available baud rate */
-		for (b = 0; b < ARRAY_SIZE(bauds); ++b) {
-			bd->bi_baudrate = bauds[b];
-			serial_setbrg();
-
-			/*
-			 * Stick to printable chars to avoid issues:
-			 *  - terminal corruption
-			 *  - serial program reacting to sequences and sending
-			 *    back random extra data
-			 *  - most serial drivers add in extra chars (like \r\n)
-			 */
-			for (c = 0x20; c < 0x7f; ++c) {
-				/* Send it out */
-				serial_putc(c);
-
-				/* Make sure it's the same one */
-				ret = (c != serial_getc());
-				if (ret) {
-					s->loop(0);
-					goto done;
-				}
-
-				/* Clean up the output in case it was sent */
-				serial_putc('\b');
-				ret = ('\b' != serial_getc());
-				if (ret) {
-					s->loop(0);
-					goto done;
-				}
-			}
-		}
-
-		/* Disable loop back */
-		s->loop(0);
-
-		/* XXX: There is no serial_stop() !? */
-		if (s->stop)
-			s->stop();
-	}
-
- done:
-	/* Restore previous serial state */
-	serial_current = saved_dev;
-	bd->bi_baudrate = saved_baud;
-	serial_reinit_all();
-	serial_setbrg();
-
-	return ret;
-}
-#endif
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index d93e81b..1491d43 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -25,6 +25,10 @@ include $(TOPDIR)/config.mk
 
 LIB	:= $(obj)libserial.o
 
+ifndef CONFIG_SPL_BUILD
+COBJS-$(CONFIG_SERIAL_MULTI) += serial.o
+endif
+
 COBJS-$(CONFIG_ALTERA_UART) += altera_uart.o
 COBJS-$(CONFIG_ALTERA_JTAG_UART) += altera_jtag_uart.o
 COBJS-$(CONFIG_ARM_DCC) += arm_dcc.o
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
new file mode 100644
index 0000000..91c7269
--- /dev/null
+++ b/drivers/serial/serial.c
@@ -0,0 +1,352 @@
+/*
+ * (C) Copyright 2004
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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
+ */
+
+#include <common.h>
+#include <serial.h>
+#include <stdio_dev.h>
+#include <post.h>
+#include <linux/compiler.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static struct serial_device *serial_devices;
+static struct serial_device *serial_current;
+
+static void serial_null(void)
+{
+}
+
+#define serial_initfunc(name)					\
+	void name(void)						\
+		__attribute__((weak, alias("serial_null")));
+
+serial_initfunc(mpc8xx_serial_initialize);
+serial_initfunc(ns16550_serial_initialize);
+serial_initfunc(pxa_serial_initialize);
+serial_initfunc(s3c24xx_serial_initialize);
+serial_initfunc(s5p_serial_initialize);
+serial_initfunc(bfin_serial_initialize);
+serial_initfunc(bfin_jtag_initialize);
+serial_initfunc(mpc512x_serial_initialize);
+serial_initfunc(uartlite_serial_initialize);
+serial_initfunc(au1x00_serial_initialize);
+serial_initfunc(asc_serial_initialize);
+serial_initfunc(jz_serial_initialize);
+serial_initfunc(mpc5xx_serial_initialize);
+serial_initfunc(mpc8220_serial_initialize);
+serial_initfunc(mpc8260_scc_serial_initialize);
+serial_initfunc(mpc8260_smc_serial_initialize);
+serial_initfunc(mpc85xx_serial_initialize);
+serial_initfunc(iop480_serial_initialize);
+serial_initfunc(leon2_serial_initialize);
+serial_initfunc(leon3_serial_initialize);
+serial_initfunc(marvell_serial_initialize);
+serial_initfunc(amirix_serial_initialize);
+serial_initfunc(bmw_serial_initialize);
+serial_initfunc(cogent_serial_initialize);
+serial_initfunc(cpci750_serial_initialize);
+serial_initfunc(evb64260_serial_initialize);
+serial_initfunc(ml2_serial_initialize);
+serial_initfunc(sconsole_serial_initialize);
+serial_initfunc(p3mx_serial_initialize);
+serial_initfunc(altera_jtag_serial_initialize);
+serial_initfunc(altera_serial_initialize);
+serial_initfunc(atmel_serial_initialize);
+serial_initfunc(lpc32xx_serial_initialize);
+serial_initfunc(mcf_serial_initialize);
+serial_initfunc(ns9750_serial_initialize);
+serial_initfunc(oc_serial_initialize);
+serial_initfunc(s3c4510b_serial_initialize);
+serial_initfunc(s3c64xx_serial_initialize);
+serial_initfunc(sandbox_serial_initialize);
+serial_initfunc(clps7111_serial_initialize);
+serial_initfunc(imx_serial_initialize);
+serial_initfunc(ixp_serial_initialize);
+serial_initfunc(ks8695_serial_initialize);
+serial_initfunc(lh7a40x_serial_initialize);
+serial_initfunc(lpc2292_serial_initialize);
+serial_initfunc(max3100_serial_initialize);
+serial_initfunc(mxc_serial_initialize);
+serial_initfunc(netarm_serial_initialize);
+serial_initfunc(pl01x_serial_initialize);
+serial_initfunc(s3c44b0_serial_initialize);
+serial_initfunc(sa1100_serial_initialize);
+serial_initfunc(sh_serial_initialize);
+
+void serial_register(struct serial_device *dev)
+{
+#ifdef CONFIG_NEEDS_MANUAL_RELOC
+	dev->start += gd->reloc_off;
+	dev->setbrg += gd->reloc_off;
+	dev->getc += gd->reloc_off;
+	dev->tstc += gd->reloc_off;
+	dev->putc += gd->reloc_off;
+	dev->puts += gd->reloc_off;
+#endif
+
+	dev->next = serial_devices;
+	serial_devices = dev;
+}
+
+void serial_initialize(void)
+{
+	mpc8xx_serial_initialize();
+	ns16550_serial_initialize();
+	pxa_serial_initialize();
+	s3c24xx_serial_initialize();
+	s5p_serial_initialize();
+	mpc512x_serial_initialize();
+	bfin_serial_initialize();
+	bfin_jtag_initialize();
+	uartlite_serial_initialize();
+	au1x00_serial_initialize();
+	asc_serial_initialize();
+	jz_serial_initialize();
+	mpc5xx_serial_initialize();
+	mpc8220_serial_initialize();
+	mpc8260_scc_serial_initialize();
+	mpc8260_smc_serial_initialize();
+	mpc85xx_serial_initialize();
+	iop480_serial_initialize();
+	leon2_serial_initialize();
+	leon3_serial_initialize();
+	marvell_serial_initialize();
+	amirix_serial_initialize();
+	bmw_serial_initialize();
+	cogent_serial_initialize();
+	cpci750_serial_initialize();
+	evb64260_serial_initialize();
+	ml2_serial_initialize();
+	sconsole_serial_initialize();
+	p3mx_serial_initialize();
+	altera_jtag_serial_initialize();
+	altera_serial_initialize();
+	atmel_serial_initialize();
+	lpc32xx_serial_initialize();
+	mcf_serial_initialize();
+	ns9750_serial_initialize();
+	oc_serial_initialize();
+	s3c4510b_serial_initialize();
+	s3c64xx_serial_initialize();
+	sandbox_serial_initialize();
+	clps7111_serial_initialize();
+	imx_serial_initialize();
+	ixp_serial_initialize();
+	ks8695_serial_initialize();
+	lh7a40x_serial_initialize();
+	lpc2292_serial_initialize();
+	max3100_serial_initialize();
+	mxc_serial_initialize();
+	netarm_serial_initialize();
+	pl01x_serial_initialize();
+	s3c44b0_serial_initialize();
+	sa1100_serial_initialize();
+	sh_serial_initialize();
+
+	serial_assign(default_serial_console()->name);
+}
+
+void serial_stdio_init(void)
+{
+	struct stdio_dev dev;
+	struct serial_device *s = serial_devices;
+
+	while (s) {
+		memset(&dev, 0, sizeof(dev));
+
+		strcpy(dev.name, s->name);
+		dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT;
+
+		dev.start = s->start;
+		dev.stop = s->stop;
+		dev.putc = s->putc;
+		dev.puts = s->puts;
+		dev.getc = s->getc;
+		dev.tstc = s->tstc;
+
+		stdio_register(&dev);
+
+		s = s->next;
+	}
+}
+
+int serial_assign(const char *name)
+{
+	struct serial_device *s;
+
+	for (s = serial_devices; s; s = s->next) {
+		if (strcmp(s->name, name) == 0) {
+			serial_current = s;
+			return 0;
+		}
+	}
+
+	return 1;
+}
+
+void serial_reinit_all(void)
+{
+	struct serial_device *s;
+
+	for (s = serial_devices; s; s = s->next)
+		s->start();
+}
+
+static struct serial_device *get_current(void)
+{
+	struct serial_device *dev;
+
+	if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
+		dev = default_serial_console();
+
+		/* We must have a console device */
+		if (!dev) {
+#ifdef CONFIG_SPL_BUILD
+			puts("Cannot find console\n");
+			hang();
+#else
+			panic("Cannot find console\n");
+#endif
+		}
+	} else
+		dev = serial_current;
+	return dev;
+}
+
+int serial_init(void)
+{
+	return get_current()->start();
+}
+
+void serial_setbrg(void)
+{
+	get_current()->setbrg();
+}
+
+int serial_getc(void)
+{
+	return get_current()->getc();
+}
+
+int serial_tstc(void)
+{
+	return get_current()->tstc();
+}
+
+void serial_putc(const char c)
+{
+	get_current()->putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	get_current()->puts(s);
+}
+
+#if CONFIG_POST & CONFIG_SYS_POST_UART
+static const int bauds[] = CONFIG_SYS_BAUDRATE_TABLE;
+
+/* Mark weak until post/cpu/.../uart.c migrate over */
+__weak
+int uart_post_test(int flags)
+{
+	unsigned char c;
+	int ret, saved_baud, b;
+	struct serial_device *saved_dev, *s;
+	bd_t *bd = gd->bd;
+
+	/* Save current serial state */
+	ret = 0;
+	saved_dev = serial_current;
+	saved_baud = bd->bi_baudrate;
+
+	for (s = serial_devices; s; s = s->next) {
+		/* If this driver doesn't support loop back, skip it */
+		if (!s->loop)
+			continue;
+
+		/* Test the next device */
+		serial_current = s;
+
+		ret = serial_init();
+		if (ret)
+			goto done;
+
+		/* Consume anything that happens to be queued */
+		while (serial_tstc())
+			serial_getc();
+
+		/* Enable loop back */
+		s->loop(1);
+
+		/* Test every available baud rate */
+		for (b = 0; b < ARRAY_SIZE(bauds); ++b) {
+			bd->bi_baudrate = bauds[b];
+			serial_setbrg();
+
+			/*
+			 * Stick to printable chars to avoid issues:
+			 *  - terminal corruption
+			 *  - serial program reacting to sequences and sending
+			 *    back random extra data
+			 *  - most serial drivers add in extra chars (like \r\n)
+			 */
+			for (c = 0x20; c < 0x7f; ++c) {
+				/* Send it out */
+				serial_putc(c);
+
+				/* Make sure it's the same one */
+				ret = (c != serial_getc());
+				if (ret) {
+					s->loop(0);
+					goto done;
+				}
+
+				/* Clean up the output in case it was sent */
+				serial_putc('\b');
+				ret = ('\b' != serial_getc());
+				if (ret) {
+					s->loop(0);
+					goto done;
+				}
+			}
+		}
+
+		/* Disable loop back */
+		s->loop(0);
+
+		/* XXX: There is no serial_stop() !? */
+		if (s->stop)
+			s->stop();
+	}
+
+ done:
+	/* Restore previous serial state */
+	serial_current = saved_dev;
+	bd->bi_baudrate = saved_baud;
+	serial_reinit_all();
+	serial_setbrg();
+
+	return ret;
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 67/72] serial: Unconditionally enable CONFIG_SERIAL_MULTI
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (65 preceding siblings ...)
  2012-09-29 21:52     ` [U-Boot] [PATCH 66/72] serial: Move common/serial.c to drivers/serial/ Marek Vasut
@ 2012-09-29 21:53     ` Marek Vasut
  2012-10-09 20:33       ` Stephen Warren
  2012-09-29 21:53     ` [U-Boot] [PATCH 68/72] serial: Remove CONFIG_SERIAL_MULTI from config files Marek Vasut
                       ` (6 subsequent siblings)
  73 siblings, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:53 UTC (permalink / raw)
  To: u-boot

Enable CONFIG_SERIAL_MULTI for all builds of U-Boot. That includes
both SPL builds and non-SPL builds, everything. To avoid poluting
this patch with removal of ifdef-endif constructions containing
CONFIG_SERIAL_MULTI, the CONFIG_SERIAL_MULTI is temporarily added
into CPPFLAGS in config.mk . This will be again removed in following
patch.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
---
 config.mk               |    2 +-
 drivers/serial/Makefile |    2 --
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/config.mk b/config.mk
index c3822a2..88c72f1 100644
--- a/config.mk
+++ b/config.mk
@@ -193,7 +193,7 @@ OBJCFLAGS += --gap-fill=0xff
 gccincdir := $(shell $(CC) -print-file-name=include)
 
 CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS)		\
-	-D__KERNEL__
+	-D__KERNEL__ -DCONFIG_SERIAL_MULTI
 
 # Enable garbage collection of un-used sections for SPL
 ifeq ($(CONFIG_SPL_BUILD),y)
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index 1491d43..9b54c12 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -25,9 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB	:= $(obj)libserial.o
 
-ifndef CONFIG_SPL_BUILD
 COBJS-$(CONFIG_SERIAL_MULTI) += serial.o
-endif
 
 COBJS-$(CONFIG_ALTERA_UART) += altera_uart.o
 COBJS-$(CONFIG_ALTERA_JTAG_UART) += altera_jtag_uart.o
-- 
1.7.10.4

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

* [U-Boot] [PATCH 68/72] serial: Remove CONFIG_SERIAL_MULTI from config files
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (66 preceding siblings ...)
  2012-09-29 21:53     ` [U-Boot] [PATCH 67/72] serial: Unconditionally enable CONFIG_SERIAL_MULTI Marek Vasut
@ 2012-09-29 21:53     ` Marek Vasut
  2012-09-29 21:53     ` [U-Boot] [PATCH 69/72] serial: Remove CONFIG_SERIAL_MULTI from serial drivers Marek Vasut
                       ` (5 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:53 UTC (permalink / raw)
  To: u-boot

Remove any notion of CONFIG_SERIAL_MULTI from board config files.
Since CONFIG_SERIAL_MULTI is now enabled by default, it is useless
to specify this config option in the board config files. Therefore
remove it.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 include/configs/DU440.h             |    1 -
 include/configs/KAREF.h             |    1 -
 include/configs/METROBOX.h          |    1 -
 include/configs/MPC8569MDS.h        |    1 -
 include/configs/P1010RDB.h          |    1 -
 include/configs/P1_P2_RDB.h         |    1 -
 include/configs/P2020COME.h         |    1 -
 include/configs/PMC440.h            |    1 -
 include/configs/TB5200.h            |    1 -
 include/configs/amcc-common.h       |    1 -
 include/configs/bfin_adi_common.h   |    1 -
 include/configs/coreboot.h          |    1 -
 include/configs/eNET.h              |    1 -
 include/configs/harmony.h           |    1 -
 include/configs/jadecpu.h           |    1 -
 include/configs/korat.h             |    1 -
 include/configs/lwmon.h             |    1 -
 include/configs/lwmon5.h            |    1 -
 include/configs/mcc200.h            |    5 -----
 include/configs/medcom.h            |    1 -
 include/configs/omap3_zoom2.h       |    1 -
 include/configs/origen.h            |    1 -
 include/configs/paz00.h             |    1 -
 include/configs/pcs440ep.h          |    1 -
 include/configs/pdm360ng.h          |    3 ---
 include/configs/plutux.h            |    1 -
 include/configs/quad100hd.h         |    1 -
 include/configs/s5p_goni.h          |    1 -
 include/configs/s5pc210_universal.h |    1 -
 include/configs/sc3.h               |    1 -
 include/configs/seaboard.h          |    1 -
 include/configs/smdk5250.h          |    1 -
 include/configs/smdkc100.h          |    1 -
 include/configs/smdkv310.h          |    1 -
 include/configs/tec.h               |    1 -
 include/configs/tegra-common-post.h |    5 -----
 include/configs/trats.h             |    1 -
 include/configs/trimslice.h         |    1 -
 include/configs/trizepsiv.h         |    1 -
 include/configs/ventana.h           |    1 -
 include/configs/whistler.h          |    1 -
 include/configs/zeus.h              |    1 -
 42 files changed, 52 deletions(-)

diff --git a/include/configs/DU440.h b/include/configs/DU440.h
index 8bd7940..bbe2713 100644
--- a/include/configs/DU440.h
+++ b/include/configs/DU440.h
@@ -93,7 +93,6 @@
 #define CONFIG_SYS_NS16550_CLK		get_serial_clock()
 #undef CONFIG_SYS_EXT_SERIAL_CLOCK
 #define CONFIG_BAUDRATE		115200
-#define CONFIG_SERIAL_MULTI     1
 
 #define CONFIG_SYS_BAUDRATE_TABLE						\
 	{300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
diff --git a/include/configs/KAREF.h b/include/configs/KAREF.h
index 3daf480..546e28b 100644
--- a/include/configs/KAREF.h
+++ b/include/configs/KAREF.h
@@ -96,7 +96,6 @@
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE	1
 #define CONFIG_SYS_NS16550_CLK		get_serial_clock()
-#define CONFIG_SERIAL_MULTI   1
 #define CONFIG_BAUDRATE	      9600
 
 #define CONFIG_SYS_BAUDRATE_TABLE  \
diff --git a/include/configs/METROBOX.h b/include/configs/METROBOX.h
index 34376bc..286f869 100644
--- a/include/configs/METROBOX.h
+++ b/include/configs/METROBOX.h
@@ -158,7 +158,6 @@
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE	1
 #define CONFIG_SYS_NS16550_CLK		get_serial_clock()
-#define CONFIG_SERIAL_MULTI   1
 #define CONFIG_BAUDRATE	      9600
 
 #define CONFIG_SYS_BAUDRATE_TABLE  \
diff --git a/include/configs/MPC8569MDS.h b/include/configs/MPC8569MDS.h
index d973364..acd3276 100644
--- a/include/configs/MPC8569MDS.h
+++ b/include/configs/MPC8569MDS.h
@@ -274,7 +274,6 @@ extern unsigned long get_clock_freq(void);
 
 /* Serial Port */
 #define CONFIG_CONS_INDEX		1
-#define CONFIG_SERIAL_MULTI		1
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE    1
diff --git a/include/configs/P1010RDB.h b/include/configs/P1010RDB.h
index 67dba9f..540f32d 100644
--- a/include/configs/P1010RDB.h
+++ b/include/configs/P1010RDB.h
@@ -453,7 +453,6 @@ extern unsigned long get_sdram_size(void);
 #define CONFIG_NS16550_MIN_FUNCTIONS
 #endif
 
-#define CONFIG_SERIAL_MULTI		/* Enable both serial ports */
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV	/* determine from environment */
 
 #define CONFIG_SYS_BAUDRATE_TABLE	\
diff --git a/include/configs/P1_P2_RDB.h b/include/configs/P1_P2_RDB.h
index ab88166..9db0e87 100644
--- a/include/configs/P1_P2_RDB.h
+++ b/include/configs/P1_P2_RDB.h
@@ -343,7 +343,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 #define CONFIG_NS16550_MIN_FUNCTIONS
 #endif
 
-#define CONFIG_SERIAL_MULTI	1 /* Enable both serial ports */
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV	/* determine from environment */
 
 #define CONFIG_SYS_BAUDRATE_TABLE	\
diff --git a/include/configs/P2020COME.h b/include/configs/P2020COME.h
index d323fb5..c75f86c 100644
--- a/include/configs/P2020COME.h
+++ b/include/configs/P2020COME.h
@@ -201,7 +201,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 #define CONFIG_SYS_NS16550_REG_SIZE	1
 #define CONFIG_SYS_NS16550_CLK		get_bus_freq(0)
 
-#define CONFIG_SERIAL_MULTI	1 /* Enable both serial ports */
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV	/* determine from environment */
 
 #define CONFIG_SYS_BAUDRATE_TABLE   \
diff --git a/include/configs/PMC440.h b/include/configs/PMC440.h
index b820954..3837b8f 100644
--- a/include/configs/PMC440.h
+++ b/include/configs/PMC440.h
@@ -102,7 +102,6 @@
 #define CONFIG_SYS_NS16550_CLK		get_serial_clock()
 #undef CONFIG_SYS_EXT_SERIAL_CLOCK
 #define CONFIG_BAUDRATE		115200
-#define CONFIG_SERIAL_MULTI     1
 
 #define CONFIG_SYS_BAUDRATE_TABLE						\
 	{300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
diff --git a/include/configs/TB5200.h b/include/configs/TB5200.h
index feaadf3..a624c83 100644
--- a/include/configs/TB5200.h
+++ b/include/configs/TB5200.h
@@ -56,7 +56,6 @@
  * Serial console configuration
  */
 #define CONFIG_PSC_CONSOLE	1	/* default console is on PSC1 */
-#define CONFIG_SERIAL_MULTI	1	/* support multiple consoles */
 #define CONFIG_PSC_CONSOLE2	6	/* second console is on PSC6 */
 #define CONFIG_BAUDRATE		115200	/* ... at 115200 bps */
 #define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200, 230400 }
diff --git a/include/configs/amcc-common.h b/include/configs/amcc-common.h
index 056a22a..c9db47a 100644
--- a/include/configs/amcc-common.h
+++ b/include/configs/amcc-common.h
@@ -31,7 +31,6 @@
 /*
  * UART
  */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE	1
diff --git a/include/configs/bfin_adi_common.h b/include/configs/bfin_adi_common.h
index 7132f8f..b635c7d 100644
--- a/include/configs/bfin_adi_common.h
+++ b/include/configs/bfin_adi_common.h
@@ -108,7 +108,6 @@
 #define CONFIG_LOADS_ECHO	1
 #define CONFIG_JTAG_CONSOLE
 #define CONFIG_SILENT_CONSOLE
-#define CONFIG_SERIAL_MULTI
 #ifndef CONFIG_BAUDRATE
 # define CONFIG_BAUDRATE	57600
 #endif
diff --git a/include/configs/coreboot.h b/include/configs/coreboot.h
index 2c65d74..0e89242 100644
--- a/include/configs/coreboot.h
+++ b/include/configs/coreboot.h
@@ -54,7 +54,6 @@
 /*-----------------------------------------------------------------------
  * Serial Configuration
  */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_CONS_INDEX		1
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_SERIAL
diff --git a/include/configs/eNET.h b/include/configs/eNET.h
index d5c9cad..4b1c219 100644
--- a/include/configs/eNET.h
+++ b/include/configs/eNET.h
@@ -55,7 +55,6 @@
 /*-----------------------------------------------------------------------
  * Serial Configuration
  */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_CONS_INDEX			1
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_SERIAL
diff --git a/include/configs/harmony.h b/include/configs/harmony.h
index e407ff4..d582ae1 100644
--- a/include/configs/harmony.h
+++ b/include/configs/harmony.h
@@ -37,7 +37,6 @@
 #define CONFIG_TEGRA_BOARD_STRING	"NVIDIA Harmony"
 
 /* Board-specific serial config */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_TEGRA_ENABLE_UARTD
 
 /* UARTD: keyboard satellite board UART, default */
diff --git a/include/configs/jadecpu.h b/include/configs/jadecpu.h
index 7b9d36d..daf37bf 100644
--- a/include/configs/jadecpu.h
+++ b/include/configs/jadecpu.h
@@ -68,7 +68,6 @@
 /*
  * Serial
  */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE		(-4)
diff --git a/include/configs/korat.h b/include/configs/korat.h
index 46335b4..b919aec 100644
--- a/include/configs/korat.h
+++ b/include/configs/korat.h
@@ -102,7 +102,6 @@
 #define CONFIG_SYS_NS16550_CLK		get_serial_clock()
 #define CONFIG_SYS_EXT_SERIAL_CLOCK	11059200	/* ext. 11.059MHz clk	*/
 #define CONFIG_BAUDRATE		115200
-#define CONFIG_SERIAL_MULTI	1
 
 #define CONFIG_SYS_BAUDRATE_TABLE						\
 	{300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
diff --git a/include/configs/lwmon.h b/include/configs/lwmon.h
index 1d89176..ab86053 100644
--- a/include/configs/lwmon.h
+++ b/include/configs/lwmon.h
@@ -60,7 +60,6 @@
 #define CONFIG_LCD_INFO		1	/* ... and some board info	*/
 #define	CONFIG_SPLASH_SCREEN		/* ... with splashscreen support*/
 
-#define CONFIG_SERIAL_MULTI	1
 #define CONFIG_8xx_CONS_SMC2	1	/* Console is on SMC2		*/
 #define CONFIG_8xx_CONS_SCC2	1	/* Console is on SCC2		*/
 
diff --git a/include/configs/lwmon5.h b/include/configs/lwmon5.h
index 497eec4..2d33ebc 100644
--- a/include/configs/lwmon5.h
+++ b/include/configs/lwmon5.h
@@ -121,7 +121,6 @@
 #define CONFIG_SYS_NS16550_CLK		get_serial_clock()
 #undef CONFIG_SYS_EXT_SERIAL_CLOCK		/* no external clock provided	*/
 #define CONFIG_BAUDRATE		115200
-#define CONFIG_SERIAL_MULTI
 
 #define CONFIG_SYS_BAUDRATE_TABLE						\
 	{300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
diff --git a/include/configs/mcc200.h b/include/configs/mcc200.h
index 1867eb6..053e5bc 100644
--- a/include/configs/mcc200.h
+++ b/include/configs/mcc200.h
@@ -76,17 +76,12 @@
  */
 #if !defined(CONFIG_PRS200)
 /* MCC200 configuration: */
-#define CONFIG_SERIAL_MULTI	1
 #define CONFIG_PSC_CONSOLE	1	/* PSC1 may be COM */
 #define CONFIG_PSC_CONSOLE2	2	/* PSC2 is PSoC */
 #else
 /* PRS200 configuration: */
 #define CONFIG_PSC_CONSOLE	1	/* console is on PSC1		*/
 #endif
-#if defined(CONFIG_QUART_CONSOLE) && defined(CONFIG_PSC_CONSOLE) && \
-	!defined(CONFIG_SERIAL_MULTI)
-#error "Select only one console device!"
-#endif
 #define CONFIG_BAUDRATE		115200
 #define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200, 230400 }
 
diff --git a/include/configs/medcom.h b/include/configs/medcom.h
index 678b36b..45c4fd2 100644
--- a/include/configs/medcom.h
+++ b/include/configs/medcom.h
@@ -38,7 +38,6 @@
 #define CONFIG_TEGRA_BOARD_STRING	"Avionic Design Medcom"
 
 /* Board-specific serial config */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_TEGRA_ENABLE_UARTD	/* UARTD: debug UART */
 #define CONFIG_SYS_NS16550_COM1		NV_PA_APB_UARTD_BASE
 
diff --git a/include/configs/omap3_zoom2.h b/include/configs/omap3_zoom2.h
index a7cc5fc..d681424 100644
--- a/include/configs/omap3_zoom2.h
+++ b/include/configs/omap3_zoom2.h
@@ -76,7 +76,6 @@
  * NS16550 Configuration
  * Zoom2 uses the TL16CP754C on the debug board
  */
-#define CONFIG_SERIAL_MULTI		1
 /*
  * 0 - 1 : first  USB with respect to the left edge of the debug board
  * 2 - 3 : second USB with respect to the left edge of the debug board
diff --git a/include/configs/origen.h b/include/configs/origen.h
index 1ab9834..ff2b24d 100644
--- a/include/configs/origen.h
+++ b/include/configs/origen.h
@@ -63,7 +63,6 @@
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20))
 
 /* select serial console configuration */
-#define CONFIG_SERIAL_MULTI		1
 #define CONFIG_SERIAL2			1	/* use SERIAL 2 */
 #define CONFIG_BAUDRATE			115200
 #define EXYNOS4_DEFAULT_UART_OFFSET	0x020000
diff --git a/include/configs/paz00.h b/include/configs/paz00.h
index 24cda48..5603de9 100644
--- a/include/configs/paz00.h
+++ b/include/configs/paz00.h
@@ -30,7 +30,6 @@
 #define CONFIG_TEGRA_BOARD_STRING	"Compal Paz00"
 
 /* Board-specific serial config */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_TEGRA_ENABLE_UARTA
 #define CONFIG_SYS_NS16550_COM1		NV_PA_APB_UARTA_BASE
 
diff --git a/include/configs/pcs440ep.h b/include/configs/pcs440ep.h
index 26627bb..351ff5a 100644
--- a/include/configs/pcs440ep.h
+++ b/include/configs/pcs440ep.h
@@ -88,7 +88,6 @@
 #define CONFIG_SYS_NS16550_CLK		get_serial_clock()
 #undef CONFIG_SYS_EXT_SERIAL_CLOCK		/* no external clk used		*/
 #define CONFIG_BAUDRATE		115200
-#define CONFIG_SERIAL_MULTI     1
 
 #define CONFIG_SYS_BAUDRATE_TABLE  \
     {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200}
diff --git a/include/configs/pdm360ng.h b/include/configs/pdm360ng.h
index 8afc3c0..671e9eb 100644
--- a/include/configs/pdm360ng.h
+++ b/include/configs/pdm360ng.h
@@ -298,7 +298,6 @@
 /*
  * Used PSC UART devices
  */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_SYS_PSC1
 #define CONFIG_SYS_PSC4
 #define CONFIG_SYS_PSC6
@@ -434,10 +433,8 @@
 #define CONFIG_KGDB_SER_INDEX	2	/* which serial port to use */
 #endif
 
-#ifdef CONFIG_SERIAL_MULTI
 /* POST support */
 #define CONFIG_POST             (CONFIG_SYS_POST_COPROC)
-#endif
 
 /*
  * Environment Configuration
diff --git a/include/configs/plutux.h b/include/configs/plutux.h
index 65b42ed..deee237 100644
--- a/include/configs/plutux.h
+++ b/include/configs/plutux.h
@@ -38,7 +38,6 @@
 #define CONFIG_TEGRA_BOARD_STRING	"Avionic Design Plutux"
 
 /* Board-specific serial config */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_TEGRA_ENABLE_UARTD	/* UARTD: debug UART */
 #define CONFIG_SYS_NS16550_COM1		NV_PA_APB_UARTD_BASE
 
diff --git a/include/configs/quad100hd.h b/include/configs/quad100hd.h
index 5d0c385..5f1bb58 100644
--- a/include/configs/quad100hd.h
+++ b/include/configs/quad100hd.h
@@ -113,7 +113,6 @@
 #undef	CONFIG_SYS_EXT_SERIAL_CLOCK			/* external serial clock */
 #define CONFIG_SYS_BASE_BAUD		691200
 #define CONFIG_BAUDRATE		115200
-#define CONFIG_SERIAL_MULTI
 
 /* The following table includes the supported baudrates */
 #define CONFIG_SYS_BAUDRATE_TABLE	\
diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 36f1a57..7e0b302 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -59,7 +59,6 @@
  * select serial console configuration
  */
 #define CONFIG_SERIAL2			1	/* use SERIAL2 */
-#define CONFIG_SERIAL_MULTI		1
 #define CONFIG_BAUDRATE			115200
 
 /* MMC */
diff --git a/include/configs/s5pc210_universal.h b/include/configs/s5pc210_universal.h
index 7727624..5fc6136 100644
--- a/include/configs/s5pc210_universal.h
+++ b/include/configs/s5pc210_universal.h
@@ -61,7 +61,6 @@
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20))
 
 /* select serial console configuration */
-#define CONFIG_SERIAL_MULTI	1
 #define CONFIG_SERIAL2		1	/* use SERIAL 2 */
 #define CONFIG_BAUDRATE		115200
 
diff --git a/include/configs/sc3.h b/include/configs/sc3.h
index 2d6e51d..fb74608 100644
--- a/include/configs/sc3.h
+++ b/include/configs/sc3.h
@@ -83,7 +83,6 @@
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE	1
 #define CONFIG_SYS_NS16550_CLK		get_serial_clock()
-#define CONFIG_SERIAL_MULTI
 
 /*
  * define CONFIG_SYS_CLK_FREQ to your base crystal clock in Hz
diff --git a/include/configs/seaboard.h b/include/configs/seaboard.h
index de19e38..0727a4c 100644
--- a/include/configs/seaboard.h
+++ b/include/configs/seaboard.h
@@ -45,7 +45,6 @@
 #define CONFIG_TEGRA_BOARD_STRING	"NVIDIA Seaboard"
 
 /* Board-specific serial config */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_TEGRA_ENABLE_UARTD
 #define CONFIG_SYS_NS16550_COM1		NV_PA_APB_UARTD_BASE
 
diff --git a/include/configs/smdk5250.h b/include/configs/smdk5250.h
index 47369aa..c0f8622 100644
--- a/include/configs/smdk5250.h
+++ b/include/configs/smdk5250.h
@@ -68,7 +68,6 @@
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20))
 
 /* select serial console configuration */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_SERIAL3			/* use SERIAL 3 */
 #define CONFIG_BAUDRATE			115200
 #define EXYNOS5_DEFAULT_UART_OFFSET	0x010000
diff --git a/include/configs/smdkc100.h b/include/configs/smdkc100.h
index 22de344..fb640db 100644
--- a/include/configs/smdkc100.h
+++ b/include/configs/smdkc100.h
@@ -64,7 +64,6 @@
  * select serial console configuration
  */
 #define CONFIG_SERIAL0			1	/* use SERIAL 0 on SMDKC100 */
-#define CONFIG_SERIAL_MULTI		1
 
 /* PWM */
 #define CONFIG_PWM			1
diff --git a/include/configs/smdkv310.h b/include/configs/smdkv310.h
index 602337f..b796b46 100644
--- a/include/configs/smdkv310.h
+++ b/include/configs/smdkv310.h
@@ -62,7 +62,6 @@
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20))
 
 /* select serial console configuration */
-#define CONFIG_SERIAL_MULTI		1
 #define CONFIG_SERIAL1			1	/* use SERIAL 1 */
 #define CONFIG_BAUDRATE			115200
 #define EXYNOS4_DEFAULT_UART_OFFSET	0x010000
diff --git a/include/configs/tec.h b/include/configs/tec.h
index d5da3c7..140d2e6 100644
--- a/include/configs/tec.h
+++ b/include/configs/tec.h
@@ -39,7 +39,6 @@
 #define CONFIG_SYS_BOARD_ODMDATA	0x2b0d8011
 
 /* Board-specific serial config */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_TEGRA_ENABLE_UARTD	/* UARTD: debug UART */
 #define CONFIG_SYS_NS16550_COM1		NV_PA_APB_UARTD_BASE
 
diff --git a/include/configs/tegra-common-post.h b/include/configs/tegra-common-post.h
index 168b64b..a01b2a7 100644
--- a/include/configs/tegra-common-post.h
+++ b/include/configs/tegra-common-post.h
@@ -154,11 +154,6 @@
 #undef CONFIG_OF_CONTROL
 #endif
 
-/* remove SERIAL_MULTI */
-#ifdef CONFIG_SERIAL_MULTI
-#undef CONFIG_SERIAL_MULTI
-#endif
-
 /* remove I2C support */
 #ifdef CONFIG_TEGRA_I2C
 #undef CONFIG_TEGRA_I2C
diff --git a/include/configs/trats.h b/include/configs/trats.h
index b3b5a3d..d7808aa 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -69,7 +69,6 @@
 #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20))
 
 /* select serial console configuration */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_SERIAL2			/* use SERIAL 2 */
 #define CONFIG_BAUDRATE			115200
 
diff --git a/include/configs/trimslice.h b/include/configs/trimslice.h
index a46890c..eeb0dbe 100644
--- a/include/configs/trimslice.h
+++ b/include/configs/trimslice.h
@@ -37,7 +37,6 @@
 #define CONFIG_TEGRA_BOARD_STRING	"Compulab Trimslice"
 
 /* Board-specific serial config */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_TEGRA_ENABLE_UARTA
 #define CONFIG_TEGRA_UARTA_GPU
 #define CONFIG_SYS_NS16550_COM1		NV_PA_APB_UARTA_BASE
diff --git a/include/configs/trizepsiv.h b/include/configs/trizepsiv.h
index 47c6a23..bc69c1e 100644
--- a/include/configs/trizepsiv.h
+++ b/include/configs/trizepsiv.h
@@ -64,7 +64,6 @@
  * select serial console configuration
  */
 #define CONFIG_PXA_SERIAL
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_FFUART	       1       /* we use FFUART on Conxs */
 #define CONFIG_BTUART	       1       /* we use BTUART on Conxs */
 #define CONFIG_STUART	       1       /* we use STUART on Conxs */
diff --git a/include/configs/ventana.h b/include/configs/ventana.h
index 7d3a54f..b751d58 100644
--- a/include/configs/ventana.h
+++ b/include/configs/ventana.h
@@ -37,7 +37,6 @@
 #define CONFIG_TEGRA_BOARD_STRING	"NVIDIA Ventana"
 
 /* Board-specific serial config */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_TEGRA_ENABLE_UARTD
 #define CONFIG_SYS_NS16550_COM1		NV_PA_APB_UARTD_BASE
 
diff --git a/include/configs/whistler.h b/include/configs/whistler.h
index 6c565ba..1c7803b 100644
--- a/include/configs/whistler.h
+++ b/include/configs/whistler.h
@@ -37,7 +37,6 @@
 #define CONFIG_TEGRA_BOARD_STRING	"NVIDIA Whistler"
 
 /* Board-specific serial config */
-#define CONFIG_SERIAL_MULTI
 #define CONFIG_TEGRA_ENABLE_UARTA
 #define CONFIG_TEGRA_UARTA_UAA_UAB
 #define CONFIG_SYS_NS16550_COM1		NV_PA_APB_UARTA_BASE
diff --git a/include/configs/zeus.h b/include/configs/zeus.h
index 2556e3b..b0c3bd5 100644
--- a/include/configs/zeus.h
+++ b/include/configs/zeus.h
@@ -130,7 +130,6 @@
 #undef	CONFIG_SYS_EXT_SERIAL_CLOCK			/* external serial clock */
 #define CONFIG_SYS_BASE_BAUD	691200
 #define CONFIG_BAUDRATE		115200
-#define CONFIG_SERIAL_MULTI
 
 #define CONFIG_SYS_BAUDRATE_TABLE  \
     {300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
-- 
1.7.10.4

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

* [U-Boot] [PATCH 69/72] serial: Remove CONFIG_SERIAL_MULTI from serial drivers
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (67 preceding siblings ...)
  2012-09-29 21:53     ` [U-Boot] [PATCH 68/72] serial: Remove CONFIG_SERIAL_MULTI from config files Marek Vasut
@ 2012-09-29 21:53     ` Marek Vasut
  2012-09-29 21:53     ` [U-Boot] [PATCH 70/72] serial: Remove CONFIG_SERIAL_MULTI from remaining sources Marek Vasut
                       ` (4 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:53 UTC (permalink / raw)
  To: u-boot

Remove the support for not-CONFIG_SERIAL_MULTI part from serial
port drivers and some board files. Since CONFIG_SERIAL_MULTI is
now enabled by default, that part is a dead code. Remove it.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/mips/cpu/mips32/au1x00/au1x00_serial.c |   32 ------
 arch/mips/cpu/mips32/incaip/asc_serial.c    |   32 ------
 arch/mips/cpu/xburst/jz_serial.c            |   32 ------
 arch/powerpc/cpu/mpc512x/serial.c           |   64 +-----------
 arch/powerpc/cpu/mpc5xx/serial.c            |   32 ------
 arch/powerpc/cpu/mpc5xxx/serial.c           |  149 +++++++--------------------
 arch/powerpc/cpu/mpc8220/uart.c             |   32 ------
 arch/powerpc/cpu/mpc8260/serial_scc.c       |   32 ------
 arch/powerpc/cpu/mpc8260/serial_smc.c       |   32 ------
 arch/powerpc/cpu/mpc85xx/serial_scc.c       |   32 ------
 arch/powerpc/cpu/ppc4xx/iop480_uart.c       |   35 -------
 arch/sparc/cpu/leon2/serial.c               |   32 ------
 arch/sparc/cpu/leon3/serial.c               |   32 ------
 board/Marvell/common/serial.c               |   32 ------
 board/amirix/ap1000/serial.c                |   31 ------
 board/bmw/serial.c                          |   32 ------
 board/cogent/serial.c                       |   32 ------
 board/esd/cpci750/serial.c                  |   31 ------
 board/evb64260/serial.c                     |   31 ------
 board/ml2/serial.c                          |   31 ------
 board/pcippc2/sconsole.c                    |   31 ------
 board/pdm360ng/pdm360ng.c                   |    6 --
 board/prodrive/p3mx/serial.c                |   32 ------
 board/trizepsiv/conxs.c                     |    2 -
 drivers/serial/altera_jtag_uart.c           |   32 ------
 drivers/serial/altera_uart.c                |   32 ------
 drivers/serial/atmel_usart.c                |   32 ------
 drivers/serial/lpc32xx_hsuart.c             |   32 ------
 drivers/serial/mcfuart.c                    |   32 ------
 drivers/serial/ns9750_serial.c              |   32 ------
 drivers/serial/opencores_yanu.c             |   32 ------
 drivers/serial/s3c4510b_uart.c              |   32 ------
 drivers/serial/s3c64xx.c                    |   32 ------
 drivers/serial/sandbox.c                    |   32 ------
 drivers/serial/serial_clps7111.c            |   32 ------
 drivers/serial/serial_imx.c                 |   32 ------
 drivers/serial/serial_ixp.c                 |   32 ------
 drivers/serial/serial_ks8695.c              |   32 ------
 drivers/serial/serial_lh7a40x.c             |   32 ------
 drivers/serial/serial_lpc2292.c             |   32 ------
 drivers/serial/serial_max3100.c             |   32 ------
 drivers/serial/serial_mxc.c                 |   36 -------
 drivers/serial/serial_netarm.c              |   32 ------
 drivers/serial/serial_ns16550.c             |   95 -----------------
 drivers/serial/serial_pl01x.c               |   32 ------
 drivers/serial/serial_pxa.c                 |   18 ----
 drivers/serial/serial_s3c24x0.c             |   53 ----------
 drivers/serial/serial_s3c44b0.c             |   32 ------
 drivers/serial/serial_sa1100.c              |   32 ------
 drivers/serial/serial_sh.c                  |   32 ------
 drivers/serial/serial_xuartlite.c           |   34 ------
 51 files changed, 39 insertions(+), 1760 deletions(-)

diff --git a/arch/mips/cpu/mips32/au1x00/au1x00_serial.c b/arch/mips/cpu/mips32/au1x00/au1x00_serial.c
index 9682775..0beac98 100644
--- a/arch/mips/cpu/mips32/au1x00/au1x00_serial.c
+++ b/arch/mips/cpu/mips32/au1x00/au1x00_serial.c
@@ -131,7 +131,6 @@ static int au1x00_serial_tstc(void)
 	return 0;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device au1x00_serial_drv = {
 	.name	= "au1x00_serial",
 	.start	= au1x00_serial_init,
@@ -152,34 +151,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &au1x00_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return au1x00_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	au1x00_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	au1x00_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	au1x00_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return au1x00_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return au1x00_serial_tstc();
-}
-#endif
diff --git a/arch/mips/cpu/mips32/incaip/asc_serial.c b/arch/mips/cpu/mips32/incaip/asc_serial.c
index b5f32e2..08949f4 100644
--- a/arch/mips/cpu/mips32/incaip/asc_serial.c
+++ b/arch/mips/cpu/mips32/incaip/asc_serial.c
@@ -286,7 +286,6 @@ static int asc_serial_tstc(void)
     return res;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device asc_serial_drv = {
 	.name	= "asc_serial",
 	.start	= asc_serial_init,
@@ -307,34 +306,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &asc_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return asc_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	asc_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	asc_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	asc_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return asc_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return asc_serial_tstc();
-}
-#endif
diff --git a/arch/mips/cpu/xburst/jz_serial.c b/arch/mips/cpu/xburst/jz_serial.c
index b1e1d27..3199007 100644
--- a/arch/mips/cpu/xburst/jz_serial.c
+++ b/arch/mips/cpu/xburst/jz_serial.c
@@ -115,7 +115,6 @@ static void jz_serial_puts(const char *s)
 		serial_putc(*s++);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device jz_serial_drv = {
 	.name	= "jz_serial",
 	.start	= jz_serial_init,
@@ -136,34 +135,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &jz_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return jz_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	jz_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	jz_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	jz_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return jz_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return jz_serial_tstc();
-}
-#endif
diff --git a/arch/powerpc/cpu/mpc512x/serial.c b/arch/powerpc/cpu/mpc512x/serial.c
index bc10c50..58587fd 100644
--- a/arch/powerpc/cpu/mpc512x/serial.c
+++ b/arch/powerpc/cpu/mpc512x/serial.c
@@ -37,7 +37,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#if defined(CONFIG_PSC_CONSOLE) || defined(CONFIG_SERIAL_MULTI)
+#if defined(CONFIG_PSC_CONSOLE)
 
 static void fifo_init (volatile psc512x_t *psc)
 {
@@ -52,7 +52,6 @@ static void fifo_init (volatile psc512x_t *psc)
 	out_be32(&psc->rfintmask, 0);
 	out_be32(&psc->tfintmask, 0);
 
-#if defined(CONFIG_SERIAL_MULTI)
 	switch (((u32)psc & 0xf00) >> 8) {
 	case 0:
 		tfsize = FIFOC_PSC0_TX_SIZE | (FIFOC_PSC0_TX_ADDR << 16);
@@ -105,10 +104,7 @@ static void fifo_init (volatile psc512x_t *psc)
 	default:
 		return;
 	}
-#else
-	tfsize = CONSOLE_FIFO_TX_SIZE | (CONSOLE_FIFO_TX_ADDR << 16);
-	rfsize = CONSOLE_FIFO_RX_SIZE | (CONSOLE_FIFO_RX_ADDR << 16);
-#endif
+
 	out_be32(&psc->tfsize, tfsize);
 	out_be32(&psc->rfsize, rfsize);
 
@@ -155,12 +151,10 @@ int serial_init_dev(unsigned int idx)
 {
 	volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
 	volatile psc512x_t *psc = (psc512x_t *) &im->psc[idx];
-#if defined(CONFIG_SERIAL_MULTI)
 	u32 reg;
 
 	reg = in_be32(&im->clk.sccr[0]);
 	out_be32(&im->clk.sccr[0], reg | CLOCK_SCCR1_PSC_EN(idx));
-#endif
 
 	fifo_init (psc);
 
@@ -285,9 +279,7 @@ int serial_getcts_dev(unsigned int idx)
 
 	return (in_8(&psc->ip) & 0x1) ? 0 : 1;
 }
-#endif /* CONFIG_PSC_CONSOLE || CONFIG_SERIAL_MULTI */
-
-#if defined(CONFIG_SERIAL_MULTI)
+#endif /* CONFIG_PSC_CONSOLE */
 
 #define DECLARE_PSC_SERIAL_FUNCTIONS(port) \
 	int serial##port##_init(void) \
@@ -381,55 +373,6 @@ void mpc512x_serial_initialize(void)
 #endif
 }
 
-#else
-
-void serial_setbrg(void)
-{
-	serial_setbrg_dev(CONFIG_PSC_CONSOLE);
-}
-
-int serial_init(void)
-{
-	return serial_init_dev(CONFIG_PSC_CONSOLE);
-}
-
-void serial_putc(const char c)
-{
-	serial_putc_dev(CONFIG_PSC_CONSOLE, c);
-}
-
-void serial_putc_raw(const char c)
-{
-	serial_putc_raw_dev(CONFIG_PSC_CONSOLE, c);
-}
-
-void serial_puts(const char *s)
-{
-	serial_puts_dev(CONFIG_PSC_CONSOLE, s);
-}
-
-int serial_getc(void)
-{
-	return serial_getc_dev(CONFIG_PSC_CONSOLE);
-}
-
-int serial_tstc(void)
-{
-	return serial_tstc_dev(CONFIG_PSC_CONSOLE);
-}
-
-void serial_setrts(int s)
-{
-	return serial_setrts_dev(CONFIG_PSC_CONSOLE, s);
-}
-
-int serial_getcts(void)
-{
-	return serial_getcts_dev(CONFIG_PSC_CONSOLE);
-}
-#endif /* CONFIG_PSC_CONSOLE */
-
-#if defined(CONFIG_SERIAL_MULTI)
 #include <stdio_dev.h>
 /*
  * Routines for communication with serial devices over PSC
@@ -514,4 +457,3 @@ int read_port(struct stdio_dev *port, char *buf, int size)
 
 	return cnt;
 }
-#endif /* CONFIG_SERIAL_MULTI */
diff --git a/arch/powerpc/cpu/mpc5xx/serial.c b/arch/powerpc/cpu/mpc5xx/serial.c
index dbaacfc..af802f9 100644
--- a/arch/powerpc/cpu/mpc5xx/serial.c
+++ b/arch/powerpc/cpu/mpc5xx/serial.c
@@ -169,7 +169,6 @@ static void mpc5xx_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device mpc5xx_serial_drv = {
 	.name	= "mpc5xx_serial",
 	.start	= mpc5xx_serial_init,
@@ -190,34 +189,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &mpc5xx_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return mpc5xx_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	mpc5xx_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	mpc5xx_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	mpc5xx_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return mpc5xx_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return mpc5xx_serial_tstc();
-}
-#endif
diff --git a/arch/powerpc/cpu/mpc5xxx/serial.c b/arch/powerpc/cpu/mpc5xxx/serial.c
index 9bebff8..eb14161 100644
--- a/arch/powerpc/cpu/mpc5xxx/serial.c
+++ b/arch/powerpc/cpu/mpc5xxx/serial.c
@@ -25,7 +25,7 @@
  * Linux/PPC sources (m8260_tty.c had no copyright info in it).
  *
  * Martin Krause, 8 Jun 2006
- * Added CONFIG_SERIAL_MULTI support
+ * Added SERIAL_MULTI support
  */
 
 /*
@@ -36,10 +36,7 @@
 #include <common.h>
 #include <linux/compiler.h>
 #include <mpc5xxx.h>
-
-#if defined (CONFIG_SERIAL_MULTI)
 #include <serial.h>
-#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -61,11 +58,8 @@ DECLARE_GLOBAL_DATA_PTR;
 #error CONFIG_PSC_CONSOLE must be in 1 ... 6
 #endif
 
-#if defined(CONFIG_SERIAL_MULTI) && !defined(CONFIG_PSC_CONSOLE2)
-#error you must define CONFIG_PSC_CONSOLE2 if CONFIG_SERIAL_MULTI is set
-#endif
+#if defined(CONFIG_PSC_CONSOLE2)
 
-#if defined(CONFIG_SERIAL_MULTI)
 #if CONFIG_PSC_CONSOLE2 == 1
 #define PSC_BASE2 MPC5XXX_PSC1
 #elif CONFIG_PSC_CONSOLE2 == 2
@@ -81,19 +75,12 @@ DECLARE_GLOBAL_DATA_PTR;
 #else
 #error CONFIG_PSC_CONSOLE2 must be in 1 ... 6
 #endif
-#endif /* CONFIG_SERIAL_MULTI */
 
-#if defined(CONFIG_SERIAL_MULTI)
-int serial_init_dev (unsigned long dev_base)
-#else
-int serial_init (void)
 #endif
+
+int serial_init_dev (unsigned long dev_base)
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
-#else
-	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#endif
 	unsigned long baseclk;
 	int div;
 
@@ -127,24 +114,12 @@ int serial_init (void)
 	return (0);
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 void serial_putc_dev (unsigned long dev_base, const char c)
-#else
-void serial_putc(const char c)
-#endif
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
-#else
-	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#endif
 
 	if (c == '\n')
-#if defined(CONFIG_SERIAL_MULTI)
 		serial_putc_dev (dev_base, '\r');
-#else
-		serial_putc('\r');
-#endif
 
 	/* Wait for last character to go. */
 	while (!(psc->psc_status & PSC_SR_TXEMP))
@@ -153,17 +128,9 @@ void serial_putc(const char c)
 	psc->psc_buffer_8 = c;
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 void serial_putc_raw_dev(unsigned long dev_base, const char c)
-#else
-void serial_putc_raw(const char c)
-#endif
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
-#else
-	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#endif
 	/* Wait for last character to go. */
 	while (!(psc->psc_status & PSC_SR_TXEMP))
 		;
@@ -172,32 +139,16 @@ void serial_putc_raw(const char c)
 }
 
 
-#if defined(CONFIG_SERIAL_MULTI)
 void serial_puts_dev (unsigned long dev_base, const char *s)
-#else
-void serial_puts (const char *s)
-#endif
 {
 	while (*s) {
-#if defined(CONFIG_SERIAL_MULTI)
 		serial_putc_dev (dev_base, *s++);
-#else
-		serial_putc (*s++);
-#endif
 	}
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 int serial_getc_dev (unsigned long dev_base)
-#else
-int serial_getc(void)
-#endif
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
-#else
-	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#endif
 
 	/* Wait for a character to arrive. */
 	while (!(psc->psc_status & PSC_SR_RXRDY))
@@ -206,32 +157,16 @@ int serial_getc(void)
 	return psc->psc_buffer_8;
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 int serial_tstc_dev (unsigned long dev_base)
-#else
-int serial_tstc(void)
-#endif
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
-#else
-	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#endif
 
 	return (psc->psc_status & PSC_SR_RXRDY);
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 void serial_setbrg_dev (unsigned long dev_base)
-#else
-void serial_setbrg(void)
-#endif
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
-#else
-	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#endif
 	unsigned long baseclk, div;
 
 	baseclk = (gd->ipb_clk + 16) / 32;
@@ -242,17 +177,9 @@ void serial_setbrg(void)
 	psc->ctlr =  div & 0xff;
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 void serial_setrts_dev (unsigned long dev_base, int s)
-#else
-void serial_setrts(int s)
-#endif
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
-#else
-	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#endif
 
 	if (s) {
 		/* Assert RTS (become LOW) */
@@ -264,78 +191,43 @@ void serial_setrts(int s)
 	}
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 int serial_getcts_dev (unsigned long dev_base)
-#else
-int serial_getcts(void)
-#endif
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)dev_base;
-#else
-	volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
-#endif
 
 	return (psc->ip & 0x1) ? 0 : 1;
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 int serial0_init(void)
 {
 	return (serial_init_dev(PSC_BASE));
 }
 
-int serial1_init(void)
-{
-	return (serial_init_dev(PSC_BASE2));
-}
 void serial0_setbrg (void)
 {
 	serial_setbrg_dev(PSC_BASE);
 }
-void serial1_setbrg (void)
-{
-	serial_setbrg_dev(PSC_BASE2);
-}
 
 void serial0_putc(const char c)
 {
 	serial_putc_dev(PSC_BASE,c);
 }
 
-void serial1_putc(const char c)
-{
-	serial_putc_dev(PSC_BASE2, c);
-}
 void serial0_puts(const char *s)
 {
 	serial_puts_dev(PSC_BASE, s);
 }
 
-void serial1_puts(const char *s)
-{
-	serial_puts_dev(PSC_BASE2, s);
-}
-
 int serial0_getc(void)
 {
 	return(serial_getc_dev(PSC_BASE));
 }
 
-int serial1_getc(void)
-{
-	return(serial_getc_dev(PSC_BASE2));
-}
 int serial0_tstc(void)
 {
 	return (serial_tstc_dev(PSC_BASE));
 }
 
-int serial1_tstc(void)
-{
-	return (serial_tstc_dev(PSC_BASE2));
-}
-
 struct serial_device serial0_device =
 {
 	.name	= "serial0",
@@ -353,6 +245,37 @@ __weak struct serial_device *default_serial_console(void)
 	return &serial0_device;
 }
 
+#ifdef CONFIG_PSC_CONSOLE2
+int serial1_init(void)
+{
+	return serial_init_dev(PSC_BASE2);
+}
+
+void serial1_setbrg(void)
+{
+	serial_setbrg_dev(PSC_BASE2);
+}
+
+void serial1_putc(const char c)
+{
+	serial_putc_dev(PSC_BASE2, c);
+}
+
+void serial1_puts(const char *s)
+{
+	serial_puts_dev(PSC_BASE2, s);
+}
+
+int serial1_getc(void)
+{
+	return serial_getc_dev(PSC_BASE2);
+}
+
+int serial1_tstc(void)
+{
+	return serial_tstc_dev(PSC_BASE2);
+}
+
 struct serial_device serial1_device =
 {
 	.name	= "serial1",
@@ -364,6 +287,6 @@ struct serial_device serial1_device =
 	.putc	= serial1_putc,
 	.puts	= serial1_puts,
 };
-#endif /* CONFIG_SERIAL_MULTI */
+#endif /* CONFIG_PSC_CONSOLE2 */
 
 #endif /* CONFIG_PSC_CONSOLE */
diff --git a/arch/powerpc/cpu/mpc8220/uart.c b/arch/powerpc/cpu/mpc8220/uart.c
index 545c81a..25d4472 100644
--- a/arch/powerpc/cpu/mpc8220/uart.c
+++ b/arch/powerpc/cpu/mpc8220/uart.c
@@ -126,7 +126,6 @@ static void mpc8220_serial_setbrg(void)
 	psc->cr = PSC_CR_RX_ENABLE | PSC_CR_TX_ENABLE;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device mpc8220_serial_drv = {
 	.name	= "mpc8220_serial",
 	.start	= mpc8220_serial_init,
@@ -147,35 +146,4 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &mpc8220_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return mpc8220_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	mpc8220_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	mpc8220_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	mpc8220_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return mpc8220_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return mpc8220_serial_tstc();
-}
-#endif
 #endif /* CONFIG_PSC_CONSOLE */
diff --git a/arch/powerpc/cpu/mpc8260/serial_scc.c b/arch/powerpc/cpu/mpc8260/serial_scc.c
index cfbcd79..954db14 100644
--- a/arch/powerpc/cpu/mpc8260/serial_scc.c
+++ b/arch/powerpc/cpu/mpc8260/serial_scc.c
@@ -261,7 +261,6 @@ static int mpc8260_scc_serial_tstc(void)
 	return ((rbdf->cbd_sc & BD_SC_EMPTY) == 0);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device mpc8260_scc_serial_drv = {
 	.name	= "mpc8260_scc_serial",
 	.start	= mpc8260_scc_serial_init,
@@ -282,37 +281,6 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &mpc8260_scc_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return mpc8260_scc_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	mpc8260_scc_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	mpc8260_scc_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	mpc8260_scc_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return mpc8260_scc_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return mpc8260_scc_serial_tstc();
-}
-#endif
 #endif	/* CONFIG_CONS_ON_SCC */
 
 #if defined(CONFIG_KGDB_ON_SCC)
diff --git a/arch/powerpc/cpu/mpc8260/serial_smc.c b/arch/powerpc/cpu/mpc8260/serial_smc.c
index 012fc98..48f5896 100644
--- a/arch/powerpc/cpu/mpc8260/serial_smc.c
+++ b/arch/powerpc/cpu/mpc8260/serial_smc.c
@@ -264,7 +264,6 @@ static int mpc8260_smc_serial_tstc(void)
 	return !(rtx->rxbd.cbd_sc & BD_SC_EMPTY);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device mpc8260_smc_serial_drv = {
 	.name	= "mpc8260_smc_serial",
 	.start	= mpc8260_smc_serial_init,
@@ -285,37 +284,6 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &mpc8260_smc_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return mpc8260_smc_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	mpc8260_smc_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	mpc8260_smc_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	mpc8260_smc_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return mpc8260_smc_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return mpc8260_smc_serial_tstc();
-}
-#endif
 #endif	/* CONFIG_CONS_ON_SMC */
 
 #if defined(CONFIG_KGDB_ON_SMC)
diff --git a/arch/powerpc/cpu/mpc85xx/serial_scc.c b/arch/powerpc/cpu/mpc85xx/serial_scc.c
index d192642..fe9af55 100644
--- a/arch/powerpc/cpu/mpc85xx/serial_scc.c
+++ b/arch/powerpc/cpu/mpc85xx/serial_scc.c
@@ -262,7 +262,6 @@ static int mpc85xx_serial_tstc(void)
 	return ((rbdf->cbd_sc & BD_SC_EMPTY) == 0);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device mpc85xx_serial_drv = {
 	.name	= "mpc85xx_serial",
 	.start	= mpc85xx_serial_init,
@@ -283,35 +282,4 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &mpc85xx_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return mpc85xx_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	mpc85xx_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	mpc85xx_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	mpc85xx_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return mpc85xx_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return mpc85xx_serial_tstc();
-}
-#endif
 #endif	/* CONFIG_CONS_ON_SCC */
diff --git a/arch/powerpc/cpu/ppc4xx/iop480_uart.c b/arch/powerpc/cpu/ppc4xx/iop480_uart.c
index fb25e15..9473984 100644
--- a/arch/powerpc/cpu/ppc4xx/iop480_uart.c
+++ b/arch/powerpc/cpu/ppc4xx/iop480_uart.c
@@ -26,11 +26,8 @@
 #include <asm/processor.h>
 #include <asm/io.h>
 #include <watchdog.h>
-
-#ifdef CONFIG_SERIAL_MULTI
 #include <serial.h>
 #include <linux/compiler.h>
-#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -234,7 +231,6 @@ static int iop480_serial_tstc(void)
 	return 0;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device iop480_serial_drv = {
 	.name	= "iop480_serial",
 	.start	= iop480_serial_init,
@@ -255,35 +251,4 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &iop480_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return iop480_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	iop480_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	iop480_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	iop480_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return iop480_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return iop480_serial_tstc();
-}
-#endif
 #endif	/* CONFIG_IOP480 */
diff --git a/arch/sparc/cpu/leon2/serial.c b/arch/sparc/cpu/leon2/serial.c
index 61d059b..16fffb6 100644
--- a/arch/sparc/cpu/leon2/serial.c
+++ b/arch/sparc/cpu/leon2/serial.c
@@ -166,7 +166,6 @@ static void leon2_serial_setbrg(void)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device leon2_serial_drv = {
 	.name	= "leon2_serial",
 	.start	= leon2_serial_init,
@@ -187,34 +186,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &leon2_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return leon2_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	leon2_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	leon2_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	leon2_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return leon2_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return leon2_serial_tstc();
-}
-#endif
diff --git a/arch/sparc/cpu/leon3/serial.c b/arch/sparc/cpu/leon3/serial.c
index a110244..c4f3ee8 100644
--- a/arch/sparc/cpu/leon3/serial.c
+++ b/arch/sparc/cpu/leon3/serial.c
@@ -140,7 +140,6 @@ static void leon3_serial_setbrg(void)
 	return;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device leon3_serial_drv = {
 	.name	= "leon3_serial",
 	.start	= leon3_serial_init,
@@ -161,34 +160,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &leon3_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return leon3_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	leon3_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	leon3_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	leon3_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return leon3_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return leon3_serial_tstc();
-}
-#endif
diff --git a/board/Marvell/common/serial.c b/board/Marvell/common/serial.c
index a5231eb..1327c62 100644
--- a/board/Marvell/common/serial.c
+++ b/board/Marvell/common/serial.c
@@ -146,7 +146,6 @@ static void marvell_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device marvell_serial_drv = {
 	.name	= "marvell_serial",
 	.start	= marvell_serial_init,
@@ -167,37 +166,6 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &marvell_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return marvell_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	marvell_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	marvell_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	marvell_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return marvell_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return marvell_serial_tstc();
-}
-#endif
 
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
diff --git a/board/amirix/ap1000/serial.c b/board/amirix/ap1000/serial.c
index 2c2e9f9..a77d332 100644
--- a/board/amirix/ap1000/serial.c
+++ b/board/amirix/ap1000/serial.c
@@ -86,7 +86,6 @@ static void amirix_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device amirix_serial_drv = {
 	.name	= "amirix_serial",
 	.start	= amirix_serial_init,
@@ -107,37 +106,7 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &amirix_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return amirix_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	amirix_serial_setbrg();
-}
 
-void serial_putc(const char c)
-{
-	amirix_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	amirix_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return amirix_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return amirix_serial_tstc();
-}
-#endif
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
 {
diff --git a/board/bmw/serial.c b/board/bmw/serial.c
index 569131f..08f449c 100644
--- a/board/bmw/serial.c
+++ b/board/bmw/serial.c
@@ -83,7 +83,6 @@ static void bmw_serial_setbrg(void)
 	NS16550_reinit (console, clock_divisor);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device bmw_serial_drv = {
 	.name	= "bmw_serial",
 	.start	= bmw_serial_init,
@@ -104,34 +103,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &bmw_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return bmw_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	bmw_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	bmw_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	bmw_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return bmw_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return bmw_serial_tstc();
-}
-#endif
diff --git a/board/cogent/serial.c b/board/cogent/serial.c
index 18a9dbf..cd4a976 100644
--- a/board/cogent/serial.c
+++ b/board/cogent/serial.c
@@ -90,7 +90,6 @@ static int cogent_serial_tstc(void)
 	return ((cma_mb_reg_read (&mbsp->ser_lsr) & LSR_DR) != 0);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device cogent_serial_drv = {
 	.name	= "cogent_serial",
 	.start	= cogent_serial_init,
@@ -111,37 +110,6 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &cogent_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return cogent_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	cogent_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	cogent_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	cogent_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return cogent_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return cogent_serial_tstc();
-}
-#endif
 #endif /* CONS_NONE */
 
 #if defined(CONFIG_CMD_KGDB) && \
diff --git a/board/esd/cpci750/serial.c b/board/esd/cpci750/serial.c
index 9ff7c27..25f8950 100644
--- a/board/esd/cpci750/serial.c
+++ b/board/esd/cpci750/serial.c
@@ -83,7 +83,6 @@ static void cpci750_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device cpci750_serial_drv = {
 	.name	= "cpci750_serial",
 	.start	= cpci750_serial_init,
@@ -104,37 +103,7 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &cpci750_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return cpci750_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	cpci750_serial_setbrg();
-}
 
-void serial_putc(const char c)
-{
-	cpci750_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	cpci750_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return cpci750_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return cpci750_serial_tstc();
-}
-#endif
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
 {
diff --git a/board/evb64260/serial.c b/board/evb64260/serial.c
index cf46a4d..9fd4298 100644
--- a/board/evb64260/serial.c
+++ b/board/evb64260/serial.c
@@ -146,7 +146,6 @@ static void evb64260_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device evb64260_serial_drv = {
 	.name	= "evb64260_serial",
 	.start	= evb64260_serial_init,
@@ -167,37 +166,7 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &evb64260_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return evb64260_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	evb64260_serial_setbrg();
-}
 
-void serial_putc(const char c)
-{
-	evb64260_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	evb64260_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return evb64260_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return evb64260_serial_tstc();
-}
-#endif
 #if defined(CONFIG_CMD_KGDB)
 void
 kgdb_serial_init(void)
diff --git a/board/ml2/serial.c b/board/ml2/serial.c
index 0ed1150..787ff46 100644
--- a/board/ml2/serial.c
+++ b/board/ml2/serial.c
@@ -90,7 +90,6 @@ static void ml2_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device ml2_serial_drv = {
 	.name	= "ml2_serial",
 	.start	= ml2_serial_init,
@@ -111,37 +110,7 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &ml2_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return ml2_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	ml2_serial_setbrg();
-}
 
-void serial_putc(const char c)
-{
-	ml2_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	ml2_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return ml2_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return ml2_serial_tstc();
-}
-#endif
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
 {
diff --git a/board/pcippc2/sconsole.c b/board/pcippc2/sconsole.c
index 0a31963..aa3c908 100644
--- a/board/pcippc2/sconsole.c
+++ b/board/pcippc2/sconsole.c
@@ -115,7 +115,6 @@ static void sconsole_serial_setbrg(void)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device sconsole_serial_drv = {
 	.name	= "sconsole_serial",
 	.start	= sconsole_serial_init,
@@ -136,37 +135,7 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &sconsole_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return sconsole_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	sconsole_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	sconsole_serial_putc(c);
-}
 
-void serial_puts(const char *s)
-{
-	sconsole_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return sconsole_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return sconsole_serial_tstc();
-}
-#endif
 int sconsole_get_baudrate (void)
 {
 	sconsole_buffer_t *sb = SCONSOLE_BUFFER;
diff --git a/board/pdm360ng/pdm360ng.c b/board/pdm360ng/pdm360ng.c
index 2082ad4..a2a1323 100644
--- a/board/pdm360ng/pdm360ng.c
+++ b/board/pdm360ng/pdm360ng.c
@@ -172,9 +172,7 @@ phys_size_t initdram (int board_type)
 	return msize;
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 static int set_lcd_brightness(char *);
-#endif
 
 int misc_init_r(void)
 {
@@ -237,9 +235,7 @@ int misc_init_r(void)
 #endif
 
 #ifdef CONFIG_FSL_DIU_FB
-#if defined(CONFIG_SERIAL_MULTI)
 	set_lcd_brightness(0);
-#endif
 	/* Switch LCD-Backlight and LVDS-Interface on */
 	setbits_be32(&im->gpio.gpdir, 0x01040000);
 	clrsetbits_be32(&im->gpio.gpdat, 0x01000000, 0x00040000);
@@ -608,7 +604,6 @@ void ft_board_setup(void *blob, bd_t *bd)
 }
 #endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */
 
-#if defined(CONFIG_SERIAL_MULTI)
 /*
  * If argument is NULL, set the LCD brightness to the
  * value from "brightness" environment variable. Set
@@ -685,4 +680,3 @@ U_BOOT_CMD(lcdbr, 2, 1, cmd_lcd_brightness,
 	"set LCD brightness",
 	"<brightness> - set LCD backlight level to <brightness>.\n"
 );
-#endif /* CONFIG_SERIAL_MULTI */
diff --git a/board/prodrive/p3mx/serial.c b/board/prodrive/p3mx/serial.c
index d3591b4..2f4d294 100644
--- a/board/prodrive/p3mx/serial.c
+++ b/board/prodrive/p3mx/serial.c
@@ -83,7 +83,6 @@ static void p3mx_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device p3mx_serial_drv = {
 	.name	= "p3mx_serial",
 	.start	= p3mx_serial_init,
@@ -104,37 +103,6 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &p3mx_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return p3mx_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	p3mx_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	p3mx_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	p3mx_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return p3mx_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return p3mx_serial_tstc();
-}
-#endif
 
 #if defined(CONFIG_CMD_KGDB)
 void kgdb_serial_init (void)
diff --git a/board/trizepsiv/conxs.c b/board/trizepsiv/conxs.c
index 8fc3c40..871e052 100644
--- a/board/trizepsiv/conxs.c
+++ b/board/trizepsiv/conxs.c
@@ -120,7 +120,6 @@ int board_init (void)
 
 int board_late_init(void)
 {
-#if defined(CONFIG_SERIAL_MULTI)
 	char *console=getenv("boot_console");
 
 	if ((console == NULL) || (strcmp(console,"serial_btuart") &&
@@ -131,7 +130,6 @@ int board_late_init(void)
 	setenv("stdout",console);
 	setenv("stdin", console);
 	setenv("stderr",console);
-#endif
 	return 0;
 }
 
diff --git a/drivers/serial/altera_jtag_uart.c b/drivers/serial/altera_jtag_uart.c
index d3b6c1c..ec8ca29 100644
--- a/drivers/serial/altera_jtag_uart.c
+++ b/drivers/serial/altera_jtag_uart.c
@@ -83,7 +83,6 @@ static int altera_jtag_serial_getc(void)
 	return (c);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device altera_jtag_serial_drv = {
 	.name	= "altera_jtag_serial",
 	.start	= altera_jtag_serial_init,
@@ -104,34 +103,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &altera_jtag_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return altera_jtag_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	altera_jtag_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	altera_jtag_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	altera_jtag_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return altera_jtag_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return altera_jtag_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c
index 18b820b..700abd6 100644
--- a/drivers/serial/altera_uart.c
+++ b/drivers/serial/altera_uart.c
@@ -99,7 +99,6 @@ static int altera_serial_getc(void)
 	return (readl (&uart->rxdata) & 0x00ff );
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device altera_serial_drv = {
 	.name	= "altera_serial",
 	.start	= altera_serial_init,
@@ -120,34 +119,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &altera_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return altera_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	altera_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	altera_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	altera_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return altera_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return altera_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c
index d49d5d4..1303031 100644
--- a/drivers/serial/atmel_usart.c
+++ b/drivers/serial/atmel_usart.c
@@ -107,7 +107,6 @@ static int atmel_serial_tstc(void)
 	return (readl(&usart->csr) & USART3_BIT(RXRDY)) != 0;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device atmel_serial_drv = {
 	.name	= "atmel_serial",
 	.start	= atmel_serial_init,
@@ -128,34 +127,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &atmel_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return atmel_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	atmel_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	atmel_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	atmel_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return atmel_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return atmel_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/lpc32xx_hsuart.c b/drivers/serial/lpc32xx_hsuart.c
index 536fd46..02429b5 100644
--- a/drivers/serial/lpc32xx_hsuart.c
+++ b/drivers/serial/lpc32xx_hsuart.c
@@ -83,7 +83,6 @@ static void lpc32xx_serial_puts(const char *s)
 		serial_putc(*s++);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device lpc32xx_serial_drv = {
 	.name	= "lpc32xx_serial",
 	.start	= lpc32xx_serial_init,
@@ -104,34 +103,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &lpc32xx_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return lpc32xx_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	lpc32xx_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	lpc32xx_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	lpc32xx_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return lpc32xx_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return lpc32xx_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/mcfuart.c b/drivers/serial/mcfuart.c
index 7e0b765..00a7114 100644
--- a/drivers/serial/mcfuart.c
+++ b/drivers/serial/mcfuart.c
@@ -130,7 +130,6 @@ static void mcf_serial_setbrg(void)
 	uart->ucr = UART_UCR_RX_ENABLED | UART_UCR_TX_ENABLED;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device mcf_serial_drv = {
 	.name	= "mcf_serial",
 	.start	= mcf_serial_init,
@@ -151,34 +150,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &mcf_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return mcf_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	mcf_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	mcf_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	mcf_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return mcf_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return mcf_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/ns9750_serial.c b/drivers/serial/ns9750_serial.c
index 829f6d5..cb545c4 100644
--- a/drivers/serial/ns9750_serial.c
+++ b/drivers/serial/ns9750_serial.c
@@ -209,7 +209,6 @@ static unsigned int calcRxCharGapRegister( void )
 	return NS9750_SER_RX_CHAR_TIMER_TRUN;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device ns9750_serial_drv = {
 	.name	= "ns9750_serial",
 	.start	= ns9750_serial_init,
@@ -230,34 +229,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &ns9750_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return ns9750_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	ns9750_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	ns9750_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	ns9750_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return ns9750_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return ns9750_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/opencores_yanu.c b/drivers/serial/opencores_yanu.c
index a0dd301..49bccf3 100644
--- a/drivers/serial/opencores_yanu.c
+++ b/drivers/serial/opencores_yanu.c
@@ -189,7 +189,6 @@ statoc int oc_serial_getc(void)
 	return(readl(&uart->data) & YANU_DATA_CHAR_MASK);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device oc_serial_drv = {
 	.name	= "oc_serial",
 	.start	= oc_serial_init,
@@ -210,34 +209,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &oc_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return oc_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	oc_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	oc_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	oc_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return oc_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return oc_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/s3c4510b_uart.c b/drivers/serial/s3c4510b_uart.c
index 4f7f98e..423d26e 100644
--- a/drivers/serial/s3c4510b_uart.c
+++ b/drivers/serial/s3c4510b_uart.c
@@ -211,7 +211,6 @@ static void s3c4510b_serial_puts(const char *s)
 
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device s3c4510b_serial_drv = {
 	.name	= "s3c4510b_serial",
 	.start	= s3c4510b_serial_init,
@@ -232,34 +231,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &s3c4510b_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return s3c4510b_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	s3c4510b_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	s3c4510b_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	s3c4510b_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return s3c4510b_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return s3c4510b_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/s3c64xx.c b/drivers/serial/s3c64xx.c
index 823425b..9ab8a28 100644
--- a/drivers/serial/s3c64xx.c
+++ b/drivers/serial/s3c64xx.c
@@ -172,7 +172,6 @@ static void s3c64xx_serial_puts(const char *s)
 		serial_putc(*s++);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device s3c64xx_serial_drv = {
 	.name	= "s3c64xx_serial",
 	.start	= s3c64xx_serial_init,
@@ -193,34 +192,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &s3c64xx_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return s3c64xx_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	s3c64xx_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	s3c64xx_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	s3c64xx_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return s3c64xx_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return s3c64xx_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/sandbox.c b/drivers/serial/sandbox.c
index d60fbba..cb19401 100644
--- a/drivers/serial/sandbox.c
+++ b/drivers/serial/sandbox.c
@@ -64,7 +64,6 @@ static int sandbox_serial_tstc(void)
 	return 0;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device sandbox_serial_drv = {
 	.name	= "sandbox_serial",
 	.start	= sandbox_serial_init,
@@ -85,34 +84,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &sandbox_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return sandbox_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	sandbox_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	sandbox_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	sandbox_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return sandbox_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return sandbox_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_clps7111.c b/drivers/serial/serial_clps7111.c
index e1bed90..65473e8 100644
--- a/drivers/serial/serial_clps7111.c
+++ b/drivers/serial/serial_clps7111.c
@@ -119,7 +119,6 @@ static void clps7111_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device clps7111_serial_drv = {
 	.name	= "clps7111_serial",
 	.start	= clps7111_serial_init,
@@ -140,34 +139,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &clps7111_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return clps7111_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	clps7111_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	clps7111_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	clps7111_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return clps7111_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return clps7111_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_imx.c b/drivers/serial/serial_imx.c
index d37ec29..6c075b5 100644
--- a/drivers/serial/serial_imx.c
+++ b/drivers/serial/serial_imx.c
@@ -221,7 +221,6 @@ static void imx_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device imx_serial_drv = {
 	.name	= "imx_serial",
 	.start	= imx_serial_init,
@@ -242,34 +241,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &imx_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return imx_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	imx_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	imx_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	imx_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return imx_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return imx_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_ixp.c b/drivers/serial/serial_ixp.c
index 6e3f7f0..c8b3658 100644
--- a/drivers/serial/serial_ixp.c
+++ b/drivers/serial/serial_ixp.c
@@ -128,7 +128,6 @@ static void ixp_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device ixp_serial_drv = {
 	.name	= "ixp_serial",
 	.start	= ixp_serial_init,
@@ -149,34 +148,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &ixp_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return ixp_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	ixp_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	ixp_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	ixp_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return ixp_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return ixp_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_ks8695.c b/drivers/serial/serial_ks8695.c
index b3af388..60e8007 100644
--- a/drivers/serial/serial_ks8695.c
+++ b/drivers/serial/serial_ks8695.c
@@ -118,7 +118,6 @@ static int ks8695_serial_getc(void)
 	return (uartp->RX);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device ks8695_serial_drv = {
 	.name	= "ks8695_serial",
 	.start	= ks8695_serial_init,
@@ -139,34 +138,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &ks8695_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return ks8695_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	ks8695_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	ks8695_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	ks8695_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return ks8695_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return ks8695_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_lh7a40x.c b/drivers/serial/serial_lh7a40x.c
index 6b73606..6c96285 100644
--- a/drivers/serial/serial_lh7a40x.c
+++ b/drivers/serial/serial_lh7a40x.c
@@ -182,7 +182,6 @@ static void lh7a40x_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device lh7a40x_serial_drv = {
 	.name	= "lh7a40x_serial",
 	.start	= lh7a40x_serial_init,
@@ -203,34 +202,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &lh7a40x_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return lh7a40x_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	lh7a40x_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	lh7a40x_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	lh7a40x_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return lh7a40x_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return lh7a40x_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_lpc2292.c b/drivers/serial/serial_lpc2292.c
index 2601ee7..fcab202 100644
--- a/drivers/serial/serial_lpc2292.c
+++ b/drivers/serial/serial_lpc2292.c
@@ -102,7 +102,6 @@ static int lpc2292_serial_tstc(void)
 	return (GET8(U0LSR) & 1);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device lpc2292_serial_drv = {
 	.name	= "lpc2292_serial",
 	.start	= lpc2292_serial_init,
@@ -123,34 +122,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &lpc2292_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return lpc2292_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	lpc2292_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	lpc2292_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	lpc2292_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return lpc2292_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return lpc2292_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_max3100.c b/drivers/serial/serial_max3100.c
index b21fba0..3533cfc 100644
--- a/drivers/serial/serial_max3100.c
+++ b/drivers/serial/serial_max3100.c
@@ -288,7 +288,6 @@ static void max3100_serial_setbrg(void)
 {
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device max3100_serial_drv = {
 	.name	= "max3100_serial",
 	.start	= max3100_serial_init,
@@ -309,34 +308,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &max3100_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return max3100_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	max3100_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	max3100_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	max3100_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return max3100_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return max3100_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
index 0899e9b..b0612f5 100644
--- a/drivers/serial/serial_mxc.c
+++ b/drivers/serial/serial_mxc.c
@@ -32,10 +32,6 @@
 
 #define UART_PHYS	CONFIG_MXC_UART_BASE
 
-#ifdef CONFIG_SERIAL_MULTI
-#warning "MXC driver does not support MULTI serials."
-#endif
-
 /* Register definitions */
 #define URXD  0x0  /* Receiver Register */
 #define UTXD  0x40 /* Transmitter Register */
@@ -226,7 +222,6 @@ static int mxc_serial_init(void)
 	return 0;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device mxc_serial_drv = {
 	.name	= "mxc_serial",
 	.start	= mxc_serial_init,
@@ -247,34 +242,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &mxc_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return mxc_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	mxc_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	mxc_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	mxc_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return mxc_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return mxc_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_netarm.c b/drivers/serial/serial_netarm.c
index ff6612d..d30adc3 100644
--- a/drivers/serial/serial_netarm.c
+++ b/drivers/serial/serial_netarm.c
@@ -189,7 +189,6 @@ static void netarm_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device netarm_serial_drv = {
 	.name	= "netarm_serial",
 	.start	= netarm_serial_init,
@@ -210,34 +209,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &netarm_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return netarm_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	netarm_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	netarm_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	netarm_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return netarm_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return netarm_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index 00ad97c..b5d1248 100644
--- a/drivers/serial/serial_ns16550.c
+++ b/drivers/serial/serial_ns16550.c
@@ -29,20 +29,11 @@
 #include <ns87308.h>
 #endif
 
-#if defined (CONFIG_SERIAL_MULTI)
 #include <serial.h>
-#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
 #if !defined(CONFIG_CONS_INDEX)
-#if defined (CONFIG_SERIAL_MULTI)
-/*   with CONFIG_SERIAL_MULTI we might have no console
- *  on these devices
- */
-#else
-#error	"No console index specified."
-#endif /* CONFIG_SERIAL_MULTI */
 #elif (CONFIG_CONS_INDEX < 1) || (CONFIG_CONS_INDEX > 4)
 #error	"Invalid console index value."
 #endif
@@ -85,8 +76,6 @@ static NS16550_t serial_ports[4] = {
 
 #define PORT	serial_ports[port-1]
 
-#if defined(CONFIG_SERIAL_MULTI)
-
 /* Multi serial device functions */
 #define DECLARE_ESERIAL_FUNCTIONS(port) \
     int  eserial##port##_init (void) {\
@@ -117,8 +106,6 @@ static NS16550_t serial_ports[4] = {
 	.puts	= eserial##port##_puts,		\
 }
 
-#endif /* CONFIG_SERIAL_MULTI */
-
 static int calc_divisor (NS16550_t port)
 {
 #ifdef CONFIG_OMAP1510
@@ -151,36 +138,6 @@ static int calc_divisor (NS16550_t port)
 		(MODE_X_DIV * gd->baudrate);
 }
 
-#if !defined(CONFIG_SERIAL_MULTI)
-int serial_init (void)
-{
-	int clock_divisor;
-
-#ifdef CONFIG_NS87308
-	initialise_ns87308();
-#endif
-
-#ifdef CONFIG_SYS_NS16550_COM1
-	clock_divisor = calc_divisor(serial_ports[0]);
-	NS16550_init(serial_ports[0], clock_divisor);
-#endif
-#ifdef CONFIG_SYS_NS16550_COM2
-	clock_divisor = calc_divisor(serial_ports[1]);
-	NS16550_init(serial_ports[1], clock_divisor);
-#endif
-#ifdef CONFIG_SYS_NS16550_COM3
-	clock_divisor = calc_divisor(serial_ports[2]);
-	NS16550_init(serial_ports[2], clock_divisor);
-#endif
-#ifdef CONFIG_SYS_NS16550_COM4
-	clock_divisor = calc_divisor(serial_ports[3]);
-	NS16550_init(serial_ports[3], clock_divisor);
-#endif
-
-	return (0);
-}
-#endif
-
 void
 _serial_putc(const char c,const int port)
 {
@@ -226,91 +183,41 @@ _serial_setbrg (const int port)
 	NS16550_reinit(PORT, clock_divisor);
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline void
 serial_putc_dev(unsigned int dev_index,const char c)
 {
 	_serial_putc(c,dev_index);
 }
-#else
-void
-serial_putc(const char c)
-{
-	_serial_putc(c,CONFIG_CONS_INDEX);
-}
-#endif
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline void
 serial_putc_raw_dev(unsigned int dev_index,const char c)
 {
 	_serial_putc_raw(c,dev_index);
 }
-#else
-void
-serial_putc_raw(const char c)
-{
-	_serial_putc_raw(c,CONFIG_CONS_INDEX);
-}
-#endif
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline void
 serial_puts_dev(unsigned int dev_index,const char *s)
 {
 	_serial_puts(s,dev_index);
 }
-#else
-void
-serial_puts(const char *s)
-{
-	_serial_puts(s,CONFIG_CONS_INDEX);
-}
-#endif
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline int
 serial_getc_dev(unsigned int dev_index)
 {
 	return _serial_getc(dev_index);
 }
-#else
-int
-serial_getc(void)
-{
-	return _serial_getc(CONFIG_CONS_INDEX);
-}
-#endif
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline int
 serial_tstc_dev(unsigned int dev_index)
 {
 	return _serial_tstc(dev_index);
 }
-#else
-int
-serial_tstc(void)
-{
-	return _serial_tstc(CONFIG_CONS_INDEX);
-}
-#endif
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline void
 serial_setbrg_dev(unsigned int dev_index)
 {
 	_serial_setbrg(dev_index);
 }
-#else
-void
-serial_setbrg(void)
-{
-	_serial_setbrg(CONFIG_CONS_INDEX);
-}
-#endif
-
-#if defined(CONFIG_SERIAL_MULTI)
 
 DECLARE_ESERIAL_FUNCTIONS(1);
 struct serial_device eserial1_device =
@@ -355,5 +262,3 @@ void ns16550_serial_initialize(void)
 	serial_register(&eserial4_device);
 #endif
 }
-
-#endif /* CONFIG_SERIAL_MULTI */
diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c
index beb0c98..7db7b65 100644
--- a/drivers/serial/serial_pl01x.c
+++ b/drivers/serial/serial_pl01x.c
@@ -253,7 +253,6 @@ static int pl01x_tstc (int portnum)
 	return !(readl(&regs->fr) & UART_PL01x_FR_RXFE);
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device pl01x_serial_drv = {
 	.name	= "pl01x_serial",
 	.start	= pl01x_serial_init,
@@ -274,34 +273,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &pl01x_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return pl01x_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	pl01x_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	pl01x_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	pl01x_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return pl01x_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return pl01x_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_pxa.c b/drivers/serial/serial_pxa.c
index 46d7689..ad39100 100644
--- a/drivers/serial/serial_pxa.c
+++ b/drivers/serial/serial_pxa.c
@@ -73,20 +73,6 @@ DECLARE_GLOBAL_DATA_PTR;
 #define	HWUART_INDEX	0xff
 #endif
 
-#ifndef CONFIG_SERIAL_MULTI
-#if defined(CONFIG_FFUART)
-#define UART_INDEX	FFUART_INDEX
-#elif defined(CONFIG_BTUART)
-#define UART_INDEX	BTUART_INDEX
-#elif defined(CONFIG_STUART)
-#define UART_INDEX	STUART_INDEX
-#elif defined(CONFIG_HWUART)
-#define UART_INDEX	HWUART_INDEX
-#else
-#error "Please select CONFIG_(FF|BT|ST|HW)UART in board config file."
-#endif
-#endif
-
 static uint32_t pxa_uart_get_baud_divider(void)
 {
 	if (gd->baudrate == 1200)
@@ -297,9 +283,6 @@ void pxa_puts_dev(unsigned int uart_index, const char *s)
 	pxa_uart_multi(btuart, BTUART)
 #endif
 
-#ifndef	CONFIG_SERIAL_MULTI
-	pxa_uart(serial, UART)
-#else
 __weak struct serial_device *default_serial_console(void)
 {
 #if CONFIG_CONS_INDEX == 1
@@ -327,4 +310,3 @@ void pxa_serial_initialize(void)
 	serial_register(&serial_stuart_device);
 #endif
 }
-#endif
diff --git a/drivers/serial/serial_s3c24x0.c b/drivers/serial/serial_s3c24x0.c
index 625c6b7..4d214c3 100644
--- a/drivers/serial/serial_s3c24x0.c
+++ b/drivers/serial/serial_s3c24x0.c
@@ -38,8 +38,6 @@ DECLARE_GLOBAL_DATA_PTR;
 #endif
 
 #include <asm/io.h>
-
-#if defined(CONFIG_SERIAL_MULTI)
 #include <serial.h>
 
 /* Multi serial device functions */
@@ -80,8 +78,6 @@ DECLARE_GLOBAL_DATA_PTR;
 	.puts	= s3serial##port##_puts,		\
 }
 
-#endif /* CONFIG_SERIAL_MULTI */
-
 #ifdef CONFIG_HWFLOW
 static int hwflow;
 #endif
@@ -100,18 +96,10 @@ void _serial_setbrg(const int dev_index)
 		/* Delay */ ;
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline void serial_setbrg_dev(unsigned int dev_index)
 {
 	_serial_setbrg(dev_index);
 }
-#else
-void serial_setbrg(void)
-{
-	_serial_setbrg(UART_NR);
-}
-#endif
-
 
 /* Initialise the serial port. The settings are always 8 data bits, no parity,
  * 1 stop bit, no start bits.
@@ -151,16 +139,6 @@ static int serial_init_dev(const int dev_index)
 	return (0);
 }
 
-#if !defined(CONFIG_SERIAL_MULTI)
-/* Initialise the serial port. The settings are always 8 data bits, no parity,
- * 1 stop bit, no start bits.
- */
-int serial_init(void)
-{
-	return serial_init_dev(UART_NR);
-}
-#endif
-
 /*
  * Read a single byte from the serial port. Returns 1 on success, 0
  * otherwise. When the function is succesfull, the character read is
@@ -176,17 +154,10 @@ int _serial_getc(const int dev_index)
 	return readb(&uart->urxh) & 0xff;
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline int serial_getc_dev(unsigned int dev_index)
 {
 	return _serial_getc(dev_index);
 }
-#else
-int serial_getc(void)
-{
-	return _serial_getc(UART_NR);
-}
-#endif
 
 #ifdef CONFIG_HWFLOW
 int hwflow_onoff(int on)
@@ -246,18 +217,10 @@ void _serial_putc(const char c, const int dev_index)
 		serial_putc('\r');
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline void serial_putc_dev(unsigned int dev_index, const char c)
 {
 	_serial_putc(c, dev_index);
 }
-#else
-void serial_putc(const char c)
-{
-	_serial_putc(c, UART_NR);
-}
-#endif
-
 
 /*
  * Test whether a character is in the RX buffer
@@ -269,17 +232,10 @@ int _serial_tstc(const int dev_index)
 	return readl(&uart->utrstat) & 0x1;
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline int serial_tstc_dev(unsigned int dev_index)
 {
 	return _serial_tstc(dev_index);
 }
-#else
-int serial_tstc(void)
-{
-	return _serial_tstc(UART_NR);
-}
-#endif
 
 void _serial_puts(const char *s, const int dev_index)
 {
@@ -288,19 +244,11 @@ void _serial_puts(const char *s, const int dev_index)
 	}
 }
 
-#if defined(CONFIG_SERIAL_MULTI)
 static inline void serial_puts_dev(int dev_index, const char *s)
 {
 	_serial_puts(s, dev_index);
 }
-#else
-void serial_puts(const char *s)
-{
-	_serial_puts(s, UART_NR);
-}
-#endif
 
-#if defined(CONFIG_SERIAL_MULTI)
 DECLARE_S3C_SERIAL_FUNCTIONS(0);
 struct serial_device s3c24xx_serial0_device =
 INIT_S3C_SERIAL_STRUCTURE(0, "s3ser0");
@@ -330,4 +278,3 @@ void s3c24xx_serial_initialize(void)
 	serial_register(&s3c24xx_serial1_device);
 	serial_register(&s3c24xx_serial2_device);
 }
-#endif /* CONFIG_SERIAL_MULTI */
diff --git a/drivers/serial/serial_s3c44b0.c b/drivers/serial/serial_s3c44b0.c
index 8beba1a..a4428e0 100644
--- a/drivers/serial/serial_s3c44b0.c
+++ b/drivers/serial/serial_s3c44b0.c
@@ -216,7 +216,6 @@ static void s3c44b0_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device s3c44b0_serial_drv = {
 	.name	= "s3c44b0_serial",
 	.start	= s3c44b0_serial_init,
@@ -237,34 +236,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &s3c44b0_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return s3c44b0_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	s3c44b0_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	s3c44b0_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	s3c44b0_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return s3c44b0_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return s3c44b0_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_sa1100.c b/drivers/serial/serial_sa1100.c
index 86e682d..c6b34db 100644
--- a/drivers/serial/serial_sa1100.c
+++ b/drivers/serial/serial_sa1100.c
@@ -160,7 +160,6 @@ static void sa1100_serial_puts(const char *s)
 	}
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device sa1100_serial_drv = {
 	.name	= "sa1100_serial",
 	.start	= sa1100_serial_init,
@@ -181,34 +180,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &sa1100_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return sa1100_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	sa1100_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	sa1100_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	sa1100_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return sa1100_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return sa1100_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_sh.c b/drivers/serial/serial_sh.c
index 8c30397..640861a 100644
--- a/drivers/serial/serial_sh.c
+++ b/drivers/serial/serial_sh.c
@@ -188,7 +188,6 @@ static int sh_serial_getc(void)
 	return ch;
 }
 
-#ifdef CONFIG_SERIAL_MULTI
 static struct serial_device sh_serial_drv = {
 	.name	= "sh_serial",
 	.start	= sh_serial_init,
@@ -209,34 +208,3 @@ __weak struct serial_device *default_serial_console(void)
 {
 	return &sh_serial_drv;
 }
-#else
-int serial_init(void)
-{
-	return sh_serial_init();
-}
-
-void serial_setbrg(void)
-{
-	sh_serial_setbrg();
-}
-
-void serial_putc(const char c)
-{
-	sh_serial_putc(c);
-}
-
-void serial_puts(const char *s)
-{
-	sh_serial_puts(s);
-}
-
-int serial_getc(void)
-{
-	return sh_serial_getc();
-}
-
-int serial_tstc(void)
-{
-	return sh_serial_tstc();
-}
-#endif
diff --git a/drivers/serial/serial_xuartlite.c b/drivers/serial/serial_xuartlite.c
index 164497e..9cc0b7f 100644
--- a/drivers/serial/serial_xuartlite.c
+++ b/drivers/serial/serial_xuartlite.c
@@ -96,39 +96,6 @@ static int uartlite_serial_init(const int port)
 	return -1;
 }
 
-#if !defined(CONFIG_SERIAL_MULTI)
-int serial_init(void)
-{
-	return uartlite_serial_init(0);
-}
-
-void serial_setbrg(void)
-{
-	/* FIXME: what's this for? */
-}
-
-void serial_putc(const char c)
-{
-	uartlite_serial_putc(c, 0);
-}
-
-void serial_puts(const char *s)
-{
-	uartlite_serial_puts(s, 0);
-}
-
-int serial_getc(void)
-{
-	return uartlite_serial_getc(0);
-}
-
-int serial_tstc(void)
-{
-	return uartlite_serial_tstc(0);
-}
-#endif
-
-#if defined(CONFIG_SERIAL_MULTI)
 /* Multi serial device functions */
 #define DECLARE_ESERIAL_FUNCTIONS(port) \
 	int userial##port##_init(void) \
@@ -197,4 +164,3 @@ void uartlite_serial_initialize(void)
 	serial_register(&uartlite_serial3_device);
 #endif /* XILINX_UARTLITE_BASEADDR3 */
 }
-#endif /* CONFIG_SERIAL_MULTI */
-- 
1.7.10.4

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

* [U-Boot] [PATCH 70/72] serial: Remove CONFIG_SERIAL_MULTI from remaining sources
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (68 preceding siblings ...)
  2012-09-29 21:53     ` [U-Boot] [PATCH 69/72] serial: Remove CONFIG_SERIAL_MULTI from serial drivers Marek Vasut
@ 2012-09-29 21:53     ` Marek Vasut
  2012-10-01 23:34       ` [U-Boot] [PATCH 70/72 V2] " Marek Vasut
  2012-09-29 21:53     ` [U-Boot] [PATCH 71/72] serial: Compile drivers/serial/serial.c by default Marek Vasut
                       ` (3 subsequent siblings)
  73 siblings, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:53 UTC (permalink / raw)
  To: u-boot

Remove the parts depending either on disabled CONFIG_SERIAL_MULTI
or ifdefs around CONFIG_SERIAL_MULTI parts since CONFIG_SERIAL_MULTI
is now enabled by default.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/arm/lib/board.c             |    2 --
 arch/blackfin/lib/board.c        |    2 --
 arch/m68k/lib/board.c            |    2 --
 arch/microblaze/lib/board.c      |    2 --
 arch/nds32/lib/board.c           |    2 --
 arch/powerpc/lib/board.c         |    2 --
 arch/sandbox/lib/board.c         |    2 --
 arch/x86/lib/board.c             |    2 --
 common/cmd_nvedit.c              |    2 --
 common/fdt_support.c             |    4 ----
 common/iomux.c                   |    2 --
 common/stdio.c                   |    2 --
 include/common.h                 |   12 ------------
 include/serial.h                 |    2 +-
 post/board/pdm360ng/coproc_com.c |    3 ---
 15 files changed, 1 insertion(+), 42 deletions(-)

diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 109a1ac..0b47ab3 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -492,9 +492,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 #ifdef CONFIG_CLOCKS
 	set_cpu_clk_info(); /* Setup clock information */
 #endif
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 
 	debug("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
 
diff --git a/arch/blackfin/lib/board.c b/arch/blackfin/lib/board.c
index c380d27..0b31f37 100644
--- a/arch/blackfin/lib/board.c
+++ b/arch/blackfin/lib/board.c
@@ -284,9 +284,7 @@ void board_init_f(ulong bootflag)
 	init_baudrate();
 	serial_early_puts("Serial init\n");
 	serial_init();
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 	serial_early_puts("Console init flash\n");
 	console_init_f();
 	serial_early_puts("End of early debugging\n");
diff --git a/arch/m68k/lib/board.c b/arch/m68k/lib/board.c
index 2add630..67c9a13 100644
--- a/arch/m68k/lib/board.c
+++ b/arch/m68k/lib/board.c
@@ -401,9 +401,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
 	gd->flags |= GD_FLG_RELOC;	/* tell others: relocation done */
 
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 
 	debug ("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
 
diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c
index 674b573..efd63cd 100644
--- a/arch/microblaze/lib/board.c
+++ b/arch/microblaze/lib/board.c
@@ -108,9 +108,7 @@ void board_init_f(ulong not_used)
 	 */
 	mem_malloc_init (CONFIG_SYS_MALLOC_BASE, CONFIG_SYS_MALLOC_LEN);
 
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 
 	for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
 		WATCHDOG_RESET ();
diff --git a/arch/nds32/lib/board.c b/arch/nds32/lib/board.c
index 17d3ee0..89900fe 100644
--- a/arch/nds32/lib/board.c
+++ b/arch/nds32/lib/board.c
@@ -324,9 +324,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 		(ulong)(&__u_boot_cmd_end - &__u_boot_cmd_start));
 #endif /* defined(CONFIG_NEEDS_MANUAL_RELOC) */
 
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 
 	debug("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
 
diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
index 07feaf5..b860141 100644
--- a/arch/powerpc/lib/board.c
+++ b/arch/powerpc/lib/board.c
@@ -672,9 +672,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 	gd->env_addr += dest_addr - CONFIG_SYS_MONITOR_BASE;
 #endif
 
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 
 	debug("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
 
diff --git a/arch/sandbox/lib/board.c b/arch/sandbox/lib/board.c
index c173bf9..83858c1 100644
--- a/arch/sandbox/lib/board.c
+++ b/arch/sandbox/lib/board.c
@@ -220,9 +220,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 
 	gd->flags |= GD_FLG_RELOC;	/* tell others: relocation done */
 
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 
 #ifdef CONFIG_POST
 	post_output_backlog();
diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
index 90cf7fc..e5caf13 100644
--- a/arch/x86/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -150,9 +150,7 @@ init_fnc_t *init_sequence_r[] = {
 	timer_init,
 	display_banner,
 	display_dram_config,
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize_r,
-#endif
 #ifndef CONFIG_SYS_NO_FLASH
 	flash_init_r,
 #endif
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 3474bc6..1d67f20 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -237,10 +237,8 @@ int env_check_apply(const char *name, const char *oldval,
 		if (console_assign(console, newval) < 0)
 			return 1;
 
-#ifdef CONFIG_SERIAL_MULTI
 		if (serial_assign(newval) < 0)
 			return 1;
-#endif
 #endif /* CONFIG_CONSOLE_MUX */
 	}
 
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 593f16c..1b208af 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -94,7 +94,6 @@ int fdt_find_and_setprop(void *fdt, const char *node, const char *prop,
 
 #ifdef CONFIG_OF_STDOUT_VIA_ALIAS
 
-#ifdef CONFIG_SERIAL_MULTI
 static void fdt_fill_multisername(char *sername, size_t maxlen)
 {
 	const char *outname = stdio_devices[stdout]->name;
@@ -106,9 +105,6 @@ static void fdt_fill_multisername(char *sername, size_t maxlen)
 	if (strcmp(outname + 1, "serial") > 0)
 		strncpy(sername, outname + 1, maxlen);
 }
-#else
-static inline void fdt_fill_multisername(char *sername, size_t maxlen) {}
-#endif /* CONFIG_SERIAL_MULTI */
 
 static int fdt_fixup_stdout(void *fdt, int chosenoff)
 {
diff --git a/common/iomux.c b/common/iomux.c
index 91d98e9..dbc2312 100644
--- a/common/iomux.c
+++ b/common/iomux.c
@@ -135,7 +135,6 @@ int iomux_doenv(const int console, const char *arg)
 		 */
 		if (console_assign(console, start[j]) < 0)
 			continue;
-#ifdef CONFIG_SERIAL_MULTI
 		/*
 		 * This was taken from common/cmd_nvedit.c.
 		 * This will never work because serial_assign() returns
@@ -146,7 +145,6 @@ int iomux_doenv(const int console, const char *arg)
 		 */
 		if (serial_assign(start[j]) < 0)
 			continue;
-#endif
 		cons_set[cs_idx++] = dev;
 	}
 	free(console_args);
diff --git a/common/stdio.c b/common/stdio.c
index 1bf9ba0..605ff3f 100644
--- a/common/stdio.c
+++ b/common/stdio.c
@@ -227,9 +227,7 @@ int stdio_init (void)
 	drv_logbuff_init ();
 #endif
 	drv_system_init ();
-#ifdef CONFIG_SERIAL_MULTI
 	serial_stdio_init ();
-#endif
 #ifdef CONFIG_USB_TTY
 	drv_usbtty_init ();
 #endif
diff --git a/include/common.h b/include/common.h
index 55025c0..b52a8a4 100644
--- a/include/common.h
+++ b/include/common.h
@@ -194,18 +194,6 @@ typedef void (interrupt_handler_t)(void *);
 # endif
 #endif
 
-#ifndef CONFIG_SERIAL_MULTI
-
-#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2) \
- || defined(CONFIG_8xx_CONS_SCC1) || defined(CONFIG_8xx_CONS_SCC2) \
- || defined(CONFIG_8xx_CONS_SCC3) || defined(CONFIG_8xx_CONS_SCC4)
-
-#define CONFIG_SERIAL_MULTI	1
-
-#endif
-
-#endif /* CONFIG_SERIAL_MULTI */
-
 /*
  * General Purpose Utilities
  */
diff --git a/include/serial.h b/include/serial.h
index 01a86b4..a8d23f5 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -63,7 +63,7 @@ extern int usbtty_tstc(void);
 
 #endif /* CONFIG_USB_TTY */
 
-#if defined(CONFIG_MPC512X) &&  defined(CONFIG_SERIAL_MULTI)
+#if defined(CONFIG_MPC512X)
 extern struct stdio_dev *open_port(int num, int baudrate);
 extern int close_port(int num);
 extern int write_port(struct stdio_dev *port, char *buf);
diff --git a/post/board/pdm360ng/coproc_com.c b/post/board/pdm360ng/coproc_com.c
index 0755352..b7e02b5 100644
--- a/post/board/pdm360ng/coproc_com.c
+++ b/post/board/pdm360ng/coproc_com.c
@@ -28,8 +28,6 @@
 #include <post.h>
 #include <serial.h>
 
-#if defined(CONFIG_SERIAL_MULTI)
-
 /*
  * Actually the termination sequence of the coprocessor
  * commands is "\r\n" (CR LF), but here we use a side effect of
@@ -94,4 +92,3 @@ int coprocessor_post_test(int flags)
 
 	return 0;
 }
-#endif	/* CONFIG_SERIAL_MULTI */
-- 
1.7.10.4

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

* [U-Boot] [PATCH 71/72] serial: Compile drivers/serial/serial.c by default
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (69 preceding siblings ...)
  2012-09-29 21:53     ` [U-Boot] [PATCH 70/72] serial: Remove CONFIG_SERIAL_MULTI from remaining sources Marek Vasut
@ 2012-09-29 21:53     ` Marek Vasut
  2012-09-29 21:53     ` [U-Boot] [PATCH 72/72] serial: Enhance the manual relocation Marek Vasut
                       ` (2 subsequent siblings)
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:53 UTC (permalink / raw)
  To: u-boot

Compile drivers/serial/serial.c by default both into SPL and into
non-SPL builds, since CONFIG_SERIAL_MULTI is now the default state.
Also having common/serial.c in by default now, it's pointless to keep
-DCONFIG_SERIAL_MULTI in CPPFLAGS any longer, so remove it as well.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 config.mk               |    2 +-
 drivers/serial/Makefile |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/config.mk b/config.mk
index 88c72f1..c3822a2 100644
--- a/config.mk
+++ b/config.mk
@@ -193,7 +193,7 @@ OBJCFLAGS += --gap-fill=0xff
 gccincdir := $(shell $(CC) -print-file-name=include)
 
 CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS)		\
-	-D__KERNEL__ -DCONFIG_SERIAL_MULTI
+	-D__KERNEL__
 
 # Enable garbage collection of un-used sections for SPL
 ifeq ($(CONFIG_SPL_BUILD),y)
diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
index 9b54c12..0eaf227 100644
--- a/drivers/serial/Makefile
+++ b/drivers/serial/Makefile
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB	:= $(obj)libserial.o
 
-COBJS-$(CONFIG_SERIAL_MULTI) += serial.o
+COBJS-y += serial.o
 
 COBJS-$(CONFIG_ALTERA_UART) += altera_uart.o
 COBJS-$(CONFIG_ALTERA_JTAG_UART) += altera_jtag_uart.o
-- 
1.7.10.4

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

* [U-Boot] [PATCH 72/72] serial: Enhance the manual relocation
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (70 preceding siblings ...)
  2012-09-29 21:53     ` [U-Boot] [PATCH 71/72] serial: Compile drivers/serial/serial.c by default Marek Vasut
@ 2012-09-29 21:53     ` Marek Vasut
  2012-10-02 18:04     ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Tom Rini
  2012-10-04 13:27     ` Wolfgang Denk
  73 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-29 21:53 UTC (permalink / raw)
  To: u-boot

Enhance the manual relocation of drivers operations structure by
checking if the entries are NULL and increment them only if they
are not. This allows for setting any entry to NULL and it will
survive the manual relocation.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 drivers/serial/serial.c |   20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index 91c7269..9550cbd 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -96,12 +96,20 @@ serial_initfunc(sh_serial_initialize);
 void serial_register(struct serial_device *dev)
 {
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
-	dev->start += gd->reloc_off;
-	dev->setbrg += gd->reloc_off;
-	dev->getc += gd->reloc_off;
-	dev->tstc += gd->reloc_off;
-	dev->putc += gd->reloc_off;
-	dev->puts += gd->reloc_off;
+	if (dev->start)
+		dev->start += gd->reloc_off;
+	if (dev->stop)
+		dev->stop += gd->reloc_off;
+	if (dev->setbrg)
+		dev->setbrg += gd->reloc_off;
+	if (dev->getc)
+		dev->getc += gd->reloc_off;
+	if (dev->tstc)
+		dev->tstc += gd->reloc_off;
+	if (dev->putc)
+		dev->putc += gd->reloc_off;
+	if (dev->puts)
+		dev->puts += gd->reloc_off;
 #endif
 
 	dev->next = serial_devices;
-- 
1.7.10.4

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

* [U-Boot] [PATCH 65/72] serial: ns16550: Rename serial.c to serial_ns16550.c
  2012-09-29 21:52     ` [U-Boot] [PATCH 65/72] serial: ns16550: Rename serial.c to serial_ns16550.c Marek Vasut
@ 2012-09-30  8:52       ` Michal Simek
  2012-09-30 13:22         ` Marek Vasut
  2012-10-01 16:49         ` Marek Vasut
  2012-10-01 16:52       ` Tom Rini
  1 sibling, 2 replies; 306+ messages in thread
From: Michal Simek @ 2012-09-30  8:52 UTC (permalink / raw)
  To: u-boot

On 09/29/2012 11:52 PM, Marek Vasut wrote:
> This serial driver had wrong name of the source file for some time
> now. The name of the driver was serial.c instead of any more logical
> and fitting name. Thus, rename the driver source file to serial_ns16550.c
> and be done with it.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Tom Rini <trini@ti.com>
> Cc: Anatolij Gustschin <agust@denx.de>
> Cc: Stefan Roese <sr@denx.de>
> Cc: Mike Frysinger <vapier@gentoo.org>
> Cc: Michal Simek <monstr@monstr.eu>
> ---
>   drivers/serial/Makefile         |    2 +-
>   drivers/serial/serial.c         |  359 ---------------------------------------
>   drivers/serial/serial_ns16550.c |  359 +++++++++++++++++++++++++++++++++++++++
>   3 files changed, 360 insertions(+), 360 deletions(-)
>   delete mode 100644 drivers/serial/serial.c
>   create mode 100644 drivers/serial/serial_ns16550.c
>
> diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
> index 65d0f23..d93e81b 100644
> --- a/drivers/serial/Makefile
> +++ b/drivers/serial/Makefile
> @@ -37,7 +37,7 @@ COBJS-$(CONFIG_SYS_NS16550) += ns16550.o
>   COBJS-$(CONFIG_DRIVER_S3C4510_UART) += s3c4510b_uart.o
>   COBJS-$(CONFIG_S3C64XX) += s3c64xx.o
>   COBJS-$(CONFIG_S5P) += serial_s5p.o
> -COBJS-$(CONFIG_SYS_NS16550_SERIAL) += serial.o
> +COBJS-$(CONFIG_SYS_NS16550_SERIAL) += serial_ns16550.o
>   COBJS-$(CONFIG_CLPS7111_SERIAL) += serial_clps7111.o
>   COBJS-$(CONFIG_IMX_SERIAL) += serial_imx.o
>   COBJS-$(CONFIG_IXP_SERIAL) += serial_ixp.o
> diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
> deleted file mode 100644
> index 00ad97c..0000000
> --- a/drivers/serial/serial.c
> +++ /dev/null
> @@ -1,359 +0,0 @@
> -/*
> - * (C) Copyright 2000
> - * Rob Taylor, Flying Pig Systems. robt at flyingpig.com.
> - *
> - * See file CREDITS for list of people who contributed to this
> - * project.
> - *
> - * 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
> - */
> -
> -#include <common.h>
> -#include <linux/compiler.h>
> -
> -#include <ns16550.h>
> -#ifdef CONFIG_NS87308
> -#include <ns87308.h>
> -#endif
> -
> -#if defined (CONFIG_SERIAL_MULTI)
> -#include <serial.h>
> -#endif
> -
> -DECLARE_GLOBAL_DATA_PTR;
> -
> -#if !defined(CONFIG_CONS_INDEX)
> -#if defined (CONFIG_SERIAL_MULTI)
> -/*   with CONFIG_SERIAL_MULTI we might have no console
> - *  on these devices
> - */
> -#else
> -#error	"No console index specified."
> -#endif /* CONFIG_SERIAL_MULTI */
> -#elif (CONFIG_CONS_INDEX < 1) || (CONFIG_CONS_INDEX > 4)
> -#error	"Invalid console index value."
> -#endif
> -
> -#if CONFIG_CONS_INDEX == 1 && !defined(CONFIG_SYS_NS16550_COM1)
> -#error	"Console port 1 defined but not configured."
> -#elif CONFIG_CONS_INDEX == 2 && !defined(CONFIG_SYS_NS16550_COM2)
> -#error	"Console port 2 defined but not configured."
> -#elif CONFIG_CONS_INDEX == 3 && !defined(CONFIG_SYS_NS16550_COM3)
> -#error	"Console port 3 defined but not configured."
> -#elif CONFIG_CONS_INDEX == 4 && !defined(CONFIG_SYS_NS16550_COM4)
> -#error	"Console port 4 defined but not configured."
> -#endif
> -
> -/* Note: The port number specified in the functions is 1 based.
> - *	 the array is 0 based.
> - */
> -static NS16550_t serial_ports[4] = {
> -#ifdef CONFIG_SYS_NS16550_COM1
> -	(NS16550_t)CONFIG_SYS_NS16550_COM1,
> -#else
> -	NULL,
> -#endif
> -#ifdef CONFIG_SYS_NS16550_COM2
> -	(NS16550_t)CONFIG_SYS_NS16550_COM2,
> -#else
> -	NULL,
> -#endif
> -#ifdef CONFIG_SYS_NS16550_COM3
> -	(NS16550_t)CONFIG_SYS_NS16550_COM3,
> -#else
> -	NULL,
> -#endif
> -#ifdef CONFIG_SYS_NS16550_COM4
> -	(NS16550_t)CONFIG_SYS_NS16550_COM4
> -#else
> -	NULL
> -#endif
> -};
> -
> -#define PORT	serial_ports[port-1]
> -
> -#if defined(CONFIG_SERIAL_MULTI)
> -
> -/* Multi serial device functions */
> -#define DECLARE_ESERIAL_FUNCTIONS(port) \
> -    int  eserial##port##_init (void) {\
> -	int clock_divisor; \
> -	clock_divisor = calc_divisor(serial_ports[port-1]); \
> -	NS16550_init(serial_ports[port-1], clock_divisor); \
> -	return(0);}\
> -    void eserial##port##_setbrg (void) {\
> -	serial_setbrg_dev(port);}\
> -    int  eserial##port##_getc (void) {\
> -	return serial_getc_dev(port);}\
> -    int  eserial##port##_tstc (void) {\
> -	return serial_tstc_dev(port);}\
> -    void eserial##port##_putc (const char c) {\
> -	serial_putc_dev(port, c);}\
> -    void eserial##port##_puts (const char *s) {\
> -	serial_puts_dev(port, s);}
> -
> -/* Serial device descriptor */
> -#define INIT_ESERIAL_STRUCTURE(port, __name) {	\
> -	.name	= __name,			\
> -	.start	= eserial##port##_init,		\
> -	.stop	= NULL,				\
> -	.setbrg	= eserial##port##_setbrg,	\
> -	.getc	= eserial##port##_getc,		\
> -	.tstc	= eserial##port##_tstc,		\
> -	.putc	= eserial##port##_putc,		\
> -	.puts	= eserial##port##_puts,		\
> -}
> -
> -#endif /* CONFIG_SERIAL_MULTI */
> -
> -static int calc_divisor (NS16550_t port)
> -{
> -#ifdef CONFIG_OMAP1510
> -	/* If can't cleanly clock 115200 set div to 1 */
> -	if ((CONFIG_SYS_NS16550_CLK == 12000000) && (gd->baudrate == 115200)) {
> -		port->osc_12m_sel = OSC_12M_SEL;	/* enable 6.5 * divisor */
> -		return (1);				/* return 1 for base divisor */
> -	}
> -	port->osc_12m_sel = 0;			/* clear if previsouly set */
> -#endif
> -#ifdef CONFIG_OMAP1610
> -	/* If can't cleanly clock 115200 set div to 1 */
> -	if ((CONFIG_SYS_NS16550_CLK == 48000000) && (gd->baudrate == 115200)) {
> -		return (26);		/* return 26 for base divisor */
> -	}
> -#endif
> -
> -#ifdef CONFIG_APTIX
> -#define MODE_X_DIV 13
> -#else
> -#define MODE_X_DIV 16
> -#endif
> -
> -	/* Compute divisor value. Normally, we should simply return:
> -	 *   CONFIG_SYS_NS16550_CLK) / MODE_X_DIV / gd->baudrate
> -	 * but we need to round that value by adding 0.5.
> -	 * Rounding is especially important at high baud rates.
> -	 */
> -	return (CONFIG_SYS_NS16550_CLK + (gd->baudrate * (MODE_X_DIV / 2))) /
> -		(MODE_X_DIV * gd->baudrate);
> -}
> -
> -#if !defined(CONFIG_SERIAL_MULTI)
> -int serial_init (void)
> -{
> -	int clock_divisor;
> -
> -#ifdef CONFIG_NS87308
> -	initialise_ns87308();
> -#endif
> -
> -#ifdef CONFIG_SYS_NS16550_COM1
> -	clock_divisor = calc_divisor(serial_ports[0]);
> -	NS16550_init(serial_ports[0], clock_divisor);
> -#endif
> -#ifdef CONFIG_SYS_NS16550_COM2
> -	clock_divisor = calc_divisor(serial_ports[1]);
> -	NS16550_init(serial_ports[1], clock_divisor);
> -#endif
> -#ifdef CONFIG_SYS_NS16550_COM3
> -	clock_divisor = calc_divisor(serial_ports[2]);
> -	NS16550_init(serial_ports[2], clock_divisor);
> -#endif
> -#ifdef CONFIG_SYS_NS16550_COM4
> -	clock_divisor = calc_divisor(serial_ports[3]);
> -	NS16550_init(serial_ports[3], clock_divisor);
> -#endif
> -
> -	return (0);
> -}
> -#endif
> -
> -void
> -_serial_putc(const char c,const int port)
> -{
> -	if (c == '\n')
> -		NS16550_putc(PORT, '\r');
> -
> -	NS16550_putc(PORT, c);
> -}
> -
> -void
> -_serial_putc_raw(const char c,const int port)
> -{
> -	NS16550_putc(PORT, c);
> -}
> -
> -void
> -_serial_puts (const char *s,const int port)
> -{
> -	while (*s) {
> -		_serial_putc (*s++,port);
> -	}
> -}
> -
> -
> -int
> -_serial_getc(const int port)
> -{
> -	return NS16550_getc(PORT);
> -}
> -
> -int
> -_serial_tstc(const int port)
> -{
> -	return NS16550_tstc(PORT);
> -}
> -
> -void
> -_serial_setbrg (const int port)
> -{
> -	int clock_divisor;
> -
> -	clock_divisor = calc_divisor(PORT);
> -	NS16550_reinit(PORT, clock_divisor);
> -}
> -
> -#if defined(CONFIG_SERIAL_MULTI)
> -static inline void
> -serial_putc_dev(unsigned int dev_index,const char c)
> -{
> -	_serial_putc(c,dev_index);
> -}
> -#else
> -void
> -serial_putc(const char c)
> -{
> -	_serial_putc(c,CONFIG_CONS_INDEX);
> -}
> -#endif
> -
> -#if defined(CONFIG_SERIAL_MULTI)
> -static inline void
> -serial_putc_raw_dev(unsigned int dev_index,const char c)
> -{
> -	_serial_putc_raw(c,dev_index);
> -}
> -#else
> -void
> -serial_putc_raw(const char c)
> -{
> -	_serial_putc_raw(c,CONFIG_CONS_INDEX);
> -}
> -#endif
> -
> -#if defined(CONFIG_SERIAL_MULTI)
> -static inline void
> -serial_puts_dev(unsigned int dev_index,const char *s)
> -{
> -	_serial_puts(s,dev_index);
> -}
> -#else
> -void
> -serial_puts(const char *s)
> -{
> -	_serial_puts(s,CONFIG_CONS_INDEX);
> -}
> -#endif
> -
> -#if defined(CONFIG_SERIAL_MULTI)
> -static inline int
> -serial_getc_dev(unsigned int dev_index)
> -{
> -	return _serial_getc(dev_index);
> -}
> -#else
> -int
> -serial_getc(void)
> -{
> -	return _serial_getc(CONFIG_CONS_INDEX);
> -}
> -#endif
> -
> -#if defined(CONFIG_SERIAL_MULTI)
> -static inline int
> -serial_tstc_dev(unsigned int dev_index)
> -{
> -	return _serial_tstc(dev_index);
> -}
> -#else
> -int
> -serial_tstc(void)
> -{
> -	return _serial_tstc(CONFIG_CONS_INDEX);
> -}
> -#endif
> -
> -#if defined(CONFIG_SERIAL_MULTI)
> -static inline void
> -serial_setbrg_dev(unsigned int dev_index)
> -{
> -	_serial_setbrg(dev_index);
> -}
> -#else
> -void
> -serial_setbrg(void)
> -{
> -	_serial_setbrg(CONFIG_CONS_INDEX);
> -}
> -#endif
> -
> -#if defined(CONFIG_SERIAL_MULTI)
> -
> -DECLARE_ESERIAL_FUNCTIONS(1);
> -struct serial_device eserial1_device =
> -	INIT_ESERIAL_STRUCTURE(1, "eserial0");
> -DECLARE_ESERIAL_FUNCTIONS(2);
> -struct serial_device eserial2_device =
> -	INIT_ESERIAL_STRUCTURE(2, "eserial1");
> -DECLARE_ESERIAL_FUNCTIONS(3);
> -struct serial_device eserial3_device =
> -	INIT_ESERIAL_STRUCTURE(3, "eserial2");
> -DECLARE_ESERIAL_FUNCTIONS(4);
> -struct serial_device eserial4_device =
> -	INIT_ESERIAL_STRUCTURE(4, "eserial3");
> -
> -__weak struct serial_device *default_serial_console(void)
> -{
> -#if CONFIG_CONS_INDEX == 1
> -	return &eserial1_device;
> -#elif CONFIG_CONS_INDEX == 2
> -	return &eserial2_device;
> -#elif CONFIG_CONS_INDEX == 3
> -	return &eserial3_device;
> -#elif CONFIG_CONS_INDEX == 4
> -	return &eserial4_device;
> -#else
> -#error "Bad CONFIG_CONS_INDEX."
> -#endif
> -}
> -
> -void ns16550_serial_initialize(void)
> -{
> -#if defined(CONFIG_SYS_NS16550_COM1)
> -	serial_register(&eserial1_device);
> -#endif
> -#if defined(CONFIG_SYS_NS16550_COM2)
> -	serial_register(&eserial2_device);
> -#endif
> -#if defined(CONFIG_SYS_NS16550_COM3)
> -	serial_register(&eserial3_device);
> -#endif
> -#if defined(CONFIG_SYS_NS16550_COM4)
> -	serial_register(&eserial4_device);
> -#endif
> -}
> -
> -#endif /* CONFIG_SERIAL_MULTI */
> diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
> new file mode 100644
> index 0000000..00ad97c
> --- /dev/null
> +++ b/drivers/serial/serial_ns16550.c
> @@ -0,0 +1,359 @@
> +/*
> + * (C) Copyright 2000
> + * Rob Taylor, Flying Pig Systems. robt at flyingpig.com.
> + *
> + * See file CREDITS for list of people who contributed to this
> + * project.
> + *
> + * 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
> + */
> +
> +#include <common.h>
> +#include <linux/compiler.h>
> +
> +#include <ns16550.h>
> +#ifdef CONFIG_NS87308
> +#include <ns87308.h>
> +#endif
> +
> +#if defined (CONFIG_SERIAL_MULTI)
> +#include <serial.h>
> +#endif
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +#if !defined(CONFIG_CONS_INDEX)
> +#if defined (CONFIG_SERIAL_MULTI)
> +/*   with CONFIG_SERIAL_MULTI we might have no console
> + *  on these devices
> + */
> +#else
> +#error	"No console index specified."
> +#endif /* CONFIG_SERIAL_MULTI */
> +#elif (CONFIG_CONS_INDEX < 1) || (CONFIG_CONS_INDEX > 4)
> +#error	"Invalid console index value."
> +#endif
> +
> +#if CONFIG_CONS_INDEX == 1 && !defined(CONFIG_SYS_NS16550_COM1)
> +#error	"Console port 1 defined but not configured."
> +#elif CONFIG_CONS_INDEX == 2 && !defined(CONFIG_SYS_NS16550_COM2)
> +#error	"Console port 2 defined but not configured."
> +#elif CONFIG_CONS_INDEX == 3 && !defined(CONFIG_SYS_NS16550_COM3)
> +#error	"Console port 3 defined but not configured."
> +#elif CONFIG_CONS_INDEX == 4 && !defined(CONFIG_SYS_NS16550_COM4)
> +#error	"Console port 4 defined but not configured."
> +#endif
> +
> +/* Note: The port number specified in the functions is 1 based.
> + *	 the array is 0 based.
> + */
> +static NS16550_t serial_ports[4] = {
> +#ifdef CONFIG_SYS_NS16550_COM1
> +	(NS16550_t)CONFIG_SYS_NS16550_COM1,
> +#else
> +	NULL,
> +#endif
> +#ifdef CONFIG_SYS_NS16550_COM2
> +	(NS16550_t)CONFIG_SYS_NS16550_COM2,
> +#else
> +	NULL,
> +#endif
> +#ifdef CONFIG_SYS_NS16550_COM3
> +	(NS16550_t)CONFIG_SYS_NS16550_COM3,
> +#else
> +	NULL,
> +#endif
> +#ifdef CONFIG_SYS_NS16550_COM4
> +	(NS16550_t)CONFIG_SYS_NS16550_COM4
> +#else
> +	NULL
> +#endif
> +};

Would it be better just use this structure?

#ifdef CONFIG_SYS_NS16550_COM1
        [0] = (NS16550_t)CONFIG_SYS_NS16550_COM1,
#endif



> +
> +#define PORT	serial_ports[port-1]
> +
> +#if defined(CONFIG_SERIAL_MULTI)
> +
> +/* Multi serial device functions */
> +#define DECLARE_ESERIAL_FUNCTIONS(port) \
> +    int  eserial##port##_init (void) {\
> +	int clock_divisor; \
> +	clock_divisor = calc_divisor(serial_ports[port-1]); \
> +	NS16550_init(serial_ports[port-1], clock_divisor); \
> +	return(0);}\
> +    void eserial##port##_setbrg (void) {\
> +	serial_setbrg_dev(port);}\
> +    int  eserial##port##_getc (void) {\
> +	return serial_getc_dev(port);}\
> +    int  eserial##port##_tstc (void) {\
> +	return serial_tstc_dev(port);}\
> +    void eserial##port##_putc (const char c) {\
> +	serial_putc_dev(port, c);}\
> +    void eserial##port##_puts (const char *s) {\
> +	serial_puts_dev(port, s);}
> +
> +/* Serial device descriptor */
> +#define INIT_ESERIAL_STRUCTURE(port, __name) {	\
> +	.name	= __name,			\
> +	.start	= eserial##port##_init,		\
> +	.stop	= NULL,				\
> +	.setbrg	= eserial##port##_setbrg,	\
> +	.getc	= eserial##port##_getc,		\
> +	.tstc	= eserial##port##_tstc,		\
> +	.putc	= eserial##port##_putc,		\
> +	.puts	= eserial##port##_puts,		\
> +}
> +
> +#endif /* CONFIG_SERIAL_MULTI */
> +
> +static int calc_divisor (NS16550_t port)
> +{
> +#ifdef CONFIG_OMAP1510
> +	/* If can't cleanly clock 115200 set div to 1 */
> +	if ((CONFIG_SYS_NS16550_CLK == 12000000) && (gd->baudrate == 115200)) {
> +		port->osc_12m_sel = OSC_12M_SEL;	/* enable 6.5 * divisor */
> +		return (1);				/* return 1 for base divisor */
> +	}
> +	port->osc_12m_sel = 0;			/* clear if previsouly set */
> +#endif
> +#ifdef CONFIG_OMAP1610
> +	/* If can't cleanly clock 115200 set div to 1 */
> +	if ((CONFIG_SYS_NS16550_CLK == 48000000) && (gd->baudrate == 115200)) {
> +		return (26);		/* return 26 for base divisor */
> +	}
> +#endif
> +
> +#ifdef CONFIG_APTIX
> +#define MODE_X_DIV 13
> +#else
> +#define MODE_X_DIV 16
> +#endif
> +
> +	/* Compute divisor value. Normally, we should simply return:
> +	 *   CONFIG_SYS_NS16550_CLK) / MODE_X_DIV / gd->baudrate
> +	 * but we need to round that value by adding 0.5.
> +	 * Rounding is especially important at high baud rates.
> +	 */
> +	return (CONFIG_SYS_NS16550_CLK + (gd->baudrate * (MODE_X_DIV / 2))) /
> +		(MODE_X_DIV * gd->baudrate);
> +}
> +
> +#if !defined(CONFIG_SERIAL_MULTI)
> +int serial_init (void)
> +{
> +	int clock_divisor;
> +
> +#ifdef CONFIG_NS87308
> +	initialise_ns87308();
> +#endif
> +
> +#ifdef CONFIG_SYS_NS16550_COM1
> +	clock_divisor = calc_divisor(serial_ports[0]);
> +	NS16550_init(serial_ports[0], clock_divisor);
> +#endif
> +#ifdef CONFIG_SYS_NS16550_COM2
> +	clock_divisor = calc_divisor(serial_ports[1]);
> +	NS16550_init(serial_ports[1], clock_divisor);
> +#endif
> +#ifdef CONFIG_SYS_NS16550_COM3
> +	clock_divisor = calc_divisor(serial_ports[2]);
> +	NS16550_init(serial_ports[2], clock_divisor);
> +#endif
> +#ifdef CONFIG_SYS_NS16550_COM4
> +	clock_divisor = calc_divisor(serial_ports[3]);
> +	NS16550_init(serial_ports[3], clock_divisor);
> +#endif
> +
> +	return (0);
> +}
> +#endif
> +
> +void
> +_serial_putc(const char c,const int port)

You are using two coding styles in this file.
One has function return value on one line and then function name
and the second function return value on one line with function name.
Will be good to unify it to look the same in the whole file.


Thanks,
Michal


-- 
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian

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

* [U-Boot] [PATCH 65/72] serial: ns16550: Rename serial.c to serial_ns16550.c
  2012-09-30  8:52       ` Michal Simek
@ 2012-09-30 13:22         ` Marek Vasut
  2012-10-01 16:49         ` Marek Vasut
  1 sibling, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-09-30 13:22 UTC (permalink / raw)
  To: u-boot

Dear Michal Simek,

[...]

> You are using two coding styles in this file.

Won't surprise me if there were even more.

> One has function return value on one line and then function name
> and the second function return value on one line with function name.
> Will be good to unify it to look the same in the whole file.

Yes, but definitelly not as a part of unintrusive conversion patch. This file 
has so much legacy and look so crappy it needs proper fixing. Patch is welcome 
%^)

> Thanks,
> Michal

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 40/71] serial: arm: Implement CONFIG_SERIAL_MULTI into altera serial driver
  2012-09-16 23:21 ` [U-Boot] [PATCH 40/71] serial: arm: Implement CONFIG_SERIAL_MULTI into altera " Marek Vasut
@ 2012-10-01 12:31   ` Thomas Chou
  2012-10-01 14:46     ` Marek Vasut
  2012-10-01 14:46   ` [U-Boot] [PATCH 40/72 V2] " Marek Vasut
  1 sibling, 1 reply; 306+ messages in thread
From: Thomas Chou @ 2012-10-01 12:31 UTC (permalink / raw)
  To: u-boot

On 09/17/2012 07:21 AM, Marek Vasut wrote:
> Implement support for CONFIG_SERIAL_MULTI into altera serial driver.
> This driver was so far only usable directly, but this patch also adds
> support for the multi method. This allows using more than one serial
> driver alongside the altera driver. Also, add a weak implementation
> of default_serial_console() returning this driver.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Tom Rini <trini@ti.com>
> Cc: Scott McNutt <smcnutt@psyent.com>
> ---
>   common/serial.c              |    2 +
>   drivers/serial/altera_uart.c |   83 ++++++++++++++++++++++++++++++++++++------
>   2 files changed, 73 insertions(+), 12 deletions(-)

Dear Marek,

Please include the following headers.

--- a/drivers/serial/altera_uart.c
+++ b/drivers/serial/altera_uart.c
@@ -26,6 +26,8 @@
  #include <watchdog.h>
  #include <asm/io.h>
  #include <nios2-io.h>
+#include <linux/compiler.h>
+#include <serial.h>

  DECLARE_GLOBAL_DATA_PTR;


Otherwise,
Acked-by: Thomas Chou <thomas@wytron.com.tw>

Best regards,
Thomas Chou




>
> diff --git a/common/serial.c b/common/serial.c
> index 24879ec..e6566da 100644
> --- a/common/serial.c
> +++ b/common/serial.c
> @@ -70,6 +70,7 @@ serial_initfunc(ml2_serial_initialize);
>   serial_initfunc(sconsole_serial_initialize);
>   serial_initfunc(p3mx_serial_initialize);
>   serial_initfunc(altera_jtag_serial_initialize);
> +serial_initfunc(altera_serial_initialize);
>
>   void serial_register(struct serial_device *dev)
>   {
> @@ -118,6 +119,7 @@ void serial_initialize(void)
>   	sconsole_serial_initialize();
>   	p3mx_serial_initialize();
>   	altera_jtag_serial_initialize();
> +	altera_serial_initialize();
>
>   	serial_assign(default_serial_console()->name);
>   }
> diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c
> index 045f119..18b820b 100644
> --- a/drivers/serial/altera_uart.c
> +++ b/drivers/serial/altera_uart.c
> @@ -37,27 +37,33 @@ static nios_uart_t *uart = (nios_uart_t *) CONFIG_SYS_NIOS_CONSOLE;
>
>   #if defined(CONFIG_SYS_NIOS_FIXEDBAUD)
>
> -/* Everything's already setup for fixed-baud PTF
> +/*
> + * Everything's already setup for fixed-baud PTF
>    * assignment
>    */
> -void serial_setbrg (void){ return; }
> -int serial_init (void) { return (0);}
> +static void altera_serial_setbrg(void)
> +{
> +}
> +
> +static int altera_serial_init(void)
> +{
> +	return 0;
> +}
>
>   #else
>
> -void serial_setbrg (void)
> +static void altera_serial_setbrg(void)
>   {
>   	unsigned div;
>
>   	div = (CONFIG_SYS_CLK_FREQ/gd->baudrate)-1;
>   	writel (div, &uart->divisor);
> -	return;
>   }
>
> -int serial_init (void)
> +static int altera_serial_init(void)
>   {
> -	serial_setbrg ();
> -	return (0);
> +	serial_setbrg();
> +	return 0;
>   }
>
>   #endif /* CONFIG_SYS_NIOS_FIXEDBAUD */
> @@ -65,7 +71,7 @@ int serial_init (void)
>   /*-----------------------------------------------------------------------
>    * UART CONSOLE
>    *---------------------------------------------------------------------*/
> -void serial_putc (char c)
> +static void altera_serial_putc(char c)
>   {
>   	if (c == '\n')
>   		serial_putc ('\r');
> @@ -74,21 +80,74 @@ void serial_putc (char c)
>   	writel ((unsigned char)c, &uart->txdata);
>   }
>
> -void serial_puts (const char *s)
> +static void altera_serial_puts(const char *s)
>   {
>   	while (*s != 0) {
>   		serial_putc (*s++);
>   	}
>   }
>
> -int serial_tstc (void)
> +static int altera_serial_tstc(void)
>   {
>   	return (readl (&uart->status) & NIOS_UART_RRDY);
>   }
>
> -int serial_getc (void)
> +static int altera_serial_getc(void)
>   {
>   	while (serial_tstc () == 0)
>   		WATCHDOG_RESET ();
>   	return (readl (&uart->rxdata) & 0x00ff );
>   }
> +
> +#ifdef CONFIG_SERIAL_MULTI
> +static struct serial_device altera_serial_drv = {
> +	.name	= "altera_serial",
> +	.start	= altera_serial_init,
> +	.stop	= NULL,
> +	.setbrg	= altera_serial_setbrg,
> +	.putc	= altera_serial_putc,
> +	.puts	= altera_serial_puts,
> +	.getc	= altera_serial_getc,
> +	.tstc	= altera_serial_tstc,
> +};
> +
> +void altera_serial_initialize(void)
> +{
> +	serial_register(&altera_serial_drv);
> +}
> +
> +__weak struct serial_device *default_serial_console(void)
> +{
> +	return &altera_serial_drv;
> +}
> +#else
> +int serial_init(void)
> +{
> +	return altera_serial_init();
> +}
> +
> +void serial_setbrg(void)
> +{
> +	altera_serial_setbrg();
> +}
> +
> +void serial_putc(const char c)
> +{
> +	altera_serial_putc(c);
> +}
> +
> +void serial_puts(const char *s)
> +{
> +	altera_serial_puts(s);
> +}
> +
> +int serial_getc(void)
> +{
> +	return altera_serial_getc();
> +}
> +
> +int serial_tstc(void)
> +{
> +	return altera_serial_tstc();
> +}
> +#endif
>

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

* [U-Boot] [PATCH 39/71] serial: arm: Implement CONFIG_SERIAL_MULTI into altera_jtag serial driver
  2012-09-16 23:21 ` [U-Boot] [PATCH 39/71] serial: arm: Implement CONFIG_SERIAL_MULTI into altera_jtag " Marek Vasut
@ 2012-10-01 12:33   ` Thomas Chou
  2012-10-01 14:41     ` Marek Vasut
  2012-10-01 14:45   ` [U-Boot] [PATCH 39/72 V2] " Marek Vasut
  1 sibling, 1 reply; 306+ messages in thread
From: Thomas Chou @ 2012-10-01 12:33 UTC (permalink / raw)
  To: u-boot

On 09/17/2012 07:21 AM, Marek Vasut wrote:
> Implement support for CONFIG_SERIAL_MULTI into altera_jtag serial driver.
> This driver was so far only usable directly, but this patch also adds
> support for the multi method. This allows using more than one serial
> driver alongside the altera_jtag driver. Also, add a weak implementation
> of default_serial_console() returning this driver.
>
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Tom Rini <trini@ti.com>
> Cc: Thomas Chou <thomas@wytron.com.tw>
> ---
>   common/serial.c                   |    2 ++
>   drivers/serial/altera_jtag_uart.c |   71 +++++++++++++++++++++++++++++++++----
>   2 files changed, 67 insertions(+), 6 deletions(-)


Dear Marek,

Please include the following headers.

--- a/drivers/serial/altera_jtag_uart.c
+++ b/drivers/serial/altera_jtag_uart.c
@@ -25,6 +25,8 @@
  #include <watchdog.h>
  #include <asm/io.h>
  #include <nios2-io.h>
+#include <linux/compiler.h>
+#include <serial.h>

  DECLARE_GLOBAL_DATA_PTR;

And the .name string is too long. >16

static struct serial_device altera_jtag_serial_drv = {
	.name	= "altera_jtag_serial",

Otherwise,
Acked-by: Thomas Chou <thomas@wytron.com.tw>

Best regards,
Thomas Chou




>
> diff --git a/common/serial.c b/common/serial.c
> index 2d6ba05..24879ec 100644
> --- a/common/serial.c
> +++ b/common/serial.c
> @@ -69,6 +69,7 @@ serial_initfunc(evb64260_serial_initialize);
>   serial_initfunc(ml2_serial_initialize);
>   serial_initfunc(sconsole_serial_initialize);
>   serial_initfunc(p3mx_serial_initialize);
> +serial_initfunc(altera_jtag_serial_initialize);
>
>   void serial_register(struct serial_device *dev)
>   {
> @@ -116,6 +117,7 @@ void serial_initialize(void)
>   	ml2_serial_initialize();
>   	sconsole_serial_initialize();
>   	p3mx_serial_initialize();
> +	altera_jtag_serial_initialize();
>
>   	serial_assign(default_serial_console()->name);
>   }
> diff --git a/drivers/serial/altera_jtag_uart.c b/drivers/serial/altera_jtag_uart.c
> index 2980e4d..d3b6c1c 100644
> --- a/drivers/serial/altera_jtag_uart.c
> +++ b/drivers/serial/altera_jtag_uart.c
> @@ -33,10 +33,16 @@ DECLARE_GLOBAL_DATA_PTR;
>    *-----------------------------------------------------------------*/
>   static nios_jtag_t *jtag = (nios_jtag_t *)CONFIG_SYS_NIOS_CONSOLE;
>
> -void serial_setbrg( void ){ return; }
> -int serial_init( void ) { return(0);}
> +static void altera_jtag_serial_setbrg(void)
> +{
> +}
> +
> +static int altera_jtag_serial_init(void)
> +{
> +	return 0;
> +}
>
> -void serial_putc (char c)
> +static void altera_jtag_serial_putc(char c)
>   {
>   	while (1) {
>   		unsigned st = readl(&jtag->control);
> @@ -51,18 +57,18 @@ void serial_putc (char c)
>   	writel ((unsigned char)c, &jtag->data);
>   }
>
> -void serial_puts (const char *s)
> +static void altera_jtag_serial_puts(const char *s)
>   {
>   	while (*s != 0)
>   		serial_putc (*s++);
>   }
>
> -int serial_tstc (void)
> +static int altera_jtag_serial_tstc(void)
>   {
>   	return ( readl (&jtag->control) & NIOS_JTAG_RRDY);
>   }
>
> -int serial_getc (void)
> +static int altera_jtag_serial_getc(void)
>   {
>   	int c;
>   	unsigned val;
> @@ -76,3 +82,56 @@ int serial_getc (void)
>   	c = val & 0x0ff;
>   	return (c);
>   }
> +
> +#ifdef CONFIG_SERIAL_MULTI
> +static struct serial_device altera_jtag_serial_drv = {
> +	.name	= "altera_jtag_serial",
> +	.start	= altera_jtag_serial_init,
> +	.stop	= NULL,
> +	.setbrg	= altera_jtag_serial_setbrg,
> +	.putc	= altera_jtag_serial_putc,
> +	.puts	= altera_jtag_serial_puts,
> +	.getc	= altera_jtag_serial_getc,
> +	.tstc	= altera_jtag_serial_tstc,
> +};
> +
> +void altera_jtag_serial_initialize(void)
> +{
> +	serial_register(&altera_jtag_serial_drv);
> +}
> +
> +__weak struct serial_device *default_serial_console(void)
> +{
> +	return &altera_jtag_serial_drv;
> +}
> +#else
> +int serial_init(void)
> +{
> +	return altera_jtag_serial_init();
> +}
> +
> +void serial_setbrg(void)
> +{
> +	altera_jtag_serial_setbrg();
> +}
> +
> +void serial_putc(const char c)
> +{
> +	altera_jtag_serial_putc(c);
> +}
> +
> +void serial_puts(const char *s)
> +{
> +	altera_jtag_serial_puts(s);
> +}
> +
> +int serial_getc(void)
> +{
> +	return altera_jtag_serial_getc();
> +}
> +
> +int serial_tstc(void)
> +{
> +	return altera_jtag_serial_tstc();
> +}
> +#endif
>

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

* [U-Boot] [PATCH 39/71] serial: arm: Implement CONFIG_SERIAL_MULTI into altera_jtag serial driver
  2012-10-01 12:33   ` Thomas Chou
@ 2012-10-01 14:41     ` Marek Vasut
  2012-10-02  7:55       ` Thomas Chou
  0 siblings, 1 reply; 306+ messages in thread
From: Marek Vasut @ 2012-10-01 14:41 UTC (permalink / raw)
  To: u-boot

Dear Thomas Chou,

> On 09/17/2012 07:21 AM, Marek Vasut wrote:
> > Implement support for CONFIG_SERIAL_MULTI into altera_jtag serial driver.
> > This driver was so far only usable directly, but this patch also adds
> > support for the multi method. This allows using more than one serial
> > driver alongside the altera_jtag driver. Also, add a weak implementation
> > of default_serial_console() returning this driver.
> > 
> > Signed-off-by: Marek Vasut <marex@denx.de>
> > Cc: Marek Vasut <marek.vasut@gmail.com>
> > Cc: Tom Rini <trini@ti.com>
> > Cc: Thomas Chou <thomas@wytron.com.tw>
> > ---
> > 
> >   common/serial.c                   |    2 ++
> >   drivers/serial/altera_jtag_uart.c |   71
> >   +++++++++++++++++++++++++++++++++---- 2 files changed, 67
> >   insertions(+), 6 deletions(-)
> 
> Dear Marek,
> 
> Please include the following headers.
> 
> --- a/drivers/serial/altera_jtag_uart.c
> +++ b/drivers/serial/altera_jtag_uart.c
> @@ -25,6 +25,8 @@
>   #include <watchdog.h>
>   #include <asm/io.h>
>   #include <nios2-io.h>
> +#include <linux/compiler.h>
> +#include <serial.h>


Are you seeing any issues without them?

>   DECLARE_GLOBAL_DATA_PTR;
> 
> And the .name string is too long. >16
> 
> static struct serial_device altera_jtag_serial_drv = {
> 	.name	= "altera_jtag_serial",
> 
> Otherwise,
> Acked-by: Thomas Chou <thomas@wytron.com.tw>
> 
> Best regards,
> Thomas Chou
[...]

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

* [U-Boot] [PATCH 39/72 V2] serial: arm: Implement CONFIG_SERIAL_MULTI into altera_jtag serial driver
  2012-09-16 23:21 ` [U-Boot] [PATCH 39/71] serial: arm: Implement CONFIG_SERIAL_MULTI into altera_jtag " Marek Vasut
  2012-10-01 12:33   ` Thomas Chou
@ 2012-10-01 14:45   ` Marek Vasut
  1 sibling, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-10-01 14:45 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into altera_jtag serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the altera_jtag driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Thomas Chou <thomas@wytron.com.tw>
---
 common/serial.c                   |    2 +
 drivers/serial/altera_jtag_uart.c |   73 ++++++++++++++++++++++++++++++++++---
 2 files changed, 69 insertions(+), 6 deletions(-)

V2: Add includes (serial.h and linux/compiler.h)
    Fix name too long error

diff --git a/common/serial.c b/common/serial.c
index 2d6ba05..24879ec 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -69,6 +69,7 @@ serial_initfunc(evb64260_serial_initialize);
 serial_initfunc(ml2_serial_initialize);
 serial_initfunc(sconsole_serial_initialize);
 serial_initfunc(p3mx_serial_initialize);
+serial_initfunc(altera_jtag_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -116,6 +117,7 @@ void serial_initialize(void)
 	ml2_serial_initialize();
 	sconsole_serial_initialize();
 	p3mx_serial_initialize();
+	altera_jtag_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/altera_jtag_uart.c b/drivers/serial/altera_jtag_uart.c
index 2980e4d..8cb4606 100644
--- a/drivers/serial/altera_jtag_uart.c
+++ b/drivers/serial/altera_jtag_uart.c
@@ -25,6 +25,8 @@
 #include <watchdog.h>
 #include <asm/io.h>
 #include <nios2-io.h>
+#include <linux/compiler.h>
+#include <serial.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -33,10 +35,16 @@ DECLARE_GLOBAL_DATA_PTR;
  *-----------------------------------------------------------------*/
 static nios_jtag_t *jtag = (nios_jtag_t *)CONFIG_SYS_NIOS_CONSOLE;
 
-void serial_setbrg( void ){ return; }
-int serial_init( void ) { return(0);}
+static void altera_jtag_serial_setbrg(void)
+{
+}
+
+static int altera_jtag_serial_init(void)
+{
+	return 0;
+}
 
-void serial_putc (char c)
+static void altera_jtag_serial_putc(char c)
 {
 	while (1) {
 		unsigned st = readl(&jtag->control);
@@ -51,18 +59,18 @@ void serial_putc (char c)
 	writel ((unsigned char)c, &jtag->data);
 }
 
-void serial_puts (const char *s)
+static void altera_jtag_serial_puts(const char *s)
 {
 	while (*s != 0)
 		serial_putc (*s++);
 }
 
-int serial_tstc (void)
+static int altera_jtag_serial_tstc(void)
 {
 	return ( readl (&jtag->control) & NIOS_JTAG_RRDY);
 }
 
-int serial_getc (void)
+static int altera_jtag_serial_getc(void)
 {
 	int c;
 	unsigned val;
@@ -76,3 +84,56 @@ int serial_getc (void)
 	c = val & 0x0ff;
 	return (c);
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device altera_jtag_serial_drv = {
+	.name	= "altera_jtag_uart",
+	.start	= altera_jtag_serial_init,
+	.stop	= NULL,
+	.setbrg	= altera_jtag_serial_setbrg,
+	.putc	= altera_jtag_serial_putc,
+	.puts	= altera_jtag_serial_puts,
+	.getc	= altera_jtag_serial_getc,
+	.tstc	= altera_jtag_serial_tstc,
+};
+
+void altera_jtag_serial_initialize(void)
+{
+	serial_register(&altera_jtag_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &altera_jtag_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return altera_jtag_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	altera_jtag_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	altera_jtag_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	altera_jtag_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return altera_jtag_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return altera_jtag_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 40/72 V2] serial: arm: Implement CONFIG_SERIAL_MULTI into altera serial driver
  2012-09-16 23:21 ` [U-Boot] [PATCH 40/71] serial: arm: Implement CONFIG_SERIAL_MULTI into altera " Marek Vasut
  2012-10-01 12:31   ` Thomas Chou
@ 2012-10-01 14:46   ` Marek Vasut
  1 sibling, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-10-01 14:46 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into altera serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the altera driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Scott McNutt <smcnutt@psyent.com>
---
 common/serial.c              |    2 +
 drivers/serial/altera_uart.c |   85 ++++++++++++++++++++++++++++++++++++------
 2 files changed, 75 insertions(+), 12 deletions(-)

V2: Add includes (serial.h and linux/compiler.h)

diff --git a/common/serial.c b/common/serial.c
index 24879ec..e6566da 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -70,6 +70,7 @@ serial_initfunc(ml2_serial_initialize);
 serial_initfunc(sconsole_serial_initialize);
 serial_initfunc(p3mx_serial_initialize);
 serial_initfunc(altera_jtag_serial_initialize);
+serial_initfunc(altera_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -118,6 +119,7 @@ void serial_initialize(void)
 	sconsole_serial_initialize();
 	p3mx_serial_initialize();
 	altera_jtag_serial_initialize();
+	altera_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c
index 045f119..1d0dd69 100644
--- a/drivers/serial/altera_uart.c
+++ b/drivers/serial/altera_uart.c
@@ -26,6 +26,8 @@
 #include <watchdog.h>
 #include <asm/io.h>
 #include <nios2-io.h>
+#include <linux/compiler.h>
+#include <serial.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -37,27 +39,33 @@ static nios_uart_t *uart = (nios_uart_t *) CONFIG_SYS_NIOS_CONSOLE;
 
 #if defined(CONFIG_SYS_NIOS_FIXEDBAUD)
 
-/* Everything's already setup for fixed-baud PTF
+/*
+ * Everything's already setup for fixed-baud PTF
  * assignment
  */
-void serial_setbrg (void){ return; }
-int serial_init (void) { return (0);}
+static void altera_serial_setbrg(void)
+{
+}
+
+static int altera_serial_init(void)
+{
+	return 0;
+}
 
 #else
 
-void serial_setbrg (void)
+static void altera_serial_setbrg(void)
 {
 	unsigned div;
 
 	div = (CONFIG_SYS_CLK_FREQ/gd->baudrate)-1;
 	writel (div, &uart->divisor);
-	return;
 }
 
-int serial_init (void)
+static int altera_serial_init(void)
 {
-	serial_setbrg ();
-	return (0);
+	serial_setbrg();
+	return 0;
 }
 
 #endif /* CONFIG_SYS_NIOS_FIXEDBAUD */
@@ -65,7 +73,7 @@ int serial_init (void)
 /*-----------------------------------------------------------------------
  * UART CONSOLE
  *---------------------------------------------------------------------*/
-void serial_putc (char c)
+static void altera_serial_putc(char c)
 {
 	if (c == '\n')
 		serial_putc ('\r');
@@ -74,21 +82,74 @@ void serial_putc (char c)
 	writel ((unsigned char)c, &uart->txdata);
 }
 
-void serial_puts (const char *s)
+static void altera_serial_puts(const char *s)
 {
 	while (*s != 0) {
 		serial_putc (*s++);
 	}
 }
 
-int serial_tstc (void)
+static int altera_serial_tstc(void)
 {
 	return (readl (&uart->status) & NIOS_UART_RRDY);
 }
 
-int serial_getc (void)
+static int altera_serial_getc(void)
 {
 	while (serial_tstc () == 0)
 		WATCHDOG_RESET ();
 	return (readl (&uart->rxdata) & 0x00ff );
 }
+
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device altera_serial_drv = {
+	.name	= "altera_serial",
+	.start	= altera_serial_init,
+	.stop	= NULL,
+	.setbrg	= altera_serial_setbrg,
+	.putc	= altera_serial_putc,
+	.puts	= altera_serial_puts,
+	.getc	= altera_serial_getc,
+	.tstc	= altera_serial_tstc,
+};
+
+void altera_serial_initialize(void)
+{
+	serial_register(&altera_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &altera_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return altera_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	altera_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	altera_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	altera_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return altera_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return altera_serial_tstc();
+}
+#endif
-- 
1.7.10.4

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

* [U-Boot] [PATCH 40/71] serial: arm: Implement CONFIG_SERIAL_MULTI into altera serial driver
  2012-10-01 12:31   ` Thomas Chou
@ 2012-10-01 14:46     ` Marek Vasut
  0 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-10-01 14:46 UTC (permalink / raw)
  To: u-boot

Dear Thomas Chou,

> On 09/17/2012 07:21 AM, Marek Vasut wrote:
> > Implement support for CONFIG_SERIAL_MULTI into altera serial driver.
> > This driver was so far only usable directly, but this patch also adds
> > support for the multi method. This allows using more than one serial
> > driver alongside the altera driver. Also, add a weak implementation
> > of default_serial_console() returning this driver.
> > 
> > Signed-off-by: Marek Vasut <marex@denx.de>
> > Cc: Marek Vasut <marek.vasut@gmail.com>
> > Cc: Tom Rini <trini@ti.com>
> > Cc: Scott McNutt <smcnutt@psyent.com>
> > ---
> > 
> >   common/serial.c              |    2 +
> >   drivers/serial/altera_uart.c |   83
> >   ++++++++++++++++++++++++++++++++++++------ 2 files changed, 73
> >   insertions(+), 12 deletions(-)
> 
> Dear Marek,
> 
> Please include the following headers.
[...]
Fixed both, V2 out

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 65/72] serial: ns16550: Rename serial.c to serial_ns16550.c
  2012-09-30  8:52       ` Michal Simek
  2012-09-30 13:22         ` Marek Vasut
@ 2012-10-01 16:49         ` Marek Vasut
  1 sibling, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-10-01 16:49 UTC (permalink / raw)
  To: u-boot

Dear Michal Simek,

[...]
> 
> Would it be better just use this structure?
> 
> #ifdef CONFIG_SYS_NS16550_COM1
>         [0] = (NS16550_t)CONFIG_SYS_NS16550_COM1,
> #endif
[...]

> 
> You are using two coding styles in this file.
> One has function return value on one line and then function name
> and the second function return value on one line with function name.
> Will be good to unify it to look the same in the whole file.

Yes, wholeheartedly agree! But (!) I don't want to clean up this file in this 
patchset.

> Thanks,
> Michal

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 65/72] serial: ns16550: Rename serial.c to serial_ns16550.c
  2012-09-29 21:52     ` [U-Boot] [PATCH 65/72] serial: ns16550: Rename serial.c to serial_ns16550.c Marek Vasut
  2012-09-30  8:52       ` Michal Simek
@ 2012-10-01 16:52       ` Tom Rini
  2012-10-02  7:29         ` Michal Simek
  1 sibling, 1 reply; 306+ messages in thread
From: Tom Rini @ 2012-10-01 16:52 UTC (permalink / raw)
  To: u-boot

On Sat, Sep 29, 2012 at 11:52:58PM +0200, Marek Vasut wrote:

> This serial driver had wrong name of the source file for some time
> now. The name of the driver was serial.c instead of any more logical
> and fitting name. Thus, rename the driver source file to serial_ns16550.c
> and be done with it.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Cc: Tom Rini <trini@ti.com>
> Cc: Anatolij Gustschin <agust@denx.de>
> Cc: Stefan Roese <sr@denx.de>
> Cc: Mike Frysinger <vapier@gentoo.org>
> Cc: Michal Simek <monstr@monstr.eu>

After checking with Marek on IRC, this is a pure rename and he just
forgot -M -C when posting the series.  So while Michal's comments about
better formatting, etc, are true, it's beyond the scope of this "just do
a rename" patch.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121001/12e82034/attachment.pgp>

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

* [U-Boot] [PATCH 25/72 V2] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8260 serial drivers
  2012-09-29 21:52     ` [U-Boot] [PATCH 25/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8260 serial drivers Marek Vasut
@ 2012-10-01 23:22       ` Marek Vasut
  0 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-10-01 23:22 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into both SCC and SMC mpc8260
serial drivers. These drivers were so far only usable directly, but this
patch also adds support for the multi method. This allows using more than
one serial driver alongside the mpc8260 drivers. Also, add a weak
implementation of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/powerpc/cpu/mpc8260/serial_scc.c |   71 ++++++++++++++++++++++++++++-----
 arch/powerpc/cpu/mpc8260/serial_smc.c |   71 ++++++++++++++++++++++++++++-----
 common/serial.c                       |    4 ++
 3 files changed, 124 insertions(+), 22 deletions(-)

V2: Fix driver name too long problem

diff --git a/arch/powerpc/cpu/mpc8260/serial_scc.c b/arch/powerpc/cpu/mpc8260/serial_scc.c
index 4ab6a28..7bfd420 100644
--- a/arch/powerpc/cpu/mpc8260/serial_scc.c
+++ b/arch/powerpc/cpu/mpc8260/serial_scc.c
@@ -31,6 +31,8 @@
 #include <common.h>
 #include <mpc8260.h>
 #include <asm/cpm_8260.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -82,7 +84,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #endif
 
-int serial_init (void)
+static int mpc8260_scc_serial_init(void)
 {
 	volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
 	volatile scc_t *sp;
@@ -180,8 +182,7 @@ int serial_init (void)
 	return (0);
 }
 
-void
-serial_setbrg (void)
+static void mpc8260_scc_serial_setbrg(void)
 {
 #if defined(CONFIG_CONS_USE_EXTC)
 	m8260_cpm_extcbrg(SCC_INDEX, gd->baudrate,
@@ -191,8 +192,7 @@ serial_setbrg (void)
 #endif
 }
 
-void
-serial_putc(const char c)
+static void mpc8260_scc_serial_putc(const char c)
 {
 	volatile scc_uart_t	*up;
 	volatile cbd_t		*tbdf;
@@ -217,16 +217,14 @@ serial_putc(const char c)
 	tbdf->cbd_sc |= BD_SC_READY;
 }
 
-void
-serial_puts (const char *s)
+static void mpc8260_scc_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
-int
-serial_getc(void)
+static int mpc8260_scc_serial_getc(void)
 {
 	volatile cbd_t		*rbdf;
 	volatile scc_uart_t	*up;
@@ -250,8 +248,7 @@ serial_getc(void)
 	return (c);
 }
 
-int
-serial_tstc()
+static int mpc8260_scc_serial_tstc(void)
 {
 	volatile cbd_t		*rbdf;
 	volatile scc_uart_t	*up;
@@ -264,6 +261,58 @@ serial_tstc()
 	return ((rbdf->cbd_sc & BD_SC_EMPTY) == 0);
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device mpc8260_scc_serial_drv = {
+	.name	= "mpc8260_scc_uart",
+	.start	= mpc8260_scc_serial_init,
+	.stop	= NULL,
+	.setbrg	= mpc8260_scc_serial_setbrg,
+	.putc	= mpc8260_scc_serial_putc,
+	.puts	= mpc8260_scc_serial_puts,
+	.getc	= mpc8260_scc_serial_getc,
+	.tstc	= mpc8260_scc_serial_tstc,
+};
+
+void mpc8260_scc_serial_initialize(void)
+{
+	serial_register(&mpc8260_scc_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &mpc8260_scc_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return mpc8260_scc_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	mpc8260_scc_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	mpc8260_scc_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	mpc8260_scc_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return mpc8260_scc_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return mpc8260_scc_serial_tstc();
+}
+#endif
 #endif	/* CONFIG_CONS_ON_SCC */
 
 #if defined(CONFIG_KGDB_ON_SCC)
diff --git a/arch/powerpc/cpu/mpc8260/serial_smc.c b/arch/powerpc/cpu/mpc8260/serial_smc.c
index 7b6eaba..0f3b834 100644
--- a/arch/powerpc/cpu/mpc8260/serial_smc.c
+++ b/arch/powerpc/cpu/mpc8260/serial_smc.c
@@ -33,6 +33,8 @@
 #include <common.h>
 #include <mpc8260.h>
 #include <asm/cpm_8260.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -91,7 +93,7 @@ static unsigned char brg_map[] = {
 	3,	/* BRG1 for SCC4 */
 };
 
-int serial_init (void)
+static int mpc8260_smc_serial_init(void)
 {
 	volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
 	volatile smc_t *sp;
@@ -183,8 +185,7 @@ int serial_init (void)
 	return (0);
 }
 
-void
-serial_setbrg (void)
+static void mpc8260_smc_serial_setbrg(void)
 {
 #if defined(CONFIG_CONS_USE_EXTC)
 	m8260_cpm_extcbrg(brg_map[SMC_INDEX], gd->baudrate,
@@ -194,8 +195,7 @@ serial_setbrg (void)
 #endif
 }
 
-void
-serial_putc(const char c)
+static void mpc8260_smc_serial_putc(const char c)
 {
 	volatile smc_uart_t	*up;
 	volatile immap_t	*im = (immap_t *)CONFIG_SYS_IMMR;
@@ -216,16 +216,14 @@ serial_putc(const char c)
 	rtx->txbd.cbd_sc |= BD_SC_READY;
 }
 
-void
-serial_puts (const char *s)
+static void mpc8260_smc_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc (*s++);
 	}
 }
 
-int
-serial_getc(void)
+static int mpc8260_smc_serial_getc(void)
 {
 	volatile smc_uart_t	*up;
 	volatile immap_t	*im = (immap_t *)CONFIG_SYS_IMMR;
@@ -254,8 +252,7 @@ serial_getc(void)
 	return(c);
 }
 
-int
-serial_tstc()
+static int mpc8260_smc_serial_tstc(void)
 {
 	volatile smc_uart_t	*up;
 	volatile immap_t	*im = (immap_t *)CONFIG_SYS_IMMR;
@@ -267,6 +264,58 @@ serial_tstc()
 	return !(rtx->rxbd.cbd_sc & BD_SC_EMPTY);
 }
 
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device mpc8260_smc_serial_drv = {
+	.name	= "mpc8260_smc_uart",
+	.start	= mpc8260_smc_serial_init,
+	.stop	= NULL,
+	.setbrg	= mpc8260_smc_serial_setbrg,
+	.putc	= mpc8260_smc_serial_putc,
+	.puts	= mpc8260_smc_serial_puts,
+	.getc	= mpc8260_smc_serial_getc,
+	.tstc	= mpc8260_smc_serial_tstc,
+};
+
+void mpc8260_smc_serial_initialize(void)
+{
+	serial_register(&mpc8260_smc_serial_drv);
+}
+
+__weak struct serial_device *default_serial_console(void)
+{
+	return &mpc8260_smc_serial_drv;
+}
+#else
+int serial_init(void)
+{
+	return mpc8260_smc_serial_init();
+}
+
+void serial_setbrg(void)
+{
+	mpc8260_smc_serial_setbrg();
+}
+
+void serial_putc(const char c)
+{
+	mpc8260_smc_serial_putc(c);
+}
+
+void serial_puts(const char *s)
+{
+	mpc8260_smc_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return mpc8260_smc_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return mpc8260_smc_serial_tstc();
+}
+#endif
 #endif	/* CONFIG_CONS_ON_SMC */
 
 #if defined(CONFIG_KGDB_ON_SMC)
diff --git a/common/serial.c b/common/serial.c
index db06f97..5c8cbdd 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -54,6 +54,8 @@ serial_initfunc(asc_serial_initialize);
 serial_initfunc(jz_serial_initialize);
 serial_initfunc(mpc5xx_serial_initialize);
 serial_initfunc(mpc8220_serial_initialize);
+serial_initfunc(mpc8260_scc_serial_initialize);
+serial_initfunc(mpc8260_smc_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -86,6 +88,8 @@ void serial_initialize(void)
 	jz_serial_initialize();
 	mpc5xx_serial_initialize();
 	mpc8220_serial_initialize();
+	mpc8260_scc_serial_initialize();
+	mpc8260_smc_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 70/72 V2] serial: Remove CONFIG_SERIAL_MULTI from remaining sources
  2012-09-29 21:53     ` [U-Boot] [PATCH 70/72] serial: Remove CONFIG_SERIAL_MULTI from remaining sources Marek Vasut
@ 2012-10-01 23:34       ` Marek Vasut
  0 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-10-01 23:34 UTC (permalink / raw)
  To: u-boot

Remove the parts depending either on disabled CONFIG_SERIAL_MULTI
or ifdefs around CONFIG_SERIAL_MULTI parts since CONFIG_SERIAL_MULTI
is now enabled by default.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/arm/lib/board.c             |    2 --
 arch/blackfin/lib/board.c        |    2 --
 arch/m68k/lib/board.c            |    2 --
 arch/microblaze/lib/board.c      |    2 --
 arch/nds32/lib/board.c           |    2 --
 arch/powerpc/lib/board.c         |    2 --
 arch/sandbox/lib/board.c         |    2 --
 arch/x86/lib/board.c             |    2 --
 common/cmd_nvedit.c              |    2 --
 common/fdt_support.c             |    6 ++----
 common/iomux.c                   |    2 --
 common/stdio.c                   |    2 --
 include/common.h                 |   12 ------------
 include/serial.h                 |    2 +-
 post/board/pdm360ng/coproc_com.c |    3 ---
 15 files changed, 3 insertions(+), 42 deletions(-)

V2: Fix compiler warning about unused fdt_fill_multisername

diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
index 109a1ac..0b47ab3 100644
--- a/arch/arm/lib/board.c
+++ b/arch/arm/lib/board.c
@@ -492,9 +492,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 #ifdef CONFIG_CLOCKS
 	set_cpu_clk_info(); /* Setup clock information */
 #endif
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 
 	debug("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
 
diff --git a/arch/blackfin/lib/board.c b/arch/blackfin/lib/board.c
index c380d27..0b31f37 100644
--- a/arch/blackfin/lib/board.c
+++ b/arch/blackfin/lib/board.c
@@ -284,9 +284,7 @@ void board_init_f(ulong bootflag)
 	init_baudrate();
 	serial_early_puts("Serial init\n");
 	serial_init();
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 	serial_early_puts("Console init flash\n");
 	console_init_f();
 	serial_early_puts("End of early debugging\n");
diff --git a/arch/m68k/lib/board.c b/arch/m68k/lib/board.c
index 2add630..67c9a13 100644
--- a/arch/m68k/lib/board.c
+++ b/arch/m68k/lib/board.c
@@ -401,9 +401,7 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
 	gd->flags |= GD_FLG_RELOC;	/* tell others: relocation done */
 
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 
 	debug ("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
 
diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c
index 674b573..efd63cd 100644
--- a/arch/microblaze/lib/board.c
+++ b/arch/microblaze/lib/board.c
@@ -108,9 +108,7 @@ void board_init_f(ulong not_used)
 	 */
 	mem_malloc_init (CONFIG_SYS_MALLOC_BASE, CONFIG_SYS_MALLOC_LEN);
 
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 
 	for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
 		WATCHDOG_RESET ();
diff --git a/arch/nds32/lib/board.c b/arch/nds32/lib/board.c
index 17d3ee0..89900fe 100644
--- a/arch/nds32/lib/board.c
+++ b/arch/nds32/lib/board.c
@@ -324,9 +324,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 		(ulong)(&__u_boot_cmd_end - &__u_boot_cmd_start));
 #endif /* defined(CONFIG_NEEDS_MANUAL_RELOC) */
 
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 
 	debug("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
 
diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
index 07feaf5..b860141 100644
--- a/arch/powerpc/lib/board.c
+++ b/arch/powerpc/lib/board.c
@@ -672,9 +672,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 	gd->env_addr += dest_addr - CONFIG_SYS_MONITOR_BASE;
 #endif
 
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 
 	debug("Now running in RAM - U-Boot at: %08lx\n", dest_addr);
 
diff --git a/arch/sandbox/lib/board.c b/arch/sandbox/lib/board.c
index c173bf9..83858c1 100644
--- a/arch/sandbox/lib/board.c
+++ b/arch/sandbox/lib/board.c
@@ -220,9 +220,7 @@ void board_init_r(gd_t *id, ulong dest_addr)
 
 	gd->flags |= GD_FLG_RELOC;	/* tell others: relocation done */
 
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize();
-#endif
 
 #ifdef CONFIG_POST
 	post_output_backlog();
diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
index 90cf7fc..e5caf13 100644
--- a/arch/x86/lib/board.c
+++ b/arch/x86/lib/board.c
@@ -150,9 +150,7 @@ init_fnc_t *init_sequence_r[] = {
 	timer_init,
 	display_banner,
 	display_dram_config,
-#ifdef CONFIG_SERIAL_MULTI
 	serial_initialize_r,
-#endif
 #ifndef CONFIG_SYS_NO_FLASH
 	flash_init_r,
 #endif
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 3474bc6..1d67f20 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -237,10 +237,8 @@ int env_check_apply(const char *name, const char *oldval,
 		if (console_assign(console, newval) < 0)
 			return 1;
 
-#ifdef CONFIG_SERIAL_MULTI
 		if (serial_assign(newval) < 0)
 			return 1;
-#endif
 #endif /* CONFIG_CONSOLE_MUX */
 	}
 
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 593f16c..963ea90 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -94,7 +94,7 @@ int fdt_find_and_setprop(void *fdt, const char *node, const char *prop,
 
 #ifdef CONFIG_OF_STDOUT_VIA_ALIAS
 
-#ifdef CONFIG_SERIAL_MULTI
+#ifdef CONFIG_CONS_INDEX
 static void fdt_fill_multisername(char *sername, size_t maxlen)
 {
 	const char *outname = stdio_devices[stdout]->name;
@@ -106,9 +106,7 @@ static void fdt_fill_multisername(char *sername, size_t maxlen)
 	if (strcmp(outname + 1, "serial") > 0)
 		strncpy(sername, outname + 1, maxlen);
 }
-#else
-static inline void fdt_fill_multisername(char *sername, size_t maxlen) {}
-#endif /* CONFIG_SERIAL_MULTI */
+#endif
 
 static int fdt_fixup_stdout(void *fdt, int chosenoff)
 {
diff --git a/common/iomux.c b/common/iomux.c
index 91d98e9..dbc2312 100644
--- a/common/iomux.c
+++ b/common/iomux.c
@@ -135,7 +135,6 @@ int iomux_doenv(const int console, const char *arg)
 		 */
 		if (console_assign(console, start[j]) < 0)
 			continue;
-#ifdef CONFIG_SERIAL_MULTI
 		/*
 		 * This was taken from common/cmd_nvedit.c.
 		 * This will never work because serial_assign() returns
@@ -146,7 +145,6 @@ int iomux_doenv(const int console, const char *arg)
 		 */
 		if (serial_assign(start[j]) < 0)
 			continue;
-#endif
 		cons_set[cs_idx++] = dev;
 	}
 	free(console_args);
diff --git a/common/stdio.c b/common/stdio.c
index 1bf9ba0..605ff3f 100644
--- a/common/stdio.c
+++ b/common/stdio.c
@@ -227,9 +227,7 @@ int stdio_init (void)
 	drv_logbuff_init ();
 #endif
 	drv_system_init ();
-#ifdef CONFIG_SERIAL_MULTI
 	serial_stdio_init ();
-#endif
 #ifdef CONFIG_USB_TTY
 	drv_usbtty_init ();
 #endif
diff --git a/include/common.h b/include/common.h
index 55025c0..b52a8a4 100644
--- a/include/common.h
+++ b/include/common.h
@@ -194,18 +194,6 @@ typedef void (interrupt_handler_t)(void *);
 # endif
 #endif
 
-#ifndef CONFIG_SERIAL_MULTI
-
-#if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2) \
- || defined(CONFIG_8xx_CONS_SCC1) || defined(CONFIG_8xx_CONS_SCC2) \
- || defined(CONFIG_8xx_CONS_SCC3) || defined(CONFIG_8xx_CONS_SCC4)
-
-#define CONFIG_SERIAL_MULTI	1
-
-#endif
-
-#endif /* CONFIG_SERIAL_MULTI */
-
 /*
  * General Purpose Utilities
  */
diff --git a/include/serial.h b/include/serial.h
index 01a86b4..a8d23f5 100644
--- a/include/serial.h
+++ b/include/serial.h
@@ -63,7 +63,7 @@ extern int usbtty_tstc(void);
 
 #endif /* CONFIG_USB_TTY */
 
-#if defined(CONFIG_MPC512X) &&  defined(CONFIG_SERIAL_MULTI)
+#if defined(CONFIG_MPC512X)
 extern struct stdio_dev *open_port(int num, int baudrate);
 extern int close_port(int num);
 extern int write_port(struct stdio_dev *port, char *buf);
diff --git a/post/board/pdm360ng/coproc_com.c b/post/board/pdm360ng/coproc_com.c
index 0755352..b7e02b5 100644
--- a/post/board/pdm360ng/coproc_com.c
+++ b/post/board/pdm360ng/coproc_com.c
@@ -28,8 +28,6 @@
 #include <post.h>
 #include <serial.h>
 
-#if defined(CONFIG_SERIAL_MULTI)
-
 /*
  * Actually the termination sequence of the coprocessor
  * commands is "\r\n" (CR LF), but here we use a side effect of
@@ -94,4 +92,3 @@ int coprocessor_post_test(int flags)
 
 	return 0;
 }
-#endif	/* CONFIG_SERIAL_MULTI */
-- 
1.7.10.4

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

* [U-Boot] [PATCH 23/72 V2] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc5xx serial driver
  2012-09-29 21:52     ` [U-Boot] [PATCH 23/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc5xx " Marek Vasut
@ 2012-10-02  7:07       ` Marek Vasut
  0 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-10-02  7:07 UTC (permalink / raw)
  To: u-boot

Implement support for CONFIG_SERIAL_MULTI into mpc5xx serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the mpc5xx driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
Cc: Anatolij Gustschin <agust@denx.de>
Cc: Stefan Roese <sr@denx.de>
---
 arch/powerpc/cpu/mpc5xx/serial.c |   95 +++++++++++++++++++++++++++++---------
 common/serial.c                  |    2 +
 2 files changed, 76 insertions(+), 21 deletions(-)

V2: Fix compiler warning

diff --git a/arch/powerpc/cpu/mpc5xx/serial.c b/arch/powerpc/cpu/mpc5xx/serial.c
index 88c6db8..a4fd6bc 100644
--- a/arch/powerpc/cpu/mpc5xx/serial.c
+++ b/arch/powerpc/cpu/mpc5xx/serial.c
@@ -33,20 +33,40 @@
 #include <watchdog.h>
 #include <command.h>
 #include <mpc5xx.h>
+#include <serial.h>
+#include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
- * Local function prototypes
+ * Local functions
  */
 
-static int ready_to_send(void);
+static int ready_to_send(void)
+{
+	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
+	volatile short status;
+
+	do {
+#if defined(CONFIG_5xx_CONS_SCI1)
+		status = immr->im_qsmcm.qsmcm_sc1sr;
+#else
+		status = immr->im_qsmcm.qsmcm_sc2sr;
+#endif
+
+#if defined(CONFIG_WATCHDOG)
+		reset_5xx_watchdog (immr);
+#endif
+	} while ((status & SCI_TDRE) == 0);
+	return 1;
+
+}
 
 /*
  * Minimal global serial functions needed to use one of the SCI modules.
  */
 
-int serial_init (void)
+static int mpc5xx_serial_init(void)
 {
 	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
 
@@ -63,7 +83,7 @@ int serial_init (void)
 	return 0;
 }
 
-void serial_putc(const char c)
+static void mpc5xx_serial_putc(const char c)
 {
 	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
 
@@ -85,7 +105,7 @@ void serial_putc(const char c)
 	}
 }
 
-int serial_getc(void)
+static int mpc5xx_serial_getc(void)
 {
 	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
 	volatile short status;
@@ -113,7 +133,7 @@ int serial_getc(void)
 	return	tmp;
 }
 
-int serial_tstc()
+static int mpc5xx_serial_tstc(void)
 {
 	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
 	short status;
@@ -127,7 +147,7 @@ int serial_tstc()
 	return (status & SCI_RDRF);
 }
 
-void serial_setbrg (void)
+static void mpc5xx_serial_setbrg(void)
 {
 	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
 	short scxbr;
@@ -141,7 +161,7 @@ void serial_setbrg (void)
 #endif
 }
 
-void serial_puts (const char *s)
+static void mpc5xx_serial_puts(const char *s)
 {
 	while (*s) {
 		serial_putc(*s);
@@ -149,22 +169,55 @@ void serial_puts (const char *s)
 	}
 }
 
-int ready_to_send(void)
+#ifdef CONFIG_SERIAL_MULTI
+static struct serial_device mpc5xx_serial_drv = {
+	.name	= "mpc5xx_serial",
+	.start	= mpc5xx_serial_init,
+	.stop	= NULL,
+	.setbrg	= mpc5xx_serial_setbrg,
+	.putc	= mpc5xx_serial_putc,
+	.puts	= mpc5xx_serial_puts,
+	.getc	= mpc5xx_serial_getc,
+	.tstc	= mpc5xx_serial_tstc,
+};
+
+void mpc5xx_serial_initialize(void)
 {
-	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
-	volatile short status;
+	serial_register(&mpc5xx_serial_drv);
+}
 
-	do {
-#if defined(CONFIG_5xx_CONS_SCI1)
-		status = immr->im_qsmcm.qsmcm_sc1sr;
+__weak struct serial_device *default_serial_console(void)
+{
+	return &mpc5xx_serial_drv;
+}
 #else
-		status = immr->im_qsmcm.qsmcm_sc2sr;
-#endif
+int serial_init(void)
+{
+	return mpc5xx_serial_init();
+}
 
-#if defined(CONFIG_WATCHDOG)
-		reset_5xx_watchdog (immr);
-#endif
-	} while ((status & SCI_TDRE) == 0);
-	return 1;
+void serial_setbrg(void)
+{
+	mpc5xx_serial_setbrg();
+}
 
+void serial_putc(const char c)
+{
+	mpc5xx_serial_putc(c);
 }
+
+void serial_puts(const char *s)
+{
+	mpc5xx_serial_puts(s);
+}
+
+int serial_getc(void)
+{
+	return mpc5xx_serial_getc();
+}
+
+int serial_tstc(void)
+{
+	return mpc5xx_serial_tstc();
+}
+#endif
diff --git a/common/serial.c b/common/serial.c
index dd35a62..69fa583 100644
--- a/common/serial.c
+++ b/common/serial.c
@@ -52,6 +52,7 @@ serial_initfunc(uartlite_serial_initialize);
 serial_initfunc(au1x00_serial_initialize);
 serial_initfunc(asc_serial_initialize);
 serial_initfunc(jz_serial_initialize);
+serial_initfunc(mpc5xx_serial_initialize);
 
 void serial_register(struct serial_device *dev)
 {
@@ -82,6 +83,7 @@ void serial_initialize(void)
 	au1x00_serial_initialize();
 	asc_serial_initialize();
 	jz_serial_initialize();
+	mpc5xx_serial_initialize();
 
 	serial_assign(default_serial_console()->name);
 }
-- 
1.7.10.4

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

* [U-Boot] [PATCH 65/72] serial: ns16550: Rename serial.c to serial_ns16550.c
  2012-10-01 16:52       ` Tom Rini
@ 2012-10-02  7:29         ` Michal Simek
  0 siblings, 0 replies; 306+ messages in thread
From: Michal Simek @ 2012-10-02  7:29 UTC (permalink / raw)
  To: u-boot

On 10/01/2012 06:52 PM, Tom Rini wrote:
> On Sat, Sep 29, 2012 at 11:52:58PM +0200, Marek Vasut wrote:
>
>> This serial driver had wrong name of the source file for some time
>> now. The name of the driver was serial.c instead of any more logical
>> and fitting name. Thus, rename the driver source file to serial_ns16550.c
>> and be done with it.
>>
>> Signed-off-by: Marek Vasut <marex@denx.de>
>> Cc: Marek Vasut <marek.vasut@gmail.com>
>> Cc: Tom Rini <trini@ti.com>
>> Cc: Anatolij Gustschin <agust@denx.de>
>> Cc: Stefan Roese <sr@denx.de>
>> Cc: Mike Frysinger <vapier@gentoo.org>
>> Cc: Michal Simek <monstr@monstr.eu>
>
> After checking with Marek on IRC, this is a pure rename and he just
> forgot -M -C when posting the series.  So while Michal's comments about
> better formatting, etc, are true, it's beyond the scope of this "just do
> a rename" patch.

No problem with that.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian

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

* [U-Boot] [PATCH 39/71] serial: arm: Implement CONFIG_SERIAL_MULTI into altera_jtag serial driver
  2012-10-01 14:41     ` Marek Vasut
@ 2012-10-02  7:55       ` Thomas Chou
  2012-10-02 10:07         ` Marek Vasut
  0 siblings, 1 reply; 306+ messages in thread
From: Thomas Chou @ 2012-10-02  7:55 UTC (permalink / raw)
  To: u-boot

On 10/01/2012 10:41 PM, Marek Vasut wrote:
>> Please include the following headers.
>>
>> --- a/drivers/serial/altera_jtag_uart.c
>> +++ b/drivers/serial/altera_jtag_uart.c
>> @@ -25,6 +25,8 @@
>>    #include <watchdog.h>
>>    #include <asm/io.h>
>>    #include <nios2-io.h>
>> +#include <linux/compiler.h>
>> +#include <serial.h>
>
>
> Are you seeing any issues without them?
>

Dear Marek,

The serial.h defines the struct serial_device.
And the linux/compiler.h defines the __weak attribute.
Without them, it won't compile.

I have pulled your latest dm-serial-1 branch, compiled and tested 
altera_uart and altera_jtag_uart on nios2 board. They work without problem.

There is only minor size change.

Before..
Configuring for nios2-generic board...
    text	   data	    bss	    dec	    hex	filename
  134782	   3206	  23173	 161161	  27589	/home/thomas/tmp/u-boot/u-boot

After..
Configuring for nios2-generic board...
    text	   data	    bss	    dec	    hex	filename
  135450	   3254	  23181	 161885	  2785d	/home/thomas/tmp/u-boot/u-boot

Thank you very much.

Best regards
Thomas Chou

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

* [U-Boot] [PATCH 39/71] serial: arm: Implement CONFIG_SERIAL_MULTI into altera_jtag serial driver
  2012-10-02  7:55       ` Thomas Chou
@ 2012-10-02 10:07         ` Marek Vasut
  0 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-10-02 10:07 UTC (permalink / raw)
  To: u-boot

Dear Thomas Chou,

> On 10/01/2012 10:41 PM, Marek Vasut wrote:
> >> Please include the following headers.
> >> 
> >> --- a/drivers/serial/altera_jtag_uart.c
> >> +++ b/drivers/serial/altera_jtag_uart.c
> >> @@ -25,6 +25,8 @@
> >> 
> >>    #include <watchdog.h>
> >>    #include <asm/io.h>
> >>    #include <nios2-io.h>
> >> 
> >> +#include <linux/compiler.h>
> >> +#include <serial.h>
> > 
> > Are you seeing any issues without them?
> 
> Dear Marek,
> 
> The serial.h defines the struct serial_device.
> And the linux/compiler.h defines the __weak attribute.
> Without them, it won't compile.
> 
> I have pulled your latest dm-serial-1 branch, compiled and tested
> altera_uart and altera_jtag_uart on nios2 board. They work without problem.
> 
> There is only minor size change.
> 
> Before..
> Configuring for nios2-generic board...
>     text	   data	    bss	    dec	    hex	filename
>   134782	   3206	  23173	 161161	  27589	/home/thomas/tmp/u-boot/u-boot
> 
> After..
> Configuring for nios2-generic board...
>     text	   data	    bss	    dec	    hex	filename
>   135450	   3254	  23181	 161885	  2785d	/home/thomas/tmp/u-boot/u-boot
> 
> Thank you very much.

Perfect! Thank YOU!

> Best regards
> Thomas Chou

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (71 preceding siblings ...)
  2012-09-29 21:53     ` [U-Boot] [PATCH 72/72] serial: Enhance the manual relocation Marek Vasut
@ 2012-10-02 18:04     ` Tom Rini
  2012-10-04 13:27     ` Wolfgang Denk
  73 siblings, 0 replies; 306+ messages in thread
From: Tom Rini @ 2012-10-02 18:04 UTC (permalink / raw)
  To: u-boot

On Sat, Sep 29, 2012 at 11:51:53PM +0200, Marek Vasut wrote:

> This patchset is a STAGE 1 of preparation of the stdio and serial subsys
> for the driver model.
> 
> The idea of this patchset is:
> 
> 1) Clean up the struct serial_device
>    Do a coding style cleanup.
> 2) Replace .init and .uninit with .start and .stop
>    This is to bring struct serial_device much closer to struct stdio_dev
>    so later on, these structures can be overlayed and struct serial_device
>    can be easily passed to stdio subsystem directly.
> 3) Do minor cleanups on the PXA and MPC512X
>    Basically for PXA this means to remove default_serial_console() call
>    from every single PXA board and move it into PXA serial driver. For
>    MPC512X, that means properly defining PSC console number.
> 4) Add support for CONFIG_SERIAL_MULTI into every single driver
>    Implement support for both non-multi and multi operation into every
>    single serial driver in the U-Boot source tree. This is a vast majority
>    of this patchset.
> 5) Unconditionally enable CONFIG_SERIAL_MULTI
>    Enable the multi operation throughout the whole U-Boot tree, both for
>    SPL and non-SPL builds. There was also some breakage due to this, so
>    this patchset also addresses that with minor fixes.
> 6) Remove unused code used for the non-multi operation
>    Remove code that was used when CONFIG_SERIAL_MULTI was not selected.
>    Also remove all occurances of CONFIG_SERIAL_MULTI throughout the source
>    tree. Some parts of the code must have been adjusted to cope with this
>    since they were initially only written for non-multi operation. These
>    were minor adjustments mostly in macros though.
> 
> This changeset obviously does mean size growth of U-Boot, therefore some
> statistics (stock U-Boot first, patchset last):
> 
> Configuring for omap3_beagle board...
>    text    data     bss     dec     hex filename
>  325687    8456  266888  601031   92bc7 ./u-boot
>  326912    8648  266944  602504   93188 ./u-boot
>   43082    1812  198020  242914   3b4e2 ./spl/u-boot-spl
>   45794    1860  198020  245674   3bfaa ./spl/u-boot-spl
> 
> Configuring for P1020RDB-PC_36BIT_SPIFLASH - Board: p1_p2_rdb_pc, Options: P1020RDB,36BIT,SPIFLASH
>    text    data     bss     dec     hex filename
>  392469   30628  267568  690665   a89e9 ./u-boot
>  394550   30940  267600  693090   a9362 ./u-boot
> 
> Configuring for grsim_leon2 board...
>    text    data     bss     dec     hex filename
>   95658    3328    2640  101626   18cfa ./u-boot
>   97058    3384    2640  103082   192aa ./u-boot
> 
> Configuring for sandbox board...
>    text    data     bss     dec     hex filename
>  137394    6364   28488  172246   2a0d6 ./u-boot
>  138674    6456   28504  173634   2a642 ./u-boot
> 
> V2: Rebase on top of current -next
> V3: - Fix problem with new SPL framework (2 new patches)
>     - mv drivers/serial/serial{,-ns16550}.c to make clear
>       what that driver really is [ 0065/0072 ]
>     - Move common/serial.c do drivers/serial, since it really has
>       to link with libserial.o, not libcommon.o [ 0066/0072 ]
> 
> Marek Vasut (72):
>   serial: Coding style cleanup of struct serial_device
>   serial: Rename .init() and .uninit() in serial_device
>   serial: Properly spell out the structure member names of
>     serial_driver
>   serial: pxa: Implement default_serial_console in serial_pxa.c
>   serial: pxa: Make use of default_serial_console in serial_pxa
>   serial: pxa: Make local functions static
>   serial: mpc512x: Properly define CONFIG_SYS_PSC3 in config files
>   serial: Implement serial_initfunc() macro
>   serial: mpc8xx: Move serial registration from serial_initialize()
>   serial: s3c24xx: Move serial registration from serial_initialize()
>   serial: pxa: Move serial registration from serial_initialize()
>   serial: s5p: Move serial registration from serial_initialize()
>   serial: microblaze: Move serial registration from serial_initialize()
>   serial: mpc512x: Move serial registration from serial_initialize()
>   serial: ns16550: Move serial registration from serial_initialize()
>   serial: bfin: Remove the bfin_serialN_device exports from serial.h
>   serial: bfin: Adjust serial_register_bfin_uart()
>   serial: zoom2: Remove zoom2 serial prototypes from serial.h
>   serial: bfin: Flip the jtag serial console to CONFIG_SERIAL_MULTI
>   serial: mips: Implement CONFIG_SERIAL_MULTI into au1x00 serial driver
>   serial: mips: Implement CONFIG_SERIAL_MULTI into asc serial driver
>   serial: mips: Implement CONFIG_SERIAL_MULTI into JZ serial driver
>   serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc5xx serial
>     driver
>   serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8220 serial
>     driver
>   serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8260 serial
>     drivers
>   serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc85xx serial
>     driver
>   serial: powerpc: Implement CONFIG_SERIAL_MULTI into iop480 serial
>     driver
>   serial: sparc: Implement CONFIG_SERIAL_MULTI into leon2 serial driver
>   serial: sparc: Implement CONFIG_SERIAL_MULTI into leon3 serial driver
>   serial: powerpc: Implement CONFIG_SERIAL_MULTI into marvell serial
>     driver
>   serial: powerpc: Implement CONFIG_SERIAL_MULTI into amirix serial
>     driver
>   serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw serial driver
>   serial: powerpc: Implement CONFIG_SERIAL_MULTI into cogent serial
>     driver
>   serial: powerpc: Implement CONFIG_SERIAL_MULTI into cpci750 serial
>     driver
>   serial: powerpc: Implement CONFIG_SERIAL_MULTI into evb64260 serial
>     driver
>   serial: powerpc: Implement CONFIG_SERIAL_MULTI into ml2 serial driver
>   serial: powerpc: Implement CONFIG_SERIAL_MULTI into sconsole serial
>     driver
>   serial: powerpc: Implement CONFIG_SERIAL_MULTI into p3mx serial
>     driver
>   serial: arm: Implement CONFIG_SERIAL_MULTI into altera_jtag serial
>     driver
>   serial: arm: Implement CONFIG_SERIAL_MULTI into altera serial driver
>   serial: arm: Implement CONFIG_SERIAL_MULTI into atmel serial driver
>   serial: arm: Implement CONFIG_SERIAL_MULTI into lpc32xx serial driver
>   serial: mcf: Implement CONFIG_SERIAL_MULTI into MCF serial driver
>   serial: Implement CONFIG_SERIAL_MULTI into ns9750 serial driver
>   serial: oc: Implement CONFIG_SERIAL_MULTI into OpenCores serial
>     driver
>   serial: arm: Implement CONFIG_SERIAL_MULTI into s3c4510b serial
>     driver
>   serial: arm: Implement CONFIG_SERIAL_MULTI into s3c64xx serial driver
>   serial: sandbox: Implement CONFIG_SERIAL_MULTI into sandbox serial
>     driver
>   serial: arm: Implement CONFIG_SERIAL_MULTI into clps7111 serial
>     driver
>   serial: arm: Implement CONFIG_SERIAL_MULTI into imx serial driver
>   serial: arm: Implement CONFIG_SERIAL_MULTI into ixp serial driver
>   serial: arm: Implement CONFIG_SERIAL_MULTI into ks8695 serial driver
>   serial: arm: Implement CONFIG_SERIAL_MULTI into lh7a40x serial driver
>   serial: arm: Implement CONFIG_SERIAL_MULTI into lpc2292 serial driver
>   serial: Implement CONFIG_SERIAL_MULTI into max3100 serial driver
>   serial: arm: Implement CONFIG_SERIAL_MULTI into mxc serial driver
>   serial: arm: Implement CONFIG_SERIAL_MULTI into netarm serial driver
>   serial: arm: Implement CONFIG_SERIAL_MULTI into pl01x serial driver
>   serial: arm: Implement CONFIG_SERIAL_MULTI into s3c44b0 serial driver
>   serial: arm: Implement CONFIG_SERIAL_MULTI into sa1100 serial driver
>   serial: sh: Implement CONFIG_SERIAL_MULTI into sh serial driver
>   serial: mxs: spl: Remove empty serial_* functions from SPL code
>   serial: Use puts() and hang() instead of panic() in SPL
>   serial: ns16550: Call usbtty_poll only in non-SPL build
>   serial: ns16550: Rename serial.c to serial_ns16550.c
>   serial: Move common/serial.c to drivers/serial/
>   serial: Unconditionally enable CONFIG_SERIAL_MULTI
>   serial: Remove CONFIG_SERIAL_MULTI from config files
>   serial: Remove CONFIG_SERIAL_MULTI from serial drivers
>   serial: Remove CONFIG_SERIAL_MULTI from remaining sources
>   serial: Compile drivers/serial/serial.c by default
>   serial: Enhance the manual relocation
> 
>  arch/arm/cpu/arm926ejs/mxs/spl_boot.c         |    4 -
>  arch/arm/lib/board.c                          |    2 -
>  arch/blackfin/cpu/jtag-console.c              |   37 +-
>  arch/blackfin/cpu/serial.c                    |    6 +-
>  arch/blackfin/lib/board.c                     |    2 -
>  arch/m68k/lib/board.c                         |    2 -
>  arch/microblaze/lib/board.c                   |    2 -
>  arch/mips/cpu/mips32/au1x00/au1x00_serial.c   |   42 +-
>  arch/mips/cpu/mips32/incaip/asc_serial.c      |   35 +-
>  arch/mips/cpu/xburst/jz_serial.c              |   35 +-
>  arch/nds32/lib/board.c                        |    2 -
>  arch/powerpc/cpu/mpc512x/serial.c             |   92 ++---
>  arch/powerpc/cpu/mpc5xx/serial.c              |   69 ++--
>  arch/powerpc/cpu/mpc5xxx/serial.c             |  181 +++-----
>  arch/powerpc/cpu/mpc8220/uart.c               |   35 +-
>  arch/powerpc/cpu/mpc8260/serial_scc.c         |   39 +-
>  arch/powerpc/cpu/mpc8260/serial_smc.c         |   39 +-
>  arch/powerpc/cpu/mpc85xx/serial_scc.c         |   39 +-
>  arch/powerpc/cpu/mpc8xx/serial.c              |   43 +-
>  arch/powerpc/cpu/ppc4xx/iop480_uart.c         |   36 +-
>  arch/powerpc/lib/board.c                      |    2 -
>  arch/sandbox/lib/board.c                      |    2 -
>  arch/sparc/cpu/leon2/serial.c                 |   51 ++-
>  arch/sparc/cpu/leon3/serial.c                 |   51 ++-
>  arch/x86/lib/board.c                          |    2 -
>  board/Marvell/common/serial.c                 |   48 ++-
>  board/amirix/ap1000/serial.c                  |   35 +-
>  board/balloon3/balloon3.c                     |    5 -
>  board/bmw/serial.c                            |   36 +-
>  board/cogent/serial.c                         |   34 +-
>  board/esd/cpci750/serial.c                    |   36 +-
>  board/evb64260/serial.c                       |   54 ++-
>  board/logicpd/zoom2/zoom2_serial.c            |    7 +-
>  board/logicpd/zoom2/zoom2_serial.h            |   16 +-
>  board/ml2/serial.c                            |   35 +-
>  board/palmld/palmld.c                         |    5 -
>  board/palmtc/palmtc.c                         |    5 -
>  board/pcippc2/sconsole.c                      |   35 +-
>  board/pdm360ng/pdm360ng.c                     |    6 -
>  board/prodrive/p3mx/serial.c                  |   36 +-
>  board/toradex/colibri_pxa270/colibri_pxa270.c |    5 -
>  board/trizepsiv/conxs.c                       |    7 -
>  board/vpac270/vpac270.c                       |    5 -
>  board/zipitz2/zipitz2.c                       |    5 -
>  common/Makefile                               |    1 -
>  common/cmd_nvedit.c                           |    2 -
>  common/fdt_support.c                          |    4 -
>  common/iomux.c                                |    2 -
>  common/serial.c                               |  305 --------------
>  common/stdio.c                                |    2 -
>  drivers/serial/Makefile                       |    4 +-
>  drivers/serial/altera_jtag_uart.c             |   39 +-
>  drivers/serial/altera_uart.c                  |   51 ++-
>  drivers/serial/atmel_usart.c                  |   35 +-
>  drivers/serial/lpc32xx_hsuart.c               |   57 ++-
>  drivers/serial/mcfuart.c                      |   33 +-
>  drivers/serial/ns16550.c                      |    2 +-
>  drivers/serial/ns9750_serial.c                |   33 +-
>  drivers/serial/opencores_yanu.c               |   35 +-
>  drivers/serial/s3c4510b_uart.c                |   33 +-
>  drivers/serial/s3c64xx.c                      |   33 +-
>  drivers/serial/sandbox.c                      |   35 +-
>  drivers/serial/serial.c                       |  550 +++++++++++++------------
>  drivers/serial/serial_clps7111.c              |   34 +-
>  drivers/serial/serial_imx.c                   |   36 +-
>  drivers/serial/serial_ixp.c                   |   36 +-
>  drivers/serial/serial_ks8695.c                |   41 +-
>  drivers/serial/serial_lh7a40x.c               |   34 +-
>  drivers/serial/serial_lpc2292.c               |   34 +-
>  drivers/serial/serial_max3100.c               |   42 +-
>  drivers/serial/serial_mxc.c                   |   40 +-
>  drivers/serial/serial_netarm.c                |   33 +-
>  drivers/serial/serial_ns16550.c               |  264 ++++++++++++
>  drivers/serial/serial_pl01x.c                 |   37 +-
>  drivers/serial/serial_pxa.c                   |   65 +--
>  drivers/serial/serial_s3c24x0.c               |   78 +---
>  drivers/serial/serial_s3c44b0.c               |   36 +-
>  drivers/serial/serial_s5p.c                   |   27 +-
>  drivers/serial/serial_sa1100.c                |   36 +-
>  drivers/serial/serial_sh.c                    |   33 +-
>  drivers/serial/serial_xuartlite.c             |   69 ++--
>  include/common.h                              |   12 -
>  include/configs/DU440.h                       |    1 -
>  include/configs/KAREF.h                       |    1 -
>  include/configs/METROBOX.h                    |    1 -
>  include/configs/MPC8569MDS.h                  |    1 -
>  include/configs/P1010RDB.h                    |    1 -
>  include/configs/P1_P2_RDB.h                   |    1 -
>  include/configs/P2020COME.h                   |    1 -
>  include/configs/PMC440.h                      |    1 -
>  include/configs/TB5200.h                      |    1 -
>  include/configs/amcc-common.h                 |    1 -
>  include/configs/aria.h                        |    1 +
>  include/configs/balloon3.h                    |    1 +
>  include/configs/bfin_adi_common.h             |    1 -
>  include/configs/colibri_pxa270.h              |    1 +
>  include/configs/coreboot.h                    |    1 -
>  include/configs/eNET.h                        |    1 -
>  include/configs/harmony.h                     |    1 -
>  include/configs/jadecpu.h                     |    1 -
>  include/configs/korat.h                       |    1 -
>  include/configs/lubbock.h                     |    1 +
>  include/configs/lwmon.h                       |    1 -
>  include/configs/lwmon5.h                      |    1 -
>  include/configs/mcc200.h                      |    5 -
>  include/configs/mecp5123.h                    |    1 +
>  include/configs/medcom.h                      |    1 -
>  include/configs/mpc5121ads.h                  |    1 +
>  include/configs/omap3_zoom2.h                 |    3 +-
>  include/configs/origen.h                      |    1 -
>  include/configs/palmld.h                      |    1 +
>  include/configs/palmtc.h                      |    1 +
>  include/configs/paz00.h                       |    1 -
>  include/configs/pcs440ep.h                    |    1 -
>  include/configs/pdm360ng.h                    |    3 -
>  include/configs/plutux.h                      |    1 -
>  include/configs/pxa255_idp.h                  |    1 +
>  include/configs/quad100hd.h                   |    1 -
>  include/configs/s5p_goni.h                    |    1 -
>  include/configs/s5pc210_universal.h           |    1 -
>  include/configs/sc3.h                         |    1 -
>  include/configs/seaboard.h                    |    1 -
>  include/configs/smdk5250.h                    |    1 -
>  include/configs/smdkc100.h                    |    1 -
>  include/configs/smdkv310.h                    |    1 -
>  include/configs/tec.h                         |    1 -
>  include/configs/tegra-common-post.h           |    5 -
>  include/configs/trats.h                       |    1 -
>  include/configs/trimslice.h                   |    1 -
>  include/configs/trizepsiv.h                   |    2 +-
>  include/configs/ventana.h                     |    1 -
>  include/configs/vpac270.h                     |    1 +
>  include/configs/whistler.h                    |    1 -
>  include/configs/xaeniax.h                     |    2 +-
>  include/configs/zeus.h                        |    1 -
>  include/configs/zipitz2.h                     |    1 +
>  include/serial.h                              |   79 +---
>  post/board/pdm360ng/coproc_com.c              |    3 -
>  138 files changed, 2111 insertions(+), 1547 deletions(-)
>  delete mode 100644 common/serial.c
>  create mode 100644 drivers/serial/serial_ns16550.c

This has been applied, with the various follow-up patches that fixed
warnings used, to u-boot/next, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121002/981ebf98/attachment.pgp>

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

* [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem
  2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
                       ` (72 preceding siblings ...)
  2012-10-02 18:04     ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Tom Rini
@ 2012-10-04 13:27     ` Wolfgang Denk
  2012-10-04 14:03       ` Marek Vasut
  73 siblings, 1 reply; 306+ messages in thread
From: Wolfgang Denk @ 2012-10-04 13:27 UTC (permalink / raw)
  To: u-boot

Dear Marek Vasut,

In message <1348955586-7109-1-git-send-email-marex@denx.de> you wrote:
> This patchset is a STAGE 1 of preparation of the stdio and serial subsys
> for the driver model.

Formal complaint:

There is no change log.

Actually none of the patches has any marker that it is a resubmit of
earlier versions. The "V3" in the cover letter is totally useless as
this is NOT recorded in patchwork.

Also, I think we disussed before NOT to cross-post between u-boot and
u-boot-dm, didn't we?

Normally, I would reject such a series for educational reasons. You
are lucky that I don't have time to do any reviews recently.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"Life, loathe it or ignore it, you can't like it."
- Marvin the paranoid android

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

* [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem
  2012-10-04 13:27     ` Wolfgang Denk
@ 2012-10-04 14:03       ` Marek Vasut
  0 siblings, 0 replies; 306+ messages in thread
From: Marek Vasut @ 2012-10-04 14:03 UTC (permalink / raw)
  To: u-boot

Dear Wolfgang Denk,

> Dear Marek Vasut,
> 
> In message <1348955586-7109-1-git-send-email-marex@denx.de> you wrote:
> > This patchset is a STAGE 1 of preparation of the stdio and serial subsys
> > for the driver model.
> 
> Formal complaint:
> 
> There is no change log.
> 
> Actually none of the patches has any marker that it is a resubmit of
> earlier versions. The "V3" in the cover letter is totally useless as
> this is NOT recorded in patchwork.

Yep, we made a formal agreement with Albert yesterday about learning patman ... 
so I did. Thus this one shall be the last troublesome patchset.

> Also, I think we disussed before NOT to cross-post between u-boot and
> u-boot-dm, didn't we?

I cross-posted only the cover letter to give others notification.

> Normally, I would reject such a series for educational reasons. You
> are lucky that I don't have time to do any reviews recently.
> 
> Best regards,
> 
> Wolfgang Denk

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 67/72] serial: Unconditionally enable CONFIG_SERIAL_MULTI
  2012-09-29 21:53     ` [U-Boot] [PATCH 67/72] serial: Unconditionally enable CONFIG_SERIAL_MULTI Marek Vasut
@ 2012-10-09 20:33       ` Stephen Warren
  2012-10-09 21:38         ` Tom Rini
  0 siblings, 1 reply; 306+ messages in thread
From: Stephen Warren @ 2012-10-09 20:33 UTC (permalink / raw)
  To: u-boot

On 09/29/2012 03:53 PM, Marek Vasut wrote:
> Enable CONFIG_SERIAL_MULTI for all builds of U-Boot. That includes
> both SPL builds and non-SPL builds, everything. To avoid poluting
> this patch with removal of ifdef-endif constructions containing
> CONFIG_SERIAL_MULTI, the CONFIG_SERIAL_MULTI is temporarily added
> into CPPFLAGS in config.mk . This will be again removed in following
> patch.

Marek,

This patch (at least, the version of it checked into u-boot/next) breaks
U-Boot on Tegra.

I believe the reason is because nothing ever calls serial_initialize()
in the SPL on Tegra. If I edit arch/arm/cpu/arm720t/tegra20/spl.c
function preloader_console_init() to call serial_initialize() right
before it calls serial_init(), then everything works fine. Without this,
drivers/serial/serial.c is never initialised (not even BSS cleared!) and
so it's left set to some bogus value, and so get_current() doesn't
replace it with default_serial_console(), so an invalid pointer is
accessed, causing a hang or crash.

I'm not sure quite what the correct solution is here. Is Tegra's custom
spl.c doing too much; stuff that should come from the common spl.c is
cut/paste here? Or, is adding the call to serial_initialize() the
correct fix? Or, is the root-cause of the problem that BSS
(serial_current) isn't being cleared to 0?

Thanks for any pointers.

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

* [U-Boot] [PATCH 67/72] serial: Unconditionally enable CONFIG_SERIAL_MULTI
  2012-10-09 20:33       ` Stephen Warren
@ 2012-10-09 21:38         ` Tom Rini
  2012-10-09 22:09           ` Stephen Warren
  0 siblings, 1 reply; 306+ messages in thread
From: Tom Rini @ 2012-10-09 21:38 UTC (permalink / raw)
  To: u-boot

On Tue, Oct 09, 2012 at 02:33:51PM -0600, Stephen Warren wrote:
> On 09/29/2012 03:53 PM, Marek Vasut wrote:
> > Enable CONFIG_SERIAL_MULTI for all builds of U-Boot. That includes
> > both SPL builds and non-SPL builds, everything. To avoid poluting
> > this patch with removal of ifdef-endif constructions containing
> > CONFIG_SERIAL_MULTI, the CONFIG_SERIAL_MULTI is temporarily added
> > into CPPFLAGS in config.mk . This will be again removed in following
> > patch.
> 
> Marek,
> 
> This patch (at least, the version of it checked into u-boot/next) breaks
> U-Boot on Tegra.
> 
> I believe the reason is because nothing ever calls serial_initialize()
> in the SPL on Tegra. If I edit arch/arm/cpu/arm720t/tegra20/spl.c
> function preloader_console_init() to call serial_initialize() right
> before it calls serial_init(), then everything works fine. Without this,
> drivers/serial/serial.c is never initialised (not even BSS cleared!) and
> so it's left set to some bogus value, and so get_current() doesn't
> replace it with default_serial_console(), so an invalid pointer is
> accessed, causing a hang or crash.
> 
> I'm not sure quite what the correct solution is here. Is Tegra's custom
> spl.c doing too much; stuff that should come from the common spl.c is
> cut/paste here? Or, is adding the call to serial_initialize() the
> correct fix? Or, is the root-cause of the problem that BSS
> (serial_current) isn't being cleared to 0?

Tegra SPL needs to either be updated ala common/spl/
(preloader_console_init() calls serial_init()) or switched over to
it.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20121009/2432dbde/attachment.pgp>

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

* [U-Boot] [PATCH 67/72] serial: Unconditionally enable CONFIG_SERIAL_MULTI
  2012-10-09 21:38         ` Tom Rini
@ 2012-10-09 22:09           ` Stephen Warren
  2012-10-09 22:13             ` Tom Rini
  0 siblings, 1 reply; 306+ messages in thread
From: Stephen Warren @ 2012-10-09 22:09 UTC (permalink / raw)
  To: u-boot

On 10/09/2012 03:38 PM, Tom Rini wrote:
> On Tue, Oct 09, 2012 at 02:33:51PM -0600, Stephen Warren wrote:
>> On 09/29/2012 03:53 PM, Marek Vasut wrote:
>>> Enable CONFIG_SERIAL_MULTI for all builds of U-Boot. That
>>> includes both SPL builds and non-SPL builds, everything. To
>>> avoid poluting this patch with removal of ifdef-endif
>>> constructions containing CONFIG_SERIAL_MULTI, the
>>> CONFIG_SERIAL_MULTI is temporarily added into CPPFLAGS in
>>> config.mk . This will be again removed in following patch.
>> 
>> Marek,
>> 
>> This patch (at least, the version of it checked into u-boot/next)
>> breaks U-Boot on Tegra.
>> 
>> I believe the reason is because nothing ever calls
>> serial_initialize() in the SPL on Tegra. If I edit
>> arch/arm/cpu/arm720t/tegra20/spl.c function
>> preloader_console_init() to call serial_initialize() right before
>> it calls serial_init(), then everything works fine. Without
>> this, drivers/serial/serial.c is never initialised (not even BSS
>> cleared!) and so it's left set to some bogus value, and so
>> get_current() doesn't replace it with default_serial_console(),
>> so an invalid pointer is accessed, causing a hang or crash.
>> 
>> I'm not sure quite what the correct solution is here. Is Tegra's
>> custom spl.c doing too much; stuff that should come from the
>> common spl.c is cut/paste here? Or, is adding the call to
>> serial_initialize() the correct fix? Or, is the root-cause of the
>> problem that BSS (serial_current) isn't being cleared to 0?
> 
> Tegra SPL needs to either be updated ala common/spl/ 
> (preloader_console_init() calls serial_init()) or switched over to 
> it.

Hmm, well it's already calling serial_init() just not
serial_initialize(). Perhaps the issue is the following code missing
from Tegra's SPL:

	/* Clear the BSS. */
	memset(__bss_start, 0, __bss_end__ - __bss_start);

Anyway, I'll let Allen take a look at it, since he's most familiar
with Tegra SPL.

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

* [U-Boot] [PATCH 67/72] serial: Unconditionally enable CONFIG_SERIAL_MULTI
  2012-10-09 22:09           ` Stephen Warren
@ 2012-10-09 22:13             ` Tom Rini
  2012-10-09 22:15               ` Stephen Warren
  0 siblings, 1 reply; 306+ messages in thread
From: Tom Rini @ 2012-10-09 22:13 UTC (permalink / raw)
  To: u-boot

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/09/12 15:09, Stephen Warren wrote:
> On 10/09/2012 03:38 PM, Tom Rini wrote:
>> On Tue, Oct 09, 2012 at 02:33:51PM -0600, Stephen Warren wrote:
>>> On 09/29/2012 03:53 PM, Marek Vasut wrote:
>>>> Enable CONFIG_SERIAL_MULTI for all builds of U-Boot. That 
>>>> includes both SPL builds and non-SPL builds, everything. To 
>>>> avoid poluting this patch with removal of ifdef-endif 
>>>> constructions containing CONFIG_SERIAL_MULTI, the 
>>>> CONFIG_SERIAL_MULTI is temporarily added into CPPFLAGS in 
>>>> config.mk . This will be again removed in following patch.
>>> 
>>> Marek,
>>> 
>>> This patch (at least, the version of it checked into
>>> u-boot/next) breaks U-Boot on Tegra.
>>> 
>>> I believe the reason is because nothing ever calls 
>>> serial_initialize() in the SPL on Tegra. If I edit 
>>> arch/arm/cpu/arm720t/tegra20/spl.c function 
>>> preloader_console_init() to call serial_initialize() right
>>> before it calls serial_init(), then everything works fine.
>>> Without this, drivers/serial/serial.c is never initialised (not
>>> even BSS cleared!) and so it's left set to some bogus value,
>>> and so get_current() doesn't replace it with
>>> default_serial_console(), so an invalid pointer is accessed,
>>> causing a hang or crash.
>>> 
>>> I'm not sure quite what the correct solution is here. Is
>>> Tegra's custom spl.c doing too much; stuff that should come
>>> from the common spl.c is cut/paste here? Or, is adding the call
>>> to serial_initialize() the correct fix? Or, is the root-cause
>>> of the problem that BSS (serial_current) isn't being cleared to
>>> 0?
>> 
>> Tegra SPL needs to either be updated ala common/spl/ 
>> (preloader_console_init() calls serial_init()) or switched over
>> to it.
> 
> Hmm, well it's already calling serial_init() just not 
> serial_initialize(). Perhaps the issue is the following code
> missing from Tegra's SPL:
> 
> /* Clear the BSS. */ memset(__bss_start, 0, __bss_end__ -
> __bss_start);
> 
> Anyway, I'll let Allen take a look at it, since he's most familiar 
> with Tegra SPL.

Yes, if SPL wasn't previously clearing the BSS, this would be a
problem now.

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQdKGaAAoJENk4IS6UOR1W3WcP/2d60PT9cL2Y0OauFG9/7gAD
PnrwKgTGWVD5wSb4bKNxb9abFSFhoeqn9BKxAYvAQ0TPXXaMgvYdHGOe9D422K1z
V76I3At84AYqXQq/3xeVTHzqK4on1H751e4einvbcd5IelkwMoKdA94Kufq1OdeD
MR5kXp1oyE11Ty9b/OZsDQlqczY8SG5x556+sO8FFa4yoQc82LF3x8ymL0R51wlB
D38/uqbvBPCYuE6H+GAawIW7L+SJjXhMaykTyUnNbb+tfvZYMt1IGFNMq2SsL75j
Kq7WuXGLb1UBB+ebFdlzPtuEtybtBjyhbqTBBu3ikKB7SLWG5ligGVbP5WVRFNuc
p3po82Wn4erzoX9y1e+LA/9Idhm8ttXZpbwFVqNc9DveJvTfItRV6A2jJWnhRfCp
SJqh10QCvlMOKdibB4j4f4aFAiR0Og2jOSlFHPfIidPXme/ZqqM5nhmN3WFW8acU
LvEimmz5XSeJ0Uosg39JtgoXPCJwKLG9px9wby5NjxbvavE7S4wHNs1h3tHo7B8e
D+csKIvoGJLiPKSr80xesv23JogHJab+37uj8Aazc/4R3GDgBeTChPvGuxsQBoeP
ZvlaD03SuyGbQ6kQJrCa9/VZS/HR2y0lFqEk0MTvwRh0mZCCR/N/nTSI/dss9rEG
uuYMDXwlIjZ0cY/ggIrv
=PNet
-----END PGP SIGNATURE-----

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

* [U-Boot] [PATCH 67/72] serial: Unconditionally enable CONFIG_SERIAL_MULTI
  2012-10-09 22:13             ` Tom Rini
@ 2012-10-09 22:15               ` Stephen Warren
  2012-10-09 22:21                 ` Allen Martin
  0 siblings, 1 reply; 306+ messages in thread
From: Stephen Warren @ 2012-10-09 22:15 UTC (permalink / raw)
  To: u-boot

On 10/09/2012 04:13 PM, Tom Rini wrote:
> On 10/09/12 15:09, Stephen Warren wrote:
>> On 10/09/2012 03:38 PM, Tom Rini wrote:
>>> On Tue, Oct 09, 2012 at 02:33:51PM -0600, Stephen Warren wrote:
>>>> On 09/29/2012 03:53 PM, Marek Vasut wrote:
>>>>> Enable CONFIG_SERIAL_MULTI for all builds of U-Boot. That 
>>>>> includes both SPL builds and non-SPL builds, everything. To 
>>>>> avoid poluting this patch with removal of ifdef-endif 
>>>>> constructions containing CONFIG_SERIAL_MULTI, the 
>>>>> CONFIG_SERIAL_MULTI is temporarily added into CPPFLAGS in 
>>>>> config.mk . This will be again removed in following patch.
>>>>
>>>> Marek,
>>>>
>>>> This patch (at least, the version of it checked into
>>>> u-boot/next) breaks U-Boot on Tegra.
>>>>
>>>> I believe the reason is because nothing ever calls 
>>>> serial_initialize() in the SPL on Tegra. If I edit 
>>>> arch/arm/cpu/arm720t/tegra20/spl.c function 
>>>> preloader_console_init() to call serial_initialize() right
>>>> before it calls serial_init(), then everything works fine.
>>>> Without this, drivers/serial/serial.c is never initialised (not
>>>> even BSS cleared!) and so it's left set to some bogus value,
>>>> and so get_current() doesn't replace it with
>>>> default_serial_console(), so an invalid pointer is accessed,
>>>> causing a hang or crash.
>>>>
>>>> I'm not sure quite what the correct solution is here. Is
>>>> Tegra's custom spl.c doing too much; stuff that should come
>>>> from the common spl.c is cut/paste here? Or, is adding the call
>>>> to serial_initialize() the correct fix? Or, is the root-cause
>>>> of the problem that BSS (serial_current) isn't being cleared to
>>>> 0?
>>>
>>> Tegra SPL needs to either be updated ala common/spl/ 
>>> (preloader_console_init() calls serial_init()) or switched over
>>> to it.
> 
>> Hmm, well it's already calling serial_init() just not 
>> serial_initialize(). Perhaps the issue is the following code
>> missing from Tegra's SPL:
> 
>> /* Clear the BSS. */ memset(__bss_start, 0, __bss_end__ -
>> __bss_start);
> 
>> Anyway, I'll let Allen take a look at it, since he's most familiar 
>> with Tegra SPL.
> 
> Yes, if SPL wasn't previously clearing the BSS, this would be a
> problem now.

It was at least at some point in time; Tegra's spl.c does:

>         /*
>          * We call relocate_code() with relocation target same as the
>          * CONFIG_SYS_SPL_TEXT_BASE. This will result in relocation getting
>          * skipped. Instead, only .bss initialization will happen. That's
>          * all we need
>          */
>         debug(">>board_init_f()\n");
>         relocate_code(CONFIG_SPL_STACK, &gdata, CONFIG_SPL_TEXT_BASE);

Perhaps that call doesn't clear BSS any more?

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

* [U-Boot] [PATCH 67/72] serial: Unconditionally enable CONFIG_SERIAL_MULTI
  2012-10-09 22:15               ` Stephen Warren
@ 2012-10-09 22:21                 ` Allen Martin
  0 siblings, 0 replies; 306+ messages in thread
From: Allen Martin @ 2012-10-09 22:21 UTC (permalink / raw)
  To: u-boot

On Tue, Oct 09, 2012 at 03:15:40PM -0700, Stephen Warren wrote:
> On 10/09/2012 04:13 PM, Tom Rini wrote:
> > On 10/09/12 15:09, Stephen Warren wrote:
> >> On 10/09/2012 03:38 PM, Tom Rini wrote:
> >>> On Tue, Oct 09, 2012 at 02:33:51PM -0600, Stephen Warren wrote:
> >>>> On 09/29/2012 03:53 PM, Marek Vasut wrote:
> >>>>> Enable CONFIG_SERIAL_MULTI for all builds of U-Boot. That 
> >>>>> includes both SPL builds and non-SPL builds, everything. To 
> >>>>> avoid poluting this patch with removal of ifdef-endif 
> >>>>> constructions containing CONFIG_SERIAL_MULTI, the 
> >>>>> CONFIG_SERIAL_MULTI is temporarily added into CPPFLAGS in 
> >>>>> config.mk . This will be again removed in following patch.
> >>>>
> >>>> Marek,
> >>>>
> >>>> This patch (at least, the version of it checked into
> >>>> u-boot/next) breaks U-Boot on Tegra.
> >>>>
> >>>> I believe the reason is because nothing ever calls 
> >>>> serial_initialize() in the SPL on Tegra. If I edit 
> >>>> arch/arm/cpu/arm720t/tegra20/spl.c function 
> >>>> preloader_console_init() to call serial_initialize() right
> >>>> before it calls serial_init(), then everything works fine.
> >>>> Without this, drivers/serial/serial.c is never initialised (not
> >>>> even BSS cleared!) and so it's left set to some bogus value,
> >>>> and so get_current() doesn't replace it with
> >>>> default_serial_console(), so an invalid pointer is accessed,
> >>>> causing a hang or crash.
> >>>>
> >>>> I'm not sure quite what the correct solution is here. Is
> >>>> Tegra's custom spl.c doing too much; stuff that should come
> >>>> from the common spl.c is cut/paste here? Or, is adding the call
> >>>> to serial_initialize() the correct fix? Or, is the root-cause
> >>>> of the problem that BSS (serial_current) isn't being cleared to
> >>>> 0?
> >>>
> >>> Tegra SPL needs to either be updated ala common/spl/ 
> >>> (preloader_console_init() calls serial_init()) or switched over
> >>> to it.
> > 
> >> Hmm, well it's already calling serial_init() just not 
> >> serial_initialize(). Perhaps the issue is the following code
> >> missing from Tegra's SPL:
> > 
> >> /* Clear the BSS. */ memset(__bss_start, 0, __bss_end__ -
> >> __bss_start);
> > 
> >> Anyway, I'll let Allen take a look at it, since he's most familiar 
> >> with Tegra SPL.
> > 
> > Yes, if SPL wasn't previously clearing the BSS, this would be a
> > problem now.
> 
> It was at least at some point in time; Tegra's spl.c does:
> 
> >         /*
> >          * We call relocate_code() with relocation target same as the
> >          * CONFIG_SYS_SPL_TEXT_BASE. This will result in relocation getting
> >          * skipped. Instead, only .bss initialization will happen. That's
> >          * all we need
> >          */
> >         debug(">>board_init_f()\n");
> >         relocate_code(CONFIG_SPL_STACK, &gdata, CONFIG_SPL_TEXT_BASE);
> 
> Perhaps that call doesn't clear BSS any more?

The clear_bss() in arm720t/start.S is surrounded by "#ifndef
CONFIG_SPL_BUILD".  It was probably removed long ago, I just never
noticed because nothing in SPL was using any globals.

Moving to common spl.c definately seems like the right thing to do to
avoid this type of thing.  I'll work on it, but it probably won't be
until next week, is that ok?

-Allen

-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

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

end of thread, other threads:[~2012-10-09 22:21 UTC | newest]

Thread overview: 306+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-16 23:20 [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 01/71] serial: Coding style cleanup of struct serial_device Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 02/71] serial: Rename .init() and .uninit() in serial_device Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 03/71] serial: Properly spell out the structure member names of serial_driver Marek Vasut
2012-09-18  6:13   ` Michal Simek
2012-09-16 23:20 ` [U-Boot] [PATCH 04/71] serial: pxa: Implement default_serial_console in serial_pxa.c Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 05/71] serial: pxa: Make use of default_serial_console in serial_pxa Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 06/71] serial: pxa: Make local functions static Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 07/71] serial: mpc512x: Properly define CONFIG_SYS_PSC3 in config files Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 08/71] serial: Implement serial_initfunc() macro Marek Vasut
2012-09-18 17:31   ` Tom Rini
2012-09-18 17:57     ` Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 09/71] serial: mpc8xx: Move serial registration from serial_initialize() Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 10/71] serial: s3c24xx: " Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 11/71] serial: pxa: " Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 12/71] serial: s5p: " Marek Vasut
2012-09-18  1:28   ` Minkyu Kang
2012-09-16 23:20 ` [U-Boot] [PATCH 13/71] serial: microblaze: " Marek Vasut
2012-09-18  6:14   ` Michal Simek
2012-09-16 23:20 ` [U-Boot] [PATCH 14/71] serial: mpc512x: " Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 15/71] serial: ns16550: " Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 16/71] serial: bfin: Remove the bfin_serialN_device exports from serial.h Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 17/71] serial: bfin: Adjust serial_register_bfin_uart() Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 18/71] serial: zoom2: Remove zoom2 serial prototypes from serial.h Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 19/71] serial: bfin: Flip the jtag serial console to CONFIG_SERIAL_MULTI Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 20/71] serial: mips: Implement CONFIG_SERIAL_MULTI into au1x00 serial driver Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 21/71] serial: mips: Implement CONFIG_SERIAL_MULTI into asc " Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 22/71] serial: mips: Implement CONFIG_SERIAL_MULTI into JZ " Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 23/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc5xx " Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 24/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8220 " Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 25/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8260 serial drivers Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 26/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc85xx serial driver Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 27/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into iop480 " Marek Vasut
2012-09-19 10:59   ` Stefan Roese
2012-09-16 23:20 ` [U-Boot] [PATCH 28/71] serial: sparc: Implement CONFIG_SERIAL_MULTI into leon2 " Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 29/71] serial: sparc: Implement CONFIG_SERIAL_MULTI into leon3 " Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 30/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into marvell " Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 31/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into amirix " Marek Vasut
2012-09-19 11:05   ` Stefan Roese
2012-09-19 11:27     ` Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 32/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw " Marek Vasut
2012-09-19 11:09   ` Stefan Roese
2012-09-19 11:28     ` Marek Vasut
2012-09-19 11:32       ` Stefan Roese
2012-09-19 17:43         ` Tom Rini
2012-09-19 19:32           ` Marek Vasut
2012-09-19 22:37             ` Tom Rini
2012-09-19 22:43               ` Marek Vasut
2012-09-19 22:49               ` Graeme Russ
2012-09-19 22:57                 ` Marek Vasut
2012-09-19 23:03                   ` Scott Wood
2012-09-19 23:05                     ` Marek Vasut
2012-09-19 23:10                       ` Scott Wood
2012-09-19 23:13                         ` Marek Vasut
2012-09-19 23:05                     ` Graeme Russ
2012-09-19 23:08                       ` Marek Vasut
2012-09-19 23:05                   ` Graeme Russ
2012-09-19 23:07                     ` Marek Vasut
2012-09-19 23:16                 ` Tom Rini
2012-09-16 23:20 ` [U-Boot] [PATCH 33/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into cogent " Marek Vasut
2012-09-16 23:20 ` [U-Boot] [PATCH 34/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into cpci750 " Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 35/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into evb64260 " Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 36/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into ml2 " Marek Vasut
2012-09-19 11:21   ` Stefan Roese
2012-09-16 23:21 ` [U-Boot] [PATCH 37/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into sconsole " Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 38/71] serial: powerpc: Implement CONFIG_SERIAL_MULTI into p3mx " Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 39/71] serial: arm: Implement CONFIG_SERIAL_MULTI into altera_jtag " Marek Vasut
2012-10-01 12:33   ` Thomas Chou
2012-10-01 14:41     ` Marek Vasut
2012-10-02  7:55       ` Thomas Chou
2012-10-02 10:07         ` Marek Vasut
2012-10-01 14:45   ` [U-Boot] [PATCH 39/72 V2] " Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 40/71] serial: arm: Implement CONFIG_SERIAL_MULTI into altera " Marek Vasut
2012-10-01 12:31   ` Thomas Chou
2012-10-01 14:46     ` Marek Vasut
2012-10-01 14:46   ` [U-Boot] [PATCH 40/72 V2] " Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 41/71] serial: arm: Implement CONFIG_SERIAL_MULTI into atmel " Marek Vasut
2012-09-17  6:51   ` Andreas Bießmann
2012-09-17 10:00     ` Marek Vasut
2012-09-17 10:21       ` Andreas Bießmann
2012-09-17 10:30         ` Marek Vasut
2012-09-18 23:45   ` Andreas Bießmann
2012-09-16 23:21 ` [U-Boot] [PATCH 42/71] serial: arm: Implement CONFIG_SERIAL_MULTI into lpc32xx " Marek Vasut
2012-09-17 22:28   ` Vladimir Zapolskiy
2012-09-16 23:21 ` [U-Boot] [PATCH 43/71] serial: mcf: Implement CONFIG_SERIAL_MULTI into MCF " Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 44/71] serial: Implement CONFIG_SERIAL_MULTI into ns9750 " Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 45/71] serial: oc: Implement CONFIG_SERIAL_MULTI into OpenCores " Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 46/71] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c4510b " Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 47/71] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c64xx " Marek Vasut
2012-09-18  1:30   ` Minkyu Kang
2012-09-16 23:21 ` [U-Boot] [PATCH 48/71] serial: sandbox: Implement CONFIG_SERIAL_MULTI into sandbox " Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 49/71] serial: arm: Implement CONFIG_SERIAL_MULTI into clps7111 " Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 50/71] serial: arm: Implement CONFIG_SERIAL_MULTI into imx " Marek Vasut
2012-09-17 13:58   ` Stefano Babic
2012-09-17 14:02     ` Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 51/71] serial: arm: Implement CONFIG_SERIAL_MULTI into ixp " Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 52/71] serial: arm: Implement CONFIG_SERIAL_MULTI into ks8695 " Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 53/71] serial: arm: Implement CONFIG_SERIAL_MULTI into lh7a40x " Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 54/71] serial: arm: Implement CONFIG_SERIAL_MULTI into lpc2292 " Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 55/71] serial: Implement CONFIG_SERIAL_MULTI into max3100 " Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 56/71] serial: arm: Implement CONFIG_SERIAL_MULTI into mxc " Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 57/71] serial: arm: Implement CONFIG_SERIAL_MULTI into netarm " Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 58/71] serial: arm: Implement CONFIG_SERIAL_MULTI into pl01x " Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 59/71] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c44b0 " Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 60/71] serial: arm: Implement CONFIG_SERIAL_MULTI into sa1100 " Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 61/71] serial: sh: Implement CONFIG_SERIAL_MULTI into sh " Marek Vasut
2012-09-18  1:01   ` Nobuhiro Iwamatsu
2012-09-16 23:21 ` [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL Marek Vasut
2012-09-18 17:05   ` Tom Rini
2012-09-18 17:13     ` Marek Vasut
2012-09-18 17:46       ` Scott Wood
2012-09-18 18:03         ` Marek Vasut
2012-09-18 18:25           ` Scott Wood
2012-09-18 18:33             ` Marek Vasut
2012-09-18 18:39               ` Tom Rini
2012-09-18 18:54                 ` Marek Vasut
2012-09-18 19:19                 ` Marek Vasut
2012-09-18 19:23                   ` Tom Rini
2012-09-18 19:25                     ` Marek Vasut
2012-09-18 20:50                       ` Tom Rini
2012-09-18 21:19                         ` Marek Vasut
2012-09-18 21:51                           ` Scott Wood
2012-09-19  6:12                             ` Stefan Roese
2012-09-19 19:14                               ` Scott Wood
2012-09-18 22:16                         ` Marek Vasut
2012-09-18 19:23               ` Scott Wood
2012-09-18 19:24                 ` Marek Vasut
2012-09-18 17:53       ` Tom Rini
2012-09-18 18:01         ` Marek Vasut
2012-09-18 18:08           ` Tom Rini
2012-09-18 18:24             ` Marek Vasut
2012-09-18 18:34               ` Tom Rini
2012-09-16 23:21 ` [U-Boot] [PATCH 63/71] serial: mxs: spl: Remove empty serial_* functions from SPL code Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 64/71] serial: ns16550: Call usbtty_poll only in non-SPL build Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 65/71] serial: Use puts() and hang() instead of panic() in SPL Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 66/71] serial: Unconditionally enable CONFIG_SERIAL_MULTI Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 67/71] serial: Remove CONFIG_SERIAL_MULTI from config files Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 68/71] serial: Remove CONFIG_SERIAL_MULTI from serial drivers Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 69/71] serial: Remove CONFIG_SERIAL_MULTI from remaining sources Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 70/71] serial: Compile common/serial.c by default Marek Vasut
2012-09-16 23:21 ` [U-Boot] [PATCH 71/71] serial: Enhance the manual relocation Marek Vasut
2012-09-17 22:52 ` [U-Boot] [PATCH 00/71] serial: Massive rework of the serial subsystem Tom Rini
2012-09-17 23:12   ` Marek Vasut
2012-09-18 16:42     ` Tom Rini
2012-09-18 17:11       ` Marek Vasut
2012-09-29  0:30 ` [U-Boot] [PATCH 00/70 V2] " Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 01/70] serial: Coding style cleanup of struct serial_device Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 02/70] serial: Rename .init() and .uninit() in serial_device Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 03/70] serial: Properly spell out the structure member names of serial_driver Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 04/70] serial: pxa: Implement default_serial_console in serial_pxa.c Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 05/70] serial: pxa: Make use of default_serial_console in serial_pxa Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 06/70] serial: pxa: Make local functions static Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 07/70] serial: mpc512x: Properly define CONFIG_SYS_PSC3 in config files Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 08/70] serial: Implement serial_initfunc() macro Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 09/70] serial: mpc8xx: Move serial registration from serial_initialize() Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 10/70] serial: s3c24xx: " Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 11/70] serial: pxa: " Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 12/70] serial: s5p: " Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 13/70] serial: microblaze: " Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 14/70] serial: mpc512x: " Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 15/70] serial: ns16550: " Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 16/70] serial: bfin: Remove the bfin_serialN_device exports from serial.h Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 17/70] serial: bfin: Adjust serial_register_bfin_uart() Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 18/70] serial: zoom2: Remove zoom2 serial prototypes from serial.h Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 19/70] serial: bfin: Flip the jtag serial console to CONFIG_SERIAL_MULTI Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 20/70] serial: mips: Implement CONFIG_SERIAL_MULTI into au1x00 serial driver Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 21/70] serial: mips: Implement CONFIG_SERIAL_MULTI into asc " Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 22/70] serial: mips: Implement CONFIG_SERIAL_MULTI into JZ " Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 23/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc5xx " Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 24/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8220 " Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 25/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8260 serial drivers Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 26/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc85xx serial driver Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 27/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into iop480 " Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 28/70] serial: sparc: Implement CONFIG_SERIAL_MULTI into leon2 " Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 29/70] serial: sparc: Implement CONFIG_SERIAL_MULTI into leon3 " Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 30/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into marvell " Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 31/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into amirix " Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 32/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw " Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 33/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into cogent " Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 34/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into cpci750 " Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 35/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into evb64260 " Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 36/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into ml2 " Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 37/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into sconsole " Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 38/70] serial: powerpc: Implement CONFIG_SERIAL_MULTI into p3mx " Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 39/70] serial: arm: Implement CONFIG_SERIAL_MULTI into altera_jtag " Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 40/70] serial: arm: Implement CONFIG_SERIAL_MULTI into altera " Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 41/70] serial: arm: Implement CONFIG_SERIAL_MULTI into atmel " Marek Vasut
2012-09-29  0:30   ` [U-Boot] [PATCH 42/70] serial: arm: Implement CONFIG_SERIAL_MULTI into lpc32xx " Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 43/70] serial: mcf: Implement CONFIG_SERIAL_MULTI into MCF " Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 44/70] serial: Implement CONFIG_SERIAL_MULTI into ns9750 " Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 45/70] serial: oc: Implement CONFIG_SERIAL_MULTI into OpenCores " Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 46/70] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c4510b " Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 47/70] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c64xx " Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 48/70] serial: sandbox: Implement CONFIG_SERIAL_MULTI into sandbox " Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 49/70] serial: arm: Implement CONFIG_SERIAL_MULTI into clps7111 " Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 50/70] serial: arm: Implement CONFIG_SERIAL_MULTI into imx " Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 51/70] serial: arm: Implement CONFIG_SERIAL_MULTI into ixp " Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 52/70] serial: arm: Implement CONFIG_SERIAL_MULTI into ks8695 " Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 53/70] serial: arm: Implement CONFIG_SERIAL_MULTI into lh7a40x " Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 54/70] serial: arm: Implement CONFIG_SERIAL_MULTI into lpc2292 " Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 55/70] serial: Implement CONFIG_SERIAL_MULTI into max3100 " Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 56/70] serial: arm: Implement CONFIG_SERIAL_MULTI into mxc " Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 57/70] serial: arm: Implement CONFIG_SERIAL_MULTI into netarm " Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 58/70] serial: arm: Implement CONFIG_SERIAL_MULTI into pl01x " Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 59/70] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c44b0 " Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 60/70] serial: arm: Implement CONFIG_SERIAL_MULTI into sa1100 " Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 61/70] serial: sh: Implement CONFIG_SERIAL_MULTI into sh " Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 62/70] serial: mxs: spl: Remove empty serial_* functions from SPL code Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 63/70] serial: ns16550: Call usbtty_poll only in non-SPL build Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 64/70] serial: Use puts() and hang() instead of panic() in SPL Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 65/70] serial: Unconditionally enable CONFIG_SERIAL_MULTI Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 66/70] serial: Remove CONFIG_SERIAL_MULTI from config files Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 67/70] serial: Remove CONFIG_SERIAL_MULTI from serial drivers Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 68/70] serial: Remove CONFIG_SERIAL_MULTI from remaining sources Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 69/70] serial: Compile common/serial.c by default Marek Vasut
2012-09-29  0:31   ` [U-Boot] [PATCH 70/70] serial: Enhance the manual relocation Marek Vasut
2012-09-29 21:51   ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Marek Vasut
2012-09-29 21:51     ` [U-Boot] [PATCH 01/72] serial: Coding style cleanup of struct serial_device Marek Vasut
2012-09-29 21:51     ` [U-Boot] [PATCH 02/72] serial: Rename .init() and .uninit() in serial_device Marek Vasut
2012-09-29 21:51     ` [U-Boot] [PATCH 03/72] serial: Properly spell out the structure member names of serial_driver Marek Vasut
2012-09-29 21:51     ` [U-Boot] [PATCH 04/72] serial: pxa: Implement default_serial_console in serial_pxa.c Marek Vasut
2012-09-29 21:51     ` [U-Boot] [PATCH 05/72] serial: pxa: Make use of default_serial_console in serial_pxa Marek Vasut
2012-09-29 21:51     ` [U-Boot] [PATCH 06/72] serial: pxa: Make local functions static Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 07/72] serial: mpc512x: Properly define CONFIG_SYS_PSC3 in config files Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 08/72] serial: Implement serial_initfunc() macro Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 09/72] serial: mpc8xx: Move serial registration from serial_initialize() Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 10/72] serial: s3c24xx: " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 11/72] serial: pxa: " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 12/72] serial: s5p: " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 13/72] serial: microblaze: " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 14/72] serial: mpc512x: " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 15/72] serial: ns16550: " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 16/72] serial: bfin: Remove the bfin_serialN_device exports from serial.h Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 17/72] serial: bfin: Adjust serial_register_bfin_uart() Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 18/72] serial: zoom2: Remove zoom2 serial prototypes from serial.h Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 19/72] serial: bfin: Flip the jtag serial console to CONFIG_SERIAL_MULTI Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 20/72] serial: mips: Implement CONFIG_SERIAL_MULTI into au1x00 serial driver Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 21/72] serial: mips: Implement CONFIG_SERIAL_MULTI into asc " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 22/72] serial: mips: Implement CONFIG_SERIAL_MULTI into JZ " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 23/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc5xx " Marek Vasut
2012-10-02  7:07       ` [U-Boot] [PATCH 23/72 V2] " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 24/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8220 " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 25/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc8260 serial drivers Marek Vasut
2012-10-01 23:22       ` [U-Boot] [PATCH 25/72 V2] " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 26/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into mpc85xx serial driver Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 27/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into iop480 " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 28/72] serial: sparc: Implement CONFIG_SERIAL_MULTI into leon2 " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 29/72] serial: sparc: Implement CONFIG_SERIAL_MULTI into leon3 " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 30/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into marvell " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 31/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into amirix " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 32/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into bmw " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 33/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into cogent " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 34/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into cpci750 " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 35/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into evb64260 " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 36/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into ml2 " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 37/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into sconsole " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 38/72] serial: powerpc: Implement CONFIG_SERIAL_MULTI into p3mx " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 39/72] serial: arm: Implement CONFIG_SERIAL_MULTI into altera_jtag " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 40/72] serial: arm: Implement CONFIG_SERIAL_MULTI into altera " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 41/72] serial: arm: Implement CONFIG_SERIAL_MULTI into atmel " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 42/72] serial: arm: Implement CONFIG_SERIAL_MULTI into lpc32xx " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 43/72] serial: mcf: Implement CONFIG_SERIAL_MULTI into MCF " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 44/72] serial: Implement CONFIG_SERIAL_MULTI into ns9750 " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 45/72] serial: oc: Implement CONFIG_SERIAL_MULTI into OpenCores " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 46/72] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c4510b " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 47/72] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c64xx " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 48/72] serial: sandbox: Implement CONFIG_SERIAL_MULTI into sandbox " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 49/72] serial: arm: Implement CONFIG_SERIAL_MULTI into clps7111 " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 50/72] serial: arm: Implement CONFIG_SERIAL_MULTI into imx " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 51/72] serial: arm: Implement CONFIG_SERIAL_MULTI into ixp " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 52/72] serial: arm: Implement CONFIG_SERIAL_MULTI into ks8695 " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 53/72] serial: arm: Implement CONFIG_SERIAL_MULTI into lh7a40x " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 54/72] serial: arm: Implement CONFIG_SERIAL_MULTI into lpc2292 " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 55/72] serial: Implement CONFIG_SERIAL_MULTI into max3100 " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 56/72] serial: arm: Implement CONFIG_SERIAL_MULTI into mxc " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 57/72] serial: arm: Implement CONFIG_SERIAL_MULTI into netarm " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 58/72] serial: arm: Implement CONFIG_SERIAL_MULTI into pl01x " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 59/72] serial: arm: Implement CONFIG_SERIAL_MULTI into s3c44b0 " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 60/72] serial: arm: Implement CONFIG_SERIAL_MULTI into sa1100 " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 61/72] serial: sh: Implement CONFIG_SERIAL_MULTI into sh " Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 62/72] serial: mxs: spl: Remove empty serial_* functions from SPL code Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 63/72] serial: Use puts() and hang() instead of panic() in SPL Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 64/72] serial: ns16550: Call usbtty_poll only in non-SPL build Marek Vasut
2012-09-29 21:52     ` [U-Boot] [PATCH 65/72] serial: ns16550: Rename serial.c to serial_ns16550.c Marek Vasut
2012-09-30  8:52       ` Michal Simek
2012-09-30 13:22         ` Marek Vasut
2012-10-01 16:49         ` Marek Vasut
2012-10-01 16:52       ` Tom Rini
2012-10-02  7:29         ` Michal Simek
2012-09-29 21:52     ` [U-Boot] [PATCH 66/72] serial: Move common/serial.c to drivers/serial/ Marek Vasut
2012-09-29 21:53     ` [U-Boot] [PATCH 67/72] serial: Unconditionally enable CONFIG_SERIAL_MULTI Marek Vasut
2012-10-09 20:33       ` Stephen Warren
2012-10-09 21:38         ` Tom Rini
2012-10-09 22:09           ` Stephen Warren
2012-10-09 22:13             ` Tom Rini
2012-10-09 22:15               ` Stephen Warren
2012-10-09 22:21                 ` Allen Martin
2012-09-29 21:53     ` [U-Boot] [PATCH 68/72] serial: Remove CONFIG_SERIAL_MULTI from config files Marek Vasut
2012-09-29 21:53     ` [U-Boot] [PATCH 69/72] serial: Remove CONFIG_SERIAL_MULTI from serial drivers Marek Vasut
2012-09-29 21:53     ` [U-Boot] [PATCH 70/72] serial: Remove CONFIG_SERIAL_MULTI from remaining sources Marek Vasut
2012-10-01 23:34       ` [U-Boot] [PATCH 70/72 V2] " Marek Vasut
2012-09-29 21:53     ` [U-Boot] [PATCH 71/72] serial: Compile drivers/serial/serial.c by default Marek Vasut
2012-09-29 21:53     ` [U-Boot] [PATCH 72/72] serial: Enhance the manual relocation Marek Vasut
2012-10-02 18:04     ` [U-Boot] [PATCH 00/72 V3] serial: Massive rework of the serial subsystem Tom Rini
2012-10-04 13:27     ` Wolfgang Denk
2012-10-04 14:03       ` Marek Vasut

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