<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
José Miguel Gonçalves wrote:
<blockquote cite="mid4AF19CB5.5060706@inov.pt" type="cite">Ben,
<br>
<br>
I attach the current patch that I use for my machine. The machine is a
SX-560 module from Silex (
<a class="moz-txt-link-freetext" href="http://www.silexeurope.com/en/home/products/embedded-modules/sx-560.html">http://www.silexeurope.com/en/home/products/embedded-modules/sx-560.html</a>
).
<br>
<br>
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.</blockquote>
Do you mean a different name? Yes that's may be the cause of all that.!<br>
<br>
The function matching platfrom_devic-es to their drivers just comparing
the names due to decide to the probe function of which drived to feed<br>
the instance of platfrom_device<br>
<br>
<blockquote cite="mid4AF19CB5.5060706@inov.pt" type="cite"> Commenting
the driving renaming I get a little bit further:
<br>
<br>
s3c2410-spi s3c2410-spi.0: No platform data supplied
<br>
s3c2410-spi: probe of s3c2410-spi.0 failed with error -2
<br>
modprobe: failed to load module spi_s3c24xx: No such device
<br>
<br>
Now it seems I need some architecture dependent initialization,
correct?
<br>
</blockquote>
looks like you are right...<br>
your arcg/arm/s3c2410/<your_board>.c have to register
platform_device s3c_device_spi0,<br>
and this device have to hav epointer to platfrom_data to be properly
set.<br>
<br>
The platfrom_data is something which the S3Cxxx SPI driver knows about.<br>
Something likes this:<br>
<br>
struct sc3_spi_platform_data {<br>
int base_addr;<br>
int irq_num;<br>
int min_clk_freq;<br>
int max_clk_freq;<br>
int enable_puuldown;<br>
int what_ever_driver_needs_to_kow_due_to_use_SPI_controller;<br>
<br>
}<br>
<br>
<br>
The SPI driver probe function casts the "priv" pointer of platfrom
device to (struct sc3_spi_platform_data*) and uses all that fields
above.<br>
See in the probe function of the drivver and find out what it needs.<br>
<br>
The things likes base_addr and irq_num should correspond of the real
construction of your processor and board.<br>
You either need to consult the data sheet or set all that fields
manually bu yourself.<br>
<br>
You can declare instance of struct sc3_spi_platform_data as statio
variable inside the file where the platfrom_device is added<br>
<br>
<br>
If the driver is renamed verify that other driver uses the same
declaration of private platfrom_data structure (in my example struct
sc3_spi_platform_data),<br>
and uses it's fields for the same purpose.<br>
<blockquote cite="mid4AF19CB5.5060706@inov.pt" type="cite"><br>
Regards,
<br>
José Gonçalves
<br>
<br>
José Miguel Gonçalves wrote:
<br>
<blockquote type="cite">Hi,
<br>
<br>
I am trying to setup Linux 2.6.27 on an embedded board with a S3C2412
SoC.
<br>
After setting some architecture specific configuration on
/arch/arm/mach-s3c2412/, I have finally booted my board with success.
<br>
Now I am trying to access a temperature sensor that is connected to the
SPI bus.
<br>
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:
<br>
<br>
modprobe: failed to load module spi_s3c24xx: No such device
<br>
<br>
Any idea of what could be the problem?
<br>
<br>
Regards,
<br>
José Miguel Gonçalves
<br>
<br>
</blockquote>
<br>
<pre wrap="">
<hr size="4" width="90%">
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 <a class="moz-txt-link-rfc2396E" href="mailto:jose.goncalves@inov.pt"><jose.goncalves@inov.pt></a>
+ *
+ * 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 <a class="moz-txt-link-rfc2396E" href="mailto:jose.goncalves@inov.pt"><jose.goncalves@inov.pt></a> */
+        .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
</pre>
<pre wrap="">
<hr size="4" width="90%">
_______________________________________________
linux-arm mailing list
<a class="moz-txt-link-abbreviated" href="mailto:linux-arm@lists.infradead.org">linux-arm@lists.infradead.org</a>
<a class="moz-txt-link-freetext" href="http://lists.infradead.org/mailman/listinfo/linux-arm">http://lists.infradead.org/mailman/listinfo/linux-arm</a>
</pre>
</blockquote>
<br>
</body>
</html>