All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthieu CASTET <matthieu.castet-ITF29qwbsa/QT0dZR+AlfA@public.gmane.org>
To: Benoit Goby <benoit-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>
Cc: David Brownell
	<dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
	Greg Kroah-Hartman <gregkh-l3A5Bk7waGM@public.gmane.org>,
	"linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Robert Morell <rmorell-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	Olof Johansson <olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org>,
	Erik Gilling <konkers-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>,
	"linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 1/4] [ARM] tegra: Add support for Tegra USB PHYs
Date: Wed, 9 Feb 2011 09:44:51 +0100	[thread overview]
Message-ID: <4D525403.4010602@parrot.com> (raw)
In-Reply-To: <1297228927-23497-2-git-send-email-benoit-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>

Hello,

Benoit Goby a écrit :
> Interface used by Tegra's gadget driver and ehci driver
> to power on and configure the USB PHYs.
> 
> + */
> +
> +#include <linux/resource.h>
> +#include <linux/delay.h>
> +#include <linux/slab.h>
> +#include <linux/err.h>
> +#include <linux/platform_device.h>
> +#include <linux/io.h>
> +#include <linux/gpio.h>
> +#include <asm/mach-types.h>
> +#include <mach/usb_phy.h>
> +#include <mach/iomap.h>
> +
> +#define USB_USBSTS             0x144
> +#define   USB_USBSTS_PCI       (1 << 2)
> +
> +#define ULPI_VIEWPORT          0x170
It look like your core is a arc/chipidea/mips one that is already used 
on other product (msm) for example.

Can't you merge with them ?

for example
 > +static int utmi_wait_register(void __iomem *reg, u32 mask, u32 result)
 > +{
 > +       unsigned long timeout = 2000;
 > +       do {
 > +               if ((readl(reg) & mask) == result)
 > +                       return 0;
 > +               udelay(1);
 > +               timeout--;
 > +       } while (timeout);
 > +       return -1;
 > +}
 > +static void ulpi_viewport_write(struct tegra_usb_phy *phy, u8 addr, 
u8 data)
 > +{
 > +       unsigned long val;
 > +       void __iomem *base = phy->regs;
 > +
 > +       val = ULPI_RUN | ULPI_RD_RW_WRITE | ULPI_PORT(0);
 > +       val |= ULPI_ADDR(addr) | ULPI_DATA_WR(data);
 > +       writel(val, base + ULPI_VIEWPORT);
 > +
 > +       if (utmi_wait_register(base + ULPI_VIEWPORT, ULPI_RUN, 0))
 > +               pr_err("%s: timeout accessing ulpi phy\n", __func__);
 > +}

look very similar to what is in drivers/usb/otg/msm72k_otg.c


+static int ulpi_write(struct otg_transceiver *otg, u32 val, u32 reg)
+{
+       struct msm_otg *motg = container_of(otg, struct msm_otg, otg);
+       int cnt = 0;
+
+       /* initiate write operation */
+       writel(ULPI_RUN | ULPI_WRITE |
+              ULPI_ADDR(reg) | ULPI_DATA(val),
+              USB_ULPI_VIEWPORT);
+
+       /* wait for completion */
+       while (cnt < ULPI_IO_TIMEOUT_USEC) {
+               if (!(readl(USB_ULPI_VIEWPORT) & ULPI_RUN))
+                       break;
+               udelay(1);
+               cnt++;
+       }
+
+       if (cnt >= ULPI_IO_TIMEOUT_USEC) {
+               dev_err(otg->dev, "ulpi_write: timeout\n");
+               return -ETIMEDOUT;
+       }
+       return 0;
+}


Matthieu
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2011-02-09  8:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-09  5:22 [PATCH 0/4] Tegra EHCI driver Benoit Goby
     [not found] ` <1297228927-23497-1-git-send-email-benoit-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>
2011-02-09  5:22   ` [PATCH 1/4] [ARM] tegra: Add support for Tegra USB PHYs Benoit Goby
     [not found]     ` <1297228927-23497-2-git-send-email-benoit-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>
2011-02-09  7:05       ` rmorell-DDmLM1+adcrQT0dZR+AlfA
     [not found]         ` <20110209070540.GA17627-f3YH7lVHJt/FT5IIyIEb6QC/G2K4zDHf@public.gmane.org>
2011-02-12  3:01           ` Benoit Goby
2011-02-09  8:44       ` Matthieu CASTET [this message]
2011-02-09  5:22   ` [PATCH 2/4] usb: host: ehci-hcd: Add controller_resets_phy quirk Benoit Goby
     [not found]     ` <1297228927-23497-3-git-send-email-benoit-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>
2011-02-09 16:01       ` Matthieu CASTET
     [not found]         ` <4D52BA75.5010409-ITF29qwbsa/QT0dZR+AlfA@public.gmane.org>
2011-02-10  2:46           ` Pavan Kondeti
2011-02-09  5:22   ` [PATCH 3/4] usb: host: Add EHCI driver for NVIDIA Tegra SoCs Benoit Goby
     [not found]     ` <1297228927-23497-4-git-send-email-benoit-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>
2011-02-09  9:01       ` Matthieu CASTET
     [not found]         ` <4D5257FA.1030605-ITF29qwbsa/QT0dZR+AlfA@public.gmane.org>
2011-02-12  0:59           ` Benoit Goby
2011-02-09 19:43       ` David Daney
2011-02-09  5:22   ` [PATCH 4/4] USB: ehci: tegra: Align DMA transfers to 32 bytes Benoit Goby

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=4D525403.4010602@parrot.com \
    --to=matthieu.castet-itf29qwbsa/qt0dzr+alfa@public.gmane.org \
    --cc=benoit-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org \
    --cc=dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=gregkh-l3A5Bk7waGM@public.gmane.org \
    --cc=konkers-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=olof-nZhT3qVonbNeoWH0uzbU5w@public.gmane.org \
    --cc=rmorell-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    /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.