2007-11-26 20:11:43 +08:00
|
|
|
/* arch/arm/mach-msm/io.c
|
|
|
|
*
|
|
|
|
* MSM7K io support
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 Google, Inc.
|
|
|
|
* Author: Brian Swetland <swetland@google.com>
|
|
|
|
*
|
|
|
|
* This software is licensed under the terms of the GNU General Public
|
|
|
|
* License version 2, as published by the Free Software Foundation, and
|
|
|
|
* may be copied, distributed, and modified under those terms.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/init.h>
|
2008-09-06 19:10:45 +08:00
|
|
|
#include <linux/io.h>
|
2007-11-26 20:11:43 +08:00
|
|
|
|
2008-08-05 23:14:15 +08:00
|
|
|
#include <mach/hardware.h>
|
2007-11-26 20:11:43 +08:00
|
|
|
#include <asm/page.h>
|
2008-08-05 23:14:15 +08:00
|
|
|
#include <mach/msm_iomap.h>
|
2007-11-26 20:11:43 +08:00
|
|
|
#include <asm/mach/map.h>
|
|
|
|
|
2008-08-05 23:14:15 +08:00
|
|
|
#include <mach/board.h>
|
2007-11-26 20:11:43 +08:00
|
|
|
|
|
|
|
#define MSM_DEVICE(name) { \
|
|
|
|
.virtual = MSM_##name##_BASE, \
|
|
|
|
.pfn = __phys_to_pfn(MSM_##name##_PHYS), \
|
|
|
|
.length = MSM_##name##_SIZE, \
|
|
|
|
.type = MT_DEVICE_NONSHARED, \
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct map_desc msm_io_desc[] __initdata = {
|
|
|
|
MSM_DEVICE(VIC),
|
|
|
|
MSM_DEVICE(CSR),
|
|
|
|
MSM_DEVICE(GPT),
|
|
|
|
MSM_DEVICE(DMOV),
|
|
|
|
MSM_DEVICE(UART1),
|
|
|
|
MSM_DEVICE(UART2),
|
|
|
|
MSM_DEVICE(UART3),
|
|
|
|
MSM_DEVICE(I2C),
|
|
|
|
MSM_DEVICE(GPIO1),
|
|
|
|
MSM_DEVICE(GPIO2),
|
|
|
|
MSM_DEVICE(HSUSB),
|
|
|
|
MSM_DEVICE(CLK_CTL),
|
|
|
|
MSM_DEVICE(PMDH),
|
|
|
|
MSM_DEVICE(EMDH),
|
|
|
|
MSM_DEVICE(MDP),
|
|
|
|
{
|
|
|
|
.virtual = MSM_SHARED_RAM_BASE,
|
|
|
|
.pfn = __phys_to_pfn(MSM_SHARED_RAM_PHYS),
|
|
|
|
.length = MSM_SHARED_RAM_SIZE,
|
|
|
|
.type = MT_DEVICE,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
void __init msm_map_common_io(void)
|
|
|
|
{
|
|
|
|
/* Make sure the peripheral register window is closed, since
|
|
|
|
* we will use PTE flags (TEX[1]=1,B=0,C=1) to determine which
|
|
|
|
* pages are peripheral interface or not.
|
|
|
|
*/
|
|
|
|
asm("mcr p15, 0, %0, c15, c2, 4" : : "r" (0));
|
|
|
|
|
|
|
|
iotable_init(msm_io_desc, ARRAY_SIZE(msm_io_desc));
|
|
|
|
}
|
|
|
|
|
|
|
|
void __iomem *
|
|
|
|
__msm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
|
|
|
|
{
|
|
|
|
if (mtype == MT_DEVICE) {
|
|
|
|
/* The peripherals in the 88000000 - D0000000 range
|
|
|
|
* are only accessable by type MT_DEVICE_NONSHARED.
|
|
|
|
* Adjust mtype as necessary to make this "just work."
|
|
|
|
*/
|
|
|
|
if ((phys_addr >= 0x88000000) && (phys_addr < 0xD0000000))
|
|
|
|
mtype = MT_DEVICE_NONSHARED;
|
|
|
|
}
|
|
|
|
|
|
|
|
return __arm_ioremap(phys_addr, size, mtype);
|
|
|
|
}
|