xref: /linux/arch/arm/mach-pxa/generic.c (revision 6769717d5d51596618f6b143008d8ace11ec8a69)
11da177e4SLinus Torvalds /*
21da177e4SLinus Torvalds  *  linux/arch/arm/mach-pxa/generic.c
31da177e4SLinus Torvalds  *
41da177e4SLinus Torvalds  *  Author:	Nicolas Pitre
51da177e4SLinus Torvalds  *  Created:	Jun 15, 2001
61da177e4SLinus Torvalds  *  Copyright:	MontaVista Software Inc.
71da177e4SLinus Torvalds  *
81da177e4SLinus Torvalds  * Code common to all PXA machines.
91da177e4SLinus Torvalds  *
101da177e4SLinus Torvalds  * This program is free software; you can redistribute it and/or modify
111da177e4SLinus Torvalds  * it under the terms of the GNU General Public License version 2 as
121da177e4SLinus Torvalds  * published by the Free Software Foundation.
131da177e4SLinus Torvalds  *
141da177e4SLinus Torvalds  * Since this file should be linked before any other machine specific file,
151da177e4SLinus Torvalds  * the __initcall() here will be executed first.  This serves as default
161da177e4SLinus Torvalds  * initialization stuff for PXA machines which can be overridden later if
171da177e4SLinus Torvalds  * need be.
181da177e4SLinus Torvalds  */
191da177e4SLinus Torvalds #include <linux/module.h>
201da177e4SLinus Torvalds #include <linux/kernel.h>
211da177e4SLinus Torvalds #include <linux/init.h>
221da177e4SLinus Torvalds 
23a09e64fbSRussell King #include <mach/hardware.h>
241da177e4SLinus Torvalds #include <asm/system.h>
251da177e4SLinus Torvalds #include <asm/pgtable.h>
261da177e4SLinus Torvalds #include <asm/mach/map.h>
27*6769717dSEric Miao #include <asm/mach-types.h>
281da177e4SLinus Torvalds 
29a09e64fbSRussell King #include <mach/pxa-regs.h>
30afd2fc02SRussell King #include <mach/reset.h>
311da177e4SLinus Torvalds 
321da177e4SLinus Torvalds #include "generic.h"
331da177e4SLinus Torvalds 
3404fef228SEric Miao void clear_reset_status(unsigned int mask)
3504fef228SEric Miao {
3604fef228SEric Miao 	if (cpu_is_pxa2xx())
3704fef228SEric Miao 		pxa2xx_clear_reset_status(mask);
3804fef228SEric Miao 
3904fef228SEric Miao 	if (cpu_is_pxa3xx())
4004fef228SEric Miao 		pxa3xx_clear_reset_status(mask);
4104fef228SEric Miao }
4204fef228SEric Miao 
43*6769717dSEric Miao unsigned long get_clock_tick_rate(void)
44*6769717dSEric Miao {
45*6769717dSEric Miao 	unsigned long clock_tick_rate;
46*6769717dSEric Miao 
47*6769717dSEric Miao 	if (cpu_is_pxa25x())
48*6769717dSEric Miao 		clock_tick_rate = 3686400;
49*6769717dSEric Miao 	else if (machine_is_mainstone())
50*6769717dSEric Miao 		clock_tick_rate = 3249600;
51*6769717dSEric Miao 	else
52*6769717dSEric Miao 		clock_tick_rate = 3250000;
53*6769717dSEric Miao 
54*6769717dSEric Miao 	return clock_tick_rate;
55*6769717dSEric Miao }
56*6769717dSEric Miao EXPORT_SYMBOL(get_clock_tick_rate);
57*6769717dSEric Miao 
581da177e4SLinus Torvalds /*
5915a40333SRussell King  * Get the clock frequency as reflected by CCCR and the turbo flag.
6015a40333SRussell King  * We assume these values have been applied via a fcs.
6115a40333SRussell King  * If info is not 0 we also display the current settings.
6215a40333SRussell King  */
6315a40333SRussell King unsigned int get_clk_frequency_khz(int info)
6415a40333SRussell King {
650ffcbfd5SEric Miao 	if (cpu_is_pxa25x())
6615a40333SRussell King 		return pxa25x_get_clk_frequency_khz(info);
672c8086a5Seric miao 	else if (cpu_is_pxa27x())
6815a40333SRussell King 		return pxa27x_get_clk_frequency_khz(info);
692c8086a5Seric miao 	else
702c8086a5Seric miao 		return pxa3xx_get_clk_frequency_khz(info);
7115a40333SRussell King }
7215a40333SRussell King EXPORT_SYMBOL(get_clk_frequency_khz);
7315a40333SRussell King 
7415a40333SRussell King /*
7515a40333SRussell King  * Return the current memory clock frequency in units of 10kHz
7615a40333SRussell King  */
7715a40333SRussell King unsigned int get_memclk_frequency_10khz(void)
7815a40333SRussell King {
790ffcbfd5SEric Miao 	if (cpu_is_pxa25x())
8015a40333SRussell King 		return pxa25x_get_memclk_frequency_10khz();
812c8086a5Seric miao 	else if (cpu_is_pxa27x())
8215a40333SRussell King 		return pxa27x_get_memclk_frequency_10khz();
832c8086a5Seric miao 	else
842c8086a5Seric miao 		return pxa3xx_get_memclk_frequency_10khz();
8515a40333SRussell King }
8615a40333SRussell King EXPORT_SYMBOL(get_memclk_frequency_10khz);
8715a40333SRussell King 
8815a40333SRussell King /*
891da177e4SLinus Torvalds  * Intel PXA2xx internal register mapping.
901da177e4SLinus Torvalds  *
911da177e4SLinus Torvalds  * Note 1: not all PXA2xx variants implement all those addresses.
921da177e4SLinus Torvalds  *
931da177e4SLinus Torvalds  * Note 2: virtual 0xfffe0000-0xffffffff is reserved for the vector table
941da177e4SLinus Torvalds  *         and cache flush area.
951da177e4SLinus Torvalds  */
961da177e4SLinus Torvalds static struct map_desc standard_io_desc[] __initdata = {
976f9182ebSDeepak Saxena   	{	/* Devs */
986f9182ebSDeepak Saxena 		.virtual	=  0xf2000000,
996f9182ebSDeepak Saxena 		.pfn		= __phys_to_pfn(0x40000000),
1006f9182ebSDeepak Saxena 		.length		= 0x02000000,
1016f9182ebSDeepak Saxena 		.type		= MT_DEVICE
1026f9182ebSDeepak Saxena 	}, {	/* Mem Ctl */
1036f9182ebSDeepak Saxena 		.virtual	=  0xf6000000,
1046f9182ebSDeepak Saxena 		.pfn		= __phys_to_pfn(0x48000000),
1057664c400SRussell King 		.length		= 0x00200000,
1066f9182ebSDeepak Saxena 		.type		= MT_DEVICE
1076f9182ebSDeepak Saxena 	}, {	/* Camera */
1086f9182ebSDeepak Saxena 		.virtual	=  0xfa000000,
1096f9182ebSDeepak Saxena 		.pfn		= __phys_to_pfn(0x50000000),
1106f9182ebSDeepak Saxena 		.length		= 0x00100000,
1116f9182ebSDeepak Saxena 		.type		= MT_DEVICE
1126f9182ebSDeepak Saxena 	}, {	/* IMem ctl */
1136f9182ebSDeepak Saxena 		.virtual	=  0xfe000000,
1146f9182ebSDeepak Saxena 		.pfn		= __phys_to_pfn(0x58000000),
1156f9182ebSDeepak Saxena 		.length		= 0x00100000,
1166f9182ebSDeepak Saxena 		.type		= MT_DEVICE
1176f9182ebSDeepak Saxena 	}, {	/* UNCACHED_PHYS_0 */
1186f9182ebSDeepak Saxena 		.virtual	= 0xff000000,
1196f9182ebSDeepak Saxena 		.pfn		= __phys_to_pfn(0x00000000),
1206f9182ebSDeepak Saxena 		.length		= 0x00100000,
1216f9182ebSDeepak Saxena 		.type		= MT_DEVICE
1226f9182ebSDeepak Saxena 	}
1231da177e4SLinus Torvalds };
1241da177e4SLinus Torvalds 
1251da177e4SLinus Torvalds void __init pxa_map_io(void)
1261da177e4SLinus Torvalds {
1271da177e4SLinus Torvalds 	iotable_init(standard_io_desc, ARRAY_SIZE(standard_io_desc));
1281da177e4SLinus Torvalds 	get_clk_frequency_khz(1);
1291da177e4SLinus Torvalds }
130