Random header image... Refresh for more!
Visitors

free invisible counter
Partner sites
http://consigliere.sk
--------------------------- led-svetla.sk
---------------------------
multi.xeres.cz

David Lewin ask me on theFriendly arm forum to check driver and setup for SPI on mini2440 board.

SPI master driver is prepared so just add some platform data and board info for sca3000 and it must work ;) .


If you would like to connect some SPI device on your mini2440 board you need to:

1. update mach-mini2440.c file in arch/arm/mach-s3c2440/ following:

Add s3c2410_spi_info structure with filled entries
(we use standars SPI pins for spi.0 on CON4):

static struct s3c2410_spi_info mini2440_spi0_pdata = {
         .pin_cs = S3C2410_GPG(2),
         .num_cs = 1,
         .bus_num = 0,
         .gpio_setup = &s3c24xx_spi_gpiocfg_bus0_gpe11_12_13,
};

2. add platform data for device:

static struct spi_board_info mini2440_spi_devs[] __initdata = {
         {       /* sca3000 accel */
                 .modalias       = "sca3000_d01",
                 .chip_select    = 0,
                 .max_speed_hz   = 1 * 1000 * 1000,
                 .bus_num        = 0,
         }
};

3. Add &s3c_device_spi0 line to array of structures mini2440_devices[].

4. In function mini2440_init add lines:

s3c_device_spi0.dev.platform_data = &mini2440_spi0_pdata;

spi_register_board_info(mini2440_spi_devs,
                                 ARRAY_SIZE(mini2440_spi_devs));

You have now prepared kernel code for working with SPI accelerometer.
Just enable all drivers you need (SPI, SCA3000, …) and recompile kernel.

If this is little bit hard to understand you can download a ::patch:: for it.

4 Responses to “Friendly arm 2440 and sca3000 accelerometer”

  • Joerg says:

    Hello!
    Silly question, but how do I use the patch?

  • Copy patch to kernel directory and use patch -p1 <path.patch (use name of patch here)

  • Joerg says:

    witch Kernel U use?

    joerg@joerg-werkstatt:~/mini2440/linux-2.6.32.2/arch$ patch -p1 <gpiopatch.patchpatching file arm/mach-s3c2410/include/mach/gpio.h
    patching file arm/mach-s3c2440/Kconfig
    Hunk #1 FAILED at 107.
    1 out of 1 hunk FAILED — saving rejects to file arm/mach-s3c2440/Kconfig.rej
    patching file arm/mach-s3c2440/mach-mini2440.c
    Hunk #1 succeeded at 42 with fuzz 2 (offset 13 lines).
    Hunk #2 FAILED at 49.
    Hunk #3 FAILED at 613.
    Hunk #4 FAILED at 620.
    Hunk #5 FAILED at 795.
    4 out of 5 hunks FAILED — saving rejects to file arm/mach-s3c2440/mach-mini2440.c.rej

  • Kernel is same as you have. Maybe there are some changes and thats the reason why you couldn’t apply patch. If you open patch file you can copy parts to your code manually and use.

Leave a Reply