[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [microblaze-uclinux] spi and spidev usage



Thank you for the hints. 
I can access the devices now using the example in the
kernel-spi-documentation with ioctl(fd, SPI_IOC_MESSAGE(1), &tr).
In the beginning I got confused with the xspi-character-device-driver
(Major 123) available in the kernel configuration. 
Now I'm using only the xilinx_spi.c from the Xilinx repository and
spidev.c (both with modifications to the related Kconfig and Makefile
and with headers).
The linux.../arch/microblaze/common/xspi.c is now modified to initialize
the xilinx_spi-driver. The board-configuration for the SPI-slaves is in
setup.c in my platform directory.
The device-files are added manually in
vendor/Petalogix/common/common.mak.
I took most of the things from the I2C-driver in the Petalinux-trunk. 

(John) > I've not used spidev ...
Do you suggest to write drivers for my devices and do the bus access in
these drivers?

(Hans) > I send you 2 programs ...
You directly access the SPI-bus which is nice for testing. I didn't
search anymore deeper but how do you expose the bus devices to the
userland? Is this already available in the drivers?

Happy to have things running,
Carsten

-----Mensaje original-----
Hello,

I use the SPI subsystem to control a touchscreen and the intensity of a
LCD display. I send you 2 programs I have written to test the
functionality of the peripherals. Hope you can figure out who the SPI
device driver has to be used.

Regards,
   Hans

John Williams <jwilliams@xxxxxxxxxxxxxx> wrote:
> Hi Carsten,
> 
> On Wed, Jan 21, 2009 at 5:23 AM, Bartsch Carsten <cbartsch@xxxxxxxxxx>
wrote:
> 
> > I'm trying to use SPI. I added a 2nd SPI core to my FPGA.
> > The software-part is based on petalinux-mmu-v0.10.
> >
> > The drivers spi and spidev can be build, the kernel says xilinx_spi 
> > 0: at 0x83400000 mapped to 0xC8100000, irq=0 xilinx_spi 1: at 
> > 0x83500000 mapped to 0xC8120000, irq=1 and in the list of 
> > /proc/devices there are character devices
> > 123 xilinx_spi and 153 spidev.
> >
> > Can I test to access these devices already?
> >
> > The spidev documentation says to configure the SPI-slaves in the 
> > board initialization code using spi_register_board_info or defining 
> > tables of devices static struct spi_board_info spi_board_info[] 
> > __initdata = {...
> >
> > Where can I do this?
> 
> I've not used spidev however typically we place these platform 
> initialisers in arch/microblaze/platform/common - there is xspi.c in 
> there, however it sets up platform_device info for the xps_spi 
> controller itself.  You may have a liitle more work to do using 
> spidev.
> 
> > The documentation told me to use udev or mdev to populate /dev 
> > dynamically.
> > mdev is not available in the busybox config (maybe to old) and udev 
> > cannot be build. I don't need dynamic configuration.
> >
> > Can I add the devices in the makefile of my platform instead?
> 
> Yes, edit vendors/<myvendor>/<myplatform>/Makefile
> 
> under the romfs:: target you can do something like [tab]touch 
> $(ROMFSDIR)/@devname,c,maj,min
> 
> where
>  *  [tab] is a proper tab character
>  * devname is the device node name
>  * c is for char, b for clock device
>  * maj is major number
>  * min is minor number
> 
> alternatively, you can add it to vendors/PetaLogix/common/common.mak,
> look for "DEVICES =" string
> 
> Regards,
> 
> John
> ___________________________
> microblaze-uclinux mailing list
> microblaze-uclinux@xxxxxxxxxxxxxx
> Project Home Page : 
> http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
> Mailing List Archive : 
> http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/

-- 
Dr. Johann Pfefferl   ------------   mailto j.pfefferl at eubus dot net
Eubus GmbH          http://www.eubus.net ++++ http://www.ebmhydraxc.com
Gollierstr. 70
D-80339 Muenchen
Phone: +49 (0)89 45 22 578-67     Fax: +49 (0)89 45 22 578-55
Registergericht Muenchen HRB 145 336, Ust-Id Nr. DE 225 783 933
Geschaeftsfuehrer: Volker Ulrich
==
 -o)   A computer program does what you tell it to do,
 /\\        not what you want it to do.               
_\_v-                                                 

___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/