Re: Problem with SPI on S3C2412

José Miguel Gonçalves <[email protected]>
Newsgroups gmane.linux.ports.arm.general
Message-ID <[email protected]>
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:

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?

Regards,
José Gonçalves

José Miguel Gonçalves wrote:
> Hi,
>
> I am trying to setup Linux 2.6.27 on an embedded board with a S3C2412 
> SoC.
> After setting some architecture specific configuration on 
> /arch/arm/mach-s3c2412/, I have finally booted my board with success.
> Now I am trying to access a temperature sensor that is connected to 
> the SPI bus.
> For this I am thinking to use the spidev userspace API. I have 
> compiled spidev and spi_s3c24xx as modules. I'm able to load spidev 
> but, when I modprobe spi_s3c24xx, I'm getting the following error:
>
> modprobe: failed to load module spi_s3c24xx: No such device
>
> Any idea of what could be the problem?
>
> Regards,
> José Miguel Gonçalves
>

_______________________________________________
linux-arm mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm
linux-2.6.27.38-sx560.patch (text/x-patch, 5.1 KB)
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.
 
 config MACH_VSTMS
 	bool "VMSTMS"
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 <[email protected]>
+ *
+ * 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>
+#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 = {
+};
+
+static struct s3c2410_uartcfg sx560_uartcfgs[] __initdata = {
+	[0] = {
+		.hwport	     = 0,
+		.flags	     = 0,
+		.ucon	     = 0x3c5,
+		.ulcon	     = 0x03,
+		.ufcon	     = 0x51,
+	},
+	[1] = {
+		.hwport	     = 1,
+		.flags	     = 0,
+		.ucon	     = 0x3c5,
+		.ulcon	     = 0x03,
+		.ufcon	     = 0x51,
+	},
+	[2] = {
+		.hwport	     = 2,
+		.flags	     = 0,
+		.ucon	     = 0x3c5,
+		.ulcon	     = 0x03,
+		.ufcon	     = 0x51,
+	}
+};
+
+static struct platform_device *sx560_devices[] __initdata = {
+	&s3c_device_usb,
+	&s3c_device_wdt,
+	&s3c_device_rtc,
+	&s3c_device_i2c,
+	&s3c_device_spi0,
+	&s3c_device_usbgadget,
+	&s3c_device_sdi,
+};
+
+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;
+	}
+}
+
+static void __init sx560_map_io(void)
+{
+	s3c24xx_init_io(sx560_iodesc, ARRAY_SIZE(sx560_iodesc));
+	s3c24xx_init_clocks(0);
+	s3c24xx_init_uarts(sx560_uartcfgs, ARRAY_SIZE(sx560_uartcfgs));
+}
+
+static void __init sx560_machine_init(void)
+{	
+	/* Configure temperature sensor chip enable pin
+	 * as output and disable the sensor */
+	s3c2410_gpio_setpin(S3C2410_GPF3, 0);
+	s3c2410_gpio_cfgpin(S3C2410_GPF3, S3C2410_GPIO_OUTPUT);
+
+	/* Configure SPI0 usage on pins GPE11, 12 and 13 */
+	s3c2410_gpio_cfgpin(S3C2410_GPE13, S3C2410_GPE13_SPICLK0);
+	s3c2410_gpio_cfgpin(S3C2410_GPE12, S3C2410_GPE12_SPIMOSI0);
+	s3c2410_gpio_cfgpin(S3C2410_GPE11, S3C2410_GPE11_SPIMISO0);
+	s3c2410_gpio_pullup(S3C2410_GPE11, 0);
+	s3c2410_gpio_pullup(S3C2410_GPE13, 0);
+
+	/* Turn off suspend for the selectable USB port and
+	 * switch it to USB host mode. Turn on suspend for the
+	 * host port since it is not connected on the SX-560. */
+	s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
+			      S3C2410_MISCCR_USBSUSPND0 |
+			      S3C2410_MISCCR_USBSUSPND1,
+			      S3C2410_MISCCR_USBHOST |
+			      S3C2410_MISCCR_USBSUSPND0);
+
+	platform_add_devices(sx560_devices, ARRAY_SIZE(sx560_devices));
+}
+
+MACHINE_START(SMDK2412, "SMDK2412")
+	/* Maintainer: Jose Goncalves <[email protected]> */
+	.phys_io	= S3C2410_PA_UART,
+	.io_pg_offst	= (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
+	.boot_params	= S3C2410_SDRAM_PA + 0x100,
+
+	.fixup		= sx560_fixup,
+	.init_irq	= s3c24xx_init_irq,
+	.map_io		= sx560_map_io,
+	.init_machine	= sx560_machine_init,
+	.timer		= &s3c24xx_timer,
+MACHINE_END
diff -Naur linux-2.6.27.38.original/arch/arm/mach-s3c2412/Makefile linux-2.6.27.38/arch/arm/mach-s3c2412/Makefile
--- linux-2.6.27.38.original/arch/arm/mach-s3c2412/Makefile	2009-10-22 08:22:46.000000000 +0100
+++ linux-2.6.27.38/arch/arm/mach-s3c2412/Makefile	2009-11-04 09:15:46.000000000 +0000
@@ -21,3 +21,4 @@
 obj-$(CONFIG_MACH_JIVE)		+= mach-jive.o
 obj-$(CONFIG_MACH_SMDK2413)	+= mach-smdk2413.o
 obj-$(CONFIG_MACH_VSTMS)	+= mach-vstms.o
+obj-$(CONFIG_MACH_SMDK2412)	+= mach-sx560.o
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.