--- linux-3.3.8-orig/arch/mips/ralink/rt305x/mach-carambola.c	2012-06-17 23:56:52.000000000 +0200
+++ carambola-new/build_dir/linux-ramips_rt305x/linux-3.3.8/arch/mips/ralink/rt305x/mach-carambola.c	2012-06-18 00:08:47.000000000 +0200
@@ -22,6 +22,11 @@
 #include <asm/sizes.h>
 #include <linux/i2c.h>
 #include <linux/i2c-gpio.h>
+#include <linux/gpio.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/flash.h>
+#include <linux/spi/spi_gpio.h>
+#include <linux/spi/ads7846.h>
 
 #include "devices.h"
 
@@ -81,6 +86,21 @@ static struct i2c_gpio_platform_data car
 	.scl_pin        = 2,
 };
 
+static struct spi_gpio_platform_data spi_gpio_data = {
+	.sck = RT305X_GPIO_12,
+	.mosi = RT305X_GPIO_11,
+	.miso = RT305X_GPIO_13,
+	.num_chipselect = 1,
+};
+
+static struct platform_device carambola_spi_gpio = {
+	.name      = "spi_gpio",
+	.id      = 1,
+	.dev      = {
+		.platform_data   = &spi_gpio_data,
+	},
+}; 
+
 static struct platform_device carambola_i2c_gpio = {
 	.name           = "i2c-gpio",
 	.id             = 0,
@@ -90,16 +110,61 @@ static struct platform_device carambola_
 };
 
 static struct platform_device *carambola_devices[] __initdata = {
-        &carambola_i2c_gpio
+        &carambola_i2c_gpio,
+		&carambola_spi_gpio
 };
 
+static int ads7843_pendown_state(void)
+{
+	return !gpio_get_value(RT305X_GPIO_7);	/* Touchscreen PENIRQ */
+}
+
+static struct ads7846_platform_data ads_info = {
+	.model			= 7843,
+	.x_min			= 150,
+	.x_max			= 3830,
+	.y_min			= 190,
+	.y_max			= 3830,
+	.vref_delay_usecs	= 100,
+
+	/* For a 8" touch-screen */
+	// .x_plate_ohms		= 603,
+	// .y_plate_ohms		= 332,
+
+	/* For a 10.4" touch-screen */
+	// .x_plate_ohms		= 611,
+	// .y_plate_ohms		= 325,
+
+	.x_plate_ohms		= 576,
+	.y_plate_ohms		= 366,
+
+	.pressure_max		= 15000, /* generally nonsense on the 7843 */
+	.debounce_max		= 1,
+	.debounce_rep		= 0,
+	.debounce_tol		= (~0),
+	.get_pendown_state	= ads7843_pendown_state,
+};
+
+
+
+
 static struct spi_board_info carambola_spi_info[] = {
-	{
+	{ /* Display, on native SPI-bus (id=0) */
+		.modalias		= "spi-ssd1289",
+		.irq            = -1,
+		.max_speed_hz   = 52428800,
 		.bus_num	= 0,
 		.chip_select	= 0,
-		.max_speed_hz	= 0,
-		.modalias	= "spidev",
-	}
+	},
+	{	/* Touchscreen, on GPIO-emulated SPI-bus (id=1) */
+		.modalias	= "ads7846",
+		.chip_select	= 0,
+		.bus_num		= 1,
+		.max_speed_hz	= 5000 * 26,
+		.platform_data	= &ads_info,
+		.irq		= -1, //set by carambola_init
+		.controller_data = (void *) RT305X_GPIO_14,
+	},
 };
 
 static void __init carambola_init(void)
@@ -107,6 +172,7 @@ static void __init carambola_init(void)
 	rt305x_gpio_init((RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT) |
 			 RT305X_GPIO_MODE_I2C);
 	carambola_register_gpiodev();
+	carambola_spi_info[1].irq=gpio_to_irq(RT305X_GPIO_7);
 	platform_add_devices(carambola_devices, ARRAY_SIZE(carambola_devices));
 
 	/* we want fixed partitions sizes for now */
--- linux-3.3.8-orig/drivers/spi/spi-ramips.c	2012-06-17 23:56:54.000000000 +0200
+++ carambola-new/build_dir/linux-ramips_rt305x/linux-3.3.8/drivers/spi/spi-ramips.c	2012-06-17 23:57:16.000000000 +0200
@@ -198,7 +198,8 @@ static inline int ramips_spi_wait_till_r
 		if ((status & SPISTAT_BUSY) == 0)
 			return 0;
 
-		udelay(1);
+//This slows things down without actually seeming to do something useful.
+//		udelay(1);
 	}
 
 	return -ETIMEDOUT;
