Skip to content

Commit b43ebc9

Browse files
Grigor TovmasyanFelipe Balbi
authored andcommitted
usb: dwc2: Add Interpacket Gap(IPG) feature support
Added GHWCFG4_IPG_ISOC_SUPPORTED and DCFG_IPG_ISOC_SUPPORDED bits definitions to enable/disable IPG feature. Added ipg_isoc_en core parameter which will indicate IPG support enable/disable and initialize it. Signed-off-by: Grigor Tovmasyan <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
1 parent 37981e0 commit b43ebc9

File tree

5 files changed

+20
-0
lines changed

5 files changed

+20
-0
lines changed

drivers/usb/dwc2/core.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,9 @@ enum dwc2_ep0_state {
380380
* is FS.
381381
* 0 - No (default)
382382
* 1 - Yes
383+
* @ipg_isoc_en Indicates the IPG supports is enabled or disabled.
384+
* 0 - Disable (default)
385+
* 1 - Enable
383386
* @ulpi_fs_ls: Make ULPI phy operate in FS/LS mode only
384387
* 0 - No (default)
385388
* 1 - Yes
@@ -511,6 +514,7 @@ struct dwc2_core_params {
511514
bool hird_threshold_en;
512515
u8 hird_threshold;
513516
bool activate_stm_fs_transceiver;
517+
bool ipg_isoc_en;
514518
u16 max_packet_count;
515519
u32 max_transfer_size;
516520
u32 ahbcfg;
@@ -560,6 +564,12 @@ struct dwc2_core_params {
560564
* 0 - Slave only
561565
* 1 - External DMA
562566
* 2 - Internal DMA
567+
* @ipg_isoc_en This feature indicates that the controller supports
568+
* the worst-case scenario of Rx followed by Rx
569+
* Interpacket Gap (IPG) (32 bitTimes) as per the utmi
570+
* specification for any token following ISOC OUT token.
571+
* 0 - Don't support
572+
* 1 - Support
563573
* @power_optimized Are power optimizations enabled?
564574
* @num_dev_ep Number of device endpoints available
565575
* @num_dev_in_eps Number of device IN endpoints available
@@ -622,6 +632,7 @@ struct dwc2_hw_params {
622632
unsigned hibernation:1;
623633
unsigned utmi_phy_data_width:2;
624634
unsigned lpm_mode:1;
635+
unsigned ipg_isoc_en:1;
625636
u32 snpsid;
626637
u32 dev_ep_dirs;
627638
u32 g_tx_fifo_size[MAX_EPS_CHANNELS];

drivers/usb/dwc2/debugfs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,7 @@ static int params_show(struct seq_file *seq, void *v)
710710
print_param(seq, p, phy_ulpi_ddr);
711711
print_param(seq, p, phy_ulpi_ext_vbus);
712712
print_param(seq, p, i2c_enable);
713+
print_param(seq, p, ipg_isoc_en);
713714
print_param(seq, p, ulpi_fs_ls);
714715
print_param(seq, p, host_support_fs_ls_low_power);
715716
print_param(seq, p, host_ls_low_power_phy_clk);

drivers/usb/dwc2/gadget.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3236,6 +3236,9 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg,
32363236
dcfg |= DCFG_DEVSPD_HS;
32373237
}
32383238

3239+
if (hsotg->params.ipg_isoc_en)
3240+
dcfg |= DCFG_IPG_ISOC_SUPPORDED;
3241+
32393242
dwc2_writel(dcfg, hsotg->regs + DCFG);
32403243

32413244
/* Clear any pending OTG interrupts */

drivers/usb/dwc2/hw.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@
311311
#define GHWCFG4_UTMI_PHY_DATA_WIDTH_MASK (0x3 << 14)
312312
#define GHWCFG4_UTMI_PHY_DATA_WIDTH_SHIFT 14
313313
#define GHWCFG4_ACG_SUPPORTED BIT(12)
314+
#define GHWCFG4_IPG_ISOC_SUPPORTED BIT(11)
314315
#define GHWCFG4_UTMI_PHY_DATA_WIDTH_8 0
315316
#define GHWCFG4_UTMI_PHY_DATA_WIDTH_16 1
316317
#define GHWCFG4_UTMI_PHY_DATA_WIDTH_8_OR_16 2
@@ -424,6 +425,7 @@
424425
#define DCFG_EPMISCNT_SHIFT 18
425426
#define DCFG_EPMISCNT_LIMIT 0x1f
426427
#define DCFG_EPMISCNT(_x) ((_x) << 18)
428+
#define DCFG_IPG_ISOC_SUPPORDED BIT(17)
427429
#define DCFG_PERFRINT_MASK (0x3 << 11)
428430
#define DCFG_PERFRINT_SHIFT 11
429431
#define DCFG_PERFRINT_LIMIT 0x3

drivers/usb/dwc2/params.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ static void dwc2_set_default_params(struct dwc2_hsotg *hsotg)
298298
p->besl = true;
299299
p->hird_threshold_en = true;
300300
p->hird_threshold = 4;
301+
p->ipg_isoc_en = false;
301302
p->max_packet_count = hw->max_packet_count;
302303
p->max_transfer_size = hw->max_transfer_size;
303304
p->ahbcfg = GAHBCFG_HBSTLEN_INCR << GAHBCFG_HBSTLEN_SHIFT;
@@ -579,6 +580,7 @@ static void dwc2_check_params(struct dwc2_hsotg *hsotg)
579580
CHECK_BOOL(enable_dynamic_fifo, hw->enable_dynamic_fifo);
580581
CHECK_BOOL(en_multiple_tx_fifo, hw->en_multiple_tx_fifo);
581582
CHECK_BOOL(i2c_enable, hw->i2c_enable);
583+
CHECK_BOOL(ipg_isoc_en, hw->ipg_isoc_en);
582584
CHECK_BOOL(acg_enable, hw->acg_enable);
583585
CHECK_BOOL(reload_ctl, (hsotg->hw_params.snpsid > DWC2_CORE_REV_2_92a));
584586
CHECK_BOOL(lpm, (hsotg->hw_params.snpsid >= DWC2_CORE_REV_2_80a));
@@ -772,6 +774,7 @@ int dwc2_get_hwparams(struct dwc2_hsotg *hsotg)
772774
hw->utmi_phy_data_width = (hwcfg4 & GHWCFG4_UTMI_PHY_DATA_WIDTH_MASK) >>
773775
GHWCFG4_UTMI_PHY_DATA_WIDTH_SHIFT;
774776
hw->acg_enable = !!(hwcfg4 & GHWCFG4_ACG_SUPPORTED);
777+
hw->ipg_isoc_en = !!(hwcfg4 & GHWCFG4_IPG_ISOC_SUPPORTED);
775778

776779
/* fifo sizes */
777780
hw->rx_fifo_size = (grxfsiz & GRXFSIZ_DEPTH_MASK) >>

0 commit comments

Comments
 (0)