|
17 | 17 |
|
18 | 18 | #include <asm/octeon/octeon.h>
|
19 | 19 |
|
| 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 | + |
20 | 33 | /* USB Control Register */
|
21 | 34 | union cvm_usbdrd_uctl_ctl {
|
22 | 35 | uint64_t u64;
|
@@ -227,7 +240,6 @@ static uint8_t clk_div[OCTEON_H_CLKDIV_SEL] = {1, 2, 4, 6, 8, 16, 24, 32};
|
227 | 240 |
|
228 | 241 | static int dwc3_octeon_config_power(struct device *dev, u64 base)
|
229 | 242 | {
|
230 |
| -#define UCTL_HOST_CFG 0xe0 |
231 | 243 | union cvm_usbdrd_uctl_host_cfg uctl_host_cfg;
|
232 | 244 | union cvmx_gpio_bit_cfgx gpio_bit;
|
233 | 245 | uint32_t gpio_pwr[3];
|
@@ -268,16 +280,16 @@ static int dwc3_octeon_config_power(struct device *dev, u64 base)
|
268 | 280 | }
|
269 | 281 |
|
270 | 282 | /* 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); |
272 | 284 | uctl_host_cfg.s.ppc_en = 1;
|
273 | 285 | 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); |
275 | 287 | } else {
|
276 | 288 | /* 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); |
278 | 290 | uctl_host_cfg.s.ppc_en = 0;
|
279 | 291 | 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); |
281 | 293 | dev_info(dev, "power control disabled\n");
|
282 | 294 | }
|
283 | 295 | return 0;
|
@@ -464,31 +476,26 @@ static int dwc3_octeon_clocks_start(struct device *dev, u64 base)
|
464 | 476 |
|
465 | 477 | static void __init dwc3_octeon_set_endian_mode(u64 base)
|
466 | 478 | {
|
467 |
| -#define UCTL_SHIM_CFG 0xe8 |
468 | 479 | union cvm_usbdrd_uctl_shim_cfg shim_cfg;
|
469 | 480 |
|
470 |
| - shim_cfg.u64 = cvmx_read_csr(base + UCTL_SHIM_CFG); |
| 481 | + shim_cfg.u64 = cvmx_read_csr(base + USBDRD_UCTL_SHIM_CFG); |
471 | 482 | #ifdef __BIG_ENDIAN
|
472 | 483 | shim_cfg.s.dma_endian_mode = 1;
|
473 | 484 | shim_cfg.s.csr_endian_mode = 1;
|
474 | 485 | #else
|
475 | 486 | shim_cfg.s.dma_endian_mode = 0;
|
476 | 487 | shim_cfg.s.csr_endian_mode = 0;
|
477 | 488 | #endif
|
478 |
| - cvmx_write_csr(base + UCTL_SHIM_CFG, shim_cfg.u64); |
| 489 | + cvmx_write_csr(base + USBDRD_UCTL_SHIM_CFG, shim_cfg.u64); |
479 | 490 | }
|
480 | 491 |
|
481 |
| -#define CVMX_USBDRDX_UCTL_CTL(index) \ |
482 |
| - (CVMX_ADD_IO_SEG(0x0001180068000000ull) + \ |
483 |
| - ((index & 1) * 0x1000000ull)) |
484 | 492 | static void __init dwc3_octeon_phy_reset(u64 base)
|
485 | 493 | {
|
486 | 494 | union cvm_usbdrd_uctl_ctl uctl_ctl;
|
487 |
| - int index = (base >> 24) & 1; |
488 | 495 |
|
489 |
| - uctl_ctl.u64 = cvmx_read_csr(CVMX_USBDRDX_UCTL_CTL(index)); |
| 496 | + uctl_ctl.u64 = cvmx_read_csr(base + USBDRD_UCTL_CTL); |
490 | 497 | 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); |
492 | 499 | }
|
493 | 500 |
|
494 | 501 | static int __init dwc3_octeon_device_init(void)
|
|
0 commit comments