From: Felipe Balbi <balbi@ti.com>
To: Huang Rui <ray.huang@amd.com>
Cc: Felipe Balbi <balbi@ti.com>,
Alan Stern <stern@rowland.harvard.edu>,
Bjorn Helgaas <bhelgaas@google.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Paul Zimmerman <Paul.Zimmerman@synopsys.com>,
Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Vincent Wan <vincent.wan@amd.com>, Tony Li <tony.li@amd.com>,
<linux-usb@vger.kernel.org>, <linux-pci@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 05/16] usb: dwc3: add quirks support to be compatible for kinds of SoCs
Date: Fri, 17 Oct 2014 09:41:44 -0500 [thread overview]
Message-ID: <20141017144144.GA26260@saruman> (raw)
In-Reply-To: <1413536021-4886-6-git-send-email-ray.huang@amd.com>
[-- Attachment #1: Type: text/plain, Size: 3572 bytes --]
HI,
On Fri, Oct 17, 2014 at 04:53:30PM +0800, Huang Rui wrote:
> This patch adds a quirks flag at dwc3 structure, and SoCs platform vendor is
> able to define this flag in platform data at bus glue layer. Then do some
> independent behaviors at dwc3 core level.
>
> Signed-off-by: Huang Rui <ray.huang@amd.com>
> ---
> drivers/usb/dwc3/core.c | 2 ++
> drivers/usb/dwc3/core.h | 3 +++
> drivers/usb/dwc3/dwc3-pci.c | 9 +++++++++
> drivers/usb/dwc3/platform_data.h | 2 ++
> 4 files changed, 16 insertions(+)
>
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index ddac372..50c0eae 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -710,6 +710,8 @@ static int dwc3_probe(struct platform_device *pdev)
>
> dwc->needs_fifo_resize = pdata->tx_fifo_resize;
> dwc->dr_mode = pdata->dr_mode;
> +
> + dwc->quirks = pdata->quirks;
> }
>
> /* default to superspeed if no maximum_speed passed */
> diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
> index f6ee623..cfe0d57 100644
> --- a/drivers/usb/dwc3/core.h
> +++ b/drivers/usb/dwc3/core.h
> @@ -636,6 +636,7 @@ struct dwc3_scratchpad_array {
> * @u1u2: only used on revisions <1.83a for workaround
> * @maximum_speed: maximum speed requested (mainly for testing purposes)
> * @revision: revision register contents
> + * @quirks: represents different SOCs hardware work-arounds and quirks
> * @dr_mode: requested mode of operation
> * @usb2_phy: pointer to USB2 PHY
> * @usb3_phy: pointer to USB3 PHY
> @@ -740,6 +741,8 @@ struct dwc3 {
> #define DWC3_REVISION_270A 0x5533270a
> #define DWC3_REVISION_280A 0x5533280a
>
> + u32 quirks;
> +
> enum dwc3_ep0_next ep0_next_event;
> enum dwc3_ep0_state ep0state;
> enum dwc3_link_state link_state;
> diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
> index 3806547..18569a4 100644
> --- a/drivers/usb/dwc3/dwc3-pci.c
> +++ b/drivers/usb/dwc3/dwc3-pci.c
> @@ -25,6 +25,8 @@
> #include <linux/usb/otg.h>
> #include <linux/usb/usb_phy_generic.h>
>
> +#include "platform_data.h"
> +
> /* FIXME define these in <linux/pci_ids.h> */
> #define PCI_VENDOR_ID_SYNOPSYS 0x16c3
> #define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd
> @@ -103,6 +105,9 @@ static int dwc3_pci_probe(struct pci_dev *pci,
> struct dwc3_pci *glue;
> int ret;
> struct device *dev = &pci->dev;
> + struct dwc3_platform_data dwc3_pdata;
> +
> + memset(&dwc3_pdata, 0x00, sizeof(dwc3_pdata));
>
> glue = devm_kzalloc(dev, sizeof(*glue), GFP_KERNEL);
> if (!glue)
> @@ -149,6 +154,10 @@ static int dwc3_pci_probe(struct pci_dev *pci,
>
> pci_set_drvdata(pci, glue);
>
> + ret = platform_device_add_data(dwc3, &dwc3_pdata, sizeof(dwc3_pdata));
> + if (ret)
> + goto err3;
> +
> dma_set_coherent_mask(&dwc3->dev, dev->coherent_dma_mask);
>
> dwc3->dev.dma_mask = dev->dma_mask;
> diff --git a/drivers/usb/dwc3/platform_data.h b/drivers/usb/dwc3/platform_data.h
> index 7db34f0..1d3d65f 100644
> --- a/drivers/usb/dwc3/platform_data.h
> +++ b/drivers/usb/dwc3/platform_data.h
> @@ -24,4 +24,6 @@ struct dwc3_platform_data {
> enum usb_device_speed maximum_speed;
> enum usb_dr_mode dr_mode;
> bool tx_fifo_resize;
> +
> + u32 quirks;
I prefer to have one-bit fields like we already have for delayed_status,
ep0_bounced, ep0_expect_in, and so on. That makes it easier to support
the same quirks through devicetree as well.
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2014-10-17 14:42 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-17 8:53 [PATCH v2 00/16] usb: dwc3: add support for AMD NL SoC Huang Rui
2014-10-17 8:53 ` [PATCH v2 01/16] usb: dwc3: add AMD NL support Huang Rui
2014-10-17 15:00 ` Felipe Balbi
2014-10-17 8:53 ` [PATCH v2 02/16] pci: quirks: add quirk to avoid AMD NL to bind with xhci Huang Rui
2014-10-24 16:35 ` Bjorn Helgaas
2014-10-27 2:55 ` Huang Rui
2014-10-27 13:21 ` Bjorn Helgaas
2014-10-17 8:53 ` [PATCH v2 03/16] usb: dwc3: enable hibernation if to be supported Huang Rui
2014-10-17 8:53 ` [PATCH v2 04/16] usb: dwc3: add a flag to check if it is fpga board Huang Rui
2014-10-17 8:53 ` [PATCH v2 05/16] usb: dwc3: add quirks support to be compatible for kinds of SoCs Huang Rui
2014-10-17 14:41 ` Felipe Balbi [this message]
2014-10-20 6:02 ` Huang Rui
2014-10-24 15:25 ` Felipe Balbi
2014-10-17 8:53 ` [PATCH v2 06/16] usb: dwc3: add disscramble quirk Huang Rui
2014-10-17 14:45 ` Felipe Balbi
2014-10-20 6:38 ` Huang Rui
2014-10-24 15:26 ` Felipe Balbi
2014-10-17 8:53 ` [PATCH v2 07/16] usb: dwc3: add lpm erratum support Huang Rui
2014-10-17 14:48 ` Felipe Balbi
2014-10-24 17:01 ` Huang Rui
2014-10-24 17:35 ` Felipe Balbi
2014-10-17 8:53 ` [PATCH v2 08/16] usb: dwc3: add u2exit lfps quirk Huang Rui
2014-10-17 14:50 ` Felipe Balbi
2014-10-20 6:43 ` Huang Rui
2014-10-24 15:27 ` Felipe Balbi
2014-10-17 8:53 ` [PATCH v2 09/16] usb: dwc3: add P3 in U2 SS inactive quirk Huang Rui
2014-10-17 14:52 ` Felipe Balbi
2014-10-17 8:53 ` [PATCH v2 10/16] usb: dwc3: add request p1p2p3 quirk Huang Rui
2014-10-17 14:53 ` Felipe Balbi
2014-10-17 8:53 ` [PATCH v2 11/16] usb: dwc3: add delay " Huang Rui
2014-10-17 14:54 ` Felipe Balbi
2014-10-17 8:53 ` [PATCH v2 12/16] usb: dwc3: add delay phy power change quirk Huang Rui
2014-10-17 14:56 ` Felipe Balbi
2014-10-17 8:53 ` [PATCH v2 13/16] usb: dwc3: add lfps filter quirk Huang Rui
2014-10-17 14:56 ` Felipe Balbi
2014-10-17 8:53 ` [PATCH v2 14/16] usb: dwc3: enable rx_detect to polling lfps quirk Huang Rui
2014-10-17 14:57 ` Felipe Balbi
2014-10-17 8:53 ` [PATCH v2 15/16] usb: dwc3: add tx demphasis quirk Huang Rui
2014-10-17 14:57 ` Felipe Balbi
2014-10-17 8:53 ` [PATCH v2 16/16] usb: dwc3: enable usb suspend phy Huang Rui
2014-10-17 14:59 ` Felipe Balbi
2014-10-17 18:41 ` Paul Zimmerman
2014-10-17 18:48 ` Felipe Balbi
2014-10-20 8:41 ` Huang Rui
2014-10-20 9:01 ` Huang Rui
2014-10-20 18:17 ` Paul Zimmerman
2014-10-24 15:29 ` Felipe Balbi
2014-10-24 15:28 ` Felipe Balbi
2014-10-17 15:10 ` [PATCH v2 00/16] usb: dwc3: add support for AMD NL SoC Felipe Balbi
2014-10-20 15:38 ` Huang Rui
2014-10-24 15:30 ` Felipe Balbi
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=20141017144144.GA26260@saruman \
--to=balbi@ti.com \
--cc=Paul.Zimmerman@synopsys.com \
--cc=bhelgaas@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=ray.huang@amd.com \
--cc=stern@rowland.harvard.edu \
--cc=tony.li@amd.com \
--cc=vincent.wan@amd.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).