Skip to content

Commit c006dbe

Browse files
JiafeiPanfabiobaltieri
authored andcommitted
drivers: ethernet: netc_psi: add MMIPO mapping support
In order to support MMU mapping on Cortex-A core, added MMIO mapping support in imx_netc_psi driver. Signed-off-by: Jiafei Pan <[email protected]>
1 parent e98a2c3 commit c006dbe

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

drivers/ethernet/nxp_imx_netc/eth_nxp_imx_netc_priv.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@
8686
}
8787

8888
struct netc_eth_config {
89+
DEVICE_MMIO_NAMED_ROM(port);
90+
DEVICE_MMIO_NAMED_ROM(pfconfig);
8991
uint16_t si_idx;
9092
const struct device *phy_dev;
9193
netc_hw_mii_mode_t phy_mode;
@@ -109,6 +111,8 @@ struct netc_eth_config {
109111
typedef uint8_t rx_buffer_t[NETC_RX_RING_BUF_SIZE_ALIGN];
110112

111113
struct netc_eth_data {
114+
DEVICE_MMIO_NAMED_RAM(port);
115+
DEVICE_MMIO_NAMED_RAM(pfconfig);
112116
ep_handle_t handle;
113117
struct net_if *iface;
114118
uint8_t mac_addr[6];

drivers/ethernet/nxp_imx_netc/eth_nxp_imx_netc_psi.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ LOG_MODULE_REGISTER(nxp_imx_eth_psi);
2222
#include "../eth.h"
2323
#include "eth_nxp_imx_netc_priv.h"
2424

25+
#define DEV_CFG(_dev) ((const struct netc_eth_config *)(_dev)->config)
26+
#define DEV_DATA(_dev) ((struct netc_eth_data *)(_dev)->data)
27+
2528
static void netc_eth_phylink_callback(const struct device *pdev, struct phy_link_state *state,
2629
void *user_data)
2730
{
@@ -104,6 +107,9 @@ static int netc_eth_init(const struct device *dev)
104107
const struct netc_eth_config *cfg = dev->config;
105108
int err;
106109

110+
DEVICE_MMIO_NAMED_MAP(dev, port, K_MEM_CACHE_NONE | K_MEM_DIRECT_MAP);
111+
DEVICE_MMIO_NAMED_MAP(dev, pfconfig, K_MEM_CACHE_NONE | K_MEM_DIRECT_MAP);
112+
107113
if (cfg->pseudo_mac) {
108114
goto init_common;
109115
}
@@ -192,6 +198,8 @@ static const struct ethernet_api netc_eth_api = {.iface_api.init = netc_eth_ifac
192198
.rx_frame = eth##n##_rx_frame, \
193199
}; \
194200
static const struct netc_eth_config netc_eth##n##_config = { \
201+
DEVICE_MMIO_NAMED_ROM_INIT_BY_NAME(port, DT_DRV_INST(n)), \
202+
DEVICE_MMIO_NAMED_ROM_INIT_BY_NAME(pfconfig, DT_DRV_INST(n)), \
195203
.generate_mac = netc_eth##n##_generate_mac, \
196204
.bdr_init = netc_eth##n##_bdr_init, \
197205
.phy_dev = (COND_CODE_1(DT_INST_NODE_HAS_PROP(n, phy_handle), \

0 commit comments

Comments
 (0)