Commit 274e4c33 authored by Bartosz Golaszewski's avatar Bartosz Golaszewski Committed by Sekhar Nori

ARM: davinci: da830-evm: add a fixed regulator for ohci-da8xx

Instead of directly using the vbus GPIO we should model it as a fixed
regulator. Add all necessary fix-ups for the regulator to be registered
and configure the vbus GPIO as its enable pin.
Signed-off-by: default avatarBartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: default avatarSekhar Nori <nsekhar@ti.com>
parent 1d272894
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <linux/platform_data/spi-davinci.h> #include <linux/platform_data/spi-davinci.h>
#include <linux/platform_data/usb-davinci.h> #include <linux/platform_data/usb-davinci.h>
#include <linux/platform_data/ti-aemif.h> #include <linux/platform_data/ti-aemif.h>
#include <linux/regulator/fixed.h>
#include <linux/regulator/machine.h> #include <linux/regulator/machine.h>
#include <linux/nvmem-provider.h> #include <linux/nvmem-provider.h>
...@@ -53,15 +54,50 @@ static const short da830_evm_usb11_pins[] = { ...@@ -53,15 +54,50 @@ static const short da830_evm_usb11_pins[] = {
-1 -1
}; };
static struct gpiod_lookup_table da830_evm_usb_gpio_lookup = { static struct regulator_consumer_supply da830_evm_usb_supplies[] = {
REGULATOR_SUPPLY("vbus", NULL),
};
static struct regulator_init_data da830_evm_usb_vbus_data = {
.consumer_supplies = da830_evm_usb_supplies,
.num_consumer_supplies = ARRAY_SIZE(da830_evm_usb_supplies),
};
static struct fixed_voltage_config da830_evm_usb_vbus = {
.supply_name = "vbus",
.microvolts = 33000000,
.init_data = &da830_evm_usb_vbus_data,
};
static struct platform_device da830_evm_usb_vbus_device = {
.name = "reg-fixed-voltage",
.id = 0,
.dev = {
.platform_data = &da830_evm_usb_vbus,
},
};
static struct gpiod_lookup_table da830_evm_usb_oc_gpio_lookup = {
.dev_id = "ohci-da8xx", .dev_id = "ohci-da8xx",
.table = { .table = {
GPIO_LOOKUP("davinci_gpio", ON_BD_USB_DRV, "vbus", 0),
GPIO_LOOKUP("davinci_gpio", ON_BD_USB_OVC, "oc", 0), GPIO_LOOKUP("davinci_gpio", ON_BD_USB_OVC, "oc", 0),
{ } { }
}, },
}; };
static struct gpiod_lookup_table da830_evm_usb_vbus_gpio_lookup = {
.dev_id = "reg-fixed-voltage.0",
.table = {
GPIO_LOOKUP("davinci_gpio", ON_BD_USB_DRV, "vbus", 0),
{ }
},
};
static struct gpiod_lookup_table *da830_evm_usb_gpio_lookups[] = {
&da830_evm_usb_oc_gpio_lookup,
&da830_evm_usb_vbus_gpio_lookup,
};
static struct da8xx_ohci_root_hub da830_evm_usb11_pdata = { static struct da8xx_ohci_root_hub da830_evm_usb11_pdata = {
/* TPS2065 switch @ 5V */ /* TPS2065 switch @ 5V */
.potpgt = (3 + 1) / 2, /* 3 ms max */ .potpgt = (3 + 1) / 2, /* 3 ms max */
...@@ -76,6 +112,9 @@ static __init void da830_evm_usb_init(void) ...@@ -76,6 +112,9 @@ static __init void da830_evm_usb_init(void)
pr_warn("%s: USB PHY CLK registration failed: %d\n", pr_warn("%s: USB PHY CLK registration failed: %d\n",
__func__, ret); __func__, ret);
gpiod_add_lookup_tables(da830_evm_usb_gpio_lookups,
ARRAY_SIZE(da830_evm_usb_gpio_lookups));
ret = da8xx_register_usb_phy(); ret = da8xx_register_usb_phy();
if (ret) if (ret)
pr_warn("%s: USB PHY registration failed: %d\n", pr_warn("%s: USB PHY registration failed: %d\n",
...@@ -101,7 +140,11 @@ static __init void da830_evm_usb_init(void) ...@@ -101,7 +140,11 @@ static __init void da830_evm_usb_init(void)
return; return;
} }
gpiod_add_lookup_table(&da830_evm_usb_gpio_lookup); ret = platform_device_register(&da830_evm_usb_vbus_device);
if (ret) {
pr_warn("%s: Unable to register the vbus supply\n", __func__);
return;
}
ret = da8xx_register_usb11(&da830_evm_usb11_pdata); ret = da8xx_register_usb11(&da830_evm_usb11_pdata);
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment