Quantcast
Channel: Processors forum - Recent Threads
Viewing all articles
Browse latest Browse all 17527

Linux/LINUXSDK-OMAPL138: SPI access from kernel space and user space

$
0
0

Part Number:LINUXSDK-OMAPL138

Tool/software: Linux

Hi

I want to access spi from user space and kernel spcae.

It works fine from user space using /dev/spidev0.2.

I want also in some cases to acces this spi bus from kernel.

I understand that I have to use methods of spi.c such spidev.c does with spi_async() or spi_sync().

But it requires to supply the : struct spi_device *spi    i.e. pointer to spi  device opened and registered at board_omapl130-hawk.c 

via da8xx_register_spi() which calls platform_device_register().

As I understand the device opened at init phase of the spidev_init() and spidev_probe() by linux launcher.

I see that spidev get it by user space ioctl call at via  struct file *filp at : spidev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)  by:

spidev = filp->private_data;
spin_lock_irq(&spidev->spi_lock);
spi = spi_dev_get(spidev->spi);

So, I need to know how to get this pointer ?

The sdk used is : ti-sdk-omapl138-lcdk-01.00.00

linux omap version is : 3.1.10-gf6fe6d8-dirty.

BR

Yehuda

 


Viewing all articles
Browse latest Browse all 17527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>