Add allwinner chipid patch

This commit is contained in:
HuangXin 2018-08-21 16:37:26 +08:00
parent 9b9c27def2
commit 0154b38b7e
2 changed files with 23 additions and 20 deletions

View File

@ -63,8 +63,6 @@
#include <asm/memblock.h> #include <asm/memblock.h>
#include <asm/virt.h> #include <asm/virt.h>
#include <mach/sunxi-chip.h>
#include "atags.h" #include "atags.h"
@ -86,6 +84,8 @@ extern void early_paging_init(const struct machine_desc *);
extern void adjust_lowmem_bounds(void); extern void adjust_lowmem_bounds(void);
extern enum reboot_mode reboot_mode; extern enum reboot_mode reboot_mode;
extern void setup_dma_zone(const struct machine_desc *desc); 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; unsigned int processor_id;
EXPORT_SYMBOL(processor_id); EXPORT_SYMBOL(processor_id);
@ -1217,17 +1217,15 @@ static int c_show(struct seq_file *m, void *v)
{ {
int i, j; int i, j;
u32 cpuid; 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) { for_each_online_cpu(i) {
/* /*
* glibc reads /proc/cpuinfo to determine the number of * 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, "Hardware\t: %s\n", machine_name);
seq_printf(m, "Revision\t: %04x\n", system_rev); seq_printf(m, "Revision\t: %04x\n", system_rev);
#if defined(CONFIG_ARCH_SUNXI) #if defined(CONFIG_ARCH_SUNXI)
seq_printf(m, "Serial\t\t: %04x%08x%08x\n", seq_printf(m, "Serial\t\t: %04x%08x%08x\n",
serial[2], serial[1], serial[0]); serial[2], serial[1], serial[0]);
seq_printf(m, "Chipid\t\t: %08x%08x%08x%08x\n", seq_printf(m, "Chipid\t\t: %08x%08x%08x%08x\n",
chip_id[3],chip_id[2], chip_id[1], chip_id[0]); chip_id[3],chip_id[2], chip_id[1], chip_id[0]);
#else #else
seq_printf(m, "Serial\t\t: %s\n", system_serial); seq_printf(m, "Serial\t\t: %s\n", system_serial);
#endif #endif
return 0; return 0;
} }

View File

@ -90,6 +90,7 @@ static ssize_t sys_info_show(struct class *class,
{ {
int i; int i;
int databuf[4] = {0}; int databuf[4] = {0};
int serial[4];
char tmpbuf[129] = {0}; char tmpbuf[129] = {0};
size_t size = 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"); size += sprintf(buf + size, "%s\n", "normal");
/* chipid */ /* chipid */
sunxi_get_serial((u8 *)databuf); sunxi_get_soc_chipid((u8 *)databuf);
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
sprintf(tmpbuf + i*8, "%08x", databuf[i]); sprintf(tmpbuf + i*8, "%08x", databuf[i]);
tmpbuf[128] = 0; tmpbuf[128] = 0;
size += sprintf(buf + size, "sunxi_chipid : %s\n", tmpbuf); 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 */ /* chiptype */
sunxi_get_soc_chipid_str(tmpbuf); sunxi_get_soc_chipid_str(tmpbuf);
size += sprintf(buf + size, "sunxi_chiptype : %s\n", tmpbuf); size += sprintf(buf + size, "sunxi_chiptype : %s\n", tmpbuf);