From: Alexander Aring <alex.aring@gmail.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/2] net: fec: drop sevenwire support
Date: Sat, 9 Mar 2013 17:56:26 +0100 [thread overview]
Message-ID: <20130309165625.GA3158@x61s> (raw)
In-Reply-To: <1362827007-28522-2-git-send-email-s.hauer@pengutronix.de>
Hi Sascha,
some nitpick...
On Sat, Mar 09, 2013 at 12:03:26PM +0100, Sascha Hauer wrote:
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> drivers/net/fec_imx.c | 75 ++++++++++++++++++++-----------------------
> drivers/net/fec_mpc5200.c | 82 +++++++++++++++++++----------------------------
> include/fec.h | 1 -
> 3 files changed, 67 insertions(+), 91 deletions(-)
>
> diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
> index 578000a..d18c062 100644
> --- a/drivers/net/fec_imx.c
> +++ b/drivers/net/fec_imx.c
> @@ -298,15 +298,14 @@ static int fec_init(struct eth_device *dev)
> * Set FEC-Lite receive control register(R_CNTRL):
> */
> rcntl = FEC_R_CNTRL_MAX_FL(1518);
> - if (fec->xcv_type != SEVENWIRE) {
> - rcntl |= FEC_R_CNTRL_MII_MODE;
> - /*
> - * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
> - * and do not drop the Preamble.
> - */
> - writel(((fec_clk_get_rate(fec) >> 20) / 5) << 1,
> - fec->regs + FEC_MII_SPEED);
> - }
> +
> + rcntl |= FEC_R_CNTRL_MII_MODE;
> + /*
> + * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
> + * and do not drop the Preamble.
> + */
> + writel(((fec_clk_get_rate(fec) >> 20) / 5) << 1,
> + fec->regs + FEC_MII_SPEED);
>
> if (fec->xcv_type == RMII) {
> if (fec_is_imx28(fec) || fec_is_imx6(fec)) {
> @@ -385,16 +384,14 @@ static int fec_open(struct eth_device *edev)
> int ret;
> u32 ecr;
>
> - if (fec->xcv_type != SEVENWIRE) {
> - ret = phy_device_connect(edev, &fec->miibus, fec->phy_addr,
> - fec_update_linkspeed, fec->phy_flags,
> - fec->interface);
> - if (ret)
> - return ret;
> + ret = phy_device_connect(edev, &fec->miibus, fec->phy_addr,
> + fec_update_linkspeed, fec->phy_flags,
> + fec->interface);
> + if (ret)
> + return ret;
>
> - if (fec->phy_init)
> - fec->phy_init(edev->phydev);
> - }
> + if (fec->phy_init)
> + fec->phy_init(edev->phydev);
>
> /*
> * Initialize RxBD/TxBD rings
> @@ -699,31 +696,27 @@ static int fec_probe(struct device_d *dev)
>
> fec_init(edev);
>
> - if (fec->xcv_type != SEVENWIRE) {
> - fec->miibus.read = fec_miibus_read;
> - fec->miibus.write = fec_miibus_write;
> - switch (fec->xcv_type) {
> - case RMII:
> - fec->interface = PHY_INTERFACE_MODE_RMII;
> - break;
> - case RGMII:
> - fec->interface = PHY_INTERFACE_MODE_RGMII;
> - break;
> - case MII10:
> - fec->phy_flags = PHYLIB_FORCE_10;
> - case MII100:
> - fec->interface = PHY_INTERFACE_MODE_MII;
> - break;
> - case SEVENWIRE:
> - fec->interface = PHY_INTERFACE_MODE_NA;
> - break;
> - }
> - fec->miibus.priv = fec;
> - fec->miibus.parent = dev;
> -
> - mdiobus_register(&fec->miibus);
> + fec->miibus.read = fec_miibus_read;
> + fec->miibus.write = fec_miibus_write;
> + switch (fec->xcv_type) {
> + case RMII:
> + fec->interface = PHY_INTERFACE_MODE_RMII;
> + break;
> + case RGMII:
> + fec->interface = PHY_INTERFACE_MODE_RGMII;
> + break;
> + case MII10:
> + fec->phy_flags = PHYLIB_FORCE_10;
> + case MII100:
> + fec->interface = PHY_INTERFACE_MODE_MII;
> + break;
> }
>
> + fec->miibus.priv = fec;
> + fec->miibus.parent = dev;
> +
> + mdiobus_register(&fec->miibus);
> +
> eth_register(edev);
> return 0;
>
> diff --git a/drivers/net/fec_mpc5200.c b/drivers/net/fec_mpc5200.c
> index 9ef5350..bdb4e8b 100644
> --- a/drivers/net/fec_mpc5200.c
> +++ b/drivers/net/fec_mpc5200.c
> @@ -294,25 +294,17 @@ static int mpc5xxx_fec_init(struct eth_device *dev)
> /*
> * Set FEC-Lite receive control register(R_CNTRL):
> */
> - if (fec->xcv_type == SEVENWIRE) {
> - /*
> - * Frame length=1518; 7-wire mode
> - */
> - fec->eth->r_cntrl = 0x05ee0020; /*0x05ee0000;FIXME */
> - } else {
> - /*
> - * Frame length=1518; MII mode;
> - */
> - fec->eth->r_cntrl = 0x05ee0024; /*0x05ee0004;FIXME */
> - }
>
> - if (fec->xcv_type != SEVENWIRE) {
> - /*
> - * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
> - * and do not drop the Preamble.
> - */
> - fec->eth->mii_speed = (((get_ipb_clock() >> 20) / 5) << 1); /* No MII for 7-wire mode */
> - }
> + /*
> + * Frame length=1518; MII mode;
> + */
> + fec->eth->r_cntrl = 0x05ee0024; /*0x05ee0004;FIXME */
> +
> + /*
> + * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
> + * and do not drop the Preamble.
> + */
> + fec->eth->mii_speed = (((get_ipb_clock() >> 20) / 5) << 1); /* No MII for 7-wire mode */
>
> /*
> * Set Opcode/Pause Duration Register
> @@ -406,10 +398,8 @@ static int mpc5xxx_fec_open(struct eth_device *edev)
> */
> SDMA_TASK_ENABLE(FEC_RECV_TASK_NO);
>
> - if (fec->xcv_type != SEVENWIRE) {
> - return phy_device_connect(edev, &fec->miibus, CONFIG_PHY_ADDR,
> - NULL, fec->phy_flags, fec->interface);
> - }
> + return phy_device_connect(edev, &fec->miibus, CONFIG_PHY_ADDR,
> + NULL, fec->phy_flags, fec->interface);
>
> return 0;
This return will never use in this function.
Alex
> }
> @@ -511,6 +501,7 @@ static int mpc5xxx_fec_send(struct eth_device *dev, void *eth_data,
> */
> mpc5xxx_fec_priv *fec = (mpc5xxx_fec_priv *)dev->priv;
> volatile FEC_TBD *pTbd;
> + uint16_t phyStatus;
>
> #ifdef DEBUG_FIFO
> debug_fifo("tbd status: 0x%04x\n", fec->tbdBase[0].status);
> @@ -548,10 +539,7 @@ static int mpc5xxx_fec_send(struct eth_device *dev, void *eth_data,
> /*
> * Kick the MII i/f
> */
> - if (fec->xcv_type != SEVENWIRE) {
> - uint16_t phyStatus;
> - phyStatus = fec5xxx_miibus_read(&fec->miibus, 0, 0x1);
> - }
> + phyStatus = fec5xxx_miibus_read(&fec->miibus, 0, 0x1);
>
> /*
> * Enable SmartDMA transmit task
> @@ -676,31 +664,27 @@ int mpc5xxx_fec_probe(struct device_d *dev)
>
> loadtask(0, 2);
>
> - if (fec->xcv_type != SEVENWIRE) {
> - fec->miibus.read = fec5xxx_miibus_read;
> - fec->miibus.write = fec5xxx_miibus_write;
> - switch (pdata->xcv_type) {
> - case RMII:
> - fec->interface = PHY_INTERFACE_MODE_RMII;
> - break;
> - case RGMII:
> - fec->interface = PHY_INTERFACE_MODE_RGMII;
> - break;
> - case MII10:
> - fec->phy_flags = PHYLIB_FORCE_10;
> - case MII100:
> - fec->interface = PHY_INTERFACE_MODE_MII;
> - break;
> - case SEVENWIRE:
> - fec->interface = PHY_INTERFACE_MODE_NA;
> - break;
> - }
> - fec->miibus.priv = fec;
> - fec->miibus.parent = dev;
> -
> - mdiobus_register(&fec->miibus);
> + fec->miibus.read = fec5xxx_miibus_read;
> + fec->miibus.write = fec5xxx_miibus_write;
> + switch (pdata->xcv_type) {
> + case RMII:
> + fec->interface = PHY_INTERFACE_MODE_RMII;
> + break;
> + case RGMII:
> + fec->interface = PHY_INTERFACE_MODE_RGMII;
> + break;
> + case MII10:
> + fec->phy_flags = PHYLIB_FORCE_10;
> + case MII100:
> + fec->interface = PHY_INTERFACE_MODE_MII;
> + break;
> }
>
> + fec->miibus.priv = fec;
> + fec->miibus.parent = dev;
> +
> + mdiobus_register(&fec->miibus);
> +
> eth_register(edev);
> return 0;
> }
> diff --git a/include/fec.h b/include/fec.h
> index 94cb6ed..80904dc 100644
> --- a/include/fec.h
> +++ b/include/fec.h
> @@ -27,7 +27,6 @@
> * Supported phy types on this platform
> */
> typedef enum {
> - SEVENWIRE,
> MII10,
> MII100,
> RMII,
> --
> 1.8.2.rc2
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2013-03-09 16:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-09 11:03 [PATCH] net: fec: Use standard phy type defines Sascha Hauer
2013-03-09 11:03 ` [PATCH 1/2] net: fec: drop sevenwire support Sascha Hauer
2013-03-09 16:56 ` Alexander Aring [this message]
2013-03-09 19:10 ` Sascha Hauer
2013-03-09 11:03 ` [PATCH 2/2] net: fec: use standard phy type defines Sascha Hauer
2013-03-10 13:17 ` [PATCH] net: fec: Use " Jean-Christophe PLAGNIOL-VILLARD
2013-03-11 7:53 ` Sascha Hauer
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=20130309165625.GA3158@x61s \
--to=alex.aring@gmail.com \
--cc=barebox@lists.infradead.org \
--cc=s.hauer@pengutronix.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