Skip to content

Commit

Permalink
ARM: OMAP: TI81XX: Prepare for addition of TI814X support
Browse files Browse the repository at this point in the history
This patch updates existing macros, functions used for TI816X, to enable
addition of other SoCs belonging to TI81XX family (e.g., TI814X).

The approach taken is to use TI81XX/ti81xx for code/data going to be common
across all TI81XX devices.

cpu_is_ti81xx() is introduced to handle code common across TI81XX devices.

In addition, ti8168_evm_map_io() is now replaced with ti81xx_map_io() and moved
in mach-omap2/common.c as same will be used for TI814X and is not board
specific.

Signed-off-by: Hemant Pedanekar <hemantp@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
  • Loading branch information
Hemant Pedanekar authored and Tony Lindgren committed Dec 13, 2011
1 parent ec023e4 commit a920360
Show file tree
Hide file tree
Showing 16 changed files with 90 additions and 76 deletions.
6 changes: 3 additions & 3 deletions arch/arm/mach-omap2/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ config SOC_OMAP3430
default y
select ARCH_OMAP_OTG

config SOC_OMAPTI816X
bool "TI816X support"
config SOC_OMAPTI81XX
bool "TI81XX support"
depends on ARCH_OMAP3
default y

Expand Down Expand Up @@ -319,7 +319,7 @@ config MACH_OMAP_3630SDP

config MACH_TI8168EVM
bool "TI8168 Evaluation Module"
depends on SOC_OMAPTI816X
depends on SOC_OMAPTI81XX
default y

config MACH_OMAP_4430SDP
Expand Down
11 changes: 3 additions & 8 deletions arch/arm/mach-omap2/board-ti8168evm.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,12 @@ static void __init ti8168_evm_init(void)
omap_board_config_size = ARRAY_SIZE(ti8168_evm_config);
}

static void __init ti8168_evm_map_io(void)
{
omapti816x_map_common_io();
}

MACHINE_START(TI8168EVM, "ti8168evm")
/* Maintainer: Texas Instruments */
.atag_offset = 0x100,
.map_io = ti8168_evm_map_io,
.init_early = ti816x_init_early,
.init_irq = ti816x_init_irq,
.map_io = ti81xx_map_io,
.init_early = ti81xx_init_early,
.init_irq = ti81xx_init_irq,
.timer = &omap3_timer,
.init_machine = ti8168_evm_init,
MACHINE_END
2 changes: 1 addition & 1 deletion arch/arm/mach-omap2/clock3xxx_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -3602,7 +3602,7 @@ int __init omap3xxx_clk_init(void)
* Lock DPLL5 -- here only until other device init code can
* handle this
*/
if (!cpu_is_ti816x() && (omap_rev() >= OMAP3430_REV_ES2_0))
if (!cpu_is_ti81xx() && (omap_rev() >= OMAP3430_REV_ES2_0))
omap3_clk_lock_dpll5();

/* Avoid sleeping during omap3_core_dpll_m2_set_rate() */
Expand Down
29 changes: 17 additions & 12 deletions arch/arm/mach-omap2/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,27 +110,32 @@ void __init omap3_map_io(void)

/*
* Adjust TAP register base such that omap3_check_revision accesses the correct
* TI816X register for checking device ID (it adds 0x204 to tap base while
* TI816X DEVICE ID register is at offset 0x600 from control base).
* TI81XX register for checking device ID (it adds 0x204 to tap base while
* TI81XX DEVICE ID register is at offset 0x600 from control base).
*/
#define TI816X_TAP_BASE (TI816X_CTRL_BASE + \
TI816X_CONTROL_DEVICE_ID - 0x204)
#define TI81XX_TAP_BASE (TI81XX_CTRL_BASE + \
TI81XX_CONTROL_DEVICE_ID - 0x204)

static struct omap_globals ti816x_globals = {
static struct omap_globals ti81xx_globals = {
.class = OMAP343X_CLASS,
.tap = OMAP2_L4_IO_ADDRESS(TI816X_TAP_BASE),
.ctrl = OMAP2_L4_IO_ADDRESS(TI816X_CTRL_BASE),
.prm = OMAP2_L4_IO_ADDRESS(TI816X_PRCM_BASE),
.cm = OMAP2_L4_IO_ADDRESS(TI816X_PRCM_BASE),
.tap = OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE),
.ctrl = OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE),
.prm = OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE),
.cm = OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE),
};

void __init omap2_set_globals_ti816x(void)
void __init omap2_set_globals_ti81xx(void)
{
__omap2_set_globals(&ti816x_globals);
__omap2_set_globals(&ti81xx_globals);
}

void __init ti81xx_map_io(void)
{
omapti81xx_map_common_io();
}

#define AM33XX_TAP_BASE (AM33XX_CTRL_BASE + \
TI816X_CONTROL_DEVICE_ID - 0x204)
TI81XX_CONTROL_DEVICE_ID - 0x204)

static struct omap_globals am33xx_globals = {
.class = AM335X_CLASS,
Expand Down
13 changes: 7 additions & 6 deletions arch/arm/mach-omap2/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ static inline void omap34xx_map_common_io(void)
}
#endif

#ifdef CONFIG_SOC_OMAPTI816X
extern void omapti816x_map_common_io(void);
#ifdef CONFIG_SOC_OMAPTI81XX
extern void omapti81xx_map_common_io(void);
#else
static inline void omapti816x_map_common_io(void)
static inline void omapti81xx_map_common_io(void)
{
}
#endif
Expand Down Expand Up @@ -90,7 +90,7 @@ void omap35xx_init_early(void);
void omap3630_init_early(void);
void omap3_init_early(void); /* Do not use this one */
void am35xx_init_early(void);
void ti816x_init_early(void);
void ti81xx_init_early(void);
void omap4430_init_early(void);

/*
Expand All @@ -114,7 +114,7 @@ void omap2_set_globals_242x(void);
void omap2_set_globals_243x(void);
void omap2_set_globals_3xxx(void);
void omap2_set_globals_443x(void);
void omap2_set_globals_ti816x(void);
void omap2_set_globals_ti81xx(void);
void omap2_set_globals_am33xx(void);

/* These get called from omap2_set_globals_xxxx(), do not call these */
Expand All @@ -128,6 +128,7 @@ void omap243x_map_io(void);
void omap3_map_io(void);
void am33xx_map_io(void);
void omap4_map_io(void);
void ti81xx_map_io(void);

/**
* omap_test_timeout - busy-loop, testing a condition
Expand Down Expand Up @@ -156,7 +157,7 @@ extern struct device *omap4_get_dsp_device(void);

void omap2_init_irq(void);
void omap3_init_irq(void);
void ti816x_init_irq(void);
void ti81xx_init_irq(void);
extern int omap_irq_pending(void);
void omap_intc_save_context(void);
void omap_intc_restore_context(void);
Expand Down
8 changes: 4 additions & 4 deletions arch/arm/mach-omap2/control.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
#define OMAP343X_CONTROL_PADCONFS_WKUP 0xa00
#define OMAP343X_CONTROL_GENERAL_WKUP 0xa60

/* TI816X spefic control submodules */
#define TI816X_CONTROL_DEVCONF 0x600
/* TI81XX spefic control submodules */
#define TI81XX_CONTROL_DEVCONF 0x600

/* Control register offsets - read/write with omap_ctrl_{read,write}{bwl}() */

Expand Down Expand Up @@ -244,8 +244,8 @@
#define OMAP3_PADCONF_SAD2D_MSTANDBY 0x250
#define OMAP3_PADCONF_SAD2D_IDLEACK 0x254

/* TI816X CONTROL_DEVCONF register offsets */
#define TI816X_CONTROL_DEVICE_ID (TI816X_CONTROL_DEVCONF + 0x000)
/* TI81XX CONTROL_DEVCONF register offsets */
#define TI81XX_CONTROL_DEVICE_ID (TI81XX_CONTROL_DEVCONF + 0x000)

/*
* REVISIT: This list of registers is not comprehensive - there are more
Expand Down
8 changes: 4 additions & 4 deletions arch/arm/mach-omap2/id.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ static void __init omap4_check_features(void)
}
}

static void __init ti816x_check_features(void)
static void __init ti81xx_check_features(void)
{
omap_features = OMAP3_HAS_NEON;
}
Expand Down Expand Up @@ -489,11 +489,11 @@ void __init omap2_check_revision(void)
} else if (cpu_is_omap34xx()) {
omap3_check_revision(&cpu_rev);

/* TI816X doesn't have feature register */
if (!cpu_is_ti816x())
/* TI81XX doesn't have feature register */
if (!cpu_is_ti81xx())
omap3_check_features();
else
ti816x_check_features();
ti81xx_check_features();

omap3_cpuinfo(cpu_rev);
return;
Expand Down
12 changes: 6 additions & 6 deletions arch/arm/mach-omap2/include/mach/debug-macro.S
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ omap_uart_lsr: .word 0
beq 34f @ configure OMAP3UART4
cmp \rp, #OMAP4UART4 @ only on 44xx
beq 44f @ configure OMAP4UART4
cmp \rp, #TI816XUART1 @ ti816x UART offsets different
cmp \rp, #TI81XXUART1 @ ti81Xx UART offsets different
beq 81f @ configure UART1
cmp \rp, #TI816XUART2 @ ti816x UART offsets different
cmp \rp, #TI81XXUART2 @ ti81Xx UART offsets different
beq 82f @ configure UART2
cmp \rp, #TI816XUART3 @ ti816x UART offsets different
cmp \rp, #TI81XXUART3 @ ti81Xx UART offsets different
beq 83f @ configure UART3
cmp \rp, #ZOOM_UART @ only on zoom2/3
beq 95f @ configure ZOOM_UART
Expand All @@ -94,11 +94,11 @@ omap_uart_lsr: .word 0
b 98f
44: mov \rp, #UART_OFFSET(OMAP4_UART4_BASE)
b 98f
81: mov \rp, #UART_OFFSET(TI816X_UART1_BASE)
81: mov \rp, #UART_OFFSET(TI81XX_UART1_BASE)
b 98f
82: mov \rp, #UART_OFFSET(TI816X_UART2_BASE)
82: mov \rp, #UART_OFFSET(TI81XX_UART2_BASE)
b 98f
83: mov \rp, #UART_OFFSET(TI816X_UART3_BASE)
83: mov \rp, #UART_OFFSET(TI81XX_UART3_BASE)
b 98f

95: ldr \rp, =ZOOM_UART_BASE
Expand Down
14 changes: 7 additions & 7 deletions arch/arm/mach-omap2/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ static struct map_desc omap34xx_io_desc[] __initdata = {
};
#endif

#ifdef CONFIG_SOC_OMAPTI816X
static struct map_desc omapti816x_io_desc[] __initdata = {
#ifdef CONFIG_SOC_OMAPTI81XX
static struct map_desc omapti81xx_io_desc[] __initdata = {
{
.virtual = L4_34XX_VIRT,
.pfn = __phys_to_pfn(L4_34XX_PHYS),
Expand Down Expand Up @@ -280,10 +280,10 @@ void __init omap34xx_map_common_io(void)
}
#endif

#ifdef CONFIG_SOC_OMAPTI816X
void __init omapti816x_map_common_io(void)
#ifdef CONFIG_SOC_OMAPTI81XX
void __init omapti81xx_map_common_io(void)
{
iotable_init(omapti816x_io_desc, ARRAY_SIZE(omapti816x_io_desc));
iotable_init(omapti81xx_io_desc, ARRAY_SIZE(omapti81xx_io_desc));
}
#endif

Expand Down Expand Up @@ -442,9 +442,9 @@ void __init am35xx_init_early(void)
omap3_init_early();
}

void __init ti816x_init_early(void)
void __init ti81xx_init_early(void)
{
omap2_set_globals_ti816x();
omap2_set_globals_ti81xx();
omap_common_init_early();
omap3xxx_voltagedomains_init();
omap3xxx_powerdomains_init();
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-omap2/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ void __init omap3_init_irq(void)
omap_init_irq(OMAP34XX_IC_BASE, 96);
}

void __init ti816x_init_irq(void)
void __init ti81xx_init_irq(void)
{
omap_init_irq(OMAP34XX_IC_BASE, 128);
}
Expand Down
6 changes: 3 additions & 3 deletions arch/arm/mach-omap2/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ static void omap_uart_idle_init(struct omap_uart_state *uart)
mod_timer(&uart->timer, jiffies + uart->timeout);
omap_uart_smart_idle_enable(uart, 0);

if (cpu_is_omap34xx() && !(cpu_is_ti816x() || cpu_is_am33xx())) {
if (cpu_is_omap34xx() && !(cpu_is_ti81xx() || cpu_is_am33xx())) {
u32 mod = (uart->num > 1) ? OMAP3430_PER_MOD : CORE_MOD;
u32 wk_mask = 0;
u32 padconf = 0;
Expand Down Expand Up @@ -746,7 +746,7 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
*/
uart->regshift = p->regshift;
uart->membase = p->membase;
if (cpu_is_omap44xx() || cpu_is_ti816x())
if (cpu_is_omap44xx() || cpu_is_ti81xx())
uart->errata |= UART_ERRATA_FIFO_FULL_ABORT;
else if ((serial_read_reg(uart, UART_OMAP_MVER) & 0xFF)
>= UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV)
Expand Down Expand Up @@ -828,7 +828,7 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
}

/* Enable the MDR1 errata for OMAP3 */
if (cpu_is_omap34xx() && !(cpu_is_ti816x() || cpu_is_am33xx()))
if (cpu_is_omap34xx() && !(cpu_is_ti81xx() || cpu_is_am33xx()))
uart->errata |= UART_ERRATA_i202_MDR1_ACCESS;
}

Expand Down
13 changes: 13 additions & 0 deletions arch/arm/plat-omap/include/plat/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ static inline int is_am ##class (void) \
return (GET_AM_CLASS == (id)) ? 1 : 0; \
}

#define GET_TI_CLASS ((omap_rev() >> 24) & 0xff)

#define IS_TI_CLASS(class, id) \
static inline int is_ti ##class (void) \
{ \
return (GET_TI_CLASS == (id)) ? 1 : 0; \
}

#define GET_OMAP_SUBCLASS ((omap_rev() >> 20) & 0x0fff)

#define IS_OMAP_SUBCLASS(subclass, id) \
Expand Down Expand Up @@ -115,6 +123,8 @@ IS_OMAP_CLASS(34xx, 0x34)
IS_OMAP_CLASS(44xx, 0x44)
IS_AM_CLASS(33xx, 0x33)

IS_TI_CLASS(81xx, 0x81)

IS_OMAP_SUBCLASS(242x, 0x242)
IS_OMAP_SUBCLASS(243x, 0x243)
IS_OMAP_SUBCLASS(343x, 0x343)
Expand All @@ -134,6 +144,7 @@ IS_AM_SUBCLASS(335x, 0x335)
#define cpu_is_omap243x() 0
#define cpu_is_omap34xx() 0
#define cpu_is_omap343x() 0
#define cpu_is_ti81xx() 0
#define cpu_is_ti816x() 0
#define cpu_is_am33xx() 0
#define cpu_is_am335x() 0
Expand Down Expand Up @@ -343,6 +354,7 @@ IS_OMAP_TYPE(3517, 0x3517)
# undef cpu_is_omap3530
# undef cpu_is_omap3505
# undef cpu_is_omap3517
# undef cpu_is_ti81xx
# undef cpu_is_ti816x
# undef cpu_is_am33xx
# undef cpu_is_am335x
Expand All @@ -362,6 +374,7 @@ IS_OMAP_TYPE(3517, 0x3517)
!omap3_has_sgx())
# undef cpu_is_omap3630
# define cpu_is_omap3630() is_omap363x()
# define cpu_is_ti81xx() is_ti81xx()
# define cpu_is_ti816x() is_ti816x()
# define cpu_is_am33xx() is_am33xx()
# define cpu_is_am335x() is_am335x()
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/plat-omap/include/plat/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@
#include <plat/omap24xx.h>
#include <plat/omap34xx.h>
#include <plat/omap44xx.h>
#include <plat/ti816x.h>
#include <plat/ti81xx.h>
#include <plat/am33xx.h>

#endif /* __ASM_ARCH_OMAP_HARDWARE_H */
14 changes: 7 additions & 7 deletions arch/arm/plat-omap/include/plat/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@
#define OMAP4_UART3_BASE 0x48020000
#define OMAP4_UART4_BASE 0x4806e000

/* TI816X serial ports */
#define TI816X_UART1_BASE 0x48020000
#define TI816X_UART2_BASE 0x48022000
#define TI816X_UART3_BASE 0x48024000
/* TI81XX serial ports */
#define TI81XX_UART1_BASE 0x48020000
#define TI81XX_UART2_BASE 0x48022000
#define TI81XX_UART3_BASE 0x48024000

/* AM3505/3517 UART4 */
#define AM35XX_UART4_BASE 0x4809E000 /* Only on AM3505/3517 */
Expand Down Expand Up @@ -89,9 +89,9 @@
#define OMAP4UART2 OMAP2UART2
#define OMAP4UART3 43
#define OMAP4UART4 44
#define TI816XUART1 81
#define TI816XUART2 82
#define TI816XUART3 83
#define TI81XXUART1 81
#define TI81XXUART2 82
#define TI81XXUART3 83
#define ZOOM_UART 95 /* Only on zoom2/3 */

/* This is only used by 8250.c for omap1510 */
Expand Down
Loading

0 comments on commit a920360

Please sign in to comment.