Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp4662940pxa; Mon, 10 Aug 2020 15:02:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpwA/e7tWEg6ydOhmFvxzPdoFh8soJa5m05qIx/brboa2c6jyOuzBUZERrzekzmVQhPrnm X-Received: by 2002:a50:f687:: with SMTP id d7mr20810526edn.306.1597096963371; Mon, 10 Aug 2020 15:02:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597096963; cv=none; d=google.com; s=arc-20160816; b=VM0iXURM/xaCDB/Wlr8gZj/FDgRJ2DKxJmTjk2nc+MAA+cJNhndfKCCYncOA5ckSNK SBgG1tKzpqsGu+thF91hQdIiaVoDgPS3IuHeRu+qyEjPtmUcD3QY8ZQoDIz8I2wc4HK5 cU3bxxHqqyk2pLzD6dayT+tXS8rduSIwKrDu6KDdSL9/nL7F8Tr2pwuJXCyg4c5iUZoi sZv5TZVVBJzhbYSlPgSsKy1LZbc/RfxWdga7UDVnGhj8VkM+iR3qA6NBmbwnXBDgLjof T5Q4lPpMBgYfiug3tsw7rFXfSth3Jz9nfUvw6E0HxMR2bZMTxh/vX1YXAxeqKViBPjD8 mUUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature; bh=AjT7dPb3SV8FTexMkPkLgWIDrwcDqqcAf9b6/dOYVe8=; b=mTLynbVVSLCmPUR+7K4jr9bVR+wNh2r9kN/JjqqKDuLki0f9cbEJR0prU0aWSTAONl lm37A6WZfuCJm5dw7IcqWrGwgP51xVUL7s5To5XxZDF7olIg5b1GsOBR6UK+01KoDWaa T725whS1MnwNGqJhNOWyymOhp28lrabz67qjp/N+NoaDmEgvPuXBTKZHfbpJY+BnSZhs HWDLCBlzglI12tktzy7lCKSkKSPQSGhh/JhnRMkeyJzkQPkgig2Z0quPyrqxHUoeILSg E1kiyWWKZAcWMNw67DHfCyCu5tfZr9AG5vNqhtA1LLrPys51Xnxvos1CrxAfCz+uuAbd v3MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=QUhdZkJe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eb8si14452615edb.246.2020.08.10.15.02.20; Mon, 10 Aug 2020 15:02:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=QUhdZkJe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726857AbgHJWBo (ORCPT + 99 others); Mon, 10 Aug 2020 18:01:44 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:21832 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726649AbgHJWBo (ORCPT ); Mon, 10 Aug 2020 18:01:44 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1597096903; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=AjT7dPb3SV8FTexMkPkLgWIDrwcDqqcAf9b6/dOYVe8=; b=QUhdZkJeESMfNDGsjJaOqeoXD06HhJ0OcibUWL8u2wGPVIlpbjG3kYhvGGrCcnAujvhibdO3 O5RqQyZyIlTy+LYN7HXzKGUwKiYuROdd4wIM88KWPmV18YLeCw6gmu9A0IwP4/b1UaF+1GQd Cf4XWkG759h/19iGz5HS1qFmWJA= X-Mailgun-Sending-Ip: 69.72.43.7 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n19.prod.us-east-1.postgun.com with SMTP id 5f31c3afd48d4625ca162cbb (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 10 Aug 2020 22:01:19 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 6A453C43395; Mon, 10 Aug 2020 22:01:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE autolearn=ham autolearn_force=no version=3.4.0 Received: from malabar-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: bbhatt) by smtp.codeaurora.org (Postfix) with ESMTPSA id 4A6B5C43391; Mon, 10 Aug 2020 22:01:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 4A6B5C43391 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=bbhatt@codeaurora.org From: Bhaumik Bhatt To: manivannan.sadhasivam@linaro.org Cc: linux-arm-msm@vger.kernel.org, hemantk@codeaurora.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org, Bhaumik Bhatt Subject: [PATCH v7 09/11] bus: mhi: core: Read and save device hardware information from BHI Date: Mon, 10 Aug 2020 15:01:03 -0700 Message-Id: <1597096865-19636-10-git-send-email-bbhatt@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1597096865-19636-1-git-send-email-bbhatt@codeaurora.org> References: <1597096865-19636-1-git-send-email-bbhatt@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Device hardware specific information such as serial number and the OEM PK hash can be read using BHI and saved on host to identify the endpoint. Signed-off-by: Bhaumik Bhatt Reviewed-by: Jeffrey Hugo Reviewed-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/boot.c | 17 ++++++++++++++++- include/linux/mhi.h | 6 ++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/bus/mhi/core/boot.c b/drivers/bus/mhi/core/boot.c index 0b38014..24422f5 100644 --- a/drivers/bus/mhi/core/boot.c +++ b/drivers/bus/mhi/core/boot.c @@ -392,13 +392,28 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl) void *buf; dma_addr_t dma_addr; size_t size; - int ret; + int i, ret; if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) { dev_err(dev, "Device MHI is not in valid state\n"); return; } + /* save hardware info from BHI */ + ret = mhi_read_reg(mhi_cntrl, mhi_cntrl->bhi, BHI_SERIALNU, + &mhi_cntrl->serial_number); + if (ret) + dev_err(dev, "Could not capture serial number via BHI\n"); + + for (i = 0; i < ARRAY_SIZE(mhi_cntrl->oem_pk_hash); i++) { + ret = mhi_read_reg(mhi_cntrl, mhi_cntrl->bhi, BHI_OEMPKHASH(i), + &mhi_cntrl->oem_pk_hash[i]); + if (ret) { + dev_err(dev, "Could not capture OEM PK HASH via BHI\n"); + break; + } + } + /* If device is in pass through, do reset to ready state transition */ if (mhi_cntrl->ee == MHI_EE_PTHRU) goto fw_load_ee_pthru; diff --git a/include/linux/mhi.h b/include/linux/mhi.h index 3a3e857..4065762 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -16,6 +16,8 @@ #include #include +#define MHI_MAX_OEM_PK_HASH_SEGMENTS 16 + struct mhi_chan; struct mhi_event; struct mhi_ctxt; @@ -317,6 +319,8 @@ struct mhi_controller_config { * @device_number: MHI controller device number * @major_version: MHI controller major revision number * @minor_version: MHI controller minor revision number + * @serial_number: MHI controller serial number obtained from BHI + * @oem_pk_hash: MHI controller OEM PK Hash obtained from BHI * @mhi_event: MHI event ring configurations table * @mhi_cmd: MHI command ring configurations table * @mhi_ctxt: MHI device context, shared memory between host and device @@ -396,6 +400,8 @@ struct mhi_controller { u32 device_number; u32 major_version; u32 minor_version; + u32 serial_number; + u32 oem_pk_hash[MHI_MAX_OEM_PK_HASH_SEGMENTS]; struct mhi_event *mhi_event; struct mhi_cmd *mhi_cmd; -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project