.. | .. |
---|
18 | 18 | #include <linux/platform_device.h> |
---|
19 | 19 | #include <linux/i2c.h> |
---|
20 | 20 | #include <linux/platform_data/pcf857x.h> |
---|
21 | | -#include <linux/platform_data/at24.h> |
---|
| 21 | +#include <linux/property.h> |
---|
22 | 22 | #include <linux/mtd/mtd.h> |
---|
23 | 23 | #include <linux/mtd/partitions.h> |
---|
24 | 24 | #include <linux/spi/spi.h> |
---|
.. | .. |
---|
29 | 29 | #include <linux/platform_data/spi-davinci.h> |
---|
30 | 30 | #include <linux/platform_data/usb-davinci.h> |
---|
31 | 31 | #include <linux/platform_data/ti-aemif.h> |
---|
| 32 | +#include <linux/regulator/fixed.h> |
---|
32 | 33 | #include <linux/regulator/machine.h> |
---|
| 34 | +#include <linux/nvmem-provider.h> |
---|
33 | 35 | |
---|
34 | 36 | #include <asm/mach-types.h> |
---|
35 | 37 | #include <asm/mach/arch.h> |
---|
36 | 38 | |
---|
37 | 39 | #include <mach/common.h> |
---|
38 | | -#include "cp_intc.h" |
---|
39 | 40 | #include <mach/mux.h> |
---|
40 | 41 | #include <mach/da8xx.h> |
---|
| 42 | + |
---|
| 43 | +#include "irqs.h" |
---|
41 | 44 | |
---|
42 | 45 | #define DA830_EVM_PHY_ID "" |
---|
43 | 46 | /* |
---|
.. | .. |
---|
51 | 54 | -1 |
---|
52 | 55 | }; |
---|
53 | 56 | |
---|
54 | | -static da8xx_ocic_handler_t da830_evm_usb_ocic_handler; |
---|
| 57 | +static struct regulator_consumer_supply da830_evm_usb_supplies[] = { |
---|
| 58 | + REGULATOR_SUPPLY("vbus", NULL), |
---|
| 59 | +}; |
---|
55 | 60 | |
---|
56 | | -static int da830_evm_usb_set_power(unsigned port, int on) |
---|
57 | | -{ |
---|
58 | | - gpio_set_value(ON_BD_USB_DRV, on); |
---|
59 | | - return 0; |
---|
60 | | -} |
---|
| 61 | +static struct regulator_init_data da830_evm_usb_vbus_data = { |
---|
| 62 | + .consumer_supplies = da830_evm_usb_supplies, |
---|
| 63 | + .num_consumer_supplies = ARRAY_SIZE(da830_evm_usb_supplies), |
---|
| 64 | + .constraints = { |
---|
| 65 | + .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
---|
| 66 | + }, |
---|
| 67 | +}; |
---|
61 | 68 | |
---|
62 | | -static int da830_evm_usb_get_power(unsigned port) |
---|
63 | | -{ |
---|
64 | | - return gpio_get_value(ON_BD_USB_DRV); |
---|
65 | | -} |
---|
| 69 | +static struct fixed_voltage_config da830_evm_usb_vbus = { |
---|
| 70 | + .supply_name = "vbus", |
---|
| 71 | + .microvolts = 33000000, |
---|
| 72 | + .init_data = &da830_evm_usb_vbus_data, |
---|
| 73 | +}; |
---|
66 | 74 | |
---|
67 | | -static int da830_evm_usb_get_oci(unsigned port) |
---|
68 | | -{ |
---|
69 | | - return !gpio_get_value(ON_BD_USB_OVC); |
---|
70 | | -} |
---|
| 75 | +static struct platform_device da830_evm_usb_vbus_device = { |
---|
| 76 | + .name = "reg-fixed-voltage", |
---|
| 77 | + .id = 0, |
---|
| 78 | + .dev = { |
---|
| 79 | + .platform_data = &da830_evm_usb_vbus, |
---|
| 80 | + }, |
---|
| 81 | +}; |
---|
71 | 82 | |
---|
72 | | -static irqreturn_t da830_evm_usb_ocic_irq(int, void *); |
---|
| 83 | +static struct gpiod_lookup_table da830_evm_usb_oc_gpio_lookup = { |
---|
| 84 | + .dev_id = "ohci-da8xx", |
---|
| 85 | + .table = { |
---|
| 86 | + GPIO_LOOKUP("davinci_gpio", ON_BD_USB_OVC, "oc", 0), |
---|
| 87 | + { } |
---|
| 88 | + }, |
---|
| 89 | +}; |
---|
73 | 90 | |
---|
74 | | -static int da830_evm_usb_ocic_notify(da8xx_ocic_handler_t handler) |
---|
75 | | -{ |
---|
76 | | - int irq = gpio_to_irq(ON_BD_USB_OVC); |
---|
77 | | - int error = 0; |
---|
| 91 | +static struct gpiod_lookup_table da830_evm_usb_vbus_gpio_lookup = { |
---|
| 92 | + .dev_id = "reg-fixed-voltage.0", |
---|
| 93 | + .table = { |
---|
| 94 | + GPIO_LOOKUP("davinci_gpio", ON_BD_USB_DRV, NULL, 0), |
---|
| 95 | + { } |
---|
| 96 | + }, |
---|
| 97 | +}; |
---|
78 | 98 | |
---|
79 | | - if (handler != NULL) { |
---|
80 | | - da830_evm_usb_ocic_handler = handler; |
---|
81 | | - |
---|
82 | | - error = request_irq(irq, da830_evm_usb_ocic_irq, |
---|
83 | | - IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
---|
84 | | - "OHCI over-current indicator", NULL); |
---|
85 | | - if (error) |
---|
86 | | - pr_err("%s: could not request IRQ to watch over-current indicator changes\n", |
---|
87 | | - __func__); |
---|
88 | | - } else |
---|
89 | | - free_irq(irq, NULL); |
---|
90 | | - |
---|
91 | | - return error; |
---|
92 | | -} |
---|
| 99 | +static struct gpiod_lookup_table *da830_evm_usb_gpio_lookups[] = { |
---|
| 100 | + &da830_evm_usb_oc_gpio_lookup, |
---|
| 101 | + &da830_evm_usb_vbus_gpio_lookup, |
---|
| 102 | +}; |
---|
93 | 103 | |
---|
94 | 104 | static struct da8xx_ohci_root_hub da830_evm_usb11_pdata = { |
---|
95 | | - .set_power = da830_evm_usb_set_power, |
---|
96 | | - .get_power = da830_evm_usb_get_power, |
---|
97 | | - .get_oci = da830_evm_usb_get_oci, |
---|
98 | | - .ocic_notify = da830_evm_usb_ocic_notify, |
---|
99 | | - |
---|
100 | 105 | /* TPS2065 switch @ 5V */ |
---|
101 | 106 | .potpgt = (3 + 1) / 2, /* 3 ms max */ |
---|
102 | 107 | }; |
---|
103 | | - |
---|
104 | | -static irqreturn_t da830_evm_usb_ocic_irq(int irq, void *dev_id) |
---|
105 | | -{ |
---|
106 | | - da830_evm_usb_ocic_handler(&da830_evm_usb11_pdata, 1); |
---|
107 | | - return IRQ_HANDLED; |
---|
108 | | -} |
---|
109 | 108 | |
---|
110 | 109 | static __init void da830_evm_usb_init(void) |
---|
111 | 110 | { |
---|
.. | .. |
---|
115 | 114 | if (ret) |
---|
116 | 115 | pr_warn("%s: USB PHY CLK registration failed: %d\n", |
---|
117 | 116 | __func__, ret); |
---|
| 117 | + |
---|
| 118 | + gpiod_add_lookup_tables(da830_evm_usb_gpio_lookups, |
---|
| 119 | + ARRAY_SIZE(da830_evm_usb_gpio_lookups)); |
---|
118 | 120 | |
---|
119 | 121 | ret = da8xx_register_usb_phy(); |
---|
120 | 122 | if (ret) |
---|
.. | .. |
---|
141 | 143 | return; |
---|
142 | 144 | } |
---|
143 | 145 | |
---|
144 | | - ret = gpio_request(ON_BD_USB_DRV, "ON_BD_USB_DRV"); |
---|
| 146 | + ret = platform_device_register(&da830_evm_usb_vbus_device); |
---|
145 | 147 | if (ret) { |
---|
146 | | - pr_err("%s: failed to request GPIO for USB 1.1 port power control: %d\n", |
---|
147 | | - __func__, ret); |
---|
| 148 | + pr_warn("%s: Unable to register the vbus supply\n", __func__); |
---|
148 | 149 | return; |
---|
149 | 150 | } |
---|
150 | | - gpio_direction_output(ON_BD_USB_DRV, 0); |
---|
151 | | - |
---|
152 | | - ret = gpio_request(ON_BD_USB_OVC, "ON_BD_USB_OVC"); |
---|
153 | | - if (ret) { |
---|
154 | | - pr_err("%s: failed to request GPIO for USB 1.1 port over-current indicator: %d\n", |
---|
155 | | - __func__, ret); |
---|
156 | | - return; |
---|
157 | | - } |
---|
158 | | - gpio_direction_input(ON_BD_USB_OVC); |
---|
159 | 151 | |
---|
160 | 152 | ret = da8xx_register_usb11(&da830_evm_usb11_pdata); |
---|
161 | 153 | if (ret) |
---|
.. | .. |
---|
207 | 199 | .dev_id = "da830-mmc.0", |
---|
208 | 200 | .table = { |
---|
209 | 201 | /* gpio chip 1 contains gpio range 32-63 */ |
---|
210 | | - GPIO_LOOKUP("davinci_gpio.0", DA830_MMCSD_CD_PIN, "cd", |
---|
| 202 | + GPIO_LOOKUP("davinci_gpio", DA830_MMCSD_CD_PIN, "cd", |
---|
211 | 203 | GPIO_ACTIVE_LOW), |
---|
212 | | - GPIO_LOOKUP("davinci_gpio.0", DA830_MMCSD_WP_PIN, "wp", |
---|
| 204 | + GPIO_LOOKUP("davinci_gpio", DA830_MMCSD_WP_PIN, "wp", |
---|
213 | 205 | GPIO_ACTIVE_LOW), |
---|
| 206 | + { } |
---|
214 | 207 | }, |
---|
215 | 208 | }; |
---|
216 | 209 | |
---|
.. | .. |
---|
273 | 266 | } |
---|
274 | 267 | }; |
---|
275 | 268 | |
---|
276 | | -/* flash bbt decriptors */ |
---|
| 269 | +/* flash bbt descriptors */ |
---|
277 | 270 | static uint8_t da830_evm_nand_bbt_pattern[] = { 'B', 'b', 't', '0' }; |
---|
278 | 271 | static uint8_t da830_evm_nand_mirror_pattern[] = { '1', 't', 'b', 'B' }; |
---|
279 | 272 | |
---|
.. | .. |
---|
313 | 306 | .core_chipsel = 1, |
---|
314 | 307 | .parts = da830_evm_nand_partitions, |
---|
315 | 308 | .nr_parts = ARRAY_SIZE(da830_evm_nand_partitions), |
---|
316 | | - .ecc_mode = NAND_ECC_HW, |
---|
| 309 | + .engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST, |
---|
317 | 310 | .ecc_bits = 4, |
---|
318 | 311 | .bbt_options = NAND_BBT_USE_FLASH, |
---|
319 | 312 | .bbt_td = &da830_evm_nand_bbt_main_descr, |
---|
.. | .. |
---|
435 | 428 | static inline void da830_evm_init_lcdc(int mux_mode) { } |
---|
436 | 429 | #endif |
---|
437 | 430 | |
---|
438 | | -static struct at24_platform_data da830_evm_i2c_eeprom_info = { |
---|
439 | | - .byte_len = SZ_256K / 8, |
---|
440 | | - .page_size = 64, |
---|
441 | | - .flags = AT24_FLAG_ADDR16, |
---|
442 | | - .setup = davinci_get_mac_addr, |
---|
443 | | - .context = (void *)0x7f00, |
---|
| 431 | +static struct nvmem_cell_info da830_evm_nvmem_cells[] = { |
---|
| 432 | + { |
---|
| 433 | + .name = "macaddr", |
---|
| 434 | + .offset = 0x7f00, |
---|
| 435 | + .bytes = ETH_ALEN, |
---|
| 436 | + } |
---|
| 437 | +}; |
---|
| 438 | + |
---|
| 439 | +static struct nvmem_cell_table da830_evm_nvmem_cell_table = { |
---|
| 440 | + .nvmem_name = "1-00500", |
---|
| 441 | + .cells = da830_evm_nvmem_cells, |
---|
| 442 | + .ncells = ARRAY_SIZE(da830_evm_nvmem_cells), |
---|
| 443 | +}; |
---|
| 444 | + |
---|
| 445 | +static struct nvmem_cell_lookup da830_evm_nvmem_cell_lookup = { |
---|
| 446 | + .nvmem_name = "1-00500", |
---|
| 447 | + .cell_name = "macaddr", |
---|
| 448 | + .dev_id = "davinci_emac.1", |
---|
| 449 | + .con_id = "mac-address", |
---|
| 450 | +}; |
---|
| 451 | + |
---|
| 452 | +static const struct property_entry da830_evm_i2c_eeprom_properties[] = { |
---|
| 453 | + PROPERTY_ENTRY_U32("pagesize", 64), |
---|
| 454 | + { } |
---|
444 | 455 | }; |
---|
445 | 456 | |
---|
446 | 457 | static int __init da830_evm_ui_expander_setup(struct i2c_client *client, |
---|
.. | .. |
---|
474 | 485 | static struct i2c_board_info __initdata da830_evm_i2c_devices[] = { |
---|
475 | 486 | { |
---|
476 | 487 | I2C_BOARD_INFO("24c256", 0x50), |
---|
477 | | - .platform_data = &da830_evm_i2c_eeprom_info, |
---|
| 488 | + .properties = da830_evm_i2c_eeprom_properties, |
---|
478 | 489 | }, |
---|
479 | 490 | { |
---|
480 | 491 | I2C_BOARD_INFO("tlv320aic3x", 0x18), |
---|
.. | .. |
---|
620 | 631 | __func__, ret); |
---|
621 | 632 | |
---|
622 | 633 | davinci_serial_init(da8xx_serial_device); |
---|
| 634 | + |
---|
| 635 | + nvmem_add_cell_table(&da830_evm_nvmem_cell_table); |
---|
| 636 | + nvmem_add_cell_lookups(&da830_evm_nvmem_cell_lookup, 1); |
---|
| 637 | + |
---|
623 | 638 | i2c_register_board_info(1, da830_evm_i2c_devices, |
---|
624 | 639 | ARRAY_SIZE(da830_evm_i2c_devices)); |
---|
625 | 640 | |
---|
.. | .. |
---|
667 | 682 | MACHINE_START(DAVINCI_DA830_EVM, "DaVinci DA830/OMAP-L137/AM17x EVM") |
---|
668 | 683 | .atag_offset = 0x100, |
---|
669 | 684 | .map_io = da830_evm_map_io, |
---|
670 | | - .init_irq = cp_intc_init, |
---|
| 685 | + .init_irq = da830_init_irq, |
---|
671 | 686 | .init_time = da830_init_time, |
---|
672 | 687 | .init_machine = da830_evm_init, |
---|
673 | 688 | .init_late = davinci_init_late, |
---|