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/virt.h>
#include <mach/sunxi-chip.h>
#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);
@ -1219,15 +1219,13 @@ static int c_show(struct seq_file *m, void *v)
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);
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;
}

View File

@ -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);