diff options
-rw-r--r-- | drivers/usb/chipidea/bits.h | 4 | ||||
-rw-r--r-- | drivers/usb/chipidea/ci.h | 1 | ||||
-rw-r--r-- | drivers/usb/chipidea/core.c | 35 | ||||
-rw-r--r-- | include/linux/usb/chipidea.h | 4 |
4 files changed, 44 insertions, 0 deletions
diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h index 462ad02167b8..e462f55c8b99 100644 --- a/drivers/usb/chipidea/bits.h +++ b/drivers/usb/chipidea/bits.h | |||
@@ -61,6 +61,10 @@ | |||
61 | /* Set non-zero value for internal TT Hub address representation */ | 61 | /* Set non-zero value for internal TT Hub address representation */ |
62 | #define TTCTRL_TTHA (0x7fUL << 24) | 62 | #define TTCTRL_TTHA (0x7fUL << 24) |
63 | 63 | ||
64 | /* BURSTSIZE */ | ||
65 | #define RX_BURST_MASK 0xff | ||
66 | #define TX_BURST_MASK 0xff00 | ||
67 | |||
64 | /* PORTSC */ | 68 | /* PORTSC */ |
65 | #define PORTSC_CCS BIT(0) | 69 | #define PORTSC_CCS BIT(0) |
66 | #define PORTSC_CSC BIT(1) | 70 | #define PORTSC_CSC BIT(1) |
diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h index 1320a4dbbcd5..62f2a7be0697 100644 --- a/drivers/usb/chipidea/ci.h +++ b/drivers/usb/chipidea/ci.h | |||
@@ -51,6 +51,7 @@ enum ci_hw_regs { | |||
51 | OP_DEVICEADDR, | 51 | OP_DEVICEADDR, |
52 | OP_ENDPTLISTADDR, | 52 | OP_ENDPTLISTADDR, |
53 | OP_TTCTRL, | 53 | OP_TTCTRL, |
54 | OP_BURSTSIZE, | ||
54 | OP_PORTSC, | 55 | OP_PORTSC, |
55 | OP_DEVLC, | 56 | OP_DEVLC, |
56 | OP_OTGSC, | 57 | OP_OTGSC, |
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index ce0489754fde..50cd23b3b7f1 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c | |||
@@ -86,6 +86,7 @@ static const u8 ci_regs_nolpm[] = { | |||
86 | [OP_DEVICEADDR] = 0x14U, | 86 | [OP_DEVICEADDR] = 0x14U, |
87 | [OP_ENDPTLISTADDR] = 0x18U, | 87 | [OP_ENDPTLISTADDR] = 0x18U, |
88 | [OP_TTCTRL] = 0x1CU, | 88 | [OP_TTCTRL] = 0x1CU, |
89 | [OP_BURSTSIZE] = 0x20U, | ||
89 | [OP_PORTSC] = 0x44U, | 90 | [OP_PORTSC] = 0x44U, |
90 | [OP_DEVLC] = 0x84U, | 91 | [OP_DEVLC] = 0x84U, |
91 | [OP_OTGSC] = 0x64U, | 92 | [OP_OTGSC] = 0x64U, |
@@ -109,6 +110,7 @@ static const u8 ci_regs_lpm[] = { | |||
109 | [OP_DEVICEADDR] = 0x14U, | 110 | [OP_DEVICEADDR] = 0x14U, |
110 | [OP_ENDPTLISTADDR] = 0x18U, | 111 | [OP_ENDPTLISTADDR] = 0x18U, |
111 | [OP_TTCTRL] = 0x1CU, | 112 | [OP_TTCTRL] = 0x1CU, |
113 | [OP_BURSTSIZE] = 0x20U, | ||
112 | [OP_PORTSC] = 0x44U, | 114 | [OP_PORTSC] = 0x44U, |
113 | [OP_DEVLC] = 0x84U, | 115 | [OP_DEVLC] = 0x84U, |
114 | [OP_OTGSC] = 0xC4U, | 116 | [OP_OTGSC] = 0xC4U, |
@@ -441,6 +443,17 @@ void ci_platform_configure(struct ci_hdrc *ci) | |||
441 | if (ci->platdata->flags & CI_HDRC_OVERRIDE_AHB_BURST) | 443 | if (ci->platdata->flags & CI_HDRC_OVERRIDE_AHB_BURST) |
442 | hw_write_id_reg(ci, ID_SBUSCFG, AHBBRST_MASK, | 444 | hw_write_id_reg(ci, ID_SBUSCFG, AHBBRST_MASK, |
443 | ci->platdata->ahb_burst_config); | 445 | ci->platdata->ahb_burst_config); |
446 | |||
447 | /* override burst size, take effect only when ahb_burst_config is 0 */ | ||
448 | if (!hw_read_id_reg(ci, ID_SBUSCFG, AHBBRST_MASK)) { | ||
449 | if (ci->platdata->flags & CI_HDRC_OVERRIDE_TX_BURST) | ||
450 | hw_write(ci, OP_BURSTSIZE, TX_BURST_MASK, | ||
451 | ci->platdata->tx_burst_size << __ffs(TX_BURST_MASK)); | ||
452 | |||
453 | if (ci->platdata->flags & CI_HDRC_OVERRIDE_RX_BURST) | ||
454 | hw_write(ci, OP_BURSTSIZE, RX_BURST_MASK, | ||
455 | ci->platdata->rx_burst_size); | ||
456 | } | ||
444 | } | 457 | } |
445 | 458 | ||
446 | /** | 459 | /** |
@@ -647,6 +660,28 @@ static int ci_get_platdata(struct device *dev, | |||
647 | platdata->flags |= CI_HDRC_OVERRIDE_AHB_BURST; | 660 | platdata->flags |= CI_HDRC_OVERRIDE_AHB_BURST; |
648 | } | 661 | } |
649 | 662 | ||
663 | if (of_find_property(dev->of_node, "tx-burst-size-dword", NULL)) { | ||
664 | ret = of_property_read_u32(dev->of_node, "tx-burst-size-dword", | ||
665 | &platdata->tx_burst_size); | ||
666 | if (ret) { | ||
667 | dev_err(dev, | ||
668 | "failed to get tx-burst-size-dword\n"); | ||
669 | return ret; | ||
670 | } | ||
671 | platdata->flags |= CI_HDRC_OVERRIDE_TX_BURST; | ||
672 | } | ||
673 | |||
674 | if (of_find_property(dev->of_node, "rx-burst-size-dword", NULL)) { | ||
675 | ret = of_property_read_u32(dev->of_node, "rx-burst-size-dword", | ||
676 | &platdata->rx_burst_size); | ||
677 | if (ret) { | ||
678 | dev_err(dev, | ||
679 | "failed to get rx-burst-size-dword\n"); | ||
680 | return ret; | ||
681 | } | ||
682 | platdata->flags |= CI_HDRC_OVERRIDE_RX_BURST; | ||
683 | } | ||
684 | |||
650 | return 0; | 685 | return 0; |
651 | } | 686 | } |
652 | 687 | ||
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h index cd7fcad49017..575eaf0ebac1 100644 --- a/include/linux/usb/chipidea.h +++ b/include/linux/usb/chipidea.h | |||
@@ -34,6 +34,8 @@ struct ci_hdrc_platform_data { | |||
34 | #define CI_HDRC_TURN_VBUS_EARLY_ON BIT(7) | 34 | #define CI_HDRC_TURN_VBUS_EARLY_ON BIT(7) |
35 | #define CI_HDRC_SET_NON_ZERO_TTHA BIT(8) | 35 | #define CI_HDRC_SET_NON_ZERO_TTHA BIT(8) |
36 | #define CI_HDRC_OVERRIDE_AHB_BURST BIT(9) | 36 | #define CI_HDRC_OVERRIDE_AHB_BURST BIT(9) |
37 | #define CI_HDRC_OVERRIDE_TX_BURST BIT(10) | ||
38 | #define CI_HDRC_OVERRIDE_RX_BURST BIT(11) | ||
37 | enum usb_dr_mode dr_mode; | 39 | enum usb_dr_mode dr_mode; |
38 | #define CI_HDRC_CONTROLLER_RESET_EVENT 0 | 40 | #define CI_HDRC_CONTROLLER_RESET_EVENT 0 |
39 | #define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 | 41 | #define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 |
@@ -43,6 +45,8 @@ struct ci_hdrc_platform_data { | |||
43 | /* interrupt threshold setting */ | 45 | /* interrupt threshold setting */ |
44 | u32 itc_setting; | 46 | u32 itc_setting; |
45 | u32 ahb_burst_config; | 47 | u32 ahb_burst_config; |
48 | u32 tx_burst_size; | ||
49 | u32 rx_burst_size; | ||
46 | }; | 50 | }; |
47 | 51 | ||
48 | /* Default offset of capability registers */ | 52 | /* Default offset of capability registers */ |