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: <C246CAC1457055469EF09E3A7AC4E11A4A5BABF5@XAP-PVEXMBX01.xlnx.xilinx.com>
Date:	Fri, 1 Jul 2016 15:21:33 +0000
From:	Appana Durga Kedareswara Rao <appana.durga.rao@...inx.com>
To:	Florian Fainelli <f.fainelli@...il.com>,
	Michal Simek <michals@...inx.com>,
	"nicolas.ferre@...el.com" <nicolas.ferre@...el.com>,
	Punnaiah Choudary Kalluri <punnaia@...inx.com>,
	Anirudha Sarangi <anirudh@...inx.com>,
	Harini Katakam <harinik@...inx.com>
CC:	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Andrew Lunn <andrew@...n.ch>
Subject: RE: [RFC PATCH 1/2] net: ethernet: xilinx: Add gmii2rgmii converter
 support

Hi Florian,

	Thanks for the review.

> > +#include <linux/module.h>
> > +#include <linux/kernel.h>
> > +#include <linux/types.h>
> > +#include <linux/netdevice.h>
> > +#include <linux/mii.h>
> > +#include <linux/of_platform.h>
> > +#include <linux/of_address.h>
> > +#include <linux/of_mdio.h>
> > +#include <linux/xilinx_gmii2rgmii.h>
> > +
> > +static void xgmii2rgmii_fix_mac_speed(void *priv, unsigned int speed)
> > +{
> > +	struct gmii2rgmii *xphy = (struct xphy *)priv;
> 
> Why not pass struct xphy pointer directly?

Ok will fix in v2...

> 
> > +	struct phy_device *gmii2rgmii_phydev = xphy->gmii2rgmii_phy_dev;
> > +	u16 gmii2rgmii_reg = 0;
> > +
> > +	switch (speed) {
> > +	case 1000:
> > +		gmii2rgmii_reg |= XILINX_GMII2RGMII_SPEED1000;
> > +		break;
> > +	case 100:
> > +		gmii2rgmii_reg |= XILINX_GMII2RGMII_SPEED100;
> > +		break;
> > +	default:
> > +		return;
> > +	}
> > +
> > +	xphy->mdio_write(xphy->mii_bus, gmii2rgmii_phydev->mdio.addr,
> > +			 XILINX_GMII2RGMII_REG_NUM,
> > +			 gmii2rgmii_reg);
> > +}
> > +
> > +int gmii2rgmii_phyprobe(struct gmii2rgmii *xphy) {
> > +	struct device_node *phy_node;
> > +	struct phy_device *phydev;
> > +	struct device_node *np = (struct device_node *)xphy->platform_data;
> > +
> > +	phy_node = of_parse_phandle(np, "gmii2rgmii-phy-handle", 0);
> 
> Is that property documented in a binding document?

Will document. Will fix in v2...

> 
> > +	if (phy_node) {
> 
> Should not there be an else clause which does not assign
> xphy->fix_mac_speed in case this property lookup fails?

Will fix in v2...

> 
> > +		phydev = of_phy_attach(xphy->dev, phy_node, 0, 0);
> > +		if (!phydev) {
> > +			netdev_err(xphy->dev,
> > +				   "%s: no gmii to rgmii converter found\n",
> > +				   xphy->dev->name);
> > +			return -1;
> > +		}
> > +		xphy->gmii2rgmii_phy_dev = phydev;
> > +	}
> > +	xphy->fix_mac_speed = xgmii2rgmii_fix_mac_speed;
> > +
> > +	return 0;
> > +}
> > +EXPORT_SYMBOL(gmii2rgmii_phyprobe);
> > +
> > +MODULE_DESCRIPTION("Xilinx GMII2RGMII converter driver");
> > +MODULE_LICENSE("GPL");
> > diff --git a/include/linux/xilinx_gmii2rgmii.h
> > b/include/linux/xilinx_gmii2rgmii.h
> > new file mode 100644
> > index 0000000..64e1659
> > --- /dev/null
> > +++ b/include/linux/xilinx_gmii2rgmii.h
> > @@ -0,0 +1,24 @@
> > +#ifndef _GMII2RGMII_H
> > +#define _GMII2RGMII_H
> > +
> > +#include <linux/of.h>
> > +#include <linux/phy.h>
> > +#include <linux/mii.h>
> > +
> > +#define XILINX_GMII2RGMII_FULLDPLX		BMCR_FULLDPLX
> > +#define XILINX_GMII2RGMII_SPEED1000		BMCR_SPEED1000
> > +#define XILINX_GMII2RGMII_SPEED100		BMCR_SPEED100
> > +#define XILINX_GMII2RGMII_REG_NUM			0x10
> 
> So the register semantics are fairly standard but not the register location, have
> you considered writing a small PHY driver for this block?

I tried but this PHY doesn't have any vendor / Device ID's
This converter won't suit to PHY framework as we need to programmed the
PHY Control register with the external phy negotiated speed as explained in the other
Mail thread...

Regards,
Kedar. 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ