Re: [U-Boot] [PATCH 06/11] FEC: Abstract access to fec->eth in MII operations

2011-09-22 Thread Stefano Babic
On 09/12/2011 06:05 AM, Marek Vasut wrote:
> Signed-off-by: Marek Vasut 
> Cc: Ben Warren 
> Cc: Stefano Babic 
> Cc: Wolfgang Denk 
> Cc: Detlev Zundel 
> ---

Applied to u-boot-imx, next branch, thanks.

Best regards,
Stefano Babic


-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 06/11] FEC: Abstract access to fec->eth in MII operations

2011-09-11 Thread Marek Vasut
Signed-off-by: Marek Vasut 
Cc: Ben Warren 
Cc: Stefano Babic 
Cc: Wolfgang Denk 
Cc: Detlev Zundel 
---
 drivers/net/fec_mxc.c |   18 ++
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 61b80b2..d448496 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -71,6 +71,7 @@ static int fec_miiphy_read(const char *dev, uint8_t phyAddr, 
uint8_t regAddr,
 {
struct eth_device *edev = eth_get_dev_by_name(dev);
struct fec_priv *fec = (struct fec_priv *)edev->priv;
+   struct ethernet_regs *eth = fec->eth;
 
uint32_t reg;   /* convenient holder for the PHY register */
uint32_t phy;   /* convenient holder for the PHY */
@@ -80,18 +81,18 @@ static int fec_miiphy_read(const char *dev, uint8_t 
phyAddr, uint8_t regAddr,
 * reading from any PHY's register is done by properly
 * programming the FEC's MII data register.
 */
-   writel(FEC_IEVENT_MII, &fec->eth->ievent);
+   writel(FEC_IEVENT_MII, ð->ievent);
reg = regAddr << FEC_MII_DATA_RA_SHIFT;
phy = phyAddr << FEC_MII_DATA_PA_SHIFT;
 
writel(FEC_MII_DATA_ST | FEC_MII_DATA_OP_RD | FEC_MII_DATA_TA |
-   phy | reg, &fec->eth->mii_data);
+   phy | reg, ð->mii_data);
 
/*
 * wait for the related interrupt
 */
start = get_timer(0);
-   while (!(readl(&fec->eth->ievent) & FEC_IEVENT_MII)) {
+   while (!(readl(ð->ievent) & FEC_IEVENT_MII)) {
if (get_timer(start) > (CONFIG_SYS_HZ / 1000)) {
printf("Read MDIO failed...\n");
return -1;
@@ -101,12 +102,12 @@ static int fec_miiphy_read(const char *dev, uint8_t 
phyAddr, uint8_t regAddr,
/*
 * clear mii interrupt bit
 */
-   writel(FEC_IEVENT_MII, &fec->eth->ievent);
+   writel(FEC_IEVENT_MII, ð->ievent);
 
/*
 * it's now safe to read the PHY's register
 */
-   *retVal = readl(&fec->eth->mii_data);
+   *retVal = readl(ð->mii_data);
debug("fec_miiphy_read: phy: %02x reg:%02x val:%#x\n", phyAddr,
regAddr, *retVal);
return 0;
@@ -128,6 +129,7 @@ static int fec_miiphy_write(const char *dev, uint8_t 
phyAddr, uint8_t regAddr,
 {
struct eth_device *edev = eth_get_dev_by_name(dev);
struct fec_priv *fec = (struct fec_priv *)edev->priv;
+   struct ethernet_regs *eth = fec->eth;
 
uint32_t reg;   /* convenient holder for the PHY register */
uint32_t phy;   /* convenient holder for the PHY */
@@ -137,13 +139,13 @@ static int fec_miiphy_write(const char *dev, uint8_t 
phyAddr, uint8_t regAddr,
phy = phyAddr << FEC_MII_DATA_PA_SHIFT;
 
writel(FEC_MII_DATA_ST | FEC_MII_DATA_OP_WR |
-   FEC_MII_DATA_TA | phy | reg | data, &fec->eth->mii_data);
+   FEC_MII_DATA_TA | phy | reg | data, ð->mii_data);
 
/*
 * wait for the MII interrupt
 */
start = get_timer(0);
-   while (!(readl(&fec->eth->ievent) & FEC_IEVENT_MII)) {
+   while (!(readl(ð->ievent) & FEC_IEVENT_MII)) {
if (get_timer(start) > (CONFIG_SYS_HZ / 1000)) {
printf("Write MDIO failed...\n");
return -1;
@@ -153,7 +155,7 @@ static int fec_miiphy_write(const char *dev, uint8_t 
phyAddr, uint8_t regAddr,
/*
 * clear MII interrupt bit
 */
-   writel(FEC_IEVENT_MII, &fec->eth->ievent);
+   writel(FEC_IEVENT_MII, ð->ievent);
debug("fec_miiphy_write: phy: %02x reg:%02x val:%#x\n", phyAddr,
regAddr, data);
 
-- 
1.7.5.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 06/11] FEC: Abstract access to fec->eth in MII operations

2011-09-08 Thread Marek Vasut
Signed-off-by: Marek Vasut 
Cc: Ben Warren 
Cc: Stefano Babic 
Cc: Wolfgang Denk 
Cc: Detlev Zundel 
---
 drivers/net/fec_mxc.c |   18 ++
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index d75f40c..6f56a7a 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -71,6 +71,7 @@ static int fec_miiphy_read(const char *dev, uint8_t phyAddr, 
uint8_t regAddr,
 {
struct eth_device *edev = eth_get_dev_by_name(dev);
struct fec_priv *fec = (struct fec_priv *)edev->priv;
+   struct ethernet_regs *eth = fec->eth;
 
uint32_t reg;   /* convenient holder for the PHY register */
uint32_t phy;   /* convenient holder for the PHY */
@@ -80,18 +81,18 @@ static int fec_miiphy_read(const char *dev, uint8_t 
phyAddr, uint8_t regAddr,
 * reading from any PHY's register is done by properly
 * programming the FEC's MII data register.
 */
-   writel(FEC_IEVENT_MII, &fec->eth->ievent);
+   writel(FEC_IEVENT_MII, ð->ievent);
reg = regAddr << FEC_MII_DATA_RA_SHIFT;
phy = phyAddr << FEC_MII_DATA_PA_SHIFT;
 
writel(FEC_MII_DATA_ST | FEC_MII_DATA_OP_RD | FEC_MII_DATA_TA |
-   phy | reg, &fec->eth->mii_data);
+   phy | reg, ð->mii_data);
 
/*
 * wait for the related interrupt
 */
start = get_timer(0);
-   while (!(readl(&fec->eth->ievent) & FEC_IEVENT_MII)) {
+   while (!(readl(ð->ievent) & FEC_IEVENT_MII)) {
if (get_timer(start) > (CONFIG_SYS_HZ / 1000)) {
printf("Read MDIO failed...\n");
return -1;
@@ -101,12 +102,12 @@ static int fec_miiphy_read(const char *dev, uint8_t 
phyAddr, uint8_t regAddr,
/*
 * clear mii interrupt bit
 */
-   writel(FEC_IEVENT_MII, &fec->eth->ievent);
+   writel(FEC_IEVENT_MII, ð->ievent);
 
/*
 * it's now safe to read the PHY's register
 */
-   *retVal = readl(&fec->eth->mii_data);
+   *retVal = readl(ð->mii_data);
debug("fec_miiphy_read: phy: %02x reg:%02x val:%#x\n", phyAddr,
regAddr, *retVal);
return 0;
@@ -128,6 +129,7 @@ static int fec_miiphy_write(const char *dev, uint8_t 
phyAddr, uint8_t regAddr,
 {
struct eth_device *edev = eth_get_dev_by_name(dev);
struct fec_priv *fec = (struct fec_priv *)edev->priv;
+   struct ethernet_regs *eth = fec->eth;
 
uint32_t reg;   /* convenient holder for the PHY register */
uint32_t phy;   /* convenient holder for the PHY */
@@ -137,13 +139,13 @@ static int fec_miiphy_write(const char *dev, uint8_t 
phyAddr, uint8_t regAddr,
phy = phyAddr << FEC_MII_DATA_PA_SHIFT;
 
writel(FEC_MII_DATA_ST | FEC_MII_DATA_OP_WR |
-   FEC_MII_DATA_TA | phy | reg | data, &fec->eth->mii_data);
+   FEC_MII_DATA_TA | phy | reg | data, ð->mii_data);
 
/*
 * wait for the MII interrupt
 */
start = get_timer(0);
-   while (!(readl(&fec->eth->ievent) & FEC_IEVENT_MII)) {
+   while (!(readl(ð->ievent) & FEC_IEVENT_MII)) {
if (get_timer(start) > (CONFIG_SYS_HZ / 1000)) {
printf("Write MDIO failed...\n");
return -1;
@@ -153,7 +155,7 @@ static int fec_miiphy_write(const char *dev, uint8_t 
phyAddr, uint8_t regAddr,
/*
 * clear MII interrupt bit
 */
-   writel(FEC_IEVENT_MII, &fec->eth->ievent);
+   writel(FEC_IEVENT_MII, ð->ievent);
debug("fec_miiphy_write: phy: %02x reg:%02x val:%#x\n", phyAddr,
regAddr, data);
 
-- 
1.7.5.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot