* [v2,4/6] ARM: davinci: omapl138-hawk: add a fixed regulator for ohci-da8xx
@ 2019-03-29 9:33 Bartosz Golaszewski
0 siblings, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2019-03-29 9:33 UTC (permalink / raw)
To: Sekhar Nori, Kevin Hilman, Alan Stern, Greg Kroah-Hartman
Cc: linux-arm-kernel, linux-kernel, linux-usb, Bartosz Golaszewski
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
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: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
arch/arm/mach-davinci/board-omapl138-hawk.c | 49 +++++++++++++++++++--
1 file changed, 46 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c
index e244c8648594..0039b4d4c935 100644
--- a/arch/arm/mach-davinci/board-omapl138-hawk.c
+++ b/arch/arm/mach-davinci/board-omapl138-hawk.c
@@ -21,6 +21,7 @@
#include <linux/platform_data/mtd-davinci.h>
#include <linux/platform_data/mtd-davinci-aemif.h>
#include <linux/platform_data/ti-aemif.h>
+#include <linux/regulator/fixed.h>
#include <linux/regulator/machine.h>
#include <asm/mach-types.h>
@@ -298,15 +299,50 @@ static const short da850_hawk_usb11_pins[] = {
-1
};
-static struct gpiod_lookup_table hawk_usb_gpio_lookup = {
+static struct regulator_consumer_supply hawk_usb_supplies[] = {
+ REGULATOR_SUPPLY("vbus", NULL),
+};
+
+static struct regulator_init_data hawk_usb_vbus_data = {
+ .consumer_supplies = hawk_usb_supplies,
+ .num_consumer_supplies = ARRAY_SIZE(hawk_usb_supplies),
+};
+
+static struct fixed_voltage_config hawk_usb_vbus = {
+ .supply_name = "vbus",
+ .microvolts = 3300000,
+ .init_data = &hawk_usb_vbus_data,
+};
+
+static struct platform_device hawk_usb_vbus_device = {
+ .name = "reg-fixed-voltage",
+ .id = 1,
+ .dev = {
+ .platform_data = &hawk_usb_vbus,
+ },
+};
+
+static struct gpiod_lookup_table hawk_usb_oc_gpio_lookup = {
.dev_id = "ohci-da8xx",
.table = {
- GPIO_LOOKUP("davinci_gpio", DA850_USB1_VBUS_PIN, "vbus", 0),
GPIO_LOOKUP("davinci_gpio", DA850_USB1_OC_PIN, "oc", 0),
{ }
},
};
+static struct gpiod_lookup_table hawk_usb_vbus_gpio_lookup = {
+ .dev_id = "reg-fixed-voltage.1",
+ .table = {
+ GPIO_LOOKUP("davinci_gpio", DA850_USB1_VBUS_PIN, NULL, 0),
+ { }
+ },
+};
+
+static struct gpiod_lookup_table *hawk_usb_gpio_lookups[] = {
+ &hawk_usb_oc_gpio_lookup,
+ &hawk_usb_vbus_gpio_lookup,
+};
+
static struct da8xx_ohci_root_hub omapl138_hawk_usb11_pdata = {
/* TPS2087 switch @ 5V */
.potpgt = (3 + 1) / 2, /* 3 ms max */
@@ -327,12 +363,19 @@ static __init void omapl138_hawk_usb_init(void)
pr_warn("%s: USB PHY CLK registration failed: %d\n",
__func__, ret);
+ gpiod_add_lookup_tables(hawk_usb_gpio_lookups,
+ ARRAY_SIZE(hawk_usb_gpio_lookups));
+
ret = da8xx_register_usb_phy();
if (ret)
pr_warn("%s: USB PHY registration failed: %d\n",
__func__, ret);
- gpiod_add_lookup_table(&hawk_usb_gpio_lookup);
+ ret = platform_device_register(&hawk_usb_vbus_device);
+ if (ret) {
+ pr_warn("%s: Unable to register the vbus supply\n", __func__);
+ return;
+ }
ret = da8xx_register_usb11(&omapl138_hawk_usb11_pdata);
if (ret)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [v2,4/6] ARM: davinci: omapl138-hawk: add a fixed regulator for ohci-da8xx
@ 2019-04-02 11:01 Sekhar Nori
0 siblings, 0 replies; 3+ messages in thread
From: Sekhar Nori @ 2019-04-02 11:01 UTC (permalink / raw)
To: Bartosz Golaszewski, Kevin Hilman, Alan Stern, Greg Kroah-Hartman
Cc: linux-arm-kernel, linux-kernel, linux-usb, Bartosz Golaszewski
Hi Bart,
On 29/03/19 3:03 PM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>
> 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: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> ---
> arch/arm/mach-davinci/board-omapl138-hawk.c | 49 +++++++++++++++++++--
> 1 file changed, 46 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c
> index e244c8648594..0039b4d4c935 100644
> --- a/arch/arm/mach-davinci/board-omapl138-hawk.c
> +++ b/arch/arm/mach-davinci/board-omapl138-hawk.c
> @@ -21,6 +21,7 @@
> #include <linux/platform_data/mtd-davinci.h>
> #include <linux/platform_data/mtd-davinci-aemif.h>
> #include <linux/platform_data/ti-aemif.h>
> +#include <linux/regulator/fixed.h>
> #include <linux/regulator/machine.h>
>
> #include <asm/mach-types.h>
> @@ -298,15 +299,50 @@ static const short da850_hawk_usb11_pins[] = {
> -1
> };
>
> -static struct gpiod_lookup_table hawk_usb_gpio_lookup = {
> +static struct regulator_consumer_supply hawk_usb_supplies[] = {
> + REGULATOR_SUPPLY("vbus", NULL),
> +};
> +
> +static struct regulator_init_data hawk_usb_vbus_data = {
> + .consumer_supplies = hawk_usb_supplies,
> + .num_consumer_supplies = ARRAY_SIZE(hawk_usb_supplies),
> +};
> +
> +static struct fixed_voltage_config hawk_usb_vbus = {
> + .supply_name = "vbus",
> + .microvolts = 3300000,
> + .init_data = &hawk_usb_vbus_data,
> +};
> +
> +static struct platform_device hawk_usb_vbus_device = {
> + .name = "reg-fixed-voltage",
> + .id = 1,
Can you explain choice of of 1 for id here? Its the first fixed
regulator being registered. Shouldn't it be 0?
Thanks,
Sekhar
^ permalink raw reply [flat|nested] 3+ messages in thread
* [v2,4/6] ARM: davinci: omapl138-hawk: add a fixed regulator for ohci-da8xx
@ 2019-04-02 12:00 Bartosz Golaszewski
0 siblings, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2019-04-02 12:00 UTC (permalink / raw)
To: Sekhar Nori
Cc: Bartosz Golaszewski, Kevin Hilman, Alan Stern, Greg Kroah-Hartman,
arm-soc, LKML, linux-usb
wt., 2 kwi 2019 o 13:01 Sekhar Nori <nsekhar@ti.com> napisał(a):
>
> Hi Bart,
>
> On 29/03/19 3:03 PM, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >
> > 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: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> > ---
> > arch/arm/mach-davinci/board-omapl138-hawk.c | 49 +++++++++++++++++++--
> > 1 file changed, 46 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c
> > index e244c8648594..0039b4d4c935 100644
> > --- a/arch/arm/mach-davinci/board-omapl138-hawk.c
> > +++ b/arch/arm/mach-davinci/board-omapl138-hawk.c
> > @@ -21,6 +21,7 @@
> > #include <linux/platform_data/mtd-davinci.h>
> > #include <linux/platform_data/mtd-davinci-aemif.h>
> > #include <linux/platform_data/ti-aemif.h>
> > +#include <linux/regulator/fixed.h>
> > #include <linux/regulator/machine.h>
> >
> > #include <asm/mach-types.h>
> > @@ -298,15 +299,50 @@ static const short da850_hawk_usb11_pins[] = {
> > -1
> > };
> >
> > -static struct gpiod_lookup_table hawk_usb_gpio_lookup = {
> > +static struct regulator_consumer_supply hawk_usb_supplies[] = {
> > + REGULATOR_SUPPLY("vbus", NULL),
> > +};
> > +
> > +static struct regulator_init_data hawk_usb_vbus_data = {
> > + .consumer_supplies = hawk_usb_supplies,
> > + .num_consumer_supplies = ARRAY_SIZE(hawk_usb_supplies),
> > +};
> > +
> > +static struct fixed_voltage_config hawk_usb_vbus = {
> > + .supply_name = "vbus",
> > + .microvolts = 3300000,
> > + .init_data = &hawk_usb_vbus_data,
> > +};
> > +
> > +static struct platform_device hawk_usb_vbus_device = {
> > + .name = "reg-fixed-voltage",
> > + .id = 1,
>
> Can you explain choice of of 1 for id here? Its the first fixed
> regulator being registered. Shouldn't it be 0?
>
> Thanks,
> Sekhar
Good point, I guess you're right. Something for v3 I guess.
Bart
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-04-02 12:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-29 9:33 [v2,4/6] ARM: davinci: omapl138-hawk: add a fixed regulator for ohci-da8xx Bartosz Golaszewski
-- strict thread matches above, loose matches on Subject: below --
2019-04-02 11:01 Sekhar Nori
2019-04-02 12:00 Bartosz Golaszewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).