On Thu, Feb 02, 2023 at 11:42:49AM +1030, Andrew Jeffery wrote: > > > On Wed, 1 Feb 2023, at 23:58, Clay Chang wrote: > > Hi Andrew, > > > > On Tue, Jan 31, 2023 at 09:46:42PM +0800, Clay Chang wrote: > >> > I'm trying to understand whether we can find some common ground with > >> > controlling e.g. Aspeed's BMCs LPC peripherals based on Arnd's query[1], > >> > but the description is a bit too vague right now for me to be able to do > >> > that. > >> > > >> > [1] https://lore.kernel.org/all/66ef9643-b47e-428d-892d-7c1cbd358a5d@xxxxxxxxxxxxxxxx/ > >> > > >> > Andrew > > > > I briefly studied driver/soc/aspeed/aspeed-lpc-ctrl.c, and IMO the > > similarity between HPE GXP driver and Aspeed's could be that we both > > expose the LPC memory addresses or registers for configuration purposes. > > However, the functions to be configured could vary. There are a few sets > > of registers that HPE wants to expose for configuration in the future. > > The talk of "exposing registers" feels concerning - we're trying not to > do that directly. Instead we want to lift out an API that constrains > the behaviour a bit but works for both of us if there's overlap in > functionality. > Let me describe it more clearly. We don't expose the registers directly to the user. We describe those registers in the device tree, and then the driver exposes them though sysfs interfaces. Users access the registers through the device attributes defined under the sysfs structure (e.g. /sys/class/soc/srom/vromoff) exposed by the driver. In the show/store function pair, we get or set the regmap or memory, validate input, do sanity check, synchronization, and so on. I learned that in the drivers/soc/aspeed/aspeed-lpc-ctrl.c, both mmap and ioctl were used, and revelant ioctl commands were defined in include/uapi/linux/aspeed-lpc-ctrl.h. Is this what you mean an API for aspeed? And we are trying to see if there are commonalities among us? If yes, yeah I think it is good to see a common abstraction for BMC chips. Accroding to [1], I'd comment that, in terms of flash update, what we want to do is similar to what was described in [1]. The SROM driver I am working on partially layouts the registers for flash update for HPE GXP hardware. BTW, the way for user to access the registers is flexible - ioctl should work as well. > Can you point to any documentation of the behaviour of your hardware? > It's still a little vague to me. > > Andrew I wish I could, but there is not yet a technical document or datasheet available to the public. Sorry. [1] https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git/commit/?h=v6.2-rc4&id=6c4e976785011dfbe461821d0bfc58cfd60eac56 Thanks, Clay