Skip to contentSkip to conversation

Change MODE, CS, BUS, and SPEED using SPI-DEV driver?

DISCUSSION Charles Martel 2 participants 2 messages Oct 4, 2010 – Oct 5, 2010 1 message not in the archive SPI

lore
Share & tools
lore
#0 lore raw

----- Original Message -----
From: David Brownell
Sent: 10/01/10 08:02 PM
To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, Charles Martel
Subject: Re: Change MODE, CS, BUS, and SPEED using SPI-DEV driver?

--- On Fri, 10/1/10, Charles Martel <[email protected]> wrote: >> >> The question I have is how do I modify these settings? > Evidently you haven't yet looked at the > documentation. Try that. There's a sample > program which will be informative.

Thank you for your reply.

1) I have read numerous documents but don't see where they explain what I need considering that only the following SPI driver files are built:
built-in.o, hspi-s3c64xx.o, spi.o, and spi-dev.o.

I had built a kernel for the s3c6410 using linux-2.6.24. I noticed that there are drivers for the s3c24xx but only the "S3C6410 High Speed SPI Driver" is specific to the s3c6410. I do not believe that the the s3c24xx series drivers are compatible with the s3c6410. Am I wrong?
The problem I am having would go away if I could use the s3c24xx drivers since they result in the spidev.c file being built.

2) The following all return 0 (debug message: "Invalid ioctl option"):
ret = ioctl(fd, SPI_IOC_WR_MODE, &spiMode);
ret = ioctl(fd, SPI_IOC_WR_BITS_PER_WORD, &bitsPerWord);
ret = ioctl(fd, SPI_IOC_WR_MAX_SPEED_HZ, &spiSpeed);
These ioctl functions are supported by the spidev_ioctl function in spidev.c. However, as mentioned above, the "S3C6410 High Speed SPI Driver" does not build spidev.c.

The same result happens when I use the following ioctl call:
ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr);
where tr structure (spi_ioc_transfer) contains the following:
tr.tx_buf = txBuf;
tr.rx_buf = rxBuf;
tr.delay_usecs = delay;
tr.speed_hz = speed;
tr.bits_per_word = 8;
tr.pad = 0;
tr.cs_change = 0;

This is what I expect since spi-dev.c does not handle these ioctl requests. The spidev_ioctl function in spi-dev.c only handles the following:
SET_SPI_FLAGS, SET_SPI_RETRIES, and SET_SPI_TIMEOUT.

3) The following always succeeds:
ret = write(fd, txBuf, xLen);
------------------------------------------------------------------------------
Virtualization is moving to the mainstream and overtaking non-virtualized environment for deploying applications. Does it make network security easier or more difficult to achieve? Read this whitepaper to separate the two and get a better understanding.
http://p.sf.net/sfu/hp-phase2-d2d

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 1 line · Charles Martel

I had built a kernel for the s3c6410 using linux-2.6.24.

Could you plz upgrade to latest kernel ?
2.6.24 was released before I was born, so can't say much about it.

Quoted 4 lines

I noticed that there are drivers for the s3c24xx but only the "S3C6410 High Speed SPI Driver" is specific to the s3c6410. I do not believe that the the s3c24xx series drivers are compatible with the s3c6410. Am I wrong?

No.

Quoted 3 lines

The problem I am having would go away if I could use the s3c24xx drivers since they result in the spidev.c file being built.

SPIDEV is a test protocol driver. You should be able to select that while config

Summary:- Upgrade to latest possible kernel or backport S3C64xx driver from the latest kernel.

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb