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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77C9FC433F5 for ; Fri, 5 Nov 2021 16:15:10 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E8AF0604DA for ; Fri, 5 Nov 2021 16:15:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E8AF0604DA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0CC358375E; Fri, 5 Nov 2021 17:13:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="KhxKPk6y"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0738083759; Fri, 5 Nov 2021 17:13:04 +0100 (CET) Received: from mail-ua1-x930.google.com (mail-ua1-x930.google.com [IPv6:2607:f8b0:4864:20::930]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 884738373A for ; Fri, 5 Nov 2021 17:12:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@google.com Received: by mail-ua1-x930.google.com with SMTP id v3so17986438uam.10 for ; Fri, 05 Nov 2021 09:12:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/+1AkX3j/4j71kXFbdjZPjkPCbYryVFnbP/jryf4MJE=; b=KhxKPk6y2a0cYFqFlcUAUnAjuylT/0Yl9WBPTSK3N+RTQgdRmLx5FQuz1nsTKHtBKH aDnHj8fFossLhBnKOhEhGPeCwCtoL5hHmbLHPPMfSpu3PFTm9FcaFnURLDdMK6/CgF9o PzD2CD8oH3IPWgabxx9Ztf5KB6NFMZ/5VtTks= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/+1AkX3j/4j71kXFbdjZPjkPCbYryVFnbP/jryf4MJE=; b=cYt2EaXoCDu/qelfyAzH4UXXIgk3etGFRIku2fPUPfthQHn+6SPV0li/t64VbMcNg0 I7lNF4XrzNjlo8pf8SlVok9Y7mQZHEHAn9tqk5ss4P2achojAbB9WqAz2Q7CCajE8rK/ Ins8L+INn7gKLqMnu0TjQTOJd8TsgQVnFaeADXrvDGNFNZ1VKXo33Pr7fPpgPVN30U/c HBpi5sjS43xOcZdfZqtKn0KE4NHa+o8w2nkaSPQ8DE9MIAg2zAdIkpJvCMdi+1ilZ0+y e2A2v1K9VMaBRgCQ7Bx+iy72Fs8QTDipoTBnvbZnKQxkbahDXuP0JAbd3Aow/Iv/piSe qIwA== X-Gm-Message-State: AOAM5329w4ho1j3P+hG3U/BPLt9Jf5xyzmo8DinCD42k8kq9VdvIZqtB MixDAFsCuJAQSzN3w62Qa06988U5wGjox72La0SzcA== X-Google-Smtp-Source: ABdhPJzUynLwyRP2bOoAAngQe3E4REL0MJqC/jUh/QajVPMeTOi8EXy+nPq1PHwEl/88sRzTpMA6TkNb7BSNGW7QQdE= X-Received: by 2002:a05:6102:905:: with SMTP id x5mr25929141vsh.58.1636128756215; Fri, 05 Nov 2021 09:12:36 -0700 (PDT) MIME-Version: 1.0 References: <20211103150910.69732-1-ilias.apalodimas@linaro.org> <20211103150910.69732-3-ilias.apalodimas@linaro.org> In-Reply-To: From: Simon Glass Date: Fri, 5 Nov 2021 10:12:22 -0600 Message-ID: Subject: Re: [PATCH 2/6 v4] tpm2: Add a TPMv2 MMIO TIS driver To: Ilias Apalodimas Cc: u-boot@lists.denx.de, trini@konsulko.com, Rick Chen , Sean Anderson , Heinrich Schuchardt , Masahisa Kojima Content-Type: text/plain; charset="UTF-8" X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Hi Ilias, On Fri, 5 Nov 2021 at 02:23, Ilias Apalodimas wrote: > > On Fri, Nov 05, 2021 at 10:17:21AM +0200, Ilias Apalodimas wrote: > > Hi Simon, > > > > [...] > > > > > > + u8 *result) > > > > +{ > > > > + struct tpm_tis_chip_data *drv_data = (void *)dev_get_driver_data(udev); > > > > + > > > > + while (len--) > > > > + *result++ = ioread8(drv_data->iobase + addr); > > > > + return 0; > > > > +} > > > > + > > > > +static int mmio_write_bytes(struct udevice *udev, u32 addr, u16 len, > > > > + const u8 *value) > > > > +{ > > > > + struct tpm_tis_chip_data *drv_data = (void *)dev_get_driver_data(udev); > > > > + > > > > + while (len--) > > > > + iowrite8(*value++, drv_data->iobase + addr); > > > > > > So should this use regmap? > > > > > > > Isn't the point of regmap abstracting the bus access itself? Something > > along the lines of It is for MMIO at present, but I suppose it could handle the bus. It would need to know about register numbers though, and we've never really figured out if it is a win or not. > > > > ******** ********** *********** > > * SPI ** --> * * --> * SPI DM ** --> Device > > ******** * * *********** > > * REGMAP * > > ******** * * > > * MMIO * --> * * --> ************** > > ******** ********** * MMIO access* --> Device > > ************** > > > > Hopefully I'll get the ASCII right this time... > > ******** ********** *********** > * SPI ** --> * * --> * SPI DM ** --> Device > ******** * * *********** > * REGMAP * > ******** * * > * MMIO * --> * * --> ************** > ******** ********** * MMIO access* --> Device > ************** > > Right now we have discrete drivers for the SPI and MMIO TPMs. > > However using it makes sense if we want to merge parts of the SPI, MMIO and I2C > > drivers in the future. That though is not what this patchset deals with. > > Let's first clean up the crud of the TIS APIs duplication we've been > > carrying over various TPM drivers and worry about consolidating the bus > > accesses later. That's OK with me. Regards, Simon