linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* "RTOS unfriendly" in chipidea udc code
@ 2020-09-14  1:01 Jeaho Hwang
  2020-09-15  8:12 ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 2+ messages in thread
From: Jeaho Hwang @ 2020-09-14  1:01 UTC (permalink / raw)
  To: linux-rt-users

Hi RT experts.

We are reviewing device drivers of our product board and found qualmy
codes in chipidea usb device, 4.19.0 applied RT patch(still exists in
current)

The function hw_usb_reset, called by isr_reset_handler, is using
udelay to wait hw reset and commented "RTOS unfriendly". Can I be sure
RT-safe is it? Could you suggest any better alternative?

Thanks. Regards

drivers/usb/chipidea/udc.c:325
/**
 * hw_usb_reset: restart device after a bus reset (execute without
 *               interruption)
 * @ci: the controller
 *
 * This function returns an error code
 */
static int hw_usb_reset(struct ci_hdrc *ci)
{
hw_usb_set_address(ci, 0);

/* ESS flushes only at end?!? */
hw_write(ci, OP_ENDPTFLUSH,    ~0, ~0);

/* clear setup token semaphores */
hw_write(ci, OP_ENDPTSETUPSTAT, 0,  0);

/* clear complete status */
hw_write(ci, OP_ENDPTCOMPLETE,  0,  0);

/* wait until all bits cleared */
while (hw_read(ci, OP_ENDPTPRIME, ~0))
udelay(10);             /* not RTOS friendly */
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/* reset all endpoints ? */

/* reset internal status and wait for further instructions
  no need to verify the port reset status (ESS does it) */

return 0;
}

-- 
황재호, Jay Hwang, linux team manager of RTst
010-7242-1593

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: "RTOS unfriendly" in chipidea udc code
  2020-09-14  1:01 "RTOS unfriendly" in chipidea udc code Jeaho Hwang
@ 2020-09-15  8:12 ` Sebastian Andrzej Siewior
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Andrzej Siewior @ 2020-09-15  8:12 UTC (permalink / raw)
  To: Jeaho Hwang; +Cc: linux-rt-users

On 2020-09-14 10:01:46 [+0900], Jeaho Hwang wrote:
> The function hw_usb_reset, called by isr_reset_handler, is using
> udelay to wait hw reset and commented "RTOS unfriendly". Can I be sure
> RT-safe is it? Could you suggest any better alternative?

If I traced it right, that function is used as an interrupt handler
which should run threaded on PREEMPT_RT (it should be requested via
request_irq() or so). That means that the udelay() can be preempted by a
task with higher priority.

> Thanks. Regards

Sebastian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-15  8:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-14  1:01 "RTOS unfriendly" in chipidea udc code Jeaho Hwang
2020-09-15  8:12 ` Sebastian Andrzej Siewior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).