lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 8 Aug 2022 22:13:33 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Ravi Gunasekaran <r-gunasekaran@...com>
Cc:     davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
        pabeni@...hat.com, linux-omap@...r.kernel.org,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, kishon@...com,
        vigneshr@...com
Subject: Re: [RESEND PATCH] net: ethernet: ti: davinci_mdio: Add workaround
 for errata i2329

> +static int davinci_mdio_sw_read(struct mii_bus *bus, int phy_id, int phy_reg)
> +{
> +	struct davinci_mdio_data *data = bus->priv;
> +	u32 reg, i;
> +	int ret;
> +	u8 ack;
> +
> +	if (phy_reg & ~PHY_REG_MASK || phy_id & ~PHY_ID_MASK)
> +		return -EINVAL;
> +
> +	ret = pm_runtime_get_sync(data->dev);
> +	if (ret < 0) {
> +		pm_runtime_put_noidle(data->dev);
> +		return ret;
> +	}
> +
> +	davinci_mdio_disable(data);
> +	davinci_mdio_enable_manual_mode(data);
> +	davinci_mdio_sw_preamble(data);
> +
> +	davinci_mdio_sw_clr_bit(data, MDIO_MDCLK);
> +	davinci_mdio_sw_set_bit(data, MDIO_OE);
> +
> +	 /* Issue clause 22 MII read function {0,1,1,0} */
> +	davinci_mdio_man_send_pattern(data, C22_BITRANGE, C22_READ_PATTERN);
> +
> +	/* Send the device number MSB first */
> +	davinci_mdio_man_send_pattern(data, PHY_BITRANGE, phy_id);
> +
> +	/* Send the register number MSB first */
> +	davinci_mdio_man_send_pattern(data, PHY_BITRANGE, phy_reg);
> +
> +	/* Send turn around cycles */
> +	davinci_mdio_sw_clr_bit(data, MDIO_OE);
> +
> +	davinci_mdio_toggle_man_bit(data, MDIO_MDCLK);
> +
> +	ack = davinci_mdio_test_man_bit(data, MDIO_PIN);
> +	davinci_mdio_toggle_man_bit(data, MDIO_MDCLK);
> +
> +	reg = 0;
> +	if (ack == 0) {
> +		for (i = MDIO_BITRANGE; i; i = i >> 1) {
> +			if (davinci_mdio_test_man_bit(data, MDIO_PIN))
> +				reg |= i;
> +
> +			davinci_mdio_toggle_man_bit(data, MDIO_MDCLK);
> +		}
> +	} else {
> +		for (i = MDIO_BITRANGE; i; i = i >> 1)
> +			davinci_mdio_toggle_man_bit(data, MDIO_MDCLK);
> +
> +		reg = 0xFFFF;
> +	}
> +
> +	davinci_mdio_sw_clr_bit(data, MDIO_MDCLK);
> +	davinci_mdio_sw_set_bit(data, MDIO_MDCLK);
> +	davinci_mdio_sw_set_bit(data, MDIO_MDCLK);
> +	davinci_mdio_toggle_man_bit(data, MDIO_MDCLK);

You appear to of re-invented drivers/net/mdio/mdio-bitbang.c

If there is a reason this cannot be used, please at least state it in
the commit message.

    Andrew

Powered by blists - more mailing lists