Patchwork [5/7] integration lpt_bitbang_spi to Makefile, flashrom.c, programmer.h

login
register
about
Submitter Maksim Kuleshov
Date 2013-03-31 15:06:28
Message ID <20130331190628.15c01388de573e47b51ffe21@mail.ru>
Download mbox | patch
Permalink /patch/3911/
State New
Headers show

Comments

Maksim Kuleshov - 2013-03-31 15:06:28
From e24b6fa25ad8917549b5d72c16baee0bff0ae9c6 Mon Sep 17 00:00:00 2001
From: Maksim Kuleshov <mmcx@mail.ru>
Date: Sun, 31 Mar 2013 15:37:34 +0400
Subject: [PATCH 5/7] integration lpt_bitbang_spi to Makefile, flashrom.c,
 programmer.h

Signed-off-by: Maksim Kuleshov <mmcx@mail.ru>
---
 Makefile     |   25 +++++++++++++++++++++++++
 flashrom.c   |   13 +++++++++++++
 programmer.h |   11 +++++++++++
 3 files changed, 49 insertions(+)

Patch

diff --git a/Makefile b/Makefile
index b948996..6505f28 100644
--- a/Makefile
+++ b/Makefile
@@ -155,6 +155,11 @@  UNSUPPORTED_FEATURES += CONFIG_RAYER_SPI=yes
 else
 override CONFIG_RAYER_SPI = no
 endif
+ifeq ($(CONFIG_LPT_BITBANG_SPI), yes)
+UNSUPPORTED_FEATURES += CONFIG_LPT_BITBANG_SPI=yes
+else
+override CONFIG_LPT_BITBANG_SPI = no
+endif
 ifeq ($(CONFIG_NIC3COM), yes)
 UNSUPPORTED_FEATURES += CONFIG_NIC3COM=yes
 else
@@ -279,6 +284,11 @@  UNSUPPORTED_FEATURES += CONFIG_RAYER_SPI=yes
 else
 override CONFIG_RAYER_SPI = no
 endif
+ifeq ($(CONFIG_LPT_BITBANG_SPI), yes)
+UNSUPPORTED_FEATURES += CONFIG_LPT_BITBANG_SPI=yes
+else
+override CONFIG_LPT_BITBANG_SPI = no
+endif
 ifeq ($(CONFIG_ATAHPT), yes)
 UNSUPPORTED_FEATURES += CONFIG_ATAHPT=yes
 else
@@ -330,6 +340,9 @@  CONFIG_SERPROG ?= yes
 # RayeR SPIPGM hardware support
 CONFIG_RAYER_SPI ?= yes
 
+# LPT_BITBANG_SPI hardware support
+CONFIG_LPT_BITBANG_SPI ?= yes
+
 # PonyProg2000 SPI hardware support
 CONFIG_PONY_SPI ?= yes
 
@@ -389,6 +402,9 @@  CONFIG_PRINT_WIKI ?= no
 ifeq ($(CONFIG_RAYER_SPI), yes)
 override CONFIG_BITBANG_SPI = yes
 else
+ifeq ($(CONFIG_LPT_BITBANG_SPI), yes)
+override CONFIG_BITBANG_SPI = yes
+else
 ifeq ($(CONFIG_PONY_SPI), yes)
 override CONFIG_BITBANG_SPI = yes
 else
@@ -407,6 +423,7 @@  endif
 endif
 endif
 endif
+endif
 
 ###############################################################################
 # Programmer drivers and programmer support infrastructure.
@@ -438,6 +455,14 @@  PROGRAMMER_OBJS += rayer_spi.o
 NEED_PCI := yes
 endif
 
+ifeq ($(CONFIG_LPT_BITBANG_SPI), yes)
+FEATURE_CFLAGS += -D'CONFIG_LPT_BITBANG_SPI=1'
+PROGRAMMER_OBJS += lpt_io.o
+PROGRAMMER_OBJS += lpt_bitbang_spi.o
+# Actually, NEED_PCI is wrong. NEED_IOPORT_ACCESS would be more correct.
+NEED_PCI := yes
+endif
+
 ifeq ($(CONFIG_PONY_SPI), yes)
 FEATURE_CFLAGS += -D'CONFIG_PONY_SPI=1'
 PROGRAMMER_OBJS += pony_spi.o
diff --git a/flashrom.c b/flashrom.c
index 225b6f0..b0c73f9 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -235,6 +235,19 @@  const struct programmer_entry programmer_table[] = {
 	},
 #endif
 
+#if CONFIG_LPT_BITBANG_SPI == 1
+	{
+		.name			= "lpt_bitbang_spi",
+		.type			= OTHER,
+					/* FIXME */
+		.devs.note		= "generic parallel port spi programmers\n",
+		.init			= lpt_bitbang_spi_init,
+		.map_flash_region	= fallback_map,
+		.unmap_flash_region	= fallback_unmap,
+		.delay			= internal_delay,
+	},
+#endif
+
 #if CONFIG_PONY_SPI == 1
 	{
 		.name			= "pony_spi",
diff --git a/programmer.h b/programmer.h
index 51a8c80..8c9350b 100644
--- a/programmer.h
+++ b/programmer.h
@@ -69,6 +69,9 @@  enum programmer {
 #if CONFIG_RAYER_SPI == 1
 	PROGRAMMER_RAYER_SPI,
 #endif
+#if CONFIG_LPT_BITBANG_SPI == 1
+	PROGRAMMER_LPT_BITBANG_SPI,
+#endif
 #if CONFIG_PONY_SPI == 1
 	PROGRAMMER_PONY_SPI,
 #endif
@@ -130,6 +133,9 @@  enum bitbang_spi_master_type {
 #if CONFIG_RAYER_SPI == 1
 	BITBANG_SPI_MASTER_RAYER,
 #endif
+#if CONFIG_LPT_BITBANG_SPI == 1
+	BITBANG_SPI_MASTER_LPT_BITBANG,
+#endif
 #if CONFIG_PONY_SPI == 1
 	BITBANG_SPI_MASTER_PONY,
 #endif
@@ -436,6 +442,11 @@  extern const struct dev_entry devs_ft2232spi[];
 int rayer_spi_init(void);
 #endif
 
+/* lpt_bitbang_spi.c */
+#if CONFIG_LPT_BITBANG_SPI == 1
+int lpt_bitbang_spi_init(void);
+#endif
+
 /* pony_spi.c */
 #if CONFIG_PONY_SPI == 1
 int pony_spi_init(void);