From: Masahiro Yamada Date: Mon, 26 Jan 2015 11:08:46 +0900 Subject: [U-Boot] [PATCH v3 0/26] dm: Add additional bus functionality In-Reply-To: <1422199640-25811-1-git-send-email-sjg@chromium.org> References: <1422199640-25811-1-git-send-email-sjg@chromium.org> Message-ID: <20150126110846.5EB5.AA925319@jp.panasonic.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Simon, On Sun, 25 Jan 2015 08:26:54 -0700 Simon Glass wrote: > The current bus implementation is simple but leaves some things to drivers > which are better handled in the uclass. > > At present uclasses cannot provide a common way of dealing with children > (i.e. devices on the bus), so we have duplication in the drivers. The same > code is repeated in each driver when it would be better to put it in the > uclass. > > Secondly, we don't have the concept of per-child platform data for devices > on the bus. Instead the per-child data can only exist when the child is > actually probed. This is not really suitable. Examples of things we want to > know before a child is probed are: > > - chip address (for I2C) > - chip select (for SPI) > - device address (for PCI) > > These things are static and do not change when the device is probed and > removed. In some cases (such as SPI mode and maximum speed), the data may > be copied to run-time data when the device is probed. It may then be changed > while the driver is active, but the original platform data is never changed > by drivers once it is set up. > > To address these issues, additional functions are added: > > - per-child platform data, which can be defined by the uclass and (if > necessary) overriden by the bus driver. This allows the bus's uclass to > provide some consistency here > - per-child post-bind and pre-probe methods in the uclass. These allow the > bus uclass to set up the per-child platform data, and also to do any > last-minute adjustments before the child is probed. > > With these changes, some code can be removed from the existing I2C and SPI > drivers and this has been done as part of this series. > > With this series I2C and SPI are tested on: > - jetson-tk1 (Tegra 124) > - beaver (Tegra 30) > - seaboard (Tegra 20, I2C only) > - trimslice (Tegra 20, SPI only) > - snow (Exynos 5250) > - pit (Exynos 5420, note I2C probe is previously broken) > - link (x86) > - sandbox > > Note: Some of these changes were previously included in the DM PCI RFC. This > series is available at u-boot-dm/i2c-working. > > Changes in v3: > - Add missing 'static' to two functions > - Change variable name from parent_drv to uc_drv > - Fix comment to say 'node references' instead of 'phandles' > - Fix stale comment in device_probe_child() > - Fix typo in commit subject > - Remove unnecessary check that dev->parent_platdata is NULL > - Remove unnecessary per_child_auto_alloc_size value I issued my Reviewed-by to some rest of the patches. V3 looks good enough to be applied. Thank you! Best Regards Masahiro Yamada