mimxrt1050_evk: eth_mcux: driver fixup

Boot PHY initialization timeout, caching mechanism fixes and networking
buffer descriptors moved to no cache section. Enabled cache management
in networking driver and manual barriers.

Signed-off-by: Andrei Gansari <andrei.gansari@nxp.com>
This commit is contained in:
Andrei Gansari 2019-01-31 13:00:56 +02:00 committed by Maureen Helm
parent 6d36f2e2f4
commit 0787936d15
4 changed files with 29 additions and 2 deletions

View File

@ -151,11 +151,24 @@ static int mimxrt1050_evk_init(struct device *dev)
/* pull up the ENET_INT before RESET. */
GPIO_WritePinOutput(GPIO1, 10, 1);
/* RESET PHY chip. */
GPIO_WritePinOutput(GPIO1, 9, 1);
GPIO_WritePinOutput(GPIO1, 9, 0);
#endif
return 0;
}
#ifdef CONFIG_ETH_MCUX_0
static int mimxrt1050_evk_phy_reset(struct device *dev)
{
/* RESET PHY chip. */
k_busy_wait(10*USEC_PER_MSEC);
GPIO_WritePinOutput(GPIO1, 9, 1);
return 0;
}
#endif
SYS_INIT(mimxrt1050_evk_init, PRE_KERNEL_1, 0);
#ifdef CONFIG_ETH_MCUX_0
SYS_INIT(mimxrt1050_evk_phy_reset, PRE_KERNEL_2, 0);
#endif

View File

@ -107,11 +107,19 @@ struct eth_context {
static void eth_0_config_func(void);
#ifdef CONFIG_HAS_MCUX_CACHE
static __nocache enet_rx_bd_struct_t __aligned(ENET_BUFF_ALIGNMENT)
rx_buffer_desc[CONFIG_ETH_MCUX_RX_BUFFERS];
static __nocache enet_tx_bd_struct_t __aligned(ENET_BUFF_ALIGNMENT)
tx_buffer_desc[CONFIG_ETH_MCUX_TX_BUFFERS];
#else
static enet_rx_bd_struct_t __aligned(ENET_BUFF_ALIGNMENT)
rx_buffer_desc[CONFIG_ETH_MCUX_RX_BUFFERS];
static enet_tx_bd_struct_t __aligned(ENET_BUFF_ALIGNMENT)
tx_buffer_desc[CONFIG_ETH_MCUX_TX_BUFFERS];
#endif
#if defined(CONFIG_PTP_CLOCK_MCUX)
/* Packets to be timestamped. */
@ -319,6 +327,7 @@ static void eth_mcux_phy_event(struct eth_context *context)
context->link_up = link_up;
context->phy_state = eth_mcux_phy_state_read_duplex;
net_eth_carrier_on(context->iface);
k_sleep(USEC_PER_MSEC);
} else if (!link_up && context->link_up) {
LOG_INF("Link down");
context->link_up = link_up;

View File

@ -885,6 +885,7 @@ static void ENET_SetRxBufferDescriptors(enet_handle_t *handle,
static void ENET_ActiveSend(ENET_Type *base, uint32_t ringId)
{
assert(ringId < FSL_FEATURE_ENET_QUEUE);
__DSB();
switch (ringId)
{
@ -1476,6 +1477,8 @@ static void ENET_UpdateReadBuffers(ENET_Type *base, enet_handle_t *handle, uint3
handle->rxBdCurrent[ringId]++;
}
__DSB();
/* Actives the receive buffer descriptor. */
switch (ringId)
{

View File

@ -885,6 +885,7 @@ static void ENET_SetRxBufferDescriptors(enet_handle_t *handle,
static void ENET_ActiveSend(ENET_Type *base, uint32_t ringId)
{
assert(ringId < FSL_FEATURE_ENET_QUEUE);
__DSB();
switch (ringId)
{
@ -1476,6 +1477,7 @@ static void ENET_UpdateReadBuffers(ENET_Type *base, enet_handle_t *handle, uint3
handle->rxBdCurrent[ringId]++;
}
__DSB();
/* Actives the receive buffer descriptor. */
switch (ringId)
{