1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * PRU-ICSS sub-system specific definitions
4 *
5 * Copyright (C) 2014-2019 Texas Instruments Incorporated - http://www.ti.com/
6 * Suman Anna <s-anna@ti.com>
7 */
9 #ifndef _PRUSS_DRIVER_H_
10 #define _PRUSS_DRIVER_H_
12 #include <linux/pruss.h>
14 /* maximum number of system events */
15 #define MAX_PRU_SYS_EVENTS 64
17 /* maximum number of interrupt channels */
18 #define MAX_PRU_CHANNELS 10
20 /* minimum starting host interrupt number for MPU */
21 #define MIN_PRU_HOST_INT 2
23 /* maximum number of host interrupts */
24 #define MAX_PRU_HOST_INT 10
26 /**
27 * struct pruss_intc_config - INTC configuration info
28 * @sysev_to_ch: system events to channel mapping information
29 * @ch_to_host: interrupt channel to host interrupt information
30 */
31 struct pruss_intc_config {
32 s8 sysev_to_ch[MAX_PRU_SYS_EVENTS];
33 s8 ch_to_host[MAX_PRU_CHANNELS];
34 };
36 /**
37 * struct pruss - PRUSS parent structure
38 * @dev: pruss device pointer
39 * @cfg: regmap for config region
40 * @iep: regmap for IEP sub-module
41 * @mii_rt: regmap for MII_RT sub-module
42 * @mem_regions: data for each of the PRUSS memory regions
43 * @mem_in_use: to indicate if memory resource is in use
44 * @lock: mutex to serialize access to resources
45 */
46 struct pruss {
47 struct device *dev;
48 struct regmap *cfg;
49 struct regmap *iep;
50 struct regmap *mii_rt;
51 struct pruss_mem_region mem_regions[PRUSS_MEM_MAX];
52 struct pruss_mem_region *mem_in_use[PRUSS_MEM_MAX];
53 struct mutex lock; /* PRU resource lock */
54 };
56 int pruss_intc_configure(struct pruss *pruss,
57 struct pruss_intc_config *intc_config);
58 int pruss_intc_unconfigure(struct pruss *pruss,
59 struct pruss_intc_config *intc_config);
61 #endif /* _PRUSS_DRIVER_H_ */