output 50 MHz for RMII

in hardware revision 2 the Ethernet PHY RMII_CLOCK input clock is
connected to the MCU pin PA10.
GCLK4 of the MCU now outputs the required 50 MHz clock on this pin.
the same clock is re-used for UART debug to generate the 921600
bps baud rate.

Change-Id: Id3a3dee15c3986536b0623d0f39ca62e94acd1fd
This commit is contained in:
Kevin Redon 2019-04-25 13:55:06 +02:00
parent 0c3533fc09
commit f53d366c1d
5 changed files with 63 additions and 5 deletions

View File

@ -702,7 +702,7 @@ drivers:
gclk_arch_gen_3_runstdby: false
gclk_arch_gen_4_enable: true
gclk_arch_gen_4_idc: false
gclk_arch_gen_4_oe: false
gclk_arch_gen_4_oe: true
gclk_arch_gen_4_oov: false
gclk_arch_gen_4_runstdby: false
gclk_arch_gen_5_enable: true
@ -748,7 +748,7 @@ drivers:
gclk_gen_3_div: 1
gclk_gen_3_div_sel: false
gclk_gen_3_oscillator: 32kHz External Crystal Oscillator (XOSC32K)
gclk_gen_4_div: 1
gclk_gen_4_div: 2
gclk_gen_4_div_sel: false
gclk_gen_4_oscillator: Digital Phase Locked Loop (DPLL1)
gclk_gen_5_div: 5
@ -1462,6 +1462,16 @@ pads:
mode: Peripheral IO
user_label: SIM2_IO
configuration: null
RMII_CLOCK:
name: PA10
definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PA10
mode: Advanced
user_label: RMII_CLOCK
configuration:
pad_direction: Out
pad_function: M
pad_initial_level: Low
pad_pull_config: 'Off'
SIMCLK_20MHZ:
name: PA11
definition: Atmel:SAME54_Drivers:0.0.1::SAME54N19A-AF::pad::PA11

View File

@ -31,6 +31,7 @@
#define SIM5_INT GPIO(GPIO_PORTA, 3)
#define SIM0_IO GPIO(GPIO_PORTA, 4)
#define SIM2_IO GPIO(GPIO_PORTA, 9)
#define RMII_CLOCK GPIO(GPIO_PORTA, 10)
#define SIMCLK_20MHZ GPIO(GPIO_PORTA, 11)
#define SIM1_IO GPIO(GPIO_PORTA, 16)
#define VB0 GPIO(GPIO_PORTA, 20)

View File

@ -349,7 +349,7 @@
// <i> Indicates whether Output Enable is enabled or not
// <id> gclk_arch_gen_4_oe
#ifndef CONF_GCLK_GEN_4_OE
#define CONF_GCLK_GEN_4_OE 0
#define CONF_GCLK_GEN_4_OE 1
#endif
// <q> Output Off Value
@ -378,7 +378,7 @@
//<o> Generic clock generator 4 division <0x0000-0xFFFF>
// <id> gclk_gen_4_div
#ifndef CONF_GCLK_GEN_4_DIV
#define CONF_GCLK_GEN_4_DIV 1
#define CONF_GCLK_GEN_4_DIV 2
#endif
// </h>
// </e>

View File

@ -641,7 +641,7 @@
* \brief SERCOM7's Core Clock frequency
*/
#ifndef CONF_GCLK_SERCOM7_CORE_FREQUENCY
#define CONF_GCLK_SERCOM7_CORE_FREQUENCY 100000000
#define CONF_GCLK_SERCOM7_CORE_FREQUENCY 50000000
#endif
/**

View File

@ -503,6 +503,53 @@ void system_init(void)
gpio_set_pin_function(SIM5_INT, GPIO_PIN_FUNCTION_OFF);
// GPIO on PA10
gpio_set_pin_direction(RMII_CLOCK,
// <y> Pin direction
// <id> pad_direction
// <GPIO_DIRECTION_OFF"> Off
// <GPIO_DIRECTION_IN"> In
// <GPIO_DIRECTION_OUT"> Out
GPIO_DIRECTION_OUT);
gpio_set_pin_level(RMII_CLOCK,
// <y> Initial level
// <id> pad_initial_level
// <false"> Low
// <true"> High
false);
gpio_set_pin_pull_mode(RMII_CLOCK,
// <y> Pull configuration
// <id> pad_pull_config
// <GPIO_PULL_OFF"> Off
// <GPIO_PULL_UP"> Pull-up
// <GPIO_PULL_DOWN"> Pull-down
GPIO_PULL_OFF);
gpio_set_pin_function(RMII_CLOCK,
// <y> Pin function
// <id> pad_function
// <i> Auto : use driver pinmux if signal is imported by driver, else turn off function
// <GPIO_PIN_FUNCTION_OFF"> Auto
// <GPIO_PIN_FUNCTION_OFF"> Off
// <GPIO_PIN_FUNCTION_A"> A
// <GPIO_PIN_FUNCTION_B"> B
// <GPIO_PIN_FUNCTION_C"> C
// <GPIO_PIN_FUNCTION_D"> D
// <GPIO_PIN_FUNCTION_E"> E
// <GPIO_PIN_FUNCTION_F"> F
// <GPIO_PIN_FUNCTION_G"> G
// <GPIO_PIN_FUNCTION_H"> H
// <GPIO_PIN_FUNCTION_I"> I
// <GPIO_PIN_FUNCTION_J"> J
// <GPIO_PIN_FUNCTION_K"> K
// <GPIO_PIN_FUNCTION_L"> L
// <GPIO_PIN_FUNCTION_M"> M
// <GPIO_PIN_FUNCTION_N"> N
GPIO_PIN_FUNCTION_M);
// GPIO on PA11
gpio_set_pin_direction(SIMCLK_20MHZ,