[RAMEN9610-20413][9610] wlbt: SCSC Driver version 10.6.1.0
[GitHub/MotorolaMobilityLLC/kernel-slsi.git] / drivers / misc / samsung / scsc / mifintrbit.h
1 /****************************************************************************
2 *
3 * Copyright (c) 2014 - 2016 Samsung Electronics Co., Ltd. All rights reserved
4 *
5 ****************************************************************************/
6
7 #ifndef __MIFINTRBIT_H
8 #define __MIFINTRBIT_H
9
10 #include <linux/spinlock.h>
11
12 /** MIF Interrupt Bit Handler prototype. */
13 typedef void (*mifintrbit_handler)(int which_bit, void *data);
14
15 struct mifintrbit; /* fwd - opaque pointer */
16
17 #define MIFINTRBIT_NUM_INT 16
18
19 /** Reserve MIF interrupt bits 0 in the to-r4 and to-m4 registers for purpose of forcing panics */
20 #define MIFINTRBIT_RESERVED_PANIC_R4 0
21 #ifdef CONFIG_SCSC_MX450_GDB_SUPPORT
22 #define MIFINTRBIT_RESERVED_PANIC_M4 0
23 #define MIFINTRBIT_RESERVED_PANIC_M4_1 0
24 #else
25 #define MIFINTRBIT_RESERVED_PANIC_M4 0
26 #endif
27
28 void mifintrbit_init(struct mifintrbit *intr, struct scsc_mif_abs *mif);
29 void mifintrbit_deinit(struct mifintrbit *intr);
30
31 /** Allocates TOHOST MIF interrupt bits, and associates handler for the AP bit.
32 * Returns the bit index.*/
33 int mifintrbit_alloc_tohost(struct mifintrbit *intr, mifintrbit_handler handler, void *data);
34 /** Deallocates TOHOST MIF interrupt bits */
35 int mifintrbit_free_tohost(struct mifintrbit *intr, int which_bit);
36 /* Get an interrupt bit associated with the target (R4/M4) -FROMHOST direction
37 * Function returns the IRQ bit associated , -EIO if error */
38 int mifintrbit_alloc_fromhost(struct mifintrbit *intr, enum scsc_mif_abs_target target);
39 /* Free an interrupt bit associated with the target (R4/M4) -FROMHOST direction
40 * Function returns the 0 if succedes , -EIO if error */
41 int mifintrbit_free_fromhost(struct mifintrbit *intr, int which_bit, enum scsc_mif_abs_target target);
42
43
44 struct mifintrbit {
45 void(*mifintrbit_irq_handler[MIFINTRBIT_NUM_INT]) (int irq, void *data);
46 void *irq_data[MIFINTRBIT_NUM_INT];
47 struct scsc_mif_abs *mif;
48 /* Use spinlock is it may be in IRQ context */
49 spinlock_t spinlock;
50 /* Interrupt allocation bitmaps */
51 DECLARE_BITMAP(bitmap_tohost, MIFINTRBIT_NUM_INT);
52 DECLARE_BITMAP(bitmap_fromhost_r4, MIFINTRBIT_NUM_INT);
53 DECLARE_BITMAP(bitmap_fromhost_m4, MIFINTRBIT_NUM_INT);
54 #ifdef CONFIG_SCSC_MX450_GDB_SUPPORT
55 DECLARE_BITMAP(bitmap_fromhost_m4_1, MIFINTRBIT_NUM_INT);
56 #endif
57 };
58
59
60 #endif