Commit bcdb3272 authored by Felipe Balbi's avatar Felipe Balbi

usb: dwc3: core: move fladj to dwc3 structure

this patch is in preparation for some further
re-factoring in dwc3 initialization. No functional
changes.
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent 2eb88016
...@@ -149,9 +149,8 @@ static int dwc3_soft_reset(struct dwc3 *dwc) ...@@ -149,9 +149,8 @@ static int dwc3_soft_reset(struct dwc3 *dwc)
/* /*
* dwc3_frame_length_adjustment - Adjusts frame length if required * dwc3_frame_length_adjustment - Adjusts frame length if required
* @dwc3: Pointer to our controller context structure * @dwc3: Pointer to our controller context structure
* @fladj: Value of GFLADJ_30MHZ to adjust frame length
*/ */
static void dwc3_frame_length_adjustment(struct dwc3 *dwc, u32 fladj) static void dwc3_frame_length_adjustment(struct dwc3 *dwc)
{ {
u32 reg; u32 reg;
u32 dft; u32 dft;
...@@ -159,15 +158,15 @@ static void dwc3_frame_length_adjustment(struct dwc3 *dwc, u32 fladj) ...@@ -159,15 +158,15 @@ static void dwc3_frame_length_adjustment(struct dwc3 *dwc, u32 fladj)
if (dwc->revision < DWC3_REVISION_250A) if (dwc->revision < DWC3_REVISION_250A)
return; return;
if (fladj == 0) if (dwc->fladj == 0)
return; return;
reg = dwc3_readl(dwc->regs, DWC3_GFLADJ); reg = dwc3_readl(dwc->regs, DWC3_GFLADJ);
dft = reg & DWC3_GFLADJ_30MHZ_MASK; dft = reg & DWC3_GFLADJ_30MHZ_MASK;
if (!dev_WARN_ONCE(dwc->dev, dft == fladj, if (!dev_WARN_ONCE(dwc->dev, dft == dwc->fladj,
"request value same as default, ignoring\n")) { "request value same as default, ignoring\n")) {
reg &= ~DWC3_GFLADJ_30MHZ_MASK; reg &= ~DWC3_GFLADJ_30MHZ_MASK;
reg |= DWC3_GFLADJ_30MHZ_SDBND_SEL | fladj; reg |= DWC3_GFLADJ_30MHZ_SDBND_SEL | dwc->fladj;
dwc3_writel(dwc->regs, DWC3_GFLADJ, reg); dwc3_writel(dwc->regs, DWC3_GFLADJ, reg);
} }
} }
...@@ -799,7 +798,6 @@ static int dwc3_probe(struct platform_device *pdev) ...@@ -799,7 +798,6 @@ static int dwc3_probe(struct platform_device *pdev)
u8 lpm_nyet_threshold; u8 lpm_nyet_threshold;
u8 tx_de_emphasis; u8 tx_de_emphasis;
u8 hird_threshold; u8 hird_threshold;
u32 fladj = 0;
int ret; int ret;
...@@ -909,7 +907,7 @@ static int dwc3_probe(struct platform_device *pdev) ...@@ -909,7 +907,7 @@ static int dwc3_probe(struct platform_device *pdev)
device_property_read_string(dev, "snps,hsphy_interface", device_property_read_string(dev, "snps,hsphy_interface",
&dwc->hsphy_interface); &dwc->hsphy_interface);
device_property_read_u32(dev, "snps,quirk-frame-length-adjustment", device_property_read_u32(dev, "snps,quirk-frame-length-adjustment",
&fladj); &dwc->fladj);
if (pdata) { if (pdata) {
dwc->maximum_speed = pdata->maximum_speed; dwc->maximum_speed = pdata->maximum_speed;
...@@ -941,7 +939,7 @@ static int dwc3_probe(struct platform_device *pdev) ...@@ -941,7 +939,7 @@ static int dwc3_probe(struct platform_device *pdev)
tx_de_emphasis = pdata->tx_de_emphasis; tx_de_emphasis = pdata->tx_de_emphasis;
dwc->hsphy_interface = pdata->hsphy_interface; dwc->hsphy_interface = pdata->hsphy_interface;
fladj = pdata->fladj_value; dwc->fladj = pdata->fladj_value;
} }
dwc->lpm_nyet_threshold = lpm_nyet_threshold; dwc->lpm_nyet_threshold = lpm_nyet_threshold;
...@@ -1022,7 +1020,7 @@ static int dwc3_probe(struct platform_device *pdev) ...@@ -1022,7 +1020,7 @@ static int dwc3_probe(struct platform_device *pdev)
} }
/* Adjust Frame Length */ /* Adjust Frame Length */
dwc3_frame_length_adjustment(dwc, fladj); dwc3_frame_length_adjustment(dwc);
usb_phy_set_suspend(dwc->usb2_phy, 0); usb_phy_set_suspend(dwc->usb2_phy, 0);
usb_phy_set_suspend(dwc->usb3_phy, 0); usb_phy_set_suspend(dwc->usb3_phy, 0);
......
...@@ -729,6 +729,7 @@ struct dwc3_scratchpad_array { ...@@ -729,6 +729,7 @@ struct dwc3_scratchpad_array {
* @gadget_driver: pointer to the gadget driver * @gadget_driver: pointer to the gadget driver
* @regs: base address for our registers * @regs: base address for our registers
* @regs_size: address space size * @regs_size: address space size
* @fladj: frame length adjustment
* @nr_scratch: number of scratch buffers * @nr_scratch: number of scratch buffers
* @u1u2: only used on revisions <1.83a for workaround * @u1u2: only used on revisions <1.83a for workaround
* @maximum_speed: maximum speed requested (mainly for testing purposes) * @maximum_speed: maximum speed requested (mainly for testing purposes)
...@@ -838,6 +839,7 @@ struct dwc3 { ...@@ -838,6 +839,7 @@ struct dwc3 {
/* used for suspend/resume */ /* used for suspend/resume */
u32 gctl; u32 gctl;
u32 fladj;
u32 nr_scratch; u32 nr_scratch;
u32 u1u2; u32 u1u2;
u32 maximum_speed; u32 maximum_speed;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment