All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] musb-new: fix omap peripheral support
@ 2022-11-26 22:30 Andreas Kemnade
  2022-11-26 22:30 ` [PATCH 1/2] omap4: make musb probeable by simple bus Andreas Kemnade
  2022-11-26 22:30 ` [PATCH 2/2] musb-new: omap2430: fix musb probing in gadget mode Andreas Kemnade
  0 siblings, 2 replies; 8+ messages in thread
From: Andreas Kemnade @ 2022-11-26 22:30 UTC (permalink / raw)
  To: marex, andreas, u-boot, t-kristo, kristo, tony

DM_GADGET did not compile at all, probe was not called in
non-gadget mode.

Tested on an omap4 board with ums and fastboot command

Andreas Kemnade (2):
  omap4: make musb probeable by simple bus
  musb-new: omap2430: fix musb probing in gadget mode

 arch/arm/dts/omap4-u-boot.dtsi  |  8 +++++++
 drivers/usb/musb-new/omap2430.c | 42 ++++++++++++++++++++-------------
 2 files changed, 33 insertions(+), 17 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] omap4: make musb probeable by simple bus
  2022-11-26 22:30 [PATCH 0/2] musb-new: fix omap peripheral support Andreas Kemnade
@ 2022-11-26 22:30 ` Andreas Kemnade
  2022-12-12 21:35   ` Tom Rini
  2022-11-26 22:30 ` [PATCH 2/2] musb-new: omap2430: fix musb probing in gadget mode Andreas Kemnade
  1 sibling, 1 reply; 8+ messages in thread
From: Andreas Kemnade @ 2022-11-26 22:30 UTC (permalink / raw)
  To: marex, andreas, u-boot, t-kristo, kristo, tony

Like other peripherals important for booting,
do not rely on ti-sysc compatibility alone

Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
 arch/arm/dts/omap4-u-boot.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/dts/omap4-u-boot.dtsi b/arch/arm/dts/omap4-u-boot.dtsi
index e33b3722e1..49e388caa5 100644
--- a/arch/arm/dts/omap4-u-boot.dtsi
+++ b/arch/arm/dts/omap4-u-boot.dtsi
@@ -17,6 +17,14 @@
 			compatible = "simple-bus";
 		};
 	};
+
+	segment@80000 {
+		/* USB OTG */
+		target-module@2b000 {
+			compatible = "simple-bus";
+		};
+	};
+
 };
 
 &l4_per {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] musb-new: omap2430: fix musb probing in gadget mode
  2022-11-26 22:30 [PATCH 0/2] musb-new: fix omap peripheral support Andreas Kemnade
  2022-11-26 22:30 ` [PATCH 1/2] omap4: make musb probeable by simple bus Andreas Kemnade
@ 2022-11-26 22:30 ` Andreas Kemnade
  2022-11-26 22:50   ` Marek Vasut
  2022-12-12 19:00   ` Tom Rini
  1 sibling, 2 replies; 8+ messages in thread
From: Andreas Kemnade @ 2022-11-26 22:30 UTC (permalink / raw)
  To: marex, andreas, u-boot, t-kristo, kristo, tony

Host mode structures were accessed but not initialized
and gadget dm did not compile at all.

Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
---
 drivers/usb/musb-new/omap2430.c | 42 ++++++++++++++++++++-------------
 1 file changed, 25 insertions(+), 17 deletions(-)

diff --git a/drivers/usb/musb-new/omap2430.c b/drivers/usb/musb-new/omap2430.c
index 7d15b94a6c..607592a1d0 100644
--- a/drivers/usb/musb-new/omap2430.c
+++ b/drivers/usb/musb-new/omap2430.c
@@ -46,6 +46,13 @@ static inline void omap2430_low_level_init(struct musb *musb)
 	musb_writel(musb->mregs, OTG_FORCESTDBY, l);
 }
 
+int dm_usb_gadget_handle_interrupts(struct udevice *dev)
+{
+	struct musb_host_data *host = dev_get_priv(dev);
+
+	host->host->isr(0, host->host);
+	return 0;
+}
 
 static int omap2430_musb_init(struct musb *musb)
 {
@@ -214,37 +221,38 @@ static int omap2430_musb_of_to_plat(struct udevice *dev)
 
 static int omap2430_musb_probe(struct udevice *dev)
 {
-#ifdef CONFIG_USB_MUSB_HOST
 	struct musb_host_data *host = dev_get_priv(dev);
-#else
-	struct musb *musbp;
-#endif
+
 	struct omap2430_musb_plat *plat = dev_get_plat(dev);
-	struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
 	struct omap_musb_board_data *otg_board_data;
 	int ret = 0;
 	void *base = dev_read_addr_ptr(dev);
 
-	priv->desc_before_addr = true;
 
 	otg_board_data = &plat->otg_board_data;
 
-#ifdef CONFIG_USB_MUSB_HOST
+	if (IS_ENABLED(CONFIG_USB_MUSB_HOST)) {
+		struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
+
+		priv->desc_before_addr = true;
+		host->host = musb_init_controller(&plat->plat,
+						  (struct device *)otg_board_data,
+						  plat->base);
+		if (!host->host)
+			return -EIO;
+
+		return musb_lowlevel_init(host);
+	}
+
+	/* OTG still not supported, so forcing peripheral */
+	plat->plat.mode = MUSB_PERIPHERAL;
 	host->host = musb_init_controller(&plat->plat,
 					  (struct device *)otg_board_data,
 					  plat->base);
-	if (!host->host) {
+	if (!host->host)
 		return -EIO;
-	}
 
-	ret = musb_lowlevel_init(host);
-#else
-	musbp = musb_register(&plat->plat, (struct device *)otg_board_data,
-			      plat->base);
-	if (IS_ERR_OR_NULL(musbp))
-		return -EINVAL;
-#endif
-	return ret;
+	return usb_add_gadget_udc((struct device *)otg_board_data, &host->host->g);
 }
 
 static int omap2430_musb_remove(struct udevice *dev)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] musb-new: omap2430: fix musb probing in gadget mode
  2022-11-26 22:30 ` [PATCH 2/2] musb-new: omap2430: fix musb probing in gadget mode Andreas Kemnade
@ 2022-11-26 22:50   ` Marek Vasut
  2022-12-12 19:00   ` Tom Rini
  1 sibling, 0 replies; 8+ messages in thread
From: Marek Vasut @ 2022-11-26 22:50 UTC (permalink / raw)
  To: Andreas Kemnade, u-boot, t-kristo, kristo, tony

On 11/26/22 23:30, Andreas Kemnade wrote:
> Host mode structures were accessed but not initialized
> and gadget dm did not compile at all.

What exactly does this patch do ?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] musb-new: omap2430: fix musb probing in gadget mode
  2022-11-26 22:30 ` [PATCH 2/2] musb-new: omap2430: fix musb probing in gadget mode Andreas Kemnade
  2022-11-26 22:50   ` Marek Vasut
@ 2022-12-12 19:00   ` Tom Rini
  2022-12-13  8:30     ` Andreas Kemnade
  2022-12-13 20:32     ` Andreas Kemnade
  1 sibling, 2 replies; 8+ messages in thread
From: Tom Rini @ 2022-12-12 19:00 UTC (permalink / raw)
  To: Andreas Kemnade; +Cc: marex, u-boot, t-kristo, kristo, tony

[-- Attachment #1: Type: text/plain, Size: 419 bytes --]

On Sat, Nov 26, 2022 at 11:30:10PM +0100, Andreas Kemnade wrote:

> Host mode structures were accessed but not initialized
> and gadget dm did not compile at all.
> 
> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> ---
>  drivers/usb/musb-new/omap2430.c | 42 ++++++++++++++++++++-------------
>  1 file changed, 25 insertions(+), 17 deletions(-)

This breaks omap3_beagle and omap3_evm.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] omap4: make musb probeable by simple bus
  2022-11-26 22:30 ` [PATCH 1/2] omap4: make musb probeable by simple bus Andreas Kemnade
@ 2022-12-12 21:35   ` Tom Rini
  0 siblings, 0 replies; 8+ messages in thread
From: Tom Rini @ 2022-12-12 21:35 UTC (permalink / raw)
  To: Andreas Kemnade; +Cc: marex, u-boot, t-kristo, kristo, tony

[-- Attachment #1: Type: text/plain, Size: 271 bytes --]

On Sat, Nov 26, 2022 at 11:30:09PM +0100, Andreas Kemnade wrote:

> Like other peripherals important for booting,
> do not rely on ti-sysc compatibility alone
> 
> Signed-off-by: Andreas Kemnade <andreas@kemnade.info>

Applied to u-boot/next, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] musb-new: omap2430: fix musb probing in gadget mode
  2022-12-12 19:00   ` Tom Rini
@ 2022-12-13  8:30     ` Andreas Kemnade
  2022-12-13 20:32     ` Andreas Kemnade
  1 sibling, 0 replies; 8+ messages in thread
From: Andreas Kemnade @ 2022-12-13  8:30 UTC (permalink / raw)
  To: Tom Rini; +Cc: marex, u-boot, t-kristo, kristo, tony

Hi,

On Mon, 12 Dec 2022 14:00:57 -0500
Tom Rini <trini@konsulko.com> wrote:

> On Sat, Nov 26, 2022 at 11:30:10PM +0100, Andreas Kemnade wrote:
> 
> > Host mode structures were accessed but not initialized
> > and gadget dm did not compile at all.
> > 
> > Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> > ---
> >  drivers/usb/musb-new/omap2430.c | 42 ++++++++++++++++++++-------------
> >  1 file changed, 25 insertions(+), 17 deletions(-)  
> 
> This breaks omap3_beagle and omap3_evm.
> 
sorry, I will retest again. Probably best to add a CONFIG_DM_USB_GADGET
conditional there. That seems to be the problem there. I just thought
that nobody would care about non-CONFIG_DM_USB_GADGET and overlooked
the omap3 configs.

Regards,
Andreas

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] musb-new: omap2430: fix musb probing in gadget mode
  2022-12-12 19:00   ` Tom Rini
  2022-12-13  8:30     ` Andreas Kemnade
@ 2022-12-13 20:32     ` Andreas Kemnade
  1 sibling, 0 replies; 8+ messages in thread
From: Andreas Kemnade @ 2022-12-13 20:32 UTC (permalink / raw)
  To: Tom Rini; +Cc: marex, u-boot, t-kristo, kristo, tony

Hi,

just noticed I am doing two things in one patch.
better do it with just some patches

On Mon, 12 Dec 2022 14:00:57 -0500
Tom Rini <trini@konsulko.com> wrote:

> On Sat, Nov 26, 2022 at 11:30:10PM +0100, Andreas Kemnade wrote:
> 
> > Host mode structures were accessed but not initialized
first thing

->         struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
which will be zero if not in host mode (and later priv->something is
accessed unconditional.

> > and gadget dm did not compile at all.
> > 
preparing things for DM_USB_GADGET should probably better
a separate patch. I will send an update hopefully soon.

> > Signed-off-by: Andreas Kemnade <andreas@kemnade.info>
> > ---
> >  drivers/usb/musb-new/omap2430.c | 42 ++++++++++++++++++++-------------
> >  1 file changed, 25 insertions(+), 17 deletions(-)  
> 
> This breaks omap3_beagle and omap3_evm.
> 

Regards,
Andreas

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-12-13 20:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-26 22:30 [PATCH 0/2] musb-new: fix omap peripheral support Andreas Kemnade
2022-11-26 22:30 ` [PATCH 1/2] omap4: make musb probeable by simple bus Andreas Kemnade
2022-12-12 21:35   ` Tom Rini
2022-11-26 22:30 ` [PATCH 2/2] musb-new: omap2430: fix musb probing in gadget mode Andreas Kemnade
2022-11-26 22:50   ` Marek Vasut
2022-12-12 19:00   ` Tom Rini
2022-12-13  8:30     ` Andreas Kemnade
2022-12-13 20:32     ` Andreas Kemnade

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.