linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] dts/mpc8569mds: Cleanup tbi phy to support rtbi
@ 2010-01-14  8:13 Liu Yu
  2010-01-14  8:13 ` [PATCH 2/4] mpc8569mds: Add bscr setting for rtbi mode Liu Yu
  2010-02-01 21:46 ` [PATCH 1/4] dts/mpc8569mds: Cleanup tbi phy to support rtbi Grant Likely
  0 siblings, 2 replies; 11+ messages in thread
From: Liu Yu @ 2010-01-14  8:13 UTC (permalink / raw)
  To: galak, davem; +Cc: netdev, Liu Yu, linuxppc-dev

After these change, when need to work in rtbi mode,
just change phy-connection-type to "rtbi".

Also, this work can be done by u-boot.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
---
 arch/powerpc/boot/dts/mpc8569mds.dts |   47 ++++++++++++++++++++++++++++++---
 1 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc8569mds.dts b/arch/powerpc/boot/dts/mpc8569mds.dts
index 795eb36..8b72eaf 100644
--- a/arch/powerpc/boot/dts/mpc8569mds.dts
+++ b/arch/powerpc/boot/dts/mpc8569mds.dts
@@ -535,6 +535,7 @@
 			rx-clock-name = "none";
 			tx-clock-name = "clk12";
 			pio-handle = <&pio1>;
+			tbi-handle = <&tbi1>;
 			phy-handle = <&qe_phy0>;
 			phy-connection-type = "rgmii-id";
 		};
@@ -579,7 +580,7 @@
 				reg = <0x6>;
 				device_type = "ethernet-phy";
 			};
-			tbi-phy@11 {
+			tbi1: tbi-phy@11 {
 				reg = <0x11>;
 				device_type = "tbi-phy";
 			};
@@ -590,7 +591,7 @@
 			reg = <0x3520 0x18>;
 			compatible = "fsl,ucc-mdio";
 
-			tbi0: tbi-phy@15 {
+			tbi6: tbi-phy@15 {
 			reg = <0x15>;
 			device_type = "tbi-phy";
 			};
@@ -600,7 +601,7 @@
 			#size-cells = <0>;
 			reg = <0x3720 0x38>;
 			compatible = "fsl,ucc-mdio";
-			tbi1: tbi-phy@17 {
+			tbi8: tbi-phy@17 {
 				reg = <0x17>;
 				device_type = "tbi-phy";
 			};
@@ -617,10 +618,22 @@
 			rx-clock-name = "none";
 			tx-clock-name = "clk12";
 			pio-handle = <&pio3>;
+			tbi-handle = <&tbi3>;
 			phy-handle = <&qe_phy2>;
 			phy-connection-type = "rgmii-id";
 		};
 
+		mdio@2320 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0x2320 0x18>;
+			compatible = "fsl,ucc-mdio";
+			tbi3: tbi-phy@11 {
+				reg = <0x11>;
+				device_type = "tbi-phy";
+			};
+		};
+
 		enet1: ucc@3000 {
 			device_type = "network";
 			compatible = "ucc_geth";
@@ -632,10 +645,22 @@
 			rx-clock-name = "none";
 			tx-clock-name = "clk17";
 			pio-handle = <&pio2>;
+			tbi-handle = <&tbi2>;
 			phy-handle = <&qe_phy1>;
 			phy-connection-type = "rgmii-id";
 		};
 
+		mdio@3120 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0x3120 0x18>;
+			compatible = "fsl,ucc-mdio";
+			tbi2: tbi-phy@11 {
+				reg = <0x11>;
+				device_type = "tbi-phy";
+			};
+		};
+
 		enet3: ucc@3200 {
 			device_type = "network";
 			compatible = "ucc_geth";
@@ -647,10 +672,22 @@
 			rx-clock-name = "none";
 			tx-clock-name = "clk17";
 			pio-handle = <&pio4>;
+			tbi-handle = <&tbi4>;
 			phy-handle = <&qe_phy3>;
 			phy-connection-type = "rgmii-id";
 		};
 
+		mdio@3320 {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			reg = <0x3320 0x18>;
+			compatible = "fsl,ucc-mdio";
+			tbi4: tbi-phy@11 {
+				reg = <0x11>;
+				device_type = "tbi-phy";
+			};
+		};
+
 		enet5: ucc@3400 {
 			device_type = "network";
 			compatible = "ucc_geth";
@@ -661,7 +698,7 @@
 			local-mac-address = [ 00 00 00 00 00 00 ];
 			rx-clock-name = "none";
 			tx-clock-name = "none";
-			tbi-handle = <&tbi0>;
+			tbi-handle = <&tbi6>;
 			phy-handle = <&qe_phy5>;
 			phy-connection-type = "sgmii";
 		};
@@ -676,7 +713,7 @@
 			local-mac-address = [ 00 00 00 00 00 00 ];
 			rx-clock-name = "none";
 			tx-clock-name = "none";
-			tbi-handle = <&tbi1>;
+			tbi-handle = <&tbi8>;
 			phy-handle = <&qe_phy7>;
 			phy-connection-type = "sgmii";
 		};
-- 
1.6.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/4] mpc8569mds: Add bscr setting for rtbi mode
  2010-01-14  8:13 [PATCH 1/4] dts/mpc8569mds: Cleanup tbi phy to support rtbi Liu Yu
@ 2010-01-14  8:13 ` Liu Yu
  2010-01-14  8:13   ` [PATCH 3/4] ucc_geth: update the tbi-phy setting Liu Yu
  2010-02-01 21:57   ` [PATCH 2/4] mpc8569mds: Add bscr setting for rtbi mode Grant Likely
  2010-02-01 21:46 ` [PATCH 1/4] dts/mpc8569mds: Cleanup tbi phy to support rtbi Grant Likely
  1 sibling, 2 replies; 11+ messages in thread
From: Liu Yu @ 2010-01-14  8:13 UTC (permalink / raw)
  To: galak, davem; +Cc: netdev, Liu Yu, linuxppc-dev

Signed-off-by: Liu Yu <yu.liu@freescale.com>
---
 arch/powerpc/platforms/85xx/mpc85xx_mds.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index c5028a2..0872e4a 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -237,6 +237,8 @@ static void __init mpc85xx_mds_setup_arch(void)
 		} else if (machine_is(mpc8569_mds)) {
 #define BCSR7_UCC12_GETHnRST	(0x1 << 2)
 #define BCSR8_UEM_MARVELL_RST	(0x1 << 1)
+#define BCSR_UCC_RGMII		(0x1 << 6)
+#define BCSR_UCC_RTBI		(0x1 << 5)
 			/*
 			 * U-Boot mangles interrupt polarity for Marvell PHYs,
 			 * so reset built-in and UEM Marvell PHYs, this puts
@@ -247,6 +249,28 @@ static void __init mpc85xx_mds_setup_arch(void)
 
 			setbits8(&bcsr_regs[7], BCSR7_UCC12_GETHnRST);
 			clrbits8(&bcsr_regs[8], BCSR8_UEM_MARVELL_RST);
+
+			for (np = NULL; (np = of_find_compatible_node(np,
+							"network",
+							"ucc_geth")) != NULL;) {
+				const unsigned int *prop;
+				int ucc_num;
+
+				prop = of_get_property(np, "cell-index", NULL);
+				if (prop == NULL)
+					continue;
+
+				ucc_num = *prop - 1;
+
+				prop = of_get_property(np, "phy-connection-type", NULL);
+				if (prop == NULL)
+					continue;
+
+				if (strcmp("rtbi", (const char *)prop) == 0)
+					clrsetbits_8(&bcsr_regs[7 + ucc_num],
+						BCSR_UCC_RGMII, BCSR_UCC_RTBI);
+			}
+
 		}
 		iounmap(bcsr_regs);
 	}
-- 
1.6.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/4] ucc_geth: update the tbi-phy setting
  2010-01-14  8:13 ` [PATCH 2/4] mpc8569mds: Add bscr setting for rtbi mode Liu Yu
@ 2010-01-14  8:13   ` Liu Yu
  2010-01-14  8:13     ` [PATCH 4/4] phy: add RTBI mode for m88e1111 Liu Yu
  2010-02-01 22:00     ` [PATCH 3/4] ucc_geth: update the tbi-phy setting Grant Likely
  2010-02-01 21:57   ` [PATCH 2/4] mpc8569mds: Add bscr setting for rtbi mode Grant Likely
  1 sibling, 2 replies; 11+ messages in thread
From: Liu Yu @ 2010-01-14  8:13 UTC (permalink / raw)
  To: galak, davem; +Cc: netdev, Liu Yu, linuxppc-dev

Old method only set tbi-phy for eth0.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
---
 drivers/net/ucc_geth.c |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 750d86d..0e72013 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -37,6 +37,7 @@
 #include <asm/qe.h>
 #include <asm/ucc.h>
 #include <asm/ucc_fast.h>
+#include <asm/machdep.h>
 
 #include "ucc_geth.h"
 #include "fsl_pq_mdio.h"
@@ -1334,7 +1335,7 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth)
 	struct ucc_geth __iomem *ug_regs;
 	struct ucc_fast __iomem *uf_regs;
 	int ret_val;
-	u32 upsmr, maccfg2, tbiBaseAddress;
+	u32 upsmr, maccfg2;
 	u16 value;
 
 	ugeth_vdbg("%s: IN", __func__);
@@ -1389,14 +1390,20 @@ static int adjust_enet_interface(struct ucc_geth_private *ugeth)
 	/* Note that this depends on proper setting in utbipar register. */
 	if ((ugeth->phy_interface == PHY_INTERFACE_MODE_TBI) ||
 	    (ugeth->phy_interface == PHY_INTERFACE_MODE_RTBI)) {
-		tbiBaseAddress = in_be32(&ug_regs->utbipar);
-		tbiBaseAddress &= UTBIPAR_PHY_ADDRESS_MASK;
-		tbiBaseAddress >>= UTBIPAR_PHY_ADDRESS_SHIFT;
-		value = ugeth->phydev->bus->read(ugeth->phydev->bus,
-				(u8) tbiBaseAddress, ENET_TBI_MII_CR);
+		struct ucc_geth_info *ug_info = ugeth->ug_info;
+		struct phy_device *tbiphy;
+
+		if (!ug_info->tbi_node)
+			ugeth_warn("TBI mode requires that the device "
+				"tree specify a tbi-handle\n");
+
+		tbiphy = of_phy_find_device(ug_info->tbi_node);
+		if (!tbiphy)
+			ugeth_warn("Could not get TBI device\n");
+
+		value = phy_read(tbiphy, ENET_TBI_MII_CR);
 		value &= ~0x1000;	/* Turn off autonegotiation */
-		ugeth->phydev->bus->write(ugeth->phydev->bus,
-				(u8) tbiBaseAddress, ENET_TBI_MII_CR, value);
+		phy_write(tbiphy, ENET_TBI_MII_CR, value);
 	}
 
 	init_check_frame_length_mode(ug_info->lengthCheckRx, &ug_regs->maccfg2);
-- 
1.6.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/4] phy: add RTBI mode for m88e1111
  2010-01-14  8:13   ` [PATCH 3/4] ucc_geth: update the tbi-phy setting Liu Yu
@ 2010-01-14  8:13     ` Liu Yu
  2010-01-14 16:20       ` Kumar Gala
  2010-02-01 22:00     ` [PATCH 3/4] ucc_geth: update the tbi-phy setting Grant Likely
  1 sibling, 1 reply; 11+ messages in thread
From: Liu Yu @ 2010-01-14  8:13 UTC (permalink / raw)
  To: galak, davem; +Cc: netdev, Liu Yu, linuxppc-dev

Signed-off-by: Liu Yu <yu.liu@freescale.com>
---
 drivers/net/phy/marvell.c |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 6f69b9b..65ed385 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -63,6 +63,7 @@
 #define MII_M1111_HWCFG_MODE_COPPER_RGMII	0xb
 #define MII_M1111_HWCFG_MODE_FIBER_RGMII	0x3
 #define MII_M1111_HWCFG_MODE_SGMII_NO_CLK	0x4
+#define MII_M1111_HWCFG_MODE_COPPER_RTBI	0x9
 #define MII_M1111_HWCFG_FIBER_COPPER_AUTO	0x8000
 #define MII_M1111_HWCFG_FIBER_COPPER_RES	0x2000
 
@@ -269,6 +270,43 @@ static int m88e1111_config_init(struct phy_device *phydev)
 			return err;
 	}
 
+	if (phydev->interface == PHY_INTERFACE_MODE_RTBI) {
+		temp = phy_read(phydev, MII_M1111_PHY_EXT_CR);
+		if (temp < 0)
+			return temp;
+		temp |= (MII_M1111_RX_DELAY | MII_M1111_TX_DELAY);
+		err = phy_write(phydev, MII_M1111_PHY_EXT_CR, temp);
+		if (err < 0)
+			return err;
+
+		temp = phy_read(phydev, MII_M1111_PHY_EXT_SR);
+		if (temp < 0)
+			return temp;
+		temp &= ~(MII_M1111_HWCFG_MODE_MASK | MII_M1111_HWCFG_FIBER_COPPER_RES);
+		temp |= 0x7 | MII_M1111_HWCFG_FIBER_COPPER_AUTO;
+		err = phy_write(phydev, MII_M1111_PHY_EXT_SR, temp);
+		if (err < 0)
+			return err;
+
+		/* soft reset */
+		err = phy_write(phydev, MII_BMCR, BMCR_RESET);
+		if (err < 0)
+			return err;
+		do
+			temp = phy_read(phydev, MII_BMCR);
+		while (temp & BMCR_RESET);
+
+		temp = phy_read(phydev, MII_M1111_PHY_EXT_SR);
+		if (temp < 0)
+			return temp;
+		temp &= ~(MII_M1111_HWCFG_MODE_MASK | MII_M1111_HWCFG_FIBER_COPPER_RES);
+		temp |= MII_M1111_HWCFG_MODE_COPPER_RTBI | MII_M1111_HWCFG_FIBER_COPPER_AUTO;
+		err = phy_write(phydev, MII_M1111_PHY_EXT_SR, temp);
+		if (err < 0)
+			return err;
+	}
+
+
 	err = phy_write(phydev, MII_BMCR, BMCR_RESET);
 	if (err < 0)
 		return err;
-- 
1.6.4

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/4] phy: add RTBI mode for m88e1111
  2010-01-14  8:13     ` [PATCH 4/4] phy: add RTBI mode for m88e1111 Liu Yu
@ 2010-01-14 16:20       ` Kumar Gala
  2010-01-15  2:49         ` Liu Yu-B13201
  0 siblings, 1 reply; 11+ messages in thread
From: Kumar Gala @ 2010-01-14 16:20 UTC (permalink / raw)
  To: Liu Yu; +Cc: netdev, linuxppc-dev, davem


On Jan 14, 2010, at 2:13 AM, Liu Yu wrote:

> Signed-off-by: Liu Yu <yu.liu@freescale.com>
> ---
> drivers/net/phy/marvell.c |   38 =
++++++++++++++++++++++++++++++++++++++
> 1 files changed, 38 insertions(+), 0 deletions(-)
>=20
> diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
> index 6f69b9b..65ed385 100644
> --- a/drivers/net/phy/marvell.c
> +++ b/drivers/net/phy/marvell.c
> @@ -63,6 +63,7 @@
> #define MII_M1111_HWCFG_MODE_COPPER_RGMII	0xb
> #define MII_M1111_HWCFG_MODE_FIBER_RGMII	0x3
> #define MII_M1111_HWCFG_MODE_SGMII_NO_CLK	0x4
> +#define MII_M1111_HWCFG_MODE_COPPER_RTBI	0x9
> #define MII_M1111_HWCFG_FIBER_COPPER_AUTO	0x8000
> #define MII_M1111_HWCFG_FIBER_COPPER_RES	0x2000
>=20
> @@ -269,6 +270,43 @@ static int m88e1111_config_init(struct phy_device =
*phydev)
> 			return err;
> 	}
>=20
> +	if (phydev->interface =3D=3D PHY_INTERFACE_MODE_RTBI) {
> +		temp =3D phy_read(phydev, MII_M1111_PHY_EXT_CR);
> +		if (temp < 0)
> +			return temp;
> +		temp |=3D (MII_M1111_RX_DELAY | MII_M1111_TX_DELAY);
> +		err =3D phy_write(phydev, MII_M1111_PHY_EXT_CR, temp);
> +		if (err < 0)
> +			return err;
> +
> +		temp =3D phy_read(phydev, MII_M1111_PHY_EXT_SR);
> +		if (temp < 0)
> +			return temp;
> +		temp &=3D ~(MII_M1111_HWCFG_MODE_MASK | =
MII_M1111_HWCFG_FIBER_COPPER_RES);
> +		temp |=3D 0x7 | MII_M1111_HWCFG_FIBER_COPPER_AUTO;

Does this magic 0x7 have some meaning?

> +		err =3D phy_write(phydev, MII_M1111_PHY_EXT_SR, temp);
> +		if (err < 0)
> +			return err;
> +
> +		/* soft reset */
> +		err =3D phy_write(phydev, MII_BMCR, BMCR_RESET);
> +		if (err < 0)
> +			return err;
> +		do
> +			temp =3D phy_read(phydev, MII_BMCR);
> +		while (temp & BMCR_RESET);
> +
> +		temp =3D phy_read(phydev, MII_M1111_PHY_EXT_SR);
> +		if (temp < 0)
> +			return temp;
> +		temp &=3D ~(MII_M1111_HWCFG_MODE_MASK | =
MII_M1111_HWCFG_FIBER_COPPER_RES);
> +		temp |=3D MII_M1111_HWCFG_MODE_COPPER_RTBI | =
MII_M1111_HWCFG_FIBER_COPPER_AUTO;
> +		err =3D phy_write(phydev, MII_M1111_PHY_EXT_SR, temp);
> +		if (err < 0)
> +			return err;
> +	}
> +
> +
> 	err =3D phy_write(phydev, MII_BMCR, BMCR_RESET);
> 	if (err < 0)
> 		return err;
> --=20
> 1.6.4

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH 4/4] phy: add RTBI mode for m88e1111
  2010-01-14 16:20       ` Kumar Gala
@ 2010-01-15  2:49         ` Liu Yu-B13201
  2010-01-21  9:18           ` David Miller
  0 siblings, 1 reply; 11+ messages in thread
From: Liu Yu-B13201 @ 2010-01-15  2:49 UTC (permalink / raw)
  To: Kumar Gala; +Cc: netdev, linuxppc-dev, davem

=20

> -----Original Message-----
> From: Kumar Gala [mailto:galak@kernel.crashing.org]=20
> Sent: Friday, January 15, 2010 12:20 AM
> To: Liu Yu-B13201
> Cc: davem@davemloft.net; linuxppc-dev@lists.ozlabs.org;=20
> netdev@vger.kernel.org
> Subject: Re: [PATCH 4/4] phy: add RTBI mode for m88e1111
>=20
>=20
> On Jan 14, 2010, at 2:13 AM, Liu Yu wrote:
>=20
> > Signed-off-by: Liu Yu <yu.liu@freescale.com>
> > ---
> > drivers/net/phy/marvell.c |   38=20
> ++++++++++++++++++++++++++++++++++++++
> > 1 files changed, 38 insertions(+), 0 deletions(-)
> >=20
> > diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
> > index 6f69b9b..65ed385 100644
> > --- a/drivers/net/phy/marvell.c
> > +++ b/drivers/net/phy/marvell.c
> > @@ -63,6 +63,7 @@
> > #define MII_M1111_HWCFG_MODE_COPPER_RGMII	0xb
> > #define MII_M1111_HWCFG_MODE_FIBER_RGMII	0x3
> > #define MII_M1111_HWCFG_MODE_SGMII_NO_CLK	0x4
> > +#define MII_M1111_HWCFG_MODE_COPPER_RTBI	0x9
> > #define MII_M1111_HWCFG_FIBER_COPPER_AUTO	0x8000
> > #define MII_M1111_HWCFG_FIBER_COPPER_RES	0x2000
> >=20
> > @@ -269,6 +270,43 @@ static int m88e1111_config_init(struct=20
> phy_device *phydev)
> > 			return err;
> > 	}
> >=20
> > +	if (phydev->interface =3D=3D PHY_INTERFACE_MODE_RTBI) {
> > +		temp =3D phy_read(phydev, MII_M1111_PHY_EXT_CR);
> > +		if (temp < 0)
> > +			return temp;
> > +		temp |=3D (MII_M1111_RX_DELAY | MII_M1111_TX_DELAY);
> > +		err =3D phy_write(phydev, MII_M1111_PHY_EXT_CR, temp);
> > +		if (err < 0)
> > +			return err;
> > +
> > +		temp =3D phy_read(phydev, MII_M1111_PHY_EXT_SR);
> > +		if (temp < 0)
> > +			return temp;
> > +		temp &=3D ~(MII_M1111_HWCFG_MODE_MASK |=20
> MII_M1111_HWCFG_FIBER_COPPER_RES);
> > +		temp |=3D 0x7 | MII_M1111_HWCFG_FIBER_COPPER_AUTO;
>=20
> Does this magic 0x7 have some meaning?
>=20

Hrr...  it's GMII to fibre mode.
Document 88E1111_erata_RevB2  chapter 4.35 describ the reason.
Without this sometimes phys couldnot work.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/4] phy: add RTBI mode for m88e1111
  2010-01-15  2:49         ` Liu Yu-B13201
@ 2010-01-21  9:18           ` David Miller
  0 siblings, 0 replies; 11+ messages in thread
From: David Miller @ 2010-01-21  9:18 UTC (permalink / raw)
  To: B13201; +Cc: netdev, linuxppc-dev

From: "Liu Yu-B13201" <B13201@freescale.com>
Date: Fri, 15 Jan 2010 10:49:37 +0800

>> -----Original Message-----
>> From: Kumar Gala [mailto:galak@kernel.crashing.org] 
>> Sent: Friday, January 15, 2010 12:20 AM
>> To: Liu Yu-B13201
>> Cc: davem@davemloft.net; linuxppc-dev@lists.ozlabs.org; 
>> netdev@vger.kernel.org
>> Subject: Re: [PATCH 4/4] phy: add RTBI mode for m88e1111
>> 
>> 
>> Does this magic 0x7 have some meaning?
>> 
> 
> Hrr...  it's GMII to fibre mode.
> Document 88E1111_erata_RevB2  chapter 4.35 describ the reason.
> Without this sometimes phys couldnot work.

Just FYI, I've applied all of these patches to net-next-2.6

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/4] dts/mpc8569mds: Cleanup tbi phy to support rtbi
  2010-01-14  8:13 [PATCH 1/4] dts/mpc8569mds: Cleanup tbi phy to support rtbi Liu Yu
  2010-01-14  8:13 ` [PATCH 2/4] mpc8569mds: Add bscr setting for rtbi mode Liu Yu
@ 2010-02-01 21:46 ` Grant Likely
  1 sibling, 0 replies; 11+ messages in thread
From: Grant Likely @ 2010-02-01 21:46 UTC (permalink / raw)
  To: Liu Yu; +Cc: netdev, linuxppc-dev, davem

T24gVGh1LCBKYW4gMTQsIDIwMTAgYXQgMToxMyBBTSwgTGl1IFl1IDx5dS5saXVAZnJlZXNjYWxl
LmNvbT4gd3JvdGU6Cj4gQWZ0ZXIgdGhlc2UgY2hhbmdlLCB3aGVuIG5lZWQgdG8gd29yayBpbiBy
dGJpIG1vZGUsCj4ganVzdCBjaGFuZ2UgcGh5LWNvbm5lY3Rpb24tdHlwZSB0byAicnRiaSIuCj4K
PiBBbHNvLCB0aGlzIHdvcmsgY2FuIGJlIGRvbmUgYnkgdS1ib290Lgo+Cj4gU2lnbmVkLW9mZi1i
eTogTGl1IFl1IDx5dS5saXVAZnJlZXNjYWxlLmNvbT4KCkxvb2tzIG9rYXkgYnkgbWUsCkFja2Vk
LWJ5OiBHcmFudCBMaWtlbHkgPGdyYW50Lmxpa2VseUBzZWNyZXRsYWIuY2E+Cgo+IC0tLQo+IKBh
cmNoL3Bvd2VycGMvYm9vdC9kdHMvbXBjODU2OW1kcy5kdHMgfCCgIDQ3ICsrKysrKysrKysrKysr
KysrKysrKysrKysrKysrKy0tLQo+IKAxIGZpbGVzIGNoYW5nZWQsIDQyIGluc2VydGlvbnMoKyks
IDUgZGVsZXRpb25zKC0pCj4KPiBkaWZmIC0tZ2l0IGEvYXJjaC9wb3dlcnBjL2Jvb3QvZHRzL21w
Yzg1NjltZHMuZHRzIGIvYXJjaC9wb3dlcnBjL2Jvb3QvZHRzL21wYzg1NjltZHMuZHRzCj4gaW5k
ZXggNzk1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IKAgoCCgIKAgoCCgIKAgoCCgcGh5LWNvbm5lY3Rp
b24tdHlwZSA9ICJzZ21paSI7Cj4goCCgIKAgoCCgIKAgoCCgfTsKPiBAQCAtNjc2LDcgKzcxMyw3
IEBACj4goCCgIKAgoCCgIKAgoCCgIKAgoCCgIKBsb2NhbC1tYWMtYWRkcmVzcyA9IFsgMDAgMDAg
MDAgMDAgMDAgMDAgXTsKPiCgIKAgoCCgIKAgoCCgIKAgoCCgIKAgoHJ4LWNsb2NrLW5hbWUgPSAi
bm9uZSI7Cj4goCCgIKAgoCCgIKAgoCCgIKAgoCCgIKB0eC1jbG9jay1uYW1lID0gIm5vbmUiOwo+
IC0goCCgIKAgoCCgIKAgoCCgIKAgoCCgIHRiaS1oYW5kbGUgPSA8JnRiaTE+Owo+ICsgoCCgIKAg
oCCgIKAgoCCgIKAgoCCgIHRiaS1oYW5kbGUgPSA8JnRiaTg+Owo+IKAgoCCgIKAgoCCgIKAgoCCg
IKAgoCCgcGh5LWhhbmRsZSA9IDwmcWVfcGh5Nz47Cj4goCCgIKAgoCCgIKAgoCCgIKAgoCCgIKBw
aHktY29ubmVjdGlvbi10eXBlID0gInNnbWlpIjsKPiCgIKAgoCCgIKAgoCCgIKB9Owo+IC0tCj4g
MS42LjQKPgo+IF9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f
Cj4gTGludXhwcGMtZGV2IG1haWxpbmcgbGlzdAo+IExpbnV4cHBjLWRldkBsaXN0cy5vemxhYnMu
b3JnCj4gaHR0cHM6Ly9saXN0cy5vemxhYnMub3JnL2xpc3RpbmZvL2xpbnV4cHBjLWRldgo+CgoK
Ci0tIApHcmFudCBMaWtlbHksIEIuU2MuLCBQLkVuZy4KU2VjcmV0IExhYiBUZWNobm9sb2dpZXMg
THRkLgo=

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/4] mpc8569mds: Add bscr setting for rtbi mode
  2010-01-14  8:13 ` [PATCH 2/4] mpc8569mds: Add bscr setting for rtbi mode Liu Yu
  2010-01-14  8:13   ` [PATCH 3/4] ucc_geth: update the tbi-phy setting Liu Yu
@ 2010-02-01 21:57   ` Grant Likely
  2010-02-02  5:57     ` Liu Yu-B13201
  1 sibling, 1 reply; 11+ messages in thread
From: Grant Likely @ 2010-02-01 21:57 UTC (permalink / raw)
  To: Liu Yu; +Cc: netdev, linuxppc-dev, davem

On Thu, Jan 14, 2010 at 1:13 AM, Liu Yu <yu.liu@freescale.com> wrote:
> Signed-off-by: Liu Yu <yu.liu@freescale.com>
> ---
> =A0arch/powerpc/platforms/85xx/mpc85xx_mds.c | =A0 24 +++++++++++++++++++=
+++++
> =A01 files changed, 24 insertions(+), 0 deletions(-)
>
> diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/pla=
tforms/85xx/mpc85xx_mds.c
> index c5028a2..0872e4a 100644
> --- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
> +++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
> @@ -237,6 +237,8 @@ static void __init mpc85xx_mds_setup_arch(void)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} else if (machine_is(mpc8569_mds)) {
> =A0#define BCSR7_UCC12_GETHnRST =A0 (0x1 << 2)
> =A0#define BCSR8_UEM_MARVELL_RST =A0(0x1 << 1)
> +#define BCSR_UCC_RGMII =A0 =A0 =A0 =A0 (0x1 << 6)
> +#define BCSR_UCC_RTBI =A0 =A0 =A0 =A0 =A0(0x1 << 5)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/*
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 * U-Boot mangles interrup=
t polarity for Marvell PHYs,
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 * so reset built-in and U=
EM Marvell PHYs, this puts
> @@ -247,6 +249,28 @@ static void __init mpc85xx_mds_setup_arch(void)
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0setbits8(&bcsr_regs[7], BC=
SR7_UCC12_GETHnRST);
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0clrbits8(&bcsr_regs[8], BC=
SR8_UEM_MARVELL_RST);
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 for (np =3D NULL; (np =3D o=
f_find_compatible_node(np,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "network",

Don't match on the 'type' field.  Replace "network" with NULL and just
rely on "ucc_geth" for matching.

> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "ucc_geth")) !=3D NULL;) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 const unsig=
ned int *prop;

u32 please.

Also, rather than reusing 'prop' for both char* and u32 values, which
forces you to use ugly casts, use 2 local variables here.

> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 int ucc_num=
;
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 prop =3D of=
_get_property(np, "cell-index", NULL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (prop =
=3D=3D NULL)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 continue;
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ucc_num =3D=
 *prop - 1;

Ugh.  No bounds checking...

> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 prop =3D of=
_get_property(np, "phy-connection-type", NULL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (prop =
=3D=3D NULL)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 continue;
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (strcmp(=
"rtbi", (const char *)prop) =3D=3D 0)

(This is the ugly cast I was talking about.)

> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 clrsetbits_8(&bcsr_regs[7 + ucc_num],

...not having bounds checking could result in badness in this array index.

This patch is dangerous as written.

Finally, while using cell-index seems convenient, I think it would be
better to have a lookup table of the index into the BCSR register
block from the UCC base address, which also gives you implicit bounds
checking.

g.

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/4] ucc_geth: update the tbi-phy setting
  2010-01-14  8:13   ` [PATCH 3/4] ucc_geth: update the tbi-phy setting Liu Yu
  2010-01-14  8:13     ` [PATCH 4/4] phy: add RTBI mode for m88e1111 Liu Yu
@ 2010-02-01 22:00     ` Grant Likely
  1 sibling, 0 replies; 11+ messages in thread
From: Grant Likely @ 2010-02-01 22:00 UTC (permalink / raw)
  To: Liu Yu; +Cc: netdev, linuxppc-dev, davem

On Thu, Jan 14, 2010 at 1:13 AM, Liu Yu <yu.liu@freescale.com> wrote:
> Old method only set tbi-phy for eth0.
>
> Signed-off-by: Liu Yu <yu.liu@freescale.com>
> ---
> =A0drivers/net/ucc_geth.c | =A0 23 +++++++++++++++--------
> =A01 files changed, 15 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
> index 750d86d..0e72013 100644
> --- a/drivers/net/ucc_geth.c
> +++ b/drivers/net/ucc_geth.c
> @@ -37,6 +37,7 @@
> =A0#include <asm/qe.h>
> =A0#include <asm/ucc.h>
> =A0#include <asm/ucc_fast.h>
> +#include <asm/machdep.h>
>
> =A0#include "ucc_geth.h"
> =A0#include "fsl_pq_mdio.h"
> @@ -1334,7 +1335,7 @@ static int adjust_enet_interface(struct ucc_geth_pr=
ivate *ugeth)
> =A0 =A0 =A0 =A0struct ucc_geth __iomem *ug_regs;
> =A0 =A0 =A0 =A0struct ucc_fast __iomem *uf_regs;
> =A0 =A0 =A0 =A0int ret_val;
> - =A0 =A0 =A0 u32 upsmr, maccfg2, tbiBaseAddress;
> + =A0 =A0 =A0 u32 upsmr, maccfg2;
> =A0 =A0 =A0 =A0u16 value;
>
> =A0 =A0 =A0 =A0ugeth_vdbg("%s: IN", __func__);
> @@ -1389,14 +1390,20 @@ static int adjust_enet_interface(struct ucc_geth_=
private *ugeth)
> =A0 =A0 =A0 =A0/* Note that this depends on proper setting in utbipar reg=
ister. */
> =A0 =A0 =A0 =A0if ((ugeth->phy_interface =3D=3D PHY_INTERFACE_MODE_TBI) |=
|
> =A0 =A0 =A0 =A0 =A0 =A0(ugeth->phy_interface =3D=3D PHY_INTERFACE_MODE_RT=
BI)) {
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 tbiBaseAddress =3D in_be32(&ug_regs->utbipa=
r);
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 tbiBaseAddress &=3D UTBIPAR_PHY_ADDRESS_MAS=
K;
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 tbiBaseAddress >>=3D UTBIPAR_PHY_ADDRESS_SH=
IFT;
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 value =3D ugeth->phydev->bus->read(ugeth->p=
hydev->bus,
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (u8) tbiBas=
eAddress, ENET_TBI_MII_CR);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct ucc_geth_info *ug_info =3D ugeth->ug=
_info;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct phy_device *tbiphy;
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!ug_info->tbi_node)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ugeth_warn("TBI mode requir=
es that the device "
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "tree speci=
fy a tbi-handle\n");

Shouldn't the driver avoid calling of_phy_find_device() if this error
path is taken?

> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 tbiphy =3D of_phy_find_device(ug_info->tbi_=
node);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!tbiphy)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ugeth_warn("Could not get T=
BI device\n");
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 value =3D phy_read(tbiphy, ENET_TBI_MII_CR)=
;

Ditto here; the code unconditionally tries to read the tbiphy, even if
it isn't there.

Looks wrong.

g.

> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0value &=3D ~0x1000; =A0 =A0 =A0 /* Turn of=
f autonegotiation */
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 ugeth->phydev->bus->write(ugeth->phydev->bu=
s,
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (u8) tbiBas=
eAddress, ENET_TBI_MII_CR, value);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 phy_write(tbiphy, ENET_TBI_MII_CR, value);
> =A0 =A0 =A0 =A0}
>
> =A0 =A0 =A0 =A0init_check_frame_length_mode(ug_info->lengthCheckRx, &ug_r=
egs->maccfg2);
> --
> 1.6.4
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>



--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: [PATCH 2/4] mpc8569mds: Add bscr setting for rtbi mode
  2010-02-01 21:57   ` [PATCH 2/4] mpc8569mds: Add bscr setting for rtbi mode Grant Likely
@ 2010-02-02  5:57     ` Liu Yu-B13201
  0 siblings, 0 replies; 11+ messages in thread
From: Liu Yu-B13201 @ 2010-02-02  5:57 UTC (permalink / raw)
  To: Grant Likely; +Cc: netdev, linuxppc-dev, davem


Thanks.
As the patchset is accepted.
Will commit another one to fix them.

=20
> -----Original Message-----
> From: glikely@secretlab.ca [mailto:glikely@secretlab.ca] On=20
> Behalf Of Grant Likely
> Sent: Tuesday, February 02, 2010 5:58 AM
> To: Liu Yu-B13201
> Cc: galak@kernel.crashing.org; davem@davemloft.net;=20
> netdev@vger.kernel.org; linuxppc-dev@lists.ozlabs.org
> Subject: Re: [PATCH 2/4] mpc8569mds: Add bscr setting for rtbi mode
>=20
> On Thu, Jan 14, 2010 at 1:13 AM, Liu Yu <yu.liu@freescale.com> wrote:
> > Signed-off-by: Liu Yu <yu.liu@freescale.com>
> > ---
> > =A0arch/powerpc/platforms/85xx/mpc85xx_mds.c | =A0 24=20
> ++++++++++++++++++++++++
> > =A01 files changed, 24 insertions(+), 0 deletions(-)
> >
> > diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c=20
> b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
> > index c5028a2..0872e4a 100644
> > --- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
> > +++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
> > @@ -237,6 +237,8 @@ static void __init mpc85xx_mds_setup_arch(void)
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} else if (machine_is(mpc8569_mds)) {
> > =A0#define BCSR7_UCC12_GETHnRST =A0 (0x1 << 2)
> > =A0#define BCSR8_UEM_MARVELL_RST =A0(0x1 << 1)
> > +#define BCSR_UCC_RGMII =A0 =A0 =A0 =A0 (0x1 << 6)
> > +#define BCSR_UCC_RTBI =A0 =A0 =A0 =A0 =A0(0x1 << 5)
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0/*
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 * U-Boot mangles =
interrupt polarity=20
> for Marvell PHYs,
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 * so reset built-in =
and UEM Marvell=20
> PHYs, this puts
> > @@ -247,6 +249,28 @@ static void __init mpc85xx_mds_setup_arch(void)
> >
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0setbits8(&bcsr_regs[7],=20
> BCSR7_UCC12_GETHnRST);
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0clrbits8(&bcsr_regs[8],=20
> BCSR8_UEM_MARVELL_RST);
> > +
> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 for (np =3D NULL; (np =
=3D=20
> of_find_compatible_node(np,
> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "network",
>=20
> Don't match on the 'type' field.  Replace "network" with NULL and just
> rely on "ucc_geth" for matching.
>=20
> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=20
> "ucc_geth")) !=3D NULL;) {
> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 const =
unsigned int *prop;
>=20
> u32 please.
>=20
> Also, rather than reusing 'prop' for both char* and u32 values, which
> forces you to use ugly casts, use 2 local variables here.
>=20
> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 int =
ucc_num;
> > +
> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 prop =
=3D of_get_property(np,=20
> "cell-index", NULL);
> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if =
(prop =3D=3D NULL)
> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 continue;
> > +
> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
ucc_num =3D *prop - 1;
>=20
> Ugh.  No bounds checking...
>=20
> > +
> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 prop =
=3D of_get_property(np,=20
> "phy-connection-type", NULL);
> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if =
(prop =3D=3D NULL)
> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 continue;
> > +
> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if =
(strcmp("rtbi", (const=20
> char *)prop) =3D=3D 0)
>=20
> (This is the ugly cast I was talking about.)
>=20
> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0=20
> clrsetbits_8(&bcsr_regs[7 + ucc_num],
>=20
> ...not having bounds checking could result in badness in this=20
> array index.
>=20
> This patch is dangerous as written.
>=20
> Finally, while using cell-index seems convenient, I think it would be
> better to have a lookup table of the index into the BCSR register
> block from the UCC base address, which also gives you implicit bounds
> checking.
>=20
> g.
>=20
> --=20
> Grant Likely, B.Sc., P.Eng.
> Secret Lab Technologies Ltd.
>=20
>=20

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-02-02  5:57 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-14  8:13 [PATCH 1/4] dts/mpc8569mds: Cleanup tbi phy to support rtbi Liu Yu
2010-01-14  8:13 ` [PATCH 2/4] mpc8569mds: Add bscr setting for rtbi mode Liu Yu
2010-01-14  8:13   ` [PATCH 3/4] ucc_geth: update the tbi-phy setting Liu Yu
2010-01-14  8:13     ` [PATCH 4/4] phy: add RTBI mode for m88e1111 Liu Yu
2010-01-14 16:20       ` Kumar Gala
2010-01-15  2:49         ` Liu Yu-B13201
2010-01-21  9:18           ` David Miller
2010-02-01 22:00     ` [PATCH 3/4] ucc_geth: update the tbi-phy setting Grant Likely
2010-02-01 21:57   ` [PATCH 2/4] mpc8569mds: Add bscr setting for rtbi mode Grant Likely
2010-02-02  5:57     ` Liu Yu-B13201
2010-02-01 21:46 ` [PATCH 1/4] dts/mpc8569mds: Cleanup tbi phy to support rtbi Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).