]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: fman: Use mac_dev for some params
authorSean Anderson <sean.anderson@seco.com>
Fri, 2 Sep 2022 21:57:29 +0000 (17:57 -0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 5 Sep 2022 13:27:39 +0000 (14:27 +0100)
Some params are already present in mac_dev. Use them directly instead of
passing them through params.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Acked-by: Camelia Groza <camelia.groza@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/fman/fman_dtsec.c
drivers/net/ethernet/freescale/fman/fman_mac.h
drivers/net/ethernet/freescale/fman/fman_memac.c
drivers/net/ethernet/freescale/fman/fman_tgec.c
drivers/net/ethernet/freescale/fman/mac.c

index 9fabb2dfc972325d0e428e52b66ec88162754334..09ad1117005aa0f1364f10fb8e7c3417016714a1 100644 (file)
@@ -1413,13 +1413,11 @@ static int dtsec_free(struct fman_mac *dtsec)
        return 0;
 }
 
-static struct fman_mac *dtsec_config(struct fman_mac_params *params)
+static struct fman_mac *dtsec_config(struct mac_device *mac_dev,
+                                    struct fman_mac_params *params)
 {
        struct fman_mac *dtsec;
        struct dtsec_cfg *dtsec_drv_param;
-       void __iomem *base_addr;
-
-       base_addr = params->base_addr;
 
        /* allocate memory for the UCC GETH data structure. */
        dtsec = kzalloc(sizeof(*dtsec), GFP_KERNEL);
@@ -1436,10 +1434,10 @@ static struct fman_mac *dtsec_config(struct fman_mac_params *params)
 
        set_dflts(dtsec_drv_param);
 
-       dtsec->regs = base_addr;
-       dtsec->addr = ENET_ADDR_TO_UINT64(params->addr);
+       dtsec->regs = mac_dev->vaddr;
+       dtsec->addr = ENET_ADDR_TO_UINT64(mac_dev->addr);
        dtsec->max_speed = params->max_speed;
-       dtsec->phy_if = params->phy_if;
+       dtsec->phy_if = mac_dev->phy_if;
        dtsec->mac_id = params->mac_id;
        dtsec->exceptions = (DTSEC_IMASK_BREN   |
                             DTSEC_IMASK_RXCEN  |
@@ -1456,7 +1454,7 @@ static struct fman_mac *dtsec_config(struct fman_mac_params *params)
                             DTSEC_IMASK_RDPEEN);
        dtsec->exception_cb = params->exception_cb;
        dtsec->event_cb = params->event_cb;
-       dtsec->dev_id = params->dev_id;
+       dtsec->dev_id = mac_dev;
        dtsec->ptp_tsu_enabled = dtsec->dtsec_drv_param->ptp_tsu_en;
        dtsec->en_tsu_err_exception = dtsec->dtsec_drv_param->ptp_exception_en;
 
@@ -1495,7 +1493,7 @@ int dtsec_initialization(struct mac_device *mac_dev,
        mac_dev->enable                 = dtsec_enable;
        mac_dev->disable                = dtsec_disable;
 
-       mac_dev->fman_mac = dtsec_config(params);
+       mac_dev->fman_mac = dtsec_config(mac_dev, params);
        if (!mac_dev->fman_mac) {
                err = -EINVAL;
                goto _return;
index 7774af6463e507ef681e403ae4a435147805ab00..730aae7fed132a731772e8cf6a1aa62796f69378 100644 (file)
@@ -163,25 +163,18 @@ typedef void (fman_mac_exception_cb)(void *dev_id,
 
 /* FMan MAC config input */
 struct fman_mac_params {
-       /* Base of memory mapped FM MAC registers */
-       void __iomem *base_addr;
-       /* MAC address of device; First octet is sent first */
-       enet_addr_t addr;
        /* MAC ID; numbering of dTSEC and 1G-mEMAC:
         * 0 - FM_MAX_NUM_OF_1G_MACS;
         * numbering of 10G-MAC (TGEC) and 10G-mEMAC:
         * 0 - FM_MAX_NUM_OF_10G_MACS
         */
        u8 mac_id;
-       /* PHY interface */
-       phy_interface_t  phy_if;
        /* Note that the speed should indicate the maximum rate that
         * this MAC should support rather than the actual speed;
         */
        u16 max_speed;
        /* A handle to the FM object this port related to */
        void *fm;
-       void *dev_id; /* device cookie used by the exception cbs */
        fman_mac_exception_cb *event_cb;    /* MDIO Events Callback Routine */
        fman_mac_exception_cb *exception_cb;/* Exception Callback Routine */
        /* SGMII/QSGII interface with 1000BaseX auto-negotiation between MAC
index 5daa8c7626f4479de43f2b8cd8a2dd1a7c4a067a..af2e67a250de31dbb2640f179fab35e4f82b2099 100644 (file)
@@ -1109,13 +1109,12 @@ static int memac_free(struct fman_mac *memac)
        return 0;
 }
 
-static struct fman_mac *memac_config(struct fman_mac_params *params)
+static struct fman_mac *memac_config(struct mac_device *mac_dev,
+                                    struct fman_mac_params *params)
 {
        struct fman_mac *memac;
        struct memac_cfg *memac_drv_param;
-       void __iomem *base_addr;
 
-       base_addr = params->base_addr;
        /* allocate memory for the m_emac data structure */
        memac = kzalloc(sizeof(*memac), GFP_KERNEL);
        if (!memac)
@@ -1133,17 +1132,17 @@ static struct fman_mac *memac_config(struct fman_mac_params *params)
 
        set_dflts(memac_drv_param);
 
-       memac->addr = ENET_ADDR_TO_UINT64(params->addr);
+       memac->addr = ENET_ADDR_TO_UINT64(mac_dev->addr);
 
-       memac->regs = base_addr;
+       memac->regs = mac_dev->vaddr;
        memac->max_speed = params->max_speed;
-       memac->phy_if = params->phy_if;
+       memac->phy_if = mac_dev->phy_if;
        memac->mac_id = params->mac_id;
        memac->exceptions = (MEMAC_IMASK_TSECC_ER | MEMAC_IMASK_TECC_ER |
                             MEMAC_IMASK_RECC_ER | MEMAC_IMASK_MGI);
        memac->exception_cb = params->exception_cb;
        memac->event_cb = params->event_cb;
-       memac->dev_id = params->dev_id;
+       memac->dev_id = mac_dev;
        memac->fm = params->fm;
        memac->basex_if = params->basex_if;
 
@@ -1177,9 +1176,9 @@ int memac_initialization(struct mac_device *mac_dev,
        mac_dev->disable                = memac_disable;
 
        if (params->max_speed == SPEED_10000)
-               params->phy_if = PHY_INTERFACE_MODE_XGMII;
+               mac_dev->phy_if = PHY_INTERFACE_MODE_XGMII;
 
-       mac_dev->fman_mac = memac_config(params);
+       mac_dev->fman_mac = memac_config(mac_dev, params);
        if (!mac_dev->fman_mac) {
                err = -EINVAL;
                goto _return;
index f34f89e46a6f8f3c835a66b3cd592962f888317a..2642a4c2729239527542a14652c77d0d69d75548 100644 (file)
@@ -728,13 +728,11 @@ static int tgec_free(struct fman_mac *tgec)
        return 0;
 }
 
-static struct fman_mac *tgec_config(struct fman_mac_params *params)
+static struct fman_mac *tgec_config(struct mac_device *mac_dev, struct fman_mac_params *params)
 {
        struct fman_mac *tgec;
        struct tgec_cfg *cfg;
-       void __iomem *base_addr;
 
-       base_addr = params->base_addr;
        /* allocate memory for the UCC GETH data structure. */
        tgec = kzalloc(sizeof(*tgec), GFP_KERNEL);
        if (!tgec)
@@ -752,8 +750,8 @@ static struct fman_mac *tgec_config(struct fman_mac_params *params)
 
        set_dflts(cfg);
 
-       tgec->regs = base_addr;
-       tgec->addr = ENET_ADDR_TO_UINT64(params->addr);
+       tgec->regs = mac_dev->vaddr;
+       tgec->addr = ENET_ADDR_TO_UINT64(mac_dev->addr);
        tgec->max_speed = params->max_speed;
        tgec->mac_id = params->mac_id;
        tgec->exceptions = (TGEC_IMASK_MDIO_SCAN_EVENT  |
@@ -773,7 +771,7 @@ static struct fman_mac *tgec_config(struct fman_mac_params *params)
                            TGEC_IMASK_RX_ALIGN_ER);
        tgec->exception_cb = params->exception_cb;
        tgec->event_cb = params->event_cb;
-       tgec->dev_id = params->dev_id;
+       tgec->dev_id = mac_dev;
        tgec->fm = params->fm;
 
        /* Save FMan revision */
@@ -803,7 +801,7 @@ int tgec_initialization(struct mac_device *mac_dev,
        mac_dev->enable                 = tgec_enable;
        mac_dev->disable                = tgec_disable;
 
-       mac_dev->fman_mac = tgec_config(params);
+       mac_dev->fman_mac = tgec_config(mac_dev, params);
        if (!mac_dev->fman_mac) {
                err = -EINVAL;
                goto _return;
index fb04c1f9cd3ee76b076f44b8207429734769cb02..0f9e3e9e60c6a2338bb84dd4fdf2d940e0d6ac1b 100644 (file)
@@ -34,7 +34,6 @@ struct mac_priv_s {
        struct list_head                mc_addr_list;
        struct platform_device          *eth_dev;
        u16                             speed;
-       u16                             max_speed;
 };
 
 struct mac_address {
@@ -439,7 +438,7 @@ static int mac_probe(struct platform_device *_of_dev)
        mac_dev->phy_if = phy_if;
 
        priv->speed             = phy2speed[mac_dev->phy_if];
-       priv->max_speed         = priv->speed;
+       params.max_speed        = priv->speed;
        mac_dev->if_support     = DTSEC_SUPPORTED;
        /* We don't support half-duplex in SGMII mode */
        if (mac_dev->phy_if == PHY_INTERFACE_MODE_SGMII)
@@ -447,7 +446,7 @@ static int mac_probe(struct platform_device *_of_dev)
                                        SUPPORTED_100baseT_Half);
 
        /* Gigabit support (no half-duplex) */
-       if (priv->max_speed == 1000)
+       if (params.max_speed == 1000)
                mac_dev->if_support |= SUPPORTED_1000baseT_Full;
 
        /* The 10G interface only supports one mode */
@@ -457,16 +456,11 @@ static int mac_probe(struct platform_device *_of_dev)
        /* Get the rest of the PHY information */
        mac_dev->phy_node = of_parse_phandle(mac_node, "phy-handle", 0);
 
-       params.base_addr = mac_dev->vaddr;
-       memcpy(&params.addr, mac_dev->addr, sizeof(mac_dev->addr));
-       params.max_speed        = priv->max_speed;
-       params.phy_if           = mac_dev->phy_if;
        params.basex_if         = false;
        params.mac_id           = priv->cell_index;
        params.fm               = (void *)priv->fman;
        params.exception_cb     = mac_exception;
        params.event_cb         = mac_exception;
-       params.dev_id           = mac_dev;
 
        err = init(mac_dev, mac_node, &params);
        if (err < 0) {