1# I3C configuration options
2#
3# Copyright (c) 2022 Intel Corporation
4#
5# SPDX-License-Identifier: Apache-2.0
6
7menuconfig I3C
8	bool "Improved Inter-Integrated Circuit (I3C) bus drivers"
9	help
10	  Enable I3C Driver Configuration
11
12if I3C
13
14module = I3C
15module-str = i3c
16source "subsys/logging/Kconfig.template.log_config"
17
18config I3C_SHELL
19	bool "I3C Shell"
20	depends on SHELL
21	help
22	  Enable I3C Shell.
23
24	  The I3C shell supports info, bus recovery, CCC, I3C read and
25	  write operations.
26
27config I3C_USE_GROUP_ADDR
28	bool "Use Group Addresses"
29	default y
30	help
31	  Enable this to use group addresses if supported
32	  by the controllers and target devices.
33
34	  Says Y if unsure.
35
36config I3C_TARGET_BUFFER_MODE
37	bool "I3C target driver for buffer mode"
38	help
39	  This is an option to enable buffer mode.
40
41menuconfig I3C_USE_IBI
42	bool "Use In-Band Interrupt (IBI)"
43	default y
44	help
45	  Enable this to use In-Band Interrupt (IBI).
46
47	  Says Y if unsure.
48
49if I3C_USE_IBI
50
51config I3C_IBI_MAX_PAYLOAD_SIZE
52	int "Maximum IBI Payload Size"
53	default 16
54	help
55	  Maxmium IBI payload size.
56
57menuconfig I3C_IBI_WORKQUEUE
58	bool "Use IBI Workqueue"
59	help
60	  Use global workqueue for processing IBI.
61
62	  This is enabled by driver if needed.
63
64if I3C_IBI_WORKQUEUE
65
66config I3C_IBI_WORKQUEUE_STACK_SIZE
67	int "IBI workqueue stack size"
68	default 1024
69	help
70	  Stack size for the IBI global workqueue.
71
72config I3C_IBI_WORKQUEUE_PRIORITY
73	int "IBI workqueue thread priority"
74	default -1
75	help
76	  Thread priority for the IBI global workqueue.
77
78config I3C_IBI_WORKQUEUE_LENGTH
79	int "IBI workqueue queue length"
80	default 8
81	help
82	  Define the maximum number of IBIs that can be
83	  queued in the workqueue.
84
85config I3C_IBI_WORKQUEUE_VERBOSE_DEBUG
86	bool "Verbose debug messages for IBI workqueue"
87	help
88	  This turns on verbose debug for the IBI workqueue
89	  when logging level is set to DEBUG, and prints
90	  the IBI payload.
91
92endif # I3C_IBI_WORKQUEUE
93
94endif # I3C_USE_IBI
95
96comment "Initialization Priority"
97
98config I3C_CONTROLLER_INIT_PRIORITY
99	int "I3C Controller Init Priority"
100	# Default is just after CONFIG_KERNEL_INIT_PRIORITY_DEVICE
101	default 50
102	help
103	  This is for setting up I3C controller device driver instance
104	  and also to perform bus initialization (e.g. dynamic address
105	  assignment).
106
107	  Note that this needs to be done before the device driver
108	  instances of the connected I2C and I3C devices start
109	  initializing those devices. This is because some devices
110	  may not be addressable until addresses are assigned by
111	  the controller.
112
113config I3C_INIT_RSTACT
114	bool "Perform Reset Action During Bus Initialization"
115	default y
116	help
117	  This determines whether the bus initialization routine
118	  sends a reset action command to I3C targets.
119
120config I3C_NUM_OF_DESC_MEM_SLABS
121	int "Number of I3C Device Descriptors Mem Slabs"
122	default 3
123	help
124	  This is the number of memory slabs allocated from when
125	  there is a device encounted through ENTDAA or DEFTGTS that
126	  is not within known I3C devices.
127
128config I3C_I2C_NUM_OF_DESC_MEM_SLABS
129	int "Number of I2C Device Descriptors Mem Slabs"
130	default 3
131	help
132	  This is the number of memory slabs allocated from when
133	  there is a device encounted through DEFTGTS that is not
134	  within known I2C devices.
135
136config I3C_RTIO
137	bool "I3C RTIO API"
138	select EXPERIMENTAL
139	select RTIO
140	select RTIO_WORKQ
141	help
142	  API and implementations of I3C for RTIO
143
144if I3C_RTIO
145config I3C_RTIO_SQ_SIZE
146	int "Submission queue size for blocking calls"
147	default 4
148	help
149	  Blocking i3c calls when I3C_RTIO is enabled are copied into a per driver
150	  submission queue. The queue depth determines the number of possible i3c_msg
151	  structs that may be in the array given to i3c_transfer. A sensible default
152	  is going to be 4 given the device address, register address, and a value
153	  to be read or written.
154
155config I3C_RTIO_CQ_SIZE
156	int "Completion queue size for blocking calls"
157	default 4
158	help
159	  Blocking i3c calls when I3C_RTIO is enabled are copied into a per driver
160	  submission queue. The queue depth determines the number of possible i3c_msg
161	  structs that may be in the array given to i3c_transfer. A sensible default
162	  is going to be 4 given the device address, register address, and a value
163	  to be read or written.
164
165config I3C_RTIO_FALLBACK_MSGS
166	int "Number of available i3c_msg structs for the default handler to use"
167	default 4
168	help
169		When RTIO is used with a driver that does not yet implement the submit API
170		natively the submissions are converted back to struct i3c_msg values that
171		are given to i3c_transfer. This requires some number of msgs be available to convert
172		the submissions into on the stack. MISRA rules dictate we must know this in
173		advance.
174
175		In all likelihood 4 is going to work for everyone, but in case you do end up with
176		an issue where you are using RTIO, your driver does not implement submit natively,
177
178endif # I3C_RTIO
179
180comment "Device Drivers"
181
182rsource "Kconfig.nxp"
183rsource "Kconfig.cdns"
184rsource "Kconfig.npcx"
185rsource "Kconfig.dw"
186rsource "Kconfig.test"
187rsource "Kconfig.stm32"
188
189endif # I3C
190