Author: cmjones
Date: 2012-04-27 11:41:18 +0100 (Fri, 27 Apr 2012)
New Revision: 1861
Modified:
balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/spi_tt.patch
Log:
Added changes for 2V2 separate SPI buses
Modified: balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/spi_tt.patch
===================================================================
--- balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/spi_tt.patch 2012-04-20 09:28:18 UTC (rev 1860)
+++ balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/spi_tt.patch 2012-04-27 10:41:18 UTC (rev 1861)
@@ -1,7 +1,7 @@
Index: linux-2.6.39.4/drivers/spi/Kconfig
===================================================================
---- linux-2.6.39.4.orig/drivers/spi/Kconfig 2012-02-20 13:28:12.000000000 +0000
-+++ linux-2.6.39.4/drivers/spi/Kconfig 2012-02-20 13:28:20.000000000 +0000
+--- linux-2.6.39.4.orig/drivers/spi/Kconfig 2012-04-27 11:32:59.000000000 +0100
++++ linux-2.6.39.4/drivers/spi/Kconfig 2012-04-27 11:37:59.000000000 +0100
@@ -386,6 +386,21 @@
SPI driver for the Topcliff PCH (Platform Controller Hub) SPI bus
used in some x86 embedded processors.
@@ -26,8 +26,8 @@
depends on GENERIC_GPIO && CPU_TX49XX
Index: linux-2.6.39.4/drivers/spi/Makefile
===================================================================
---- linux-2.6.39.4.orig/drivers/spi/Makefile 2012-02-20 13:28:12.000000000 +0000
-+++ linux-2.6.39.4/drivers/spi/Makefile 2012-02-20 13:28:20.000000000 +0000
+--- linux-2.6.39.4.orig/drivers/spi/Makefile 2012-04-27 11:32:59.000000000 +0100
++++ linux-2.6.39.4/drivers/spi/Makefile 2012-04-27 11:37:59.000000000 +0100
@@ -54,6 +54,7 @@
obj-$(CONFIG_SPI_SH_MSIOF) += spi_sh_msiof.o
obj-$(CONFIG_SPI_STMP3XXX) += spi_stmp.o
@@ -39,8 +39,8 @@
Index: linux-2.6.39.4/drivers/spi/spi_tt.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.39.4/drivers/spi/spi_tt.c 2012-02-20 13:28:20.000000000 +0000
-@@ -0,0 +1,267 @@
++++ linux-2.6.39.4/drivers/spi/spi_tt.c 2012-04-27 11:35:09.000000000 +0100
+@@ -0,0 +1,291 @@
+/*
+ * Copyright 20011 Toby Churchill Ltd
+ * Based on spi_imx.c
@@ -93,10 +93,20 @@
+ samosa_write8( (enable ? SAMOSA_ADDR_CONTROL_REG_3_SET : SAMOSA_ADDR_CONTROL_REG_3_CLR), (1<<SPI_DATA_OUT_ENABLE_BIT));
+}
+
-+static void spi_tt_wait_ready(void) {
++static void spi_tt_rtc_mosi_output_enable (int enable) {
++ samosa_write8( (enable ? SAMOSA_ADDR_CONTROL_REG_3_SET : SAMOSA_ADDR_CONTROL_REG_3_CLR), (1<<RTC_SPI_DATA_OUT_ENABLE_BIT));
++}
++
++static void spi_tt_wait_ready(struct spi_device *spi) {
+ int n = SPI_MAX_WAIT;
-+ while(n & !(samosa_read8(SAMOSA_ADDR_SPI_STATUS) & SPI_STATUS_READY_BIT))
-+ n--;
++
++ if ( spi->chip_select == SPI_TT_DEVICE_RTC) {
++ while(n & !(samosa_read8(SAMOSA_ADDR_SPI_STATUS) & RTC_SPI_STATUS_READY_BIT))
++ n--; }
++ else {
++ while(n & !(samosa_read8(SAMOSA_ADDR_SPI_STATUS) & SPI_STATUS_READY_BIT))
++ n--;
++ }
+ if (!n)
+ pr_info("%s: Timeout waiting for SPI ready\n",__func__);
+}
@@ -163,14 +173,22 @@
+ const u8 *tx = transfer->tx_buf;
+ u8 *rx = transfer->rx_buf;
+
-+ int half_duplex = (spi->chip_select == SPI_TT_DEVICE_ADC) || (spi->chip_select == SPI_TT_DEVICE_RTC);
++ int half_duplex = (spi->chip_select == SPI_TT_DEVICE_ADC)
++ || (spi->chip_select == SPI_TT_DEVICE_RTC)
++ || (spi->chip_select == SPI_TT_DEVICE_USER_DISPLAY) ;
+ while (likely(count > 0)) {
+ unsigned long timeout = msecs_to_jiffies(SPI_ACK_TIMEOUT_MS);
+ u8 txd = tx ? (*tx++):0;
-+ spi_tt_wait_ready();
-+ spi_tt_mosi_output_enable(half_duplex ? (transfer->tx_buf ? 1:0):1);
++ spi_tt_wait_ready(spi);
+ init_completion(&spi_tt->xfer_done);
-+ samosa_write8(SAMOSA_ADDR_SPI_DATA,txd);
++ if ( spi->chip_select == SPI_TT_DEVICE_RTC) {
++ spi_tt_rtc_mosi_output_enable(half_duplex ? (transfer->tx_buf ? 1:0):1);
++ samosa_write8(SAMOSA_ADDR_RTC_SPI_DATA, txd);
++ }
++ else {
++ spi_tt_mosi_output_enable(half_duplex ? (transfer->tx_buf ? 1:0):1);
++ samosa_write8(SAMOSA_ADDR_SPI_DATA,txd);
++ }
+ timeout = wait_for_completion_timeout(&spi_tt->xfer_done, timeout);
+ if (timeout == 0) {
+ pr_info("%s: completion timed out\n", __func__);
@@ -179,11 +197,17 @@
+ samosa_write8(SAMOSA_ADDR_INT_CLEAR ,SAMOSA_SPI_INT_MASK);
+#endif
+ }
-+ spi_tt_wait_ready(); // likely unnecessary
++ spi_tt_wait_ready(spi); // likely unnecessary
+ udelay(30); // wait between bytes
+ if (rx) {
-+ u8 rx_data = samosa_read8(SAMOSA_ADDR_SPI_DATA);
-+ *(rx++) = rx_data;
++ if ( spi->chip_select == SPI_TT_DEVICE_RTC) {
++ u8 rx_data = samosa_read8(SAMOSA_ADDR_RTC_SPI_DATA);
++ *(rx++) = rx_data;
++ }
++ else {
++ u8 rx_data = samosa_read8(SAMOSA_ADDR_SPI_DATA);
++ *(rx++) = rx_data;
++ }
+ }
+ count--;
+ }
@@ -311,8 +335,8 @@
Index: linux-2.6.39.4/include/linux/spi/spi_tt.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.39.4/include/linux/spi/spi_tt.h 2012-02-20 18:47:34.000000000 +0000
-@@ -0,0 +1,61 @@
++++ linux-2.6.39.4/include/linux/spi/spi_tt.h 2012-04-27 11:35:25.000000000 +0100
+@@ -0,0 +1,65 @@
+#ifndef SPI_TT_H
+#define SPI_TT_H
+
@@ -320,6 +344,7 @@
+
+#define SAMOSA_ADDR_SPI_DATA 0x06
+#define SAMOSA_ADDR_SPI_STATUS 0x07
++#define SAMOSA_ADDR_RTC_SPI_DATA 0x09
+#define SAMOSA_ADDR_CONTROL_REG_2_CLR 0x12
+#define SAMOSA_ADDR_CONTROL_REG_2_SET 0x13
+#define SAMOSA_ADDR_CONTROL_REG_3_CLR 0x14
@@ -338,6 +363,7 @@
+
+// SAMOSA_ADDR_SPI_STATUS
+#define SPI_STATUS_READY_BIT (0)
++#define RTC_SPI_STATUS_READY_BIT (1)
+// SAMOSA_ADDR_CONTROL_REG_2
+#define KBD_RESET_BIT (0)
+#define FAR_DISPLAY_RESET_BIT (1)
@@ -350,6 +376,7 @@
+#define USER_DISPLAY_RESET_BIT (1)
+#define USER_DISPLAY_CMD_DATA_BIT (3)
+#define SPI_DATA_OUT_ENABLE_BIT (4)
++#define RTC_SPI_DATA_OUT_ENABLE_BIT (7)
+
+#define SPI_TT_BUS_NUM 16
+
@@ -364,6 +391,7 @@
+#define SPI_TT_SPI_READY_IRQ BALLOON3_IRQ(1)
+#define SPI_TT_VBUS_CHANGE_IRQ BALLOON3_IRQ(2)
+#define TT_SYS_START_IRQ BALLOON3_IRQ(3)
++#define SPI_TT_RTC_SPI_READY_IRQ BALLOON3_IRQ(4)
+
+#define USB_VBUS_OK_BIT (0)
+#define USB_CHARGER_PRESENT_BIT (1)
@@ -376,8 +404,8 @@
+#endif
Index: linux-2.6.39.4/arch/arm/mach-pxa/balloon3.c
===================================================================
---- linux-2.6.39.4.orig/arch/arm/mach-pxa/balloon3.c 2012-02-20 13:28:19.000000000 +0000
-+++ linux-2.6.39.4/arch/arm/mach-pxa/balloon3.c 2012-02-20 18:48:41.000000000 +0000
+--- linux-2.6.39.4.orig/arch/arm/mach-pxa/balloon3.c 2012-04-27 11:37:58.000000000 +0100
++++ linux-2.6.39.4/arch/arm/mach-pxa/balloon3.c 2012-04-27 11:37:59.000000000 +0100
@@ -54,6 +54,12 @@
#include <mach/irda.h>
#include <mach/ohci.h>