From c01e13d7852e0de245cc765664d67b41d13cb75f Mon Sep 17 00:00:00 2001
From: Jesse Gilles <jgilles@multitech.com>
Date: Wed, 6 Nov 2013 10:46:16 -0600
Subject: linux-2.6.39-at91: mtocgd3: configure spidev for SPI devices by
 default

---
 .../linux/linux-2.6.39-at91/mtocgd3/defconfig      |  2 +-
 .../mtocgd3/linux-2.6.39.4-mach-at91-mtocgd3.patch | 90 +++++++++++++---------
 2 files changed, 56 insertions(+), 36 deletions(-)

(limited to 'multitech')

diff --git a/multitech/recipes/linux/linux-2.6.39-at91/mtocgd3/defconfig b/multitech/recipes/linux/linux-2.6.39-at91/mtocgd3/defconfig
index 0afdbee..04fb2d9 100644
--- a/multitech/recipes/linux/linux-2.6.39-at91/mtocgd3/defconfig
+++ b/multitech/recipes/linux/linux-2.6.39-at91/mtocgd3/defconfig
@@ -1249,7 +1249,7 @@ CONFIG_SPI_ATMEL_DMA=y
 #
 # SPI Protocol Masters
 #
-# CONFIG_SPI_SPIDEV is not set
+CONFIG_SPI_SPIDEV=m
 # CONFIG_SPI_TLE62X0 is not set
 
 #
diff --git a/multitech/recipes/linux/linux-2.6.39-at91/mtocgd3/linux-2.6.39.4-mach-at91-mtocgd3.patch b/multitech/recipes/linux/linux-2.6.39-at91/mtocgd3/linux-2.6.39.4-mach-at91-mtocgd3.patch
index 9740495..4e35e85 100644
--- a/multitech/recipes/linux/linux-2.6.39-at91/mtocgd3/linux-2.6.39.4-mach-at91-mtocgd3.patch
+++ b/multitech/recipes/linux/linux-2.6.39-at91/mtocgd3/linux-2.6.39.4-mach-at91-mtocgd3.patch
@@ -1,7 +1,7 @@
-Index: linux-2.6.39.4/arch/arm/mach-at91/board-sam9x5cm.c
+Index: git/arch/arm/mach-at91/board-sam9x5cm.c
 ===================================================================
---- linux-2.6.39.4.orig/arch/arm/mach-at91/board-sam9x5cm.c	2013-02-19 09:38:45.180035681 -0600
-+++ linux-2.6.39.4/arch/arm/mach-at91/board-sam9x5cm.c	2013-02-27 16:36:25.684073131 -0600
+--- git.orig/arch/arm/mach-at91/board-sam9x5cm.c	2013-04-17 17:15:13.000000000 -0500
++++ git/arch/arm/mach-at91/board-sam9x5cm.c	2013-11-05 17:25:46.511692620 -0600
 @@ -18,6 +18,9 @@
  #include <linux/platform_device.h>
  #include <linux/spi/flash.h>
@@ -12,19 +12,39 @@ Index: linux-2.6.39.4/arch/arm/mach-at91/board-sam9x5cm.c
  #include <linux/fb.h>
  #include <linux/gpio_keys.h>
  #include <linux/input.h>
-@@ -103,6 +106,11 @@
+@@ -103,6 +106,31 @@
  		.irq            = -1,
  	},
  #endif
-+	{
++	{ /* SPI1_NCS1 to ethernet switch */
++		.modalias = "spidev",
++		.chip_select = 0,
++		.bus_num = 1,
++	},
++	{ /* SPI1_NCS2 to temp sensor */
 +		.modalias = "mts-io-board-temp",
 +		.chip_select = 1,
 +		.bus_num = 1,
++	},
++	{ /* SPI1_NCS3 to daughter card */
++		.modalias = "spidev",
++		.chip_select = 2,
++		.bus_num = 1,
++	},
++	{ /* SPI1_NCS4 to daughter card */
++		.modalias = "spidev",
++		.chip_select = 3,
++		.bus_num = 1,
++	},
++	{ /* SPI1_NCS5 to daughter card */
++		.modalias = "spidev",
++		.chip_select = 4,
++		.bus_num = 1,
 +	},
  #endif
  };
  
-@@ -111,13 +119,48 @@
+@@ -111,13 +139,48 @@
   */
  static struct mtd_partition __initdata cm_nand_partition[] = {
  	{
@@ -47,16 +67,16 @@ Index: linux-2.6.39.4/arch/arm/mach-at91/board-sam9x5cm.c
 +	{
 +		.name	= "UBoot Config",
 +		.offset	= 768*1024,
-+		.size	= 640*1024,
-+	},
-+	{
-+		.name	= "UBoot Redundant Config",
-+		.offset	= 1408*1024,
 +		.size	= 640*1024,
  	},
  	{
 -		.name	= "Partition 2",
 -		.offset	= MTDPART_OFS_NXTBLK,
++		.name	= "UBoot Redundant Config",
++		.offset	= 1408*1024,
++		.size	= 640*1024,
++	},
++	{
 +		.name	= "uImage",
 +		.offset	= 2*1024*1024,
 +		.size	= 6*1024*1024,
@@ -77,7 +97,7 @@ Index: linux-2.6.39.4/arch/arm/mach-at91/board-sam9x5cm.c
  		.size	= MTDPART_SIZ_FULL,
  	},
  };
-@@ -135,7 +178,8 @@
+@@ -135,7 +198,8 @@
  	.enable_pin	= AT91_PIN_PD4,
  	.ecc_mode	= NAND_ECC_HW,
  	.has_pmecc	= 1,
@@ -87,7 +107,7 @@ Index: linux-2.6.39.4/arch/arm/mach-at91/board-sam9x5cm.c
  	.pmecc_sector_size = 512,
  	.pmecc_lookup_table_offset = 0x8000,
  	.partition_info	= nand_partitions,
-@@ -170,7 +214,13 @@
+@@ -170,7 +234,13 @@
  	else
  		cm_nand_smc_config.mode |= AT91_SMC_DBW_8;
  
@@ -101,7 +121,7 @@ Index: linux-2.6.39.4/arch/arm/mach-at91/board-sam9x5cm.c
  	if (cm_is_revA()) {
  		cm_nand_data.bus_on_d0 = 1;
  		cm_nand_data.rdy_pin = AT91_PIN_PD6;
-@@ -178,6 +228,7 @@
+@@ -178,6 +248,7 @@
  		cm_nand_data.bus_on_d0 = 0;
  		cm_nand_data.rdy_pin = AT91_PIN_PD5;
  	}
@@ -109,7 +129,7 @@ Index: linux-2.6.39.4/arch/arm/mach-at91/board-sam9x5cm.c
  
  	/* configure chip-select 3 (NAND) */
  	sam9_smc_configure(3, &cm_nand_smc_config);
-@@ -189,25 +240,71 @@
+@@ -189,17 +260,62 @@
   * LEDs
   */
  static struct gpio_led cm_leds[] = {
@@ -136,7 +156,7 @@ Index: linux-2.6.39.4/arch/arm/mach-at91/board-sam9x5cm.c
 +		.name			= "led-c",
 +		.gpio			= AT91_PIN_PA25,
 +		.active_low		= 1
-+	},
+ 	},
 +	{
 +		.name			= "led-d",
 +		.gpio			= AT91_PIN_PA26,
@@ -151,9 +171,9 @@ Index: linux-2.6.39.4/arch/arm/mach-at91/board-sam9x5cm.c
 +		.name			= "led-f",
 +		.gpio			= AT91_PIN_PA28,
 +		.active_low		= 1
- 	},
- };
- 
++	},
++};
++
 +
 +uint8_t mts_id_eeprom[512];
 +
@@ -177,10 +197,10 @@ Index: linux-2.6.39.4/arch/arm/mach-at91/board-sam9x5cm.c
 +	.byte_len	= SZ_4K / 8,
 +	.page_size	= 16,
 +	.setup		= mts_id_eeprom_load,
-+};
-+
+ };
+ 
  /*
-  * I2C Devices
+@@ -207,7 +323,8 @@
   */
  static struct i2c_board_info __initdata cm_i2c_devices[] = {
  	{
@@ -190,7 +210,7 @@ Index: linux-2.6.39.4/arch/arm/mach-at91/board-sam9x5cm.c
  	},
  };
  
-@@ -234,8 +331,12 @@
+@@ -234,8 +351,12 @@
  	/* LEDs */
  	at91_gpio_leds(cm_leds, ARRAY_SIZE(cm_leds));
  
@@ -203,10 +223,10 @@ Index: linux-2.6.39.4/arch/arm/mach-at91/board-sam9x5cm.c
  		printk(KERN_CRIT "AT91: CM rev B and higher\n");
 +	*/
  }
-Index: linux-2.6.39.4/arch/arm/mach-at91/board-sam9x5ek.c
+Index: git/arch/arm/mach-at91/board-sam9x5ek.c
 ===================================================================
---- linux-2.6.39.4.orig/arch/arm/mach-at91/board-sam9x5ek.c	2013-02-19 09:38:43.680033046 -0600
-+++ linux-2.6.39.4/arch/arm/mach-at91/board-sam9x5ek.c	2013-02-19 09:38:45.180035681 -0600
+--- git.orig/arch/arm/mach-at91/board-sam9x5ek.c	2013-04-17 17:15:13.000000000 -0500
++++ git/arch/arm/mach-at91/board-sam9x5ek.c	2013-11-01 12:16:09.080917828 -0500
 @@ -23,6 +23,7 @@
  #include <linux/leds.h>
  #include <linux/clk.h>
@@ -302,7 +322,7 @@ Index: linux-2.6.39.4/arch/arm/mach-at91/board-sam9x5ek.c
  /*
   *  ISI
   */
-@@ -326,9 +356,11 @@
+@@ -330,9 +360,11 @@
   * I2C Devices
   */
  static struct i2c_board_info __initdata ek_i2c_devices[] = {
@@ -314,7 +334,7 @@ Index: linux-2.6.39.4/arch/arm/mach-at91/board-sam9x5ek.c
  #if defined(CONFIG_KEYBOARD_QT1070)
  	{
  		I2C_BOARD_INFO("qt1070", 0x1b),
-@@ -384,18 +416,24 @@
+@@ -388,18 +420,24 @@
  	bool config_isi_enabled = false;
  
  	cm_board_init(&cm_config);
@@ -340,7 +360,7 @@ Index: linux-2.6.39.4/arch/arm/mach-at91/board-sam9x5ek.c
  	at91_add_device_mci(0, &mci0_data);
  	/* I2C */
  	if (cm_config & CM_CONFIG_I2C0_ENABLE)
-@@ -405,6 +443,15 @@
+@@ -409,6 +447,15 @@
  		at91_add_device_i2c(0,
  				ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices));
  
@@ -356,7 +376,7 @@ Index: linux-2.6.39.4/arch/arm/mach-at91/board-sam9x5ek.c
  	if (cpu_is_at91sam9g25()) {
  		/* ISI */
  		/* NOTE: PCK0 provides ISI_MCK to the ISI module.
-@@ -430,13 +477,10 @@
+@@ -434,13 +481,10 @@
  		/* Touch Screen */
  		at91_add_device_tsadcc(&ek_tsadcc_data);
  	}
@@ -373,7 +393,7 @@ Index: linux-2.6.39.4/arch/arm/mach-at91/board-sam9x5ek.c
  
  #if 0
  	if (cpu_is_at91sam9x25() || cpu_is_at91sam9x35())
-@@ -448,6 +492,8 @@
+@@ -452,6 +496,8 @@
  		at91_add_device_can(0, NULL);
  #endif
  
@@ -382,7 +402,7 @@ Index: linux-2.6.39.4/arch/arm/mach-at91/board-sam9x5ek.c
  	if (cpu_is_at91sam9x25() || cpu_is_at91sam9x35())
  		/* this conflicts with usart.1 */
  		at91_add_device_can(1, NULL);
-@@ -474,6 +520,9 @@
+@@ -478,6 +524,9 @@
  	else if (config_isi_enabled)
  		printk(KERN_CRIT
  			"AT91: ISI conficts with MCI1, disable MCI1\n");
@@ -392,10 +412,10 @@ Index: linux-2.6.39.4/arch/arm/mach-at91/board-sam9x5ek.c
  }
  
  MACHINE_START(AT91SAM9X5EK, "Atmel AT91SAM9X5-EK")
-Index: linux-2.6.39.4/arch/arm/mach-at91/at91sam9x5_devices.c
+Index: git/arch/arm/mach-at91/at91sam9x5_devices.c
 ===================================================================
---- linux-2.6.39.4.orig/arch/arm/mach-at91/at91sam9x5_devices.c	2013-02-19 09:38:44.680033189 -0600
-+++ linux-2.6.39.4/arch/arm/mach-at91/at91sam9x5_devices.c	2013-02-19 15:28:04.792006181 -0600
+--- git.orig/arch/arm/mach-at91/at91sam9x5_devices.c	2013-04-17 17:15:13.000000000 -0500
++++ git/arch/arm/mach-at91/at91sam9x5_devices.c	2013-11-01 12:16:09.080917828 -0500
 @@ -543,11 +543,11 @@
  #endif
  
-- 
cgit v1.2.3