r4715 - developers/werner/wlan-spi/patches-tracking

werner at docs.openmoko.org werner at docs.openmoko.org
Thu Oct 16 03:19:51 CEST 2008


Author: werner
Date: 2008-10-16 03:19:51 +0200 (Thu, 16 Oct 2008)
New Revision: 4715

Added:
   developers/werner/wlan-spi/patches-tracking/s3c-spi-fix-int-mode.patch
Modified:
   developers/werner/wlan-spi/patches-tracking/gta02-mmc-spi-bitbang.patch
   developers/werner/wlan-spi/patches-tracking/gta02-mmc-spi.patch
   developers/werner/wlan-spi/patches-tracking/series
Log:
- rebasing continues ...
- gta02-mmc-spi-bitbang.patch: make arch/arm/mach-s3c2440/mach-gta02.c
  (gta02_spi_mmc_bdinfo) an array, to better match style of similar uses
- gta02-mmc-spi.patch: added board and driver registration and updated for new
  style



Modified: developers/werner/wlan-spi/patches-tracking/gta02-mmc-spi-bitbang.patch
===================================================================
--- developers/werner/wlan-spi/patches-tracking/gta02-mmc-spi-bitbang.patch	2008-10-16 00:50:32 UTC (rev 4714)
+++ developers/werner/wlan-spi/patches-tracking/gta02-mmc-spi-bitbang.patch	2008-10-16 01:19:51 UTC (rev 4715)
@@ -13,8 +13,8 @@
 
 Index: ktrack/arch/arm/mach-s3c2440/Kconfig
 ===================================================================
---- ktrack.orig/arch/arm/mach-s3c2440/Kconfig	2008-10-15 22:15:23.000000000 -0200
-+++ ktrack/arch/arm/mach-s3c2440/Kconfig	2008-10-15 22:27:33.000000000 -0200
+--- ktrack.orig/arch/arm/mach-s3c2440/Kconfig	2008-10-15 22:30:39.000000000 -0200
++++ ktrack/arch/arm/mach-s3c2440/Kconfig	2008-10-15 23:09:15.000000000 -0200
 @@ -99,6 +99,20 @@
  	   Say Y here if you are using an early hardware revision
  	   of the FIC/Openmoko Neo1973 GTA02 GSM Phone.
@@ -38,8 +38,8 @@
  #source "arch/arm/mach-s3c2440/camera/Kconfig"
 Index: ktrack/arch/arm/mach-s3c2440/mach-gta02.c
 ===================================================================
---- ktrack.orig/arch/arm/mach-s3c2440/mach-gta02.c	2008-10-15 22:15:23.000000000 -0200
-+++ ktrack/arch/arm/mach-s3c2440/mach-gta02.c	2008-10-15 22:27:52.000000000 -0200
+--- ktrack.orig/arch/arm/mach-s3c2440/mach-gta02.c	2008-10-15 22:30:39.000000000 -0200
++++ ktrack/arch/arm/mach-s3c2440/mach-gta02.c	2008-10-15 23:09:56.000000000 -0200
 @@ -37,6 +37,7 @@
  #include <linux/spi/spi.h>
  #include <linux/spi/glamo.h>
@@ -48,7 +48,7 @@
  #include <linux/mmc/host.h>
  
  #include <linux/mtd/mtd.h>
-@@ -1223,6 +1224,85 @@
+@@ -1223,6 +1224,87 @@
  	},
  };
  
@@ -60,13 +60,15 @@
 +
 +#if defined(CONFIG_AR6K_SPI_S3C24XX_GPIO)
 +
-+static struct spi_board_info gta02_spi_mmc_bdinfo = {
-+	.modalias	= "mmc_spi",
-+	.irq		= IRQ_EINT3,	/* unused ? */
-+	.max_speed_hz	= 12 * 1000 * 1000,
-+	.bus_num	= 0,
-+	.chip_select	= 0,
-+	.mode		= SPI_MODE_0,
++static struct spi_board_info gta02_spi_mmc_bdinfo[] = {
++	{
++		.modalias	= "mmc_spi",
++		.irq		= IRQ_EINT3,	/* unused ? */
++		.max_speed_hz	= 12 * 1000 * 1000,
++		.bus_num	= 0,
++		.chip_select	= 0,
++		.mode		= SPI_MODE_0,
++	}
 +};
 +
 +#endif /* CONFIG_AR6K_SPI_S3C24XX_GPIO */
@@ -91,8 +93,8 @@
 +	.pin_clk	= S3C2410_GPE5,
 +	.pin_mosi	= S3C2410_GPE6,
 +	.pin_miso	= S3C2410_GPE7,
-+	.board_size	= 1,
-+	.board_info	= &gta02_spi_mmc_bdinfo,
++	.board_size	= ARRAY_SIZE(gta02_spi_mmc_bdinfo),
++	.board_info	= gta02_spi_mmc_bdinfo,
 +	.chip_select	= &spi_wlan_cs,
 +	.num_chipselect = 1,
 +};
@@ -134,7 +136,7 @@
  static struct resource gta02_led_resources[] = {
  	{
  		.name	= "gta02-power:orange",
-@@ -1638,7 +1718,13 @@
+@@ -1638,7 +1720,13 @@
  	s3c2410_gpio_pullup(S3C2410_GPF3, 1);
  	s3c2410_gpio_pullup(S3C2410_GPG2, 1);
  

Modified: developers/werner/wlan-spi/patches-tracking/gta02-mmc-spi.patch
===================================================================
--- developers/werner/wlan-spi/patches-tracking/gta02-mmc-spi.patch	2008-10-16 00:50:32 UTC (rev 4714)
+++ developers/werner/wlan-spi/patches-tracking/gta02-mmc-spi.patch	2008-10-16 01:19:51 UTC (rev 4715)
@@ -12,8 +12,8 @@
 
 Index: ktrack/arch/arm/mach-s3c2440/Kconfig
 ===================================================================
---- ktrack.orig/arch/arm/mach-s3c2440/Kconfig	2008-10-15 22:04:35.000000000 -0200
-+++ ktrack/arch/arm/mach-s3c2440/Kconfig	2008-10-15 22:05:19.000000000 -0200
+--- ktrack.orig/arch/arm/mach-s3c2440/Kconfig	2008-10-15 23:09:15.000000000 -0200
++++ ktrack/arch/arm/mach-s3c2440/Kconfig	2008-10-15 23:10:08.000000000 -0200
 @@ -111,6 +111,15 @@
                  bool "GPIO bit-banging SPI"
                  select MMC_SPI
@@ -32,8 +32,8 @@
  endmenu
 Index: ktrack/arch/arm/mach-s3c2440/mach-gta02.c
 ===================================================================
---- ktrack.orig/arch/arm/mach-s3c2440/mach-gta02.c	2008-10-15 22:04:35.000000000 -0200
-+++ ktrack/arch/arm/mach-s3c2440/mach-gta02.c	2008-10-15 22:06:25.000000000 -0200
+--- ktrack.orig/arch/arm/mach-s3c2440/mach-gta02.c	2008-10-15 23:09:56.000000000 -0200
++++ ktrack/arch/arm/mach-s3c2440/mach-gta02.c	2008-10-15 23:10:08.000000000 -0200
 @@ -1228,9 +1228,7 @@
  /* ----- AR6000 WLAN interface --------------------------------------------- */
  
@@ -43,10 +43,10 @@
 -#if defined(CONFIG_AR6K_SPI_S3C24XX_GPIO)
 +#if defined(CONFIG_AR6K_SPI_S3C24XX) || defined(CONFIG_AR6K_SPI_S3C24XX_GPIO)
  
- static struct spi_board_info gta02_spi_mmc_bdinfo = {
- 	.modalias	= "mmc_spi",
-@@ -1241,7 +1239,18 @@
- 	.mode		= SPI_MODE_0,
+ static struct spi_board_info gta02_spi_mmc_bdinfo[] = {
+ 	{
+@@ -1243,7 +1241,18 @@
+ 	}
  };
  
 -#endif /* CONFIG_AR6K_SPI_S3C24XX_GPIO */
@@ -57,11 +57,25 @@
 +
 +static struct s3c2410_spi_info spi_wlan_cfg = {
 +	.pin_cs		= S3C2410_GPG2,
-+	.board_size	= 1,
-+	.board_info	= &gta02_spi_mmc_bdinfo,
++	.num_cs		= 1,
++	.bus_num	= 0, /* link to gta02_spi_mmc_bdinfo */
 +};
 +
 +#endif /* CONFIG_AR6K_SPI_S3C24XX */
  
  
  #ifdef CONFIG_AR6K_SPI_S3C24XX_GPIO
+@@ -1750,6 +1759,13 @@
+ 	}
+ #endif
+ 
++#ifdef CONFIG_AR6K_SPI_S3C24XX
++	spi_register_board_info(gta02_spi_mmc_bdinfo,
++	    ARRAY_SIZE(gta02_spi_mmc_bdinfo));
++	s3c_device_spi0.dev.platform_data = &spi_wlan_cfg;
++	platform_device_register(&s3c_device_spi0);
++#endif /* CONFIG_AR6K_SPI_S3C24XX */
++
+         i2c_register_board_info(0, gta02_i2c_devs,
+                 ARRAY_SIZE(gta02_i2c_devs));
+ 

Added: developers/werner/wlan-spi/patches-tracking/s3c-spi-fix-int-mode.patch
===================================================================
--- developers/werner/wlan-spi/patches-tracking/s3c-spi-fix-int-mode.patch	                        (rev 0)
+++ developers/werner/wlan-spi/patches-tracking/s3c-spi-fix-int-mode.patch	2008-10-16 01:19:51 UTC (rev 4715)
@@ -0,0 +1,63 @@
+Work in progress. Makes spi_s3c24xx.c work for up to 12MHz.
+
+At speeds of 13MHz or higher, we have setup time issues. I.e., the
+SPI host sees the data coming from the device delayed by one bit,
+even though things look fine on the scope.
+
+This 12MHz/13MHz "barrier" exists with or without probes attached,
+suggesting capacitative loading plays only a minor role in this.
+
+Index: ktrack/drivers/spi/spi_s3c24xx.c
+===================================================================
+--- ktrack.orig/drivers/spi/spi_s3c24xx.c	2008-10-10 10:52:14.000000000 -0200
++++ ktrack/drivers/spi/spi_s3c24xx.c	2008-10-15 23:14:27.000000000 -0200
+@@ -199,6 +199,27 @@
+ 
+ 	wait_for_completion(&hw->done);
+ 
++	/*
++	 * Get the last byte. Since we don't have more data we can send in
++	 * order to clock the byte out of the SPI system, we need to wait.
++	 *
++	 * Duh, I'm just handwaving here about possible explanations of what's
++	 * going on in the hardware. This is the voodoo ritual that makes it
++	 * work while anything else fails.
++	 */
++	if (hw->rx && hw->count) {
++		udelay(1+10*1000000/spi->max_speed_hz);
++		hw->rx[hw->count-1] = readb(hw->regs + S3C2410_SPRDAT);
++	}
++
++	if (0&&t->rx_buf && t->len > 18) {
++		int i;
++
++		printk(KERN_INFO "RX (%p):", t->rx_buf);
++		for (i = 0; i != t->len; i++)
++			printk(" %02x", ((u8 *) t->rx_buf)[i]);
++		printk("\n");
++	}
+ 	return hw->count;
+ }
+ 
+@@ -222,8 +243,19 @@
+ 
+ 	hw->count++;
+ 
+-	if (hw->rx)
+-		hw->rx[count] = readb(hw->regs + S3C2410_SPRDAT);
++	/*
++	 * Misfeature #1: the first byte received can only be read after
++	 * writing the second byte to send to the shifter.
++	 *
++	 * Misfeature #2: we need to consume the byte preceding the first byte
++	 * or the SPI engine gets upset.
++	 */
++	if (hw->rx) {
++		u8 b = readb(hw->regs + S3C2410_SPRDAT);
++
++		if (count)
++			hw->rx[count-1] = b;
++	}
+ 
+ 	count++;
+ 

Modified: developers/werner/wlan-spi/patches-tracking/series
===================================================================
--- developers/werner/wlan-spi/patches-tracking/series	2008-10-16 00:50:32 UTC (rev 4714)
+++ developers/werner/wlan-spi/patches-tracking/series	2008-10-16 01:19:51 UTC (rev 4715)
@@ -14,3 +14,4 @@
 hif-linux-sdio.patch
 gta02-mmc-spi-bitbang.patch
 gta02-mmc-spi.patch
+s3c-spi-fix-int-mode.patch 




More information about the commitlog mailing list