Anastasia Klimchuk has uploaded this change for review.

View Change

rayer_spi.c: Remove forward-declarations

Reorder functions to avoid forward-declarations.
I aimed to do this for all spi masters in earlier patch,
but missed this one.

BUG=b:140394053
TEST=builds

Change-Id: I0e3c82967a169d6a2512ffa17d1e0c78eafb2797
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
---
M rayer_spi.c
1 file changed, 45 insertions(+), 54 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/55/51555/1
diff --git a/rayer_spi.c b/rayer_spi.c
index 8e869e6..cde008f 100644
--- a/rayer_spi.c
+++ b/rayer_spi.c
@@ -31,6 +31,11 @@
#include "programmer.h"
#include "hwaccess.h"

+static uint16_t lpt_iobase;
+
+/* Cached value of last byte sent. */
+static uint8_t lpt_outbyte;
+
/* We have two sets of pins, out and in. The numbers for both sets are
* independent and are bitshift values, not real pin numbers.
* Default settings are for the RayeR hardware.
@@ -59,8 +64,20 @@
.miso_bit = 6,
};

-static void dlc5_preinit(const void *);
-static int dlc5_shutdown(void *);
+static void dlc5_preinit(const void *data) {
+ msg_pdbg("dlc5_preinit\n");
+ /* Assert pin 6 to receive MISO. */
+ lpt_outbyte |= (1<<4);
+ OUTB(lpt_outbyte, lpt_iobase);
+}
+
+static int dlc5_shutdown(void *data) {
+ msg_pdbg("dlc5_shutdown\n");
+ /* De-assert pin 6 to force MISO low. */
+ lpt_outbyte &= ~(1<<4);
+ OUTB(lpt_outbyte, lpt_iobase);
+ return 0;
+}

static const struct rayer_pinout xilinx_dlc5 = {
.cs_bit = 2,
@@ -71,8 +88,18 @@
.shutdown = dlc5_shutdown,
};

-static void byteblaster_preinit(const void *);
-static int byteblaster_shutdown(void *);
+static void byteblaster_preinit(const void *data){
+ msg_pdbg("byteblaster_preinit\n");
+ /* Assert #EN signal. */
+ OUTB(2, lpt_iobase + 2 );
+}
+
+static int byteblaster_shutdown(void *data){
+ msg_pdbg("byteblaster_shutdown\n");
+ /* De-Assert #EN signal. */
+ OUTB(0, lpt_iobase + 2 );
+ return 0;
+}

static const struct rayer_pinout altera_byteblastermv = {
.cs_bit = 1,
@@ -83,8 +110,20 @@
.shutdown = byteblaster_shutdown,
};

-static void stk200_preinit(const void *);
-static int stk200_shutdown(void *);
+static void stk200_preinit(const void *data) {
+ msg_pdbg("stk200_init\n");
+ /* Assert #EN signals, set LED signal. */
+ lpt_outbyte = (1 << 6) ;
+ OUTB(lpt_outbyte, lpt_iobase);
+}
+
+static int stk200_shutdown(void *data) {
+ msg_pdbg("stk200_shutdown\n");
+ /* Assert #EN signals, clear LED signal. */
+ lpt_outbyte = (1 << 2) | (1 << 3);
+ OUTB(lpt_outbyte, lpt_iobase);
+ return 0;
+}

static const struct rayer_pinout atmel_stk200 = {
.cs_bit = 7,
@@ -121,11 +160,6 @@

static const struct rayer_pinout *pinout = NULL;

-static uint16_t lpt_iobase;
-
-/* Cached value of last byte sent. */
-static uint8_t lpt_outbyte;
-
static void rayer_bitbang_set_cs(int val)
{
lpt_outbyte &= ~(1 << pinout->cs_bit);
@@ -237,49 +271,6 @@
return 0;
}

-static void byteblaster_preinit(const void *data){
- msg_pdbg("byteblaster_preinit\n");
- /* Assert #EN signal. */
- OUTB(2, lpt_iobase + 2 );
-}
-
-static int byteblaster_shutdown(void *data){
- msg_pdbg("byteblaster_shutdown\n");
- /* De-Assert #EN signal. */
- OUTB(0, lpt_iobase + 2 );
- return 0;
-}
-
-static void stk200_preinit(const void *data) {
- msg_pdbg("stk200_init\n");
- /* Assert #EN signals, set LED signal. */
- lpt_outbyte = (1 << 6) ;
- OUTB(lpt_outbyte, lpt_iobase);
-}
-
-static int stk200_shutdown(void *data) {
- msg_pdbg("stk200_shutdown\n");
- /* Assert #EN signals, clear LED signal. */
- lpt_outbyte = (1 << 2) | (1 << 3);
- OUTB(lpt_outbyte, lpt_iobase);
- return 0;
-}
-
-static void dlc5_preinit(const void *data) {
- msg_pdbg("dlc5_preinit\n");
- /* Assert pin 6 to receive MISO. */
- lpt_outbyte |= (1<<4);
- OUTB(lpt_outbyte, lpt_iobase);
-}
-
-static int dlc5_shutdown(void *data) {
- msg_pdbg("dlc5_shutdown\n");
- /* De-assert pin 6 to force MISO low. */
- lpt_outbyte &= ~(1<<4);
- OUTB(lpt_outbyte, lpt_iobase);
- return 0;
-}
-
#else
#error PCI port I/O access is not supported on this architecture yet.
#endif

To view, visit change 51555. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I0e3c82967a169d6a2512ffa17d1e0c78eafb2797
Gerrit-Change-Number: 51555
Gerrit-PatchSet: 1
Gerrit-Owner: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-MessageType: newchange