From 18ea8e01b08c0f2ad5bcbc608a66ecc2bbedd370 Mon Sep 17 00:00:00 2001
From: Oussama Ghorbel <ghorbel@gmail.com>
Date: Mon, 28 Nov 2016 16:20:59 +0100
Subject: [PATCH 2/2] usb: dwc_otg: enable fiq stat

This patch relies on the following patch: 'arm: add stat support to
fiq'

Signed-off-by: Oussama Ghorbel <ghorbel@gmail.com>
---
 drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c   | 5 +++++
 drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c | 7 +++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

Index: linux-5.10.52-rt47/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c
===================================================================
--- linux-5.10.52-rt47.orig/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c
+++ linux-5.10.52-rt47/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c
@@ -51,6 +51,7 @@
  */
 
 #include "dwc_otg_fiq_fsm.h"
+#include <asm/fiq.h>
 
 
 char buffer[1000*16];
@@ -1235,6 +1236,7 @@ static int notrace noinline fiq_fsm_do_h
 	return handled;
 }
 
+extern struct fiq_handler dwc_usb_fh;
 
 /**
  * dwc_otg_fiq_fsm() - Flying State Machine (monster) FIQ
@@ -1264,6 +1266,9 @@ void notrace dwc_otg_fiq_fsm(struct fiq_
 	/* Ensure peripheral reads issued prior to FIQ entry are complete */
 	dsb(sy);
 
+	if (dwc_usb_fh.fiq_kstat)
+		fiq_kstat_this_cpu_inc(&dwc_usb_fh);
+
 	gintsts_handled.d32 = 0;
 	haint_handled.d32 = 0;
 
Index: linux-5.10.52-rt47/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
===================================================================
--- linux-5.10.52-rt47.orig/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
+++ linux-5.10.52-rt47/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
@@ -433,7 +433,7 @@ irqreturn_t fiq_irq_handler(int irq, voi
 }
 
 #else
-static struct fiq_handler fh = {
+struct fiq_handler dwc_usb_fh = {
   .name = "usb_fiq",
 };
 
@@ -450,7 +450,10 @@ static void hcd_init_fiq(void *cookie)
 	struct pt_regs regs;
 	int irq;
 
-	if (claim_fiq(&fh)) {
+	if (fiq_kstat_enable(&dwc_usb_fh))
+		DWC_ERROR("Can't enable fiq kstat");
+
+	if (claim_fiq(&dwc_usb_fh)) {
 		DWC_ERROR("Can't claim FIQ");
 		BUG();
 	}