2007-11-26 05:11:43 -07:00
|
|
|
/* arch/arm/mach-msm/io.c
|
|
|
|
*
|
2010-05-04 16:12:27 -06:00
|
|
|
* MSM7K, QSD io support
|
2007-11-26 05:11:43 -07:00
|
|
|
*
|
|
|
|
* Copyright (C) 2007 Google, Inc.
|
2010-05-04 16:12:27 -06:00
|
|
|
* Copyright (c) 2008-2010, Code Aurora Forum. All rights reserved.
|
2007-11-26 05:11:43 -07:00
|
|
|
* 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 05:10:45 -06:00
|
|
|
#include <linux/io.h>
|
2007-11-26 05:11:43 -07:00
|
|
|
|
2008-08-05 09:14:15 -06:00
|
|
|
#include <mach/hardware.h>
|
2007-11-26 05:11:43 -07:00
|
|
|
#include <asm/page.h>
|
2008-08-05 09:14:15 -06:00
|
|
|
#include <mach/msm_iomap.h>
|
2007-11-26 05:11:43 -07:00
|
|
|
#include <asm/mach/map.h>
|
|
|
|
|
2008-08-05 09:14:15 -06:00
|
|
|
#include <mach/board.h>
|
2007-11-26 05:11:43 -07:00
|
|
|
|
|
|
|
#define MSM_DEVICE(name) { \
|
2008-09-10 15:00:53 -06:00
|
|
|
.virtual = (unsigned long) MSM_##name##_BASE, \
|
2007-11-26 05:11:43 -07:00
|
|
|
.pfn = __phys_to_pfn(MSM_##name##_PHYS), \
|
|
|
|
.length = MSM_##name##_SIZE, \
|
|
|
|
.type = MT_DEVICE_NONSHARED, \
|
|
|
|
}
|
|
|
|
|
2010-05-04 16:12:27 -06:00
|
|
|
#if defined(CONFIG_ARCH_MSM7X00A) || defined(CONFIG_ARCH_MSM7X27) \
|
|
|
|
|| defined(CONFIG_ARCH_MSM7X25)
|
2007-11-26 05:11:43 -07:00
|
|
|
static struct map_desc msm_io_desc[] __initdata = {
|
|
|
|
MSM_DEVICE(VIC),
|
|
|
|
MSM_DEVICE(CSR),
|
|
|
|
MSM_DEVICE(GPT),
|
|
|
|
MSM_DEVICE(DMOV),
|
|
|
|
MSM_DEVICE(GPIO1),
|
|
|
|
MSM_DEVICE(GPIO2),
|
|
|
|
MSM_DEVICE(CLK_CTL),
|
2009-11-02 03:48:29 -07:00
|
|
|
#ifdef CONFIG_MSM_DEBUG_UART
|
|
|
|
MSM_DEVICE(DEBUG_UART),
|
2010-01-29 12:43:42 -07:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_ARCH_MSM7X30
|
|
|
|
MSM_DEVICE(GCC),
|
2009-11-02 03:48:29 -07:00
|
|
|
#endif
|
2007-11-26 05:11:43 -07:00
|
|
|
{
|
2008-09-10 15:00:53 -06:00
|
|
|
.virtual = (unsigned long) MSM_SHARED_RAM_BASE,
|
2010-05-04 16:12:27 -06:00
|
|
|
.pfn = __phys_to_pfn(MSM_SHARED_RAM_PHYS),
|
2007-11-26 05:11:43 -07:00
|
|
|
.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));
|
|
|
|
}
|
2010-05-04 16:12:27 -06:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_ARCH_QSD8X50
|
|
|
|
static struct map_desc qsd8x50_io_desc[] __initdata = {
|
|
|
|
MSM_DEVICE(VIC),
|
|
|
|
MSM_DEVICE(CSR),
|
|
|
|
MSM_DEVICE(TMR),
|
|
|
|
MSM_DEVICE(DMOV),
|
|
|
|
MSM_DEVICE(GPIO1),
|
|
|
|
MSM_DEVICE(GPIO2),
|
|
|
|
MSM_DEVICE(CLK_CTL),
|
|
|
|
MSM_DEVICE(SIRC),
|
|
|
|
MSM_DEVICE(SCPLL),
|
|
|
|
MSM_DEVICE(AD5),
|
|
|
|
MSM_DEVICE(MDC),
|
|
|
|
#ifdef CONFIG_MSM_DEBUG_UART
|
|
|
|
MSM_DEVICE(DEBUG_UART),
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
.virtual = (unsigned long) MSM_SHARED_RAM_BASE,
|
|
|
|
.pfn = __phys_to_pfn(MSM_SHARED_RAM_PHYS),
|
|
|
|
.length = MSM_SHARED_RAM_SIZE,
|
|
|
|
.type = MT_DEVICE,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
void __init msm_map_qsd8x50_io(void)
|
|
|
|
{
|
|
|
|
iotable_init(qsd8x50_io_desc, ARRAY_SIZE(qsd8x50_io_desc));
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_ARCH_QSD8X50 */
|
2007-11-26 05:11:43 -07:00
|
|
|
|
2010-01-06 15:55:24 -07:00
|
|
|
#ifdef CONFIG_ARCH_MSM8X60
|
|
|
|
static struct map_desc msm8x60_io_desc[] __initdata = {
|
|
|
|
MSM_DEVICE(QGIC_DIST),
|
|
|
|
MSM_DEVICE(QGIC_CPU),
|
|
|
|
MSM_DEVICE(TMR),
|
2010-12-02 13:05:12 -07:00
|
|
|
MSM_DEVICE(TMR0),
|
2010-01-06 15:55:24 -07:00
|
|
|
MSM_DEVICE(ACC),
|
|
|
|
MSM_DEVICE(GCC),
|
|
|
|
};
|
|
|
|
|
|
|
|
void __init msm_map_msm8x60_io(void)
|
|
|
|
{
|
|
|
|
iotable_init(msm8x60_io_desc, ARRAY_SIZE(msm8x60_io_desc));
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_ARCH_MSM8X60 */
|
|
|
|
|
2010-05-04 16:26:13 -06:00
|
|
|
#ifdef CONFIG_ARCH_MSM7X30
|
|
|
|
static struct map_desc msm7x30_io_desc[] __initdata = {
|
|
|
|
MSM_DEVICE(VIC),
|
|
|
|
MSM_DEVICE(CSR),
|
|
|
|
MSM_DEVICE(TMR),
|
|
|
|
MSM_DEVICE(DMOV),
|
|
|
|
MSM_DEVICE(GPIO1),
|
|
|
|
MSM_DEVICE(GPIO2),
|
|
|
|
MSM_DEVICE(CLK_CTL),
|
|
|
|
MSM_DEVICE(CLK_CTL_SH2),
|
|
|
|
MSM_DEVICE(AD5),
|
|
|
|
MSM_DEVICE(MDC),
|
|
|
|
MSM_DEVICE(ACC),
|
|
|
|
MSM_DEVICE(SAW),
|
|
|
|
MSM_DEVICE(GCC),
|
|
|
|
MSM_DEVICE(TCSR),
|
|
|
|
#ifdef CONFIG_MSM_DEBUG_UART
|
|
|
|
MSM_DEVICE(DEBUG_UART),
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
.virtual = (unsigned long) MSM_SHARED_RAM_BASE,
|
|
|
|
.pfn = __phys_to_pfn(MSM_SHARED_RAM_PHYS),
|
|
|
|
.length = MSM_SHARED_RAM_SIZE,
|
|
|
|
.type = MT_DEVICE,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
void __init msm_map_msm7x30_io(void)
|
|
|
|
{
|
|
|
|
iotable_init(msm7x30_io_desc, ARRAY_SIZE(msm7x30_io_desc));
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_ARCH_MSM7X30 */
|
|
|
|
|
2007-11-26 05:11:43 -07:00
|
|
|
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
|
tree-wide: fix comment/printk typos
"gadget", "through", "command", "maintain", "maintain", "controller", "address",
"between", "initiali[zs]e", "instead", "function", "select", "already",
"equal", "access", "management", "hierarchy", "registration", "interest",
"relative", "memory", "offset", "already",
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-11-01 13:38:34 -06:00
|
|
|
* are only accessible by type MT_DEVICE_NONSHARED.
|
2007-11-26 05:11:43 -07:00
|
|
|
* Adjust mtype as necessary to make this "just work."
|
|
|
|
*/
|
|
|
|
if ((phys_addr >= 0x88000000) && (phys_addr < 0xD0000000))
|
|
|
|
mtype = MT_DEVICE_NONSHARED;
|
|
|
|
}
|
|
|
|
|
2009-12-18 04:10:03 -07:00
|
|
|
return __arm_ioremap_caller(phys_addr, size, mtype,
|
|
|
|
__builtin_return_address(0));
|
2007-11-26 05:11:43 -07:00
|
|
|
}
|
2010-11-09 03:11:29 -07:00
|
|
|
EXPORT_SYMBOL(__msm_ioremap);
|