aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2019-06-19 20:35:37 +0200
committerHarald Welte <laforge@gnumonks.org>2019-06-19 20:35:37 +0200
commitbc62335768ec7d786c811dc7b6575f795fc02d6d (patch)
tree6a99fad60da4aefb4554d83e523b49efa968c872
parent63490361d2ad9f929a75ace8899505663ed870e8 (diff)
qmod: Disable hub reset and EEPROM erase/write by default
We recently introduced ALLOW_PEER_ERASE to control if the firmware should contain code for the SAM3 to reset each other on QMOD. Let's use the same define to also remove code for putting the USB hub into reset as well as code for erasing + writing the hub EEPROM. This is needed only during production, but it shouldn't be enabled during normal operation of the product at the end user. Change-Id: I1c8cca2f7f0f0070d7bf1ade676e035c45e4d5ab
-rw-r--r--firmware/libboard/qmod/source/board_qmod.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/firmware/libboard/qmod/source/board_qmod.c b/firmware/libboard/qmod/source/board_qmod.c
index 4d75b98..0565c92 100644
--- a/firmware/libboard/qmod/source/board_qmod.c
+++ b/firmware/libboard/qmod/source/board_qmod.c
@@ -28,6 +28,7 @@
#include "card_pres.h"
#include <osmocom/core/timer.h>
#include "usb_buf.h"
+#include "i2c.h"
static const Pin pin_hubpwr_override = PIN_PRTPWR_OVERRIDE;
static const Pin pin_hub_rst = {PIO_PA13, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT};
@@ -46,6 +47,7 @@ static int qmod_sam3_is_12(void)
return 0;
}
+#if (ALLOW_PEER_ERASE > 0)
const unsigned char __eeprom_bin[256] = {
USB_VENDOR_OPENMOKO & 0xff,
USB_VENDOR_OPENMOKO >> 8,
@@ -69,7 +71,6 @@ const unsigned char __eeprom_bin[256] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0, 0x56, 0x23, 0x71, 0x04, 0x00, /* 0xf0 - 0xff */
};
-#include "i2c.h"
static int write_hub_eeprom(void)
{
int i;
@@ -126,7 +127,7 @@ static int erase_hub_eeprom(void)
return 0;
}
-
+#endif /* ALLOW_PEER_ERASE */
static void board_exec_dbg_cmd_st12only(int ch)
{
@@ -137,12 +138,14 @@ static void board_exec_dbg_cmd_st12only(int ch)
return;
switch (ch) {
+#if (ALLOW_PEER_ERASE > 0)
case 'E':
write_hub_eeprom();
break;
case 'e':
erase_hub_eeprom();
break;
+#endif /* ALLOW_PEER_ERASE */
case 'O':
printf("Setting PRTPWR_OVERRIDE\n\r");
PIO_Set(&pin_hubpwr_override);
@@ -151,6 +154,7 @@ static void board_exec_dbg_cmd_st12only(int ch)
printf("Clearing PRTPWR_OVERRIDE\n\r");
PIO_Clear(&pin_hubpwr_override);
break;
+#if (ALLOW_PEER_ERASE > 0)
case 'H':
printf("Clearing _HUB_RESET -> HUB_RESET high (inactive)\n\r");
PIO_Clear(&pin_hub_rst);
@@ -170,6 +174,7 @@ static void board_exec_dbg_cmd_st12only(int ch)
printf("Writing value 0x%02lx to EEPROM offset 0x%02lx\n\r", val, addr);
eeprom_write_byte(0x50, addr, val);
break;
+#endif /* ALLOW_PEER_ERASE */
case 'r':
printf("Please enter EEPROM offset:\n\r");
UART_GetIntegerMinMax(&addr, 0, 255);