From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 06/11] FEC: Abstract access to fec->eth in MII operations
Date: Mon, 12 Sep 2011 06:05:34 +0200 [thread overview]
Message-ID: <1315800339-19823-7-git-send-email-marek.vasut@gmail.com> (raw)
In-Reply-To: <1315800339-19823-1-git-send-email-marek.vasut@gmail.com>
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Ben Warren <biggerbadderben@gmail.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Detlev Zundel <dzu@denx.de>
---
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
next prev parent reply other threads:[~2011-09-12 4:05 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-12 4:05 [U-Boot] [PATCH 00/11 V2] Support for both FEC interfaces on i.MX28 Marek Vasut
2011-09-12 4:05 ` [U-Boot] [PATCH 01/11] FEC: Use proper accessor to read register in debug call Marek Vasut
2011-09-22 10:55 ` Stefano Babic
2011-09-12 4:05 ` [U-Boot] [PATCH 02/11] FEC: Use defined constant instead of magic number Marek Vasut
2011-09-22 10:57 ` Stefano Babic
2011-09-12 4:05 ` [U-Boot] [PATCH 03/11] FEC: Kill mode select FIXME's Marek Vasut
2011-09-22 10:58 ` Stefano Babic
2011-09-12 4:05 ` [U-Boot] [PATCH 04/11] FEC: Add RMII mode support Marek Vasut
2011-09-22 10:58 ` Stefano Babic
2011-09-12 4:05 ` [U-Boot] [PATCH 05/11] FEC: Allow selection of MII mode via CONFIG_FEC_XCV_TYPE Marek Vasut
2011-09-22 10:59 ` Stefano Babic
2011-09-12 4:05 ` Marek Vasut [this message]
2011-09-22 10:59 ` [U-Boot] [PATCH 06/11] FEC: Abstract access to fec->eth in MII operations Stefano Babic
2011-09-12 4:05 ` [U-Boot] [PATCH 07/11] FEC: Allow multiple FECes Marek Vasut
2011-09-15 23:13 ` [U-Boot] [PATCH V2] " Marek Vasut
2011-09-22 10:57 ` Stefano Babic
2011-09-12 4:05 ` [U-Boot] [PATCH 08/11] FEC: Allow registering MII postconfiguration callback Marek Vasut
2011-09-22 11:00 ` Stefano Babic
2011-09-12 4:05 ` [U-Boot] [PATCH 09/11] FEC: Add timeout for chip reset Marek Vasut
2011-09-22 11:01 ` Stefano Babic
2011-09-12 4:05 ` [U-Boot] [PATCH 10/11] FEC: Squish "got MAC from fuse" message, make it debug() Marek Vasut
2011-09-22 11:01 ` Stefano Babic
2011-09-12 4:05 ` [U-Boot] [PATCH 11/11] FEC: Move imx_get_mac_from_fuse() definition to fec_mxc.h Marek Vasut
2011-09-22 11:02 ` Stefano Babic
-- strict thread matches above, loose matches on Subject: below --
2011-09-08 20:37 [U-Boot] [PATCH 00/11] Support for both FEC interfaces on i.MX28 Marek Vasut
2011-09-08 20:37 ` [U-Boot] [PATCH 06/11] FEC: Abstract access to fec->eth in MII operations Marek Vasut
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1315800339-19823-7-git-send-email-marek.vasut@gmail.com \
--to=marek.vasut@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox