aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Anderson <dianders@chromium.org>2016-01-28 21:20:07 -0500
committerFelipe Balbi <balbi@kernel.org>2016-03-04 08:14:44 -0500
commit483bb2544c470aebdcc41199c0b145d05058a3bd (patch)
tree0d8ad5f44089cb0fb7e7a1abd1737906e49198f0
parent2d3f139810cd5d491d8dc8c3332c9d32b9b8e1f1 (diff)
usb: dwc2: host: Add scheduler logging for missed SOFs
We'll use the new "scheduler verbose debugging" macro to log missed SOFs. This is fast enough (assuming you configure it to use the ftrace buffer) that we can do it without worrying about the speed hit. The overhead hit if the scheduler tracing is set to "no_printk" should be near zero. Acked-by: John Youn <johnyoun@synopsys.com> Signed-off-by: Douglas Anderson <dianders@chromium.org> Tested-by: Heiko Stuebner <heiko@sntech.de> Tested-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Felipe Balbi <balbi@kernel.org>
-rw-r--r--drivers/usb/dwc2/core.h3
-rw-r--r--drivers/usb/dwc2/hcd.c2
-rw-r--r--drivers/usb/dwc2/hcd_intr.c12
3 files changed, 11 insertions, 6 deletions
diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index 18f9e4045643..64d45a2053bb 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -809,9 +809,10 @@ struct dwc2_hsotg {
809 bool bus_suspended; 809 bool bus_suspended;
810 bool new_connection; 810 bool new_connection;
811 811
812 u16 last_frame_num;
813
812#ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS 814#ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS
813#define FRAME_NUM_ARRAY_SIZE 1000 815#define FRAME_NUM_ARRAY_SIZE 1000
814 u16 last_frame_num;
815 u16 *frame_num_array; 816 u16 *frame_num_array;
816 u16 *last_frame_num_array; 817 u16 *last_frame_num_array;
817 int frame_num_idx; 818 int frame_num_idx;
diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index fd731347daf7..f48da015fa5e 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -3084,8 +3084,8 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq)
3084 FRAME_NUM_ARRAY_SIZE, GFP_KERNEL); 3084 FRAME_NUM_ARRAY_SIZE, GFP_KERNEL);
3085 if (!hsotg->last_frame_num_array) 3085 if (!hsotg->last_frame_num_array)
3086 goto error1; 3086 goto error1;
3087 hsotg->last_frame_num = HFNUM_MAX_FRNUM;
3088#endif 3087#endif
3088 hsotg->last_frame_num = HFNUM_MAX_FRNUM;
3089 3089
3090 /* Check if the bus driver or platform code has setup a dma_mask */ 3090 /* Check if the bus driver or platform code has setup a dma_mask */
3091 if (hsotg->core_params->dma_enable > 0 && 3091 if (hsotg->core_params->dma_enable > 0 &&
diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c
index 97aa6ca3a12e..5fc024f2092a 100644
--- a/drivers/usb/dwc2/hcd_intr.c
+++ b/drivers/usb/dwc2/hcd_intr.c
@@ -55,12 +55,16 @@
55/* This function is for debug only */ 55/* This function is for debug only */
56static void dwc2_track_missed_sofs(struct dwc2_hsotg *hsotg) 56static void dwc2_track_missed_sofs(struct dwc2_hsotg *hsotg)
57{ 57{
58#ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS
59 u16 curr_frame_number = hsotg->frame_number; 58 u16 curr_frame_number = hsotg->frame_number;
59 u16 expected = dwc2_frame_num_inc(hsotg->last_frame_num, 1);
60
61 if (expected != curr_frame_number)
62 dwc2_sch_vdbg(hsotg, "MISSED SOF %04x != %04x\n",
63 expected, curr_frame_number);
60 64
65#ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS
61 if (hsotg->frame_num_idx < FRAME_NUM_ARRAY_SIZE) { 66 if (hsotg->frame_num_idx < FRAME_NUM_ARRAY_SIZE) {
62 if (((hsotg->last_frame_num + 1) & HFNUM_MAX_FRNUM) != 67 if (expected != curr_frame_number) {
63 curr_frame_number) {
64 hsotg->frame_num_array[hsotg->frame_num_idx] = 68 hsotg->frame_num_array[hsotg->frame_num_idx] =
65 curr_frame_number; 69 curr_frame_number;
66 hsotg->last_frame_num_array[hsotg->frame_num_idx] = 70 hsotg->last_frame_num_array[hsotg->frame_num_idx] =
@@ -79,8 +83,8 @@ static void dwc2_track_missed_sofs(struct dwc2_hsotg *hsotg)
79 } 83 }
80 hsotg->dumped_frame_num_array = 1; 84 hsotg->dumped_frame_num_array = 1;
81 } 85 }
82 hsotg->last_frame_num = curr_frame_number;
83#endif 86#endif
87 hsotg->last_frame_num = curr_frame_number;
84} 88}
85 89
86static void dwc2_hc_handle_tt_clear(struct dwc2_hsotg *hsotg, 90static void dwc2_hc_handle_tt_clear(struct dwc2_hsotg *hsotg,