Change in simtrace2[master]: qmod: Add 'e' command for erasing the EEPROM
Kévin Redon has submitted this change and it was merged. ( https://gerrit.osmocom.org/9858 ) Change subject: qmod: Add 'e' command for erasing the EEPROM .. qmod: Add 'e' command for erasing the EEPROM Change-Id: Id7cb0db568dd3e9d796829bf0019d63048612998 --- M firmware/libboard/qmod/source/board_qmod.c 1 file changed, 24 insertions(+), 0 deletions(-) Approvals: Kévin Redon: Looks good to me, approved Jenkins Builder: Verified diff --git a/firmware/libboard/qmod/source/board_qmod.c b/firmware/libboard/qmod/source/board_qmod.c index 47a4cb6..acd090f 100644 --- a/firmware/libboard/qmod/source/board_qmod.c +++ b/firmware/libboard/qmod/source/board_qmod.c @@ -102,6 +102,26 @@ return 0; } +static int erase_hub_eeprom(void) +{ + int i; + + /* wait */ + mdelay(100); + + TRACE_INFO("Erasing EEPROM...\n\r"); + /* write the EEPROM once */ + for (i = 0; i < 256; i++) { + int rc = eeprom_write_byte(0x50, i, 0xff); + /* if the result was negative, repeat that write */ + if (rc < 0) + i--; + } + + return 0; +} + + static void board_exec_dbg_cmd_st12only(int ch) { uint32_t addr, val; @@ -114,6 +134,9 @@ case 'E': write_hub_eeprom(); break; + case 'e': + erase_hub_eeprom(); + break; case 'O': printf("Setting PRTPWR_OVERRIDE\n\r"); PIO_Set(_hubpwr_override); @@ -161,6 +184,7 @@ printf("\tR\treset SAM3\n\r"); if (qmod_sam3_is_12()) { printf("\tE\tprogram EEPROM\n\r"); + printf("\te\tErase EEPROM\n\r"); printf("\tO\tEnable PRTPWR_OVERRIDE\n\r"); printf("\to\tDisable PRTPWR_OVERRIDE\n\r"); printf("\tH\tRelease HUB RESET (high)\n\r"); -- To view, visit https://gerrit.osmocom.org/9858 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: simtrace2 Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: Id7cb0db568dd3e9d796829bf0019d63048612998 Gerrit-Change-Number: 9858 Gerrit-PatchSet: 2 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Kévin Redon
Change in simtrace2[master]: qmod: Add 'e' command for erasing the EEPROM
Kévin Redon has posted comments on this change. ( https://gerrit.osmocom.org/9858 ) Change subject: qmod: Add 'e' command for erasing the EEPROM .. Patch Set 1: merging the code so I can fix it -- To view, visit https://gerrit.osmocom.org/9858 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: simtrace2 Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Id7cb0db568dd3e9d796829bf0019d63048612998 Gerrit-Change-Number: 9858 Gerrit-PatchSet: 1 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Kévin Redon Gerrit-Comment-Date: Tue, 07 Aug 2018 09:41:00 + Gerrit-HasComments: No Gerrit-HasLabels: No
Change in simtrace2[master]: qmod: Add 'e' command for erasing the EEPROM
Kévin Redon has posted comments on this change. ( https://gerrit.osmocom.org/9858 ) Change subject: qmod: Add 'e' command for erasing the EEPROM .. Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/9858 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: simtrace2 Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Id7cb0db568dd3e9d796829bf0019d63048612998 Gerrit-Change-Number: 9858 Gerrit-PatchSet: 1 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Kévin Redon Gerrit-Comment-Date: Tue, 07 Aug 2018 09:40:39 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in simtrace2[master]: qmod: Add 'e' command for erasing the EEPROM
Kévin Redon has posted comments on this change. ( https://gerrit.osmocom.org/9858 ) Change subject: qmod: Add 'e' command for erasing the EEPROM .. Patch Set 1: Code-Review-1 see previous comment -- To view, visit https://gerrit.osmocom.org/9858 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: simtrace2 Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Id7cb0db568dd3e9d796829bf0019d63048612998 Gerrit-Change-Number: 9858 Gerrit-PatchSet: 1 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Kévin Redon Gerrit-Comment-Date: Wed, 04 Jul 2018 12:47:53 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in simtrace2[master]: qmod: Add 'e' command for erasing the EEPROM
Kévin Redon has posted comments on this change. ( https://gerrit.osmocom.org/9858 ) Change subject: qmod: Add 'e' command for erasing the EEPROM .. Patch Set 1: Code-Review+1 (1 comment) https://gerrit.osmocom.org/#/c/9858/1/firmware/libboard/qmod/source/board_qmod.c File firmware/libboard/qmod/source/board_qmod.c: https://gerrit.osmocom.org/#/c/9858/1/firmware/libboard/qmod/source/board_qmod.c@103 PS1, Line 103: --; this can cause an endless loop, halted by the watchdog. alternative: print error message instead and continue with erasing the rest (or stop erasing) -- To view, visit https://gerrit.osmocom.org/9858 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: simtrace2 Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Id7cb0db568dd3e9d796829bf0019d63048612998 Gerrit-Change-Number: 9858 Gerrit-PatchSet: 1 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Kévin Redon Gerrit-Comment-Date: Wed, 04 Jul 2018 12:23:13 + Gerrit-HasComments: Yes Gerrit-HasLabels: Yes
Change in simtrace2[master]: qmod: Add 'e' command for erasing the EEPROM
Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/9858 Change subject: qmod: Add 'e' command for erasing the EEPROM .. qmod: Add 'e' command for erasing the EEPROM Change-Id: Id7cb0db568dd3e9d796829bf0019d63048612998 --- M firmware/libboard/qmod/source/board_qmod.c 1 file changed, 24 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/58/9858/1 diff --git a/firmware/libboard/qmod/source/board_qmod.c b/firmware/libboard/qmod/source/board_qmod.c index dd6e616..c4065eb 100644 --- a/firmware/libboard/qmod/source/board_qmod.c +++ b/firmware/libboard/qmod/source/board_qmod.c @@ -87,6 +87,26 @@ return 0; } +static int erase_hub_eeprom(void) +{ + int i; + + /* wait */ + mdelay(100); + + TRACE_INFO("Erasing EEPROM...\n\r"); + /* write the EEPROM once */ + for (i = 0; i < 256; i++) { + int rc = eeprom_write_byte(0x50, i, 0xff); + /* if the result was negative, repeat that write */ + if (rc < 0) + i--; + } + + return 0; +} + + static void board_exec_dbg_cmd_st12only(int ch) { uint32_t addr, val; @@ -99,6 +119,9 @@ case 'E': write_hub_eeprom(); break; + case 'e': + erase_hub_eeprom(); + break; case 'O': printf("Setting PRTPWR_OVERRIDE\n\r"); PIO_Set(_hubpwr_override); @@ -146,6 +169,7 @@ printf("\tR\treset SAM3\n\r"); if (qmod_sam3_is_12()) { printf("\tE\tprogram EEPROM\n\r"); + printf("\te\tErase EEPROM\n\r"); printf("\tO\tEnable PRTPWR_OVERRIDE\n\r"); printf("\to\tDisable PRTPWR_OVERRIDE\n\r"); printf("\tH\tRelease HUB RESET (high)\n\r"); -- To view, visit https://gerrit.osmocom.org/9858 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: simtrace2 Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: Id7cb0db568dd3e9d796829bf0019d63048612998 Gerrit-Change-Number: 9858 Gerrit-PatchSet: 1 Gerrit-Owner: Harald Welte