Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  *  linux/arch/arm/mach-mmp/common.c
0004  *
0005  *  Code common to PXA168 processor lines
0006  */
0007 
0008 #include <linux/init.h>
0009 #include <linux/kernel.h>
0010 #include <linux/module.h>
0011 
0012 #include <asm/page.h>
0013 #include <asm/mach/map.h>
0014 #include <asm/system_misc.h>
0015 #include "addr-map.h"
0016 #include <linux/soc/mmp/cputype.h>
0017 
0018 #include "common.h"
0019 
0020 #define MMP_CHIPID  CIU_REG(0x00)
0021 
0022 unsigned int mmp_chip_id;
0023 EXPORT_SYMBOL(mmp_chip_id);
0024 
0025 static struct map_desc standard_io_desc[] __initdata = {
0026     {
0027         .pfn        = __phys_to_pfn(APB_PHYS_BASE),
0028         .virtual    = (unsigned long)APB_VIRT_BASE,
0029         .length     = APB_PHYS_SIZE,
0030         .type       = MT_DEVICE,
0031     }, {
0032         .pfn        = __phys_to_pfn(AXI_PHYS_BASE),
0033         .virtual    = (unsigned long)AXI_VIRT_BASE,
0034         .length     = AXI_PHYS_SIZE,
0035         .type       = MT_DEVICE,
0036     },
0037 };
0038 
0039 static struct map_desc mmp2_io_desc[] __initdata = {
0040     {
0041         .pfn        = __phys_to_pfn(PGU_PHYS_BASE),
0042         .virtual    = (unsigned long)PGU_VIRT_BASE,
0043         .length     = PGU_PHYS_SIZE,
0044         .type       = MT_DEVICE,
0045     },
0046 };
0047 
0048 void __init mmp_map_io(void)
0049 {
0050     iotable_init(standard_io_desc, ARRAY_SIZE(standard_io_desc));
0051 
0052     /* this is early, initialize mmp_chip_id here */
0053     mmp_chip_id = __raw_readl(MMP_CHIPID);
0054 }
0055 
0056 void __init mmp2_map_io(void)
0057 {
0058     mmp_map_io();
0059     iotable_init(mmp2_io_desc, ARRAY_SIZE(mmp2_io_desc));
0060 }
0061 
0062 void mmp_restart(enum reboot_mode mode, const char *cmd)
0063 {
0064     soft_restart(0);
0065 }