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 188C9C433EF for ; Fri, 5 Nov 2021 08:23:44 +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 43D6761212 for ; Fri, 5 Nov 2021 08:23:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 43D6761212 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.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 7F50D836E9; Fri, 5 Nov 2021 09:23:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="nvuX5CtO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 47075836A7; Fri, 5 Nov 2021 09:23:38 +0100 (CET) Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) (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 AAA5F836C7 for ; Fri, 5 Nov 2021 09:23:28 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-wr1-x431.google.com with SMTP id u18so12456711wrg.5 for ; Fri, 05 Nov 2021 01:23:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=GlQ3oymrOawTo3jiedFDc9OaEqMsZIxtmret4NIBtvg=; b=nvuX5CtOhn4QxfPP5GZdssfXaEzUndtRnkpEtFYkaowIMf067n6wpn9mgnIkbxhqZK +NHFdIUymI0Ti1Mf2Sz6/Zbrr0/ngw1jAjPj/Q7lIL4xn0+hOuY8T+bAfXTXkdgUTNF+ Ca+v9rYrQHP6/I+gDTkVpKgwIbCx7UZnQT9FvCYUKEtSx5+W5k3Xbe5Ok5YNBS82DRhg BFL5RnsSVP2hgMuNpTpa51UO+77kS7rr8D4QJbfL+rzq+cVvZBYT23ll5cPVvc4iV3BQ 7Zax/yKsvhF5WFpEAKJqhwGjiG2sw4AWReFBY3lerKo3qdvjtIiNrHSPLxr5wSs0MXfz 6q9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=GlQ3oymrOawTo3jiedFDc9OaEqMsZIxtmret4NIBtvg=; b=H+JbvjquJObFT9wssFrekyqE50G+OrXCI3jCfPwCPY6Tfrb4zgh+eXzGqyGjU5D+/Y iN+/vq2/HElJKIyCdjtAbc6MMvyVhJb8iZ28JgOzWxkfsB3LVa32Tc8VU6TKLmnh/wLc 129Sg4cby4mowVusq8mmYki5QaOhwQiwQy2j+eHNtWaJ+OX8nA189OnZFSrKrf6+GOwQ YnNekDPxzUW59Zeru2aq2AfhVzYDELEtvv6qXbYL+ORFqdPIRdiGQBYarh3ZpJaqag2s bKuebqIzw0XpD0Ys4qwaRbbFiJEk5fbElOYcu/Wv86mGnJOur7DhpGoipelK8O+MF8YE J8zg== X-Gm-Message-State: AOAM530rjtIQEnG9DWtRLsfXe9TnK9fAiDoOoCiaHtqJ3h8IdQo//Dlb 4FOD5f9fyPO61l78UMKmwk+94g== X-Google-Smtp-Source: ABdhPJz6Hxkw1dAUrdKBN/aNvpWDCnZqKw45Ais3dYyFa2lk+q9vl83REiAaaRQ248JRLmtyxuJWBw== X-Received: by 2002:adf:d1cd:: with SMTP id b13mr21013003wrd.323.1636100608225; Fri, 05 Nov 2021 01:23:28 -0700 (PDT) Received: from apalos.home (ppp-94-66-220-13.home.otenet.gr. [94.66.220.13]) by smtp.gmail.com with ESMTPSA id 10sm12110416wme.27.2021.11.05.01.23.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Nov 2021 01:23:27 -0700 (PDT) Date: Fri, 5 Nov 2021 10:23:25 +0200 From: Ilias Apalodimas To: Simon Glass Cc: u-boot@lists.denx.de, trini@konsulko.com, Rick Chen , Sean Anderson , Heinrich Schuchardt , Masahisa Kojima Subject: Re: [PATCH 2/6 v4] tpm2: Add a TPMv2 MMIO TIS driver Message-ID: References: <20211103150910.69732-1-ilias.apalodimas@linaro.org> <20211103150910.69732-3-ilias.apalodimas@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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 > > ******** ********** *********** > * 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. > > Thanks > /Ilias > > > > + return 0; > > > +} > > [..] > > > > Regards, > > Simon