hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/arch/arm/mach-davinci/board-omapl138-hawk.c
....@@ -3,7 +3,7 @@
33 *
44 * Initial code: Syed Mohammed Khasim
55 *
6
- * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com
6
+ * Copyright (C) 2009 Texas Instruments Incorporated - https://www.ti.com
77 *
88 * This file is licensed under the terms of the GNU General Public License
99 * version 2. This program is licensed "as is" without any warranty of
....@@ -21,13 +21,13 @@
2121 #include <linux/platform_data/mtd-davinci.h>
2222 #include <linux/platform_data/mtd-davinci-aemif.h>
2323 #include <linux/platform_data/ti-aemif.h>
24
+#include <linux/regulator/fixed.h>
2425 #include <linux/regulator/machine.h>
2526
2627 #include <asm/mach-types.h>
2728 #include <asm/mach/arch.h>
2829
2930 #include <mach/common.h>
30
-#include "cp_intc.h"
3131 #include <mach/da8xx.h>
3232 #include <mach/mux.h>
3333
....@@ -134,9 +134,9 @@
134134 static struct gpiod_lookup_table mmc_gpios_table = {
135135 .dev_id = "da830-mmc.0",
136136 .table = {
137
- GPIO_LOOKUP("davinci_gpio.0", DA850_HAWK_MMCSD_CD_PIN, "cd",
137
+ GPIO_LOOKUP("davinci_gpio", DA850_HAWK_MMCSD_CD_PIN, "cd",
138138 GPIO_ACTIVE_LOW),
139
- GPIO_LOOKUP("davinci_gpio.0", DA850_HAWK_MMCSD_WP_PIN, "wp",
139
+ GPIO_LOOKUP("davinci_gpio", DA850_HAWK_MMCSD_WP_PIN, "wp",
140140 GPIO_ACTIVE_LOW),
141141 },
142142 };
....@@ -206,7 +206,7 @@
206206 .core_chipsel = 1,
207207 .parts = omapl138_hawk_nandflash_partition,
208208 .nr_parts = ARRAY_SIZE(omapl138_hawk_nandflash_partition),
209
- .ecc_mode = NAND_ECC_HW,
209
+ .engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST,
210210 .ecc_bits = 4,
211211 .bbt_options = NAND_BBT_USE_FLASH,
212212 .options = NAND_BUSWIDTH_16,
....@@ -294,65 +294,62 @@
294294 return platform_device_register(&omapl138_hawk_aemif_device);
295295 }
296296
297
-static irqreturn_t omapl138_hawk_usb_ocic_irq(int irq, void *dev_id);
298
-static da8xx_ocic_handler_t hawk_usb_ocic_handler;
299
-
300297 static const short da850_hawk_usb11_pins[] = {
301298 DA850_GPIO2_4, DA850_GPIO6_13,
302299 -1
303300 };
304301
305
-static int hawk_usb_set_power(unsigned port, int on)
306
-{
307
- gpio_set_value(DA850_USB1_VBUS_PIN, on);
308
- return 0;
309
-}
302
+static struct regulator_consumer_supply hawk_usb_supplies[] = {
303
+ REGULATOR_SUPPLY("vbus", NULL),
304
+};
310305
311
-static int hawk_usb_get_power(unsigned port)
312
-{
313
- return gpio_get_value(DA850_USB1_VBUS_PIN);
314
-}
306
+static struct regulator_init_data hawk_usb_vbus_data = {
307
+ .consumer_supplies = hawk_usb_supplies,
308
+ .num_consumer_supplies = ARRAY_SIZE(hawk_usb_supplies),
309
+ .constraints = {
310
+ .valid_ops_mask = REGULATOR_CHANGE_STATUS,
311
+ },
312
+};
315313
316
-static int hawk_usb_get_oci(unsigned port)
317
-{
318
- return !gpio_get_value(DA850_USB1_OC_PIN);
319
-}
314
+static struct fixed_voltage_config hawk_usb_vbus = {
315
+ .supply_name = "vbus",
316
+ .microvolts = 3300000,
317
+ .init_data = &hawk_usb_vbus_data,
318
+};
320319
321
-static int hawk_usb_ocic_notify(da8xx_ocic_handler_t handler)
322
-{
323
- int irq = gpio_to_irq(DA850_USB1_OC_PIN);
324
- int error = 0;
320
+static struct platform_device hawk_usb_vbus_device = {
321
+ .name = "reg-fixed-voltage",
322
+ .id = 0,
323
+ .dev = {
324
+ .platform_data = &hawk_usb_vbus,
325
+ },
326
+};
325327
326
- if (handler != NULL) {
327
- hawk_usb_ocic_handler = handler;
328
+static struct gpiod_lookup_table hawk_usb_oc_gpio_lookup = {
329
+ .dev_id = "ohci-da8xx",
330
+ .table = {
331
+ GPIO_LOOKUP("davinci_gpio", DA850_USB1_OC_PIN, "oc", 0),
332
+ { }
333
+ },
334
+};
328335
329
- error = request_irq(irq, omapl138_hawk_usb_ocic_irq,
330
- IRQF_TRIGGER_RISING |
331
- IRQF_TRIGGER_FALLING,
332
- "OHCI over-current indicator", NULL);
333
- if (error)
334
- pr_err("%s: could not request IRQ to watch "
335
- "over-current indicator changes\n", __func__);
336
- } else {
337
- free_irq(irq, NULL);
338
- }
339
- return error;
340
-}
336
+static struct gpiod_lookup_table hawk_usb_vbus_gpio_lookup = {
337
+ .dev_id = "reg-fixed-voltage.0",
338
+ .table = {
339
+ GPIO_LOOKUP("davinci_gpio", DA850_USB1_VBUS_PIN, NULL, 0),
340
+ { }
341
+ },
342
+};
343
+
344
+static struct gpiod_lookup_table *hawk_usb_gpio_lookups[] = {
345
+ &hawk_usb_oc_gpio_lookup,
346
+ &hawk_usb_vbus_gpio_lookup,
347
+};
341348
342349 static struct da8xx_ohci_root_hub omapl138_hawk_usb11_pdata = {
343
- .set_power = hawk_usb_set_power,
344
- .get_power = hawk_usb_get_power,
345
- .get_oci = hawk_usb_get_oci,
346
- .ocic_notify = hawk_usb_ocic_notify,
347350 /* TPS2087 switch @ 5V */
348351 .potpgt = (3 + 1) / 2, /* 3 ms max */
349352 };
350
-
351
-static irqreturn_t omapl138_hawk_usb_ocic_irq(int irq, void *dev_id)
352
-{
353
- hawk_usb_ocic_handler(&omapl138_hawk_usb11_pdata, 1);
354
- return IRQ_HANDLED;
355
-}
356353
357354 static __init void omapl138_hawk_usb_init(void)
358355 {
....@@ -369,39 +366,25 @@
369366 pr_warn("%s: USB PHY CLK registration failed: %d\n",
370367 __func__, ret);
371368
369
+ gpiod_add_lookup_tables(hawk_usb_gpio_lookups,
370
+ ARRAY_SIZE(hawk_usb_gpio_lookups));
371
+
372372 ret = da8xx_register_usb_phy();
373373 if (ret)
374374 pr_warn("%s: USB PHY registration failed: %d\n",
375375 __func__, ret);
376376
377
- ret = gpio_request_one(DA850_USB1_VBUS_PIN,
378
- GPIOF_DIR_OUT, "USB1 VBUS");
379
- if (ret < 0) {
380
- pr_err("%s: failed to request GPIO for USB 1.1 port "
381
- "power control: %d\n", __func__, ret);
377
+ ret = platform_device_register(&hawk_usb_vbus_device);
378
+ if (ret) {
379
+ pr_warn("%s: Unable to register the vbus supply\n", __func__);
382380 return;
383381 }
384382
385
- ret = gpio_request_one(DA850_USB1_OC_PIN,
386
- GPIOF_DIR_IN, "USB1 OC");
387
- if (ret < 0) {
388
- pr_err("%s: failed to request GPIO for USB 1.1 port "
389
- "over-current indicator: %d\n", __func__, ret);
390
- goto usb11_setup_oc_fail;
391
- }
392
-
393383 ret = da8xx_register_usb11(&omapl138_hawk_usb11_pdata);
394
- if (ret) {
384
+ if (ret)
395385 pr_warn("%s: USB 1.1 registration failed: %d\n", __func__, ret);
396
- goto usb11_setup_fail;
397
- }
398386
399387 return;
400
-
401
-usb11_setup_fail:
402
- gpio_free(DA850_USB1_OC_PIN);
403
-usb11_setup_oc_fail:
404
- gpio_free(DA850_USB1_VBUS_PIN);
405388 }
406389
407390 static __init void omapl138_hawk_init(void)
....@@ -462,7 +445,7 @@
462445 MACHINE_START(OMAPL138_HAWKBOARD, "AM18x/OMAP-L138 Hawkboard")
463446 .atag_offset = 0x100,
464447 .map_io = omapl138_hawk_map_io,
465
- .init_irq = cp_intc_init,
448
+ .init_irq = da850_init_irq,
466449 .init_time = da850_init_time,
467450 .init_machine = omapl138_hawk_init,
468451 .init_late = davinci_init_late,