From: "Marek Behún" <kabel@kernel.org>
To: Stefan Roese <sr@denx.de>
Cc: "Robert Marko" <robert.marko@sartura.hr>,
"Pali Rohár" <pali@kernel.org>,
U-Boot-Denx <u-boot@lists.denx.de>,
"Ramon Fried" <rfried.dev@gmail.com>,
"Joe Hershberger" <joe.hershberger@ni.com>,
"Marek Behún" <marek.behun@nic.cz>
Subject: [PATCH u-boot-marvell 08/19] net: mvneta: Don't register MDIO bus
Date: Wed, 27 Apr 2022 12:41:51 +0200 [thread overview]
Message-ID: <20220427104202.1205-9-kabel@kernel.org> (raw)
In-Reply-To: <20220427104202.1205-1-kabel@kernel.org>
From: Marek Behún <marek.behun@nic.cz>
This MDIO bus is now handled by a proper mvmdio DM driver. Remove it
from mvneta.
Signed-off-by: Marek Behún <marek.behun@nic.cz>
---
drivers/net/mvneta.c | 143 +------------------------------------------
1 file changed, 2 insertions(+), 141 deletions(-)
diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c
index 83e9629138..19f8145fc0 100644
--- a/drivers/net/mvneta.c
+++ b/drivers/net/mvneta.c
@@ -288,7 +288,6 @@ struct mvneta_port {
struct gpio_desc phy_reset_gpio;
struct gpio_desc sfp_tx_disable_gpio;
#endif
- struct mii_dev *bus;
};
/* The mvneta_tx_desc and mvneta_rx_desc structures describe the
@@ -414,15 +413,6 @@ static struct buffer_location buffer_loc;
*/
#define BD_SPACE (1 << 20)
-/*
- * Dummy implementation that can be overwritten by a board
- * specific function
- */
-__weak int board_network_enable(struct mii_dev *bus)
-{
- return 0;
-}
-
/* Utility/helper methods */
/* Write helper method */
@@ -1421,118 +1411,6 @@ static int mvneta_init(struct udevice *dev)
/* U-Boot only functions follow here */
-/* SMI / MDIO functions */
-
-static int smi_wait_ready(struct mvneta_port *pp)
-{
- u32 timeout = MVNETA_SMI_TIMEOUT;
- u32 smi_reg;
-
- /* wait till the SMI is not busy */
- do {
- /* read smi register */
- smi_reg = mvreg_read(pp, MVNETA_SMI);
- if (timeout-- == 0) {
- printf("Error: SMI busy timeout\n");
- return -EFAULT;
- }
- } while (smi_reg & MVNETA_SMI_BUSY);
-
- return 0;
-}
-
-/*
- * mvneta_mdio_read - miiphy_read callback function.
- *
- * Returns 16bit phy register value, or 0xffff on error
- */
-static int mvneta_mdio_read(struct mii_dev *bus, int addr, int devad, int reg)
-{
- struct mvneta_port *pp = bus->priv;
- u32 smi_reg;
- u32 timeout;
-
- /* check parameters */
- if (addr > MVNETA_PHY_ADDR_MASK) {
- printf("Error: Invalid PHY address %d\n", addr);
- return -EFAULT;
- }
-
- if (reg > MVNETA_PHY_REG_MASK) {
- printf("Err: Invalid register offset %d\n", reg);
- return -EFAULT;
- }
-
- /* wait till the SMI is not busy */
- if (smi_wait_ready(pp) < 0)
- return -EFAULT;
-
- /* fill the phy address and regiser offset and read opcode */
- smi_reg = (addr << MVNETA_SMI_DEV_ADDR_OFFS)
- | (reg << MVNETA_SMI_REG_ADDR_OFFS)
- | MVNETA_SMI_OPCODE_READ;
-
- /* write the smi register */
- mvreg_write(pp, MVNETA_SMI, smi_reg);
-
- /* wait till read value is ready */
- timeout = MVNETA_SMI_TIMEOUT;
-
- do {
- /* read smi register */
- smi_reg = mvreg_read(pp, MVNETA_SMI);
- if (timeout-- == 0) {
- printf("Err: SMI read ready timeout\n");
- return -EFAULT;
- }
- } while (!(smi_reg & MVNETA_SMI_READ_VALID));
-
- /* Wait for the data to update in the SMI register */
- for (timeout = 0; timeout < MVNETA_SMI_TIMEOUT; timeout++)
- ;
-
- return mvreg_read(pp, MVNETA_SMI) & MVNETA_SMI_DATA_MASK;
-}
-
-/*
- * mvneta_mdio_write - miiphy_write callback function.
- *
- * Returns 0 if write succeed, -EINVAL on bad parameters
- * -ETIME on timeout
- */
-static int mvneta_mdio_write(struct mii_dev *bus, int addr, int devad, int reg,
- u16 value)
-{
- struct mvneta_port *pp = bus->priv;
- u32 smi_reg;
-
- /* check parameters */
- if (addr > MVNETA_PHY_ADDR_MASK) {
- printf("Error: Invalid PHY address %d\n", addr);
- return -EFAULT;
- }
-
- if (reg > MVNETA_PHY_REG_MASK) {
- printf("Err: Invalid register offset %d\n", reg);
- return -EFAULT;
- }
-
- /* wait till the SMI is not busy */
- if (smi_wait_ready(pp) < 0)
- return -EFAULT;
-
- /* fill the phy addr and reg offset and write opcode and data */
- smi_reg = value << MVNETA_SMI_DATA_OFFS;
- smi_reg |= (addr << MVNETA_SMI_DEV_ADDR_OFFS)
- | (reg << MVNETA_SMI_REG_ADDR_OFFS);
- smi_reg &= ~MVNETA_SMI_OPCODE_READ;
-
- /* write the smi register */
- mvreg_write(pp, MVNETA_SMI, smi_reg);
-
- return 0;
-}
-
static int mvneta_start(struct udevice *dev)
{
struct mvneta_port *pp = dev_get_priv(dev);
@@ -1690,10 +1568,9 @@ static int mvneta_probe(struct udevice *dev)
#endif
void *blob = (void *)gd->fdt_blob;
int node = dev_of_offset(dev);
- struct mii_dev *bus;
void *bd_space;
- int ret;
int fl_node;
+ int ret;
/*
* Allocate buffer area for descs and rx_buffers. This is only
@@ -1739,22 +1616,6 @@ static int mvneta_probe(struct udevice *dev)
pp->fixed_link = true;
}
- bus = mdio_alloc();
- if (!bus) {
- printf("Failed to allocate MDIO bus\n");
- return -ENOMEM;
- }
-
- bus->read = mvneta_mdio_read;
- bus->write = mvneta_mdio_write;
- snprintf(bus->name, sizeof(bus->name), dev->name);
- bus->priv = (void *)pp;
- pp->bus = bus;
-
- ret = mdio_register(bus);
- if (ret)
- return ret;
-
#if CONFIG_IS_ENABLED(DM_GPIO)
ret = dev_read_phandle_with_args(dev, "sfp", NULL, 0, 0, &sfp_args);
if (!ret && ofnode_is_enabled(sfp_args.node))
@@ -1774,7 +1635,7 @@ static int mvneta_probe(struct udevice *dev)
dm_gpio_set_value(&pp->sfp_tx_disable_gpio, 0);
#endif
- return board_network_enable(bus);
+ return 0;
}
static void mvneta_stop(struct udevice *dev)
--
2.35.1
next prev parent reply other threads:[~2022-04-27 10:43 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-27 10:41 [PATCH u-boot-marvell 00/19] some mvneta changes, cleanups, fixes Marek Behún
2022-04-27 10:41 ` [PATCH u-boot-marvell 01/19] net: mvneta: Get rid of platdata Marek Behún
2022-04-30 23:28 ` Ramon Fried
2022-05-02 6:48 ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 02/19] net: mvneta: Fix 10Mbps speed Marek Behún
2022-04-30 23:28 ` Ramon Fried
2022-05-02 6:48 ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 03/19] net: mvneta: Use DM MDIO API for connecting PHY Marek Behún
2022-04-30 23:28 ` Ramon Fried
2022-05-02 6:48 ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 04/19] net: mvneta: Remember fixed link instead of PHY address in priv data Marek Behún
2022-04-30 23:28 ` Ramon Fried
2022-05-02 6:48 ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 05/19] arm: mvebu: Espressobin: Use DM registered MDIO to configure switch Marek Behún
2022-05-02 6:48 ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 06/19] net: mdio-uclass: add dm_phy_find_by_ofnode() helper Marek Behún
2022-04-30 23:28 ` Ramon Fried
2022-05-02 7:00 ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 07/19] arm: mvebu: turris_mox: Use DM registered MDIO Marek Behún
2022-05-02 7:00 ` Stefan Roese
2022-04-27 10:41 ` Marek Behún [this message]
2022-04-30 23:29 ` [PATCH u-boot-marvell 08/19] net: mvneta: Don't register MDIO bus Ramon Fried
2022-05-02 7:01 ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 09/19] net: mvneta: Fix unused variable warning if DM_GPIO is disabled Marek Behún
2022-04-30 23:29 ` Ramon Fried
2022-05-02 7:01 ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 10/19] net: mvneta: Drop one indentation level in mvneta_adjust_link() Marek Behún
2022-04-30 23:29 ` Ramon Fried
2022-05-02 7:01 ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 11/19] net: mvneta: Use bool instead of int for boolean variable Marek Behún
2022-04-30 23:29 ` Ramon Fried
2022-05-02 7:01 ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 12/19] net: mvneta: Drop unnecessary space Marek Behún
2022-04-30 23:30 ` Ramon Fried
2022-05-02 7:01 ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 13/19] net: mvneta: Don't check for CONFIG_PHYLIB Marek Behún
2022-04-30 23:30 ` Ramon Fried
2022-05-02 7:02 ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 14/19] net: mvneta: Rename CONFIG_NR_CPUS to MVNETA_NR_CPUS Marek Behún
2022-04-30 23:30 ` Ramon Fried
2022-05-02 7:02 ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 15/19] net: mvneta: Convert to use PHY_FIXED for fixed-link Marek Behún
2022-04-30 23:31 ` Ramon Fried
2022-05-02 7:02 ` Stefan Roese
2022-04-27 10:41 ` [PATCH u-boot-marvell 16/19] net: mvneta: Write PHY address just before enabling HW polling Marek Behún
2022-04-30 23:31 ` Ramon Fried
2022-05-02 7:03 ` Stefan Roese
2022-04-27 10:42 ` [PATCH u-boot-marvell 17/19] net: mvneta: Drop fixed_link member from private struct Marek Behún
2022-04-30 23:31 ` Ramon Fried
2022-05-02 7:03 ` Stefan Roese
2022-04-27 10:42 ` [PATCH u-boot-marvell 18/19] net: mvneta: Disable fixed PHY code if PHY_FIXED is not compiled in Marek Behún
2022-04-30 23:32 ` Ramon Fried
2022-05-02 7:03 ` Stefan Roese
2022-04-27 10:42 ` [PATCH u-boot-marvell 19/19] net: mvneta: Drop unneeded macro Marek Behún
2022-04-30 23:32 ` Ramon Fried
2022-05-02 7:03 ` Stefan Roese
2022-05-02 5:39 ` [PATCH u-boot-marvell 00/19] some mvneta changes, cleanups, fixes Stefan Roese
2022-05-04 9:25 ` Stefan Roese
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220427104202.1205-9-kabel@kernel.org \
--to=kabel@kernel.org \
--cc=joe.hershberger@ni.com \
--cc=marek.behun@nic.cz \
--cc=pali@kernel.org \
--cc=rfried.dev@gmail.com \
--cc=robert.marko@sartura.hr \
--cc=sr@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.