From 0154b38b7e7ed37679ab433805f1a1dc1e620d59 Mon Sep 17 00:00:00 2001 From: HuangXin Date: Tue, 21 Aug 2018 16:37:26 +0800 Subject: [PATCH] Add allwinner chipid patch --- lichee/linux-4.9/arch/arm/kernel/setup.c | 34 ++++++++----------- .../char/sunxi-sysinfo/sunxi-sysinfo.c | 9 ++++- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/lichee/linux-4.9/arch/arm/kernel/setup.c b/lichee/linux-4.9/arch/arm/kernel/setup.c index a05da65fa..f7c45c3ca 100644 --- a/lichee/linux-4.9/arch/arm/kernel/setup.c +++ b/lichee/linux-4.9/arch/arm/kernel/setup.c @@ -63,8 +63,6 @@ #include #include -#include - #include "atags.h" @@ -86,6 +84,8 @@ extern void early_paging_init(const struct machine_desc *); extern void adjust_lowmem_bounds(void); extern enum reboot_mode reboot_mode; extern void setup_dma_zone(const struct machine_desc *desc); +extern int sunxi_get_serial(u8 *serial); +extern int sunxi_get_soc_chipid(u8 *chipid); unsigned int processor_id; EXPORT_SYMBOL(processor_id); @@ -1217,17 +1217,15 @@ static int c_show(struct seq_file *m, void *v) { int i, j; u32 cpuid; - -#if defined(CONFIG_ARCH_SUNXI) - u32 serial[4]; - u32 chip_id[4] = {0}; - int ret; - - memset(serial, 0, sizeof(serial)); - ret = sunxi_get_serial((u8 *)serial); - ret = sunxi_get_soc_chipid((u8 *)chip_id); -#endif +#if defined(CONFIG_ARCH_SUNXI) + u32 serial[4]; + u32 chip_id[4] = {0}; + int ret; + memset(serial, 0, sizeof(serial)); + ret = sunxi_get_serial((u8 *)serial); + ret = sunxi_get_soc_chipid((u8 *)chip_id); +#endif for_each_online_cpu(i) { /* * glibc reads /proc/cpuinfo to determine the number of @@ -1284,16 +1282,14 @@ static int c_show(struct seq_file *m, void *v) seq_printf(m, "Hardware\t: %s\n", machine_name); seq_printf(m, "Revision\t: %04x\n", system_rev); - #if defined(CONFIG_ARCH_SUNXI) - seq_printf(m, "Serial\t\t: %04x%08x%08x\n", - serial[2], serial[1], serial[0]); - seq_printf(m, "Chipid\t\t: %08x%08x%08x%08x\n", - chip_id[3],chip_id[2], chip_id[1], chip_id[0]); + seq_printf(m, "Serial\t\t: %04x%08x%08x\n", + serial[2], serial[1], serial[0]); + seq_printf(m, "Chipid\t\t: %08x%08x%08x%08x\n", + chip_id[3],chip_id[2], chip_id[1], chip_id[0]); #else - seq_printf(m, "Serial\t\t: %s\n", system_serial); + seq_printf(m, "Serial\t\t: %s\n", system_serial); #endif - return 0; } diff --git a/lichee/linux-4.9/drivers/char/sunxi-sysinfo/sunxi-sysinfo.c b/lichee/linux-4.9/drivers/char/sunxi-sysinfo/sunxi-sysinfo.c index d8197c199..10ff35fb2 100644 --- a/lichee/linux-4.9/drivers/char/sunxi-sysinfo/sunxi-sysinfo.c +++ b/lichee/linux-4.9/drivers/char/sunxi-sysinfo/sunxi-sysinfo.c @@ -90,6 +90,7 @@ static ssize_t sys_info_show(struct class *class, { int i; int databuf[4] = {0}; + int serial[4]; char tmpbuf[129] = {0}; size_t size = 0; @@ -105,12 +106,18 @@ static ssize_t sys_info_show(struct class *class, size += sprintf(buf + size, "%s\n", "normal"); /* chipid */ - sunxi_get_serial((u8 *)databuf); + sunxi_get_soc_chipid((u8 *)databuf); for (i = 0; i < 4; i++) sprintf(tmpbuf + i*8, "%08x", databuf[i]); tmpbuf[128] = 0; size += sprintf(buf + size, "sunxi_chipid : %s\n", tmpbuf); + /* serial */ + memset(serial, 0, sizeof(serial)); + sunxi_get_serial((u8 *)serial); + sprintf(tmpbuf, "%04x%08x%08x", serial[2], serial[1], serial[0]); + size += sprintf(buf+size, "sunxi_serial : %s\n", tmpbuf); + /* chiptype */ sunxi_get_soc_chipid_str(tmpbuf); size += sprintf(buf + size, "sunxi_chiptype : %s\n", tmpbuf);