2007-11-26 04:11:43 -08:00
/* arch/arm/mach-msm/io.c
*
2010-05-04 15:12:27 -07:00
* MSM7K , QSD io support
2007-11-26 04:11:43 -08:00
*
* Copyright ( C ) 2007 Google , Inc .
2011-01-07 10:20:49 -08:00
* Copyright ( c ) 2008 - 2011 , Code Aurora Forum . All rights reserved .
2007-11-26 04:11:43 -08: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>
2013-07-24 13:54:31 -07:00
# include <linux/bug.h>
2007-11-26 04:11:43 -08:00
# include <linux/init.h>
2008-09-06 12:10:45 +01:00
# include <linux/io.h>
2011-07-31 16:17:29 -04:00
# include <linux/export.h>
2007-11-26 04:11:43 -08:00
2008-08-05 16:14:15 +01:00
# include <mach/hardware.h>
2007-11-26 04:11:43 -08:00
# include <asm/page.h>
2008-08-05 16:14:15 +01:00
# include <mach/msm_iomap.h>
2007-11-26 04:11:43 -08:00
# include <asm/mach/map.h>
2012-09-05 12:28:57 -07:00
# include "common.h"
2012-09-07 13:05:56 -07:00
# define MSM_CHIP_DEVICE_TYPE(name, chip, mem_type) { \
2008-09-10 14:00:53 -07:00
. virtual = ( unsigned long ) MSM_ # # name # # _BASE , \
2011-01-07 10:20:49 -08:00
. pfn = __phys_to_pfn ( chip # # _ # # name # # _PHYS ) , \
. length = chip # # _ # # name # # _SIZE , \
2012-09-07 13:05:56 -07:00
. type = mem_type , \
2007-11-26 04:11:43 -08:00
}
2012-09-07 13:05:56 -07:00
# define MSM_DEVICE_TYPE(name, mem_type) \
MSM_CHIP_DEVICE_TYPE ( name , MSM , mem_type )
# define MSM_CHIP_DEVICE(name, chip) \
MSM_CHIP_DEVICE_TYPE ( name , chip , MT_DEVICE )
2011-01-07 10:20:49 -08:00
# define MSM_DEVICE(name) MSM_CHIP_DEVICE(name, MSM)
2012-09-06 19:50:02 -07:00
# if defined(CONFIG_ARCH_MSM7X00A)
2007-11-26 04:11:43 -08:00
static struct map_desc msm_io_desc [ ] __initdata = {
2012-09-07 13:05:56 -07:00
MSM_DEVICE_TYPE ( VIC , MT_DEVICE_NONSHARED ) ,
MSM_CHIP_DEVICE_TYPE ( CSR , MSM7X00 , MT_DEVICE_NONSHARED ) ,
MSM_DEVICE_TYPE ( DMOV , MT_DEVICE_NONSHARED ) ,
MSM_CHIP_DEVICE_TYPE ( GPIO1 , MSM7X00 , MT_DEVICE_NONSHARED ) ,
MSM_CHIP_DEVICE_TYPE ( GPIO2 , MSM7X00 , MT_DEVICE_NONSHARED ) ,
MSM_DEVICE_TYPE ( CLK_CTL , MT_DEVICE_NONSHARED ) ,
2007-11-26 04:11:43 -08:00
{
2008-09-10 14:00:53 -07:00
. virtual = ( unsigned long ) MSM_SHARED_RAM_BASE ,
2010-05-04 15:12:27 -07:00
. pfn = __phys_to_pfn ( MSM_SHARED_RAM_PHYS ) ,
2007-11-26 04:11:43 -08:00
. length = MSM_SHARED_RAM_SIZE ,
. type = MT_DEVICE ,
} ,
2014-05-26 19:37:40 +03:00
# if defined(CONFIG_DEBUG_MSM_UART)
2013-07-24 13:54:28 -07:00
{
/* Must be last: virtual and pfn filled in by debug_ll_addr() */
. length = SZ_4K ,
. type = MT_DEVICE_NONSHARED ,
}
# endif
2007-11-26 04:11:43 -08:00
} ;
void __init msm_map_common_io ( void )
{
2013-07-24 13:54:28 -07:00
size_t size = ARRAY_SIZE ( msm_io_desc ) ;
2007-11-26 04:11:43 -08:00
/* 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 ) ) ;
2014-05-26 19:37:40 +03:00
# if defined(CONFIG_DEBUG_MSM_UART)
2014-03-16 20:57:29 +01:00
# ifdef CONFIG_MMU
2013-07-24 13:54:28 -07:00
debug_ll_addr ( & msm_io_desc [ size - 1 ] . pfn ,
& msm_io_desc [ size - 1 ] . virtual ) ;
2014-03-16 20:57:29 +01:00
# endif
2013-07-24 13:54:28 -07:00
msm_io_desc [ size - 1 ] . pfn = __phys_to_pfn ( msm_io_desc [ size - 1 ] . pfn ) ;
# endif
iotable_init ( msm_io_desc , size ) ;
2007-11-26 04:11:43 -08:00
}
2010-05-04 15:12:27 -07:00
# endif
# ifdef CONFIG_ARCH_QSD8X50
static struct map_desc qsd8x50_io_desc [ ] __initdata = {
MSM_DEVICE ( VIC ) ,
2011-01-07 10:20:49 -08:00
MSM_CHIP_DEVICE ( CSR , QSD8X50 ) ,
2010-05-04 15:12:27 -07:00
MSM_DEVICE ( DMOV ) ,
2011-05-12 00:54:36 -07:00
MSM_CHIP_DEVICE ( GPIO1 , QSD8X50 ) ,
MSM_CHIP_DEVICE ( GPIO2 , QSD8X50 ) ,
2010-05-04 15:12:27 -07:00
MSM_DEVICE ( CLK_CTL ) ,
MSM_DEVICE ( SIRC ) ,
MSM_DEVICE ( SCPLL ) ,
MSM_DEVICE ( AD5 ) ,
MSM_DEVICE ( MDC ) ,
{
. 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 )
{
2013-07-24 13:54:28 -07:00
debug_ll_io_init ( ) ;
2010-05-04 15:12:27 -07:00
iotable_init ( qsd8x50_io_desc , ARRAY_SIZE ( qsd8x50_io_desc ) ) ;
}
# endif /* CONFIG_ARCH_QSD8X50 */
2007-11-26 04:11:43 -08:00
2010-05-04 15:26:13 -07:00
# ifdef CONFIG_ARCH_MSM7X30
static struct map_desc msm7x30_io_desc [ ] __initdata = {
MSM_DEVICE ( VIC ) ,
2011-01-07 10:20:49 -08:00
MSM_CHIP_DEVICE ( CSR , MSM7X30 ) ,
2010-05-04 15:26:13 -07:00
MSM_DEVICE ( DMOV ) ,
2011-05-12 00:54:36 -07:00
MSM_CHIP_DEVICE ( GPIO1 , MSM7X30 ) ,
MSM_CHIP_DEVICE ( GPIO2 , MSM7X30 ) ,
2010-05-04 15:26:13 -07:00
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 ) ,
{
. 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 )
{
2013-07-24 13:54:28 -07:00
debug_ll_io_init ( ) ;
2010-05-04 15:26:13 -07:00
iotable_init ( msm7x30_io_desc , ARRAY_SIZE ( msm7x30_io_desc ) ) ;
}
# endif /* CONFIG_ARCH_MSM7X30 */
2013-07-24 13:54:27 -07:00
# ifdef CONFIG_ARCH_MSM7X00A
2013-05-16 19:40:22 +01:00
void __iomem * __msm_ioremap_caller ( phys_addr_t phys_addr , size_t size ,
2012-02-13 13:27:24 -06:00
unsigned int mtype , void * caller )
2007-11-26 04:11:43 -08:00
{
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 15:38:34 -04:00
* are only accessible by type MT_DEVICE_NONSHARED .
2007-11-26 04:11:43 -08:00
* Adjust mtype as necessary to make this " just work. "
*/
if ( ( phys_addr > = 0x88000000 ) & & ( phys_addr < 0xD0000000 ) )
mtype = MT_DEVICE_NONSHARED ;
}
2012-02-13 13:27:24 -06:00
return __arm_ioremap_caller ( phys_addr , size , mtype , caller ) ;
2007-11-26 04:11:43 -08:00
}
2013-07-24 13:54:27 -07:00
# endif