Commit 0f179ff9 authored by Tony Lindgren's avatar Tony Lindgren

ARM: OMAP: Clean-up omap1 low-level io init and ensure cache & tlb flushing

Caches and tlb must be flushed after map_io as pointed out by RMK on
linux-arm-kernel mailing list.

This patch adds does following:

- Move hw init from omap_map_common_io() to new function omap1_init_common_hw()

- Ensure cache and tlb flushing is done in omap_map_common_io() because of
  cpu detection

- Ensure cache and tlb flushing is done after mapping sram

- Remove old unused init check code
parent 17120a28
......@@ -30,6 +30,7 @@
static void __init omap_generic_init_irq(void)
{
omap1_init_common_hw();
omap_init_irq();
}
......@@ -104,7 +105,7 @@ static void __init omap_generic_init(void)
static void __init omap_generic_map_io(void)
{
omap_map_common_io();
omap1_map_common_io();
}
MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
......
......@@ -187,6 +187,7 @@ static void __init h2_init_smc91x(void)
static void __init h2_init_irq(void)
{
omap1_init_common_hw();
omap_init_irq();
omap_gpio_init();
h2_init_smc91x();
......@@ -274,7 +275,7 @@ static void __init h2_init(void)
static void __init h2_map_io(void)
{
omap_map_common_io();
omap1_map_common_io();
}
MACHINE_START(OMAP_H2, "TI-H2")
......
......@@ -284,6 +284,7 @@ static void __init h3_init_smc91x(void)
void h3_init_irq(void)
{
omap1_init_common_hw();
omap_init_irq();
omap_gpio_init();
h3_init_smc91x();
......@@ -291,7 +292,7 @@ void h3_init_irq(void)
static void __init h3_map_io(void)
{
omap_map_common_io();
omap1_map_common_io();
}
MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board")
......
......@@ -181,6 +181,7 @@ static void __init innovator_init_smc91x(void)
void innovator_init_irq(void)
{
omap1_init_common_hw();
omap_init_irq();
omap_gpio_init();
#ifdef CONFIG_ARCH_OMAP15XX
......@@ -285,7 +286,7 @@ static void __init innovator_init(void)
static void __init innovator_map_io(void)
{
omap_map_common_io();
omap1_map_common_io();
#ifdef CONFIG_ARCH_OMAP15XX
if (cpu_is_omap1510()) {
......
......@@ -169,6 +169,7 @@ static void __init osk_init_cf(void)
static void __init osk_init_irq(void)
{
omap1_init_common_hw();
omap_init_irq();
omap_gpio_init();
osk_init_smc91x();
......@@ -279,7 +280,7 @@ static void __init osk_init(void)
static void __init osk_map_io(void)
{
omap_map_common_io();
omap1_map_common_io();
}
MACHINE_START(OMAP_OSK, "TI-OSK")
......
......@@ -34,6 +34,7 @@
static void __init omap_generic_init_irq(void)
{
omap1_init_common_hw();
omap_init_irq();
}
......@@ -72,7 +73,7 @@ static void __init omap_generic_init(void)
static void __init omap_generic_map_io(void)
{
omap_map_common_io();
omap1_map_common_io();
}
MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E")
......
......@@ -179,6 +179,7 @@ static void __init perseus2_init_smc91x(void)
void omap_perseus2_init_irq(void)
{
omap1_init_common_hw();
omap_init_irq();
omap_gpio_init();
perseus2_init_smc91x();
......@@ -195,7 +196,7 @@ static struct map_desc omap_perseus2_io_desc[] __initdata = {
static void __init omap_perseus2_map_io(void)
{
omap_map_common_io();
omap1_map_common_io();
iotable_init(omap_perseus2_io_desc,
ARRAY_SIZE(omap_perseus2_io_desc));
......
......@@ -162,6 +162,7 @@ static struct omap_board_config_kernel voiceblue_config[] = {
static void __init voiceblue_init_irq(void)
{
omap1_init_common_hw();
omap_init_irq();
omap_gpio_init();
}
......@@ -206,7 +207,7 @@ static void __init voiceblue_init(void)
static void __init voiceblue_map_io(void)
{
omap_map_common_io();
omap1_map_common_io();
}
#define MACHINE_PANICED 1
......
......@@ -13,6 +13,7 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <asm/tlb.h>
#include <asm/mach/map.h>
#include <asm/io.h>
#include <asm/arch/mux.h>
......@@ -83,15 +84,24 @@ static struct map_desc omap16xx_io_desc[] __initdata = {
};
#endif
static int initialized = 0;
static void __init _omap_map_io(void)
/*
* Maps common IO regions for omap1. This should only get called from
* board specific init.
*/
void __init omap1_map_common_io(void)
{
initialized = 1;
/* We have to initialize the IO space mapping before we can run
* cpu_is_omapxxx() macros. */
iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc));
/* Normally devicemaps_init() would flush caches and tlb after
* mdesc->map_io(), but we must also do it here because of the CPU
* revision check below.
*/
local_flush_tlb_all();
flush_cache_all();
/* We want to check CPU revision early for cpu_is_omapxxxx() macros.
* IO space mapping must be initialized before we can do that.
*/
omap_check_revision();
#ifdef CONFIG_ARCH_OMAP730
......@@ -111,7 +121,14 @@ static void __init _omap_map_io(void)
#endif
omap_sram_init();
}
/*
* Common low-level hardware init for omap1. This should only get called from
* board specific init.
*/
void __init omap1_init_common_hw()
{
/* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort
* on a Posted Write in the TIPB Bridge".
*/
......@@ -121,16 +138,7 @@ static void __init _omap_map_io(void)
/* Must init clocks early to assure that timer interrupt works
*/
omap1_clk_init();
}
/*
* This should only get called from board specific init
*/
void __init omap_map_common_io(void)
{
if (!initialized) {
_omap_map_io();
omap1_mux_init();
}
omap1_mux_init();
}
......@@ -16,10 +16,12 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <asm/mach/map.h>
#include <asm/tlb.h>
#include <asm/io.h>
#include <asm/cacheflush.h>
#include <asm/mach/map.h>
#include <asm/arch/sram.h>
#define OMAP1_SRAM_PA 0x20000000
......@@ -150,6 +152,14 @@ void __init omap_map_sram(void)
omap_sram_io_desc[0].pfn, omap_sram_io_desc[0].virtual,
omap_sram_io_desc[0].length);
/*
* Normally devicemaps_init() would flush caches and tlb after
* mdesc->map_io(), but since we're called from map_io(), we
* must do it here.
*/
local_flush_tlb_all();
flush_cache_all();
/*
* Looks like we need to preserve some bootloader code at the
* beginning of SRAM for jumping to flash for reboot to work...
......
......@@ -116,7 +116,8 @@ typedef struct { volatile u32 offset[4096]; } __regbase32;
->offset[((vaddr)&4095)>>2]
#define __REG32(paddr) __REGV32(io_p2v(paddr))
extern void omap_map_common_io(void);
extern void omap1_map_common_io(void);
extern void omap1_init_common_hw(void);
#else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment