openbmc / linux

OpenBMC Linux kernel source tree
Other
49 stars 132 forks source link

Disadvantages of DTS files? #154

Closed ouyangxx10 closed 6 years ago

ouyangxx10 commented 6 years ago

When I use the DTS file in the linux kernel, the linux kernel almost implementation all the driver of device, such as pca95xx, gpio-led, some i2c devices. But there is a downside to this approach. Sometimes, when BMC bootup and load device driver and the driver need communicate with the device, need read or write the register of the device, that means the device need init before the BMC load the device driver. But the device may be init after the OS power up. There is a problem: the BMC bootup before the OS, and will occur the error of loading device driver. Do we have a way to solve this problem and then continue to use DTS to configure the device? such as the device of ina219.

[    3.334714] ina2xx 1-0040: error configuring the device: -6
[    3.348700] ina2xx 1-0041: error configuring the device: -6
ya-mouse commented 6 years ago

We use such re-order stuff for built-in modules to make i2c appear earlier: https://github.com/ya-mouse/meta-openbmc-yandex/blob/master/meta-yandex/meta-openrack/meta-shaosi/recipes-kernel/linux/linux-obmc/021-i2c-driver-order.patch

ouyangxx10 commented 6 years ago

@ya-mouse The patch just order the i2c device driver loading in all the driver. I think the patch can not resolve my problem. We cannot cconfirm the time od "ina219" device driver need to load, not sure it will wait one min or one day or even more long time. I think the DST file lack a condition to judge when the driver need loading. thanks.

ya-mouse commented 6 years ago

Regarding to the message above ("No such device or address"), you don't have i2c subsystem at the time of ina2xx loading: devm_regmap_init_i2c The driver will not wait, but moving i2c upper might add some time between ina2xx load and i2c bus init. There is nothing to do with DTS as far as with old fashion way with platform's definition. If re-order wouldn't help (you may try anyway), I would recommend to add init script to load this driver. We use overlay-stuff (backported from RaspberryPi) to load/unload additional DTS on-the-fly when needed.

ouyangxx10 commented 6 years ago

maybe need load the driver when it need it, thanks.