Edward O'Callaghan submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Angel Pons: Looks good to me, approved Edward O'Callaghan: Looks good to me, approved
rayer_spi.c: Remove forward-declarations

Reorder functions to avoid forward-declarations.
This was aimed to be done for all spi masters in the earlier patch
however this file was missed.

BUG=b:140394053
TEST=builds

Change-Id: I0e3c82967a169d6a2512ffa17d1e0c78eafb2797
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/51555
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
---
M rayer_spi.c
1 file changed, 45 insertions(+), 54 deletions(-)

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: 3
Gerrit-Owner: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged