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-rpi-4.18.4-test/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c
===================================================================
@ linux-rpi-4.18.4-test/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c:54 @
  */
 
 #include "dwc_otg_fiq_fsm.h"
+#include <asm/fiq.h>
 
 
 char buffer[1000*16];
@ linux-rpi-4.18.4-test/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c:1237 @ 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
@ linux-rpi-4.18.4-test/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c:1264 @ void notrace dwc_otg_fiq_fsm(struct fiq_
 	haintmsk_data_t haintmsk;
 	int kick_irq = 0;
 
+	if (dwc_usb_fh.fiq_kstat)
+		fiq_kstat_this_cpu_inc(&dwc_usb_fh);
+
 	gintsts_handled.d32 = 0;
 	haint_handled.d32 = 0;
 
Index: linux-rpi-4.18.4-test/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
===================================================================
--- linux-rpi-4.18.4-test.orig/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
+++ linux-rpi-4.18.4-test/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
@ linux-rpi-4.18.4-test/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c:436 @ irqreturn_t fiq_irq_handler(int irq, voi
 }
 
 #else
-static struct fiq_handler fh = {
+struct fiq_handler dwc_usb_fh = {
   .name = "usb_fiq",
 };
 
@ linux-rpi-4.18.4-test/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c:453 @ 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();
 	}