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]
Date:	Mon, 5 Aug 2013 07:41:11 +0000
From:	Duan Fugang-B38611 <B38611@...escale.com>
To:	Sean Cross <xobs@...agi.com>,
	Sascha Hauer <s.hauer@...gutronix.de>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>
CC:	David Miller <davem@...emloft.net>,
	"stephen@...workplumber.org" <stephen@...workplumber.org>,
	Steven Rostedt <rostedt@...dmis.org>
Subject: RE: [PATCH v5] net/phy: micrel: Add OF configuration support for
 ksz9021

From: Sean Cross [mailto:xobs@...agi.com]
Data: Monday, August 05, 2013 3:04 PM
> To: Sascha Hauer; Duan Fugang-B38611; netdev@...r.kernel.org;
> devicetree@...r.kernel.org
> Cc: David Miller; stephen@...workplumber.org; Steven Rostedt; Sean Cross
> Subject: [PATCH v5] net/phy: micrel: Add OF configuration support for
> ksz9021
> 
> Some boards require custom PHY configuration, for example due to trace
> length differences.  Add the ability to configure these registers in order
> to get the PHY to function on boards that need it.
> 
> Because PHYs are auto-detected based on MDIO device IDs, allow PHY
> configuration to be specified in the parent Ethernet device node if no PHY
> device node is present.
> 
> Signed-off-by: Sean Cross <xobs@...agi.com>
> ---
> +static int ksz9021_load_values_from_of(struct phy_device *phydev,
> +				       struct device_node *of_node, u16 reg,
> +				       char *field1, char *field2,
> +				       char *field3, char *field4)
> +{
> +	int val1 = -1;
> +	int val2 = -2;
> +	int val3 = -3;
> +	int val4 = -4;
> +	int newval;
> +	int matches = 0;
> +
> +	if (!of_property_read_u32(of_node, field1, &val1))
> +		matches++;
> +
> +	if (!of_property_read_u32(of_node, field2, &val2))
> +		matches++;
> +
> +	if (!of_property_read_u32(of_node, field3, &val3))
> +		matches++;
> +
> +	if (!of_property_read_u32(of_node, field4, &val4))
> +		matches++;
> +
> +	if (!matches)
> +		return 0;
> +
> +	if (matches < 4)
> +		newval = kszphy_extended_read(phydev, reg);
> +	else
> +		newval = 0;
> +
> +	if (val1 != -1)
> +		newval = ((newval & 0xfff0) | ((val1/200)&0xf) << 0);
> +
> +	if (val2 != -1)
> +		newval = ((newval & 0xff0f) | ((val2/200)&0xf) << 4);
Must be :  Newval |= ...
> +
> +	if (val3 != -1)
> +		newval = ((newval & 0xf0ff) | ((val3/200)&0xf) << 8);
Must be :  Newval |= ...
> +
> +	if (val4 != -1)
> +		newval = ((newval & 0x0fff) | ((val4/200)&0xf) << 12);
Must be :  Newval |= ...
> +
> +	return kszphy_extended_write(phydev, reg, newval); }



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ