From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Warren Date: Tue, 13 Nov 2012 10:30:06 -0700 Subject: [U-Boot] [PATCH 2/2] WIP: tegra: i2c: Enable new CONFIG_SYS_I2C framework In-Reply-To: <50A1E780.4090807@denx.de> References: <1351618133-14909-1-git-send-email-sjg@chromium.org> <1351618133-14909-2-git-send-email-sjg@chromium.org> <50905561.90602@wwwdotorg.org> <5090BE73.6050501@denx.de> <509146C5.8020301@wwwdotorg.org> <509150E4.2050206@wwwdotorg.org> <509227DF.9070107@denx.de> <5092AB68.6080801@wwwdotorg.org> <509B556A.1050808@denx.de> <509BE63F.8030701@wwwdotorg.org> <50A1E780.4090807@denx.de> Message-ID: <50A2839E.1030905@wwwdotorg.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 11/12/2012 11:24 PM, Heiko Schocher wrote: > Hello Stephen, > > On 08.11.2012 18:05, Stephen Warren wrote: >> On 11/07/2012 11:47 PM, Heiko Schocher wrote: >>> On 01.11.2012 18:03, Stephen Warren wrote: >> ... >>>> I'd suggest having a CONFIG_SYS_I2C_DRIVERS variable at most, and each >>>> driver registers an arbitrary number of adapters and/or buses during >>>> its >>>> initialization. >>> >>> Why should an i2c driver register buses? That is board specific. >> >> I don't entirely agree here. Certainly the information is >> board-specific, but I don't believe that precludes bus registration >> occurring from the I2C adapter drivers themselves, based on information >> passed from a board file or device tree. >> >> If a particular adapter is instantiated by the board, then there is >> clearly an I2C bus attached to that adapter. Hence, it's quite >> reasonable for the adapter itself to register the bus directly attached >> to it. > > But some i2c drivers have more than one instance... would you for all > boards register all possible instances of a driver? ... Register, but perhaps not initialize, seems fine to me. After all, what if the user wishes to use the I2C adapters for some custom command; up-front registration of all valid adapters is required for that, although actual initialization can always be deferred until if/when the adapter is actually used. The other issue is that as I pointed out before, the move to define which I2C (and all other peripheral) adapters are used via device tree rather than board/config files on some U-Boot platforms seems completely at odds with not always registering all I2C adapters, at least on the platforms that use device tree. >> Following on from there, if there's an I2C bus mux attached to some I2C >> bus, then there are clearly I2C buses downstream from the bus mux, and >> the bus mux driver knows exactly how many there are, and can register >> those buses. > > Here again, why register all possible buses? We are just a bootloader ... I don't see how being a bootloader is relevant. After all, people can use for example U-Boot I2C or GPIO commands for board bringup, to implement HW initialization via custom boot scripts, etc.