[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201001231023.14372.arnd@arndb.de>
Date: Sat, 23 Jan 2010 10:23:14 +0100
From: Arnd Bergmann <arnd@...db.de>
To: linuxppc-dev@...ts.ozlabs.org
Cc: Wolfgang Grandegger <wg@...ndegger.com>,
David Miller <davem@...emloft.net>, wd@...x.de, dzu@...x.de,
netdev@...r.kernel.org, linuxppc-dev@...abs.org, agust@...x.de,
kosmo@...ihalf.com
Subject: Re: [net-next-2.6 PATCH 2/3] fs_enet: Add support for MPC512x to fs_enet driver
On Thursday 21 January 2010, Wolfgang Grandegger wrote:
> The major problem that Anatolij tries to solve are the different
> register layouts of the supported SOCs, MPC52xx and MPC8xx. They use the
> same registers but at different offsets. Therefore we cannot handle
> this with a single "fec_t" struct to allow building a single kernel
> image. Instead it's handled by filling a table with register addresses:
>
> if (of_device_is_compatible(ofdev->node, "fsl,mpc5121-fec")) {
> fep->fec.fec_id = FS_ENET_MPC5121_FEC;
> fec_reg_mpc5121(ievent);
> fec_reg_mpc5121(imask);
> ...
> } else {
> fec_reg_mpc8xx(ievent);
> fec_reg_mpc8xx(imask);
> ...
> }
>
> Do you see a more clever solution to this problem? Nevertheless, the
> code could be improved by using "offsetof", I think.
Is there any chance of building a kernel that runs on both mpc8xx and
mpc5121? AFAIK, the 5121 is built on a 6xx core which is fundamentally
incompatible with 8xx due to different memory management etc.
Since this makes it all a compile-time decision, it should be solvable
with a very small number of carefully placed #ifdef in the header files
an no runtime detection at all.
Obviously this approach would not work for drivers that want to be portable
across different register layouts on otherwise compatible platforms.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists