MX: serial_mxc: cleanup removing nasty #ifdef
Subsystems (2)
PATCH 1/1 MX: serial_mxc: cleanup removing nasty #ifdef
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.
--- 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(-)
arch/arm/cpu/arm1136/mx31/devices.c +0 -4
@@ -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 #ifdef CONFIG_MXC_SPI /*
arch/arm/include/asm/arch-mx25/imx-regs.h +5 -5
@@ -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)
arch/arm/include/asm/arch-mx27/imx-regs.h +4 -4
@@ -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)
arch/arm/include/asm/arch-mx31/imx-regs.h +6 -0
@@ -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)
arch/arm/include/asm/arch-mx35/imx-regs.h +3 -3
@@ -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
@@ -52,7 +52,7 @@* SPBA */ #define SPBA_BASE_ADDR 0x50000000 -#define UART3_BASE_ADDR 0x5000C000 +#define UART3_BASE 0x5000C000#define CSPI2_BASE_ADDR 0x50010000#define ATA_DMA_BASE_ADDR 0x50020000#define FEC_BASE_ADDR 0x50038000
arch/arm/include/asm/arch-mx5/imx-regs.h +3 -3
@@ -54,7 +54,7 @@*/ #define MMC_SDHC1_BASE_ADDR (SPBA0_BASE_ADDR + 0x00004000)#define MMC_SDHC2_BASE_ADDR (SPBA0_BASE_ADDR + 0x00008000) -#define UART3_BASE_ADDR (SPBA0_BASE_ADDR + 0x0000C000) +#define UART3_BASE (SPBA0_BASE_ADDR + 0x0000C000)#define CSPI1_BASE_ADDR (SPBA0_BASE_ADDR + 0x00010000)#define SSI2_BASE_ADDR (SPBA0_BASE_ADDR + 0x00014000)#define MMC_SDHC3_BASE_ADDR (SPBA0_BASE_ADDR + 0x00020000)
@@ -83,8 +83,8 @@#define EPIT2_BASE_ADDR (AIPS1_BASE_ADDR + 0x000B0000)#define PWM1_BASE_ADDR (AIPS1_BASE_ADDR + 0x000B4000)#define PWM2_BASE_ADDR (AIPS1_BASE_ADDR + 0x000B8000) -#define UART1_BASE_ADDR (AIPS1_BASE_ADDR + 0x000BC000) -#define UART2_BASE_ADDR (AIPS1_BASE_ADDR + 0x000C0000) +#define UART1_BASE (AIPS1_BASE_ADDR + 0x000BC000) +#define UART2_BASE (AIPS1_BASE_ADDR + 0x000C0000)#define SRC_BASE_ADDR (AIPS1_BASE_ADDR + 0x000D0000)#define CCM_BASE_ADDR (AIPS1_BASE_ADDR + 0x000D4000)#define GPC_BASE_ADDR (AIPS1_BASE_ADDR + 0x000D8000)
drivers/serial/serial_mxc.c +4 -33
@@ -24,41 +24,12 @@#define __REG (x) (*((volatile u32 *)(x))) -#if defined(CONFIG_SYS_MX31_UART1 ) || defined(CONFIG_SYS_MX25_UART1 ) -#define UART_PHYS 0x43f90000 -#elif defined(CONFIG_SYS_MX31_UART2 ) || defined(CONFIG_SYS_MX25_UART2 ) -#define UART_PHYS 0x43f94000 -#elif defined(CONFIG_SYS_MX31_UART3 ) || defined(CONFIG_SYS_MX25_UART3 ) -#define UART_PHYS 0x5000c000 -#elif defined(CONFIG_SYS_MX31_UART4 ) || defined(CONFIG_SYS_MX25_UART4 ) -#define UART_PHYS 0x43fb0000 -#elif defined(CONFIG_SYS_MX31_UART5 ) || defined(CONFIG_SYS_MX25_UART5 ) -#define UART_PHYS 0x43fb4000 -#elif defined(CONFIG_SYS_MX27_UART1 ) -#define UART_PHYS 0x1000a000 -#elif defined(CONFIG_SYS_MX27_UART2 ) -#define UART_PHYS 0x1000b000 -#elif defined(CONFIG_SYS_MX27_UART3 ) -#define UART_PHYS 0x1000c000 -#elif defined(CONFIG_SYS_MX27_UART4 ) -#define UART_PHYS 0x1000d000 -#elif defined(CONFIG_SYS_MX27_UART5 ) -#define UART_PHYS 0x1001b000 -#elif defined(CONFIG_SYS_MX27_UART6 ) -#define UART_PHYS 0x1001c000 -#elif defined(CONFIG_SYS_MX35_UART1 ) || defined(CONFIG_SYS_MX51_UART1 ) || \ - defined(CONFIG_SYS_MX53_UART1 ) -#define UART_PHYS UART1_BASE_ADDR -#elif defined(CONFIG_SYS_MX35_UART2 ) || defined(CONFIG_SYS_MX51_UART2 ) || \ - defined(CONFIG_SYS_MX53_UART2 ) -#define UART_PHYS UART2_BASE_ADDR -#elif defined(CONFIG_SYS_MX35_UART3 ) || defined(CONFIG_SYS_MX51_UART3 ) || \ - defined(CONFIG_SYS_MX53_UART3 ) -#define UART_PHYS UART3_BASE_ADDR -#else -#error "define CONFIG_SYS_MXxx_UARTx to use the MXC UART driver" +#ifndef CONFIG_MXC_UART_BASE +#error "define CONFIG_MXC_UART_BASE to use the MXC UART driver"#endif +#define UART_PHYS CONFIG_MXC_UART_BASE +#ifdef CONFIG_SERIAL_MULTI #warning "MXC driver does not support MULTI serials."#endif
include/configs/efikamx.h +1 -1
@@ -85,7 +85,7 @@* Hardware drivers */ #define CONFIG_MXC_UART -#define CONFIG_SYS_MX51_UART1 +#define CONFIG_MXC_UART_BASE UART1_BASE#define CONFIG_CONS_INDEX 1#define CONFIG_BAUDRATE 115200#define CONFIG_SYS_BAUDRATE_TABLE {9600, 19200, 38400, 57600, 115200}
include/configs/flea3.h +1 -1
@@ -77,7 +77,7 @@* UART (console) */ #define CONFIG_MXC_UART -#define CONFIG_SYS_MX35_UART3 +#define CONFIG_MXC_UART_BASE UART3_BASE/* allow to overwrite serial and ethaddr */ #define CONFIG_ENV_OVERWRITE
include/configs/imx27lite-common.h +1 -1
@@ -102,7 +102,7 @@* Serial Driver info */ #define CONFIG_MXC_UART -#define CONFIG_SYS_MX27_UART1 +#define CONFIG_MXC_UART_BASE UART1_BASE#define CONFIG_CONS_INDEX 1/* use UART0 for console */ #define CONFIG_BAUDRATE 115200/* Default baud rate */ #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
include/configs/imx31_litekit.h +2 -2
@@ -63,8 +63,8 @@* Hardware drivers */ -#define CONFIG_MXC_UART 1 -#define CONFIG_SYS_MX31_UART1 1 +#define CONFIG_MXC_UART +#define CONFIG_MXC_UART_BASE UART1_BASE#define CONFIG_MXC_GPIO #define CONFIG_HARD_SPI 1
include/configs/imx31_phycore.h +1 -1
@@ -59,7 +59,7 @@#define CONFIG_SYS_I2C_SLAVE 0xfe#define CONFIG_MXC_UART -#define CONFIG_SYS_MX31_UART1 +#define CONFIG_MXC_UART_BASE UART1_BASE/* allow to overwrite serial and ethaddr */ #define CONFIG_ENV_OVERWRITE
include/configs/mx25pdk.h +1 -1
@@ -54,7 +54,7 @@/* Serial Info */ #define CONFIG_MXC_UART -#define CONFIG_SYS_MX25_UART1 +#define CONFIG_MXC_UART_BASE UART1_BASE#define CONFIG_CONS_INDEX 1/* use UART0 for console */ #define CONFIG_BAUDRATE 115200/* Default baud rate */ #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
include/configs/mx31ads.h +2 -2
@@ -60,8 +60,8 @@* Hardware drivers */ -#define CONFIG_MXC_UART 1 -#define CONFIG_SYS_MX31_UART1 1 +#define CONFIG_MXC_UART +#define CONFIG_MXC_UART_BASE UART1_BASE#define CONFIG_HARD_SPI 1#define CONFIG_MXC_SPI 1
include/configs/mx31pdk.h +1 -1
@@ -61,7 +61,7 @@*/ #define CONFIG_MXC_UART -#define CONFIG_SYS_MX31_UART1 +#define CONFIG_MXC_UART_BASE UART1_BASE#define CONFIG_HW_WATCHDOG #define CONFIG_MXC_GPIO
include/configs/mx35pdk.h +1 -1
@@ -85,7 +85,7 @@* UART (console) */ #define CONFIG_MXC_UART -#define CONFIG_SYS_MX35_UART1 +#define CONFIG_MXC_UART_BASE UART1_BASE/* allow to overwrite serial and ethaddr */ #define CONFIG_ENV_OVERWRITE
include/configs/mx51evk.h +1 -1
@@ -59,7 +59,7 @@* Hardware drivers */ #define CONFIG_MXC_UART -#define CONFIG_SYS_MX51_UART1 +#define CONFIG_MXC_UART_BASE UART1_BASE#define CONFIG_MXC_GPIO /*
include/configs/mx53ard.h +1 -1
@@ -44,7 +44,7 @@#define CONFIG_MXC_GPIO #define CONFIG_MXC_UART -#define CONFIG_SYS_MX53_UART1 +#define CONFIG_MXC_UART_BASE UART1_BASE/* I2C Configs */ #define CONFIG_CMD_I2C
include/configs/mx53evk.h +1 -1
@@ -47,7 +47,7 @@#define CONFIG_MXC_GPIO #define CONFIG_MXC_UART -#define CONFIG_SYS_MX53_UART1 +#define CONFIG_MXC_UART_BASE UART1_BASE/* I2C Configs */ #define CONFIG_CMD_I2C
include/configs/mx53loco.h +1 -1
@@ -45,7 +45,7 @@#define CONFIG_MXC_GPIO #define CONFIG_MXC_UART -#define CONFIG_SYS_MX53_UART1 +#define CONFIG_MXC_UART_BASE UART1_BASE/* MMC Configs */ #define CONFIG_FSL_ESDHC
include/configs/mx53smd.h +1 -1
@@ -44,7 +44,7 @@#define CONFIG_MXC_GPIO #define CONFIG_MXC_UART -#define CONFIG_SYS_MX53_UART1 +#define CONFIG_MXC_UART_BASE UART1_BASE/* I2C Configs */ #define CONFIG_CMD_I2C
include/configs/qong.h +2 -2
@@ -49,8 +49,8 @@* Hardware drivers */ -#define CONFIG_MXC_UART 1 -#define CONFIG_SYS_MX31_UART1 1 +#define CONFIG_MXC_UART +#define CONFIG_MXC_UART_BASE UART1_BASE#define CONFIG_MXC_GPIO #define CONFIG_HW_WATCHDOG
include/configs/tt01.h +1 -1
@@ -148,7 +148,7 @@* make sure that the transceiver is enabled during PL=1 for testing! */ #define CONFIG_MXC_UART -#define CONFIG_SYS_MX31_UART2 +#define CONFIG_MXC_UART_BASE UART2_BASE#define CONFIG_MXC_SPI #define CONFIG_MXC_GPIO
include/configs/tx25.h +1 -1
@@ -90,7 +90,7 @@* Serial Info */ #define CONFIG_MXC_UART -#define CONFIG_SYS_MX25_UART1 +#define CONFIG_MXC_UART_BASE UART1_BASE#define CONFIG_CONS_INDEX 1/* use UART0 for console */ #define CONFIG_BAUDRATE 115200/* Default baud rate */ #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
include/configs/vision2.h +1 -1
@@ -54,7 +54,7 @@* Hardware drivers */ #define CONFIG_MXC_UART -#define CONFIG_SYS_MX51_UART3 +#define CONFIG_MXC_UART_BASE UART3_BASE#define CONFIG_MXC_GPIO #define CONFIG_MXC_SPI #define CONFIG_HW_WATCHDOG
include/configs/zmx25.h +1 -1
@@ -66,7 +66,7 @@* Serial */ #define CONFIG_MXC_UART -#define CONFIG_SYS_MX25_UART2 +#define CONFIG_MXC_UART_BASE UART2_BASE#define CONFIG_CONS_INDEX 1/* use UART2 for console */ #define CONFIG_BAUDRATE 115200/* Default baud rate */ #define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
Signature · 1 line
1.7.5.4
PATCH 1/1 MX: serial_mxc: cleanup removing nasty #ifdef
Quoted 35 lines
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 <[email protected]>CC Marek Vasut <[email protected]>CC Wolfgang Denk <[email protected]>CC Fabio Estevam <[email protected]>CC Helmut Raiger <[email protected]>CC John Rigby <[email protected]>CC Matthias Weisser <[email protected]>CC Jason Liu <[email protected]>--- 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 +-
Quoted 9 lines
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!
Quoted 23 lines
(quoted diff) +0
-0
b/arch/arm/cpu/arm1136/mx31/devices.cindex b42dac3..2ebee2e 100644arch/arm/cpu/arm1136/mx31/devices.c +0
-3@@ -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 */
arch/arm/cpu/arm1136/mx31/devices.c void mx31_uart2_hw_init(void) · line 50
Quoted 4 lines
arch/arm/cpu/arm1136/mx31/devices.c +0
-1@@ -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/.... ?
Quoted 27 lines
arch/arm/cpu/arm1136/mx31/devices.c +0
-0#ifdef CONFIG_MXC_SPI /* (quoted diff) +0
-0
b/arch/arm/include/asm/arch-mx25/imx-regs.hindex eece138..7f9449b 100644arch/arm/include/asm/arch-mx25/imx-regs.h +4
-4@@ -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)
arch/arm/include/asm/arch-mx25/imx-regs.h struct aips_regs { · line 211
Quoted 10 lines
arch/arm/include/asm/arch-mx25/imx-regs.h +1
-1#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 ...
Quoted 41 lines
(quoted diff) +0
-0
b/arch/arm/include/asm/arch-mx27/imx-regs.hindex 83ab216..ced5b2a 100644arch/arm/include/asm/arch-mx27/imx-regs.h +4
-4@@ -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)(quoted diff) +0
-0
b/arch/arm/include/asm/arch-mx31/imx-regs.hindex 0147920..6a517dd 100644arch/arm/include/asm/arch-mx31/imx-regs.h +6
-0@@ -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)(quoted diff) +0
-0
b/arch/arm/include/asm/arch-mx35/imx-regs.hindex 25c324e..df74508 100644
arch/arm/include/asm/arch-mx35/imx-regs.h line 49
Quoted 10 lines
arch/arm/include/asm/arch-mx35/imx-regs.h +2
-2@@ -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
PATCH 1/1 MX: serial_mxc: cleanup removing nasty #ifdef
Quoted 11 lines · Marek Vasut
arch/arm/cpu/arm1136/mx31/devices.c void mx31_uart2_hw_init(void) · line 50
Quoted 9 lines
arch/arm/cpu/arm1136/mx31/devices.c +0
-2-#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/.... ?
There are several way to improve the MUX on the IMX, but this should be done in separate patches. This patch takes care only to move the selected UART from the driver to the board configuration file.
Quoted 30 lines
Quoted 30 lines
arch/arm/cpu/arm1136/mx31/devices.c +0
-0#ifdef CONFIG_MXC_SPI /* (quoted diff) +0
-0
b/arch/arm/include/asm/arch-mx25/imx-regs.hindex eece138..7f9449b 100644arch/arm/include/asm/arch-mx25/imx-regs.h +4
-4@@ -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)
Quoted 8 lines
arch/arm/include/asm/arch-mx25/imx-regs.h struct aips_regs { · line 211
Quoted 6 lines
arch/arm/include/asm/arch-mx25/imx-regs.h +1
-1#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 ...
This should be done globally. Agree this must be done, but I will let that the patch remain easy to be read containing only the changes related to the commit message. So I tend to move this cleanup in a separate patch.
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
PATCH 1/1 MX: serial_mxc: cleanup removing nasty #ifdef
In reply to Stefano BabicQuoted 5 lines · Stefano Babic
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.
Good clean up. :)
Quoted 328 lines
Signed-off-by Stefano Babic <[email protected]>CC Marek Vasut <[email protected]>CC Wolfgang Denk <[email protected]>CC Fabio Estevam <[email protected]>CC Helmut Raiger <[email protected]>CC John Rigby <[email protected]>CC Matthias Weisser <[email protected]>CC Jason Liu <[email protected]>---
?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(-)
arch/arm/cpu/arm1136/mx31/devices.c +0
-0@@ -27,7 +27,6 @@?#include <
asm/arch/imx-regs.h>
?#include <asm/arch/clock.h>-#ifdef
CONFIG_SYS_MX31_UART1
?voidmx31_uart1_hw_init(void)
?{
? ? ? ?/* setup pins for UART1 */arch/arm/cpu/arm1136/mx31/devices.c +0
-2@@ -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 */
arch/arm/cpu/arm1136/mx31/devices.c +0
-1@@ -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 ?#ifdef
CONFIG_MXC_SPI
?/*arch/arm/include/asm/arch-mx25/imx-regs.h +2
-2@@ -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 */
?#defineIMX_SPBA_BASE? ? ? ? ?(0x50000000)
?#defineIMX_CSPI3_BASE? ? ? ? (0x50004000)arch/arm/include/asm/arch-mx25/imx-regs.h +2
-2-#define IMX_UART4_BASE ? ? ? ? (0x50008000) -#define IMX_UART3_BASE ? ? ? ? (0x5000C000) +#define UART4_BASE ? ? ? ? ? ? (0x50008000) +#define UART3_BASE ? ? ? ? ? ? (0x5000C000)?#define
IMX_CSPI2_BASE? ? ? ? (0x50010000)
?#defineIMX_SSI2_BASE? ? ? ? ?(0x50014000)
?#defineIMX_ESAI_BASE? ? ? ? ?(0x50018000)
?#defineIMX_ATA_DMA_BASE? ? ? (0x50020000)
?#defineIMX_SIM1_BASE? ? ? ? ?(0x50024000)
?#defineIMX_SIM2_BASE? ? ? ? ?(0x50028000)arch/arm/include/asm/arch-mx25/imx-regs.h +1
-1-#define IMX_UART5_BASE ? ? ? ? (0x5002C000) +#define UART5_BASE ? ? ? ? ? ? (0x5002C000)?#define
IMX_TSC_BASE? ? ? ? ? (0x50030000)
?#defineIMX_SSI1_BASE? ? ? ? ?(0x50034000)
?#defineIMX_FEC_BASE? ? ? ? ? (0x50038000)arch/arm/include/asm/arch-mx27/imx-regs.h +4
-4@@ -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)arch/arm/include/asm/arch-mx31/imx-regs.h +0
-0@@ -600,6 +600,12 @@ struct esdc_regs {?#define
WEIM_ESDCFG1?0xB800100C
?#defineWEIM_ESDMISC?0xB8001010arch/arm/include/asm/arch-mx31/imx-regs.h +6
-0+#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)
?#defineESDCTL_CMD_RW? ? ? ? ? ? ? ? ?(0 << 28)
?#defineESDCTL_CMD_PRECHARGE? ? ? ? ? (1 << 28)arch/arm/include/asm/arch-mx35/imx-regs.h +0
-0@@ -42,8 +42,8 @@?#define
I2C_BASE_ADDR? ? ? ? ?0x43F80000
?#defineI2C3_BASE_ADDR? ? ? ? ?0x43F84000
?#defineATA_BASE_ADDR? ? ? ? ?0x43F8C000arch/arm/include/asm/arch-mx35/imx-regs.h +2
-2-#define UART1_BASE_ADDR ? ? ? ? 0x43F90000 -#define UART2_BASE_ADDR ? ? ? ? 0x43F94000 +#define UART1_BASE ? ? ? ? ? ? 0x43F90000 +#define UART2_BASE ? ? ? ? ? ? 0x43F94000?#define
I2C2_BASE_ADDR? ? ? ? ?0x43F98000
?#defineCSPI1_BASE_ADDR? ? ? ?0x43FA4000
?#defineIOMUXC_BASE_ADDR? ? ? ?0x43FAC000arch/arm/include/asm/arch-mx35/imx-regs.h +0
-0@@ -52,7 +52,7 @@?* SPBA
?*/
?#defineSPBA_BASE_ADDR? ? ? ? ?0x50000000arch/arm/include/asm/arch-mx35/imx-regs.h +1
-1-#define UART3_BASE_ADDR ? ? ? ? 0x5000C000 +#define UART3_BASE ? ? ? ? ? ? 0x5000C000?#define
CSPI2_BASE_ADDR? ? ? ?0x50010000
?#defineATA_DMA_BASE_ADDR? ? ?0x50020000
?#defineFEC_BASE_ADDR? ? ? ? ?0x50038000arch/arm/include/asm/arch-mx5/imx-regs.h +0
-0@@ -54,7 +54,7 @@?*/
?#defineMMC_SDHC1_BASE_ADDR? ?(SPBA0_BASE_ADDR +0x00004000) ?#defineMMC_SDHC2_BASE_ADDR? ?(SPBA0_BASE_ADDR +0x00008000)arch/arm/include/asm/arch-mx5/imx-regs.h +1
-1-#define UART3_BASE_ADDR ? ? ? ?(SPBA0_BASE_ADDR + 0x0000C000) +#define UART3_BASE ? ? ? ? ? ? (SPBA0_BASE_ADDR + 0x0000C000)?#define
CSPI1_BASE_ADDR? ? ? ?(SPBA0_BASE_ADDR +0x00010000) ?#defineSSI2_BASE_ADDR? ? ? ? (SPBA0_BASE_ADDR+0x00014000) ?#defineMMC_SDHC3_BASE_ADDR? ?(SPBA0_BASE_ADDR +0x00020000)arch/arm/include/asm/arch-mx5/imx-regs.h +2
-2@@ -83,8 +83,8 @@ ?#define EPIT2_BASE_ADDR ? ? ? ? ? ? ? ?(AIPS1_BASE_ADDR + 0x000B0000) ?#define PWM1_BASE_ADDR ? ? ? ? (AIPS1_BASE_ADDR + 0x000B4000) ?#define PWM2_BASE_ADDR ? ? ? ? (AIPS1_BASE_ADDR + 0x000B8000) -#define UART1_BASE_ADDR ? ? ? ? ? ? ? ?(AIPS1_BASE_ADDR + 0x000BC000) -#define UART2_BASE_ADDR ? ? ? ? ? ? ? ?(AIPS1_BASE_ADDR + 0x000C0000) +#define UART1_BASE ? ? ? ? ? ? (AIPS1_BASE_ADDR + 0x000BC000) +#define UART2_BASE ? ? ? ? ? ? (AIPS1_BASE_ADDR + 0x000C0000) ?#define SRC_BASE_ADDR ? ? ? ? ?(AIPS1_BASE_ADDR + 0x000D0000) ?#define CCM_BASE_ADDR ? ? ? ? ?(AIPS1_BASE_ADDR + 0x000D4000) ?#define GPC_BASE_ADDR ? ? ? ? ?(AIPS1_BASE_ADDR + 0x000D8000)drivers/serial/serial_mxc.c +2
-33@@ -24,41 +24,12 @@ ?#define __REG(x) ? ? (*((volatile u32 *)(x))) -#if defined(CONFIG_SYS_MX31_UART1 ) || defined(CONFIG_SYS_MX25_UART1 ) -#define UART_PHYS 0x43f90000 -#elif defined(CONFIG_SYS_MX31_UART2 ) || defined(CONFIG_SYS_MX25_UART2 ) -#define UART_PHYS 0x43f94000 -#elif defined(CONFIG_SYS_MX31_UART3 ) || defined(CONFIG_SYS_MX25_UART3 ) -#define UART_PHYS 0x5000c000 -#elif defined(CONFIG_SYS_MX31_UART4 ) || defined(CONFIG_SYS_MX25_UART4 ) -#define UART_PHYS 0x43fb0000 -#elif defined(CONFIG_SYS_MX31_UART5 ) || defined(CONFIG_SYS_MX25_UART5 ) -#define UART_PHYS 0x43fb4000 -#elif defined(CONFIG_SYS_MX27_UART1 ) -#define UART_PHYS 0x1000a000 -#elif defined(CONFIG_SYS_MX27_UART2 ) -#define UART_PHYS 0x1000b000 -#elif defined(CONFIG_SYS_MX27_UART3 ) -#define UART_PHYS 0x1000c000 -#elif defined(CONFIG_SYS_MX27_UART4 ) -#define UART_PHYS 0x1000d000 -#elif defined(CONFIG_SYS_MX27_UART5 ) -#define UART_PHYS 0x1001b000 -#elif defined(CONFIG_SYS_MX27_UART6 ) -#define UART_PHYS 0x1001c000 -#elif defined(CONFIG_SYS_MX35_UART1 ) || defined(CONFIG_SYS_MX51_UART1 ) || \ - ? ? ? defined(CONFIG_SYS_MX53_UART1) -#define UART_PHYS UART1_BASE_ADDR -#elif defined(CONFIG_SYS_MX35_UART2 ) || defined(CONFIG_SYS_MX51_UART2 ) || \ - ? ? ? defined(CONFIG_SYS_MX53_UART2) -#define UART_PHYS UART2_BASE_ADDR -#elif defined(CONFIG_SYS_MX35_UART3 ) || defined(CONFIG_SYS_MX51_UART3 ) || \ - ? ? ? defined(CONFIG_SYS_MX53_UART3) -#define UART_PHYS UART3_BASE_ADDR -#else -#error "define CONFIG_SYS_MXxx_UARTx to use the MXC UART driver" +#ifndef CONFIG_MXC_UART_BASE +#error "define CONFIG_MXC_UART_BASE to use the MXC UART driver"?#endif
drivers/serial/serial_mxc.c +2
-0+#define UART_PHYS ? ? ?CONFIG_MXC_UART_BASE +?#ifdef
CONFIG_SERIAL_MULTI
?#warning "MXC driver does not support MULTI serials." ?#endifinclude/configs/efikamx.h +0
-0@@ -85,7 +85,7 @@?* Hardware drivers
?*/
?#defineCONFIG_MXC_UARTinclude/configs/efikamx.h +1
-1-#define CONFIG_SYS_MX51_UART1 +#define CONFIG_MXC_UART_BASE ? ? ? ? ? UART1_BASE?#define
CONFIG_CONS_INDEX? ? ? ? ? ? ?1
?#defineCONFIG_BAUDRATE? ? ? ? ? ? ? ? ? ? ? ?115200
?#defineCONFIG_SYS_BAUDRATE_TABLE? ? ?{9600, 19200, 38400, 57600, 115200}include/configs/flea3.h +0
-0@@ -77,7 +77,7 @@ ?* UART (console)?*/
?#defineCONFIG_MXC_UARTinclude/configs/flea3.h +1
-1-#define CONFIG_SYS_MX35_UART3 +#define CONFIG_MXC_UART_BASE ? UART3_BASE?/* allow to overwrite serial and ethaddr */
?#defineCONFIG_ENV_OVERWRITEinclude/configs/imx27lite-common.h +0
-0@@ -102,7 +102,7 @@?* Serial Driver info
?*/
?#defineCONFIG_MXC_UARTinclude/configs/imx27lite-common.h +1
-1-#define CONFIG_SYS_MX27_UART1 +#define CONFIG_MXC_UART_BASE ? UART1_BASE?#define
CONFIG_CONS_INDEX? ? ?1 ? ? ? ? ? ? ? /* use UART0 for console */ ?#defineCONFIG_BAUDRATE? ? ? ? ? ? ? ?115200 ? ? ? ? ?/* Default baud rate */ ?#defineCONFIG_SYS_BAUDRATE_TABLE? ? ?{ 9600, 19200, 38400, 57600, 115200 }include/configs/imx31_litekit.h +0
-0@@ -63,8 +63,8 @@?* Hardware drivers
?*/include/configs/imx31_litekit.h +2
-2-#define CONFIG_MXC_UART ? ? ? ?1 -#define CONFIG_SYS_MX31_UART1 ? ? ? ? ?1 +#define CONFIG_MXC_UART +#define CONFIG_MXC_UART_BASE ? UART1_BASE?#define
CONFIG_MXC_GPIO?#define
CONFIG_HARD_SPI? ? ? ? ? ? ? ?1include/configs/imx31_phycore.h +0
-0@@ -59,7 +59,7 @@?#define
CONFIG_SYS_I2C_SLAVE? ? ? ? ?0xfe?#define
CONFIG_MXC_UARTinclude/configs/imx31_phycore.h +1
-1-#define CONFIG_SYS_MX31_UART1 +#define CONFIG_MXC_UART_BASE ? ? ? ? ? UART1_BASE?/* allow to overwrite serial and ethaddr */
?#defineCONFIG_ENV_OVERWRITEinclude/configs/mx25pdk.h +0
-0@@ -54,7 +54,7 @@?/* Serial Info */
?#defineCONFIG_MXC_UARTinclude/configs/mx25pdk.h +1
-1-#define CONFIG_SYS_MX25_UART1 +#define CONFIG_MXC_UART_BASE ? UART1_BASE?#define
CONFIG_CONS_INDEX? ? ?1 ? ? ? /* use UART0 for console */ ?#defineCONFIG_BAUDRATE? ? ? ? ? ? ? ?115200 ?/* Default baud rate */ ?#defineCONFIG_SYS_BAUDRATE_TABLE? ? ?{ 9600, 19200, 38400, 57600, 115200 }include/configs/mx31ads.h +0
-0@@ -60,8 +60,8 @@?* Hardware drivers
?*/include/configs/mx31ads.h +2
-2-#define CONFIG_MXC_UART ? ? ? ?1 -#define CONFIG_SYS_MX31_UART1 ? ? ? ? ?1 +#define CONFIG_MXC_UART +#define CONFIG_MXC_UART_BASE ? UART1_BASE
PATCH 1/1 MX: serial_mxc: cleanup removing nasty #ifdef
Quoted 6 lines · Jason Hui
From the u-boot/README:
* Configuration _OPTIONS_:
These are selectable by the user and have names beginning with "CONFIG_".
Quoted 8 lines
* Configuration _SETTINGS_:
These depend on the hardware etc. and should not be meddled with if you don't know what you're doing; they have names beginning with "CONFIG_SYS_".It's better to use #define
CONFIG_SYS_MXC_UART_BASEUART1_BASE[...]
Agree, I do it in V2
Best regards,
Stefano Babic
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
PATCH 1/1 MX: serial_mxc: cleanup removing nasty #ifdef
Quoted 12 lines · Jason Hui
Quoted 11 lines
From the u-boot/README:
* Configuration _OPTIONS_:
These are selectable by the user and have names beginning with "CONFIG_".* Configuration _SETTINGS_:
These depend on the hardware etc. and should not be meddled with if you don't know what you're doing; they have names beginning with "CONFIG_SYS_".
Quoted 8 lines
Quoted 3 lines
It's better to use #define
CONFIG_SYS_MXC_UART_BASEUART1_BASE[...]
Agree, I do it in V2
Best regards,
Stefano Babic
But this is not completely right. Why CONFIG_SYS, if the user can change it quite safely to adjust his serial port.
M
PATCH 1/1 MX: serial_mxc: cleanup removing nasty #ifdef
Am 23/11/2011 11:44, schrieb Marek Vasut:
Quoted 16 lines
Quoted 16 lines · Jason Hui
Quoted 14 lines
From the u-boot/README:
* Configuration _OPTIONS_:
These are selectable by the user and have names beginning with "CONFIG_".* Configuration _SETTINGS_:
These depend on the hardware etc. and should not be meddled with if you don't know what you're doing; they have names beginning with "CONFIG_SYS_".It's better to use #define
CONFIG_SYS_MXC_UART_BASEUART1_BASE[...]
Quoted 7 lines
Quoted 4 lines
Agree, I do it in V2
Best regards,
Stefano BabicBut this is not completely right. Why
CONFIG_SYS, if the user can change it quite safely to adjust his serial port.
So we have a case where we can use CONFIG_ (because it is an option selectable by user) or CONFIG_SYS_ because it depends on HW... I see other cases where a CONFIG_ (CONFIG_SERIAL_BASE, CONFIG_FFUART, ..) is used to select the UART on different SOCs. And I see also other cases with CONFIG_SYS_ (CONFIG_SYS_UART_BASE, for example). Both are currently used - I will not change, I think that CONFIG_MXC_UART_BASE explains already well what is supposed to do.
Stefano
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de =====================================================================
PATCH 1/1 MX: serial_mxc: cleanup removing nasty #ifdef
Quoted 25 lines
Am 23/11/2011 11:44, schrieb Marek Vasut:
Quoted 16 lines
Quoted 16 lines · Jason Hui
Quoted 14 lines
From the u-boot/README:
* Configuration _OPTIONS_:
These are selectable by the user and have names beginning with "CONFIG_".* Configuration _SETTINGS_:
These depend on the hardware etc. and should not be meddled with if you don't know what you're doing; they have names beginning with "CONFIG_SYS_".It's better to use #define
CONFIG_SYS_MXC_UART_BASEUART1_BASE[...]
Quoted 7 lines
Quoted 4 lines
Agree, I do it in V2
Best regards,
Stefano BabicBut this is not completely right. Why
CONFIG_SYS, if the user can change it quite safely to adjust his serial port.
Quoted 7 lines
So we have a case where we can use
CONFIG_(because it is an option selectable by user) orCONFIG_SYS_because it depends on HW... I see other cases where aCONFIG_(CONFIG_SERIAL_BASE,CONFIG_FFUART, ..) is used to select the UART on different SOCs. And I see also other cases withCONFIG_SYS_(CONFIG_SYS_UART_BASE, for example). Both are currently used - I will not change, I think thatCONFIG_MXC_UART_BASEexplains already well what is supposed to do.
Definitelly.
M
PATCH 1/1 MX: serial_mxc: cleanup removing nasty #ifdef
Quoted 33 lines · Marek Vasut
Quoted 25 lines
Am 23/11/2011 11:44, schrieb Marek Vasut:
Quoted 16 lines
Quoted 16 lines · Jason Hui
Quoted 14 lines
From the u-boot/README:
* Configuration _OPTIONS_:
? These are selectable by the user and have names beginning with ? "CONFIG_".* Configuration _SETTINGS_:
? These depend on the hardware etc. and should not be meddled with if ? you don't know what you're doing; they have names beginning with ? "CONFIG_SYS_".It's better to use #define
CONFIG_SYS_MXC_UART_BASE?UART1_BASE[...]
Quoted 7 lines
Quoted 4 lines
Agree, I do it in V2
Best regards,
Stefano BabicBut this is not completely right. Why
CONFIG_SYS, if the user can change it quite safely to adjust his serial port.Quoted 7 lines
So we have a case where we can use
CONFIG_(because it is an option selectable by user) orCONFIG_SYS_because it depends on HW... I see other cases where aCONFIG_(CONFIG_SERIAL_BASE,CONFIG_FFUART, ..) is used to select the UART on different SOCs. And I see also other cases withCONFIG_SYS_(CONFIG_SYS_UART_BASE, for example). Both are currently used - I will not change, I think thatCONFIG_MXC_UART_BASEexplains already well what is supposed to do.
Quoted 1 line
Definitelly.
Really? As I understand:
CONFIG_OPTION is for an option selectable by user, so if we:
#define CONFIG_OPTION
means we select this feature or something like that.
CONFIG_SYS_XXXX: means the option is depend on the HW, typically, it will have one value at the end. For example:
#define CONFIG_SYS_XXX yyy
Since there is a lot of inconsistency in the u-boot. I don't know what is definitely correct way.
Maybe, Wolfgang can comment on this?
Quoted 3 lines
M
PATCH 1/1 MX: serial_mxc: cleanup removing nasty #ifdef
Quoted 46 lines · Marek Vasut
Quoted 33 lines
Quoted 25 lines
Am 23/11/2011 11:44, schrieb Marek Vasut:
Quoted 16 lines
Quoted 16 lines · Jason Hui
Quoted 14 lines
From the u-boot/README:
* Configuration _OPTIONS_:
These are selectable by the user and have names beginning with "CONFIG_".* Configuration _SETTINGS_:
These depend on the hardware etc. and should not be meddled with
if you don't know what you're doing; they have names beginning with "CONFIG_SYS_".It's better to use #define
CONFIG_SYS_MXC_UART_BASEUART1_BASE[...]
Quoted 7 lines
Quoted 4 lines
Agree, I do it in V2
Best regards,
Stefano BabicBut this is not completely right. Why
CONFIG_SYS, if the user can change it quite safely to adjust his serial port.Quoted 7 lines
So we have a case where we can use
CONFIG_(because it is an option selectable by user) orCONFIG_SYS_because it depends on HW... I see other cases where aCONFIG_(CONFIG_SERIAL_BASE,CONFIG_FFUART, ..) is used to select the UART on different SOCs. And I see also other cases withCONFIG_SYS_(CONFIG_SYS_UART_BASE, for example). Both are currently used - I will not change, I think thatCONFIG_MXC_UART_BASEexplains already well what is supposed to do.Quoted 1 line
Definitelly.
Really? As I understand:
CONFIG_OPTIONis for an option selectable by user, so if we:
#defineCONFIG_OPTIONmeans we select this feature or something like that.
CONFIG_SYS_XXXX: means the option is depend on the HW, typically, it will have one value at the end. For example:
Quoted 7 lines
#define
CONFIG_SYS_XXXyyySince there is a lot of inconsistency in the u-boot. I don't know what is definitely correct way.
Maybe, Wolfgang can comment on this?
Someone should step up and make it consistent then ;-)
M
PATCH 1/1 MX: serial_mxc: cleanup removing nasty #ifdef
Dear Marek Vasut,
Quoted 2 lines · In message <[email protected]> you wrote:
Someone should step up and make it consistent then ;-)
There is no inconsistency, only misunderstanding.
Best regards,
Wolfgang Denk
Signature · 6 lines
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 Nothing in progression can rest on its original plan. We may as well think of rocking a grown man in the cradle of an infant. - Edmund Burke
PATCH 1/1 MX: serial_mxc: cleanup removing nasty #ifdef
In reply to Jason HuiDear Jason Hui,
Quoted 8 lines · In message <CAFQ4atSGoTA9YXHxiprdRrWw4E5VFfssOoYOS=N2Yj=q9j_+TQ@mail.gmail.com>…
Really? As I understand:
CONFIG_OPTIONis for an option selectable by user, so if we:
#defineCONFIG_OPTIONmeans we select this feature or something like that.
Quoted 7 lines
CONFIG_SYS_XXXX: means the option is depend on the HW, typically, it will have one value at the end. For example:#define
CONFIG_SYS_XXXyyySince there is a lot of inconsistency in the u-boot. I don't know what is definitely correct way.
Your understanding is not correct, that's all.
There user configurable settings that just select features (like adding support for optional features, say things like CONFIG_CMD_ASKENV, CONFIG_CMD_CONSOLE, CONFIG_CMD_IMI etc.), but there are also such options that take values, like for example CONFIG_BAUDRATE, CONFIG_BOOTDELAY or CONFIG_BOOTCOMMAND.
The same applies for the CONFIG_SYS_ variables - there are some that don't take values, and some do.
Best regards,
Wolfgang Denk
Signature · 5 lines
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 While most peoples' opinions change, the conviction of their correct- ness never does.
PATCH 1/1 MX: serial_mxc: cleanup removing nasty #ifdef
Quoted 14 lines · Wolfgang Denk
Dear Jason Hui,
Quoted 11 lines · In message <CAFQ4atSGoTA9YXHxiprdRrWw4E5VFfssOoYOS=N2Yj=q9j_+TQ@mail.gmail.com>…
Really? As I understand:
CONFIG_OPTIONis for an option selectable by user, so if we:
#defineCONFIG_OPTIONmeans we select this feature or something like that.
CONFIG_SYS_XXXX: means the option is depend on the HW, typically, it will have one value at the end. For example:
Quoted 6 lines
Quoted 4 lines
#define
CONFIG_SYS_XXX? ? yyySince there is a lot of inconsistency in the u-boot. I don't know what is definitely correct way.
Your understanding is not correct, that's all.
OK, thanks for pointing this out.
Quoted 9 lines
There user configurable settings that just select features (like adding support for optional features, say things like
CONFIG_CMD_ASKENV,CONFIG_CMD_CONSOLE,CONFIG_CMD_IMIetc.), but there are also such options that take values, like for exampleCONFIG_BAUDRATE,CONFIG_BOOTDELAYorCONFIG_BOOTCOMMAND.The same applies for the
CONFIG_SYS_variables - there are some that don't take values, and some do.
Then what's the rule that we must need use CONFIG_SYS_ other than CONFIG_option?
Quoted 12 lines
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 While most peoples' opinions change, the conviction of their correct- ness never does.
PATCH 1/1 MX: serial_mxc: cleanup removing nasty #ifdef
Dear Jason Hui,
Quoted 3 lines · In message <CAFQ4atQfQ7YKKwa5fBBe16eWT95uBnKk1bjtPPqw8adTUWZvZQ@mail.gmail.com>…
Then what's the rule that we must need use
CONFIG_SYS_other thanCONFIG_option?
You yourself quoted the relevant part of the README before in this thread. Just re-read your own posting and/or the README:
11/23 Jason Hui Re: [PATCH] MX: serial_mxc: cleanup removing nasty #ifdef
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/117887
Best regards,
Wolfgang Denk
Signature · 5 lines
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
In the beginning, there was nothing, which exploded.
- Terry Pratchett, _Lords and Ladies_PATCH 1/1 MX: serial_mxc: cleanup removing nasty #ifdef
Quoted 4 lines · Wolfgang Denk
Dear Jason Hui,
Quoted 1 line · In message <CAFQ4atQfQ7YKKwa5fBBe16eWT95uBnKk1bjtPPqw8adTUWZvZQ@mail.gmail.com>…
Quoted 8 lines
Quoted 2 lines
Then what's the rule that we must need use
CONFIG_SYS_other thanCONFIG_option?You yourself quoted the relevant part of the README before in this thread. ?Just re-read your own posting and/or the README:
11/23 Jason Hui ? ? ? ? ?Re: [PATCH] MX:
serial_mxc: cleanup removing nasty #ifdef
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/117887
I'm just get confused. It seems from you that we can both use:CONFIG_option and CONFIG_SYS_ in this patch? right?
Quoted 13 lines
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 In the beginning, there was nothing, which exploded.
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?- Terry Pratchett,_LordsandLadies_
PATCH 1/1 MX: serial_mxc: cleanup removing nasty #ifdef
Dear Jason Hui,
Quoted 3 lines · In message <CAFQ4atRGwSxiw+mik8wSMMUVW4M=N9WS55PpD1iFhu-E1Aj_Rg@mail.gmail.com>…
I'm just get confused. It seems from you that we can both use:
CONFIG_optionandCONFIG_SYS_in this patch? right?
It's one of those boarder cases. But given that we don't actually set hardware related values (say, initial data for registers) here, but select from a set of pre-defined options (UART1_BASE etc.) it seems OK to me to handle this as Stefano suggested, i. e. as CONFIG_MXC_UART_BASE .
Best regards,
Wolfgang Denk
Signature · 5 lines
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
You Don't Have To Be 'Damned' To Work Here, But It Helps!!!
- Terry Pratchett, _Eric_PATCH 1/1 MX: serial_mxc: cleanup removing nasty #ifdef
Quoted 4 lines · Wolfgang Denk
Dear Jason Hui,
Quoted 1 line · In message <CAFQ4atRGwSxiw+mik8wSMMUVW4M=N9WS55PpD1iFhu-E1Aj_Rg@mail.gmail.com>…
Quoted 8 lines
Quoted 2 lines
I'm just get confused. It seems from you that we can both use:
CONFIG_optionandCONFIG_SYS_?in this patch? right?It's one of those boarder cases. ?But given that we don't actually set hardware related values (say, initial data for registers) here, but select from a set of pre-defined options (
UART1_BASEetc.) it seems OK to me to handle this as Stefano suggested, i. e. asCONFIG_MXC_UART_BASE.
OK, thanks Wolfgang.
Quoted 12 lines
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 You Don't Have To Be 'Damned' To Work Here, But It Helps!!! ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? - Terry Pratchett, _Eric_
PATCH 1/1 MX: serial_mxc: cleanup removing nasty #ifdef
In reply to Stefano BabicQuoted 41 lines · Stefano Babic
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 <[email protected]>CC Marek Vasut <[email protected]>CC Wolfgang Denk <[email protected]>CC Fabio Estevam <[email protected]>CC Helmut Raiger <[email protected]>CC John Rigby <[email protected]>CC Matthias Weisser <[email protected]>CC Jason Liu <[email protected]>---
?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 +-
Quoted 1 line
?26 files changed, 47 insertions(+), 74 deletions(-)
[..]