drivers: ethernet: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and dev->config instead. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
d3443cc8c1
commit
6f6a178390
13 changed files with 141 additions and 157 deletions
|
@ -90,7 +90,7 @@ DT_INST_FOREACH_STATUS_OKAY(ETH_XLNX_GEM_INITIALIZE)
|
|||
*/
|
||||
static int eth_xlnx_gem_dev_init(const struct device *dev)
|
||||
{
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = DEV_CFG(dev);
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = dev->config;
|
||||
uint32_t reg_val;
|
||||
|
||||
/* Precondition checks using assertions */
|
||||
|
@ -219,8 +219,8 @@ static int eth_xlnx_gem_dev_init(const struct device *dev)
|
|||
static void eth_xlnx_gem_iface_init(struct net_if *iface)
|
||||
{
|
||||
const struct device *dev = net_if_get_device(iface);
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = DEV_CFG(dev);
|
||||
struct eth_xlnx_gem_dev_data *dev_data = DEV_DATA(dev);
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = dev->config;
|
||||
struct eth_xlnx_gem_dev_data *dev_data = dev->data;
|
||||
|
||||
/* Set the initial contents of the current instance's run-time data */
|
||||
dev_data->iface = iface;
|
||||
|
@ -264,8 +264,8 @@ static void eth_xlnx_gem_iface_init(struct net_if *iface)
|
|||
*/
|
||||
static void eth_xlnx_gem_isr(const struct device *dev)
|
||||
{
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = DEV_CFG(dev);
|
||||
struct eth_xlnx_gem_dev_data *dev_data = DEV_DATA(dev);
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = dev->config;
|
||||
struct eth_xlnx_gem_dev_data *dev_data = dev->data;
|
||||
uint32_t reg_val;
|
||||
|
||||
/* Read the interrupt status register */
|
||||
|
@ -344,8 +344,8 @@ static void eth_xlnx_gem_isr(const struct device *dev)
|
|||
*/
|
||||
static int eth_xlnx_gem_send(const struct device *dev, struct net_pkt *pkt)
|
||||
{
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = DEV_CFG(dev);
|
||||
struct eth_xlnx_gem_dev_data *dev_data = DEV_DATA(dev);
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = dev->config;
|
||||
struct eth_xlnx_gem_dev_data *dev_data = dev->data;
|
||||
|
||||
uint16_t tx_data_length;
|
||||
uint16_t tx_data_remaining;
|
||||
|
@ -519,8 +519,8 @@ static int eth_xlnx_gem_send(const struct device *dev, struct net_pkt *pkt)
|
|||
*/
|
||||
static int eth_xlnx_gem_start_device(const struct device *dev)
|
||||
{
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = DEV_CFG(dev);
|
||||
struct eth_xlnx_gem_dev_data *dev_data = DEV_DATA(dev);
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = dev->config;
|
||||
struct eth_xlnx_gem_dev_data *dev_data = dev->data;
|
||||
uint32_t reg_val;
|
||||
|
||||
if (dev_data->started) {
|
||||
|
@ -568,8 +568,8 @@ static int eth_xlnx_gem_start_device(const struct device *dev)
|
|||
*/
|
||||
static int eth_xlnx_gem_stop_device(const struct device *dev)
|
||||
{
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = DEV_CFG(dev);
|
||||
struct eth_xlnx_gem_dev_data *dev_data = DEV_DATA(dev);
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = dev->config;
|
||||
struct eth_xlnx_gem_dev_data *dev_data = dev->data;
|
||||
uint32_t reg_val;
|
||||
|
||||
if (!dev_data->started) {
|
||||
|
@ -613,7 +613,7 @@ static int eth_xlnx_gem_stop_device(const struct device *dev)
|
|||
static enum ethernet_hw_caps eth_xlnx_gem_get_capabilities(
|
||||
const struct device *dev)
|
||||
{
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = DEV_CFG(dev);
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = dev->config;
|
||||
enum ethernet_hw_caps caps = (enum ethernet_hw_caps)0;
|
||||
|
||||
if (dev_conf->max_link_speed == LINK_1GBIT) {
|
||||
|
@ -664,7 +664,9 @@ static enum ethernet_hw_caps eth_xlnx_gem_get_capabilities(
|
|||
*/
|
||||
static struct net_stats_eth *eth_xlnx_gem_stats(const struct device *dev)
|
||||
{
|
||||
return &(DEV_DATA(dev)->stats);
|
||||
struct eth_xlnx_gem_dev_data *dev_data = dev->data;
|
||||
|
||||
return &data->stats;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -677,7 +679,7 @@ static struct net_stats_eth *eth_xlnx_gem_stats(const struct device *dev)
|
|||
*/
|
||||
static void eth_xlnx_gem_reset_hw(const struct device *dev)
|
||||
{
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = DEV_CFG(dev);
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = dev->config;
|
||||
|
||||
/*
|
||||
* Controller reset sequence as described in the Zynq-7000 TRM,
|
||||
|
@ -726,8 +728,8 @@ static void eth_xlnx_gem_configure_clocks(const struct device *dev)
|
|||
* values for the respective GEM's TX clock are calculated here.
|
||||
*/
|
||||
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = DEV_CFG(dev);
|
||||
struct eth_xlnx_gem_dev_data *dev_data = DEV_DATA(dev);
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = dev->config;
|
||||
struct eth_xlnx_gem_dev_data *dev_data = dev->data;
|
||||
|
||||
uint32_t div0;
|
||||
uint32_t div1;
|
||||
|
@ -853,7 +855,7 @@ static void eth_xlnx_gem_configure_clocks(const struct device *dev)
|
|||
*/
|
||||
static void eth_xlnx_gem_set_initial_nwcfg(const struct device *dev)
|
||||
{
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = DEV_CFG(dev);
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = dev->config;
|
||||
uint32_t reg_val = 0;
|
||||
|
||||
if (dev_conf->ignore_ipg_rxer) {
|
||||
|
@ -973,8 +975,8 @@ static void eth_xlnx_gem_set_initial_nwcfg(const struct device *dev)
|
|||
*/
|
||||
static void eth_xlnx_gem_set_nwcfg_link_speed(const struct device *dev)
|
||||
{
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = DEV_CFG(dev);
|
||||
struct eth_xlnx_gem_dev_data *dev_data = DEV_DATA(dev);
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = dev->config;
|
||||
struct eth_xlnx_gem_dev_data *dev_data = dev->data;
|
||||
uint32_t reg_val;
|
||||
|
||||
/*
|
||||
|
@ -1007,8 +1009,8 @@ static void eth_xlnx_gem_set_nwcfg_link_speed(const struct device *dev)
|
|||
*/
|
||||
static void eth_xlnx_gem_set_mac_address(const struct device *dev)
|
||||
{
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = DEV_CFG(dev);
|
||||
struct eth_xlnx_gem_dev_data *dev_data = DEV_DATA(dev);
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = dev->config;
|
||||
struct eth_xlnx_gem_dev_data *dev_data = dev->data;
|
||||
uint32_t regval_top;
|
||||
uint32_t regval_bot;
|
||||
|
||||
|
@ -1043,7 +1045,7 @@ static void eth_xlnx_gem_set_mac_address(const struct device *dev)
|
|||
*/
|
||||
static void eth_xlnx_gem_set_initial_dmacr(const struct device *dev)
|
||||
{
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = DEV_CFG(dev);
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = dev->config;
|
||||
uint32_t reg_val = 0;
|
||||
|
||||
/*
|
||||
|
@ -1110,7 +1112,7 @@ static void eth_xlnx_gem_set_initial_dmacr(const struct device *dev)
|
|||
*/
|
||||
static void eth_xlnx_gem_init_phy(const struct device *dev)
|
||||
{
|
||||
struct eth_xlnx_gem_dev_data *dev_data = DEV_DATA(dev);
|
||||
struct eth_xlnx_gem_dev_data *dev_data = dev->data;
|
||||
int detect_rc;
|
||||
|
||||
LOG_DBG("%s attempting to initialize associated PHY", dev->name);
|
||||
|
@ -1162,7 +1164,7 @@ static void eth_xlnx_gem_poll_phy(struct k_work *work)
|
|||
struct eth_xlnx_gem_dev_data *dev_data = CONTAINER_OF(dwork,
|
||||
struct eth_xlnx_gem_dev_data, phy_poll_delayed_work);
|
||||
const struct device *dev = net_if_get_device(dev_data->iface);
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = DEV_CFG(dev);
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = dev->config;
|
||||
|
||||
uint16_t phy_status;
|
||||
uint8_t link_status;
|
||||
|
@ -1257,8 +1259,8 @@ static void eth_xlnx_gem_poll_phy(struct k_work *work)
|
|||
*/
|
||||
static void eth_xlnx_gem_configure_buffers(const struct device *dev)
|
||||
{
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = DEV_CFG(dev);
|
||||
struct eth_xlnx_gem_dev_data *dev_data = DEV_DATA(dev);
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = dev->config;
|
||||
struct eth_xlnx_gem_dev_data *dev_data = dev->data;
|
||||
struct eth_xlnx_gem_bd *bdptr;
|
||||
uint32_t buf_iter;
|
||||
|
||||
|
@ -1372,8 +1374,8 @@ static void eth_xlnx_gem_rx_pending_work(struct k_work *item)
|
|||
*/
|
||||
static void eth_xlnx_gem_handle_rx_pending(const struct device *dev)
|
||||
{
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = DEV_CFG(dev);
|
||||
struct eth_xlnx_gem_dev_data *dev_data = DEV_DATA(dev);
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = dev->config;
|
||||
struct eth_xlnx_gem_dev_data *dev_data = dev->data;
|
||||
uint32_t reg_addr;
|
||||
uint32_t reg_ctrl;
|
||||
uint32_t reg_val;
|
||||
|
@ -1552,8 +1554,8 @@ static void eth_xlnx_gem_tx_done_work(struct k_work *item)
|
|||
*/
|
||||
static void eth_xlnx_gem_handle_tx_done(const struct device *dev)
|
||||
{
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = DEV_CFG(dev);
|
||||
struct eth_xlnx_gem_dev_data *dev_data = DEV_DATA(dev);
|
||||
const struct eth_xlnx_gem_dev_cfg *dev_conf = dev->config;
|
||||
struct eth_xlnx_gem_dev_data *dev_data = dev->data;
|
||||
uint32_t reg_ctrl;
|
||||
uint32_t reg_val;
|
||||
uint32_t reg_val_txsr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue