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 72E26C433EF for ; Fri, 5 Nov 2021 08:17:33 +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 42B176120A for ; Fri, 5 Nov 2021 08:17:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 42B176120A 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 2C0CA831FD; Fri, 5 Nov 2021 09:17:30 +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="mCgkUZ6Y"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1808B833E6; Fri, 5 Nov 2021 09:17:28 +0100 (CET) Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) (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 DC32A82EBB for ; Fri, 5 Nov 2021 09:17:24 +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-x42a.google.com with SMTP id r8so12420697wra.7 for ; Fri, 05 Nov 2021 01:17:24 -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=IQhe/SG1pJJIzbKNycC9DXO/lfZ4ufUQrZu0y0341oA=; b=mCgkUZ6YF7PX+AQZ0mHE/gm/VWuAui9m7iikw+9Kc0Xf2YYBR14aInB93mGhfTvzWO zVnY8uOihnlRRUlGFacYuom8DG8fzMb22/U6Hlego4ju1i3Z9YRx8o2pmgBmHTrgA71L LRqQ2adcUqCwb9/JzkRozW3CRhqKdWHG7Tl2eODQIrtaOAWFnWK6ADz/Fiqoag9WO3QP w7uHJPS5C/IVfg4FwUYZYbin+8ooQwuisXUXDbqF97YdyXB3NgPmqKzvFmRPISZ6ODxF 5IHnQs87UBRKOD8QA6KFK8bCM9UQPMu0mSzCjNxrMFP/65dbOaNmS/YyWzMH675CHX60 JJkA== 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=IQhe/SG1pJJIzbKNycC9DXO/lfZ4ufUQrZu0y0341oA=; b=Cg/4Bcrqaug9hQ+KgwXB6F+gJBUzO515+zv9xVNLBaEvDYOu0DLQdrtU96BfiDorE9 /H2YD0UnS7cxjyz8f2NmMjYT4LzyvgxDyT2xdhfvJTF09jJAwRc6i++WaQAge9rC6oFo xe+dxqU1O+cTwefl6LryJ9aeIKIL4YFvE+jYvOdlbU2FrJTY7MJSg7CMY2fs18v7Isze l8+ohtuQiCmA3tBfbSGYLvK2+2wj9iKVg4SzssriS4SIrqjb/FXdrxZdA2vZOAHBJ2OW NMuG/mqe5Ojhq7mKTKR9oZYO3QeYQNQ1f9vD7U8n4lSkZfuXwzu5UyuRhv9rLd6U2lYG Hk2Q== X-Gm-Message-State: AOAM532BU61L4BcfO3tjbcdQjgOUsHWzDGk60oM2YNTYrkoBOx527Yn9 e+9R9JKtu7G/9zl4v7rjaAL9kA== X-Google-Smtp-Source: ABdhPJzUXnnFgyWVU0UwzbEI7bRqQpjbSxbxFZyIR42KuDpSBV203h3XQGF3mSI+Zi16Hi1e3ljLDg== X-Received: by 2002:a5d:4575:: with SMTP id a21mr57201332wrc.193.1636100244461; Fri, 05 Nov 2021 01:17:24 -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 k15sm7190386wrx.53.2021.11.05.01.17.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Nov 2021 01:17:23 -0700 (PDT) Date: Fri, 5 Nov 2021 10:17:21 +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 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 ************** 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