Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp161545ybg; Mon, 27 Jul 2020 19:04:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3kYehC125DNUb8si0ZRdKRQAgs5MZPDU9ZHwEvsHEUXLLKD6xqSAgI164hHcbWwPo9QKD X-Received: by 2002:aa7:d1c8:: with SMTP id g8mr24005983edp.337.1595901842298; Mon, 27 Jul 2020 19:04:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595901842; cv=none; d=google.com; s=arc-20160816; b=hqr755K0/NiNc2raTiRgCxhsrtLTZFBQLhCvK9S9Ml5y7q7BvplBLcCgFRAZVzEt3z 6RaI2p2JTpp30sLuT9au5S9uraNYcUMYkfq86J0n7oSFwxsbh21Km42sSN661Xqh+FWi 0lPju2orSTosyDw0HGXE+5M63CV3YsCafVqq0ndpWRjU7kEmxM6iy6W5QJ7OOF9tjuR2 ejPE+p42ICN62okC7F7BWCrBRBY2C3iOhPVRJ9afSjINusLQrRxUzF8eJ3DkQa0hSPD4 XCMwlfJcoY7SpkbqZhf6nPTfLjlpBRaTJ9yeH7iJj4DUxJq3TMHNKYtphJWjzjniq/Hl dIkA== 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=sTL9YNE6cVNaCBg4JVfnZqFPMtAuwW4Qs6driPMI2k8=; b=rZtsI/je7XehoZ/KTpVRJdn1uc+QBJ5eaRPKL4jdmSaIojG0wz57uxjsVZtzQl1pyM ysp6AOBCiNeN2mkzeXHe04bxFL+WtCqVCI93hsJe1gJk49rGqJcwsH3UeKvmd9StpNvV EXpLzmySCYLE6rglWsH71dUYqkT7lLl9LokAvqDMzl+Wipe7vJK9FiOU05VHDj+uBxw2 bVU37i6fqO0Q37ngOk19tfhCoesF6g9Bc0XnfTeY/tJnRRlaJE9iVu4+BLlrWRoPs+yX d5GhJJ23by6vrhVbTtF2X8YO6PM4kghfbVdDANb6AVC1yr6a/TfCzmkP9Zs0+z4EbVdT VT3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=HkKrg1kp; 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 x7si6612620ede.597.2020.07.27.19.03.39; Mon, 27 Jul 2020 19:04:02 -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=HkKrg1kp; 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 S1726728AbgG1CCm (ORCPT + 99 others); Mon, 27 Jul 2020 22:02:42 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:33492 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726842AbgG1CCh (ORCPT ); Mon, 27 Jul 2020 22:02:37 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1595901757; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=sTL9YNE6cVNaCBg4JVfnZqFPMtAuwW4Qs6driPMI2k8=; b=HkKrg1kp3uj3ymNPFZyf/GwSx7nqH5YSyO19SfF7TDATYDX1dvhCfZFxPLYHN1/NVkpvw9tK LLp2gq4eCtZJIMb8pVjE6VTDGWmtbT0g+kT2LqNIW/0EU5VUtFecRikbfhXd/xFWBL4L+Jap RQ4uyWulUI1G3bTIky/iuwQv5pE= 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-n03.prod.us-east-1.postgun.com with SMTP id 5f1f873dbd0c3f0296bcd82c (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 28 Jul 2020 02:02:37 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 6F582C433C6; Tue, 28 Jul 2020 02:02:36 +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, URIBL_BLOCKED autolearn=unavailable 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 51A56C4339C; Tue, 28 Jul 2020 02:02:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 51A56C4339C 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 v6 09/11] bus: mhi: core: Read and save device hardware information from BHI Date: Mon, 27 Jul 2020 19:02:18 -0700 Message-Id: <1595901740-27379-10-git-send-email-bbhatt@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1595901740-27379-1-git-send-email-bbhatt@codeaurora.org> References: <1595901740-27379-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 a6e6634..d15e9ce 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