
On 31 août 2011, at 15:01, Stefano Babic wrote:
Hi Eric,
Sorry for the confusion, I did not understood that your remark was not related to the compilation flags. Now, I've checked how to have this U-Boot commands in the driver itself. I think it's doable if I can have a compilation CONFIG_CMD_XXX to enable the command line feature.
You could add a CONFIG_DM9000_* switch. This set a switch only for the DM9000 driver and the name remembers that it is used only inside the driver itself, such as CONFIG_DM9000_DEBUG and CONFIG_DM9000_BASE that are currently used in the driver.
In such a case MAKEALL fails to compile the trizepsiv board with a double definition of 'do_dm9000_eeprom'.
Without this option, there is a direct impact one memory footprint for every board featuring the DM9000 controller and I failed to find any model of driver with an optional command line interface in a driver.
Or you can reuse CONFIG_DM9000_NO_SROM (already in driver) and enable your command if this switch is not defined. If the eeprom is present, it makes sense to have this command enabled.
That makes sense but there is still a compilation failure and some impact on 7 other boards.
Why do you recommend to put the command interface in drivers as it is seems to be something quite unusual in U-Boot ?
Not sure it is so unusual. I see that all commands under common/* are general commands, and they are not related to a specific driver. There are then two commands in drivers, drivers/misc/fsl_pmic.c and drivers/qe/qe.c. These commands are only related to these drivers and make no sense without the driver. I see then a lot of board related commands stored in the board directories.
If I understand well the concept, each command resides where it is thought: general commands in common, board commands in board directories, driver commands in the driver itself. If your command is in the driver file, there is also no need to check if CONFIG_DRIVER_DM9000 is set, because the file is simply not compiled if it is unset.
I understand your point of view but I am not sure at all that board maintainers will want to give a command interface to modify the content of the DM9000 eeprom.
Best regards, Eric