From patchwork Sun Nov 7 21:33:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 518015 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp2739856iml; Sun, 7 Nov 2021 13:33:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJwx6usiDQZfxK8qLTQbiXr9Ok/ErjNiFVK7NqttmQvnGiiCy5DiFDtW6w34KskGiHGn55ZF X-Received: by 2002:a17:906:f74a:: with SMTP id jp10mr34221768ejb.358.1636320816572; Sun, 07 Nov 2021 13:33:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636320816; cv=none; d=google.com; s=arc-20160816; b=rV4gs274Bz4JkETGQubT2miynPI5Fk2N8Jkhy4VwweiKdLM0OVvDaJ1eQqvZKypJqV HExECX9aXNajci5jl2VvXBpojveQgz3bmubfdKhocZCmKgT8MbknGhq9iblMlkdvHIOr uv5QhAhY1Lc0Eg4JttGk7latbu2SgL7sdYdk0JeZ4MFcK5w8P+Kk7cbjLrYOkTRdTDF0 w4ZFuywoDvmMPUTXTdPmoxrDPXC0jthzzxOb1e+EokKPp+T/xMsmFQFOXDNYy6gB7uS+ IwiWwyakPLzM6Oved6t23Z3afsxeukrlF5eYlRxEFAkPMEq3n6IMXHn8vQCrVU9+n83Z m8gA== 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=hkFln6ATxtVzMYz5UnT009KaZJSatKpVfYeAH18CZJ0=; b=VDVMY7oewNJW20r5/nvx07Pvn/PaSQ+VR2nfEEdQDi7lMH4oywFbCyhgsXhS7y4Wer rRGFYTiptWMQ/Z1H2i7sBYO6hpp9+JtQ2k8OcXZzyiUoMzzni+1YJYwEMrUoVH17l7j+ x7KiAvxwG1Fojc9ukbapvZgE6Sgp+I06fBVeF21aflTJSz6JFPx36F/8h5Ryj6QatzXE L5w7cn01mtu7YOJAcgtpo0lHInQIG4cqRvkLaEpct0+zblGuBLAqnrNsybsyX5ekpflB Eo+QWloTalz6UHlWZE611/HO+NZmJmNtD7XdEy7aiHcGjwN5z7qAjOjmDvAPiBQfiNWh zMUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lg0IL8WB; 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 dk5si20828601edb.601.2021.11.07.13.33.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Nov 2021 13:33:36 -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=lg0IL8WB; 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 DD4D3837F7; Sun, 7 Nov 2021 22:33:25 +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="lg0IL8WB"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C227C837EF; Sun, 7 Nov 2021 22:33:21 +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-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) (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 2C41F837EC for ; Sun, 7 Nov 2021 22:33:18 +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-ed1-x52d.google.com with SMTP id ee33so54948815edb.8 for ; Sun, 07 Nov 2021 13:33:18 -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=hkFln6ATxtVzMYz5UnT009KaZJSatKpVfYeAH18CZJ0=; b=lg0IL8WB+WRHzY5HhNFsK10PvTkwsffepVQIvyjapkM/vS8uKFwXhHdNHDf/PNaj18 igHP1zLlbvqqll1QRqJKlgNjTm0KttH8AWCzgo/Ryb60RbI5s4f4Epo0j832nniRPdtC TfdyzpHm8Z5fbp4urD4N9qfdlki5dIMwoAav20F0nqbLlYWoO3AHEnJg5HBYaRNjzKVb WDYJxFQ9mQFfSd8oYB/4W3mmNix4jOcpfaRUVZ7qRZ7rFg6LjHdbnpsEDbNWUdpVsdxz /t6aD6mQEDzBpO5Flxv4/8yMHQlEhRg8i6nlmSfteMJOely0VG6FwhcWJO0RZzCJIC0X CXkA== 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=hkFln6ATxtVzMYz5UnT009KaZJSatKpVfYeAH18CZJ0=; b=SSmijp9QbQ5hVFQoZzlAoaxmiFPjY79iECVo+wiQeEAF1MtWVMn2kTwpqOb/481lMI jipjeXAGb2A7FlW2MOJPbnchSnNaX34VvWkoDeE3JFVFhZORy5mCjctQP52GjeSoGA76 iKNRUZtxihZ23qpt80ua3otEsinrnxnSsWTK+xi7+VSh9OtPjHJ3UjsX9Gx8mDncP5Op VmKIcsTEMbjBGgfLoTKh4WuLB1JRRQIgprHgsDhnNub7S3B+QEewg+ZmJgvInZz4ftvn RIHR3r5MYwhHmomt3T1BgLjEbflsUOE8eESnIqvcKXbgnbyC+JJULpBBayvNbhHc8L0B RJ2g== X-Gm-Message-State: AOAM5309MEwqAu/SDmz5jFP6o+3wG0g0hz0tT0GhTvgg0hQq9a3ngVjF FQHOTwxtWxmMVzYyyrmAC1wQBldQgeigqQ== X-Received: by 2002:a05:6402:41a:: with SMTP id q26mr56784344edv.387.1636320797800; Sun, 07 Nov 2021 13:33:17 -0800 (PST) Received: from apalos.home ([2a02:587:4680:8a9c:2e56:dcff:fe9a:8f06]) by smtp.gmail.com with ESMTPSA id hw8sm5042150ejc.58.2021.11.07.13.33.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Nov 2021 13:33:17 -0800 (PST) From: Ilias Apalodimas To: u-boot@lists.denx.de Cc: trini@konsulko.com, Ilias Apalodimas , Rick Chen , Simon Glass , Sean Anderson , Heinrich Schuchardt , Masahisa Kojima Subject: [PATCH 1/8 v6] tpm: refactor function names and macros for infineon v1.2 TPM Date: Sun, 7 Nov 2021 23:33:04 +0200 Message-Id: <20211107213312.263357-2-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211107213312.263357-1-ilias.apalodimas@linaro.org> References: <20211107213312.263357-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 function names are part of the new header file. So switch conflicting driver defined function names and defines. Signed-off-by: Ilias Apalodimas Reviewed-by: Simon Glass --- 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..aa66e931bada 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 TPM1_ACCESS(l) (0x0000 | ((l) << 4)) +#define TPM1_STS(l) (0x0001 | ((l) << 4)) +#define TPM1_DATA_FIFO(l) (0x0005 | ((l) << 4)) +#define TPM1_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, TPM1_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, TPM1_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, TPM1_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, TPM1_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, TPM1_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, TPM1_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 = TPM1_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, TPM1_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, TPM1_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, TPM1_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, TPM1_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,