e9d87dfb5e84a6bc4b2e1e47b69131cafd35fb41
[15.05/openwrt.git] / target / linux / ep93xx / patches-3.18 / 001-ep93xx_cpuinfo.patch
1 This patch puts the EP93xx chip revision and unique ID into /proc/cpuinfo.
2 This is necessary to be able to set a unique MAC address for DHCP purposes
3 by adding a line to /etc/network/interfaces:
4
5 # Generate a unique locally-assigned MAC address from the CPU serial number
6 pre-up ifconfig eth0 hw ether `sed -n 's/^Serial.* 000000/02/p' /proc/cpuinfo`
7
8 It uses the chip revision reading code in the ep93xx-chip-revision patch.
9
10 Really, this is wrong, since /proc/cpuinfo should report the revision and
11 serial number of the ARM920T processor, while these are the rev and serial
12 of the EP93xx SoC. In a future kernel (>2.6.34) there may be a new file
13 /proc/socinfo for this information.
14
15         -martinwguy 14 May 2010
16
17 --- a/arch/arm/kernel/setup.c
18 +++ b/arch/arm/kernel/setup.c
19 @@ -57,6 +57,12 @@
20  #include <asm/memblock.h>
21  #include <asm/virt.h>
22  
23 +#if defined(CONFIG_ARCH_EP93XX)
24 +#include <asm/io.h>
25 +#include <mach/platform.h>
26 +#include <mach/ep93xx-regs.h>
27 +#endif
28 +
29  #include "atags.h"
30  
31  
32 @@ -1087,9 +1093,16 @@ static int c_show(struct seq_file *m, vo
33         }
34  
35         seq_printf(m, "Hardware\t: %s\n", machine_name);
36 +#if defined(CONFIG_ARCH_EP93XX)
37 +       seq_printf(m, "Revision\t: %04x\n",
38 +            ep93xx_chip_revision());
39 +       seq_printf(m, "Serial\t\t: %016x\n",
40 +            *((unsigned int *)EP93XX_SECURITY_UNIQID));
41 +#else
42         seq_printf(m, "Revision\t: %04x\n", system_rev);
43         seq_printf(m, "Serial\t\t: %08x%08x\n",
44                    system_serial_high, system_serial_low);
45 +#endif
46  
47         return 0;
48  }
49 --- a/arch/arm/mach-ep93xx/soc.h
50 +++ b/arch/arm/mach-ep93xx/soc.h
51 @@ -82,8 +82,6 @@
52  #define EP93XX_I2S_PHYS_BASE           EP93XX_APB_PHYS(0x00020000)
53  #define EP93XX_I2S_BASE                        EP93XX_APB_IOMEM(0x00020000)
54  
55 -#define EP93XX_SECURITY_BASE           EP93XX_APB_IOMEM(0x00030000)
56 -
57  #define EP93XX_AAC_PHYS_BASE           EP93XX_APB_PHYS(0x00080000)
58  #define EP93XX_AAC_BASE                        EP93XX_APB_IOMEM(0x00080000)
59  
60 --- a/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h
61 +++ b/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h
62 @@ -38,4 +38,8 @@
63  #define EP93XX_UART3_PHYS_BASE         EP93XX_APB_PHYS(0x000e0000)
64  #define EP93XX_UART3_BASE              EP93XX_APB_IOMEM(0x000e0000)
65  
66 +#define EP93XX_SECURITY_BASE           EP93XX_APB_IOMEM(0x00030000)
67 +#define EP93XX_SECURITY_REG(x)         (EP93XX_SECURITY_BASE + (x))
68 +#define EP93XX_SECURITY_UNIQID         EP93XX_SECURITY_REG(0x2440)
69 +
70  #endif