1*d2912cb1SThomas 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> 201da177e4SLinus Torvalds 21a09e64fbSRussell King #include <mach/hardware.h> 221da177e4SLinus Torvalds #include <asm/mach/map.h> 236769717dSEric Miao #include <asm/mach-types.h> 241da177e4SLinus Torvalds 25a38b1f60SRobert Jarzmik #include <mach/irqs.h> 26afd2fc02SRussell King #include <mach/reset.h> 27ad68bb9fSMarek Vasut #include <mach/smemc.h> 28a4553358SHaojian Zhuang #include <mach/pxa3xx-regs.h> 291da177e4SLinus Torvalds 301da177e4SLinus Torvalds #include "generic.h" 31a38b1f60SRobert Jarzmik #include <clocksource/pxa.h> 321da177e4SLinus Torvalds 3304fef228SEric Miao void clear_reset_status(unsigned int mask) 3404fef228SEric Miao { 3504fef228SEric Miao if (cpu_is_pxa2xx()) 3604fef228SEric Miao pxa2xx_clear_reset_status(mask); 37a4553358SHaojian Zhuang else { 38a4553358SHaojian Zhuang /* RESET_STATUS_* has a 1:1 mapping with ARSR */ 39a4553358SHaojian Zhuang ARSR = mask; 40a4553358SHaojian Zhuang } 4104fef228SEric Miao } 4204fef228SEric Miao 431da177e4SLinus Torvalds /* 44a38b1f60SRobert Jarzmik * For non device-tree builds, keep legacy timer init 45a38b1f60SRobert Jarzmik */ 463d3c6a5fSArnd Bergmann void __init pxa_timer_init(void) 47a38b1f60SRobert Jarzmik { 485e1d0128SRobert Jarzmik if (cpu_is_pxa25x()) 495e1d0128SRobert Jarzmik pxa25x_clocks_init(); 505e1d0128SRobert Jarzmik if (cpu_is_pxa27x()) 515e1d0128SRobert Jarzmik pxa27x_clocks_init(); 52a1c0a6adSRobert Jarzmik if (cpu_is_pxa3xx()) 53a1c0a6adSRobert Jarzmik pxa3xx_clocks_init(); 54f4e14edfSRobert Jarzmik pxa_timer_nodt_init(IRQ_OST0, io_p2v(0x40a00000)); 55a38b1f60SRobert Jarzmik } 56a38b1f60SRobert Jarzmik 57a38b1f60SRobert Jarzmik /* 5815a40333SRussell King * Get the clock frequency as reflected by CCCR and the turbo flag. 5915a40333SRussell King * We assume these values have been applied via a fcs. 6015a40333SRussell King * If info is not 0 we also display the current settings. 6115a40333SRussell King */ 6215a40333SRussell King unsigned int get_clk_frequency_khz(int info) 6315a40333SRussell King { 640ffcbfd5SEric Miao if (cpu_is_pxa25x()) 6515a40333SRussell King return pxa25x_get_clk_frequency_khz(info); 662c8086a5Seric miao else if (cpu_is_pxa27x()) 6715a40333SRussell King return pxa27x_get_clk_frequency_khz(info); 68ecf89b8aSHaojian Zhuang return 0; 6915a40333SRussell King } 7015a40333SRussell King EXPORT_SYMBOL(get_clk_frequency_khz); 7115a40333SRussell King 7215a40333SRussell King /* 731da177e4SLinus Torvalds * Intel PXA2xx internal register mapping. 741da177e4SLinus Torvalds * 75851982c1SMarek Vasut * Note: virtual 0xfffe0000-0xffffffff is reserved for the vector table 761da177e4SLinus Torvalds * and cache flush area. 771da177e4SLinus Torvalds */ 78851982c1SMarek Vasut static struct map_desc common_io_desc[] __initdata = { 796f9182ebSDeepak Saxena { /* Devs */ 800e32986cSLaurent Pinchart .virtual = (unsigned long)PERIPH_VIRT, 810e32986cSLaurent Pinchart .pfn = __phys_to_pfn(PERIPH_PHYS), 820e32986cSLaurent Pinchart .length = PERIPH_SIZE, 836f9182ebSDeepak Saxena .type = MT_DEVICE 846f9182ebSDeepak Saxena } 851da177e4SLinus Torvalds }; 861da177e4SLinus Torvalds 871da177e4SLinus Torvalds void __init pxa_map_io(void) 881da177e4SLinus Torvalds { 892111667bSAndrew Ruder debug_ll_io_init(); 90851982c1SMarek Vasut iotable_init(ARRAY_AND_SIZE(common_io_desc)); 911da177e4SLinus Torvalds } 92