Skip to content

Commit

Permalink
omap: Clean the serial port defines
Browse files Browse the repository at this point in the history
This way we don't have conflicts with the defines
with compiling in multiple omaps. Set the addresses
for uarts in struct omap_globals for the early serial
init code.

Signed-off-by: Tony Lindgren <tony@atomide.com>
  • Loading branch information
Tony Lindgren committed Feb 15, 2010
1 parent 4e6d488 commit 4f2c49f
Show file tree
Hide file tree
Showing 11 changed files with 130 additions and 87 deletions.
16 changes: 10 additions & 6 deletions arch/arm/mach-omap1/include/mach/debug-macro.S
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
*
*/

#include <linux/serial_reg.h>

#include <plat/serial.h>

.macro addruart, rx, tmp
mrc p15, 0, \rx, c1, c0
tst \rx, #1 @ MMU enabled?
Expand All @@ -30,13 +34,13 @@
.endm

.macro busyuart,rd,rx
1001: ldrb \rd, [\rx, #(0x5 << 2)] @ OMAP-1510 and friends
and \rd, \rd, #0x60
teq \rd, #0x60
1001: ldrb \rd, [\rx, #(UART_LSR << OMAP_PORT_SHIFT)]
and \rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
teq \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
beq 1002f
ldrb \rd, [\rx, #(0x5 << 0)] @ OMAP-730 only
and \rd, \rd, #0x60
teq \rd, #0x60
ldrb \rd, [\rx, #(UART_LSR << OMAP7XX_PORT_SHIFT)]
and \rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
teq \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
bne 1001b
1002:
.endm
Expand Down
6 changes: 3 additions & 3 deletions arch/arm/mach-omap1/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,23 @@ static void __init omap_serial_reset(struct plat_serial8250_port *p)

static struct plat_serial8250_port serial_platform_data[] = {
{
.mapbase = OMAP_UART1_BASE,
.mapbase = OMAP1_UART1_BASE,
.irq = INT_UART1,
.flags = UPF_BOOT_AUTOCONF,
.iotype = UPIO_MEM,
.regshift = 2,
.uartclk = OMAP16XX_BASE_BAUD * 16,
},
{
.mapbase = OMAP_UART2_BASE,
.mapbase = OMAP1_UART2_BASE,
.irq = INT_UART2,
.flags = UPF_BOOT_AUTOCONF,
.iotype = UPIO_MEM,
.regshift = 2,
.uartclk = OMAP16XX_BASE_BAUD * 16,
},
{
.mapbase = OMAP_UART3_BASE,
.mapbase = OMAP1_UART3_BASE,
.irq = INT_UART3,
.flags = UPF_BOOT_AUTOCONF,
.iotype = UPIO_MEM,
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-omap2/board-3630sdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {

static void __init omap_sdp_map_io(void)
{
omap2_set_globals_343x();
omap2_set_globals_36xx();
omap2_map_common_io();
}

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-omap2/board-zoom3.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

static void __init omap_zoom_map_io(void)
{
omap2_set_globals_343x();
omap2_set_globals_36xx();
omap2_map_common_io();
}

Expand Down
15 changes: 7 additions & 8 deletions arch/arm/mach-omap2/include/mach/debug-macro.S
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
*
*/

#include <linux/serial_reg.h>

#include <plat/serial.h>

.macro addruart, rx, tmp
mrc p15, 0, \rx, c1, c0
tst \rx, #1 @ MMU enabled?
Expand Down Expand Up @@ -44,15 +48,10 @@
.endm

.macro busyuart,rd,rx
1001: ldrb \rd, [\rx, #(0x5 << 2)] @ OMAP-1510 and friends
and \rd, \rd, #0x60
teq \rd, #0x60
beq 1002f
ldrb \rd, [\rx, #(0x5 << 0)] @ OMAP-730 only
and \rd, \rd, #0x60
teq \rd, #0x60
1001: ldrb \rd, [\rx, #(UART_LSR << OMAP_PORT_SHIFT)]
and \rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
teq \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
bne 1001b
1002:
.endm

.macro waituart,rd,rx
Expand Down
15 changes: 11 additions & 4 deletions arch/arm/mach-omap2/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ static LIST_HEAD(uart_list);

static struct plat_serial8250_port serial_platform_data0[] = {
{
.mapbase = OMAP_UART1_BASE,
.irq = 72,
.flags = UPF_BOOT_AUTOCONF,
.iotype = UPIO_MEM,
Expand All @@ -87,7 +86,6 @@ static struct plat_serial8250_port serial_platform_data0[] = {

static struct plat_serial8250_port serial_platform_data1[] = {
{
.mapbase = OMAP_UART2_BASE,
.irq = 73,
.flags = UPF_BOOT_AUTOCONF,
.iotype = UPIO_MEM,
Expand All @@ -100,7 +98,6 @@ static struct plat_serial8250_port serial_platform_data1[] = {

static struct plat_serial8250_port serial_platform_data2[] = {
{
.mapbase = OMAP_UART3_BASE,
.irq = 74,
.flags = UPF_BOOT_AUTOCONF,
.iotype = UPIO_MEM,
Expand All @@ -114,7 +111,6 @@ static struct plat_serial8250_port serial_platform_data2[] = {
#ifdef CONFIG_ARCH_OMAP4
static struct plat_serial8250_port serial_platform_data3[] = {
{
.mapbase = OMAP_UART4_BASE,
.irq = 70,
.flags = UPF_BOOT_AUTOCONF,
.iotype = UPIO_MEM,
Expand All @@ -125,6 +121,17 @@ static struct plat_serial8250_port serial_platform_data3[] = {
}
};
#endif

void __init omap2_set_globals_uart(struct omap_globals *omap2_globals)
{
serial_platform_data0[0].mapbase = omap2_globals->uart1_phys;
serial_platform_data1[0].mapbase = omap2_globals->uart2_phys;
serial_platform_data2[0].mapbase = omap2_globals->uart3_phys;
#ifdef CONFIG_ARCH_OMAP4
serial_platform_data3[0].mapbase = omap2_globals->uart4_phys;
#endif
}

static inline unsigned int __serial_read_reg(struct uart_port *up,
int offset)
{
Expand Down
29 changes: 26 additions & 3 deletions arch/arm/plat-omap/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <plat/control.h>
#include <plat/mux.h>
#include <plat/fpga.h>
#include <plat/serial.h>

#include <plat/clock.h>

Expand Down Expand Up @@ -219,6 +220,7 @@ static void __init __omap2_set_globals(struct omap_globals *omap2_globals)
omap2_set_globals_sdrc(omap2_globals);
omap2_set_globals_control(omap2_globals);
omap2_set_globals_prcm(omap2_globals);
omap2_set_globals_uart(omap2_globals);
}

#endif
Expand All @@ -233,6 +235,9 @@ static struct omap_globals omap242x_globals = {
.ctrl = OMAP2_L4_IO_ADDRESS(OMAP2420_CTRL_BASE),
.prm = OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE),
.cm = OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE),
.uart1_phys = OMAP2_UART1_BASE,
.uart2_phys = OMAP2_UART2_BASE,
.uart3_phys = OMAP2_UART3_BASE,
};

void __init omap2_set_globals_242x(void)
Expand All @@ -251,6 +256,9 @@ static struct omap_globals omap243x_globals = {
.ctrl = OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
.prm = OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE),
.cm = OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE),
.uart1_phys = OMAP2_UART1_BASE,
.uart2_phys = OMAP2_UART2_BASE,
.uart3_phys = OMAP2_UART3_BASE,
};

void __init omap2_set_globals_243x(void)
Expand All @@ -259,21 +267,31 @@ void __init omap2_set_globals_243x(void)
}
#endif

#if defined(CONFIG_ARCH_OMAP3430)
#if defined(CONFIG_ARCH_OMAP3)

static struct omap_globals omap343x_globals = {
static struct omap_globals omap3_globals = {
.class = OMAP343X_CLASS,
.tap = OMAP2_L4_IO_ADDRESS(0x4830A000),
.sdrc = OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
.sms = OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE),
.ctrl = OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
.prm = OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE),
.cm = OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
.uart1_phys = OMAP3_UART1_BASE,
.uart2_phys = OMAP3_UART2_BASE,
.uart3_phys = OMAP3_UART3_BASE,
};

void __init omap2_set_globals_343x(void)
{
__omap2_set_globals(&omap343x_globals);
__omap2_set_globals(&omap3_globals);
}

void __init omap2_set_globals_36xx(void)
{
omap3_globals.uart4_phys = OMAP3_UART4_BASE;

__omap2_set_globals(&omap3_globals);
}
#endif

Expand All @@ -285,13 +303,18 @@ static struct omap_globals omap4_globals = {
.prm = OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE),
.cm = OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
.cm2 = OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE),
.uart1_phys = OMAP4_UART1_BASE,
.uart2_phys = OMAP4_UART2_BASE,
.uart3_phys = OMAP4_UART3_BASE,
.uart4_phys = OMAP4_UART4_BASE,
};

void __init omap2_set_globals_443x(void)
{
omap2_set_globals_tap(&omap4_globals);
omap2_set_globals_control(&omap4_globals);
omap2_set_globals_prcm(&omap4_globals);
omap2_set_globals_uart(&omap4_globals);
}
#endif

6 changes: 6 additions & 0 deletions arch/arm/plat-omap/include/plat/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,24 @@ struct omap_globals {
void __iomem *prm; /* Power and Reset Management */
void __iomem *cm; /* Clock Management */
void __iomem *cm2;
unsigned long uart1_phys;
unsigned long uart2_phys;
unsigned long uart3_phys;
unsigned long uart4_phys;
};

void omap2_set_globals_242x(void);
void omap2_set_globals_243x(void);
void omap2_set_globals_343x(void);
void omap2_set_globals_36xx(void);
void omap2_set_globals_443x(void);

/* These get called from omap2_set_globals_xxxx(), do not call these */
void omap2_set_globals_tap(struct omap_globals *);
void omap2_set_globals_sdrc(struct omap_globals *);
void omap2_set_globals_control(struct omap_globals *);
void omap2_set_globals_prcm(struct omap_globals *);
void omap2_set_globals_uart(struct omap_globals *);

/**
* omap_test_timeout - busy-loop, testing a condition
Expand Down
74 changes: 37 additions & 37 deletions arch/arm/plat-omap/include/plat/omap16xx.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,43 +125,43 @@
#define OMAP16XX_MMCSD2_SSW_MPU_CONF (TIPB_SWITCH_BASE + 0x160)

/* UART3 Registers Mapping through MPU bus */
#define UART3_RHR (OMAP_UART3_BASE + 0)
#define UART3_THR (OMAP_UART3_BASE + 0)
#define UART3_DLL (OMAP_UART3_BASE + 0)
#define UART3_IER (OMAP_UART3_BASE + 4)
#define UART3_DLH (OMAP_UART3_BASE + 4)
#define UART3_IIR (OMAP_UART3_BASE + 8)
#define UART3_FCR (OMAP_UART3_BASE + 8)
#define UART3_EFR (OMAP_UART3_BASE + 8)
#define UART3_LCR (OMAP_UART3_BASE + 0x0C)
#define UART3_MCR (OMAP_UART3_BASE + 0x10)
#define UART3_XON1_ADDR1 (OMAP_UART3_BASE + 0x10)
#define UART3_XON2_ADDR2 (OMAP_UART3_BASE + 0x14)
#define UART3_LSR (OMAP_UART3_BASE + 0x14)
#define UART3_TCR (OMAP_UART3_BASE + 0x18)
#define UART3_MSR (OMAP_UART3_BASE + 0x18)
#define UART3_XOFF1 (OMAP_UART3_BASE + 0x18)
#define UART3_XOFF2 (OMAP_UART3_BASE + 0x1C)
#define UART3_SPR (OMAP_UART3_BASE + 0x1C)
#define UART3_TLR (OMAP_UART3_BASE + 0x1C)
#define UART3_MDR1 (OMAP_UART3_BASE + 0x20)
#define UART3_MDR2 (OMAP_UART3_BASE + 0x24)
#define UART3_SFLSR (OMAP_UART3_BASE + 0x28)
#define UART3_TXFLL (OMAP_UART3_BASE + 0x28)
#define UART3_RESUME (OMAP_UART3_BASE + 0x2C)
#define UART3_TXFLH (OMAP_UART3_BASE + 0x2C)
#define UART3_SFREGL (OMAP_UART3_BASE + 0x30)
#define UART3_RXFLL (OMAP_UART3_BASE + 0x30)
#define UART3_SFREGH (OMAP_UART3_BASE + 0x34)
#define UART3_RXFLH (OMAP_UART3_BASE + 0x34)
#define UART3_BLR (OMAP_UART3_BASE + 0x38)
#define UART3_ACREG (OMAP_UART3_BASE + 0x3C)
#define UART3_DIV16 (OMAP_UART3_BASE + 0x3C)
#define UART3_SCR (OMAP_UART3_BASE + 0x40)
#define UART3_SSR (OMAP_UART3_BASE + 0x44)
#define UART3_EBLR (OMAP_UART3_BASE + 0x48)
#define UART3_OSC_12M_SEL (OMAP_UART3_BASE + 0x4C)
#define UART3_MVR (OMAP_UART3_BASE + 0x50)
#define UART3_RHR (OMAP1_UART3_BASE + 0)
#define UART3_THR (OMAP1_UART3_BASE + 0)
#define UART3_DLL (OMAP1_UART3_BASE + 0)
#define UART3_IER (OMAP1_UART3_BASE + 4)
#define UART3_DLH (OMAP1_UART3_BASE + 4)
#define UART3_IIR (OMAP1_UART3_BASE + 8)
#define UART3_FCR (OMAP1_UART3_BASE + 8)
#define UART3_EFR (OMAP1_UART3_BASE + 8)
#define UART3_LCR (OMAP1_UART3_BASE + 0x0C)
#define UART3_MCR (OMAP1_UART3_BASE + 0x10)
#define UART3_XON1_ADDR1 (OMAP1_UART3_BASE + 0x10)
#define UART3_XON2_ADDR2 (OMAP1_UART3_BASE + 0x14)
#define UART3_LSR (OMAP1_UART3_BASE + 0x14)
#define UART3_TCR (OMAP1_UART3_BASE + 0x18)
#define UART3_MSR (OMAP1_UART3_BASE + 0x18)
#define UART3_XOFF1 (OMAP1_UART3_BASE + 0x18)
#define UART3_XOFF2 (OMAP1_UART3_BASE + 0x1C)
#define UART3_SPR (OMAP1_UART3_BASE + 0x1C)
#define UART3_TLR (OMAP1_UART3_BASE + 0x1C)
#define UART3_MDR1 (OMAP1_UART3_BASE + 0x20)
#define UART3_MDR2 (OMAP1_UART3_BASE + 0x24)
#define UART3_SFLSR (OMAP1_UART3_BASE + 0x28)
#define UART3_TXFLL (OMAP1_UART3_BASE + 0x28)
#define UART3_RESUME (OMAP1_UART3_BASE + 0x2C)
#define UART3_TXFLH (OMAP1_UART3_BASE + 0x2C)
#define UART3_SFREGL (OMAP1_UART3_BASE + 0x30)
#define UART3_RXFLL (OMAP1_UART3_BASE + 0x30)
#define UART3_SFREGH (OMAP1_UART3_BASE + 0x34)
#define UART3_RXFLH (OMAP1_UART3_BASE + 0x34)
#define UART3_BLR (OMAP1_UART3_BASE + 0x38)
#define UART3_ACREG (OMAP1_UART3_BASE + 0x3C)
#define UART3_DIV16 (OMAP1_UART3_BASE + 0x3C)
#define UART3_SCR (OMAP1_UART3_BASE + 0x40)
#define UART3_SSR (OMAP1_UART3_BASE + 0x44)
#define UART3_EBLR (OMAP1_UART3_BASE + 0x48)
#define UART3_OSC_12M_SEL (OMAP1_UART3_BASE + 0x4C)
#define UART3_MVR (OMAP1_UART3_BASE + 0x50)

/*
* ---------------------------------------------------------------------------
Expand Down
Loading

0 comments on commit 4f2c49f

Please sign in to comment.