From patchwork Thu Apr 2 05:36:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11470119 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 24DD215AB for ; Thu, 2 Apr 2020 05:36:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EE17D2078E for ; Thu, 2 Apr 2020 05:36:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="bDATjtlv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728661AbgDBFgc (ORCPT ); Thu, 2 Apr 2020 01:36:32 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:34594 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728999AbgDBFgc (ORCPT ); Thu, 2 Apr 2020 01:36:32 -0400 Received: by mail-pg1-f195.google.com with SMTP id l14so1348817pgb.1 for ; Wed, 01 Apr 2020 22:36:28 -0700 (PDT) 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; bh=/86LCZpkdCCI2aQCkzyWwEuy6AbVAj1IJKzL58DHDfQ=; b=bDATjtlvewO2aXhdqOfQBC/pBYB6DM9c45KnTOPWOnLnbRT8YsiPe2hUhh8blsNALJ 9N4HxMbzLwW4I++3l4TEU08PJEIREZtk9FWwCx/9ellw5Pwth9zHEDaDs8NQcp8dFzC2 kDPb3P2dKkGfo+B/MLG5lfkTILZoUq+8ll1hAXptkw/ELPV9MlJZulKD3JE8jxlTDQh9 uGtfyejTWoPTDMrluVIIBTgple1TdNOJaYY0iC0hx+QQnhFlwF0kRspbc9dlKrz3G9P6 Sch+QJyOKAf/5y3g5NJ5nz7qDbI7huL5nt2OF0XO47jjqIVEN6pVy4yhChG/009HdKr3 bIxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/86LCZpkdCCI2aQCkzyWwEuy6AbVAj1IJKzL58DHDfQ=; b=FoqTAO5rMnfOTDF6vgww3L7JP4aA0B6G5mRjl98wwdjKnN78GKgbtENWeofPIA/6MH tAK37nenL7kELBACKh617dmat6wXq8tgTIoAo/JnjhDBLv2dZR6NuuMkZ+o0+mR/eAPW GuqTT4zf2pJPCVX77V+UN1Ml0vmU4SMQiM61mHzt3+d6ngWQNAsatPqfBD6WSgGooTNy 4LrTs+haxOyNKQIhx4cXZzIKgeugNEEaPuEQMZCFs4Y+0o3YUnYI47hWO27aJvHA8yZs t8YswVGv+YUvesEmXdDPkXMM8709vBZ4Tyhk/lZKYlJf2mz9rSkKJC5ADrilKTx1Xqk2 AEpA== X-Gm-Message-State: AGi0PuYMuAlYRXnkddkl2mSXHaeO2bDctytTw1M3tAa38zZi6boY0+xa Q/DMwJapCzFRPrsvbUalJcyL X-Google-Smtp-Source: APiQypInsyCDoGwDVuzQwTgMzLsgrdkKGHtAU0VxyCHuoH02ryokIn4GnqzmG4qUxKyVyu2QdtqOwQ== X-Received: by 2002:aa7:9f4a:: with SMTP id h10mr1504155pfr.234.1585805787832; Wed, 01 Apr 2020 22:36:27 -0700 (PDT) Received: from localhost.localdomain ([2409:4072:29a:a216:d9f7:e98f:311a:69f6]) by smtp.gmail.com with ESMTPSA id s14sm2684824pgl.4.2020.04.01.22.36.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Apr 2020 22:36:27 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org, davem@davemloft.net Cc: smohanad@codeaurora.org, jhugo@codeaurora.org, kvalo@codeaurora.org, bjorn.andersson@linaro.org, hemantk@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, clew@codeaurora.org, Manivannan Sadhasivam Subject: [PATCH v2 1/3] bus: mhi: core: Add support for MHI suspend and resume Date: Thu, 2 Apr 2020 11:06:08 +0530 Message-Id: <20200402053610.9345-2-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200402053610.9345-1-manivannan.sadhasivam@linaro.org> References: <20200402053610.9345-1-manivannan.sadhasivam@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add support for MHI suspend and resume states. While at it, the mhi_notify() function needs to be exported as well. Signed-off-by: Manivannan Sadhasivam --- drivers/bus/mhi/core/main.c | 3 +- drivers/bus/mhi/core/pm.c | 143 ++++++++++++++++++++++++++++++++++++ include/linux/mhi.h | 19 +++++ 3 files changed, 164 insertions(+), 1 deletion(-) diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c index eb4256b81406..3e9aa3b2da77 100644 --- a/drivers/bus/mhi/core/main.c +++ b/drivers/bus/mhi/core/main.c @@ -267,7 +267,7 @@ int mhi_destroy_device(struct device *dev, void *data) return 0; } -static void mhi_notify(struct mhi_device *mhi_dev, enum mhi_callback cb_reason) +void mhi_notify(struct mhi_device *mhi_dev, enum mhi_callback cb_reason) { struct mhi_driver *mhi_drv; @@ -279,6 +279,7 @@ static void mhi_notify(struct mhi_device *mhi_dev, enum mhi_callback cb_reason) if (mhi_drv->status_cb) mhi_drv->status_cb(mhi_dev, cb_reason); } +EXPORT_SYMBOL_GPL(mhi_notify); /* Bind MHI channels to MHI devices */ void mhi_create_devices(struct mhi_controller *mhi_cntrl) diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c index 52690cb5c89c..3529419d076b 100644 --- a/drivers/bus/mhi/core/pm.c +++ b/drivers/bus/mhi/core/pm.c @@ -669,6 +669,149 @@ void mhi_pm_st_worker(struct work_struct *work) } } +int mhi_pm_suspend(struct mhi_controller *mhi_cntrl) +{ + struct mhi_chan *itr, *tmp; + struct device *dev = &mhi_cntrl->mhi_dev->dev; + enum mhi_pm_state new_state; + int ret; + + if (mhi_cntrl->pm_state == MHI_PM_DISABLE) + return -EINVAL; + + if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) + return -EIO; + + /* Return busy if there are any pending resources */ + if (atomic_read(&mhi_cntrl->dev_wake)) + return -EBUSY; + + /* Take MHI out of M2 state */ + read_lock_bh(&mhi_cntrl->pm_lock); + mhi_cntrl->wake_get(mhi_cntrl, false); + read_unlock_bh(&mhi_cntrl->pm_lock); + + ret = wait_event_timeout(mhi_cntrl->state_event, + mhi_cntrl->dev_state == MHI_STATE_M0 || + mhi_cntrl->dev_state == MHI_STATE_M1 || + MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state), + msecs_to_jiffies(mhi_cntrl->timeout_ms)); + + read_lock_bh(&mhi_cntrl->pm_lock); + mhi_cntrl->wake_put(mhi_cntrl, false); + read_unlock_bh(&mhi_cntrl->pm_lock); + + if (!ret || MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) { + dev_err(dev, + "Could not enter M0/M1 state"); + return -EIO; + } + + write_lock_irq(&mhi_cntrl->pm_lock); + + if (atomic_read(&mhi_cntrl->dev_wake)) { + write_unlock_irq(&mhi_cntrl->pm_lock); + return -EBUSY; + } + + dev_info(dev, "Allowing M3 transition\n"); + new_state = mhi_tryset_pm_state(mhi_cntrl, MHI_PM_M3_ENTER); + if (new_state != MHI_PM_M3_ENTER) { + write_unlock_irq(&mhi_cntrl->pm_lock); + dev_err(dev, + "Error setting to PM state: %s from: %s\n", + to_mhi_pm_state_str(MHI_PM_M3_ENTER), + to_mhi_pm_state_str(mhi_cntrl->pm_state)); + return -EIO; + } + + /* Set MHI to M3 and wait for completion */ + mhi_set_mhi_state(mhi_cntrl, MHI_STATE_M3); + write_unlock_irq(&mhi_cntrl->pm_lock); + dev_info(dev, "Wait for M3 completion\n"); + + ret = wait_event_timeout(mhi_cntrl->state_event, + mhi_cntrl->dev_state == MHI_STATE_M3 || + MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state), + msecs_to_jiffies(mhi_cntrl->timeout_ms)); + + if (!ret || MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) { + dev_err(dev, + "Did not enter M3 state, MHI state: %s, PM state: %s\n", + TO_MHI_STATE_STR(mhi_cntrl->dev_state), + to_mhi_pm_state_str(mhi_cntrl->pm_state)); + return -EIO; + } + + /* Notify clients about entering LPM */ + list_for_each_entry_safe(itr, tmp, &mhi_cntrl->lpm_chans, node) { + mutex_lock(&itr->mutex); + if (itr->mhi_dev) + mhi_notify(itr->mhi_dev, MHI_CB_LPM_ENTER); + mutex_unlock(&itr->mutex); + } + + return 0; +} +EXPORT_SYMBOL_GPL(mhi_pm_suspend); + +int mhi_pm_resume(struct mhi_controller *mhi_cntrl) +{ + struct mhi_chan *itr, *tmp; + struct device *dev = &mhi_cntrl->mhi_dev->dev; + enum mhi_pm_state cur_state; + int ret; + + dev_info(dev, "Entered with PM state: %s, MHI state: %s\n", + to_mhi_pm_state_str(mhi_cntrl->pm_state), + TO_MHI_STATE_STR(mhi_cntrl->dev_state)); + + if (mhi_cntrl->pm_state == MHI_PM_DISABLE) + return 0; + + if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) + return -EIO; + + /* Notify clients about exiting LPM */ + list_for_each_entry_safe(itr, tmp, &mhi_cntrl->lpm_chans, node) { + mutex_lock(&itr->mutex); + if (itr->mhi_dev) + mhi_notify(itr->mhi_dev, MHI_CB_LPM_EXIT); + mutex_unlock(&itr->mutex); + } + + write_lock_irq(&mhi_cntrl->pm_lock); + cur_state = mhi_tryset_pm_state(mhi_cntrl, MHI_PM_M3_EXIT); + if (cur_state != MHI_PM_M3_EXIT) { + write_unlock_irq(&mhi_cntrl->pm_lock); + dev_info(dev, + "Error setting to PM state: %s from: %s\n", + to_mhi_pm_state_str(MHI_PM_M3_EXIT), + to_mhi_pm_state_str(mhi_cntrl->pm_state)); + return -EIO; + } + + /* Set MHI to M0 and wait for completion */ + mhi_set_mhi_state(mhi_cntrl, MHI_STATE_M0); + write_unlock_irq(&mhi_cntrl->pm_lock); + + ret = wait_event_timeout(mhi_cntrl->state_event, + mhi_cntrl->dev_state == MHI_STATE_M0 || + MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state), + msecs_to_jiffies(mhi_cntrl->timeout_ms)); + + if (!ret || MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) { + dev_err(dev, + "Did not enter M0 state, MHI state: %s, PM state: %s\n", + TO_MHI_STATE_STR(mhi_cntrl->dev_state), + to_mhi_pm_state_str(mhi_cntrl->pm_state)); + return -EIO; + } + + return 0; +} +EXPORT_SYMBOL_GPL(mhi_pm_resume); + int __mhi_device_get_sync(struct mhi_controller *mhi_cntrl) { int ret; diff --git a/include/linux/mhi.h b/include/linux/mhi.h index ad1996001965..a4288f4d656f 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -568,6 +568,13 @@ void mhi_driver_unregister(struct mhi_driver *mhi_drv); void mhi_set_mhi_state(struct mhi_controller *mhi_cntrl, enum mhi_state state); +/** + * mhi_notify - Notify the MHI client driver about client device status + * @mhi_dev: MHI device instance + * @cb_reason: MHI callback reason + */ +void mhi_notify(struct mhi_device *mhi_dev, enum mhi_callback cb_reason); + /** * mhi_prepare_for_power_up - Do pre-initialization before power up. * This is optional, call this before power up if @@ -604,6 +611,18 @@ void mhi_power_down(struct mhi_controller *mhi_cntrl, bool graceful); */ void mhi_unprepare_after_power_down(struct mhi_controller *mhi_cntrl); +/** + * mhi_pm_suspend - Move MHI into a suspended state + * @mhi_cntrl: MHI controller + */ +int mhi_pm_suspend(struct mhi_controller *mhi_cntrl); + +/** + * mhi_pm_resume - Resume MHI from suspended state + * @mhi_cntrl: MHI controller + */ +int mhi_pm_resume(struct mhi_controller *mhi_cntrl); + /** * mhi_download_rddm_img - Download ramdump image from device for * debugging purpose. From patchwork Thu Apr 2 05:36:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11470121 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6331315AB for ; Thu, 2 Apr 2020 05:36:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 371962080C for ; Thu, 2 Apr 2020 05:36:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="YxfV5CiR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729164AbgDBFgi (ORCPT ); Thu, 2 Apr 2020 01:36:38 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:39292 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729061AbgDBFgh (ORCPT ); Thu, 2 Apr 2020 01:36:37 -0400 Received: by mail-pg1-f194.google.com with SMTP id g32so1334274pgb.6 for ; Wed, 01 Apr 2020 22:36:35 -0700 (PDT) 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; bh=c9aiokAxzZhwWXc4cjzfhhR5DKaeA3lVRVjrvcxIYDo=; b=YxfV5CiR7/K2rL9/KvIrT7WZdxOlFXLB0MxY+F7eBnURzYLzvc7J52d3H58oVXAVTY kQhpUccDZxXsu/nIQLQ4YKxiFn3MAgNDkrkWAe+wf3Rlriyy6vPomitMLioeEdYqtyNz wZl38EXvLgq42G9/McXJQbmcSLh4XonPDCYCENZ/PfEH5YVu71Hzz2DS0skJB/1JYKjX KGPoN99b6NJ52FkB9AfIYQY/DZPFKhKt8cUPEkQUT3WRl1Sdvpc4sO5IXEn5CoUQw4db FoJAOu/Jyarvj6Hp4Hio+uE7b+FLn/bNP3VVjjajsQoUWfDQD1AG4nZ5n23HLrbYW9nW Qpkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=c9aiokAxzZhwWXc4cjzfhhR5DKaeA3lVRVjrvcxIYDo=; b=nRZzifglDTyEhFrJj2sjwlw17DG0bxJbuLItR6nvchuTw/bwBH2tXfDgdUp9/iaKVo GphRqAnqzEnekHaCvWMiwyeYBv89JpcGYzxrWdoOKGet+d6X7UZZ5TTTz4zAnshOitOM CTkBrlZw/lng+kr1US+AtXzqyrCQ9TD4cPNOicY7QUy03fDLaBRO2FFHtPY8bFHc12eX LEqRTzDrwrXzhHh6wH5eaxQRvPlDwuBVJ/0xhuSI2pMHq8b7iegegB+vk/cBWBQw2VE2 zgqFzC7ONIEtLH/k/c/E+4HmS78lCEYJOSRiOn/smFeRYuxkiwIhpHCJ0kUKAv4b0Jsy 9R9Q== X-Gm-Message-State: AGi0PuZ5vkKgpwnXgPuO0HQtVy1/uH46vUlFGr3XGdF2hQfLvYwmfYLt P18WqQq1nLlalMKdY/oWp2vr X-Google-Smtp-Source: APiQypJkdabGHuso2IS07ogoJUhKzJdhEuB0gSewbxXaShBigRMmgAgz1IGbzAzHT5PlR/qVgiDl1g== X-Received: by 2002:aa7:870b:: with SMTP id b11mr1524260pfo.134.1585805794658; Wed, 01 Apr 2020 22:36:34 -0700 (PDT) Received: from localhost.localdomain ([2409:4072:29a:a216:d9f7:e98f:311a:69f6]) by smtp.gmail.com with ESMTPSA id s14sm2684824pgl.4.2020.04.01.22.36.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Apr 2020 22:36:34 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org, davem@davemloft.net Cc: smohanad@codeaurora.org, jhugo@codeaurora.org, kvalo@codeaurora.org, bjorn.andersson@linaro.org, hemantk@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, clew@codeaurora.org, Manivannan Sadhasivam , netdev@vger.kernel.org Subject: [PATCH v2 2/3] net: qrtr: Add MHI transport layer Date: Thu, 2 Apr 2020 11:06:09 +0530 Message-Id: <20200402053610.9345-3-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200402053610.9345-1-manivannan.sadhasivam@linaro.org> References: <20200402053610.9345-1-manivannan.sadhasivam@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org MHI is the transport layer used for communicating to the external modems. Hence, this commit adds MHI transport layer support to QRTR for transferring the QMI messages over IPC Router. Cc: "David S. Miller" Cc: netdev@vger.kernel.org Signed-off-by: Manivannan Sadhasivam Reviewed-by: Bjorn Andersson --- net/qrtr/Kconfig | 7 +++ net/qrtr/Makefile | 2 + net/qrtr/mhi.c | 126 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 135 insertions(+) create mode 100644 net/qrtr/mhi.c diff --git a/net/qrtr/Kconfig b/net/qrtr/Kconfig index 63f89cc6e82c..8eb876471564 100644 --- a/net/qrtr/Kconfig +++ b/net/qrtr/Kconfig @@ -29,4 +29,11 @@ config QRTR_TUN implement endpoints of QRTR, for purpose of tunneling data to other hosts or testing purposes. +config QRTR_MHI + tristate "MHI IPC Router channels" + depends on MHI_BUS + help + Say Y here to support MHI based ipcrouter channels. MHI is the + transport used for communicating to external modems. + endif # QRTR diff --git a/net/qrtr/Makefile b/net/qrtr/Makefile index 32d4e923925d..1b1411d158a7 100644 --- a/net/qrtr/Makefile +++ b/net/qrtr/Makefile @@ -5,3 +5,5 @@ obj-$(CONFIG_QRTR_SMD) += qrtr-smd.o qrtr-smd-y := smd.o obj-$(CONFIG_QRTR_TUN) += qrtr-tun.o qrtr-tun-y := tun.o +obj-$(CONFIG_QRTR_MHI) += qrtr-mhi.o +qrtr-mhi-y := mhi.o diff --git a/net/qrtr/mhi.c b/net/qrtr/mhi.c new file mode 100644 index 000000000000..2f604dff93cd --- /dev/null +++ b/net/qrtr/mhi.c @@ -0,0 +1,126 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. + */ + +#include +#include +#include +#include +#include + +#include "qrtr.h" + +struct qrtr_mhi_dev { + struct qrtr_endpoint ep; + struct mhi_device *mhi_dev; + struct device *dev; +}; + +/* From MHI to QRTR */ +static void qcom_mhi_qrtr_dl_callback(struct mhi_device *mhi_dev, + struct mhi_result *mhi_res) +{ + struct qrtr_mhi_dev *qdev = dev_get_drvdata(&mhi_dev->dev); + int rc; + + if (!qdev || mhi_res->transaction_status) + return; + + rc = qrtr_endpoint_post(&qdev->ep, mhi_res->buf_addr, + mhi_res->bytes_xferd); + if (rc == -EINVAL) + dev_err(qdev->dev, "invalid ipcrouter packet\n"); +} + +/* From QRTR to MHI */ +static void qcom_mhi_qrtr_ul_callback(struct mhi_device *mhi_dev, + struct mhi_result *mhi_res) +{ + struct sk_buff *skb = (struct sk_buff *)mhi_res->buf_addr; + + if (skb->sk) + sock_put(skb->sk); + consume_skb(skb); +} + +/* Send data over MHI */ +static int qcom_mhi_qrtr_send(struct qrtr_endpoint *ep, struct sk_buff *skb) +{ + struct qrtr_mhi_dev *qdev = container_of(ep, struct qrtr_mhi_dev, ep); + int rc; + + rc = skb_linearize(skb); + if (rc) { + kfree_skb(skb); + return rc; + } + + rc = mhi_queue_skb(qdev->mhi_dev, DMA_TO_DEVICE, skb, skb->len, + MHI_EOT); + if (rc) { + kfree_skb(skb); + return rc; + } + + if (skb->sk) + sock_hold(skb->sk); + + return rc; +} + +static int qcom_mhi_qrtr_probe(struct mhi_device *mhi_dev, + const struct mhi_device_id *id) +{ + struct qrtr_mhi_dev *qdev; + int rc; + + qdev = devm_kzalloc(&mhi_dev->dev, sizeof(*qdev), GFP_KERNEL); + if (!qdev) + return -ENOMEM; + + qdev->mhi_dev = mhi_dev; + qdev->dev = &mhi_dev->dev; + qdev->ep.xmit = qcom_mhi_qrtr_send; + + dev_set_drvdata(&mhi_dev->dev, qdev); + rc = qrtr_endpoint_register(&qdev->ep, QRTR_EP_NID_AUTO); + if (rc) + return rc; + + dev_dbg(qdev->dev, "Qualcomm MHI QRTR driver probed\n"); + + return 0; +} + +static void qcom_mhi_qrtr_remove(struct mhi_device *mhi_dev) +{ + struct qrtr_mhi_dev *qdev = dev_get_drvdata(&mhi_dev->dev); + + qrtr_endpoint_unregister(&qdev->ep); + dev_set_drvdata(&mhi_dev->dev, NULL); +} + +static const struct mhi_device_id qcom_mhi_qrtr_id_table[] = { + { .chan = "IPCR" }, + {} +}; +MODULE_DEVICE_TABLE(mhi, qcom_mhi_qrtr_id_table); + +static struct mhi_driver qcom_mhi_qrtr_driver = { + .probe = qcom_mhi_qrtr_probe, + .remove = qcom_mhi_qrtr_remove, + .dl_xfer_cb = qcom_mhi_qrtr_dl_callback, + .ul_xfer_cb = qcom_mhi_qrtr_ul_callback, + .id_table = qcom_mhi_qrtr_id_table, + .driver = { + .name = "qcom_mhi_qrtr", + }, +}; + +module_mhi_driver(qcom_mhi_qrtr_driver); + +MODULE_AUTHOR("Chris Lew "); +MODULE_AUTHOR("Manivannan Sadhasivam "); +MODULE_DESCRIPTION("Qualcomm IPC-Router MHI interface driver"); +MODULE_LICENSE("GPL v2"); From patchwork Thu Apr 2 05:36:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 11470123 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 95D671668 for ; Thu, 2 Apr 2020 05:36:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 727F12078E for ; Thu, 2 Apr 2020 05:36:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FLxJvfQS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725789AbgDBFgs (ORCPT ); Thu, 2 Apr 2020 01:36:48 -0400 Received: from mail-pj1-f67.google.com ([209.85.216.67]:53598 "EHLO mail-pj1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729262AbgDBFgl (ORCPT ); Thu, 2 Apr 2020 01:36:41 -0400 Received: by mail-pj1-f67.google.com with SMTP id l36so1093876pjb.3 for ; Wed, 01 Apr 2020 22:36:41 -0700 (PDT) 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; bh=jPuAXHpqrNAT+U03Z2D0D9d6MExECUerQyolxFR+Rtk=; b=FLxJvfQS0ysmXpNHESPUDdj7u8d5tYFdiE/P7MB7ZAiuFbqgIiOi0ODzXBe0HK5t5y 05ZME+MBiIQY5rPFJhn/ankIYTGPQ39BjLn3zNjh/hKIl83Cq5plB/coFF1KyMN5Wv6x sDjUTNTxeGnF1C9EwKC5E58eLETX49fVYiRrILohyk8d4PThgmZFwY+iYVcnpbPamiKB +VHONI6ttdeP87QsPum9UOXkFBP/QxZOVh1bft6RS92h6kicR1Y7AJsTzXs35vARM8FX xhLXxvZT0kQqlH534Yc9tglbmXj6DaWECLZVNh/vc3ALb/ev+KfKHOlcrHYT8uEppfiD p2mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jPuAXHpqrNAT+U03Z2D0D9d6MExECUerQyolxFR+Rtk=; b=hcdQJr3SoO9CGkxZfUC+gRJOjpJLwFDmIr5ct6I5wgDek1X6wlQhSa7UxFH+KPozvp jETn82hiXX8ncItba+hp79ZBlrkZNuZpIOvRY65n25Hc7/UtBmlopA7G01jH1H5ZQM5l +2svJsedKtryMyeOTHrc0LJRcGp2imdVjaa5XUAPIubDus0Vu5HON16d7oIWte4Fs1sD Lc8jvUjZcT8WuMetraUQ9qt4bKf64nEhLYqaNHgvv2aopiIgdMrOaKcuC3o6gLgjpFqY dFPA/NgFekuNQ/zFytBT/qrTUJZbhTfojjbVX12K1z4SmQlhdBSvGNSV0xT9yybh3k+k RXtA== X-Gm-Message-State: AGi0PuZI6abfy/ga0T5Tc7IfOuKeAc+rKjx+0XOqjC0/f5Ln5k7oltQV AAlJYxUzSQVDD+GgJOyV/wL0 X-Google-Smtp-Source: APiQypLUO9ItCUYvMe/cdxMNd9ZZ/BddDu0GYPMSa91cheBTNWouOMVF2ehqKljSAS/Zgn43sQDi/w== X-Received: by 2002:a17:902:d705:: with SMTP id w5mr1414399ply.68.1585805800814; Wed, 01 Apr 2020 22:36:40 -0700 (PDT) Received: from localhost.localdomain ([2409:4072:29a:a216:d9f7:e98f:311a:69f6]) by smtp.gmail.com with ESMTPSA id s14sm2684824pgl.4.2020.04.01.22.36.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Apr 2020 22:36:40 -0700 (PDT) From: Manivannan Sadhasivam To: gregkh@linuxfoundation.org, davem@davemloft.net Cc: smohanad@codeaurora.org, jhugo@codeaurora.org, kvalo@codeaurora.org, bjorn.andersson@linaro.org, hemantk@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, clew@codeaurora.org, Manivannan Sadhasivam , netdev@vger.kernel.org Subject: [PATCH v2 3/3] net: qrtr: Do not depend on ARCH_QCOM Date: Thu, 2 Apr 2020 11:06:10 +0530 Message-Id: <20200402053610.9345-4-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200402053610.9345-1-manivannan.sadhasivam@linaro.org> References: <20200402053610.9345-1-manivannan.sadhasivam@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org IPC Router protocol is also used by external modems for exchanging the QMI messages. Hence, it doesn't always depend on Qualcomm platforms. One such instance is the QCA6390 WLAN device connected to x86 machine. Cc: "David S. Miller" Cc: netdev@vger.kernel.org Reviewed-by: Bjorn Andersson Signed-off-by: Manivannan Sadhasivam --- net/qrtr/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/net/qrtr/Kconfig b/net/qrtr/Kconfig index 8eb876471564..f362ca316015 100644 --- a/net/qrtr/Kconfig +++ b/net/qrtr/Kconfig @@ -4,7 +4,6 @@ config QRTR tristate "Qualcomm IPC Router support" - depends on ARCH_QCOM || COMPILE_TEST ---help--- Say Y if you intend to use Qualcomm IPC router protocol. The protocol is used to communicate with services provided by other