forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 10ebd8556b7990499c896a550e3d416b444211e6
kernel/arch/arm/mach-omap1/board-osk.c
....@@ -26,6 +26,7 @@
2626 * 675 Mass Ave, Cambridge, MA 02139, USA.
2727 */
2828 #include <linux/gpio.h>
29
+#include <linux/gpio/machine.h>
2930 #include <linux/kernel.h>
3031 #include <linux/init.h>
3132 #include <linux/platform_device.h>
....@@ -54,6 +55,9 @@
5455 #include <mach/usb.h>
5556
5657 #include "common.h"
58
+
59
+/* Name of the GPIO chip used by the OMAP for GPIOs 0..15 */
60
+#define OMAP_GPIO_LABEL "gpio-0-15"
5761
5862 /* At OMAP5912 OSK the Ethernet is directly connected to CS1 */
5963 #define OMAP_OSK_ETHR_START 0x04800300
....@@ -199,6 +203,8 @@
199203 */
200204 gpio_request(OSK_TPS_GPIO_USB_PWR_EN, "n_vbus_en");
201205 gpio_direction_output(OSK_TPS_GPIO_USB_PWR_EN, 1);
206
+ /* Free the GPIO again as the driver will request it */
207
+ gpio_free(OSK_TPS_GPIO_USB_PWR_EN);
202208
203209 /* Set GPIO 2 high so LED D3 is off by default */
204210 tps65010_set_gpio_out_value(GPIO2, HIGH);
....@@ -240,7 +246,9 @@
240246
241247 static struct i2c_board_info __initdata osk_i2c_board_info[] = {
242248 {
249
+ /* This device will get the name "i2c-tps65010" */
243250 I2C_BOARD_INFO("tps65010", 0x48),
251
+ .dev_name = "tps65010",
244252 .platform_data = &tps_board,
245253
246254 },
....@@ -277,6 +285,16 @@
277285 /* the CF I/O IRQ is really active-low */
278286 irq_set_irq_type(gpio_to_irq(62), IRQ_TYPE_EDGE_FALLING);
279287 }
288
+
289
+static struct gpiod_lookup_table osk_usb_gpio_table = {
290
+ .dev_id = "ohci",
291
+ .table = {
292
+ /* Power GPIO on the I2C-attached TPS65010 */
293
+ GPIO_LOOKUP("tps65010", 0, "power", GPIO_ACTIVE_HIGH),
294
+ GPIO_LOOKUP(OMAP_GPIO_LABEL, 9, "overcurrent",
295
+ GPIO_ACTIVE_HIGH),
296
+ },
297
+};
280298
281299 static struct omap_usb_config osk_usb_config __initdata = {
282300 /* has usb host connector (A) ... for development it can also
....@@ -581,6 +599,7 @@
581599 l |= (3 << 1);
582600 omap_writel(l, USB_TRANSCEIVER_CTRL);
583601
602
+ gpiod_add_lookup_table(&osk_usb_gpio_table);
584603 omap1_usb_init(&osk_usb_config);
585604
586605 /* irq for tps65010 chip */