Hi Peter,
On 06/08/11 00:44, Peter Turczak wrote:
following the path I found yesterday I discovered the reason for the strange
behavior of the chip select pins when toggled from the spi driver via the
kernel gpio api.
The problem has its root in the calculation of the set-port offsets (macro
MCFGPIO_SETR() in arch/m68k/include/gpio.h), this assumes that all ports have
the same offset from the base port address (MCFGPIO_SETR) which is defined in
mcf520xsim.h as an alias of MCFGIO_PSETR_BUSCTL. Because the BUSCTL and BE port
do not have a set-register (see MCF5208 Reference Manual Page 13-10, Table
13-3) the offset calculations went wrong.
Because the BE and BUSCTL port do not seem useful in these parts, as they lack
a set register, I removed them and adapted the gpio chip bases which are also
used for the offset-calculations. Now both setting and resetting the chip
selects works as expected from userland and from the kernelspace.
Your changes in the patch below sure do look right given the
documentation.
Furthermore the base address of the spi controller was wrong in mcfqspi.h.
Because I don't know the M532x series and it had a different base-adress in the
same ifdef-branch I added an ifdef choice there. If sombody has access to an
532x device, please test it!
Greg: Would you please check if this could be merged into mainline?
Overall it looks right. Just a couple of minor nits to clean up:
diff --git a/arch/m68k/include/asm/mcfqspi.h b/arch/m68k/include/asm/mcfqspi.h
index 39d90d5..d983ea0 100644
--- a/arch/m68k/include/asm/mcfqspi.h
+++ b/arch/m68k/include/asm/mcfqspi.h
@@ -26,8 +26,12 @@
#elif defined(CONFIG_M5249)
#define MCFQSPI_IOBASE (MCF_MBAR + 0x300)
#elif defined(CONFIG_M520x) || defined(CONFIG_M532x)
+#if defined(CONFIG_M520x)
+#define MCFQSPI_IOBASE 0xFC05C000
+#elif defined(CONFIG_M532x)
#define MCFQSPI_IOBASE 0xFC058000
#endif
+#endif
Lets simplify the logic here a little and do:
#elif defined(CONFIG_M5249)
#define MCFQSPI_IOBASE (MCF_MBAR + 0x300)
#elif defined(CONFIG_M520x)
#define MCFQSPI_IOBASE 0xFC05C000
#elif defined(CONFIG_M532x)
#define MCFQSPI_IOBASE 0xFC058000
#endif
diff --git a/arch/m68k/platform/520x/Makefile b/arch/m68k/platform/520x/Makefile
index ad3f4e5..3b8c275 100644
--- a/arch/m68k/platform/520x/Makefile
+++ b/arch/m68k/platform/520x/Makefile
@@ -14,4 +14,4 @@
asflags-$(CONFIG_FULLDEBUG) := -DDEBUGGER_COMPATIBLE_CACHE=1
-obj-y := config.o gpio.o
+obj-y := config.o gpio.o spi-mcf520x.o
There is no spi-mcf520x.c in this patch...
Is there supposed to be?
Can you regenerate your patch, and add a Signed-off-by?
Regards
Greg
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: g...@snapgear.com
SnapGear Group, McAfee PHONE: +61 7 3435 2888
8 Gardner Close FAX: +61 7 3217 5323
Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com
_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev