Commit edc16d8d authored by Aaro Koskinen's avatar Aaro Koskinen Committed by Greg Kroah-Hartman

stating: octeon-usb: cvmx_usb_initialize(): eliminate extra indentation

Eliminate extra indentation by putting all the code into the same block.
Also delete a bogus comment.
Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6ad9c95b
...@@ -705,9 +705,15 @@ static int cvmx_usb_shutdown(struct cvmx_usb_state *usb) ...@@ -705,9 +705,15 @@ static int cvmx_usb_shutdown(struct cvmx_usb_state *usb)
static int cvmx_usb_initialize(struct device *dev, static int cvmx_usb_initialize(struct device *dev,
struct cvmx_usb_state *usb) struct cvmx_usb_state *usb)
{ {
int channel;
int divisor;
int retries = 0; int retries = 0;
union cvmx_usbcx_hcfg usbcx_hcfg;
union cvmx_usbnx_clk_ctl usbn_clk_ctl; union cvmx_usbnx_clk_ctl usbn_clk_ctl;
union cvmx_usbcx_gintsts usbc_gintsts; union cvmx_usbcx_gintsts usbc_gintsts;
union cvmx_usbcx_gahbcfg usbcx_gahbcfg;
union cvmx_usbcx_gintmsk usbcx_gintmsk;
union cvmx_usbcx_gusbcfg usbcx_gusbcfg;
union cvmx_usbnx_usbp_ctl_status usbn_usbp_ctl_status; union cvmx_usbnx_usbp_ctl_status usbn_usbp_ctl_status;
retry: retry:
...@@ -775,15 +781,14 @@ static int cvmx_usb_initialize(struct device *dev, ...@@ -775,15 +781,14 @@ static int cvmx_usb_initialize(struct device *dev,
* setting USBN0/1_CLK_CTL[ENABLE] = 1. Divide the core clock down * setting USBN0/1_CLK_CTL[ENABLE] = 1. Divide the core clock down
* such that USB is as close as possible to 125Mhz * such that USB is as close as possible to 125Mhz
*/ */
{ divisor = DIV_ROUND_UP(octeon_get_clock_rate(), 125000000);
int divisor = DIV_ROUND_UP(octeon_get_clock_rate(), 125000000);
/* Lower than 4 doesn't seem to work properly */ /* Lower than 4 doesn't seem to work properly */
if (divisor < 4) if (divisor < 4)
divisor = 4; divisor = 4;
usbn_clk_ctl.s.divide = divisor; usbn_clk_ctl.s.divide = divisor;
usbn_clk_ctl.s.divide2 = 0; usbn_clk_ctl.s.divide2 = 0;
}
cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64); cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
/* 2d. Write USBN0/1_CLK_CTL[HCLK_RST] = 1 */ /* 2d. Write USBN0/1_CLK_CTL[HCLK_RST] = 1 */
usbn_clk_ctl.s.hclk_rst = 1; usbn_clk_ctl.s.hclk_rst = 1;
cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64); cvmx_write64_uint64(CVMX_USBNX_CLK_CTL(usb->index), usbn_clk_ctl.u64);
...@@ -862,8 +867,6 @@ static int cvmx_usb_initialize(struct device *dev, ...@@ -862,8 +867,6 @@ static int cvmx_usb_initialize(struct device *dev,
* USBC_GAHBCFG[PTXFEMPLVL] * USBC_GAHBCFG[PTXFEMPLVL]
* Global interrupt mask, USBC_GAHBCFG[GLBLINTRMSK] = 1 * Global interrupt mask, USBC_GAHBCFG[GLBLINTRMSK] = 1
*/ */
{
union cvmx_usbcx_gahbcfg usbcx_gahbcfg;
usbcx_gahbcfg.u32 = 0; usbcx_gahbcfg.u32 = 0;
usbcx_gahbcfg.s.dmaen = !(usb->init_flags & usbcx_gahbcfg.s.dmaen = !(usb->init_flags &
CVMX_USB_INITIALIZE_FLAGS_NO_DMA); CVMX_USB_INITIALIZE_FLAGS_NO_DMA);
...@@ -873,7 +876,7 @@ static int cvmx_usb_initialize(struct device *dev, ...@@ -873,7 +876,7 @@ static int cvmx_usb_initialize(struct device *dev,
usbcx_gahbcfg.s.glblintrmsk = 1; usbcx_gahbcfg.s.glblintrmsk = 1;
cvmx_usb_write_csr32(usb, CVMX_USBCX_GAHBCFG(usb->index), cvmx_usb_write_csr32(usb, CVMX_USBCX_GAHBCFG(usb->index),
usbcx_gahbcfg.u32); usbcx_gahbcfg.u32);
}
/* /*
* 3. Program the following fields in USBC_GUSBCFG register. * 3. Program the following fields in USBC_GUSBCFG register.
* HS/FS timeout calibration, USBC_GUSBCFG[TOUTCAL] = 0 * HS/FS timeout calibration, USBC_GUSBCFG[TOUTCAL] = 0
...@@ -881,9 +884,6 @@ static int cvmx_usb_initialize(struct device *dev, ...@@ -881,9 +884,6 @@ static int cvmx_usb_initialize(struct device *dev,
* USB turnaround time, USBC_GUSBCFG[USBTRDTIM] = 0x5 * USB turnaround time, USBC_GUSBCFG[USBTRDTIM] = 0x5
* PHY low-power clock select, USBC_GUSBCFG[PHYLPWRCLKSEL] = 0 * PHY low-power clock select, USBC_GUSBCFG[PHYLPWRCLKSEL] = 0
*/ */
{
union cvmx_usbcx_gusbcfg usbcx_gusbcfg;
usbcx_gusbcfg.u32 = cvmx_usb_read_csr32(usb, usbcx_gusbcfg.u32 = cvmx_usb_read_csr32(usb,
CVMX_USBCX_GUSBCFG(usb->index)); CVMX_USBCX_GUSBCFG(usb->index));
usbcx_gusbcfg.s.toutcal = 0; usbcx_gusbcfg.s.toutcal = 0;
...@@ -892,17 +892,13 @@ static int cvmx_usb_initialize(struct device *dev, ...@@ -892,17 +892,13 @@ static int cvmx_usb_initialize(struct device *dev,
usbcx_gusbcfg.s.phylpwrclksel = 0; usbcx_gusbcfg.s.phylpwrclksel = 0;
cvmx_usb_write_csr32(usb, CVMX_USBCX_GUSBCFG(usb->index), cvmx_usb_write_csr32(usb, CVMX_USBCX_GUSBCFG(usb->index),
usbcx_gusbcfg.u32); usbcx_gusbcfg.u32);
}
/* /*
* 4. The software must unmask the following bits in the USBC_GINTMSK * 4. The software must unmask the following bits in the USBC_GINTMSK
* register. * register.
* OTG interrupt mask, USBC_GINTMSK[OTGINTMSK] = 1 * OTG interrupt mask, USBC_GINTMSK[OTGINTMSK] = 1
* Mode mismatch interrupt mask, USBC_GINTMSK[MODEMISMSK] = 1 * Mode mismatch interrupt mask, USBC_GINTMSK[MODEMISMSK] = 1
*/ */
{
union cvmx_usbcx_gintmsk usbcx_gintmsk;
int channel;
usbcx_gintmsk.u32 = cvmx_usb_read_csr32(usb, usbcx_gintmsk.u32 = cvmx_usb_read_csr32(usb,
CVMX_USBCX_GINTMSK(usb->index)); CVMX_USBCX_GINTMSK(usb->index));
usbcx_gintmsk.s.otgintmsk = 1; usbcx_gintmsk.s.otgintmsk = 1;
...@@ -916,15 +912,13 @@ static int cvmx_usb_initialize(struct device *dev, ...@@ -916,15 +912,13 @@ static int cvmx_usb_initialize(struct device *dev,
usbcx_gintmsk.u32); usbcx_gintmsk.u32);
/* /*
* Disable all channel interrupts. We'll enable them per channel * Disable all channel interrupts. We'll enable them per channel later.
* later.
*/ */
for (channel = 0; channel < 8; channel++) for (channel = 0; channel < 8; channel++)
cvmx_usb_write_csr32(usb, cvmx_usb_write_csr32(usb,
CVMX_USBCX_HCINTMSKX(channel, usb->index), 0); CVMX_USBCX_HCINTMSKX(channel, usb->index),
} 0);
{
/* /*
* Host Port Initialization * Host Port Initialization
* *
...@@ -935,25 +929,15 @@ static int cvmx_usb_initialize(struct device *dev, ...@@ -935,25 +929,15 @@ static int cvmx_usb_initialize(struct device *dev,
union cvmx_usbcx_gintmsk, prtintmsk, 1); union cvmx_usbcx_gintmsk, prtintmsk, 1);
USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index),
union cvmx_usbcx_gintmsk, disconnintmsk, 1); union cvmx_usbcx_gintmsk, disconnintmsk, 1);
/* /*
* 2. Program the USBC_HCFG register to select full-speed host * 2. Program the USBC_HCFG register to select full-speed host
* or high-speed host. * or high-speed host.
*/ */
{ usbcx_hcfg.u32 = cvmx_usb_read_csr32(usb, CVMX_USBCX_HCFG(usb->index));
union cvmx_usbcx_hcfg usbcx_hcfg;
usbcx_hcfg.u32 = cvmx_usb_read_csr32(usb,
CVMX_USBCX_HCFG(usb->index));
usbcx_hcfg.s.fslssupp = 0; usbcx_hcfg.s.fslssupp = 0;
usbcx_hcfg.s.fslspclksel = 0; usbcx_hcfg.s.fslspclksel = 0;
cvmx_usb_write_csr32(usb, CVMX_USBCX_HCFG(usb->index), cvmx_usb_write_csr32(usb, CVMX_USBCX_HCFG(usb->index), usbcx_hcfg.u32);
usbcx_hcfg.u32);
}
/*
* Steps 4-15 from the manual are done later in the port enable
*/
}
cvmx_fifo_setup(usb); cvmx_fifo_setup(usb);
......
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