All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 1/2] drivers: musb-new: Add USB DRC driver for Microchip PIC32 OTG controller.
Date: Tue, 9 Feb 2016 14:18:58 +0100	[thread overview]
Message-ID: <201602091418.58398.marex@denx.de> (raw)
In-Reply-To: <1455019370-12197-1-git-send-email-purna.mandal@microchip.com>

On Tuesday, February 09, 2016 at 01:02:49 PM, Purna Chandra Mandal wrote:
> From: Cristian Birsan <cristian.birsan@microchip.com>
> 
> This driver adds support of PIC32 MUSB OTG controller as dual role device.
> It implements platform specific glue to reuse musb core.
> 
> Signed-off-by: Cristian Birsan <cristian.birsan@microchip.com>
> Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
> ---
> 
>  drivers/usb/gadget/f_mass_storage.c |   2 +
>  drivers/usb/musb-new/Kconfig        |   7 +
>  drivers/usb/musb-new/Makefile       |   1 +
>  drivers/usb/musb-new/linux-compat.h |   2 +
>  drivers/usb/musb-new/musb_core.c    |   2 +-
>  drivers/usb/musb-new/pic32.c        | 294
> ++++++++++++++++++++++++++++++++++++ 6 files changed, 307 insertions(+), 1
> deletion(-)
>  create mode 100644 drivers/usb/musb-new/pic32.c
> 
> diff --git a/drivers/usb/gadget/f_mass_storage.c
> b/drivers/usb/gadget/f_mass_storage.c index 1ecb92a..8ca02f2 100644
> --- a/drivers/usb/gadget/f_mass_storage.c
> +++ b/drivers/usb/gadget/f_mass_storage.c
> @@ -283,6 +283,7 @@ static const char fsg_string_interface[] = "Mass
> Storage"; struct kref {int x; };
>  struct completion {int x; };
> 
> +#if !defined(CONFIG_MIPS)

Why is this change needed, endianness issues ?

Also, you should put this into separate patch.

>  inline void set_bit(int nr, volatile void *addr)
>  {
>  	int	mask;
> @@ -302,6 +303,7 @@ inline void clear_bit(int nr, volatile void *addr)
>  	mask = 1 << (nr & 0x1f);
>  	*a &= ~mask;
>  }
> +#endif
> 
>  struct fsg_dev;
>  struct fsg_common;

[...]

> diff --git a/drivers/usb/musb-new/linux-compat.h
> b/drivers/usb/musb-new/linux-compat.h index 46f83d9..9ac48c1 100644
> --- a/drivers/usb/musb-new/linux-compat.h
> +++ b/drivers/usb/musb-new/linux-compat.h
> @@ -13,12 +13,14 @@
>  		printf(fmt, ##args);		\
>  	ret_warn; })
> 
> +#if !defined(CONFIG_MIPS)
>  #define writesl(a, d, s) __raw_writesl((unsigned long)a, d, s)
>  #define readsl(a, d, s) __raw_readsl((unsigned long)a, d, s)
>  #define writesw(a, d, s) __raw_writesw((unsigned long)a, d, s)
>  #define readsw(a, d, s) __raw_readsw((unsigned long)a, d, s)
>  #define writesb(a, d, s) __raw_writesb((unsigned long)a, d, s)
>  #define readsb(a, d, s) __raw_readsb((unsigned long)a, d, s)
> +#endif

Why is this needed?

>  #define device_init_wakeup(dev, a) do {} while (0)
> 

[...]

> +static int pic32_musb_set_mode(struct musb *musb, u8 mode)
> +{
> +	struct device *dev = musb->controller;
> +
> +	switch (mode) {
> +	case MUSB_HOST:
> +		clrsetbits_le32(musb_glue + USBCRCON,
> +				USBCRCON_USBIDVAL, USBCRCON_USBIDOVEN);

Is pic32 mipsel ? Or is the core doing endian swapping ?

I would expect _be32() stuff on mips.

> +		break;
> +	case MUSB_PERIPHERAL:
> +		setbits_le32(musb_glue + USBCRCON,
> +			     USBCRCON_USBIDVAL | USBCRCON_USBIDOVEN);
> +		break;
> +	case MUSB_OTG:
> +		dev_err(dev, "MUSB OTG mode enabled\n");
> +		break;
> +	default:
> +		dev_err(dev, "unsupported mode %d\n", mode);
> +		return -EINVAL;
> +	}
> +
> +	return 0;
> +}

[...]

Looks good otherwise.

  parent reply	other threads:[~2016-02-09 13:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-09 12:02 [U-Boot] [PATCH v1 1/2] drivers: musb-new: Add USB DRC driver for Microchip PIC32 OTG controller Purna Chandra Mandal
2016-02-09 12:02 ` [U-Boot] [PATCH v1 2/2] board: pic32mzda: enable USB-host, USB-storage support Purna Chandra Mandal
2016-02-09 13:18 ` Marek Vasut [this message]
2016-02-09 13:26   ` [U-Boot] [PATCH v1 1/2] drivers: musb-new: Add USB DRC driver for Microchip PIC32 OTG controller Purna Chandra Mandal
2016-02-09 14:50     ` Marek Vasut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201602091418.58398.marex@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.