xref: /linux/arch/arm/mach-pxa/generic.c (revision 08d3df8c81537089fc8f21006b56f2f6fb23c6f8)
1d2912cb1SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
21da177e4SLinus Torvalds /*
31da177e4SLinus Torvalds  *  linux/arch/arm/mach-pxa/generic.c
41da177e4SLinus Torvalds  *
51da177e4SLinus Torvalds  *  Author:	Nicolas Pitre
61da177e4SLinus Torvalds  *  Created:	Jun 15, 2001
71da177e4SLinus Torvalds  *  Copyright:	MontaVista Software Inc.
81da177e4SLinus Torvalds  *
91da177e4SLinus Torvalds  * Code common to all PXA machines.
101da177e4SLinus Torvalds  *
111da177e4SLinus Torvalds  * Since this file should be linked before any other machine specific file,
121da177e4SLinus Torvalds  * the __initcall() here will be executed first.  This serves as default
131da177e4SLinus Torvalds  * initialization stuff for PXA machines which can be overridden later if
141da177e4SLinus Torvalds  * need be.
151da177e4SLinus Torvalds  */
162f8163baSRussell King #include <linux/gpio.h>
171da177e4SLinus Torvalds #include <linux/module.h>
181da177e4SLinus Torvalds #include <linux/kernel.h>
191da177e4SLinus Torvalds #include <linux/init.h>
20*08d3df8cSArnd Bergmann #include <linux/soc/pxa/cpu.h>
211da177e4SLinus Torvalds 
221da177e4SLinus Torvalds #include <asm/mach/map.h>
236769717dSEric Miao #include <asm/mach-types.h>
241da177e4SLinus Torvalds 
25*08d3df8cSArnd Bergmann #include <mach/addr-map.h>
26a38b1f60SRobert Jarzmik #include <mach/irqs.h>
27afd2fc02SRussell King #include <mach/reset.h>
28ad68bb9fSMarek Vasut #include <mach/smemc.h>
29a4553358SHaojian Zhuang #include <mach/pxa3xx-regs.h>
301da177e4SLinus Torvalds 
311da177e4SLinus Torvalds #include "generic.h"
32a38b1f60SRobert Jarzmik #include <clocksource/pxa.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);
38a4553358SHaojian Zhuang 	else {
39a4553358SHaojian Zhuang 		/* RESET_STATUS_* has a 1:1 mapping with ARSR */
40a4553358SHaojian Zhuang 		ARSR = mask;
41a4553358SHaojian Zhuang 	}
4204fef228SEric Miao }
4304fef228SEric Miao 
441da177e4SLinus Torvalds /*
45a38b1f60SRobert Jarzmik  * For non device-tree builds, keep legacy timer init
46a38b1f60SRobert Jarzmik  */
473d3c6a5fSArnd Bergmann void __init pxa_timer_init(void)
48a38b1f60SRobert Jarzmik {
495e1d0128SRobert Jarzmik 	if (cpu_is_pxa25x())
505e1d0128SRobert Jarzmik 		pxa25x_clocks_init();
515e1d0128SRobert Jarzmik 	if (cpu_is_pxa27x())
525e1d0128SRobert Jarzmik 		pxa27x_clocks_init();
53a1c0a6adSRobert Jarzmik 	if (cpu_is_pxa3xx())
54a1c0a6adSRobert Jarzmik 		pxa3xx_clocks_init();
55f4e14edfSRobert Jarzmik 	pxa_timer_nodt_init(IRQ_OST0, io_p2v(0x40a00000));
56a38b1f60SRobert Jarzmik }
57a38b1f60SRobert Jarzmik 
58a38b1f60SRobert Jarzmik /*
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 /*
741da177e4SLinus Torvalds  * Intel PXA2xx internal register mapping.
751da177e4SLinus Torvalds  *
76851982c1SMarek Vasut  * Note: virtual 0xfffe0000-0xffffffff is reserved for the vector table
771da177e4SLinus Torvalds  *       and cache flush area.
781da177e4SLinus Torvalds  */
79851982c1SMarek Vasut static struct map_desc common_io_desc[] __initdata = {
806f9182ebSDeepak Saxena   	{	/* Devs */
810e32986cSLaurent Pinchart 		.virtual	= (unsigned long)PERIPH_VIRT,
820e32986cSLaurent Pinchart 		.pfn		= __phys_to_pfn(PERIPH_PHYS),
830e32986cSLaurent Pinchart 		.length		= PERIPH_SIZE,
846f9182ebSDeepak Saxena 		.type		= MT_DEVICE
856f9182ebSDeepak Saxena 	}
861da177e4SLinus Torvalds };
871da177e4SLinus Torvalds 
881da177e4SLinus Torvalds void __init pxa_map_io(void)
891da177e4SLinus Torvalds {
902111667bSAndrew Ruder 	debug_ll_io_init();
91851982c1SMarek Vasut 	iotable_init(ARRAY_AND_SIZE(common_io_desc));
921da177e4SLinus Torvalds }
93