hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/arch/arm/mach-davinci/board-dm646x-evm.c
....@@ -22,7 +22,7 @@
2222 #include <linux/gpio.h>
2323 #include <linux/platform_device.h>
2424 #include <linux/i2c.h>
25
-#include <linux/platform_data/at24.h>
25
+#include <linux/property.h>
2626 #include <linux/platform_data/pcf857x.h>
2727 #include <linux/platform_data/ti-aemif.h>
2828
....@@ -32,6 +32,7 @@
3232 #include <linux/mtd/mtd.h>
3333 #include <linux/mtd/rawnand.h>
3434 #include <linux/mtd/partitions.h>
35
+#include <linux/nvmem-provider.h>
3536 #include <linux/clk.h>
3637 #include <linux/export.h>
3738 #include <linux/platform_data/gpio-davinci.h>
....@@ -43,10 +44,10 @@
4344 #include <asm/mach/arch.h>
4445
4546 #include <mach/common.h>
46
-#include <mach/irqs.h>
4747 #include <mach/serial.h>
4848
4949 #include "davinci.h"
50
+#include "irqs.h"
5051
5152 #define NAND_BLOCK_SIZE SZ_128K
5253
....@@ -90,7 +91,7 @@
9091 .mask_ale = 0x40000,
9192 .parts = davinci_nand_partitions,
9293 .nr_parts = ARRAY_SIZE(davinci_nand_partitions),
93
- .ecc_mode = NAND_ECC_HW,
94
+ .engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST,
9495 .ecc_bits = 1,
9596 .options = 0,
9697 };
....@@ -159,8 +160,7 @@
159160 #define DM646X_EVM_ATA_PWD BIT(1)
160161
161162 /* CPLD Register 0 Client: used for I/O Control */
162
-static int cpld_reg0_probe(struct i2c_client *client,
163
- const struct i2c_device_id *id)
163
+static int cpld_reg0_probe(struct i2c_client *client)
164164 {
165165 if (HAS_ATA) {
166166 u8 data;
....@@ -196,7 +196,7 @@
196196 static struct i2c_driver dm6467evm_cpld_driver = {
197197 .driver.name = "cpld_reg0",
198198 .id_table = cpld_reg_ids,
199
- .probe = cpld_reg0_probe,
199
+ .probe_new = cpld_reg0_probe,
200200 };
201201
202202 /* LEDS */
....@@ -266,20 +266,15 @@
266266 evm_sw_gpio[i] = gpio++;
267267
268268 status = gpio_direction_input(evm_sw_gpio[i]);
269
- if (status) {
270
- gpio_free(evm_sw_gpio[i]);
271
- evm_sw_gpio[i] = -EINVAL;
269
+ if (status)
272270 goto out_free;
273
- }
274271
275272 status = gpio_export(evm_sw_gpio[i], 0);
276
- if (status) {
277
- gpio_free(evm_sw_gpio[i]);
278
- evm_sw_gpio[i] = -EINVAL;
273
+ if (status)
279274 goto out_free;
280
- }
281275 }
282
- return status;
276
+ return 0;
277
+
283278 out_free:
284279 for (i = 0; i < 4; ++i) {
285280 if (evm_sw_gpio[i] != -EINVAL) {
....@@ -342,12 +337,30 @@
342337 * - ... newer boards may have more
343338 */
344339
345
-static struct at24_platform_data eeprom_info = {
346
- .byte_len = (256*1024) / 8,
347
- .page_size = 64,
348
- .flags = AT24_FLAG_ADDR16,
349
- .setup = davinci_get_mac_addr,
350
- .context = (void *)0x7f00,
340
+static struct nvmem_cell_info dm646x_evm_nvmem_cells[] = {
341
+ {
342
+ .name = "macaddr",
343
+ .offset = 0x7f00,
344
+ .bytes = ETH_ALEN,
345
+ }
346
+};
347
+
348
+static struct nvmem_cell_table dm646x_evm_nvmem_cell_table = {
349
+ .nvmem_name = "1-00500",
350
+ .cells = dm646x_evm_nvmem_cells,
351
+ .ncells = ARRAY_SIZE(dm646x_evm_nvmem_cells),
352
+};
353
+
354
+static struct nvmem_cell_lookup dm646x_evm_nvmem_cell_lookup = {
355
+ .nvmem_name = "1-00500",
356
+ .cell_name = "macaddr",
357
+ .dev_id = "davinci_emac.1",
358
+ .con_id = "mac-address",
359
+};
360
+
361
+static const struct property_entry eeprom_properties[] = {
362
+ PROPERTY_ENTRY_U32("pagesize", 64),
363
+ { }
351364 };
352365 #endif
353366
....@@ -383,8 +396,7 @@
383396 #ifdef CONFIG_I2C
384397 static struct i2c_client *cpld_client;
385398
386
-static int cpld_video_probe(struct i2c_client *client,
387
- const struct i2c_device_id *id)
399
+static int cpld_video_probe(struct i2c_client *client)
388400 {
389401 cpld_client = client;
390402 return 0;
....@@ -405,7 +417,7 @@
405417 .driver = {
406418 .name = "cpld_video",
407419 },
408
- .probe = cpld_video_probe,
420
+ .probe_new = cpld_video_probe,
409421 .remove = cpld_video_remove,
410422 .id_table = cpld_video_id,
411423 };
....@@ -418,7 +430,7 @@
418430 static struct i2c_board_info __initdata i2c_info[] = {
419431 {
420432 I2C_BOARD_INFO("24c256", 0x50),
421
- .platform_data = &eeprom_info,
433
+ .properties = eeprom_properties,
422434 },
423435 {
424436 I2C_BOARD_INFO("pcf8574a", 0x38),
....@@ -815,6 +827,8 @@
815827 pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
816828
817829 #ifdef CONFIG_I2C
830
+ nvmem_add_cell_table(&dm646x_evm_nvmem_cell_table);
831
+ nvmem_add_cell_lookups(&dm646x_evm_nvmem_cell_lookup, 1);
818832 evm_init_i2c();
819833 #endif
820834
....@@ -839,7 +853,7 @@
839853 MACHINE_START(DAVINCI_DM6467_EVM, "DaVinci DM646x EVM")
840854 .atag_offset = 0x100,
841855 .map_io = davinci_map_io,
842
- .init_irq = davinci_irq_init,
856
+ .init_irq = dm646x_init_irq,
843857 .init_time = dm646x_evm_init_time,
844858 .init_machine = evm_init,
845859 .init_late = davinci_init_late,
....@@ -849,7 +863,7 @@
849863 MACHINE_START(DAVINCI_DM6467TEVM, "DaVinci DM6467T EVM")
850864 .atag_offset = 0x100,
851865 .map_io = davinci_map_io,
852
- .init_irq = davinci_irq_init,
866
+ .init_irq = dm646x_init_irq,
853867 .init_time = dm6467t_evm_init_time,
854868 .init_machine = evm_init,
855869 .init_late = davinci_init_late,