diff -uprN linux-2.6.20-at92_e1.5.1/arch/arm/mach-at91rm9200/at91sam9260_devices.c linux-2.6.20-at92_e1.5.1-spi/arch/arm/mach-at91rm9200/at91sam9260_devices.c
--- linux-2.6.20-at92_e1.5.1/arch/arm/mach-at91rm9200/at91sam9260_devices.c	2008-02-06 12:45:55.000000000 -0500
+++ linux-2.6.20-at92_e1.5.1-spi/arch/arm/mach-at91rm9200/at91sam9260_devices.c	2008-02-06 13:09:17.000000000 -0500
@@ -490,7 +490,7 @@ void __init at91_add_device_spi(struct s
 	if (enable_spi0) {
 		at91_set_A_periph(AT91_PIN_PA0, 0);	/* SPI0_MISO */
 		at91_set_A_periph(AT91_PIN_PA1, 0);	/* SPI0_MOSI */
-		at91_set_A_periph(AT91_PIN_PA2, 0);	/* SPI1_SPCK */
+		at91_set_A_periph(AT91_PIN_PA2, 0);	/* SPI0_SPCK */
 
 		at91_clock_associate("spi0_clk", &at91sam9260_spi0_device.dev, "spi_clk");
 		platform_device_register(&at91sam9260_spi0_device);
diff -uprN linux-2.6.20-at92_e1.5.1/arch/arm/mach-at91rm9200/board-sam9260ek.c linux-2.6.20-at92_e1.5.1-spi/arch/arm/mach-at91rm9200/board-sam9260ek.c
--- linux-2.6.20-at92_e1.5.1/arch/arm/mach-at91rm9200/board-sam9260ek.c	2008-02-06 12:45:56.000000000 -0500
+++ linux-2.6.20-at92_e1.5.1-spi/arch/arm/mach-at91rm9200/board-sam9260ek.c	2008-02-06 13:09:17.000000000 -0500
@@ -26,7 +26,6 @@
 #include <linux/platform_device.h>
 #include <linux/spi/spi.h>
 #include <linux/clk.h>
-
 #include <asm/hardware.h>
 #include <asm/setup.h>
 #include <asm/mach-types.h>
@@ -151,6 +150,7 @@ void __init at91_add_device_ssc_at73c213
 /*
  * SPI devices.
  */
+
 static struct spi_board_info ek_spi_devices[] = {
 #if !defined(CONFIG_MMC_AT91)
 	{	/* DataFlash chip */
@@ -191,6 +191,7 @@ static struct __initdata at91_eth_data e
 /*
  * NAND flash
  */
+#if 0
 static struct mtd_partition __initdata ek_nand_partition[] = {
 	{
 		.name	= "Partition 1",
@@ -203,6 +204,33 @@ static struct mtd_partition __initdata e
 		.size	= MTDPART_SIZ_FULL,
 	},
 };
+#endif
+
+/*
+ * NAND flash
+ */
+static struct mtd_partition __initdata ek_nand_partition[] = {
+	{
+		.name	= "Boot Partition",
+		.offset	= 0,
+		.size	= 64 * 2 * 1024,
+	},
+	{
+		.name	= "UBoot Partition",
+		.offset	= 64 * 2 * 1024,
+		.size	= 64 * 14 * 1024,
+	},
+ 	{
+ 		.name	= "Kernel Partition",
+ 		.offset	= 64 * 16 * 1024,
+ 		.size	= 64 * 48 * 1024,
+ 	},
+ 	{
+ 		.name	= "Disk Partition",
+ 		.offset	= 64 * 64 * 1024,
+ 		.size	= 64 * 448 * 1024,
+ 	},
+};
 
 static struct mtd_partition *nand_partitions(int size, int *num_partitions)
 {
diff -uprN linux-2.6.20-at92_e1.5.1/arch/arm/mach-at91rm9200/board-som9260m.c linux-2.6.20-at92_e1.5.1-spi/arch/arm/mach-at91rm9200/board-som9260m.c
--- linux-2.6.20-at92_e1.5.1/arch/arm/mach-at91rm9200/board-som9260m.c	2008-02-06 12:50:08.000000000 -0500
+++ linux-2.6.20-at92_e1.5.1-spi/arch/arm/mach-at91rm9200/board-som9260m.c	2008-02-06 13:09:18.000000000 -0500
@@ -29,8 +29,10 @@
 #include <linux/clk.h>
 #include <linux/ioex/ecoreex.h>
 #include <linux/mtd/physmap.h>
+#ifdef CONFIG_SPI_CLASS
 #include <linux/class/spi.h>
 #include <linux/class/spi_interface.h>
+#endif /* CONFIG_SPI_CLASS */
 
 #include <asm/hardware.h>
 #include <asm/setup.h>
@@ -175,20 +177,6 @@ static struct spi_s mcp3208_spi = 
 };
 #endif
 
-//static struct spi_s fake_spi = 
-//{
-// .name = "fake",
-// .subclass = 0,
-// .bsize = 16,
-// .tip = lsi2esc_spi_tip,
-// .xmit = lsi2esc_spi_xmit,
-// .confwrite = lsi2esc_spi_confwrite,
-// .confread = lsi2esc_spi_confread,
-// .speedread = lsi2esc_spi_speedread,
-// .speedwrite = lsi2esc_spi_speedwrite,
-//};
-
-	
 static struct spi_board_info ek_spi_devices[] = {
 #if !defined(CONFIG_MMC_AT91)
 	{	/* DataFlash chip */
@@ -222,13 +210,6 @@ static struct spi_board_info ek_spi_devi
 	  .bus_num = 1,
 	  .platform_data = &mcp3208_spi,
 	},
-	//{ /*fake*/
-	//  .modalias = "lsi2esc",
-	//  .chip_select = 1,
-	//  .max_speed_hz = 10 * 1000 * 1000,
-	//  .bus_num = 0,
-	//  .platform_data = &fake_spi,
-	//},
 #endif
 };
 
diff -uprN linux-2.6.20-at92_e1.5.1/arch/arm/mach-at91rm9200/clock.c linux-2.6.20-at92_e1.5.1-spi/arch/arm/mach-at91rm9200/clock.c
--- linux-2.6.20-at92_e1.5.1/arch/arm/mach-at91rm9200/clock.c	2008-02-06 12:45:56.000000000 -0500
+++ linux-2.6.20-at92_e1.5.1-spi/arch/arm/mach-at91rm9200/clock.c	2008-02-06 13:09:17.000000000 -0500
@@ -138,10 +138,12 @@ static struct clk mck = {
 
 static void pmc_periph_mode(struct clk *clk, int is_on)
 {
-	if (is_on)
+	if (is_on) {
 		at91_sys_write(AT91_PMC_PCER, clk->pmc_mask);
-	else
+	}
+	else {
 		at91_sys_write(AT91_PMC_PCDR, clk->pmc_mask);
+	}
 }
 
 static struct clk __init *at91_css_to_clk(unsigned long css)
@@ -168,9 +170,10 @@ static struct clk __init *at91_css_to_cl
 void __init at91_clock_associate(const char *id, struct device *dev, const char *func)
 {
 	struct clk *clk = clk_get(NULL, id);
-
+	
 	if (!dev || !clk || !IS_ERR(clk_get(dev, func)))
 		return;
+	
 
 	clk->function = func;
 	clk->dev = dev;
diff -uprN linux-2.6.20-at92_e1.5.1/drivers/misc/classes/char/spi_char.c linux-2.6.20-at92_e1.5.1-spi/drivers/misc/classes/char/spi_char.c
--- linux-2.6.20-at92_e1.5.1/drivers/misc/classes/char/spi_char.c	2008-02-06 12:45:57.000000000 -0500
+++ linux-2.6.20-at92_e1.5.1-spi/drivers/misc/classes/char/spi_char.c	2008-02-06 13:09:18.000000000 -0500
@@ -87,6 +87,7 @@ static int spi_char_ioctl(struct inode *
     	int errval=0;
         DPRINTK("XMIT ioctl\n");
         if (!spi->xmit)return -EFAULT;//method not available
+        t = kmalloc(sizeof(spi_transfer_t), GFP_KERNEL);
         if (copy_from_user(t, (void *)arg, sizeof(spi_transfer_t)) != 0){errval=-EFAULT;goto cleanup;}
         if(t->size==0)return 0;//not an error, but nothing to do
         if((t->miso)||(t->mosi))buf = kmalloc(t->size,GFP_KERNEL);
@@ -95,6 +96,7 @@ static int spi_char_ioctl(struct inode *
         if(t->miso)if(copy_to_user(t->miso, buf, t->size)!= 0 ){errval=-EFAULT;goto cleanup;}
 cleanup:
         if(buf)kfree(buf);
+        if(t)kfree(t);
         return errval;
         break;
     }
diff -uprN linux-2.6.20-at92_e1.5.1/drivers/misc/classes/spi_interface.c linux-2.6.20-at92_e1.5.1-spi/drivers/misc/classes/spi_interface.c
--- linux-2.6.20-at92_e1.5.1/drivers/misc/classes/spi_interface.c	2008-02-06 12:45:57.000000000 -0500
+++ linux-2.6.20-at92_e1.5.1-spi/drivers/misc/classes/spi_interface.c	2008-02-06 13:09:18.000000000 -0500
@@ -13,6 +13,15 @@
  * Copyright (C) 2007, EMAC Inc
  */
 
+//#define DEBUG_LSI
+
+#ifdef DEBUG_LSI
+#define DPRINTK(string, args...) printk("lsi2esc: " string, ##args)
+#else
+#define DPRINTK(string, args...)
+#endif
+
+
 /**
  * function to set/clear a transfer-in-progrees for
  * the given device. This function should be implemented
@@ -21,16 +30,24 @@
  */
 int lsi2esc_spi_tip(struct spi_s *s, int ofs)
 {
-    printk("lsi2esc_spi_tip\n");
+    DPRINTK("lsi2esc_spi_tip\n");
     return 0;
 }
 
 /**
  * function to transfer data on the SPI bus
+ * Data is written/read using an spi_sync call which causes
+ * the chip select to remain active throughout the entire transfer
+ * but also requires that the available size of the buffers is the
+ * sum of the write data plus the read data. i.e. to write an 8 bit
+ * command and read a 8 bit response the response would be stored in
+ * the last 8 bits of a 16 bit miso, the data to be written would need
+ * to be placed in the top 8 bits of a 16 bit mosi.
  * Assumptions: MOSI and MISO can be the same buffer,
  * if MOSI is NULL 0xFF is transmitted, if MISO is NULL
  * received data is discarded, there is no limit on buffer
- * size.
+ * size but both buffers must be the same size if they both exist.
+ * 
  * @param s the EMAC SPI class device to tranfer data on
  * @param mosi the transmit buffer (master->slave)
  * @param miso the receive buffer (slave->master)
@@ -42,22 +59,50 @@ int lsi2esc_spi_xmit(struct spi_s *s, u8
     int result = 0;
     u8 *local_mosi = mosi;
     u8 *local_miso = miso;
+    int temp_size;
+    struct spi_message msg;
+    struct spi_transfer msg_xfer =
+    {
+        .cs_change  = 0, /* hold cs for entire transfer */
+    };
+  
+    DPRINTK("lsi2esc_spi_xmit %d bytes\n", size);
     
-    printk("lsi2esc_spi_xmit\n");
-
     if (!local_mosi) {
         if (!(local_mosi = kmalloc(size, GFP_KERNEL)))
             return -ENOMEM;
-        /* memset to 0xFF */
         memset(local_mosi, 0xFF, size);
     }
-    result = spi_write(s->lsi, local_mosi, size);
-    if ((result == 0) && local_miso) { /* success */
-        result = spi_read(s->lsi, local_miso, size);
+    if (!local_miso) {
+        /* data is discarded, but a buffer must exist */
+        if (!(local_miso = kmalloc(size, GFP_KERNEL)))
+            return -ENOMEM;
+    }
+#ifdef DEBUG_LSI
+    for(temp_size = size; temp_size > 0; temp_size--) {
+        DPRINTK("mosi[%d] = 0x%X\n", temp_size-1, mosi ? mosi[temp_size-1] : 0);
     }
+#endif
+    spi_message_init(&msg);
+    msg_xfer.tx_buf = local_mosi;
+    msg_xfer.rx_buf = local_miso;
+    msg_xfer.len = size;
+    spi_message_add_tail(&msg_xfer, &msg);
+    
+    result = spi_sync(s->lsi, &msg);
+    
+#ifdef DEBUG_LSI
+    for(temp_size = size; temp_size > 0; temp_size--) {
+        DPRINTK("miso[%d] = 0x%X\n", temp_size-1, local_miso ? local_miso[temp_size-1] : 0);
+    }
+#endif
+
     if (!mosi)
         kfree(local_mosi);
-    return result;
+    if (!miso)
+        kfree(local_miso);
+
+    return result;    
 }
 
 /**
@@ -68,11 +113,11 @@ int lsi2esc_spi_xmit(struct spi_s *s, u8
 spi_control lsi2esc_spi_confread(struct spi_s *s)
 {
     spi_control flags = 0;
-    printk("lsi2esc_spi_confread\n");
+    DPRINTK("lsi2esc_spi_confread\n");
 
     flags = s->lsi->mode; /* SPI and SPICL same here */
 
-    printk("bits_per_word = %d\n", s->lsi->bits_per_word);
+    DPRINTK("bits_per_word = %d\n", s->lsi->bits_per_word);
     if (s->lsi->bits_per_word == 8)
         flags |= SPICL_EIGHTBIT; /* actually does nothing */
     else if (s->lsi->bits_per_word == 10)
@@ -93,7 +138,7 @@ spi_control lsi2esc_spi_confread(struct 
  */
 int lsi2esc_spi_confwrite(struct spi_s *s, spi_control config)
 {
-    printk("lsi2esc_spi_confwrite: %d\n", config);
+    DPRINTK("lsi2esc_spi_confwrite: %d\n", config);
     
     /* set the mode */
     s->lsi->mode = 0;
@@ -123,7 +168,7 @@ int lsi2esc_spi_confwrite(struct spi_s *
  */
 spi_control lsi2esc_spi_speedread(struct spi_s *s)
 {
-    printk("lsi2esc_spi_speedread\n");
+    DPRINTK("lsi2esc_spi_speedread\n");
     return s->lsi->max_speed_hz;    
 }
 
@@ -134,7 +179,7 @@ spi_control lsi2esc_spi_speedread(struct
  */
 int lsi2esc_spi_speedwrite(struct spi_s *s, spi_control speed)
 {
-    printk("lsi2esc_spi_speedwrite\n");
+    DPRINTK("lsi2esc_spi_speedwrite\n");
     s->lsi->max_speed_hz = speed;
     /* error checking and adjustment must be provided by
      * the SPI controller driver to use this directly */
@@ -194,7 +239,7 @@ static struct spi_driver lsi2esc_driver 
 
 static __init int lsi2esc_init(void)
 {
-    printk("Registering LSI2ESC SPI driver\n");
+    DPRINTK("Registering LSI2ESC SPI driver\n");
     return spi_register_driver(&lsi2esc_driver);
 }
 
