diff options
author | George Cherian <george.cherian@ti.com> | 2013-06-12 05:23:46 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-06-12 16:57:13 -0400 |
commit | ff7307b534258c8864c356d15c52a84d0a5fbb35 (patch) | |
tree | 999253ddfa2d02226c76f9153191244740c16ab9 | |
parent | 1e2a064c7fa19ec6a9bfbe11cdc9bec34c7834a1 (diff) |
usb: dwc3: omap: initialize the register offset values for omap5 and AM437x
This patch Initializes the register offset values depending
on the X_MAJOR of USBOTGSS_REVISION register. Also adds register
offset defines and new debug register defines.
X_MAJOR is 2 for both OMAP5 and AM437x. But both have different
glue register layout. Differentiate AM437x using dt compatible.
Register offsets are cached in dwc3_omap struct for reg reads
and writes.
Signed-off-by: George Cherian <george.cherian@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r-- | drivers/usb/dwc3/dwc3-omap.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index f67ff4c4eaca..54dd6fe886e2 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c | |||
@@ -61,21 +61,38 @@ | |||
61 | #define USBOTGSS_REVISION 0x0000 | 61 | #define USBOTGSS_REVISION 0x0000 |
62 | #define USBOTGSS_SYSCONFIG 0x0010 | 62 | #define USBOTGSS_SYSCONFIG 0x0010 |
63 | #define USBOTGSS_IRQ_EOI 0x0020 | 63 | #define USBOTGSS_IRQ_EOI 0x0020 |
64 | #define USBOTGSS_EOI_OFFSET 0x0008 | ||
64 | #define USBOTGSS_IRQSTATUS_RAW_0 0x0024 | 65 | #define USBOTGSS_IRQSTATUS_RAW_0 0x0024 |
65 | #define USBOTGSS_IRQSTATUS_0 0x0028 | 66 | #define USBOTGSS_IRQSTATUS_0 0x0028 |
66 | #define USBOTGSS_IRQENABLE_SET_0 0x002c | 67 | #define USBOTGSS_IRQENABLE_SET_0 0x002c |
67 | #define USBOTGSS_IRQENABLE_CLR_0 0x0030 | 68 | #define USBOTGSS_IRQENABLE_CLR_0 0x0030 |
69 | #define USBOTGSS_IRQ0_OFFSET 0x0004 | ||
68 | #define USBOTGSS_IRQSTATUS_RAW_1 0x0034 | 70 | #define USBOTGSS_IRQSTATUS_RAW_1 0x0034 |
69 | #define USBOTGSS_IRQSTATUS_1 0x0038 | 71 | #define USBOTGSS_IRQSTATUS_1 0x0038 |
70 | #define USBOTGSS_IRQENABLE_SET_1 0x003c | 72 | #define USBOTGSS_IRQENABLE_SET_1 0x003c |
71 | #define USBOTGSS_IRQENABLE_CLR_1 0x0040 | 73 | #define USBOTGSS_IRQENABLE_CLR_1 0x0040 |
74 | #define USBOTGSS_IRQSTATUS_EOI_MISC 0x0030 | ||
75 | #define USBOTGSS_IRQSTATUS_RAW_MISC 0x0034 | ||
76 | #define USBOTGSS_IRQSTATUS_MISC 0x0038 | ||
77 | #define USBOTGSS_IRQENABLE_SET_MISC 0x003c | ||
78 | #define USBOTGSS_IRQENABLE_CLR_MISC 0x0040 | ||
79 | #define USBOTGSS_IRQMISC_OFFSET 0x03fc | ||
72 | #define USBOTGSS_UTMI_OTG_CTRL 0x0080 | 80 | #define USBOTGSS_UTMI_OTG_CTRL 0x0080 |
73 | #define USBOTGSS_UTMI_OTG_STATUS 0x0084 | 81 | #define USBOTGSS_UTMI_OTG_STATUS 0x0084 |
82 | #define USBOTGSS_UTMI_OTG_OFFSET 0x0480 | ||
83 | #define USBOTGSS_TXFIFO_DEPTH 0x0508 | ||
84 | #define USBOTGSS_RXFIFO_DEPTH 0x050c | ||
74 | #define USBOTGSS_MMRAM_OFFSET 0x0100 | 85 | #define USBOTGSS_MMRAM_OFFSET 0x0100 |
75 | #define USBOTGSS_FLADJ 0x0104 | 86 | #define USBOTGSS_FLADJ 0x0104 |
76 | #define USBOTGSS_DEBUG_CFG 0x0108 | 87 | #define USBOTGSS_DEBUG_CFG 0x0108 |
77 | #define USBOTGSS_DEBUG_DATA 0x010c | 88 | #define USBOTGSS_DEBUG_DATA 0x010c |
89 | #define USBOTGSS_DEV_EBC_EN 0x0110 | ||
90 | #define USBOTGSS_DEBUG_OFFSET 0x0600 | ||
78 | 91 | ||
92 | /* REVISION REGISTER */ | ||
93 | #define USBOTGSS_REVISION_XMAJOR(reg) ((reg >> 8) & 0x7) | ||
94 | #define USBOTGSS_REVISION_XMAJOR1 1 | ||
95 | #define USBOTGSS_REVISION_XMAJOR2 2 | ||
79 | /* SYSCONFIG REGISTER */ | 96 | /* SYSCONFIG REGISTER */ |
80 | #define USBOTGSS_SYSCONFIG_DMADISABLE (1 << 16) | 97 | #define USBOTGSS_SYSCONFIG_DMADISABLE (1 << 16) |
81 | 98 | ||
@@ -300,6 +317,7 @@ static int dwc3_omap_probe(struct platform_device *pdev) | |||
300 | int irq; | 317 | int irq; |
301 | 318 | ||
302 | int utmi_mode = 0; | 319 | int utmi_mode = 0; |
320 | int x_major; | ||
303 | 321 | ||
304 | u32 reg; | 322 | u32 reg; |
305 | 323 | ||
@@ -356,6 +374,42 @@ static int dwc3_omap_probe(struct platform_device *pdev) | |||
356 | goto err0; | 374 | goto err0; |
357 | } | 375 | } |
358 | 376 | ||
377 | reg = dwc3_omap_readl(omap->base, USBOTGSS_REVISION); | ||
378 | omap->revision = reg; | ||
379 | x_major = USBOTGSS_REVISION_XMAJOR(reg); | ||
380 | |||
381 | /* Differentiate between OMAP5,AM437x and others*/ | ||
382 | switch (x_major) { | ||
383 | case USBOTGSS_REVISION_XMAJOR1: | ||
384 | case USBOTGSS_REVISION_XMAJOR2: | ||
385 | omap->irq_eoi_offset = 0; | ||
386 | omap->irq0_offset = 0; | ||
387 | omap->irqmisc_offset = 0; | ||
388 | omap->utmi_otg_offset = 0; | ||
389 | omap->debug_offset = 0; | ||
390 | break; | ||
391 | default: | ||
392 | /* Default to the latest revision */ | ||
393 | omap->irq_eoi_offset = USBOTGSS_EOI_OFFSET; | ||
394 | omap->irq0_offset = USBOTGSS_IRQ0_OFFSET; | ||
395 | omap->irqmisc_offset = USBOTGSS_IRQMISC_OFFSET; | ||
396 | omap->utmi_otg_offset = USBOTGSS_UTMI_OTG_OFFSET; | ||
397 | omap->debug_offset = USBOTGSS_DEBUG_OFFSET; | ||
398 | break; | ||
399 | } | ||
400 | |||
401 | /* For OMAP5(ES2.0) and AM437x x_major is 2 even though there are | ||
402 | * changes in wrapper registers, Using dt compatible for aegis | ||
403 | */ | ||
404 | |||
405 | if (of_device_is_compatible(node, "ti,am437x-dwc3")) { | ||
406 | omap->irq_eoi_offset = USBOTGSS_EOI_OFFSET; | ||
407 | omap->irq0_offset = USBOTGSS_IRQ0_OFFSET; | ||
408 | omap->irqmisc_offset = USBOTGSS_IRQMISC_OFFSET; | ||
409 | omap->utmi_otg_offset = USBOTGSS_UTMI_OTG_OFFSET; | ||
410 | omap->debug_offset = USBOTGSS_DEBUG_OFFSET; | ||
411 | } | ||
412 | |||
359 | reg = dwc3_omap_readl(omap->base, USBOTGSS_UTMI_OTG_STATUS); | 413 | reg = dwc3_omap_readl(omap->base, USBOTGSS_UTMI_OTG_STATUS); |
360 | 414 | ||
361 | of_property_read_u32(node, "utmi-mode", &utmi_mode); | 415 | of_property_read_u32(node, "utmi-mode", &utmi_mode); |
@@ -423,6 +477,9 @@ static const struct of_device_id of_dwc3_match[] = { | |||
423 | { | 477 | { |
424 | .compatible = "ti,dwc3" | 478 | .compatible = "ti,dwc3" |
425 | }, | 479 | }, |
480 | { | ||
481 | .compatible = "ti,am437x-dwc3" | ||
482 | }, | ||
426 | { }, | 483 | { }, |
427 | }; | 484 | }; |
428 | MODULE_DEVICE_TABLE(of, of_dwc3_match); | 485 | MODULE_DEVICE_TABLE(of, of_dwc3_match); |