
Dear Stefan Roese,
In message 200809251109.49798.sr@denx.de you wrote:
Wouldn't it make more sense to use a common source tree for both, like we do in Linux, too?
I'm not so sure here. In Linux it is different. All the 4xx platforms files were 100% identical. So it really made no sense to have multiple incarnations there. In U-Boot we have some differences. I'm not sure if it makes sense to try to move the common code into a separate place and reuse it there. We would have to introduce even more #ifdef's in the resulting code to make it work on Canyonlands, Glacier & Arches.
I think it definitely makes sense at least to extract common or at least very similar code.
OK, functions that are 100% identical between multiple boards are probably better moved into such a common directory (perhaps board/amcc/common). The PCI(e) related functions come to my mind first.
Not only that - already now the Arches code contains improvements (like changing hard-coded numbers into much easier readbale symbolic constants) that would make sense to go to Canyonlands and Glacier, too, but as is the existing code does not benefit from the new patches, i. e. the improvments get lost and the copied code diverges.
All this looks liek verbatim copies of the canyonlands code.
No, not 100% I'm afraid. There are subtile differences here with respect to RAPIDIO and the Canyonlands/Glacier distinction in the Canyonlands version.
Ineed. But the differences arre minimal compared to the amount of copied code.
Sure, it is always good to not duplicate code. But if the code is not 100% identical then I'm unsure what's better. Using more common board code has the following advantages and disadvantages:
- Less code duplication
- Easier to maintain
This entry alone is worth the effort. We have already too many pieces of rotting code.
- Resulting code is "uglier" by using more #ifdef's
This may or may not be the case. We have developed quite a few methods to avoid #ifdef's. And we already support Canyonlands and Glacier in one file, so why not add Arches?
- Makes it harder for custom board ports, since the code needed is scattered in more directories
On contrary: if we factor out common code now, it will be much easier for following custom ports to see which parts need to be adapted.
Not sure where to go here. Wolfgang, your call.
I think the advantages outweight the additional effort.
Best regards,
Wolfgang Denk