From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7008C432BE for ; Fri, 27 Aug 2021 03:09:09 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E540760F5C for ; Fri, 27 Aug 2021 03:09:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E540760F5C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeconstruct.com.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Gwl6q18qBz2ypn for ; Fri, 27 Aug 2021 13:09:07 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=codeconstruct.com.au (client-ip=203.29.241.158; helo=codeconstruct.com.au; envelope-from=jk@codeconstruct.com.au; receiver=) Received: from codeconstruct.com.au (pi.codeconstruct.com.au [203.29.241.158]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Gwl6G5lNMz2xnd; Fri, 27 Aug 2021 13:08:38 +1000 (AEST) Received: from pecola.lan (unknown [159.196.93.152]) by mail.codeconstruct.com.au (Postfix) with ESMTPSA id BC8942012C; Fri, 27 Aug 2021 11:08:33 +0800 (AWST) Message-ID: Subject: Re: [PATCH v3 3/4] soc: aspeed: Add eSPI driver From: Jeremy Kerr To: Chia-Wei Wang , joel@jms.id.au, robh+dt@kernel.org, andrew@aj.id.au, linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Date: Fri, 27 Aug 2021 11:08:31 +0800 In-Reply-To: <20210826061623.6352-4-chiawei_wang@aspeedtech.com> References: <20210826061623.6352-1-chiawei_wang@aspeedtech.com> <20210826061623.6352-4-chiawei_wang@aspeedtech.com> Content-Type: multipart/alternative; boundary="=-TZ3lhG3ptk97Vn50SDMo" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openbmc-bounces+openbmc=archiver.kernel.org@lists.ozlabs.org Sender: "openbmc" --=-TZ3lhG3ptk97Vn50SDMo Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Hi Chia-Wei, > The Aspeed eSPI controller is slave device to communicate with > the master through the Enhanced Serial Peripheral Interface (eSPI). > All of the four eSPI channels, namely peripheral, virtual wire, > out-of-band, and flash are supported. Great to have this added submitted upstream! A few comments though: > --- >  drivers/soc/aspeed/Kconfig             |  11 + >  drivers/soc/aspeed/Makefile            |   1 + >  drivers/soc/aspeed/aspeed-espi-ctrl.c  | 205 +++++++++ >  drivers/soc/aspeed/aspeed-espi-ctrl.h  | 304 ++++++++++++ >  drivers/soc/aspeed/aspeed-espi-flash.h | 380 +++++++++++++++ >  drivers/soc/aspeed/aspeed-espi-ioc.h   | 153 +++++++ >  drivers/soc/aspeed/aspeed-espi-oob.h   | 611 +++++++++++++++++++++++++ >  drivers/soc/aspeed/aspeed-espi-perif.h | 539 ++++++++++++++++++++++ >  drivers/soc/aspeed/aspeed-espi-vw.h    | 142 ++++++ This structure is a bit odd - you have the one -crtl.c file, which defines the actual driver, but then a bunch of headers that contain more code than header-type definitions. Is there any reason that -flash, -ioc, -oob, -perif and -vw components can't be standard .c files? Then, for the userspace ABI: it looks like you're exposing everything through new device-specific ioctls. Would it not make more sense to use existing interfaces? For example, the virtual wire bits could be regular GPIOs; the flash interface could be a mtd or block device. I understand that we'll likely still need some level of custom device control, but the more we can use generic interfaces for, the less custom code (and interfaces) we'll need on the userspace side. Cheers, Jeremy --=-TZ3lhG3ptk97Vn50SDMo Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
Hi Chia-Wei,

> The Aspeed eSPI controller is slave device to communicate with=
> the master through the Enhanced Serial Peripheral Interface=
 (eSPI).
> All of the four eSPI channels, namely peripheral, v=
irtual wire,
> out-of-band, and flash are supported.

Great to have this added submitted upstream! A few comments=
 though:

> ---
>  drivers/soc=
/aspeed/Kconfig          =
   |  11 +
>  drivers/soc/aspeed/Makefile&=
nbsp;           | &n=
bsp; 1 +
>  drivers/soc/aspeed/aspeed-espi-ctrl.c  |=
 205 +++++++++
>  drivers/soc/aspeed/aspeed-espi-ctrl.h&n=
bsp; | 304 ++++++++++++
>  drivers/soc/aspeed/aspeed-espi=
-flash.h | 380 +++++++++++++++
>  drivers/soc/aspeed/aspe=
ed-espi-ioc.h   | 153 +++++++
>  drivers/soc/as=
peed/aspeed-espi-oob.h   | 611 +++++++++++++++++++++++++
>  drivers/soc/aspeed/aspeed-espi-perif.h | 539 +++++++++++++++++= +++++
>  drivers/soc/aspeed/aspeed-espi-vw.h  &=
nbsp; | 142 ++++++

This structure is a bit odd - y=
ou have the one -crtl.c file, which
defines the actual driver, bu=
t then a bunch of headers that contain more
code than header-type=
 definitions.

Is there any reason that -flash, -io=
c, -oob, -perif and -vw components
can't be standard .c files?

Then, for the userspace ABI: it looks like you're ex=
posing everything
through new device-specific ioctls. Would it no=
t make more sense to use
existing interfaces? For example, the vi=
rtual wire bits could be regular
GPIOs; the flash interface could=
 be a mtd or block device.

I understand that we'll=
 likely still need some level of custom device
control, but the m=
ore we can use generic interfaces for, the less custom
code (and =
interfaces) we'll need on the userspace side.

Chee=
rs,


Jeremy
--=-TZ3lhG3ptk97Vn50SDMo--