From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B580BC43217 for ; Sun, 27 Nov 2022 15:29:10 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6D51F851B8; Sun, 27 Nov 2022 16:26:33 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="JIqV09jF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3046C84F68; Sun, 27 Nov 2022 16:26:03 +0100 (CET) Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4D6C784F27 for ; Sun, 27 Nov 2022 16:26:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-ej1-x632.google.com with SMTP id ha10so20390221ejb.3 for ; Sun, 27 Nov 2022 07:26:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=18ub1Fc2hpdYwbILiDGmXSm/CS+KDDb1sVSgoNDQqmU=; b=JIqV09jFZgAZtSo+XyrPSnajPxLOyt8SCgOjtQs404Z7vtvTUwb4ZvTaFkIUw85bAj FAyEAyQsv/a8nnqX+SZBalFXVNGKw+VaOb7bWShANpWZLUM7FWE7PkyIughbGDRvDZ1C 2CevOMZ9rcURTpJ7lx++J2FHKtqwl7oVCm9a4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=18ub1Fc2hpdYwbILiDGmXSm/CS+KDDb1sVSgoNDQqmU=; b=wmB0VEQ1nBgi12Cji72J68qUQ6u7B1LI9tJUfVC96TCz75fX2K2e5K61DpUdWb6zT7 pzRr90N6ZwXwOxouyTk1jiiQEb4r8vxJuAkEZalTQySrBC02DYhWdUzJDqbhhDgxfinq CUDfNddRcUDoJUA+QXGki054qMz4bhVvCutNioFLjPAgcAldFnBIzgYtXpp6QK8xL7Bo DhbpQHb4egpoZAHIFE5j1GJ64V4EPw+DzpMRUtalxf2YZJ0VXSnIL/vx2pHkw0z4yK7H dZ3Y43DatzLftkpxho+rdd1S9z1zXD0Zpy0tHblDiKPy27AMm6IPwy09apmF931Ytd4x mOCg== X-Gm-Message-State: ANoB5pll6ZEINDEmwdQ4NcdHwm/sNSfrGXqkccglO4DkZRVgZuogsYjB pOPLVRzF3VkTTsNBzGj6DEqtj+rngM9+tQ== X-Google-Smtp-Source: AA0mqf5JOeb8E+ggRj4nUxu+SAuasLPi4Qx0mJHIFiOJRWwxFEWmLXViKeYzc2ICOILdkksJIkuT1A== X-Received: by 2002:a17:906:70ca:b0:7ae:fbe8:a73f with SMTP id g10-20020a17090670ca00b007aefbe8a73fmr40117282ejk.479.1669562759525; Sun, 27 Nov 2022 07:25:59 -0800 (PST) Received: from bill-the-cat.lan (2603-6081-7b00-6400-dc2c-1c0a-ea3e-04dc.res6.spectrum.com. [2603:6081:7b00:6400:dc2c:1c0a:ea3e:4dc]) by smtp.gmail.com with ESMTPSA id tb6-20020a1709078b8600b007b47749838asm3853036ejc.45.2022.11.27.07.25.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Nov 2022 07:25:59 -0800 (PST) From: Tom Rini To: u-boot@lists.denx.de Subject: [PATCH 19/41] net: ldpaa_eth: Remove non-DM_ETH code Date: Sun, 27 Nov 2022 10:25:14 -0500 Message-Id: <20221127152536.1556469-19-trini@konsulko.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221127152536.1556469-1-trini@konsulko.com> References: <20221119234545.404563-38-trini@konsulko.com> <20221127152536.1556469-1-trini@konsulko.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean As DM_ETH is required for all network drivers, it's now safe to remove the non-DM_ETH support code. Signed-off-by: Tom Rini --- drivers/net/ldpaa_eth/ldpaa_eth.c | 198 +----------------------------- drivers/net/ldpaa_eth/ldpaa_eth.h | 4 - 2 files changed, 2 insertions(+), 200 deletions(-) diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.c b/drivers/net/ldpaa_eth/ldpaa_eth.c index b6f589eb91a5..24850777949a 100644 --- a/drivers/net/ldpaa_eth/ldpaa_eth.c +++ b/drivers/net/ldpaa_eth/ldpaa_eth.c @@ -24,7 +24,6 @@ #include "ldpaa_eth.h" #ifdef CONFIG_PHYLIB -#ifdef CONFIG_DM_ETH static void init_phy(struct udevice *dev) { struct ldpaa_eth_priv *priv = dev_get_priv(dev); @@ -36,51 +35,6 @@ static void init_phy(struct udevice *dev) phy_config(priv->phy); } -#else -static int init_phy(struct eth_device *dev) -{ - struct ldpaa_eth_priv *priv = (struct ldpaa_eth_priv *)dev->priv; - struct phy_device *phydev = NULL; - struct mii_dev *bus; - int phy_addr, phy_num; - int ret = 0; - - bus = wriop_get_mdio(priv->dpmac_id); - if (bus == NULL) - return 0; - - for (phy_num = 0; phy_num < WRIOP_MAX_PHY_NUM; phy_num++) { - phy_addr = wriop_get_phy_address(priv->dpmac_id, phy_num); - if (phy_addr < 0) - continue; - - phydev = phy_connect(bus, phy_addr, dev, - wriop_get_enet_if(priv->dpmac_id)); - if (!phydev) { - printf("Failed to connect\n"); - ret = -ENODEV; - break; - } - wriop_set_phy_dev(priv->dpmac_id, phy_num, phydev); - ret = phy_config(phydev); - if (ret) - break; - } - - if (ret) { - for (phy_num = 0; phy_num < WRIOP_MAX_PHY_NUM; phy_num++) { - phydev = wriop_get_phy_dev(priv->dpmac_id, phy_num); - if (!phydev) - continue; - - free(phydev); - wriop_set_phy_dev(priv->dpmac_id, phy_num, NULL); - } - } - - return ret; -} -#endif #endif #ifdef DEBUG @@ -147,15 +101,9 @@ static void ldpaa_eth_get_dpni_counter(void) } } -#ifdef CONFIG_DM_ETH static void ldpaa_eth_get_dpmac_counter(struct udevice *dev) { struct ldpaa_eth_priv *priv = dev_get_priv(dev); -#else -static void ldpaa_eth_get_dpmac_counter(struct eth_device *net_dev) -{ - struct ldpaa_eth_priv *priv = (struct ldpaa_eth_priv *)net_dev->priv; -#endif int err = 0; u64 value; @@ -288,16 +236,10 @@ error: return; } -#ifdef CONFIG_DM_ETH static int ldpaa_eth_pull_dequeue_rx(struct udevice *dev, int flags, uchar **packetp) { struct ldpaa_eth_priv *priv = dev_get_priv(dev); -#else -static int ldpaa_eth_pull_dequeue_rx(struct eth_device *dev) -{ - struct ldpaa_eth_priv *priv = (struct ldpaa_eth_priv *)dev->priv; -#endif const struct ldpaa_dq *dq; const struct dpaa_fd *fd; int i = 5, err = 0, status; @@ -354,15 +296,9 @@ static int ldpaa_eth_pull_dequeue_rx(struct eth_device *dev) return err; } -#ifdef CONFIG_DM_ETH static int ldpaa_eth_tx(struct udevice *dev, void *buf, int len) { struct ldpaa_eth_priv *priv = dev_get_priv(dev); -#else -static int ldpaa_eth_tx(struct eth_device *net_dev, void *buf, int len) -{ - struct ldpaa_eth_priv *priv = (struct ldpaa_eth_priv *)net_dev->priv; -#endif struct dpaa_fd fd; u64 buffer_start; int data_offset, err; @@ -438,27 +374,6 @@ error: return err; } -static struct phy_device *ldpaa_get_phydev(struct ldpaa_eth_priv *priv) -{ -#ifdef CONFIG_DM_ETH - return priv->phy; -#else -#ifdef CONFIG_PHYLIB - struct phy_device *phydev = NULL; - int phy_num; - - /* start the phy devices one by one and update the dpmac state */ - for (phy_num = 0; phy_num < WRIOP_MAX_PHY_NUM; phy_num++) { - phydev = wriop_get_phy_dev(priv->dpmac_id, phy_num); - if (phydev) - return phydev; - } - return NULL; -#endif - return NULL; -#endif -} - static int ldpaa_get_dpmac_state(struct ldpaa_eth_priv *priv, struct dpmac_link_state *state) { @@ -479,7 +394,7 @@ static int ldpaa_get_dpmac_state(struct ldpaa_eth_priv *priv, state->up = 1; state->options |= DPMAC_LINK_OPT_AUTONEG; - phydev = ldpaa_get_phydev(priv); + phydev = priv->phy; if (phydev) { err = phy_startup(phydev); @@ -509,16 +424,10 @@ static int ldpaa_get_dpmac_state(struct ldpaa_eth_priv *priv, return 0; } -#ifdef CONFIG_DM_ETH static int ldpaa_eth_open(struct udevice *dev) { struct eth_pdata *plat = dev_get_plat(dev); struct ldpaa_eth_priv *priv = dev_get_priv(dev); -#else -static int ldpaa_eth_open(struct eth_device *net_dev, struct bd_info *bd) -{ - struct ldpaa_eth_priv *priv = (struct ldpaa_eth_priv *)net_dev->priv; -#endif struct dpmac_link_state dpmac_link_state = { 0 }; #ifdef DEBUG struct dpni_link_state link_state; @@ -526,13 +435,8 @@ static int ldpaa_eth_open(struct eth_device *net_dev, struct bd_info *bd) int err = 0; struct dpni_queue d_queue; -#ifdef CONFIG_DM_ETH if (eth_is_active(dev)) return 0; -#else - if (net_dev->state == ETH_STATE_ACTIVE) - return 0; -#endif if (get_mc_boot_status() != 0) { printf("ERROR (MC is not booted)\n"); @@ -572,13 +476,8 @@ static int ldpaa_eth_open(struct eth_device *net_dev, struct bd_info *bd) if (err) goto err_dpni_bind; -#ifdef CONFIG_DM_ETH err = dpni_add_mac_addr(dflt_mc_io, MC_CMD_NO_FLAGS, dflt_dpni->dpni_handle, plat->enetaddr); -#else - err = dpni_add_mac_addr(dflt_mc_io, MC_CMD_NO_FLAGS, - dflt_dpni->dpni_handle, net_dev->enetaddr); -#endif if (err) { printf("dpni_add_mac_addr() failed\n"); return err; @@ -651,34 +550,18 @@ err_dpmac_setup: return err; } -#ifdef CONFIG_DM_ETH static void ldpaa_eth_stop(struct udevice *dev) { struct ldpaa_eth_priv *priv = dev_get_priv(dev); -#else -static void ldpaa_eth_stop(struct eth_device *net_dev) -{ - struct ldpaa_eth_priv *priv = (struct ldpaa_eth_priv *)net_dev->priv; -#endif struct phy_device *phydev = NULL; int err = 0; -#ifdef CONFIG_DM_ETH if (!eth_is_active(dev)) return; -#else - if ((net_dev->state == ETH_STATE_PASSIVE) || - (net_dev->state == ETH_STATE_INIT)) - return; -#endif #ifdef DEBUG ldpaa_eth_get_dpni_counter(); -#ifdef CONFIG_DM_ETH ldpaa_eth_get_dpmac_counter(dev); -#else - ldpaa_eth_get_dpmac_counter(net_dev); -#endif #endif err = dprc_disconnect(dflt_mc_io, MC_CMD_NO_FLAGS, @@ -702,7 +585,7 @@ static void ldpaa_eth_stop(struct eth_device *net_dev) if (err < 0) printf("dpni_disable() failed\n"); - phydev = ldpaa_get_phydev(priv); + phydev = priv->phy; if (phydev) phy_shutdown(phydev); @@ -1097,7 +980,6 @@ static int ldpaa_dpni_bind(struct ldpaa_eth_priv *priv) return 0; } -#ifdef CONFIG_DM_ETH static int ldpaa_eth_probe(struct udevice *dev) { struct ofnode_phandle_args phandle; @@ -1177,79 +1059,3 @@ U_BOOT_DRIVER(ldpaa_eth) = { .priv_auto = sizeof(struct ldpaa_eth_priv), .plat_auto = sizeof(struct eth_pdata), }; - -#else - -static int ldpaa_eth_netdev_init(struct eth_device *net_dev, - phy_interface_t enet_if) -{ - int err; - struct ldpaa_eth_priv *priv = (struct ldpaa_eth_priv *)net_dev->priv; - - snprintf(net_dev->name, ETH_NAME_LEN, "DPMAC%d@%s", priv->dpmac_id, - phy_interface_strings[enet_if]); - - net_dev->iobase = 0; - net_dev->init = ldpaa_eth_open; - net_dev->halt = ldpaa_eth_stop; - net_dev->send = ldpaa_eth_tx; - net_dev->recv = ldpaa_eth_pull_dequeue_rx; - -#ifdef CONFIG_PHYLIB - err = init_phy(net_dev); - if (err < 0) - return err; -#endif - - err = eth_register(net_dev); - if (err < 0) { - printf("eth_register() = %d\n", err); - return err; - } - - return 0; -} - -int ldpaa_eth_init(int dpmac_id, phy_interface_t enet_if) -{ - struct eth_device *net_dev = NULL; - struct ldpaa_eth_priv *priv = NULL; - int err = 0; - - /* Net device */ - net_dev = (struct eth_device *)malloc(sizeof(struct eth_device)); - if (!net_dev) { - printf("eth_device malloc() failed\n"); - return -ENOMEM; - } - memset(net_dev, 0, sizeof(struct eth_device)); - - /* alloc the ldpaa ethernet private struct */ - priv = (struct ldpaa_eth_priv *)malloc(sizeof(struct ldpaa_eth_priv)); - if (!priv) { - printf("ldpaa_eth_priv malloc() failed\n"); - free(net_dev); - return -ENOMEM; - } - memset(priv, 0, sizeof(struct ldpaa_eth_priv)); - - net_dev->priv = (void *)priv; - priv->net_dev = (struct eth_device *)net_dev; - priv->dpmac_id = dpmac_id; - debug("%s dpmac_id=%d\n", __func__, dpmac_id); - - err = ldpaa_eth_netdev_init(net_dev, enet_if); - if (err) - goto err_netdev_init; - - debug("ldpaa ethernet: Probed interface %s\n", net_dev->name); - return 0; - -err_netdev_init: - free(priv); - net_dev->priv = NULL; - free(net_dev); - - return err; -} -#endif diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.h b/drivers/net/ldpaa_eth/ldpaa_eth.h index e90513e56f9a..16d0106233e0 100644 --- a/drivers/net/ldpaa_eth/ldpaa_eth.h +++ b/drivers/net/ldpaa_eth/ldpaa_eth.h @@ -116,13 +116,9 @@ struct ldpaa_fas { LDPAA_ETH_FAS_TIDE) struct ldpaa_eth_priv { -#ifdef CONFIG_DM_ETH struct phy_device *phy; int phy_mode; bool started; -#else - struct eth_device *net_dev; -#endif uint32_t dpmac_id; uint16_t dpmac_handle; -- 2.25.1