Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp210191imm; Mon, 21 May 2018 04:57:22 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq3MR8aYU9zv4CWATuQ+ihGbTiKccwZ/yxs/fem21bt/jHjdlQYbGP0h1iq91j/E1kvT81k X-Received: by 2002:a62:cd45:: with SMTP id o66-v6mr19858452pfg.250.1526903842517; Mon, 21 May 2018 04:57:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526903842; cv=none; d=google.com; s=arc-20160816; b=cmu3slcX9CVW2dCJMB0vMJVLS5ckHYQB60B4ZJBdn6EDom99Xahkfg7ExuKlv7XVAU hsBJF7EKi9FeSqX3loeLfGu1Ebt4Tw3X7yjA9plUwPG/YjmyNhfghWl6AgVjALjsCgWX GVJTXYV8QwEQZ7Twx8K+ltP+bcsEHVrOJrZQWe5I3xTjpOkvp607Tn8XxJrsZcRYTYOa E/dmRL542cDU5YL8hm4Xn3OpxoZyEt8NDBUBdoG2jw9Q6540RF+Ixl/gDu/8HZPyCpOe xvOJZOA+/kt/TaQnmzMDB10/QY8cM9JO3SGDppUtsXQXjUFxZI14eDoCcNbbLsDsI6mY n+Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=P+IvVOG0nobarRYvo2X+vy/DzUoremIPg5ep6Cc2/3E=; b=JOe3HDC4WrNJKfh5A+QIZyz/wyFH6PsNyx2IBsC+HLAecuLl+GUtcDAlYJt38Rk9xr g0JU21YkNmCHjYROxg/By/hVeZmCXlx/4D4pIriumDlGHJ+h22sSxEsaPhXaO4myFRPb j+5MymB9I6fkp66HF+llKSte1MvEAfQneN2amRmv4srM1VYSTUhvVGhmz4QhYsC0F4S2 Fbc1TaaAE69l1dSCHpEyrqu2ooxc/MSjNlcZo6u/PeiTgICcbBnTrEsdbZSoi0B2KLVb PG6Ocd+xsOXV81giInuSjACGijopNv5B5MLmFpbh57wUhz2hkF9oXoAYTCO41Y9wNTfJ LDPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D06PNA+C; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id a14-v6si14319333plt.484.2018.05.21.04.57.08; Mon, 21 May 2018 04:57:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D06PNA+C; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1752828AbeEULz5 (ORCPT + 99 others); Mon, 21 May 2018 07:55:57 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:54474 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751234AbeEULzy (ORCPT ); Mon, 21 May 2018 07:55:54 -0400 Received: by mail-wm0-f68.google.com with SMTP id f6-v6so24850342wmc.4 for ; Mon, 21 May 2018 04:55:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=P+IvVOG0nobarRYvo2X+vy/DzUoremIPg5ep6Cc2/3E=; b=D06PNA+C7l68GRftV4EX/ZmsZ3foWNu4jSBhGWGJSF6WFVPHWFhLdSPuA/vX1DJTNz 2McurevC4eY51WqsoMev91D90Lr//X9yF1msbA9Jx/dFOVV82gZj1o+vvtKZaqiTdi37 B3I4FbpFEU+Lga55hjRTJOzjlqOWgTLGaX+dY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=P+IvVOG0nobarRYvo2X+vy/DzUoremIPg5ep6Cc2/3E=; b=ft+SwwsSHpD8pTw2JIK5yJGdXs//OLwo3OQJIbX0QKS2xK8Ajj6yNxpcR0mb/0wPBh 4IZyPIYKA57t2tGYKvuQ6BOscWiVMSHnVMu+bf5yupzGqIBuaW8pw3EO1cqbqf2d5ENb ThKgY+7HlWCMvQtz+9khY0WMLztSc5ftOvQQAy7TC9wuw8kUeDGstcqmgzkJJnXvpza1 kqlqXcF9/zo0Zq3QJiSzedc20cKUSXkcrhnEvphmYW73Nm3crW/Of1yQEgUSJbWFzm3M mxk6d5ob5oiK88fq5rj2NmG8u1f/uX/SqP1yf8nvroGgjNZtfZQ7TwzqZbwe3sAi9Wrn 292w== X-Gm-Message-State: ALKqPwftS8cqowAT38CJU3ZwPFR2L/L0SxMKPywXDtlhneLGmI0wmw2I AyU+K5C5qmN60oL+06irxeAITQ== X-Received: by 2002:a1c:700d:: with SMTP id l13-v6mr9727902wmc.81.1526903753351; Mon, 21 May 2018 04:55:53 -0700 (PDT) Received: from [192.168.0.18] (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.googlemail.com with ESMTPSA id m64-v6sm21372773wmb.12.2018.05.21.04.55.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 May 2018 04:55:52 -0700 (PDT) Subject: Re: [PATCH 2/2] slimbus: ngd: Add qcom SLIMBus NGD driver To: Vinod Cc: gregkh@linuxfoundation.org, robh+dt@kernel.org, kramasub@codeaurora.org, sdharia@quicinc.com, girishm@quicinc.com, linux-kernel@vger.kernel.org, mark.rutland@arm.com, bgoswami@codeaurora.org, devicetree@vger.kernel.org, broonie@kernel.org, linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org References: <20180516165118.16551-1-srinivas.kandagatla@linaro.org> <20180516165118.16551-3-srinivas.kandagatla@linaro.org> <20180521113314.GC14654@vkoul-mobl> From: Srinivas Kandagatla Message-ID: Date: Mon, 21 May 2018 12:55:51 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20180521113314.GC14654@vkoul-mobl> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks Vinod for the review! On 21/05/18 12:33, Vinod wrote: > On 16-05-18, 17:51, Srinivas Kandagatla wrote: >> This patch adds suppor to Qualcomm SLIMBus Non-Generic Device (NGD) > > /s/suppor/support > Yep, Will fix this in next version. >> +/* NGD (Non-ported Generic Device) registers */ >> +#define NGD_CFG 0x0 >> +#define NGD_CFG_ENABLE BIT(0) >> +#define NGD_CFG_RX_MSGQ_EN BIT(1) >> +#define NGD_CFG_TX_MSGQ_EN BIT(2) >> +#define NGD_STATUS 0x4 >> +#define NGD_LADDR BIT(1) >> +#define NGD_RX_MSGQ_CFG 0x8 >> +#define NGD_INT_EN 0x10 >> +#define SLIMBUS_QMI_POWER_RESP_MAX_MSG_LEN 7 >> +#define SLIMBUS_QMI_SELECT_INSTANCE_REQ_MAX_MSG_LEN 14 >> +#define SLIMBUS_QMI_SELECT_INSTANCE_RESP_MAX_MSG_LEN 7 >> +#define SLIMBUS_QMI_CHECK_FRAMER_STAT_RESP_MAX_MSG_LEN 7 >> +/* QMI response timeout of 500ms */ >> +#define SLIMBUS_QMI_RESP_TOUT 1000 > > Tabs or spaces, take your pick and use one, not both... I will check for such instances once again before sending v2. > >> +static void qcom_slim_qmi_power_resp_cb(struct qmi_handle *handle, >> + struct sockaddr_qrtr *sq, >> + struct qmi_txn *txn, const void *data) >> +{ >> + struct slimbus_power_resp_msg_v01 *resp; >> + >> + resp = (struct slimbus_power_resp_msg_v01 *)data; > > you dont need cast away from void It's a const void * so the compiler keeps complaining about this without cast. > >> + if (resp->resp.result != QMI_RESULT_SUCCESS_V01) >> + pr_err("%s: QMI power request failed 0x%x\n", __func__, >> + resp->resp.result); > > cant we use dev_err? I will have a look! > >> +static int qcom_slim_qmi_send_power_request(struct qcom_slim_ngd_ctrl *ctrl, >> + struct slimbus_power_req_msg_v01 *req) >> +{ >> + struct slimbus_power_resp_msg_v01 resp = { { 0, 0 } }; >> + struct qmi_txn txn; >> + int rc; >> + >> + rc = qmi_txn_init(ctrl->qmi.handle, &txn, >> + slimbus_power_resp_msg_v01_ei, &resp); >> + >> + rc = qmi_send_request(ctrl->qmi.handle, NULL, &txn, >> + SLIMBUS_QMI_POWER_REQ_V01, >> + SLIMBUS_QMI_POWER_REQ_MAX_MSG_LEN, >> + slimbus_power_req_msg_v01_ei, req); >> + if (rc < 0) { >> + dev_err(ctrl->dev, "%s: QMI send req fail %d\n", __func__, rc); >> + qmi_txn_cancel(&txn); >> + } >> + >> + if (rc < 0) >> + return rc; > > why not add this is prev error check? Yes, we should move this to previous check, Will fix this in v2. > >> +static int qcom_slim_qmi_init(struct qcom_slim_ngd_ctrl *ctrl, >> + bool apps_is_master) >> +{ >> + int rc = 0; > > superfluous init > >> +static u32 *qcom_slim_ngd_tx_msg_get(struct qcom_slim_ngd_ctrl *ctrl, int len, >> + struct completion *comp) >> +{ >> + struct qcom_slim_ngd_dma_desc *desc; >> + unsigned long flags; >> + >> + spin_lock_irqsave(&ctrl->tx_buf_lock, flags); >> + >> + if ((ctrl->tx_tail + 1) % QCOM_SLIM_NGD_DESC_NUM == ctrl->tx_head) { >> + spin_unlock_irqrestore(&ctrl->tx_buf_lock, flags); >> + return NULL; >> + } >> + desc = &ctrl->txdesc[ctrl->tx_tail]; >> + desc->base = (u32 *)((u8 *)ctrl->tx_base + >> + (ctrl->tx_tail * SLIM_MSGQ_BUF_LEN)); > > too many casts > >> +static int qcom_slim_ngd_post_rx_msgq(struct qcom_slim_ngd_ctrl *ctrl) >> +{ >> + struct qcom_slim_ngd_dma_desc *desc; >> + struct dma_slave_config conf = { >> + .direction = DMA_DEV_TO_MEM, >> + }; >> + int ret, i; >> + >> + ret = dmaengine_slave_config(ctrl->dma_rx_channel, &conf); > > so you are only setting direction for conf, not any other parameters? If not why > bother setting direction Nice hint, I will remove this! > >> + if (ret) >> + dev_err(ctrl->dev, "Error Configuring rx dma\n"); >> + >> + for (i = 0; i < QCOM_SLIM_NGD_DESC_NUM; i++) { >> + desc = &ctrl->rx_desc[i]; >> + desc->phys = ctrl->rx_phys_base + i * SLIM_MSGQ_BUF_LEN; >> + desc->ctrl = ctrl; >> + desc->base = ctrl->rx_base + i * SLIM_MSGQ_BUF_LEN; >> + desc->desc = dmaengine_prep_slave_single(ctrl->dma_rx_channel, >> + desc->phys, SLIM_MSGQ_BUF_LEN, >> + DMA_DEV_TO_MEM, >> + DMA_PREP_INTERRUPT); > > why issue multiple slave_single to dmaengine, you can bundle them and issue > dmaengine_prep_slave_sg().. Am reusing the descriptors here, My plan is to issue multiple descriptors with callback for each, and in each callback queue it back. > >> +static int qcom_slim_ngd_qmi_svc_event_init(struct qcom_slim_ngd_qmi *qmi) >> +{ >> + int ret = 0; > > superfluous init here too > Yep. >> +static int qcom_slim_ngd_runtime_idle(struct device *dev) >> +{ >> + struct qcom_slim_ngd_ctrl *ctrl = dev_get_drvdata(dev); >> + >> + if (ctrl->state == QCOM_SLIM_NGD_CTRL_AWAKE) >> + ctrl->state = QCOM_SLIM_NGD_CTRL_IDLE; >> + pm_request_autosuspend(dev); >> + return -EAGAIN; >> +} >> + >> + > > double empty lines, here Sure, will fix this in v2. > thanks, srini