All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] MX: serial_mxc: cleanup removing nasty #ifdef
Date: Tue, 22 Nov 2011 19:06:36 +0100	[thread overview]
Message-ID: <201111221906.39243.marek.vasut@gmail.com> (raw)
In-Reply-To: <1321977108-21243-1-git-send-email-sbabic@denx.de>

> The serial driver for iMX SOCs is continuosly changed if a
> new SOC or not yet used port is used. CONFIG_SYS_<SOC>_<UART Port>
> defines were used only to find the base address for the selected UART.
> Instead of that, move the base address to the board configuration
> file and drop all #ifdef from driver.
> 
> Signed-off-by: Stefano Babic <sbabic@denx.de>
> CC: Marek Vasut <marek.vasut@gmail.com>
> CC: Wolfgang Denk <wd@denx.de>
> CC: Fabio Estevam <fabio.estevam@freescale.com>
> CC: Helmut Raiger <helmut.raiger@hale.at>
> CC: John Rigby <jcrigby@gmail.com>
> CC: Matthias Weisser <weisserm@arcor.de>
> CC: Jason Liu <jason.hui@linaro.org>
> ---
>  arch/arm/cpu/arm1136/mx31/devices.c       |    4 ---
>  arch/arm/include/asm/arch-mx25/imx-regs.h |   10 ++++----
>  arch/arm/include/asm/arch-mx27/imx-regs.h |    8 +++---
>  arch/arm/include/asm/arch-mx31/imx-regs.h |    6 ++++
>  arch/arm/include/asm/arch-mx35/imx-regs.h |    6 ++--
>  arch/arm/include/asm/arch-mx5/imx-regs.h  |    6 ++--
>  drivers/serial/serial_mxc.c               |   37
> +++------------------------- include/configs/efikamx.h                 |  
>  2 +-
>  include/configs/flea3.h                   |    2 +-
>  include/configs/imx27lite-common.h        |    2 +-
>  include/configs/imx31_litekit.h           |    4 +-
>  include/configs/imx31_phycore.h           |    2 +-
>  include/configs/mx25pdk.h                 |    2 +-
>  include/configs/mx31ads.h                 |    4 +-
>  include/configs/mx31pdk.h                 |    2 +-
>  include/configs/mx35pdk.h                 |    2 +-
>  include/configs/mx51evk.h                 |    2 +-
>  include/configs/mx53ard.h                 |    2 +-
>  include/configs/mx53evk.h                 |    2 +-
>  include/configs/mx53loco.h                |    2 +-
>  include/configs/mx53smd.h                 |    2 +-
>  include/configs/qong.h                    |    4 +-
>  include/configs/tt01.h                    |    2 +-
>  include/configs/tx25.h                    |    2 +-
>  include/configs/vision2.h                 |    2 +-
>  include/configs/zmx25.h                   |    2 +-
>  26 files changed, 47 insertions(+), 74 deletions(-)
> 

I'm definitelly not against such cleanup!

> diff --git a/arch/arm/cpu/arm1136/mx31/devices.c
> b/arch/arm/cpu/arm1136/mx31/devices.c index b42dac3..2ebee2e 100644
> --- a/arch/arm/cpu/arm1136/mx31/devices.c
> +++ b/arch/arm/cpu/arm1136/mx31/devices.c
> @@ -27,7 +27,6 @@
>  #include <asm/arch/imx-regs.h>
>  #include <asm/arch/clock.h>
> 
> -#ifdef CONFIG_SYS_MX31_UART1
>  void mx31_uart1_hw_init(void)
>  {
>  	/* setup pins for UART1 */
> @@ -36,9 +35,7 @@ void mx31_uart1_hw_init(void)
>  	mx31_gpio_mux(MUX_RTS1__UART1_RTS_B);
>  	mx31_gpio_mux(MUX_CTS1__UART1_CTS_B);
>  }
> -#endif
> 
> -#ifdef CONFIG_SYS_MX31_UART2
>  void mx31_uart2_hw_init(void)
>  {
>  	/* setup pins for UART2 */
> @@ -47,7 +44,6 @@ void mx31_uart2_hw_init(void)
>  	mx31_gpio_mux(MUX_RTS2__UART2_RTS_B);
>  	mx31_gpio_mux(MUX_CTS2__UART2_CTS_B);
>  }
> -#endif

Maybe the MUX should be abstracted into CPU-files in arch/arm/.... ?

> 
>  #ifdef CONFIG_MXC_SPI
>  /*
> diff --git a/arch/arm/include/asm/arch-mx25/imx-regs.h
> b/arch/arm/include/asm/arch-mx25/imx-regs.h index eece138..7f9449b 100644
> --- a/arch/arm/include/asm/arch-mx25/imx-regs.h
> +++ b/arch/arm/include/asm/arch-mx25/imx-regs.h
> @@ -180,8 +180,8 @@ struct aips_regs {
>  #define IMX_I2C3_BASE		(0x43F84000)
>  #define IMX_CAN1_BASE		(0x43F88000)
>  #define IMX_CAN2_BASE		(0x43F8C000)
> -#define IMX_UART1_BASE		(0x43F90000)
> -#define IMX_UART2_BASE		(0x43F94000)
> +#define UART1_BASE		(0x43F90000)
> +#define UART2_BASE		(0x43F94000)
>  #define IMX_I2C2_BASE		(0x43F98000)
>  #define IMX_OWIRE_BASE		(0x43F9C000)
>  #define IMX_CSPI1_BASE		(0x43FA4000)
> @@ -197,15 +197,15 @@ struct aips_regs {
>  /* SPBA */
>  #define IMX_SPBA_BASE		(0x50000000)
>  #define IMX_CSPI3_BASE		(0x50004000)
> -#define IMX_UART4_BASE		(0x50008000)
> -#define IMX_UART3_BASE		(0x5000C000)
> +#define UART4_BASE		(0x50008000)
> +#define UART3_BASE		(0x5000C000)
>  #define IMX_CSPI2_BASE		(0x50010000)
>  #define IMX_SSI2_BASE		(0x50014000)
>  #define IMX_ESAI_BASE		(0x50018000)
>  #define IMX_ATA_DMA_BASE	(0x50020000)
>  #define IMX_SIM1_BASE		(0x50024000)
>  #define IMX_SIM2_BASE		(0x50028000)
> -#define IMX_UART5_BASE		(0x5002C000)
> +#define UART5_BASE		(0x5002C000)
>  #define IMX_TSC_BASE		(0x50030000)
>  #define IMX_SSI1_BASE		(0x50034000)
>  #define IMX_FEC_BASE		(0x50038000)

The parenthesis should go too ...

> diff --git a/arch/arm/include/asm/arch-mx27/imx-regs.h
> b/arch/arm/include/asm/arch-mx27/imx-regs.h index 83ab216..ced5b2a 100644
> --- a/arch/arm/include/asm/arch-mx27/imx-regs.h
> +++ b/arch/arm/include/asm/arch-mx27/imx-regs.h
> @@ -224,10 +224,10 @@ struct fuse_bank0_regs {
>  #define IMX_TIM1_BASE		(0x03000 + IMX_IO_BASE)
>  #define IMX_TIM2_BASE		(0x04000 + IMX_IO_BASE)
>  #define IMX_TIM3_BASE		(0x05000 + IMX_IO_BASE)
> -#define IMX_UART1_BASE		(0x0a000 + IMX_IO_BASE)
> -#define IMX_UART2_BASE		(0x0b000 + IMX_IO_BASE)
> -#define IMX_UART3_BASE		(0x0c000 + IMX_IO_BASE)
> -#define IMX_UART4_BASE		(0x0d000 + IMX_IO_BASE)
> +#define UART1_BASE		(0x0a000 + IMX_IO_BASE)
> +#define UART2_BASE		(0x0b000 + IMX_IO_BASE)
> +#define UART3_BASE		(0x0c000 + IMX_IO_BASE)
> +#define UART4_BASE		(0x0d000 + IMX_IO_BASE)
>  #define IMX_I2C1_BASE		(0x12000 + IMX_IO_BASE)
>  #define IMX_GPIO_BASE		(0x15000 + IMX_IO_BASE)
>  #define IMX_TIM4_BASE		(0x19000 + IMX_IO_BASE)
> diff --git a/arch/arm/include/asm/arch-mx31/imx-regs.h
> b/arch/arm/include/asm/arch-mx31/imx-regs.h index 0147920..6a517dd 100644
> --- a/arch/arm/include/asm/arch-mx31/imx-regs.h
> +++ b/arch/arm/include/asm/arch-mx31/imx-regs.h
> @@ -600,6 +600,12 @@ struct esdc_regs {
>  #define WEIM_ESDCFG1	0xB800100C
>  #define WEIM_ESDMISC	0xB8001010
> 
> +#define UART1_BASE	0x43F90000
> +#define UART2_BASE	0x43F94000
> +#define UART3_BASE	0x5000C000
> +#define UART4_BASE	0x43FB0000
> +#define UART5_BASE	0x43FB4000
> +
>  #define ESDCTL_SDE			(1 << 31)
>  #define ESDCTL_CMD_RW			(0 << 28)
>  #define ESDCTL_CMD_PRECHARGE		(1 << 28)
> diff --git a/arch/arm/include/asm/arch-mx35/imx-regs.h
> b/arch/arm/include/asm/arch-mx35/imx-regs.h index 25c324e..df74508 100644
> --- a/arch/arm/include/asm/arch-mx35/imx-regs.h
> +++ b/arch/arm/include/asm/arch-mx35/imx-regs.h
> @@ -42,8 +42,8 @@
>  #define I2C_BASE_ADDR           0x43F80000
>  #define I2C3_BASE_ADDR          0x43F84000
>  #define ATA_BASE_ADDR           0x43F8C000
> -#define UART1_BASE_ADDR         0x43F90000
> -#define UART2_BASE_ADDR         0x43F94000
> +#define UART1_BASE		0x43F90000
> +#define UART2_BASE		0x43F94000
>  #define I2C2_BASE_ADDR          0x43F98000
>  #define CSPI1_BASE_ADDR         0x43FA4000
>  #define IOMUXC_BASE_ADDR        0x43FAC000

Maybe cleanup this space/tab mix ? s/ \+/\t/ ?

M

  reply	other threads:[~2011-11-22 18:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-22 15:51 [U-Boot] [PATCH] MX: serial_mxc: cleanup removing nasty #ifdef Stefano Babic
2011-11-22 18:06 ` Marek Vasut [this message]
2011-11-23  8:41   ` Stefano Babic
2011-11-23  2:48 ` Jason Hui
2011-11-23  8:37   ` Stefano Babic
2011-11-23 10:44     ` Marek Vasut
2011-11-23 21:27       ` stefano babic
2011-11-24  0:08         ` Marek Vasut
2011-11-24  2:35           ` Jason Hui
2011-11-24  2:44             ` Marek Vasut
2011-11-24 11:35               ` Wolfgang Denk
2011-11-24  6:13             ` Wolfgang Denk
2011-11-24  6:23               ` Jason Hui
2011-11-24 11:41                 ` Wolfgang Denk
2011-11-24 11:47                   ` Jason Hui
2011-11-24 12:11                     ` Wolfgang Denk
2011-11-25  2:11                       ` Jason Hui
2011-11-25  3:32 ` Jason Hui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201111221906.39243.marek.vasut@gmail.com \
    --to=marek.vasut@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.