usb: dwc2: Use platform endianness when accessing registers
This patch switches calls to readl/writel to their dwc2_readl/dwc2_writel equivalents which preserve platform endianness. This patch is necessary to access dwc2 registers correctly on big-endian systems such as the mips based SoCs made by Lantiq. Then dwc2 can be used to replace ifx-hcd driver for Lantiq platforms found e.g. in OpenWrt. The patch was autogenerated with the following commands: $EDITOR core.h sed -i "s/\<readl\>/dwc2_readl/g" *.c hcd.h hw.h sed -i "s/\<writel\>/dwc2_writel/g" *.c hcd.h hw.h Some files were then hand-edited to fix checkpatch.pl warnings about too long lines. Signed-off-by: Antti Seppälä <a.seppala@gmail.com> Signed-off-by: Vincent Pelletier <plr.vincent@gmail.com> Signed-off-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:

committed by
Felipe Balbi

parent
bba787a860
commit
95c8bc3609
@@ -169,19 +169,19 @@ static void dwc2_per_sched_enable(struct dwc2_hsotg *hsotg, u32 fr_list_en)
|
||||
|
||||
spin_lock_irqsave(&hsotg->lock, flags);
|
||||
|
||||
hcfg = readl(hsotg->regs + HCFG);
|
||||
hcfg = dwc2_readl(hsotg->regs + HCFG);
|
||||
if (hcfg & HCFG_PERSCHEDENA) {
|
||||
/* already enabled */
|
||||
spin_unlock_irqrestore(&hsotg->lock, flags);
|
||||
return;
|
||||
}
|
||||
|
||||
writel(hsotg->frame_list_dma, hsotg->regs + HFLBADDR);
|
||||
dwc2_writel(hsotg->frame_list_dma, hsotg->regs + HFLBADDR);
|
||||
|
||||
hcfg &= ~HCFG_FRLISTEN_MASK;
|
||||
hcfg |= fr_list_en | HCFG_PERSCHEDENA;
|
||||
dev_vdbg(hsotg->dev, "Enabling Periodic schedule\n");
|
||||
writel(hcfg, hsotg->regs + HCFG);
|
||||
dwc2_writel(hcfg, hsotg->regs + HCFG);
|
||||
|
||||
spin_unlock_irqrestore(&hsotg->lock, flags);
|
||||
}
|
||||
@@ -193,7 +193,7 @@ static void dwc2_per_sched_disable(struct dwc2_hsotg *hsotg)
|
||||
|
||||
spin_lock_irqsave(&hsotg->lock, flags);
|
||||
|
||||
hcfg = readl(hsotg->regs + HCFG);
|
||||
hcfg = dwc2_readl(hsotg->regs + HCFG);
|
||||
if (!(hcfg & HCFG_PERSCHEDENA)) {
|
||||
/* already disabled */
|
||||
spin_unlock_irqrestore(&hsotg->lock, flags);
|
||||
@@ -202,7 +202,7 @@ static void dwc2_per_sched_disable(struct dwc2_hsotg *hsotg)
|
||||
|
||||
hcfg &= ~HCFG_PERSCHEDENA;
|
||||
dev_vdbg(hsotg->dev, "Disabling Periodic schedule\n");
|
||||
writel(hcfg, hsotg->regs + HCFG);
|
||||
dwc2_writel(hcfg, hsotg->regs + HCFG);
|
||||
|
||||
spin_unlock_irqrestore(&hsotg->lock, flags);
|
||||
}
|
||||
|
Reference in New Issue
Block a user