diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-davinci/board-mityomapl138.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/arch/arm/mach-davinci/board-mityomapl138.c b/arch/arm/mach-davinci/board-mityomapl138.c index 6f12a182333b..65f7501984db 100644 --- a/arch/arm/mach-davinci/board-mityomapl138.c +++ b/arch/arm/mach-davinci/board-mityomapl138.c | |||
@@ -15,6 +15,8 @@ | |||
15 | #include <linux/mtd/partitions.h> | 15 | #include <linux/mtd/partitions.h> |
16 | #include <linux/regulator/machine.h> | 16 | #include <linux/regulator/machine.h> |
17 | #include <linux/i2c.h> | 17 | #include <linux/i2c.h> |
18 | #include <linux/i2c/at24.h> | ||
19 | #include <linux/etherdevice.h> | ||
18 | 20 | ||
19 | #include <asm/mach-types.h> | 21 | #include <asm/mach-types.h> |
20 | #include <asm/mach/arch.h> | 22 | #include <asm/mach/arch.h> |
@@ -25,6 +27,65 @@ | |||
25 | #include <mach/mux.h> | 27 | #include <mach/mux.h> |
26 | 28 | ||
27 | #define MITYOMAPL138_PHY_ID "0:03" | 29 | #define MITYOMAPL138_PHY_ID "0:03" |
30 | |||
31 | #define FACTORY_CONFIG_MAGIC 0x012C0138 | ||
32 | #define FACTORY_CONFIG_VERSION 0x00010001 | ||
33 | |||
34 | /* Data Held in On-Board I2C device */ | ||
35 | struct factory_config { | ||
36 | u32 magic; | ||
37 | u32 version; | ||
38 | u8 mac[6]; | ||
39 | u32 fpga_type; | ||
40 | u32 spare; | ||
41 | u32 serialnumber; | ||
42 | char partnum[32]; | ||
43 | }; | ||
44 | |||
45 | static struct factory_config factory_config; | ||
46 | |||
47 | static void read_factory_config(struct memory_accessor *a, void *context) | ||
48 | { | ||
49 | int ret; | ||
50 | struct davinci_soc_info *soc_info = &davinci_soc_info; | ||
51 | |||
52 | ret = a->read(a, (char *)&factory_config, 0, sizeof(factory_config)); | ||
53 | if (ret != sizeof(struct factory_config)) { | ||
54 | pr_warning("MityOMAPL138: Read Factory Config Failed: %d\n", | ||
55 | ret); | ||
56 | return; | ||
57 | } | ||
58 | |||
59 | if (factory_config.magic != FACTORY_CONFIG_MAGIC) { | ||
60 | pr_warning("MityOMAPL138: Factory Config Magic Wrong (%X)\n", | ||
61 | factory_config.magic); | ||
62 | return; | ||
63 | } | ||
64 | |||
65 | if (factory_config.version != FACTORY_CONFIG_VERSION) { | ||
66 | pr_warning("MityOMAPL138: Factory Config Version Wrong (%X)\n", | ||
67 | factory_config.version); | ||
68 | return; | ||
69 | } | ||
70 | |||
71 | pr_info("MityOMAPL138: Found MAC = %pM\n", factory_config.mac); | ||
72 | pr_info("MityOMAPL138: Part Number = %s\n", factory_config.partnum); | ||
73 | if (is_valid_ether_addr(factory_config.mac)) | ||
74 | memcpy(soc_info->emac_pdata->mac_addr, | ||
75 | factory_config.mac, ETH_ALEN); | ||
76 | else | ||
77 | pr_warning("MityOMAPL138: Invalid MAC found " | ||
78 | "in factory config block\n"); | ||
79 | } | ||
80 | |||
81 | static struct at24_platform_data mityomapl138_fd_chip = { | ||
82 | .byte_len = 256, | ||
83 | .page_size = 8, | ||
84 | .flags = AT24_FLAG_READONLY | AT24_FLAG_IRUGO, | ||
85 | .setup = read_factory_config, | ||
86 | .context = NULL, | ||
87 | }; | ||
88 | |||
28 | static struct davinci_i2c_platform_data mityomap_i2c_0_pdata = { | 89 | static struct davinci_i2c_platform_data mityomap_i2c_0_pdata = { |
29 | .bus_freq = 100, /* kHz */ | 90 | .bus_freq = 100, /* kHz */ |
30 | .bus_delay = 0, /* usec */ | 91 | .bus_delay = 0, /* usec */ |
@@ -151,6 +212,7 @@ static struct i2c_board_info __initdata mityomap_tps65023_info[] = { | |||
151 | }, | 212 | }, |
152 | { | 213 | { |
153 | I2C_BOARD_INFO("24c02", 0x50), | 214 | I2C_BOARD_INFO("24c02", 0x50), |
215 | .platform_data = &mityomapl138_fd_chip, | ||
154 | }, | 216 | }, |
155 | }; | 217 | }; |
156 | 218 | ||