Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2967494ybt; Mon, 29 Jun 2020 11:41:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybLAJG4IIhygl1peWFwFZPNCoewWJ7fAYYN0+gQHN6soWzIZlhvS1vr8jl7cMMjUtUOJRJ X-Received: by 2002:a05:6402:3138:: with SMTP id dd24mr19377378edb.118.1593456115448; Mon, 29 Jun 2020 11:41:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593456115; cv=none; d=google.com; s=arc-20160816; b=X0Lh472XmeHrVcaihK9Bq8QtP93bfJ53mJISuAfvq+XgoU6O7kbjiJJpDXo8/9qUSw rHaiLQzNyzI1HmsWu9i7+XkOwLa3vaXAWslxAHNcTXDsyt40tHRYMpBtKyXCfT+qCfaL HevfCoLiJkj4k6b4HF9XvVNo1mUyQtkvhg7adbViCp4s0m02YR6xwmJR4Gf/nJ58Nv+g I23yAw40v6yORIOM503A4SLC6BJaPKjsb37noORnT5RL2LBoysY4+N+vhnERBE8o22uA ZYBMwReX7Vu9pYSB2uTZIeEkrFiDK+dqDc81EyYM+JGi/PyMx3nWWoVeWWPpvl7D6zg6 X8pg== 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=Rn9VPsCeNhlTXsEtCkLtA7SovaaodoBU4vKbWke+iHI=; b=GyqmE++3tMRXh/RFA6cZl22X5zP4GKjGLxSSePCZ8i5JvdDKV8/f63DwYtghEw2Lvm 8CsfcEDg+xUBqqNq1p2UHWLp9Ed8li+MlGiuqYXtc8fE6c62TuOGOqmjbPhBTkFic/Gd hfthNUBgTQLOKRGfwm9cxusCpbgrZY8/wEAC37qvWDWMs7r19nfORAclpMFhj3oUd/VR g9hWFat/2cqqNLRQxSHnFSY3EdO6J4kE54Cko9u9MBXaVWKLqP7EJEzC86jZ7jp6AP/i mMlduUoSwd7SotdB0oR9dsE/2dxpNqkBqSz/9e5GUZ/4oJL03piTMDtNYy0qI+D+ZOGR dCyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b="Z/HZ+NNa"; 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 d15si293739ejt.185.2020.06.29.11.41.31; Mon, 29 Jun 2020 11:41:55 -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="Z/HZ+NNa"; 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 S1727984AbgF2SiJ (ORCPT + 99 others); Mon, 29 Jun 2020 14:38:09 -0400 Received: from m43-7.mailgun.net ([69.72.43.7]:44394 "EHLO m43-7.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727960AbgF2SiC (ORCPT ); Mon, 29 Jun 2020 14:38:02 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1593455881; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=Rn9VPsCeNhlTXsEtCkLtA7SovaaodoBU4vKbWke+iHI=; b=Z/HZ+NNai+i0hUoKAQVECVY4VlSrb+zp2/M/ZkJs9FQq6s0qQ/mItra74cQHwY99OBZoWFTm p8D+RR8H0Cue+4Rotwgf3YTV2gdfnEwsrtSum2gb5I7BvaVecPqIkRejY7K+OY+hGbECptPe gKMVy46HXv9W3SH/SUi33WZTQx0= 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-n08.prod.us-west-2.postgun.com with SMTP id 5efa195cf3deea03f3cdf0e7 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 29 Jun 2020 16:39:56 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 3C1AAC433C8; Mon, 29 Jun 2020 16:39:56 +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=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 475B7C433CB; Mon, 29 Jun 2020 16:39:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 475B7C433CB 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 v4 8/9] bus: mhi: core: Read and save device hardware information from BHI Date: Mon, 29 Jun 2020 09:39:41 -0700 Message-Id: <1593448782-8385-9-git-send-email-bbhatt@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1593448782-8385-1-git-send-email-bbhatt@codeaurora.org> References: <1593448782-8385-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 --- 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 b1e8b4f..dad6246 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; @@ -315,6 +317,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 @@ -394,6 +398,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