[PATCH v2 14/17] usb: gadget: acm: Use plain udevice for UDC controller interaction
Marek Vasut
marex at denx.de
Fri Sep 1 11:50:00 CEST 2023
Convert to plain udevice interaction with UDC controller
device, avoid the use of UDC uclass dev_array .
Signed-off-by: Marek Vasut <marex at denx.de>
---
Cc: Angus Ainslie <angus at akkea.ca>
Cc: Dmitrii Merkurev <dimorinny at google.com>
Cc: Eddie Cai <eddie.cai.linux at gmail.com>
Cc: Kever Yang <kever.yang at rock-chips.com>
Cc: Lukasz Majewski <lukma at denx.de>
Cc: Miquel Raynal <miquel.raynal at bootlin.com>
Cc: Mattijs Korpershoek <mkorpershoek at baylibre.com>
Cc: Nishanth Menon <nm at ti.com>
Cc: Patrice Chotard <patrice.chotard at foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay at foss.st.com>
Cc: Philipp Tomsich <philipp.tomsich at vrull.eu>
Cc: Simon Glass <sjg at chromium.org>
Cc: Stefan Roese <sr at denx.de>
Cc: kernel at puri.sm
---
V2: No change
---
drivers/usb/gadget/f_acm.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/usb/gadget/f_acm.c b/drivers/usb/gadget/f_acm.c
index b2ddd1ada8b..de42e0189e8 100644
--- a/drivers/usb/gadget/f_acm.c
+++ b/drivers/usb/gadget/f_acm.c
@@ -51,7 +51,7 @@ struct f_acm {
#define ACM_CTRL_RTS BIT(1) /* unused with full duplex */
#define ACM_CTRL_DTR BIT(0) /* host is ready for data r/w */
- int controller_index;
+ struct udevice *udc;
};
static struct f_acm *default_acm_function;
@@ -489,7 +489,7 @@ static void __acm_tx(struct f_acm *f_acm)
int len, ret;
do {
- usb_gadget_handle_interrupts(f_acm->controller_index);
+ dm_usb_gadget_handle_interrupts(f_acm->udc);
if (!(f_acm->handshake_bits & ACM_CTRL_DTR))
break;
@@ -520,7 +520,7 @@ static bool acm_connected(struct stdio_dev *dev)
struct f_acm *f_acm = stdio_to_acm(dev);
/* give a chance to process udc irq */
- usb_gadget_handle_interrupts(f_acm->controller_index);
+ dm_usb_gadget_handle_interrupts(f_acm->udc);
return f_acm->connected;
}
@@ -543,7 +543,10 @@ static int acm_add(struct usb_configuration *c)
f_acm->usb_function.descriptors = acm_fs_function;
f_acm->usb_function.hs_descriptors = acm_hs_function;
f_acm->usb_function.setup = acm_setup;
- f_acm->controller_index = 0;
+
+ status = udc_device_get_by_index(0, &f_acm->udc);
+ if (status)
+ return status;
status = usb_add_function(c, &f_acm->usb_function);
if (status) {
@@ -567,7 +570,7 @@ static int acm_stdio_tstc(struct stdio_dev *dev)
{
struct f_acm *f_acm = stdio_to_acm(dev);
- usb_gadget_handle_interrupts(f_acm->controller_index);
+ dm_usb_gadget_handle_interrupts(f_acm->udc);
return (f_acm->rx_buf.size > 0);
}
--
2.40.1
More information about the U-Boot
mailing list