All of lore.kernel.org
 help / color / mirror / Atom feed
* Issue with driver-to-driver services
@ 2022-01-19 13:28 Olsen, Niels (INT)
  2022-01-24 17:28 ` Jan Kiszka
  0 siblings, 1 reply; 2+ messages in thread
From: Olsen, Niels (INT) @ 2022-01-19 13:28 UTC (permalink / raw)
  To: xenomai

We are having issues with a Xenomai driver module for a UART chip. The UART
chip is connected to our i.MX8MN SOC via ECSPI, and I have a Xenomai SPI
driver for i.MX ECSPI. The stock NXP 'spi-imx' driver is configured out of
the kernel.

The Xenomai SPI driver initializes successfully, and after boot there is a
slave device node available in

  /dev/rtdm/spi1/slave1.0

When I modprobe the UART driver, its module_init routine opens the SPI
device like this:

  fd = rtdm_open("/dev/rtdm/spi1/slave1.0", O_RDWR);

which succeeds.

But when the module init routine then tries to initialize the UART device
through SPI, the rtdm_ioctl()/rtdm_read()/rtdm_write() calls fail. I have
traced the cause to be that 'ipipe_root_p' is true. In cobalt/rtdm/fd.c,
the service routines for ioctl/read/write check 'ipipe_root_p', and when
true, calls the non-realtime driver ops.

So, it seems that when loading a realtime driver module with modprobe,
the init routine is not executing in realtime mode.

Is there something special we need to do in the module init routine, in
order to switch to realtime mode?

Environment:
 - i.MX8MN eval board
 - MAX14830 Quad UART eval board
 - NXP BSP 2.3.3, kernel 5.4.70
 - Xenomai 3.1.1

TIA,
Niels

Teledyne Confidential; Commercially Sensitive Business Data


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

* Re: Issue with driver-to-driver services
  2022-01-19 13:28 Issue with driver-to-driver services Olsen, Niels (INT)
@ 2022-01-24 17:28 ` Jan Kiszka
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kiszka @ 2022-01-24 17:28 UTC (permalink / raw)
  To: Olsen, Niels (INT), xenomai

On 19.01.22 14:28, Olsen, Niels (INT) via Xenomai wrote:
> We are having issues with a Xenomai driver module for a UART chip. The UART
> chip is connected to our i.MX8MN SOC via ECSPI, and I have a Xenomai SPI
> driver for i.MX ECSPI. The stock NXP 'spi-imx' driver is configured out of
> the kernel.
> 
> The Xenomai SPI driver initializes successfully, and after boot there is a
> slave device node available in
> 
>    /dev/rtdm/spi1/slave1.0
> 
> When I modprobe the UART driver, its module_init routine opens the SPI
> device like this:
> 
>    fd = rtdm_open("/dev/rtdm/spi1/slave1.0", O_RDWR);
> 
> which succeeds.
> 
> But when the module init routine then tries to initialize the UART device
> through SPI, the rtdm_ioctl()/rtdm_read()/rtdm_write() calls fail. I have
> traced the cause to be that 'ipipe_root_p' is true. In cobalt/rtdm/fd.c,
> the service routines for ioctl/read/write check 'ipipe_root_p', and when
> true, calls the non-realtime driver ops.
> 
> So, it seems that when loading a realtime driver module with modprobe,
> the init routine is not executing in realtime mode.
> 

This is correct - and required because most initialization stuff is 
provided by Linux and cannot be run in RT.

> Is there something special we need to do in the module init routine, in
> order to switch to realtime mode?

You need an in-kernel RT(DM) task in order to execute RT functions of 
the subordinate device. Or you need a service call from a userspace RT 
task and handle the call from there.

Jan

> 
> Environment:
>   - i.MX8MN eval board
>   - MAX14830 Quad UART eval board
>   - NXP BSP 2.3.3, kernel 5.4.70
>   - Xenomai 3.1.1
> 
> TIA,
> Niels
> 
> Teledyne Confidential; Commercially Sensitive Business Data
> 

-- 
Siemens AG, Technology
Competence Center Embedded Linux


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

end of thread, other threads:[~2022-01-24 17:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-19 13:28 Issue with driver-to-driver services Olsen, Niels (INT)
2022-01-24 17:28 ` Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.