1 // SPDX-License-Identifier: GPL-2.0-or-later 2 /* 3 * Author: Alexander Shiyan <shc_work@mail.ru>, 2016 4 */ 5 6 #include <linux/io.h> 7 #include <linux/of_fdt.h> 8 #include <linux/platform_device.h> 9 #include <linux/random.h> 10 #include <linux/sizes.h> 11 12 #include <linux/mfd/syscon/clps711x.h> 13 14 #include <asm/system_info.h> 15 #include <asm/system_misc.h> 16 #include <asm/mach/arch.h> 17 #include <asm/mach/map.h> 18 19 #define CLPS711X_VIRT_BASE IOMEM(0xfeff4000) 20 #define CLPS711X_PHYS_BASE (0x80000000) 21 # define SYSFLG1 (0x0140) 22 # define HALT (0x0800) 23 # define UNIQID (0x2440) 24 # define RANDID0 (0x2700) 25 # define RANDID1 (0x2704) 26 # define RANDID2 (0x2708) 27 # define RANDID3 (0x270c) 28 29 static struct map_desc clps711x_io_desc __initdata = { 30 .virtual = (unsigned long)CLPS711X_VIRT_BASE, 31 .pfn = __phys_to_pfn(CLPS711X_PHYS_BASE), 32 .length = 48 * SZ_1K, 33 .type = MT_DEVICE, 34 }; 35 36 static void __init clps711x_map_io(void) 37 { 38 iotable_init(&clps711x_io_desc, 1); 39 } 40 41 static const struct resource clps711x_cpuidle_res = 42 DEFINE_RES_MEM(CLPS711X_PHYS_BASE + HALT, SZ_128); 43 44 static void __init clps711x_init(void) 45 { 46 u32 id[5]; 47 48 id[0] = readl(CLPS711X_VIRT_BASE + UNIQID); 49 id[1] = readl(CLPS711X_VIRT_BASE + RANDID0); 50 id[2] = readl(CLPS711X_VIRT_BASE + RANDID1); 51 id[3] = readl(CLPS711X_VIRT_BASE + RANDID2); 52 id[4] = readl(CLPS711X_VIRT_BASE + RANDID3); 53 system_rev = SYSFLG1_VERID(readl(CLPS711X_VIRT_BASE + SYSFLG1)); 54 55 add_device_randomness(id, sizeof(id)); 56 57 system_serial_low = id[0]; 58 59 platform_device_register_simple("clps711x-cpuidle", PLATFORM_DEVID_NONE, 60 &clps711x_cpuidle_res, 1); 61 } 62 63 static void clps711x_restart(enum reboot_mode mode, const char *cmd) 64 { 65 soft_restart(0); 66 } 67 68 static const char *const clps711x_compat[] __initconst = { 69 "cirrus,ep7209", 70 NULL 71 }; 72 73 DT_MACHINE_START(CLPS711X_DT, "Cirrus Logic CLPS711X (Device Tree Support)") 74 .dt_compat = clps711x_compat, 75 .map_io = clps711x_map_io, 76 .init_late = clps711x_init, 77 .restart = clps711x_restart, 78 MACHINE_END 79
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.