Skip to contentSkip to conversation

about MPC 8XX SPI Driver

PATCH New 徐小威的EMAIL 2 participants 2 messages Nov 10, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi All:

Anybody know where can found 'CPM SPI Driver' for MPC852T.I found a
cpm_spi.c at /arch/ppc/8260_io directory in Linux 2.4.25.But I don't know how to program application to
handle this driver.

Best Regards,
Rober Hsu

#1 lore raw

PATCH 1/1 2.6: PRTPPC board-support was: Re: about MPC 8XX SPI Driver

Quoted 4 lines · 徐小威的EMAIL

Anybody know where can found 'CPM SPI Driver' for MPC852T.I found a
cpm_spi.c at /arch/ppc/8260_io directory in Linux 2.4.25.But I don't know how to program application to
handle this driver.

Do you want it for 2.4 or 2.6? (I have both running on a mpc852T). Here's a patch for 2.6.14 (denx-git tree).
Sorry to send you the complete patch for prtppc board support, but the spi driver makes up most part of it, so it wouldn't be much smaller anyway ;-)

Regards,

Signature · 2 lines
David Jander
Protonic Holland.
arch/ppc/8xx_io/Kconfig +8 -0
@@ -77,6 +77,14 @@ config ENET_BIG_BUFFERS
 config HTDMSOUND
 	bool "Embedded Planet HIOX Audio"
 	depends on SOUND=y
+	
+config CPM_SPI
+	bool "Simple CPM SPI driver"
+
+config CPM_SPI_BDSIZE
+	int "Size of Rx/Tx Buffer for SPI"
+	depends on CPM_SPI
+	default "16"
 
 # This doesn't really belong here, but it is convenient to ask
 # 8xx specific questions.
arch/ppc/8xx_io/Makefile +1 -0
@@ -8,3 +8,4 @@ obj-$(CONFIG_FEC_ENET)	+= fec.o
 obj-$(CONFIG_SCC_ENET)	+= enet.o
 obj-$(CONFIG_UCODE_PATCH) += micropatch.o
 obj-$(CONFIG_HTDMSOUND) += cs4218_tdm.o
+obj-$(CONFIG_CPM_SPI)   += cpm_spi.o
arch/ppc/8xx_io/cpm_spi.c new file +448 -0

448 lines not on this page · raw message

arch/ppc/Kconfig +17 -0
@@ -504,6 +504,13 @@ config WINCEPT
 	  MPC821 PowerPC, introduced in 1998 and designed to be used in
 	  thin-client machines.  Say Y to support it directly.
 
+config PRTPPC
+	bool "PRTPPC"
+	help
+	  PRTPPC is a single-board computer module based on a Freescale MPC852T
+	  embedded processor. It is used in different products designed and
+	  manufactured by Protonic Holland.
+
 endchoice
 
 choice
@@ -954,6 +961,16 @@ config NR_CPUS
 config HIGHMEM
 	bool "High memory support"
 
+config PRT_IOADDR
+	hex "PRTPPC IO-address space start"
+	depends on PRTPPC
+	default "0xf8100000"
+	
+config PRT_IOSIZE
+	hex "PRTPPC IO-address space size"
+	depends on PRTPPC
+	default "0x00040000"
+
 source kernel/Kconfig.hz
 source kernel/Kconfig.preempt
 source "mm/Kconfig"
arch/ppc/platforms/Makefile +1 -0
@@ -46,6 +46,7 @@ obj-$(CONFIG_SBC82xx)		+= sbc82xx.o
 obj-$(CONFIG_SPRUCE)		+= spruce.o
 obj-$(CONFIG_LITE5200)		+= lite5200.o
 obj-$(CONFIG_EV64360)		+= ev64360.o
+obj-$(CONFIG_PRTPPC)		+= prtppc_setup.o
 
 ifeq ($(CONFIG_SMP),y)
 obj-$(CONFIG_PPC_PMAC)		+= pmac_smp.o
arch/ppc/platforms/prtppc.h new file +40 -0
new file mode 100644
@@ -0,0 +1,40 @@
+/*
+ * PRTPPC board definitions, loosely based on:
+ *   TQM8xx(L/M) board specific definitions
+ * 
+ * Author: David Jander <[email protected]>
+ *
+ * Copyright (c) 2005 Protonic Holland b.v.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#ifndef __PRTPPC_H__
+#define __PRTPPC_H__
+
+#include <linux/config.h>
+
+#include <asm/ppcboot.h>
+
+#define BOARD_CHIP_NAME "MPC86X"
+
+#define	PRTPPC_IMMR_BASE	0xF8000000	/* phys. addr of IMMR */
+#define	PRTPPC_IMAP_SIZE	(64 * 1024)	/* size of mapped area */
+
+#define	IMAP_ADDR	PRTPPC_IMMR_BASE	/* physical base address of IMMR area */
+#define IMAP_SIZE	PRTPPC_IMAP_SIZE	/* mapped size of IMMR area */
+
+/* define IO_BASE for External bus devices */
+#define _IO_BASE        CONFIG_PRT_IOADDR
+#define _IO_BASE_SIZE  	CONFIG_PRT_IOSIZE
+
+#define	FEC_INTERRUPT		 9	/* = SIU_LEVEL4			*/
+
+/* We don't use the 8259.
+*/
+#define NR_8259_INTS	0
+
+#endif	/* __PRTPPC_H__ */
arch/ppc/platforms/prtppc_serial.h new file +100 -0

100 lines not on this page · raw message

arch/ppc/platforms/prtppc_setup.c new file +88 -0

88 lines not on this page · raw message

arch/ppc/syslib/m8xx_setup.c +1 -1
@@ -367,7 +367,7 @@ m8xx_map_io(void)
 #ifdef CONFIG_PCI
         io_block_mapping(PCI_CSR_ADDR, PCI_CSR_ADDR, PCI_CSR_SIZE, _PAGE_IO);
 #endif
-#if defined(CONFIG_NETTA)
+#if defined(CONFIG_NETTA) || defined (CONFIG_PRTPPC)
 	io_block_mapping(_IO_BASE,_IO_BASE,_IO_BASE_SIZE, _PAGE_IO);
 #endif
 }
drivers/usb/Kconfig +2 -1
@@ -10,7 +10,8 @@ menu "USB support"
 config USB_ARCH_HAS_HCD
 	boolean
 	default y if USB_ARCH_HAS_OHCI
-	default y if ARM				# SL-811
+	default y if ARM                               # SL-811
+	default y if PRTPPC
 	default PCI
 
 # many non-PCI SOC chips embed OHCI
drivers/usb/host/isp116x.h +32 -0
@@ -365,6 +365,33 @@ struct isp116x_ep {
 #define	IRQ_TEST()	do{}while(0)
 #endif
 
+#if defined(CONFIG_PRTPPC)
+/* On the PRTPPC the ISP1160 is connected through an 8-bit bus via a CPLD
+ * which translates the 8-bit data to 16-bit back and forth.
+ * The UPM splits the 16-bit bus-cycles up into two 8-bit cycles.
+ * The only caveat is that on writing, we have to write to the higher address first
+ * and then to the lower address, while on reading it has to be done the other way around,
+ * that is first the lower address and then the higher address.
+ * So for reading we can use normal 16-bit read functions, while for writing,
+ * we just redefine (temporarily) writew() and __raw_writew() to these below.
+ */
+static void inline writew_hcd(unsigned int port,u16 data)
+{
+	out_8((volatile unsigned char __iomem *)(port | 0x00000001), (data>>8) & 0x00ff);
+	out_8((volatile unsigned char __iomem *)(port & 0xfffffffe), data & 0x00ff);
+}
+
+static void inline raw_writew_hcd(unsigned int port,u16 data)
+{
+	__raw_writeb(data & 0x00ff, (volatile unsigned char __iomem *)(port | 0x00000001));
+	__raw_writeb((data>>8) & 0x00ff, (volatile unsigned char __iomem *)(port & 0xfffffffe));
+}
+
+#define writew(b,a) 		writew_hcd((unsigned int)(a),b)
+#define __raw_writew(b,a) 	raw_writew_hcd((unsigned int)(a),b)
+
+#endif /* CONFIG_PRTPPC */
+
 static inline void isp116x_write_addr(struct isp116x *isp116x, unsigned reg)
 {
 	IRQ_TEST();
@@ -421,6 +448,11 @@ static inline u32 isp116x_read_data32(st
 	return val;
 }
 
+#if defined(CONFIG_PRTPPC)
+#undef writew
+#undef __raw_writew
+#endif /* CONFIG_PRTPPC */
+
 /* Let's keep register access functions out of line. Hint:
    we wait at least 150 ns at every access.
 */
include/asm-ppc/cpm_spi.h new file +340 -0

340 lines not on this page · raw message

include/asm-ppc/mpc8xx.h +4 -0
@@ -68,6 +68,10 @@
 #include <platforms/mpc885ads.h>
 #endif
 
+#if defined(CONFIG_PRTPPC)
+#include <platforms/prtppc.h>
+#endif
+
 /* Currently, all 8xx boards that support a processor to PCI/ISA bridge
  * use the same memory map.
  */
include/asm-ppc/serial.h +2 -0
@@ -38,6 +38,8 @@
 #include <asm/mpc85xx.h>
 #elif defined(CONFIG_RADSTONE_PPC7D)
 #include <platforms/radstone_ppc7d.h>
+#elif defined(CONFIG_PRTPPC)
+#include <platforms/prtppc_serial.h>
 #else
 
 /*