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 _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev