spi on beagleboard

hi all,
is there any spi patch for linux-2.6.36.1??
how to make spidev_test.c work on BB-xm with linux-2.6.36 is running??

thanks in advance

See http://elinux.org/BeagleBoard/SPI#Patches . I just uploaded a patch
against 2.6.37 although it should also apply against .36.

Cheers,

- Ben

hi ben
i used the patch which u recommended
I also have
CONFIG_SPI_SPIDEV=y in my .config
but i was not able to find /dev/spidev after booting the kernel...

Hmm, there are many things that could be wrong. Are you sure you enabled
the McSPI driver in your configuration? Could you attach your
configuration and the output of dmesg?

Cheers,

- Ben

I just put up the configuration I use on the BeagleBoard/SPI
article[1]. Perhaps give it a try. I honestly haven't tested this with
2.6.37 yet, but I've checked it over and I believe it should work.

- Ben

[1] http://elinux.org/BeagleBoard/SPI/Config-2.6.37

Hello,

I am working on applying the SPI patch as per
http://elinux.org/BeagleBoard/SPI#Patches

How exactly does one go about doing this? I have created a file called SPIPATCH.patch, filled it with the contents of said patch, put it into the directory of the kernel recipe and added the filename SPIPATCH.patch to the recipe in the hopes than when bitbake comes to compile the kernel, the patch is included and SPI functionality is enabled. Sadly, this did not work.

The kernel .bb file is linux-omap-psp_2.6.32.bb

I have downloaded the latest version of bitbake 1.10.1 and the latest release of openembedded(Dec 2010)

Thanks in advance!

Sincerely,

David

PS. Perhaps in future releases of OE, SPI functionality could be included? Maybe, please?

Hello,

I am working on applying the SPI patch as per
BeagleBoard/SPI - eLinux.org

How exactly does one go about doing this? I have created a file called
SPIPATCH.patch, filled it with the contents of said patch, put it into
the directory of the kernel recipe and added the filename SPIPATCH.patch
to the recipe in the hopes than when bitbake comes to compile the
kernel, the patch is included and SPI functionality is enabled. Sadly,
this did not work.

What exactly do you mean by it didn't work? The problem is likely your
kernel configuration. You need to ensure that both spidev and your
platform's SPI driver is enabled in your kernel configuration.

- Ben

PS. Perhaps in future releases of OE, SPI functionality could be
included? Maybe, please?

It's not that simple. This is something that depends upon your
particular application. This is one of the difficulties of embedded
development; everyone's requirements are different.

I am currently trying to do the same thing (xM as well) and not having
much luck. If you dig a little deeper in the documentation, it tells
you how to specifically download and build your own kernel and apply
patches using quilt. I don't add the patch file in to the patches
directly, I just apply it directly to the file using patch (patch
<oirg file> <patch file>) and make sure that it succeeds.
Unfortunately, when I do this method and just replace the uImage, it
just hangs at the point after the kernel has been decompressed.

I am trying to build everything from scratch and trying a different
method to get it working (editing the MUX settings in kernel.h for u-
boot), but I can't even get a non modified u-boot to work properly on
my board. Quite frustrating.

Please let me know if you are able to get it working and how. I
really need this functionality asap.

Thanks,
Brian

Sounds as if your kernel is incorrectly configured. Generally getting a
kernel to at least boot shouldn't be too difficult.

- Ben

By the way, usually when debugging kernel builds I just compile the
kernel manually using the toolchain built with the meta-toolchain
recipe. After building this recipe you will find a tarball in
deploy/glibc/sdk/. Extract this tarball and source the environment.sh
therein. This will give you a full gcc toolchain for your target.

For some reason Kconfig doesn't like it when it runs under this
environment (i.e. fstat fails with -EINVAL[1]) so I've found it
necessary to run make *config before sourcing the arm environment (be
sure to pass ARCH=arm to make config). After configuring, compile with,

  $ make CROSS_COMPILE=arm-angstrom-linux-gnueabi- ARCH=arm

Cheers,

- Ben

[1] http://kerneltrap.org/mailarchive/linux-kernel/2010/7/29/4599522

Ben,
First off, I want to thank you for replying and helping out. I do
appreciate it.

I am able to build kernel the normal oe/bb way and get the bb to boot
up. My trouble comes from creating a custom kernel. I am following
pretty much line for line this process: http://elinux.org/BeagleBoardLinuxKernel

Currently, it gets close to booting up and just hangs:
OMAP3630/3730-GP ES2.0, CPU-OPP2, L3-165MHz,
OMAP3 Beagle board + LPDDR/NAND
I2C: ready
DRAM: 512 MB
NAND: 0 MiB
*** Warning - bad CRC or NAND, using default environment

In: serial
Out: serial
Err: serial

Probing for expansion boards, if none are connected you'll see a
harmless I2C e.

No EEPROM on expansion board
Beagle xM Rev A
Die ID #0cc600211ff00000015739eb0a017026
Hit any key to stop autoboot: 0
mmc1 is available
The user button is currently NOT pressed.
reading boot.scr

** Unable to read "boot.scr" from mmc 1:1 **
reading uImage

3013036 bytes read
Booting from mmc ...
## Booting kernel from Legacy Image at 80200000 ...
   Image Name: Linux-2.6.29-omap1
   Image Type: ARM Linux Kernel Image (uncompressed)
   Data Size: 3012972 Bytes = 2.9 MB
   Load Address: 80008000
   Entry Point: 80008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing
Linux.....................................................

If there is another process that I should be using or another source
where I should be getting the kernel, please let me know. I have been
banging against this for weeks now.

Thanks,
Brian

Could you attach your kernel configuration? This is generally caused by
a misconfiguration. In particular make sure that the machine type is set
properly, etc. Have you tried booting the validation image? I've never
tried bringing up an XM, but it shouldn't be too much different from the
standard BeagleBoard (correct me if I'm wrong).

- Ben

I use 'make menuconfig' to configure my kernel. I think it is easier to do. My custom built kernel works on the original BB and the BB -xm. However, I need to change the GPIO enable polarity for the SMSC USB chip for the -xm board.

This should be easily done. Looking at the code, it looks like one
should be able to change the chip select mode in spi_board_info with the
following,

diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 58bacb6..44643b7 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -526,7 +526,7 @@ static struct spi_board_info beagle_mcspi_board_info[] = {
                .max_speed_hz = 48000000, //48 Mbps
                .bus_num = 3,
                .chip_select = 0,
- .mode = SPI_MODE_1,
+ .mode = SPI_MODE_1 | SPI_CS_HIGH,
        },

Let me know if this works,

- Ben