Skip to content

Commit c7b6a1e

Browse files
3x380Vtsbogend
authored andcommitted
MIPS: OCTEON: octeon-usb: add all register offsets
Glue code uses a mix of offset and absolute address register definition. Define all of them as offsets and use them consistently. Signed-off-by: Ladislav Michl <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent 670f77f commit c7b6a1e

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

arch/mips/cavium-octeon/octeon-usb.c

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,19 @@
1717

1818
#include <asm/octeon/octeon.h>
1919

20+
#define USBDRD_UCTL_CTL 0x00
21+
#define USBDRD_UCTL_BIST_STATUS 0x08
22+
#define USBDRD_UCTL_SPARE0 0x10
23+
#define USBDRD_UCTL_INTSTAT 0x30
24+
#define USBDRD_UCTL_PORT_CFG_HS(port) (0x40 + (0x20 * port))
25+
#define USBDRD_UCTL_PORT_CFG_SS(port) (0x48 + (0x20 * port))
26+
#define USBDRD_UCTL_PORT_CR_DBG_CFG(port) (0x50 + (0x20 * port))
27+
#define USBDRD_UCTL_PORT_CR_DBG_STATUS(port) (0x58 + (0x20 * port))
28+
#define USBDRD_UCTL_HOST_CFG 0xe0
29+
#define USBDRD_UCTL_SHIM_CFG 0xe8
30+
#define USBDRD_UCTL_ECC 0xf0
31+
#define USBDRD_UCTL_SPARE1 0xf8
32+
2033
/* USB Control Register */
2134
union cvm_usbdrd_uctl_ctl {
2235
uint64_t u64;
@@ -227,7 +240,6 @@ static uint8_t clk_div[OCTEON_H_CLKDIV_SEL] = {1, 2, 4, 6, 8, 16, 24, 32};
227240

228241
static int dwc3_octeon_config_power(struct device *dev, u64 base)
229242
{
230-
#define UCTL_HOST_CFG 0xe0
231243
union cvm_usbdrd_uctl_host_cfg uctl_host_cfg;
232244
union cvmx_gpio_bit_cfgx gpio_bit;
233245
uint32_t gpio_pwr[3];
@@ -268,16 +280,16 @@ static int dwc3_octeon_config_power(struct device *dev, u64 base)
268280
}
269281

270282
/* Enable XHCI power control and set if active high or low. */
271-
uctl_host_cfg.u64 = cvmx_read_csr(base + UCTL_HOST_CFG);
283+
uctl_host_cfg.u64 = cvmx_read_csr(base + USBDRD_UCTL_HOST_CFG);
272284
uctl_host_cfg.s.ppc_en = 1;
273285
uctl_host_cfg.s.ppc_active_high_en = !power_active_low;
274-
cvmx_write_csr(base + UCTL_HOST_CFG, uctl_host_cfg.u64);
286+
cvmx_write_csr(base + USBDRD_UCTL_HOST_CFG, uctl_host_cfg.u64);
275287
} else {
276288
/* Disable XHCI power control and set if active high. */
277-
uctl_host_cfg.u64 = cvmx_read_csr(base + UCTL_HOST_CFG);
289+
uctl_host_cfg.u64 = cvmx_read_csr(base + USBDRD_UCTL_HOST_CFG);
278290
uctl_host_cfg.s.ppc_en = 0;
279291
uctl_host_cfg.s.ppc_active_high_en = 0;
280-
cvmx_write_csr(base + UCTL_HOST_CFG, uctl_host_cfg.u64);
292+
cvmx_write_csr(base + USBDRD_UCTL_HOST_CFG, uctl_host_cfg.u64);
281293
dev_info(dev, "power control disabled\n");
282294
}
283295
return 0;
@@ -464,31 +476,26 @@ static int dwc3_octeon_clocks_start(struct device *dev, u64 base)
464476

465477
static void __init dwc3_octeon_set_endian_mode(u64 base)
466478
{
467-
#define UCTL_SHIM_CFG 0xe8
468479
union cvm_usbdrd_uctl_shim_cfg shim_cfg;
469480

470-
shim_cfg.u64 = cvmx_read_csr(base + UCTL_SHIM_CFG);
481+
shim_cfg.u64 = cvmx_read_csr(base + USBDRD_UCTL_SHIM_CFG);
471482
#ifdef __BIG_ENDIAN
472483
shim_cfg.s.dma_endian_mode = 1;
473484
shim_cfg.s.csr_endian_mode = 1;
474485
#else
475486
shim_cfg.s.dma_endian_mode = 0;
476487
shim_cfg.s.csr_endian_mode = 0;
477488
#endif
478-
cvmx_write_csr(base + UCTL_SHIM_CFG, shim_cfg.u64);
489+
cvmx_write_csr(base + USBDRD_UCTL_SHIM_CFG, shim_cfg.u64);
479490
}
480491

481-
#define CVMX_USBDRDX_UCTL_CTL(index) \
482-
(CVMX_ADD_IO_SEG(0x0001180068000000ull) + \
483-
((index & 1) * 0x1000000ull))
484492
static void __init dwc3_octeon_phy_reset(u64 base)
485493
{
486494
union cvm_usbdrd_uctl_ctl uctl_ctl;
487-
int index = (base >> 24) & 1;
488495

489-
uctl_ctl.u64 = cvmx_read_csr(CVMX_USBDRDX_UCTL_CTL(index));
496+
uctl_ctl.u64 = cvmx_read_csr(base + USBDRD_UCTL_CTL);
490497
uctl_ctl.s.uphy_rst = 0;
491-
cvmx_write_csr(CVMX_USBDRDX_UCTL_CTL(index), uctl_ctl.u64);
498+
cvmx_write_csr(base + USBDRD_UCTL_CTL, uctl_ctl.u64);
492499
}
493500

494501
static int __init dwc3_octeon_device_init(void)

0 commit comments

Comments
 (0)