Subject: Re: [PATCH 0/2] mpc52xx: stop drivers from accessing clock config directly

From: Domen Puncer <[email-masked]>
Date: Wed, 24 Oct 2007 22:54:03 +0200

On 24/10/07 14:14 -0600, Grant Likely wrote:
> On 10/24/07, Domen Puncer <[email-masked]> wrote:
> > On 24/10/07 12:24 -0600, Grant Likely wrote:
> > > Domen,
> > >
> > > Here's a real solution to the problem.  I've somewhat tested this on
> > > the lite5200b.  Can you give it a spin on efika and see if SPI still
> > > works for you?
> >
> > My test case was lite5200b too, I don't think I ever tried SPI on
> > efika.
> > (Are even the right pins on irda connector, or is a necessary line
> > missing?)
> 
> Hmm, I guess that's right.  Can you at least make sure it still boots
> on Efika?  Some of the clock detection stuff has changed so I want to
> make sure it still boots.

OK. I'll do that tomorrow.

> 
> Are you setup to do your SPI test easily on you lite5200b?  When I say
> "somewhat" tested; I mean I probed the driver and it didn't crash.
> :-)  I haven't tried to run traffic over it.

Sorry, lite5200b is resting these days. :-(

> 
> Can you check that on your system?  If not, can you email me what
> setup/programs you used for testing?  I know very little about the SPI
> infrastructure.

For userspace part I used something like: Documentation/spi/spidev
And for kernel the attached, to fill get binded to spidev driver.

	Domen

> 
> Thanks,
> g.
> 
> -- 
> Grant Likely, B.Sc., P.Eng.
> Secret Lab Technologies Ltd.
> [email-masked]
> (403) 399-0195

-- 
Domen Puncer | Research & Development
.............................................................................................
Telargo d.o.o. | Zagrebška cesta 20 | 2000 Maribor | Slovenia
.............................................................................................
www.telargo.com
---
 drivers/spi/Makefile           |    1 +
 drivers/spi/spi_test_devices.c |   38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)

Index: work-powerpc.git/drivers/spi/Makefile
===================================================================
--- work-powerpc.git.orig/drivers/spi/Makefile
+++ work-powerpc.git/drivers/spi/Makefile
@@ -35,3 +35,4 @@ obj-$(CONFIG_SPI_SPIDEV)	+= spidev.o
 
 # SPI slave drivers (protocol for that link)
 # 	... add above this line ...
+obj-m				+= spi_test_devices.o
Index: work-powerpc.git/drivers/spi/spi_test_devices.c
===================================================================
--- /dev/null
+++ work-powerpc.git/drivers/spi/spi_test_devices.c
@@ -0,0 +1,38 @@
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/spi/spi.h>
+
+static struct spi_board_info spi_info[7];
+static struct spi_device *spidev[7];
+static int testdev_init(void)
+{
+	struct spi_board_info *info;
+	int i;
+
+	for (i=0; i<7; i++) {
+		struct spi_master *master;
+
+		info = &spi_info[i];
+		//info->max_speed_hz = 2*1000000;
+		info->max_speed_hz = 100000;
+		//info->max_speed_hz = 1*1000000;
+		strcpy(info->modalias, "spidev");
+
+		master = spi_busnum_to_master(i);
+		if (master)
+			spidev[i] = spi_new_device(master, info);
+	}
+	return 0;
+}
+
+static void testdev_exit(void)
+{
+	/* there is no _remove? */
+	/*for (i=0; i<7; i++) {
+	}*/
+}
+
+module_init(testdev_init);
+module_exit(testdev_exit);
+
+MODULE_LICENSE("GPL");