linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: John Rigby <jcrigby@gmail.com>
To: linuxppc <linuxppc-dev@ozlabs.org>, Wolfgang Denk <wd@denx.de>
Cc: netdev@vger.kernel.org, Piotr Ziecik <kosmo@semihalf.com>,
	Detlev Zundel <dzu@denx.de>
Subject: Re: [PATCH 02/12] fs_enet: Add MPC5121 FEC support.
Date: Thu, 7 May 2009 20:02:53 -0600	[thread overview]
Message-ID: <4b73d43f0905071902y3b51d36ct2a04c560b5acdfb9@mail.gmail.com> (raw)
In-Reply-To: <fa686aa40905070709r7478837fnefb094d46f03ae0e@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3305 bytes --]

Wolfgang,

Welcome to my world and why I gave up on this months ago.

Everyone else,

One thing to consider here is a rewrite with the goal of a new improved fec
driver that would work on both 5121 and the various mx platforms that also
have this same fec core.

Also don't forget that the register map is the same on 512x, mx and coldfire
platforms but not on the other ppc platforms so if you want to one binary to
rule them all you will need to have an offest table or some such.

John

On Thu, May 7, 2009 at 8:09 AM, Grant Likely <grant.likely@secretlab.ca>wrote:

> On Wed, May 6, 2009 at 4:41 PM, Wolfgang Denk <wd@denx.de> wrote:
> > Dear Grant,
> >
> > In message <fa686aa40905061529u11b231afle3b5bb10a2334ad0@mail.gmail.com>
> you wrote:
> >>
> >> > Agreed that it's ugly, but duplicatio9ng the code would have been even
> >> > worse. I don't think that it has multiplatform - at least not as long
> >> > as you don't ask for one image that runs on 83xx and on 512x.
> >>
> >> Actually, I *am* asking for one image that runs on 83xx, 52xx and
> >> 521x.  I already can and do build and test a single image which boots
> >> on all my 52xx boards, on my 8349 board, and on my G4 Mac.
> >
> > He. I was afraid you'd say that ;-)
> >
> > In this case I need a helping hand as I can't figure out how to make
> > this work. Any suggestions?
>
> Hmmm, it is rather ugly because the layout of fec_t is so different.
> Easiest solution would be to duplicate the driver in its entirety, but
> as you say it results in a lot of duplicate code.  It might be the
> lesser of many weevils though.
>
> Second easiest would be to factor out all the common code in the
> driver into a separate .c file that gets included by a 'wrapper' .c
> file for each config which first includes the correct definition of
> fec_t.  This approach solves the duplicate code problem, but it also
> fell out of the ugly tree and hit every branch on the way down.
>
> ie: the wrappers would look something like this:
>
> fs_enet_cpm1.c:
> #include <asm/cpm1.h>
> #include "fs_enet_main.c"
>
> fs_enet_cpm2.c:
> #include <asm/cpm2.h>
> #include "fs_enet_main.c"
>
> fs_enet_512x.c:
> #include <asm/mpc512x.h>
> #include "fs_enet_main.c"
>
> And then the makefile would be something along the lines of:
> obj-${CONFIG_FS_ENET_CPM1_ += fs_enet_cpm1.o
> obj-${CONFIG_FS_ENET_CPM2_ += fs_enet_cpm2.o
> obj-${CONFIG_FS_ENET_MPC512x_ += fs_enet_512x.o
>
> A brief look at the driver suggests that access to the fec_t structure
> is restricted to the fec-mii.c and mac-fec.c files.  It might be
> appropriate to duplicate just those files and do some form of
> fs_enet_ops to select between them.
>
> While on the topic, it looks to me like the driver could really use
> some refactoring love.  Having multiple definitions of "fec_t" is
> confusing and potentially lead to hard to find bugs if the wrong
> header gets included by anyone.  I'd like to see all the fec specific
> stuff in arch/powerpc/include/asm moved into drivers/net/fs_enet and
> renamed to reflect the hardware it is associate with.  Stuff like
> "fec_t" is far to generic, not to mention that typedefs are
> discouraged now.
>
> Regardless, I feel your pain.  It is not a pretty situation.
>
> g.
>
> --
> Grant Likely, B.Sc., P.Eng.
> Secret Lab Technologies Ltd.
>

[-- Attachment #2: Type: text/html, Size: 4196 bytes --]

  reply	other threads:[~2009-05-08  2:02 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-06 20:15 [PATCH 00/16] Add support for MPC512x Wolfgang Denk
2009-05-06 20:15 ` [PATCH 01/12] fs_enet: Use defines to set driver tunables Wolfgang Denk
2009-05-06 20:35   ` Grant Likely
2009-05-06 22:02     ` Wolfgang Denk
2009-05-06 22:41       ` Grant Likely
2009-05-06 20:15 ` [PATCH 02/12] fs_enet: Add MPC5121 FEC support Wolfgang Denk
2009-05-06 20:33   ` Grant Likely
2009-05-06 21:08     ` Scott Wood
2009-05-06 22:01     ` Wolfgang Denk
2009-05-06 22:29       ` Grant Likely
2009-05-06 22:41         ` Wolfgang Denk
2009-05-07 14:09           ` Grant Likely
2009-05-08  2:02             ` John Rigby [this message]
2009-05-08  7:52               ` David Miller
2009-05-11  6:56                 ` David Jander
2009-05-07  8:14         ` David Jander
2009-05-07 13:05       ` Kumar Gala
2009-05-06 20:40   ` David Miller
2009-05-06 22:06     ` Wolfgang Denk
2009-05-06 20:41   ` Scott Wood
2009-05-06 22:09     ` Wolfgang Denk
2009-05-06 22:39       ` Grant Likely
2009-05-14 12:38         ` Piotr Zięcik
2009-05-14 14:00           ` Grant Likely
2009-05-18 22:17             ` Benjamin Herrenschmidt
2009-05-19 11:26               ` Piotr Zięcik
2009-05-19 21:56                 ` Benjamin Herrenschmidt
2009-05-21  8:34             ` Piotr Zięcik
2009-05-21 15:36               ` Grant Likely
2009-05-06 20:15 ` [PATCH 03/12] fs_enet: Add FEC TX Alignment workaround for MPC5121 Wolfgang Denk
2009-05-06 20:37   ` Grant Likely
2009-05-06 22:12     ` Wolfgang Denk
2009-05-06 22:42       ` Grant Likely
2009-05-08  2:36         ` John Rigby
2009-05-06 20:15 ` [PATCH 04/12] mpc5121: Added reset module registers representation Wolfgang Denk
2009-05-06 20:29   ` Scott Wood
2009-05-06 21:57     ` Wolfgang Denk
2009-05-06 20:39   ` Grant Likely
2009-05-06 22:14     ` Wolfgang Denk
2009-05-06 20:15 ` [PATCH 05/12] mpc5121ads: Added Reset Module node to DTS Wolfgang Denk
2009-05-06 20:40   ` Grant Likely
2009-05-06 22:16     ` Wolfgang Denk
2009-05-06 22:46       ` Grant Likely
2009-05-06 20:15 ` [PATCH 06/12] mpc5121: Added NAND Flash Controller driver Wolfgang Denk
2009-05-06 20:59   ` Grant Likely
2009-05-08  2:22     ` John Rigby
2009-05-08  3:07       ` Grant Likely
2009-05-07  8:08   ` David Jander
2009-05-08  3:30   ` John Rigby
2009-05-13  8:41     ` Piotr Zięcik
2009-05-06 20:15 ` [PATCH 07/12] mpc5121ads: Clean up and fix NAND description in mpc5121ads DTS Wolfgang Denk
2009-05-06 21:00   ` Grant Likely
2009-05-06 20:15 ` [PATCH 08/12] mpc5121: Added I2C support Wolfgang Denk
2009-05-06 21:01   ` Grant Likely
2009-05-06 22:19     ` Wolfgang Denk
2009-05-06 22:51       ` Grant Likely
2009-05-07  2:41         ` Grant Likely
2009-05-07  6:36           ` Wolfgang Grandegger
2009-05-18 13:57             ` Piotr Zięcik
2009-05-18 14:11               ` Grant Likely
2009-05-18 14:29               ` Wolfgang Grandegger
2009-05-19  7:47                 ` Piotr Zięcik
2009-05-19  8:10                   ` Wolfgang Grandegger
2009-05-08  2:12           ` John Rigby
2009-05-08  3:01             ` Grant Likely
2009-05-06 20:15 ` [PATCH 09/12] mpc5121ads: Added I2C RTC node to mpc5121ads DTS Wolfgang Denk
2009-05-06 21:02   ` Grant Likely
2009-05-07  6:45   ` Wolfgang Grandegger
2009-05-06 20:15 ` [PATCH 10/12] mpc5121: Add MPC5121 Real time clock driver Wolfgang Denk
2009-05-06 21:03   ` Grant Likely
2009-05-06 21:06   ` Wolfram Sang
2009-05-06 22:40     ` Grant Likely
2009-05-08  2:41       ` [rtc-linux] " John Rigby
2009-05-08 15:53         ` Grant Likely
2009-05-08 16:09           ` Alessandro Zummo
2009-05-08 19:18             ` Wolfgang Denk
2009-05-08 16:10           ` Alessandro Zummo
2009-05-06 20:15 ` [PATCH 11/12] mpc5121: Added MPC512x DMA driver Wolfgang Denk
2009-05-06 21:07   ` Grant Likely
2009-05-08  2:49     ` John Rigby
2009-05-19  1:37   ` Hongjun Chen
2009-05-19  8:03     ` Piotr Zięcik
2009-05-20  0:39       ` Hongjun Chen
2009-05-06 20:15 ` [PATCH 12/12] mpc5121: Added default config for MPC5121 Wolfgang Denk
2009-05-06 21:08   ` Grant Likely
2009-05-06 22:23     ` Wolfgang Denk
2009-05-06 22:48       ` Grant Likely

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=4b73d43f0905071902y3b51d36ct2a04c560b5acdfb9@mail.gmail.com \
    --to=jcrigby@gmail.com \
    --cc=dzu@denx.de \
    --cc=kosmo@semihalf.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=netdev@vger.kernel.org \
    --cc=wd@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;
as well as URLs for NNTP newsgroup(s).