From: Felipe Balbi <balbi@ti.com>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Chanwoo Choi <cw00.choi@samsung.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>,
David Cohen <david.a.cohen@linux.intel.com>,
Lu Baolu <baolu.lu@linux.intel.com>,
Mathias Nyman <mathias.nyman@linux.intel.com>,
<linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] usb: pci-quirks: register USB mux found on Cherrytrail SOC
Date: Tue, 1 Dec 2015 14:38:38 -0600 [thread overview]
Message-ID: <87oae9zyy9.fsf@saruman.tx.rr.com> (raw)
In-Reply-To: <1448976758-35807-3-git-send-email-heikki.krogerus@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 2795 bytes --]
Hi,
Heikki Krogerus <heikki.krogerus@linux.intel.com> writes:
> Intel Braswell/Cherrytrail has an internal mux that shares
> one USB port between USB Device Controller and xHCI. The
> same mux is found on several SOCs from Intel, but only on
> a few Cherrytrail based platforms the OS is expected to
> configure it. Normally BIOS takes care of it.
>
> The driver for the mux is an "extcon" driver. With this we
> only register the mux if it's detected.
>
> Suggested-by: Lu Baolu <baolu.lu@linux.intel.com>
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/host/pci-quirks.c | 30 +++++++++++++++++++++++++++++-
> 1 file changed, 29 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
> index f940056..4e3016a 100644
> --- a/drivers/usb/host/pci-quirks.c
> +++ b/drivers/usb/host/pci-quirks.c
> @@ -16,6 +16,7 @@
> #include <linux/export.h>
> #include <linux/acpi.h>
> #include <linux/dmi.h>
> +#include <linux/extcon/intel_usb_mux.h>
> #include "pci-quirks.h"
> #include "xhci-ext-caps.h"
>
> @@ -1029,9 +1030,36 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev)
> writel(val, base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET);
>
> hc_init:
> - if (pdev->vendor == PCI_VENDOR_ID_INTEL)
> + if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
> usb_enable_intel_xhci_ports(pdev);
>
> + /*
> + * Initialize the internal mux that shares a port between USB
> + * Device Controller and xHCI on platforms that have it.
> + */
> +#define XHCI_INTEL_VENDOR_CAPS 192
> +#define XHCI_INTEL_USB_MUX_OFFSET 0x80d8
> + ext_cap_offset = xhci_find_next_cap_offset(base,
> + XHCI_HCC_PARAMS_OFFSET);
> + ext_cap_offset = xhci_find_ext_cap_by_id(base, ext_cap_offset,
> + XHCI_INTEL_VENDOR_CAPS);
> + if (ext_cap_offset) {
> + struct intel_usb_mux *mux;
> + struct resource r;
> +
> + r.start = pci_resource_start(pdev, 0) +
> + XHCI_INTEL_USB_MUX_OFFSET;
> + r.end = r.start + 8;
> + r.flags = IORESOURCE_MEM;
> +
> + mux = intel_usb_mux_register(&pdev->dev, &r);
> + if (IS_ERR(mux) && PTR_ERR(mux) == -ENOTSUPP)
> + dev_dbg(&pdev->dev, "USB mux not supported\n");
> + else if (IS_ERR(mux))
> + dev_err(&pdev->dev, "failed to register mux\n");
IMHO, this should be creating a child device instead of calling
intel_usb_mux_register() directly. That way, your mux driver could
actually _be_ a driver. Seems like all you need to do from this point is
a register a simple platform_device which is a child of xhci, see
platform_device_register_simple() for how to do this.
Or rather, platform_device_register_rsndata() passing xhci's device
pointer as parent.
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]
next prev parent reply other threads:[~2015-12-01 20:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-01 13:32 [PATCH 0/2] extcon: driver for Intel USB MUX Heikki Krogerus
2015-12-01 13:32 ` [PATCH 1/2] extcon: add driver for Intel USB mux Heikki Krogerus
2015-12-01 20:28 ` David Cohen
2015-12-02 10:27 ` Heikki Krogerus
2015-12-02 18:17 ` David Cohen
2015-12-01 20:34 ` Felipe Balbi
2015-12-01 20:55 ` David Cohen
2015-12-01 21:22 ` Felipe Balbi
2015-12-01 13:32 ` [PATCH 2/2] usb: pci-quirks: register USB mux found on Cherrytrail SOC Heikki Krogerus
2015-12-01 20:38 ` Felipe Balbi [this message]
2015-12-02 9:13 ` Heikki Krogerus
2015-12-02 14:46 ` Felipe Balbi
2015-12-02 7:02 ` Lu Baolu
2015-12-02 9:15 ` Heikki Krogerus
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=87oae9zyy9.fsf@saruman.tx.rr.com \
--to=balbi@ti.com \
--cc=baolu.lu@linux.intel.com \
--cc=cw00.choi@samsung.com \
--cc=david.a.cohen@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@linux.intel.com \
--cc=myungjoo.ham@samsung.com \
/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.