Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1068201imm; Fri, 28 Sep 2018 11:20:50 -0700 (PDT) X-Google-Smtp-Source: ACcGV62dBxzeAmgPJmxYTATvSWvOV/nrGmfweCUwJ++evVDyqzeNFvuWh1JZrn31dPGi09FkDWdO X-Received: by 2002:a63:1f58:: with SMTP id q24-v6mr15983554pgm.88.1538158850840; Fri, 28 Sep 2018 11:20:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538158850; cv=none; d=google.com; s=arc-20160816; b=W0eCInEeSQaFiJBNcH414TNXMTLJK19ZPPDJXRiyoV61v+0UBcX7ySKUP5fMnQnJmU gGqFTy0WaOT7QgLMCYRtjd79DfRjCqvHLYjq4KYfYyshmqn+CJpC7TSu5Oy3vWQM4y9u zZTJFMhrD1CXhtTqVQF10iaYIcktqZWpq4hqRmGLUGYZDyAlWe8jOgdSBfpi3iKTG3zk XD1adjLX76VL6bSt9Nt6IL2oxqPm0hlpx/VhiYY74nV4kHV/DyLsGX9Ym/Fat50537n9 kJZfvxSskgTeY3Zpd6sefcxx0oPI/83gI3KX1R+AvE3Sn+5zFSIkx5QMBrSG5pxtpZi2 0K2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=LcKmU7L+xBx0pBdhtJyMkoX3aJB7gK2IFsKoZuZ4G2o=; b=zU2dJjG/ff7s973gtMgPm8gXQ/y8HPXXvij8kixenvdNYyUi7uV5eDR2doD9wEyMJJ Wl/tMjeTzIq5cYkpd+aFHHAFUqhoOlwQJ/jvIrWJGDrCEz9gKnfmwYR4NA8izior7JXb /AdrqLFwlmdiEQ1ITEzxTE3Q/EC8SRTkVTMPlVtA3wAl9gshD8wnX7OjJ1KJ+NprimvQ 0eVIAc08lYxG/ntmUZdXQRlUv0R72SMP9ILSpXT+LhJajqrO6RH2OJL2encfSwnSFIIv 20j1lV01t+O/eLBrftkDLbKyWjvsa7Gq2wRjZFAc0mjwnZ+XUR7nOyn3F23j3Rf11pyq mglA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=EllzHqvi; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 207-v6si5262774pgf.245.2018.09.28.11.20.36; Fri, 28 Sep 2018 11:20:50 -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=@chromium.org header.s=google header.b=EllzHqvi; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726291AbeI2ApD (ORCPT + 99 others); Fri, 28 Sep 2018 20:45:03 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:46836 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725906AbeI2ApC (ORCPT ); Fri, 28 Sep 2018 20:45:02 -0400 Received: by mail-qt1-f194.google.com with SMTP id h22-v6so7603633qtr.13 for ; Fri, 28 Sep 2018 11:20:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LcKmU7L+xBx0pBdhtJyMkoX3aJB7gK2IFsKoZuZ4G2o=; b=EllzHqviTOTomyNkep9PH15pjXWKPAJAfkV9tztBHpEgJjzTP9O42Ih2+/+3pOFbsg W/MpVC/KajS8rjW0f9TTOSMO8eSYIJz1oL7k63CCTrwaROtSlDdN34YY/ROIFCY1vZZF kWy/YCJo0ltpnKZdYoMdCEY3sPM8qk6JtZS00= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LcKmU7L+xBx0pBdhtJyMkoX3aJB7gK2IFsKoZuZ4G2o=; b=ioRuNavr4zLjr4uPkTo2H6fI3tJykwOCD3VFIKjc3c+ncovyWk401ZnBl3gywM0+On BBt3jzRMSZh2JP3FAqOigY1GkN972gdR9LHtl9hbsT9DYFrxUjy0oCQmjrtYBlHrf+VY Rz1DYpvwh7b3Ldx34kpFgD5aprwrlwvSWdizICXAgcXy9rgyct3L7Xtf6FuuiUEDiNNG tIAO+Kswm53z1Jq5MD4sfbYuM5KO214XecKERFGf4q6BSnGVoj9jiO44GZ1AzURYI20d mLVsp/akmmzf1NoZvv140PtSzOCBH1kJOm8IWOvWclQHGfpqmZN1icnQ8jDC+OFpiXhD N+qg== X-Gm-Message-State: ABuFfogfOvoRTOYSjRfJMfMsmgAT47Nonz+M4v4/EYn7m9hkKWrsfUXG xiucAW08FQLWNFqTT1CrySno6lu5wgPJy2KZED2V6g== X-Received: by 2002:ac8:1019:: with SMTP id z25-v6mr13780167qti.25.1538158802236; Fri, 28 Sep 2018 11:20:02 -0700 (PDT) MIME-Version: 1.0 References: <20180926205204.184898-1-ryandcase@chromium.org> <20180926205204.184898-2-ryandcase@chromium.org> <153803059441.119890.891880266219521584@swboyd.mtv.corp.google.com> In-Reply-To: <153803059441.119890.891880266219521584@swboyd.mtv.corp.google.com> From: Ryan Case Date: Fri, 28 Sep 2018 11:19:51 -0700 Message-ID: Subject: Re: [PATCH v3 2/2] spi: Introduce new driver for Qualcomm QuadSPI controller To: Stephen Boyd Cc: Mark Brown , Randy Dunlap , linux-arm-msm@vger.kernel.org, Doug Anderson , Trent Piepho , Boris Brezillon , Girish Mahadevan , linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 26, 2018 at 11:43 PM Stephen Boyd wrote: > Quoting Ryan Case (2018-09-26 13:52:04) > > From: Girish Mahadevan > > +#include > > + > > +#define AHB_MIN_HZ 9600000UL > > Is this used? Nope. Do you want all currently unused defines removed or specifically this one? I saw precedent in other drivers for defining registers/flags/values of supported but unused functionality so I left these (big endian, DDR, ...). > > + speed_hz = slv->max_speed_hz; > > + if (xfer->speed_hz) > > + speed_hz = xfer->speed_hz; > > + > > + ret = clk_set_rate(ctrl->clks[QSPI_CLK_CORE].clk, speed_hz * 4); > > Why 4? Is that related to the number of wires? In normal operation the core clock should be running at 4x the rate of the transfer clock regardless of number of wires used. > > + put_unaligned(rd_fifo, word_buf++); > > + } > > + ctrl->xfer.rx_buf = word_buf; > > + } > > + > > + if (bytes_to_read) { > > + byte_buf = ctrl->xfer.rx_buf; > > Does this need to move forward by words_to_read bytes so that the left > over bytes are tacked onto the end? Or this should be an else if > statement? When the words block completes it updates the rx_buf location so it is already at the correct offset for bytes. > > + > > + master->max_speed_hz = 300000000; > > + master->num_chipselect = QSPI_NUM_CS; > > + master->bus_num = pdev->id; > > Can this come from DT aliases? I've never thought about qspi and > "regular" spi being in the same spi bus numbering system, but I suppose > that will happen now and we need to make sure that qspi numbers start > after the regular ones? I'm not sure. Can look into it. > > > + master->dev.of_node = pdev->dev.of_node; > > + master->mode_bits = SPI_MODE_0 | > > + SPI_TX_DUAL | SPI_RX_DUAL | > > + SPI_TX_QUAD | SPI_RX_QUAD; > > + master->flags = SPI_MASTER_HALF_DUPLEX; > > + master->prepare_message = qcom_qspi_prepare_message; > > + master->transfer_one = qcom_qspi_transfer_one;