All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: Sergej Stepanov <Sergej.Stepanov@ids.de>
Cc: linuxppc-dev <linuxppc-dev@ozlabs.org>
Subject: Re: [PATCH] using mii-bitbang on different processor ports
Date: Tue, 30 Oct 2007 11:32:00 -0500	[thread overview]
Message-ID: <20071030163200.GA4470@loki.buserror.net> (raw)
In-Reply-To: <1193760559.6244.25.camel@p60635-ste.ids.de>

On Tue, Oct 30, 2007 at 05:09:19PM +0100, Sergej Stepanov wrote:
> The patch makes possible to have mdio and mdc pins on different physical ports
> also for CONFIG_PPC_CPM_NEW_BINDING.
> To setup it in the device tree:
> reg = <10d40 14 10d60 14>; // mdc-offset: 0x10d40, mdio-offset: 0x10d60
> or
> reg = <10d40 14>; // mdc and mdio have the same offset 0x10d40
> The approach was taken from older version.

There are some formatting issues in fs_mii_bitbang_init(), but otherwise it
looks good.  It'll need to be sent to Jeff Garzik and the netdev list, not
just linuxppc-dev, though.

Also, please update Documentation/powerpc/booting-without-of.txt (probably
in a separate patch, since that one would go through Paul).

> @@ -142,13 +146,27 @@ static int __devinit fs_mii_bitbang_init(struct mii_bus *bus,
>  		return -ENODEV;
>  	mdc_pin = *data;
>  
> -	bitbang->dir = ioremap(res.start, res.end - res.start + 1);
> -	if (!bitbang->dir)
> +	bitbang->mdc.dir = ioremap(res[0].start, res[0].end - res[0].start + 1);
> +	if (!bitbang->mdc.dir)
>  		return -ENOMEM;
>  
> -	bitbang->dat = bitbang->dir + 4;
> -	bitbang->mdio_msk = 1 << (31 - mdio_pin);
> -	bitbang->mdc_msk = 1 << (31 - mdc_pin);
> +	bitbang->mdc.dat = bitbang->mdc.dir + 4;
> +	if( !of_address_to_resource(np, 1, &res[1]))

Space before the '(', not after.  A newline after the previous line would be
nice, too.

> +	{

Brace at the end of the previous line.

> +		bitbang->mdio.dir = ioremap(res[1].start, res[1].end - res[1].start + 1);
> +		if (!bitbang->mdio.dir)
> +		{

Likewise.

You could just use of_iomap() for the second one, since we don't need
the physical address for bus->id.

> +			iounmap(bitbang->mdc.dir);
> +			return -ENOMEM;

Please use the goto-style error handling that's used elsewhere in the
function.

> +		}
> +		bitbang->mdio.dat = bitbang->mdio.dir + 4;
> +	}
> +	else{

} else {

>  out_unmap_regs:
> -	iounmap(bitbang->dir);
> +	if ( bitbang->mdio.dir != bitbang->mdc.dir)
> +		iounmap(bitbang->mdio.dir);
> +	iounmap(bitbang->mdc.dir);
>  out_free_bus:
>  	kfree(new_bus);
>  out_free_priv:
> @@ -238,7 +258,9 @@ static int fs_enet_mdio_remove(struct of_device *ofdev)
>  	free_mdio_bitbang(bus);
>  	dev_set_drvdata(&ofdev->dev, NULL);
>  	kfree(bus->irq);
> -	iounmap(bitbang->dir);
> +	if ( bitbang->mdio.dir != bitbang->mdc.dir)
> +		iounmap(bitbang->mdio.dir);
> +	iounmap(bitbang->mdc.dir);
>  	kfree(bitbang);
>  	kfree(bus);

"if (bitbang", not "if ( bitbang".

-Scott

  reply	other threads:[~2007-11-02 18:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-30 16:09 [PATCH] using mii-bitbang on different processor ports Sergej Stepanov
2007-10-30 16:32 ` Scott Wood [this message]
2007-10-30 16:58   ` Sergej Stepanov
2007-10-30 17:16     ` Scott Wood
2007-10-31  2:50 ` Stephen Rothwell

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=20071030163200.GA4470@loki.buserror.net \
    --to=scottwood@freescale.com \
    --cc=Sergej.Stepanov@ids.de \
    --cc=linuxppc-dev@ozlabs.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.