From: Jean-Christophe PLAGNIOL-VILLARD Date: Sat, 20 Jun 2009 15:18:16 +0200 Subject: [U-Boot] [PATCH 2/7] serial_mx31: allow it to work with mx27 too and rename to serial_mxc In-Reply-To: <1244419971-13895-3-git-send-email-yanok@emcraft.com> References: <1244419971-13895-1-git-send-email-yanok@emcraft.com> <1244419971-13895-3-git-send-email-yanok@emcraft.com> Message-ID: <20090620131816.GH3849@game.jcrosoft.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 04:12 Mon 08 Jun , Ilya Yanok wrote: > UART hardware on i.MX27 is the same as on the i.MX31 so we just > need to provide the driver with correct address of the registers. > IIRC the imx1 share the same too > Signed-off-by: Ilya Yanok > --- > drivers/serial/Makefile | 2 +- > drivers/serial/{serial_mx31.c => serial_mxc.c} | 21 +++++++++++++++++++++ > include/configs/imx31_litekit.h | 2 +- > include/configs/imx31_phycore.h | 2 +- > include/configs/mx31ads.h | 2 +- > include/configs/qong.h | 2 +- > 6 files changed, 26 insertions(+), 5 deletions(-) > rename drivers/serial/{serial_mx31.c => serial_mxc.c} (94%) > > diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile > index 14c818d..9a572e9 100644 > --- a/drivers/serial/Makefile > +++ b/drivers/serial/Makefile > @@ -40,7 +40,7 @@ COBJS-$(CONFIG_IXP_SERIAL) += serial_ixp.o > COBJS-$(CONFIG_KS8695_SERIAL) += serial_ks8695.o > COBJS-$(CONFIG_LPC2292_SERIAL) += serial_lpc2292.o > COBJS-$(CONFIG_MAX3100_SERIAL) += serial_max3100.o > -COBJS-$(CONFIG_MX31_UART) += serial_mx31.o > +COBJS-$(CONFIG_MXC_UART) += serial_mxc.o > COBJS-$(CONFIG_NETARM_SERIAL) += serial_netarm.o > COBJS-$(CONFIG_PL010_SERIAL) += serial_pl01x.o > COBJS-$(CONFIG_PL011_SERIAL) += serial_pl01x.o > diff --git a/drivers/serial/serial_mx31.c b/drivers/serial/serial_mxc.c > similarity index 94% > rename from drivers/serial/serial_mx31.c > rename to drivers/serial/serial_mxc.c > index 7c0682a..acc5b7d 100644 > --- a/drivers/serial/serial_mx31.c > +++ b/drivers/serial/serial_mxc.c > @@ -18,7 +18,12 @@ > */ > > #include > +#ifdef CONFIG_MX31 > #include > +#else > +#include > +#include > +#endif > > #define __REG(x) (*((volatile u32 *)(x))) > > @@ -32,6 +37,18 @@ > #define UART_PHYS 0x43fb0000 > #elif defined(CONFIG_SYS_MX31_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 > #else > #error "define CONFIG_SYS_MX31_UARTx to use the mx31 UART driver" > #endif > @@ -149,7 +166,11 @@ DECLARE_GLOBAL_DATA_PTR; > > void serial_setbrg (void) > { > +#ifdef CONFIG_MX31 > u32 clk = mx31_get_ipg_clk(); > +#else > + u32 clk = imx_get_perclk1(); > +#endif here we need to have a common clock rate function name as we do for avr32 & at91 this could done in a next patch but mandatory for other board adding applied to u-boot-arm Best Regards, J.