Patchwork [3/3] rayer_spi: add pinout for Willem EPROM programmer SPI

login
register
about
Submitter Ondrej Zary
Date 2013-03-16 22:43:23
Message ID <201303162343.24714.linux@rainbow-software.org>
Download mbox | patch
Permalink /patch/3888/
State New
Headers show

Comments

Ondrej Zary - 2013-03-16 22:43:23
Add support for Willem EPROM programmer SPI socket. Tested on PCB4.0.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>

Patch

--- a/rayer_spi.c	2013-03-16 23:13:31.000000000 +0100
+++ b/rayer_spi.c	2013-03-16 23:13:39.000000000 +0100
@@ -124,6 +124,22 @@  static struct rayer_pinout wiggler_lpt =
 	.miso_inverted = 1,
 };
 
+static void willem_preinit(void *);
+static int willem_shutdown(void *);
+
+static struct rayer_pinout willem = {
+	.cs_bit = 3,	/* SELIN */
+	.cs_reg = 2,	/* control register */
+	.cs_inverted = 1,
+	.sck_bit = 1,	/* D1 */
+	.mosi_bit = 0,	/* D0 */
+	.mosi_inverted = 1,
+	.miso_bit = 7,	/* BUSY */
+	.miso_inverted = 1,
+	.preinit = willem_preinit,
+	.shutdown = willem_shutdown,
+};
+
 struct rayer_programmer rayer_spi_types[] = {
 	{"rayer",	NT,	"RayeR SPIPGM",			  	&rayer_spipgm},
 	{"xilinx",	NT,	"Xilinx Parallel Cable III (DLC 5)", 	&xilinx_dlc5},
@@ -131,6 +147,7 @@  struct rayer_programmer rayer_spi_types[
 	{"byteblaster",	NT,	"Altera ByteBlaster",			&altera_byteblaster},
 	{"stk200", 	NT,	"Atmel STK200/300 adapter",		&atmel_stk200},
 	{"wiggler",	NT,	"Wiggler LPT",				&wiggler_lpt},
+	{"willem",	NT,	"Willem EPROM Programmer SPI",		&willem},
 	{0},
 };
 
@@ -305,6 +322,21 @@  static int stk200_shutdown(void *data) {
 	return 0;
 }
 
+static void willem_preinit(void *data) {
+	msg_pdbg("willem_init\n");
+	/* Disable VPP, enable VCC and OE. */
+	lpt_outbyte[2] = (1 << 2) | (1 << 1) | (1 << 0);
+	OUTB(lpt_outbyte[2], lpt_iobase + 2);
+}
+
+static int willem_shutdown(void *data) {
+	msg_pdbg("willem_shutdown\n");
+	/* Disable VPP, VCC and OE. */
+	lpt_outbyte[2] = (1 << 0);
+	OUTB(lpt_outbyte[2], lpt_iobase + 2);
+	return 0;
+}
+
 #else
 #error PCI port I/O access is not supported on this architecture yet.
 #endif