From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] TI: DaVinci: Updating EMAC driver for DM365, DM646x and DA8XX
Date: Wed, 16 Dec 2009 23:00:37 +0100 [thread overview]
Message-ID: <20091216220037.2D4774C026@gemini.denx.de> (raw)
In-Reply-To: <4B2770F8.5090607@ge.com>
Dear Nick Thompson,
In message <4B2770F8.5090607@ge.com> you wrote:
> The EMAC IP on DM365, DM646x and DA830 is slightly different
> from that on DM644x. This change updates the DaVinci EMAC driver
> so that EMAC becomes operational on SOCs with EMAC v2.
>
> Signed-off-by: Nick Thompson <nick.thompson@ge.com>
> Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
> ---
> Applies to: u-boot-ti
>
> This is a combined patch with Sandeep's DM365 and DM646x changes
> and additional changes for DA830. It replaces previous submissions
> for EMAC support on these devices.
>
> drivers/net/davinci_emac.c | 131 ++++++++++++++++++++++++-----
> include/asm-arm/arch-davinci/emac_defs.h | 60 +++++++++++++-
> 2 files changed, 164 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
> index fa8cee4..dbf94d2 100644
> --- a/drivers/net/davinci_emac.c
> +++ b/drivers/net/davinci_emac.c
> @@ -42,6 +42,7 @@
> #include <miiphy.h>
> #include <malloc.h>
> #include <asm/arch/emac_defs.h>
> +#include <asm/io.h>
>
> unsigned int emac_dbg = 0;
> #define debug_emac(fmt,args...) if (emac_dbg) printf(fmt,##args)
> @@ -107,6 +108,35 @@ static void davinci_eth_mdio_enable(void)
> while (adap_mdio->CONTROL & MDIO_CONTROL_IDLE) {;}
Please fix this as well while we are here. Please make this:
while (adap_mdio->CONTROL & MDIO_CONTROL_IDLE)
;
> + /* Wait for command to complete */
> + while (readl(&adap_mdio->USERACCESS0) & MDIO_USERACCESS0_GO);
Please make this:
while (readl(&adap_mdio->USERACCESS0) & MDIO_USERACCESS0_GO)
;
> +static void emac_gigabit_enable(void)
> +{
> +#ifdef DAVINCI_EMAC_GIG_ENABLE
> + int temp
> +
> + if (mdio_read(EMAC_MDIO_PHY_NUM, 0) & (1 << 6)) {
> + /*
> + * Check if link detected is giga-bit
> + * If Gigabit mode detected, enable gigbit in MAC and PHY
> + */
> + writel(EMAC_MACCONTROL_GIGFORCE |
> + EMAC_MACCONTROL_GIGABIT_ENABLE,
> + &adap_emac->MACCONTROL);
> +
> + /*
> + * The SYS_CLK which feeds the SOC for giga-bit operation
> + * does not seem to be enabled after reset as expected.
> + * Force enabling SYS_CLK by writing to the PHY
> + */
> + temp = mdio_read(EMAC_MDIO_PHY_NUM, 22);
> + temp |= (1 << 4);
> + mdio_write(EMAC_MDIO_PHY_NUM, 22, temp);
> + }
> +#endif
> +}
Can we - instead of providing an empty function when
DAVINCI_EMAC_GIG_ENABLE is not set - either omit this function
completely, or use a weak implementation instead?
> if (!phy.get_link_speed(active_phy_addr))
> return(0);
> + else
> + emac_gigabit_enable();
No "else" is needed here. Remove it, and un-indent the
emac_gigabit_enable() call.
> if (!phy.get_link_speed (active_phy_addr)) {
> printf ("WARN: emac_send_packet: No link\n");
> return (ret_status);
> - }
> + } else
> + emac_gigabit_enable();
Ditto.
> if (!phy.get_link_speed (active_phy_addr)) {
> davinci_eth_ch_teardown (EMAC_CH_TX);
> return (ret_status);
> - }
> + } else
> + emac_gigabit_enable();
And again.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
No problem is insoluble.
-- Dr. Janet Wallace, "The Deadly Years", stardate 3479.4
next prev parent reply other threads:[~2009-12-16 22:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-15 11:20 [U-Boot] [PATCH] TI: DaVinci: Updating EMAC driver for DM365, DM646x and DA8XX Nick Thompson
2009-12-16 22:00 ` Wolfgang Denk [this message]
2009-12-17 11:38 ` Nick Thompson
2009-12-17 12:03 ` Sriramakrishnan
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=20091216220037.2D4774C026@gemini.denx.de \
--to=wd@denx.de \
--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