Skip to content

Commit

Permalink
staging: dwc2: remove redundant register reads
Browse files Browse the repository at this point in the history
For calculating FIFO offsets, the sizes of preceding fifos need to be
known. For filling the GDFIFOCFG register, these fifo sizes were read
from hardware registers. However, these values were written to these
registers just a few lines before, so we can just use the values written
instead.

Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
Acked-by: Paul Zimmerman <paulz@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Matthijs Kooijman authored and Greg Kroah-Hartman committed Aug 30, 2013
1 parent c35205a commit 08b9f9d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/staging/dwc2/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ void dwc2_disable_host_interrupts(struct dwc2_hsotg *hsotg)
static void dwc2_config_fifos(struct dwc2_hsotg *hsotg)
{
struct dwc2_core_params *params = hsotg->core_params;
u32 rxfsiz, nptxfsiz, hptxfsiz, dfifocfg;
u32 nptxfsiz, hptxfsiz, dfifocfg;

if (!params->enable_dynamic_fifo)
return;
Expand Down Expand Up @@ -555,11 +555,10 @@ static void dwc2_config_fifos(struct dwc2_hsotg *hsotg)
* include RxFIFO, NPTXFIFO and HPTXFIFO
*/
dfifocfg = readl(hsotg->regs + GDFIFOCFG);
rxfsiz = readl(hsotg->regs + GRXFSIZ) & 0x0000ffff;
nptxfsiz = readl(hsotg->regs + GNPTXFSIZ) >> 16 & 0xffff;
hptxfsiz = readl(hsotg->regs + HPTXFSIZ) >> 16 & 0xffff;
dfifocfg &= ~GDFIFOCFG_EPINFOBASE_MASK;
dfifocfg |= (rxfsiz + nptxfsiz + hptxfsiz) <<
dfifocfg |= (params->host_rx_fifo_size +
params->host_nperio_tx_fifo_size +
params->host_perio_tx_fifo_size) <<
GDFIFOCFG_EPINFOBASE_SHIFT &
GDFIFOCFG_EPINFOBASE_MASK;
writel(dfifocfg, hsotg->regs + GDFIFOCFG);
Expand Down

0 comments on commit 08b9f9d

Please sign in to comment.