From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [IXP42x PATCH series v4 12/17] IXP NPE: add support for fixed-speed MII ports
Date: Sat, 21 May 2011 02:05:43 +0200 [thread overview]
Message-ID: <201105210205.43479.marek.vasut@gmail.com> (raw)
In-Reply-To: <1302126558-1318-13-git-send-email-michael@schwingen.org>
On Wednesday, April 06, 2011 11:49:13 PM Michael Schwingen wrote:
> Signed-off-by: Michael Schwingen <michael@schwingen.org>
> ---
> Changes for V2:
> Changes for V3:
> - coding style / indentation cleanup
> - move config.h changes to AcTux2/AcTux3 board patches
> Changes for V4:
> - add changelog
>
> arch/arm/cpu/ixp/npe/npe.c | 67
> +++++++++++++++++++++++++++---------------- 1 files changed, 42
> insertions(+), 25 deletions(-)
>
> diff --git a/arch/arm/cpu/ixp/npe/npe.c b/arch/arm/cpu/ixp/npe/npe.c
> index 6d92c53..f0e02bf 100644
> --- a/arch/arm/cpu/ixp/npe/npe.c
> +++ b/arch/arm/cpu/ixp/npe/npe.c
> @@ -359,36 +359,53 @@ static int npe_init(struct eth_device *dev, bd_t *
> bis)
>
> debug("%s: 1\n", __FUNCTION__);
>
> - miiphy_read (dev->name, p_npe->phy_no, MII_BMSR, ®_short);
> -
> - /*
> - * Wait if PHY is capable of autonegotiation and autonegotiation is not
> complete - */
> - if ((reg_short & BMSR_ANEGCAPABLE) && !(reg_short & BMSR_ANEGCOMPLETE)) {
> - puts ("Waiting for PHY auto negotiation to complete");
> - i = 0;
> - while (!(reg_short & BMSR_ANEGCOMPLETE)) {
> - /*
> - * Timeout reached ?
> - */
> - if (i > PHY_AUTONEGOTIATE_TIMEOUT) {
> - puts (" TIMEOUT !\n");
> - break;
> - }
> +#ifdef CONFIG_MII_NPE0_FIXEDLINK
> + if (0 == p_npe->eth_id) {
> + speed = CONFIG_MII_NPE0_SPEED;
> + duplex = CONFIG_MII_NPE0_FULLDUPLEX ? FULL : HALF;
> + } else
> +#endif
> +#ifdef CONFIG_MII_NPE1_FIXEDLINK
> + if (1 == p_npe->eth_id) {
> + speed = CONFIG_MII_NPE1_SPEED;
> + duplex = CONFIG_MII_NPE1_FULLDUPLEX ? FULL : HALF;
> + } else
> +#endif
Maybe you can bend the CPP here a bit to avoid code duplication ?
> + {
> + miiphy_read(dev->name, p_npe->phy_no, MII_BMSR, ®_short);
> +
> + /*
> + * Wait if PHY is capable of autonegotiation and
> + * autonegotiation is not complete
> + */
> + if ((reg_short & BMSR_ANEGCAPABLE) &&
> + !(reg_short & BMSR_ANEGCOMPLETE)) {
> + puts("Waiting for PHY auto negotiation to complete");
> + i = 0;
> + while (!(reg_short & BMSR_ANEGCOMPLETE)) {
> + /*
> + * Timeout reached ?
> + */
> + if (i > PHY_AUTONEGOTIATE_TIMEOUT) {
> + puts(" TIMEOUT !\n");
> + break;
> + }
>
> - if ((i++ % 1000) == 0) {
> - putc ('.');
> - miiphy_read (dev->name, p_npe->phy_no, MII_BMSR,
®_short);
> + if ((i++ % 1000) == 0) {
> + putc('.');
> + miiphy_read(dev->name, p_npe->phy_no,
> + MII_BMSR, ®_short);
> + }
> + udelay(1000); /* 1 ms */
> }
> - udelay (1000); /* 1 ms */
> + puts(" done\n");
> + /* another 500 ms (results in faster booting) */
> + udelay(500000);
> }
> - puts (" done\n");
> - udelay (500000); /* another 500 ms (results in faster booting) */
> + speed = miiphy_speed(dev->name, p_npe->phy_no);
> + duplex = miiphy_duplex(dev->name, p_npe->phy_no);
> }
>
> - speed = miiphy_speed (dev->name, p_npe->phy_no);
> - duplex = miiphy_duplex (dev->name, p_npe->phy_no);
> -
> if (p_npe->print_speed) {
> p_npe->print_speed = 0;
> printf ("ENET Speed is %d Mbps - %s duplex connection\n",
next prev parent reply other threads:[~2011-05-21 0:05 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-06 21:49 [U-Boot] [IXP42x PATCH series v4 00/17] Overview Michael Schwingen
2011-04-06 21:49 ` [U-Boot] [IXP42x PATCH series v4 01/17] add XScale sub architecture (IXP/PXA) to maintainer list Michael Schwingen
2011-05-20 23:53 ` Marek Vasut
2011-04-06 21:49 ` [U-Boot] [IXP42x PATCH series v4 02/17] add support for IXP42x Rev. B1 and newer Michael Schwingen
2011-05-20 23:53 ` Marek Vasut
2011-05-21 18:31 ` Wolfgang Denk
2011-04-06 21:49 ` [U-Boot] [IXP42x PATCH series v4 03/17] trigger hardware watchdog in IXP42x serial driver Michael Schwingen
2011-05-20 23:54 ` Marek Vasut
2011-04-06 21:49 ` [U-Boot] [IXP42x PATCH series v4 04/17] Fix IXP code to work after relocation was added Michael Schwingen
2011-05-20 23:58 ` Marek Vasut
2011-05-22 19:15 ` Michael Schwingen
2011-05-23 0:38 ` Marek Vasut
2011-04-06 21:49 ` [U-Boot] [IXP42x PATCH series v4 05/17] fix "depend" target in npe directory Michael Schwingen
2011-05-20 23:59 ` Marek Vasut
2011-04-06 21:49 ` [U-Boot] [IXP42x PATCH series v4 06/17] support CONFIG_SYS_LDSCRIPT on ARM Michael Schwingen
2011-05-22 15:33 ` Marek Vasut
2011-04-06 21:49 ` [U-Boot] [IXP42x PATCH series v4 07/17] use -ffunction-sections / --gc-sections on IXP42x Michael Schwingen
2011-04-06 21:49 ` [U-Boot] [IXP42x PATCH series v4 08/17] update/fix AcTux1 board Michael Schwingen
2011-05-21 0:03 ` Marek Vasut
2011-05-22 15:36 ` Marek Vasut
2011-05-22 21:53 ` Michael Schwingen
2011-05-22 19:51 ` Michael Schwingen
2011-04-06 21:49 ` [U-Boot] [IXP42x PATCH series v4 09/17] update/fix AcTux2 board Michael Schwingen
2011-04-06 21:49 ` [U-Boot] [IXP42x PATCH series v4 10/17] update/fix AcTux3 board Michael Schwingen
2011-04-06 21:49 ` [U-Boot] [IXP42x PATCH series v4 11/17] update/fix AcTux4 board Michael Schwingen
2011-04-06 21:49 ` [U-Boot] [IXP42x PATCH series v4 12/17] IXP NPE: add support for fixed-speed MII ports Michael Schwingen
2011-05-21 0:05 ` Marek Vasut [this message]
2011-04-06 21:49 ` [U-Boot] [IXP42x PATCH series v4 13/17] add dvlhost (dLAN 200 AV Wireless G) board Michael Schwingen
2011-05-21 0:06 ` Marek Vasut
2011-05-22 20:53 ` Michael Schwingen
2011-04-06 21:49 ` [U-Boot] [IXP42x PATCH series v4 14/17] update/fix IXDP425 / IXDPG425 boards Michael Schwingen
2011-04-06 21:49 ` [U-Boot] [IXP42x PATCH series v4 15/17] update/fix PDNB3 board Michael Schwingen
2011-04-06 21:49 ` [U-Boot] [IXP42x PATCH series v4 16/17] IXP42x PCI rewrite Michael Schwingen
2011-04-06 21:49 ` [U-Boot] [IXP42x PATCH series v4 17/17] run arm_pci_init after relocation Michael Schwingen
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=201105210205.43479.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