Change in simtrace2[master]: firmware: add definition for main osc bypass when using external osc
James Tavares has uploaded this change for review. ( https://gerrit.osmocom.org/c/simtrace2/+/26861 ) Change subject: firmware: add definition for main osc bypass when using external osc ...................................................................... firmware: add definition for main osc bypass when using external osc Add new board.h definition BOARD_MAINOSC_BYPASS to configure the clock module to use an external oscillator rather than a crystal. The qmod board is one such board. Change-Id: If62f55cd4c8b0cf758534f09d25a9bcb028814a7 --- M firmware/libboard/common/source/board_lowlevel.c M firmware/libboard/qmod/include/board.h 2 files changed, 6 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/61/26861/1 diff --git a/firmware/libboard/common/source/board_lowlevel.c b/firmware/libboard/common/source/board_lowlevel.c index 1ddbcba..a04ce10 100644 --- a/firmware/libboard/common/source/board_lowlevel.c +++ b/firmware/libboard/common/source/board_lowlevel.c @@ -147,7 +147,7 @@ } */ -#ifndef qmod +#ifndef BOARD_MAINOSC_BYPASS /* Initialize main oscillator */ if ( !(PMC->CKGR_MOR & CKGR_MOR_MOSCSEL) ) { @@ -165,11 +165,11 @@ timeout = 0; while (!(PMC->PMC_SR & PMC_SR_MOSCSELS) && (timeout++ < CLOCK_TIMEOUT)); #else - /* QMOD has external 12MHz clock source */ + /* Board has external clock, not a crystal oscillator */ PIOB->PIO_PDR = (1 << 9); PIOB->PIO_PUDR = (1 << 9); PIOB->PIO_PPDDR = (1 << 9); - PMC->CKGR_MOR = CKGR_MOR_KEY(0x37) | CKGR_MOR_MOSCRCEN | CKGR_MOR_MOSCXTBY| CKGR_MOR_MOSCSEL; + PMC->CKGR_MOR = CKGR_MOR_KEY(0x37) | CKGR_MOR_MOSCRCEN | CKGR_MOR_MOSCXTBY | CKGR_MOR_MOSCSEL; #endif /* disable the red LED after main clock initialization */ diff --git a/firmware/libboard/qmod/include/board.h b/firmware/libboard/qmod/include/board.h index 6d7d4ff..7ea5bd7 100644 --- a/firmware/libboard/qmod/include/board.h +++ b/firmware/libboard/qmod/include/board.h @@ -25,6 +25,8 @@ #define BOARD_MAINOSC 12000000 /** desired main clock frequency (in Hz, based on BOARD_MAINOSC) */ #define BOARD_MCK 58000000 // 18.432 * 29 / 6 +/** board has external clock, not crystal */ +#define BOARD_MAINOSC_BYPASS /** MCU pin connected to red LED */ #define PIO_LED_RED PIO_PA17 @@ -35,7 +37,7 @@ /** green LED pin definition */ #define PIN_LED_GREEN {PIO_LED_GREEN, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT} /** LEDs pin definition */ -#define PINS_LEDS PIN_LED_RED, PIN_LED_GREEN +#define PINS_LEDS PIN_LED_RED, PIN_LED_GREEN /** index for red LED in LEDs pin definition array */ #define LED_NUM_RED 0 /** index for green LED in LEDs pin definition array */ -- To view, visit https://gerrit.osmocom.org/c/simtrace2/+/26861 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: simtrace2 Gerrit-Branch: master Gerrit-Change-Id: If62f55cd4c8b0cf758534f09d25a9bcb028814a7 Gerrit-Change-Number: 26861 Gerrit-PatchSet: 1 Gerrit-Owner: James Tavares <jtavares@kvh.com> Gerrit-MessageType: newchange
laforge has posted comments on this change. ( https://gerrit.osmocom.org/c/simtrace2/+/26861 ) Change subject: firmware: add definition for main osc bypass when using external osc ...................................................................... Patch Set 1: Code-Review+2 -- To view, visit https://gerrit.osmocom.org/c/simtrace2/+/26861 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: simtrace2 Gerrit-Branch: master Gerrit-Change-Id: If62f55cd4c8b0cf758534f09d25a9bcb028814a7 Gerrit-Change-Number: 26861 Gerrit-PatchSet: 1 Gerrit-Owner: James Tavares <jtavares@kvh.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge@osmocom.org> Gerrit-Reviewer: tsaitgaist <kredon@sysmocom.de> Gerrit-Comment-Date: Tue, 11 Jan 2022 13:08:18 +0000 Gerrit-HasComments: No Gerrit-Has-Labels: Yes Gerrit-MessageType: comment
laforge has submitted this change. ( https://gerrit.osmocom.org/c/simtrace2/+/26861 ) Change subject: firmware: add definition for main osc bypass when using external osc ...................................................................... firmware: add definition for main osc bypass when using external osc Add new board.h definition BOARD_MAINOSC_BYPASS to configure the clock module to use an external oscillator rather than a crystal. The qmod board is one such board. Change-Id: If62f55cd4c8b0cf758534f09d25a9bcb028814a7 --- M firmware/libboard/common/source/board_lowlevel.c M firmware/libboard/qmod/include/board.h 2 files changed, 6 insertions(+), 4 deletions(-) Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified diff --git a/firmware/libboard/common/source/board_lowlevel.c b/firmware/libboard/common/source/board_lowlevel.c index 1ddbcba..a04ce10 100644 --- a/firmware/libboard/common/source/board_lowlevel.c +++ b/firmware/libboard/common/source/board_lowlevel.c @@ -147,7 +147,7 @@ } */ -#ifndef qmod +#ifndef BOARD_MAINOSC_BYPASS /* Initialize main oscillator */ if ( !(PMC->CKGR_MOR & CKGR_MOR_MOSCSEL) ) { @@ -165,11 +165,11 @@ timeout = 0; while (!(PMC->PMC_SR & PMC_SR_MOSCSELS) && (timeout++ < CLOCK_TIMEOUT)); #else - /* QMOD has external 12MHz clock source */ + /* Board has external clock, not a crystal oscillator */ PIOB->PIO_PDR = (1 << 9); PIOB->PIO_PUDR = (1 << 9); PIOB->PIO_PPDDR = (1 << 9); - PMC->CKGR_MOR = CKGR_MOR_KEY(0x37) | CKGR_MOR_MOSCRCEN | CKGR_MOR_MOSCXTBY| CKGR_MOR_MOSCSEL; + PMC->CKGR_MOR = CKGR_MOR_KEY(0x37) | CKGR_MOR_MOSCRCEN | CKGR_MOR_MOSCXTBY | CKGR_MOR_MOSCSEL; #endif /* disable the red LED after main clock initialization */ diff --git a/firmware/libboard/qmod/include/board.h b/firmware/libboard/qmod/include/board.h index 6d7d4ff..7ea5bd7 100644 --- a/firmware/libboard/qmod/include/board.h +++ b/firmware/libboard/qmod/include/board.h @@ -25,6 +25,8 @@ #define BOARD_MAINOSC 12000000 /** desired main clock frequency (in Hz, based on BOARD_MAINOSC) */ #define BOARD_MCK 58000000 // 18.432 * 29 / 6 +/** board has external clock, not crystal */ +#define BOARD_MAINOSC_BYPASS /** MCU pin connected to red LED */ #define PIO_LED_RED PIO_PA17 @@ -35,7 +37,7 @@ /** green LED pin definition */ #define PIN_LED_GREEN {PIO_LED_GREEN, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT} /** LEDs pin definition */ -#define PINS_LEDS PIN_LED_RED, PIN_LED_GREEN +#define PINS_LEDS PIN_LED_RED, PIN_LED_GREEN /** index for red LED in LEDs pin definition array */ #define LED_NUM_RED 0 /** index for green LED in LEDs pin definition array */ -- To view, visit https://gerrit.osmocom.org/c/simtrace2/+/26861 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: simtrace2 Gerrit-Branch: master Gerrit-Change-Id: If62f55cd4c8b0cf758534f09d25a9bcb028814a7 Gerrit-Change-Number: 26861 Gerrit-PatchSet: 2 Gerrit-Owner: James Tavares <jtavares@kvh.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: laforge <laforge@osmocom.org> Gerrit-Reviewer: tsaitgaist <kredon@sysmocom.de> Gerrit-MessageType: merged
participants (2)
-
James Tavares -
laforge