Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3187751ybt; Sat, 4 Jul 2020 08:51:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwaFcPOBs4Fcd/tVoPk6LBUV6QHAtuftw5eABenClmECaOfGrRycNeVNZLdncy4vdDSAK3V X-Received: by 2002:a50:ab53:: with SMTP id t19mr47154492edc.179.1593877880846; Sat, 04 Jul 2020 08:51:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593877880; cv=none; d=google.com; s=arc-20160816; b=FaZ+EKzf4J2BclaxmMyeDEzCSOtrdewn1PxhPAazAF9aZQNnPLatWc9Wa1PNvvj7rF kaLVfyuY5+AZRyUvcGVFBJYEVX4qoa5n/PTP5tygL4O7FXYfwx1mo5MMRWSPW5NXYNvB ZgRaW4nmx8ofOlWzlII8aoJHrt9OVxpHnmM/Pn6r67e3w8zE0bAWceptx+uHq5SoJsbW Nnm1wjvjDjXYHaT3qyqDpSGSdj1Q1Hf4UGClRC3hpx1rT0GVIdmtbN7TJpfjhjTxoZDq UobNJH37CUinSxjRbKnsoe+qaja2hdS9Tgsp4fQL2DtjGNLWExjK4E6YxIqFLMLtCfb0 BSAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=kbJGmL/GT/RryX9bJANqO+8burLO+M6iii1/sXcpL8Y=; b=Rp+ZW2vbh9xRqjNbeMVRIrOsuqz9t0tQuu1xBoqnrVkuPWxt0ievFxayBGHua8cJDr jGyUkaQvb1g3xDkWf4OPFnmytkBcwqhdzZ6BFE6FcaCMAC+l7JM7OalHJ7GUGYzXIYHr CxuMPPCMQVmddPt1w5Dg0nTUtfqCrot0lD8EH6XfjUBmpPWvJvK6/rhS9X8KE5IqUzJO y+GOfoWPMSIsX+UnIv9KLBt1VwbIw6mTjt2RX6QtP2+TQeJxMEfC4V+u561vTibAJZhG r3bBoc6qx3pnEmw3u1LZQMsnw/sxIVn/ibqarxwgC3HJW9Vn9yyiG6DXkBb/OTdHRUmg cgoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aFuJOl88; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g26si9907348edv.376.2020.07.04.08.50.57; Sat, 04 Jul 2020 08:51:20 -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=pass header.i=@linaro.org header.s=google header.b=aFuJOl88; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726766AbgGDPry (ORCPT + 99 others); Sat, 4 Jul 2020 11:47:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726632AbgGDPrx (ORCPT ); Sat, 4 Jul 2020 11:47:53 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70087C061794 for ; Sat, 4 Jul 2020 08:47:53 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id e8so16417097pgc.5 for ; Sat, 04 Jul 2020 08:47:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=kbJGmL/GT/RryX9bJANqO+8burLO+M6iii1/sXcpL8Y=; b=aFuJOl88J5YF63X3Nc3Zmfg/OZKoB1k6qA4dmQ6pilrTcDmHp9MOAjcdZj1GhkLtJr 7tDM3xJLxv58i8BE20/OSQgO0T1kAegEKWn+q6m5GRn/T2QQJYuBH5Qg4NJu8/WW4XzD DvQojXVv3/TIznFSPeA/6NcnnkwVfrtbrdkb4KgGENz5NTSvgt8koGac5YXJjIlx9PVT quFpdKi4F+a6Nqipat0JrAUqYnqwNQh0u7Cq3uxu6pPPYInONp+Osf+G2RfzjF2nxgkJ Wya8a4LK6psikVX5MMbBn+zO7mXgUA5NWYyYpZ4LFt67UGdkeJnbbOCqur7ddiW7V691 CN9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=kbJGmL/GT/RryX9bJANqO+8burLO+M6iii1/sXcpL8Y=; b=UfJ/I8uV/kNsl6ns1yekYErJtgON1QO2sSN8y5WQ6Ex5gVTABMZ7J1HJHhngwsImlH 7VS8LktC6jbAsHv9hH1jCcjgHWHn5joDEHnW/HxQN4hy8RUieDULqLFU5h+GjFG4471Y eLZRBkNr8hLqpNjUy0aQGFB+nGKyIN6VQiCophhoA84ZH7+YXRSRT19ueuZ4EWHvy71S 1jQxcfOBUjRBUGIAFJDCKtknUj+HhCJ4UqUE1ihJk4bYg4GxtZeKV9zfEv1rfkW2A4Dr uF2noViSh+Sohq2wDNaiQ3C1fgEcNOIBXgCdY9y5VnOAJTTjRYrf/4nH987E01yN38VV GcOg== X-Gm-Message-State: AOAM532EeAExALPCSldJ361gNfT8tAn0ILVmBdgDGsZwrw8zB2LPKixi 9XdDofLYe5MJ/lE2uABmMSx6IJ4sxA== X-Received: by 2002:a63:5a1a:: with SMTP id o26mr33016259pgb.420.1593877672856; Sat, 04 Jul 2020 08:47:52 -0700 (PDT) Received: from Mani-XPS-13-9360 ([2409:4072:680:29c6:d74:dc5c:e13f:c458]) by smtp.gmail.com with ESMTPSA id i196sm15044123pgc.55.2020.07.04.08.47.48 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sat, 04 Jul 2020 08:47:52 -0700 (PDT) Date: Sat, 4 Jul 2020 21:17:45 +0530 From: Manivannan Sadhasivam To: Bhaumik Bhatt Cc: linux-arm-msm@vger.kernel.org, hemantk@codeaurora.org, jhugo@codeaurora.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 8/9] bus: mhi: core: Read and save device hardware information from BHI Message-ID: <20200704154745.GH3066@Mani-XPS-13-9360> References: <1593448782-8385-1-git-send-email-bbhatt@codeaurora.org> <1593448782-8385-9-git-send-email-bbhatt@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1593448782-8385-9-git-send-email-bbhatt@codeaurora.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 29, 2020 at 09:39:41AM -0700, Bhaumik Bhatt wrote: > 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 Thanks, Mani > --- > 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 >