Problem with SPI on S3C2412

Ben Dooks ben-linux at fluff.org
Wed Nov 4 10:57:54 EST 2009


On Wed, Nov 04, 2009 at 03:24:37PM +0000, José Miguel Gonçalves wrote:
> Ben,
>
> I attach the current patch that I use for my machine. The machine is a  
> SX-560 module from Silex (  
> http://www.silexeurope.com/en/home/products/embedded-modules/sx-560.html 
> ).
>
> Meanwhile I think I've spotted the (first) problem. In  
> arch/arm/mach-s3c2412/s3c2412.c the SPI device is renamed "s3c2412-spi"  
> (it was set in arch/arm/plat-s3c24xx/devs.c with "s3c2410-spi") but the  
> spi_s3c24xx driver expects a platform driver named "s3c2410-spi", so it  
> fails to initialize. Commenting the driving renaming I get a little bit  
> further:

Hmm, I think I was looking at adding some basic support for the s3c2412's
FIFO facility to the SPI driver and forgot to actually finish and submit
it. I'll look into fixing the spi driver in my latest updates.

> s3c2410-spi s3c2410-spi.0: No platform data supplied
> s3c2410-spi: probe of s3c2410-spi.0 failed with error -2
> modprobe: failed to load module spi_s3c24xx: No such device
>
> Now it seems I need some architecture dependent initialization, correct?

Yes, you need to give it some platform data to control behaviour.

> Regards,
> José Gonçalves
>

Some notes:

> diff -Naur linux-2.6.27.38.original/arch/arm/mach-s3c2412/Kconfig linux-2.6.27.38/arch/arm/mach-s3c2412/Kconfig
> --- linux-2.6.27.38.original/arch/arm/mach-s3c2412/Kconfig	2009-10-22 08:22:46.000000000 +0100
> +++ linux-2.6.27.38/arch/arm/mach-s3c2412/Kconfig	2009-11-04 09:15:46.000000000 +0000
> @@ -60,13 +60,10 @@
>  	  selected
>  
>  config MACH_SMDK2412
> -	bool "SMDK2412"
> -	select MACH_SMDK2413
> +	bool "SX560"
> +	select CPU_S3C2412
>  	help
> -	  Say Y here if you are using an SMDK2412
> -
> -	  Note, this shares support with SMDK2413, so will automatically
> -	  select MACH_SMDK2413.
> +	  Say Y here if you are using a Silex SX-560 embedded WLAN module.

would have been better to cop ythe SMDK2412 entry, especially if you want
to get this merged into mainline at somepoint.

> diff -Naur linux-2.6.27.38.original/arch/arm/mach-s3c2412/mach-sx560.c linux-2.6.27.38/arch/arm/mach-s3c2412/mach-sx560.c
> --- linux-2.6.27.38.original/arch/arm/mach-s3c2412/mach-sx560.c	1970-01-01 01:00:00.000000000 +0100
> +++ linux-2.6.27.38/arch/arm/mach-s3c2412/mach-sx560.c	2009-11-04 10:03:27.000000000 +0000
> @@ -0,0 +1,135 @@
> +/* linux/arch/arm/mach-s3c2412/mach-sx560.c
> + *
> + * Copyright (c) 2009 INOV - INESC Inovacao
> + *	Jose Goncalves <jose.goncalves at inov.pt>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> +*/
> +
> +#include <linux/kernel.h>
> +#include <linux/types.h>
> +#include <linux/interrupt.h>
> +#include <linux/list.h>
> +#include <linux/timer.h>
> +#include <linux/init.h>
> +#include <linux/serial_core.h>
> +#include <linux/platform_device.h>
> +
> +#include <asm/mach/arch.h>
> +#include <asm/mach/map.h>
> +#include <asm/mach/irq.h>
> +
> +#include <mach/hardware.h>
> +#include <asm/hardware/iomd.h>
> +#include <asm/setup.h>
> +#include <asm/io.h>
> +#include <asm/irq.h>
> +#include <asm/mach-types.h>
> +
> +#include <asm/plat-s3c/regs-serial.h>
> +#include <mach/regs-gpio.h>
> +
> +#include <mach/idle.h>
> +
> +#include <asm/plat-s3c24xx/s3c2410.h>
> +#include <asm/plat-s3c24xx/s3c2412.h>

don't think you need those includes.

> +#include <asm/plat-s3c24xx/clock.h>
> +#include <asm/plat-s3c24xx/devs.h>
> +#include <asm/plat-s3c24xx/cpu.h>
> +
> +static struct map_desc sx560_iodesc[] __initdata = {
> +};

you should be able to remove this and pass NULL, 0 to the init call.

> +static void __init sx560_fixup(struct machine_desc *desc,
> +				  struct tag *tags, char **cmdline,
> +				  struct meminfo *mi)
> +{
> +	if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) {
> +		mi->nr_banks=1;
> +		mi->bank[0].start = 0x30000000;
> +		mi->bank[0].size = SZ_16M;
> +		mi->bank[0].node = 0;
> +	}
> +}

is the bootloader really that broken?

> +static void __init sx560_map_io(void)
> +{
> +	s3c24xx_init_io(sx560_iodesc, ARRAY_SIZE(sx560_iodesc));

you should be able to do:
    s3c24xx_init_io(NULL, 0);

> +MACHINE_START(SMDK2412, "SMDK2412")

FFS, why can't people learn to allocate machine numbers???

-- 
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.




More information about the linux-arm mailing list