From patchwork Tue Nov 9 07:02:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 518033 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp1319966iml; Mon, 8 Nov 2021 23:02:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJxrEVpGxJZgs7xH7vHl4eH/3Fpn5H9PDvZpiL0BXDQOQBhrOduMLZoWTqjoH5/ltGTTg0+W X-Received: by 2002:a50:d88b:: with SMTP id p11mr7178951edj.287.1636441367021; Mon, 08 Nov 2021 23:02:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636441367; cv=none; d=google.com; s=arc-20160816; b=tj3GVjYa+VcVoPXPdseS1w3eSLJ0/XmVHSDD6DwTlyY/ltD9zowAXCdTRNTUjWyajN l3Sqz2cJUpvSQ7xZl4SWJl7LQ80owckyBHOlL36m/TF6G9bjBHcV67E9mEykBRNjMmzY Z31ImvxElMBtX/+8qcCGD74ungQLj534bHCCCaUcDpuDCrk+ig++xJnlTcD7sMkzUlCj HYNasGHEqjn71cFqORxj8OaHVpW1BlbnJqdBz5wBpH/etM7xkv8FqE/3AHU7YHcKp+Gi hpPS+YCTsk0kqHkfbCEIe+ZENKTLoaS7UmECxG6If5xmMs+0lb+sRzXmVCU0/lgN15hm peCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wNeZylK6Uc6p4s5cJscjplLeA6hT25Mpnx2q1SoGyVw=; b=AddFFB2772ASsFvrGPyWM2jMaB8vl19dPRDopFHlUPnqsAM8tGKZmdpjWXKt82bz3u hJ/UH0YSUAPtTOlI0oiIjerAJicDQeqJPl4lNqyled/VgT4gL5ZJzLjXDM0oduApHnh0 k1OfaeTqsgr1n/Gkdh96VhhWQcKpSvja8LXjmLg26k1BUNgmqZoSPlDGSR7rJqCnCrnA OItLYBtViEuzLcsgO0P4ZXsRLrcEn/sLgLISz2m5vbqkrDonKPM4V0272l4MWPyqptla XYS+sclcdjUMWczldRZnmGyZS67KjHoqv/OwXjO/KO2UNkb0SdGUcSXM7+aC7sh5FzyV jlQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kf7g9me2; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id d13si10749537edu.169.2021.11.08.23.02.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Nov 2021 23:02:47 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kf7g9me2; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9810183820; Tue, 9 Nov 2021 08:02:35 +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="Kf7g9me2"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8DE3283820; Tue, 9 Nov 2021 08:02:32 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) (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 71DDD836D5 for ; Tue, 9 Nov 2021 08:02: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-wm1-x334.google.com with SMTP id g191-20020a1c9dc8000000b0032fbf912885so1481405wme.4 for ; Mon, 08 Nov 2021 23:02:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wNeZylK6Uc6p4s5cJscjplLeA6hT25Mpnx2q1SoGyVw=; b=Kf7g9me2MpJEKmDoVxkFDyeFI1u9WYbJ9w0hJsrDfVmKYL2gXKDp56bPQ2WJIyfezG mSeK6EcykuBCT2v5zLJ9vipfOvQAhy8cVNi4pdWgmo1j44GnbD2VzjMKtUnMqWTfQr6A ByEF3QbVZ44UAUaLcEo9Cy7Rb8XYEIR4Y3aCIWs/BunG/U1caUk/H5xrMecTRfuKQI3A Rhb0X3Ai09XDp2tLXwk57l4Y5MKJZq6sp4LVm+D2T7VcEE82shb1EiI9tS1Qc5rD+C3s Pw9upjeINTJpI/IvRfu0/Jy1V9ONWSncMv/Qn4brudgVIJwrmt5gxtoC7IynVMoutyNm GHIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wNeZylK6Uc6p4s5cJscjplLeA6hT25Mpnx2q1SoGyVw=; b=s9gmYBrrMXzFIDfqwWARR3NqxfErVS8iDZ0hk0j9G33CQY3KAD0Ww5Wkt4A4FTyuuc u//SFhjJ4brtSfm8Lp9atpGgGXq3Z6zcr1sixLrx/deQIx6LrQvgSGrXum6fC1Xoxcyr 5OP2diuPPIPaQ1IqyCpCfmH/OIbdFUiLGzvnWne8IY5uIaPQDc9ZRIOJ0iQopb5vSoB5 Q8JaGe/P0n/66rRjM4d77oF1cFd3Y/QhIRntVBALHWe6V2bLp9cxSO/xZfH/CMjflVCe y1oMPynZFuGMwWIsdtfJbZD6rSyU0rYwV50wIVF/JtE2t2EpSw80quqiW++Z3j5eJbCU cmFg== X-Gm-Message-State: AOAM532ZBQZw580/M/c0vSlRBwUIRwP/GTZgs6XuKlxXijzOKtzp0Yuj cyoHQTx1bMU6umJkP1ucrsw6nIaQh0OTRg== X-Received: by 2002:a05:600c:430c:: with SMTP id p12mr4774907wme.127.1636441348013; Mon, 08 Nov 2021 23:02:28 -0800 (PST) Received: from apalos.home ([2a02:587:4627:18c0:2e56:dcff:fe9a:8f06]) by smtp.gmail.com with ESMTPSA id g5sm20897229wri.45.2021.11.08.23.02.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Nov 2021 23:02:27 -0800 (PST) From: Ilias Apalodimas To: u-boot@lists.denx.de Cc: trini@konsulko.com, Ilias Apalodimas , Simon Glass , Rick Chen , Sean Anderson , Heinrich Schuchardt , Masahisa Kojima Subject: [PATCH 1/8 v7] tpm: refactor function names and macros for infineon v1.2 TPM Date: Tue, 9 Nov 2021 09:02:15 +0200 Message-Id: <20211109070223.76456-2-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211109070223.76456-1-ilias.apalodimas@linaro.org> References: <20211109070223.76456-1-ilias.apalodimas@linaro.org> MIME-Version: 1.0 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 With the upcoming TPM2 API, some of the functions name are part of the new header file. So switch conflicting internal function names and defines. Reviewed-by: Simon Glass Signed-off-by: Ilias Apalodimas --- drivers/tpm/tpm_tis_infineon.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/tpm/tpm_tis_infineon.c b/drivers/tpm/tpm_tis_infineon.c index f414e5657db9..525ad72f4c92 100644 --- a/drivers/tpm/tpm_tis_infineon.c +++ b/drivers/tpm/tpm_tis_infineon.c @@ -50,10 +50,10 @@ static const char * const chip_name[] = { [UNKNOWN] = "unknown/fallback to slb9635", }; -#define TPM_ACCESS(l) (0x0000 | ((l) << 4)) -#define TPM_STS(l) (0x0001 | ((l) << 4)) -#define TPM_DATA_FIFO(l) (0x0005 | ((l) << 4)) -#define TPM_DID_VID(l) (0x0006 | ((l) << 4)) +#define TPM_INFINEON_ACCESS(l) (0x0000 | ((l) << 4)) +#define TPM_INFINEON_STS(l) (0x0001 | ((l) << 4)) +#define TPM_INFINEON_DATA_FIFO(l) (0x0005 | ((l) << 4)) +#define TPM_INFINEON_DID_VID(l) (0x0006 | ((l) << 4)) /* * tpm_tis_i2c_read() - read from TPM register @@ -197,7 +197,7 @@ static int tpm_tis_i2c_check_locality(struct udevice *dev, int loc) u8 buf; int rc; - rc = tpm_tis_i2c_read(dev, TPM_ACCESS(loc), &buf, 1); + rc = tpm_tis_i2c_read(dev, TPM_INFINEON_ACCESS(loc), &buf, 1); if (rc < 0) return rc; @@ -215,12 +215,12 @@ static void tpm_tis_i2c_release_locality(struct udevice *dev, int loc, const u8 mask = TPM_ACCESS_REQUEST_PENDING | TPM_ACCESS_VALID; u8 buf; - if (tpm_tis_i2c_read(dev, TPM_ACCESS(loc), &buf, 1) < 0) + if (tpm_tis_i2c_read(dev, TPM_INFINEON_ACCESS(loc), &buf, 1) < 0) return; if (force || (buf & mask) == mask) { buf = TPM_ACCESS_ACTIVE_LOCALITY; - tpm_tis_i2c_write(dev, TPM_ACCESS(loc), &buf, 1); + tpm_tis_i2c_write(dev, TPM_INFINEON_ACCESS(loc), &buf, 1); } } @@ -240,7 +240,7 @@ static int tpm_tis_i2c_request_locality(struct udevice *dev, int loc) return rc; } - rc = tpm_tis_i2c_write(dev, TPM_ACCESS(loc), &buf, 1); + rc = tpm_tis_i2c_write(dev, TPM_INFINEON_ACCESS(loc), &buf, 1); if (rc) { debug("%s: Failed to write to TPM: %d\n", __func__, rc); return rc; @@ -271,7 +271,7 @@ static u8 tpm_tis_i2c_status(struct udevice *dev) /* NOTE: Since i2c read may fail, return 0 in this case --> time-out */ u8 buf; - if (tpm_tis_i2c_read(dev, TPM_STS(chip->locality), &buf, 1) < 0) + if (tpm_tis_i2c_read(dev, TPM_INFINEON_STS(chip->locality), &buf, 1) < 0) return 0; else return buf; @@ -286,7 +286,7 @@ static int tpm_tis_i2c_ready(struct udevice *dev) u8 buf = TPM_STS_COMMAND_READY; debug("%s\n", __func__); - rc = tpm_tis_i2c_write_long(dev, TPM_STS(chip->locality), &buf, 1); + rc = tpm_tis_i2c_write_long(dev, TPM_INFINEON_STS(chip->locality), &buf, 1); if (rc) debug("%s: rc=%d\n", __func__, rc); @@ -306,7 +306,7 @@ static ssize_t tpm_tis_i2c_get_burstcount(struct udevice *dev) stop = chip->timeout_d; do { /* Note: STS is little endian */ - addr = TPM_STS(chip->locality) + 1; + addr = TPM_INFINEON_STS(chip->locality) + 1; if (tpm_tis_i2c_read(dev, addr, buf, 3) < 0) burstcnt = 0; else @@ -360,7 +360,7 @@ static int tpm_tis_i2c_recv_data(struct udevice *dev, u8 *buf, size_t count) if (burstcnt > (count - size)) burstcnt = count - size; - rc = tpm_tis_i2c_read(dev, TPM_DATA_FIFO(chip->locality), + rc = tpm_tis_i2c_read(dev, TPM_INFINEON_DATA_FIFO(chip->locality), &(buf[size]), burstcnt); if (rc == 0) size += burstcnt; @@ -462,7 +462,7 @@ static int tpm_tis_i2c_send(struct udevice *dev, const u8 *buf, size_t len) burstcnt = CONFIG_TPM_TIS_I2C_BURST_LIMITATION_LEN; #endif /* CONFIG_TPM_TIS_I2C_BURST_LIMITATION */ - rc = tpm_tis_i2c_write(dev, TPM_DATA_FIFO(chip->locality), + rc = tpm_tis_i2c_write(dev, TPM_INFINEON_DATA_FIFO(chip->locality), &(buf[count]), burstcnt); if (rc == 0) count += burstcnt; @@ -482,7 +482,7 @@ static int tpm_tis_i2c_send(struct udevice *dev, const u8 *buf, size_t len) } /* Go and do it */ - rc = tpm_tis_i2c_write(dev, TPM_STS(chip->locality), &sts, 1); + rc = tpm_tis_i2c_write(dev, TPM_INFINEON_STS(chip->locality), &sts, 1); if (rc < 0) return rc; debug("%s: done, rc=%d\n", __func__, rc); @@ -525,7 +525,7 @@ static int tpm_tis_i2c_init(struct udevice *dev) return rc; /* Read four bytes from DID_VID register */ - if (tpm_tis_i2c_read(dev, TPM_DID_VID(0), (uchar *)&vendor, 4) < 0) { + if (tpm_tis_i2c_read(dev, TPM_INFINEON_DID_VID(0), (uchar *)&vendor, 4) < 0) { tpm_tis_i2c_release_locality(dev, 0, 1); return -EIO; } @@ -583,7 +583,7 @@ static int tpm_tis_i2c_close(struct udevice *dev) return 0; } -static int tpm_tis_get_desc(struct udevice *dev, char *buf, int size) +static int tpm_tis_i2c_get_desc(struct udevice *dev, char *buf, int size) { struct tpm_chip *chip = dev_get_priv(dev); @@ -615,7 +615,7 @@ static int tpm_tis_i2c_probe(struct udevice *dev) static const struct tpm_ops tpm_tis_i2c_ops = { .open = tpm_tis_i2c_open, .close = tpm_tis_i2c_close, - .get_desc = tpm_tis_get_desc, + .get_desc = tpm_tis_i2c_get_desc, .send = tpm_tis_i2c_send, .recv = tpm_tis_i2c_recv, .cleanup = tpm_tis_i2c_cleanup,