Change in ...simtrace2[master]: qmod: Disable hub reset and EEPROM erase/write by default

laforge gerrit-no-reply at lists.osmocom.org
Thu Jun 20 16:48:04 UTC 2019


laforge has submitted this change and it was merged. ( https://gerrit.osmocom.org/c/simtrace2/+/14549 )

Change subject: qmod: Disable hub reset and EEPROM erase/write by default
......................................................................

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
---
M firmware/libboard/qmod/source/board_qmod.c
1 file changed, 7 insertions(+), 2 deletions(-)

Approvals:
  Jenkins Builder: Verified
  tsaitgaist: Looks good to me, approved



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 @@
 		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 @@
 	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 @@
 
 	return 0;
 }
-
+#endif /* ALLOW_PEER_ERASE */
 
 static void board_exec_dbg_cmd_st12only(int ch)
 {
@@ -137,12 +138,14 @@
 		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 @@
 		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 @@
 		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);

-- 
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/14549
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I1c8cca2f7f0f0070d7bf1ade676e035c45e4d5ab
Gerrit-Change-Number: 14549
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at gnumonks.org>
Gerrit-Reviewer: tsaitgaist <kredon at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190620/ec0bfd42/attachment.html>


More information about the gerrit-log mailing list