xref: /linux/arch/arm/mach-pxa/generic.c (revision 851982c1b6ca18cedf6d01e4529a0c1ddb30771e)
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>
276769717dSEric Miao #include <asm/mach-types.h>
281da177e4SLinus Torvalds 
29afd2fc02SRussell King #include <mach/reset.h>
30da065a0bSEric Miao #include <mach/gpio.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 
436769717dSEric Miao unsigned long get_clock_tick_rate(void)
446769717dSEric Miao {
456769717dSEric Miao 	unsigned long clock_tick_rate;
466769717dSEric Miao 
476769717dSEric Miao 	if (cpu_is_pxa25x())
486769717dSEric Miao 		clock_tick_rate = 3686400;
496769717dSEric Miao 	else if (machine_is_mainstone())
506769717dSEric Miao 		clock_tick_rate = 3249600;
516769717dSEric Miao 	else
526769717dSEric Miao 		clock_tick_rate = 3250000;
536769717dSEric Miao 
546769717dSEric Miao 	return clock_tick_rate;
556769717dSEric Miao }
566769717dSEric Miao EXPORT_SYMBOL(get_clock_tick_rate);
576769717dSEric 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);
69ecf89b8aSHaojian Zhuang 	return 0;
7015a40333SRussell King }
7115a40333SRussell King EXPORT_SYMBOL(get_clk_frequency_khz);
7215a40333SRussell King 
7315a40333SRussell King /*
7415a40333SRussell King  * Return the current memory clock frequency in units of 10kHz
7515a40333SRussell King  */
7615a40333SRussell King unsigned int get_memclk_frequency_10khz(void)
7715a40333SRussell King {
780ffcbfd5SEric Miao 	if (cpu_is_pxa25x())
7915a40333SRussell King 		return pxa25x_get_memclk_frequency_10khz();
802c8086a5Seric miao 	else if (cpu_is_pxa27x())
8115a40333SRussell King 		return pxa27x_get_memclk_frequency_10khz();
82799929d7SHaojian Zhuang 	return 0;
8315a40333SRussell King }
8415a40333SRussell King EXPORT_SYMBOL(get_memclk_frequency_10khz);
8515a40333SRussell King 
8615a40333SRussell King /*
871da177e4SLinus Torvalds  * Intel PXA2xx internal register mapping.
881da177e4SLinus Torvalds  *
89*851982c1SMarek Vasut  * Note: virtual 0xfffe0000-0xffffffff is reserved for the vector table
901da177e4SLinus Torvalds  *       and cache flush area.
911da177e4SLinus Torvalds  */
92*851982c1SMarek Vasut static struct map_desc common_io_desc[] __initdata = {
936f9182ebSDeepak Saxena   	{	/* Devs */
946f9182ebSDeepak Saxena 		.virtual	=  0xf2000000,
956f9182ebSDeepak Saxena 		.pfn		= __phys_to_pfn(0x40000000),
966f9182ebSDeepak Saxena 		.length		= 0x02000000,
976f9182ebSDeepak Saxena 		.type		= MT_DEVICE
986f9182ebSDeepak Saxena 	}, {	/* UNCACHED_PHYS_0 */
996f9182ebSDeepak Saxena 		.virtual	= 0xff000000,
1006f9182ebSDeepak Saxena 		.pfn		= __phys_to_pfn(0x00000000),
1016f9182ebSDeepak Saxena 		.length		= 0x00100000,
1026f9182ebSDeepak Saxena 		.type		= MT_DEVICE
1036f9182ebSDeepak Saxena 	}
1041da177e4SLinus Torvalds };
1051da177e4SLinus Torvalds 
1061da177e4SLinus Torvalds void __init pxa_map_io(void)
1071da177e4SLinus Torvalds {
108*851982c1SMarek Vasut 	iotable_init(ARRAY_AND_SIZE(common_io_desc));
1091da177e4SLinus Torvalds }
110