public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Detlev Zundel <dzu@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 7/7] tsec: Convert tsec to use PHY Lib
Date: Wed, 30 Mar 2011 14:32:26 +0200	[thread overview]
Message-ID: <m24o6kn605.fsf@ohwell.denx.de> (raw)
In-Reply-To: <1301427010-7429-8-git-send-email-afleming@freescale.com> (Andy Fleming's message of "Tue, 29 Mar 2011 14:30:10 -0500")

Hi Andy,

> This converts tsec to use the new PHY Lib.  All of the old PHY support
> is ripped out.  The old MDIO driver is split off, and placed in
> fsl_mdio.c.  The initialization is modified to initialize the MDIO
> driver as well.  The powerpc config file is modified to configure PHYLIB
> if TSEC_ENET is configured.
>
> Signed-off-by: Mingkai Hu <Mingkai.hu@freescale.com>
> Signed-off-by: Andy Fleming <afleming@freescale.com>

[...]

> diff --git a/drivers/net/fsl_mdio.c b/drivers/net/fsl_mdio.c
> new file mode 100644
> index 0000000..3239171
> --- /dev/null
> +++ b/drivers/net/fsl_mdio.c
> @@ -0,0 +1,117 @@
> +/*
> + * Copyright 2009-2010 Freescale Semiconductor, Inc.
> + *	Jun-jie Zhang <b18070@freescale.com>
> + *	Mingkai Hu <Mingkai.hu@freescale.com>
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License as
> + * published by the Free Software Foundation; either version 2 of
> + * the License, or (at your option) any later version.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> + * MA 02111-1307 USA
> + */
> +#include <common.h>
> +#include <miiphy.h>
> +#include <phy.h>
> +#include <fsl_mdio.h>
> +#include <asm/io.h>
> +#include <asm/errno.h>
> +#include <asm/fsl_enet.h>
> +
> +void tsec_local_mdio_write(tsec_mii_t *phyregs, int port_addr,
> +		int dev_addr, int regnum, int value)
> +{
> +	int timeout = 1000000;
> +
> +	out_be32(&phyregs->miimadd, (port_addr << 8) | (regnum & 0x1f));
> +	out_be32(&phyregs->miimcon, value);
> +	asm("sync");
> +
> +	while ((in_be32(&phyregs->miimind) & MIIMIND_BUSY) && timeout--);

Semicolon needs to be on its own line.

> +}
> +
> +int tsec_local_mdio_read(tsec_mii_t *phyregs, int port_addr,
> +		int dev_addr, int regnum)
> +{
> +	int value;
> +	int timeout = 1000000;
> +
> +	/* Put the address of the phy, and the register
> +	 * number into MIIMADD */
> +	out_be32(&phyregs->miimadd, (port_addr << 8) | (regnum & 0x1f));
> +
> +	/* Clear the command register, and wait */
> +	out_be32(&phyregs->miimcom, 0);
> +	asm("sync");
> +
> +	/* Initiate a read command, and wait */
> +	out_be32(&phyregs->miimcom, MIIMCOM_READ_CYCLE);
> +	asm("sync");
> +
> +	/* Wait for the the indication that the read is done */
> +	while ((in_be32(&phyregs->miimind) & (MIIMIND_NOTVALID | MIIMIND_BUSY))
> +			&& timeout--);

dito.

Other than that this also looks good, so once my concerns are addressed:

Acked-by: Detlev Zundel <dzu@denx.de>

Cheers
  Detlev

-- 
Markov does it in chains.
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de

  reply	other threads:[~2011-03-30 12:32 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-29 19:30 [U-Boot] [RFC 0/7] Universal PHY Infrastructure Andy Fleming
2011-03-29 19:30 ` [U-Boot] [PATCH 1/7] tsec: use IO accessories to access the register Andy Fleming
2011-03-29 19:30   ` [U-Boot] [PATCH 2/7] tsec: arrange the code to avoid useless function declaration Andy Fleming
2011-03-29 19:30     ` [U-Boot] [PATCH 3/7] Remove instances of phy_read/write Andy Fleming
2011-03-29 19:30       ` [U-Boot] [PATCH 4/7] Create PHY Lib for U-Boot Andy Fleming
2011-03-29 19:30         ` [U-Boot] [PATCH 5/7] Add mdio command for new PHY infrastructure Andy Fleming
2011-03-29 19:30           ` [U-Boot] [PATCH 6/7] phylib: Add a bunch of PHY drivers from tsec Andy Fleming
2011-03-29 19:30             ` [U-Boot] [PATCH 7/7] tsec: Convert tsec to use PHY Lib Andy Fleming
2011-03-30 12:32               ` Detlev Zundel [this message]
2011-03-30 12:26             ` [U-Boot] [PATCH 6/7] phylib: Add a bunch of PHY drivers from tsec Detlev Zundel
2011-03-31  1:13               ` Andy Fleming
2011-03-30 11:55           ` [U-Boot] [PATCH 5/7] Add mdio command for new PHY infrastructure Detlev Zundel
2011-03-30 23:05             ` Andy Fleming
2011-03-30 23:18           ` Mike Frysinger
2011-03-30 11:47         ` [U-Boot] [PATCH 4/7] Create PHY Lib for U-Boot Detlev Zundel
2011-03-30 11:11       ` [U-Boot] [PATCH 3/7] Remove instances of phy_read/write Detlev Zundel
2011-03-30 11:07     ` [U-Boot] [PATCH 2/7] tsec: arrange the code to avoid useless function declaration Detlev Zundel
2011-03-31  8:13     ` Kumar Gala
2011-03-31 14:01       ` Fleming Andy-AFLEMING
2011-03-31  8:12   ` [U-Boot] [PATCH 1/7] tsec: use IO accessories to access the register Kumar Gala
2011-03-30 12:06 ` [U-Boot] [RFC 0/7] Universal PHY Infrastructure Detlev Zundel

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=m24o6kn605.fsf@ohwell.denx.de \
    --to=dzu@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