All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Felipe Balbi <balbi@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	USB <linux-usb@vger.kernel.org>
Subject: [2/3] usb: dwc3: pci: Enable ULPI Refclk on platforms where the firmware doesnot
Date: Thu, 7 Jun 2018 16:30:45 +0300	[thread overview]
Message-ID: <CAHp75VfG5Vnudz0_dS0Z8J+3mrMFoKTMJYt_87PhSy2BSEDWBA@mail.gmail.com> (raw)

On Thu, Jun 7, 2018 at 1:38 PM, Hans de Goede <hdegoede@redhat.com> wrote:
> On some Bay Trail (BYT) systems the firmware does not enable the
> ULPI Refclk.
>
> This commit adds a helper which checks and if necessary enabled the Refclk
> and calls this helper for BYT machines.


> +static void dwc3_pci_enable_ulpi_refclock(struct pci_dev *pci)
> +{
> +       void __iomem    *reg;
> +       struct resource res;
> +       struct device   *dev = &pci->dev;
> +       u32             value;
> +

> +       res.start       = pci_resource_start(pci, 1);
> +       res.end         = pci_resource_end(pci, 1);
> +       res.name        = "dwc_usb3_bar1";
> +       res.flags       = IORESOURCE_MEM;
> +
> +       reg = devm_ioremap_resource(dev, &res);
> +       if (IS_ERR(reg)) {
> +               dev_err(dev, "cannot check GP_RWREG1 to assert ulpi refclock\n");
> +               return;
> +       }

I'm not sure I understand what's wrong with simple
pci_iomap() & Co (perhaps pcim_iomap() / pcim_iomap_regions() and others)

> +
> +       value = readl(reg + GP_RWREG1);
> +       if (!(value & GP_RWREG1_ULPI_REFCLK_DISABLE))
> +               return; /* ULPI refclk already enabled */
> +
> +       dev_warn(dev, "ULPI refclock is disabled from the BIOS, enabling it\n");
> +       value &= ~GP_RWREG1_ULPI_REFCLK_DISABLE;
> +       writel(value, reg + GP_RWREG1);

> +       msleep(100);

This has to be explained.

> +}

             reply	other threads:[~2018-06-07 13:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-07 13:30 Andy Shevchenko [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-06-07 17:23 [2/3] usb: dwc3: pci: Enable ULPI Refclk on platforms where the firmware doesnot Andy Shevchenko
2018-06-07 17:01 Hans de Goede
2018-06-07 16:43 Sergei Shtylyov
2018-06-07 13:42 Hans de Goede
2018-06-07 10:38 Hans de Goede

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=CAHp75VfG5Vnudz0_dS0Z8J+3mrMFoKTMJYt_87PhSy2BSEDWBA@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=linux-usb@vger.kernel.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.