Skip to content

Commit

Permalink
usb: dwc3: Correct errors when dwc3 loaded as module
Browse files Browse the repository at this point in the history
This patch fixes the errors when dwc3 is selected as a loadable
module.

Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
State: pending
  • Loading branch information
Piyush Mehta authored and Michal Simek committed Apr 16, 2020
1 parent 8110b9b commit 782658c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/usb/dwc3/core.c
Expand Up @@ -1400,6 +1400,9 @@ static void dwc3_get_properties(struct dwc3 *dwc)
dwc->dis_metastability_quirk = device_property_read_bool(dev,
"snps,dis_metastability_quirk");

/* Check if extra quirks to be added */
dwc3_simple_check_quirks(dwc);

dwc->lpm_nyet_threshold = lpm_nyet_threshold;
dwc->tx_de_emphasis = tx_de_emphasis;

Expand Down
3 changes: 3 additions & 0 deletions drivers/usb/dwc3/core.h
Expand Up @@ -1422,13 +1422,16 @@ static inline bool dwc3_is_usb31(struct dwc3 *dwc)
int dwc3_enable_hw_coherency(struct device *dev);
void dwc3_simple_wakeup_capable(struct device *dev, bool wakeup);
void dwc3_set_simple_data(struct dwc3 *dwc);
void dwc3_simple_check_quirks(struct dwc3 *dwc);
#else
static inline int dwc3_enable_hw_coherency(struct device *dev)
{ return 1; }
void dwc3_simple_wakeup_capable(struct device *dev, bool wakeup)
{ ; }
void dwc3_set_simple_data(struct dwc3 *dwc)
{ ; }
void dwc3_simple_check_quirks(struct dwc3 *dwc)
{ ; }
#endif

bool dwc3_has_imod(struct dwc3 *dwc);
Expand Down
19 changes: 19 additions & 0 deletions drivers/usb/dwc3/dwc3-of-simple.c
Expand Up @@ -49,6 +49,7 @@ struct dwc3_of_simple {
struct dwc3 *dwc;
struct phy *phy;
bool wakeup_capable;
bool dis_u3_susphy_quirk;
bool enable_d3_suspend;
struct reset_control *resets;
bool pulse_resets;
Expand Down Expand Up @@ -96,6 +97,24 @@ void dwc3_set_simple_data(struct dwc3 *dwc)
}
EXPORT_SYMBOL(dwc3_set_simple_data);

void dwc3_simple_check_quirks(struct dwc3 *dwc)
{
struct device_node *node = of_get_parent(dwc->dev->of_node);

if (node && of_device_is_compatible(node, "xlnx,zynqmp-dwc3")) {
struct platform_device *pdev_parent;
struct dwc3_of_simple *simple;

pdev_parent = of_find_device_by_node(node);
simple = platform_get_drvdata(pdev_parent);

/* Add snps,dis_u3_susphy_quirk */
dwc->dis_u3_susphy_quirk = simple->dis_u3_susphy_quirk;

}
}
EXPORT_SYMBOL(dwc3_simple_check_quirks);

void dwc3_simple_wakeup_capable(struct device *dev, bool wakeup)
{
struct device_node *node = of_node_get(dev->parent->of_node);
Expand Down
1 change: 1 addition & 0 deletions drivers/usb/dwc3/host.c
Expand Up @@ -17,6 +17,7 @@ void dwc3_host_wakeup_capable(struct device *dev, bool wakeup)
{
dwc3_simple_wakeup_capable(dev, wakeup);
}
EXPORT_SYMBOL(dwc3_host_wakeup_capable);

static int dwc3_host_get_irq(struct dwc3 *dwc)
{
Expand Down

0 comments on commit 782658c

Please sign in to comment.