mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-30 21:18:25 +00:00
strap PHY in hal, remove manual config in Mongoose
This commit is contained in:
1 parent
a688c0a0f0
commit
3566f7c7fe
4 files changed
+27
-13
No files matched your search
@@ -21,7 +21,7 @@ SOURCES += cmsis_rt1186/devices/MIMXRT1186/drivers/fsl_ele_base_api.c
|
||||
SOURCES += cmsis_rt1186/devices/MIMXRT1186/drivers/fsl_s3mu.c
|
||||
SOURCES += cmsis_rt1186/devices/MIMXRT1186/drivers/fsl_trdc.c
|
||||
|
||||
CFLAGS += -D__ATOLLIC__ -D__STARTUP_CLEAR_BSS -DMG_HAL_DISABLE_RANDOM
|
||||
CFLAGS += -D__ATOLLIC__ -D__STARTUP_CLEAR_BSS -DMG_HAL_DISABLE_RANDOM -DMG_HAL_ENABLE_PHY_STRAP
|
||||
|
||||
all build: firmware.bin
|
||||
|
||||
|
||||
@@ -586,9 +586,6 @@ static inline void hal_netc_pins_init(void) {
|
||||
CLOCK_EnableClock(kCLOCK_Iomuxc1);
|
||||
CLOCK_EnableClock(kCLOCK_Iomuxc2);
|
||||
|
||||
hal_gpio_output(HAL_NETC_PHY0_RESET);
|
||||
hal_gpio_write(HAL_NETC_PHY0_RESET, true);
|
||||
|
||||
hal_gpio_mux_config(kIOMUXC_SW_MUX_CTL_PAD_GPIO_AD_30, 7U); // EMDC
|
||||
hal_gpio_pad_config(kIOMUXC_SW_PAD_CTL_PAD_GPIO_AD_30,
|
||||
HAL_GPIO_OTYPE_PUSH_PULL, HAL_GPIO_SPEED_HIGH,
|
||||
@@ -648,13 +645,27 @@ static inline bool hal_netc_ierb_init(void) {
|
||||
static inline void hal_ethernet_init(void) {
|
||||
hal_netc_trdc_init();
|
||||
CLOCK_EnableClock(kCLOCK_Netc);
|
||||
hal_netc_pins_init();
|
||||
if (!hal_netc_ierb_init()) return;
|
||||
|
||||
hal_gpio_output(HAL_NETC_PHY0_RESET);
|
||||
hal_gpio_write(HAL_NETC_PHY0_RESET, false);
|
||||
SDK_DelayAtLeastUs(10000U, SYS_FREQUENCY);
|
||||
#if MG_HAL_ENABLE_PHY_STRAP
|
||||
hal_gpio_output(PIN('3', 10)); // RX_CLK PHY ADDR1
|
||||
hal_gpio_output(PIN('3', 11)); // RX_DATA_2 CFG_MODE1
|
||||
hal_gpio_output(PIN('3', 12)); // RX_DATA_3 CFG_MODE2
|
||||
hal_gpio_output(PIN('3', 20)); // RX_DATA_1 CFG_MODE0
|
||||
hal_gpio_write(PIN('3', 10), false); // PHY ADDR b101 = 5
|
||||
hal_gpio_write(PIN('3', 12), false); // CFG_MODE 000: RGMII
|
||||
hal_gpio_write(PIN('3', 11), false); //
|
||||
hal_gpio_write(PIN('3', 20), false); //
|
||||
#endif
|
||||
SDK_DelayAtLeastUs(15000U, SYS_FREQUENCY);
|
||||
hal_gpio_write(HAL_NETC_PHY0_RESET, true);
|
||||
SDK_DelayAtLeastUs(150000U, SYS_FREQUENCY);
|
||||
__DSB(); // ensure pin config happens AFTER reset is released
|
||||
SDK_DelayAtLeastUs(10U, SYS_FREQUENCY); // provide some hold time
|
||||
hal_netc_pins_init(); // release straps, set as Ethernet pins
|
||||
if (!hal_netc_ierb_init())
|
||||
return;
|
||||
SDK_DelayAtLeastUs(15000U, SYS_FREQUENCY);
|
||||
|
||||
NVIC_EnableIRQ(MSGINTR1_IRQn);
|
||||
}
|
||||
|
||||
@@ -664,3 +675,4 @@ static inline void hal_rng_init(void) {
|
||||
static inline uint32_t hal_rng_read(void) {
|
||||
return 42;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user