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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <08858b46-95f0-24d0-0e11-1eaec292187c@gmail.com>
Date:   Sat, 9 May 2020 10:28:05 -0700
From:   Florian Fainelli <f.fainelli@...il.com>
To:     Michael Grzeschik <m.grzeschik@...gutronix.de>, andrew@...n.ch
Cc:     netdev@...r.kernel.org, davem@...emloft.net, kernel@...gutronix.de
Subject: Re: [PATCH v3 1/5] net: phy: Add support for microchip SMI0 MDIO bus



On 5/8/2020 8:43 AM, Michael Grzeschik wrote:
> From: Andrew Lunn <andrew@...n.ch>
> 
> SMI0 is a mangled version of MDIO. The main low level difference is
> the MDIO C22 OP code is always 0, not 0x2 or 0x1 for Read/Write. The
> read/write information is instead encoded in the PHY address.
> 
> Extend the bit-bang code to allow the op code to be overridden, but
> default to normal C22 values. Add an extra compatible to the mdio-gpio
> driver, and when this compatible is present, set the op codes to 0.
> 
> A higher level driver, sitting on top of the basic MDIO bus driver can
> then implement the rest of the microchip SMI0 odderties.
> 
> Signed-off-by: Andrew Lunn <andrew@...n.ch>
> Signed-off-by: Michael Grzeschik <m.grzeschik@...gutronix.de>
> ---
>   drivers/net/phy/mdio-bitbang.c |  7 ++-----
>   drivers/net/phy/mdio-gpio.c    | 13 +++++++++++++
>   include/linux/mdio-bitbang.h   |  2 ++
>   3 files changed, 17 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/phy/mdio-bitbang.c b/drivers/net/phy/mdio-bitbang.c
> index 5136275c8e7399..11255460ecb933 100644
> --- a/drivers/net/phy/mdio-bitbang.c
> +++ b/drivers/net/phy/mdio-bitbang.c
> @@ -19,9 +19,6 @@
>   #include <linux/types.h>
>   #include <linux/delay.h>
>   
> -#define MDIO_READ 2
> -#define MDIO_WRITE 1
> -
>   #define MDIO_C45 (1<<15)
>   #define MDIO_C45_ADDR (MDIO_C45 | 0)
>   #define MDIO_C45_READ (MDIO_C45 | 3)
> @@ -158,7 +155,7 @@ static int mdiobb_read(struct mii_bus *bus, int phy, int reg)
>   		reg = mdiobb_cmd_addr(ctrl, phy, reg);
>   		mdiobb_cmd(ctrl, MDIO_C45_READ, phy, reg);
>   	} else
> -		mdiobb_cmd(ctrl, MDIO_READ, phy, reg);
> +		mdiobb_cmd(ctrl, ctrl->op_c22_read, phy, reg);
>   
>   	ctrl->ops->set_mdio_dir(ctrl, 0);
>   
> @@ -189,7 +186,7 @@ static int mdiobb_write(struct mii_bus *bus, int phy, int reg, u16 val)
>   		reg = mdiobb_cmd_addr(ctrl, phy, reg);
>   		mdiobb_cmd(ctrl, MDIO_C45_WRITE, phy, reg);
>   	} else
> -		mdiobb_cmd(ctrl, MDIO_WRITE, phy, reg);
> +		mdiobb_cmd(ctrl, ctrl->op_c22_write, phy, reg);

There are other users of the mdio-bitbang.c file which I believe you are 
going to break here because they will not initialize op_c22_write or 
op_c22_read, and thus they will be using 0, instead of MDIO_READ and 
MDIO_WRITE. I believe you need something like the patch attached.
-- 
Florian

View attachment "mdio-bb.diff" of type "text/plain" (1834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ