1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 17:52:47 +01:00

cpu/saml21: add clock configuration for usbdev

Co-authored-by: dylad <dylan.laduranty@mesotic.com>
This commit is contained in:
Antonio Galea 2019-08-29 12:30:42 +02:00
parent 1ad2d07181
commit 3076ee837d
2 changed files with 11 additions and 2 deletions

View File

@ -82,8 +82,14 @@ static void _xosc32k_setup(void)
void sam0_gclk_enable(uint8_t id) void sam0_gclk_enable(uint8_t id)
{ {
(void) id; switch(id) {
/* clocks are always running */ case SAM0_GCLK_48MHZ:
_gclk_setup(SAM0_GCLK_48MHZ, GCLK_GENCTRL_GENEN |
GCLK_GENCTRL_SRC_DFLL48M);
break;
default:
break;
}
} }
uint32_t sam0_gclk_freq(uint8_t id) uint32_t sam0_gclk_freq(uint8_t id)
@ -95,6 +101,8 @@ uint32_t sam0_gclk_freq(uint8_t id)
return 8000000; return 8000000;
case SAM0_GCLK_32KHZ: case SAM0_GCLK_32KHZ:
return 32768; return 32768;
case SAM0_GCLK_48MHZ:
return 48000000;
default: default:
return 0; return 0;
} }

View File

@ -46,6 +46,7 @@ enum {
SAM0_GCLK_MAIN = 0, /**< Main clock */ SAM0_GCLK_MAIN = 0, /**< Main clock */
SAM0_GCLK_8MHZ = 1, /**< 8MHz clock */ SAM0_GCLK_8MHZ = 1, /**< 8MHz clock */
SAM0_GCLK_32KHZ = 2, /**< 32 kHz clock */ SAM0_GCLK_32KHZ = 2, /**< 32 kHz clock */
SAM0_GCLK_48MHZ = 3, /**< 48MHz clock */
}; };
/** @} */ /** @} */