Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp461984pxf; Thu, 8 Apr 2021 06:45:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSVeqk+PzjxGvdZm1bADtxQcEw9EH3y9jJkQgJfqPjFrW7FSt+esM+PlVHj74P9DcwRt4B X-Received: by 2002:a17:902:bc4c:b029:e9:175e:3367 with SMTP id t12-20020a170902bc4cb02900e9175e3367mr7937797plz.7.1617889509619; Thu, 08 Apr 2021 06:45:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617889509; cv=none; d=google.com; s=arc-20160816; b=fyl920/CjdK9+iMN6azSCl5I6N9uyZBMoCeA7ZYWdU4IqEHLDDgxHvBR67zpc4Bw4O Fe3Qk0zKtazjOBBFWDenEl2TCKE+AVfubresEtiM2RDVxR7jTONi1hNYB6sII3gs2NfL ubdchX2Qk+8Dg1PIwlrrf7K935YSC4a00GgaOwLQaRFUfgN3A/TMPwy/dJUyfhL6ItJc pmV6P1apwUXhhMc7uhXZVy3jMrjoUkW29TgBvtj3r/+2YFiNnRxcbQhQXkmBQvQgc+ZA YJWQ/J2wSAiVpyOkJf2UoZwLUjI8Uv6Lty2C174DfU8I5LRRV0YuzWa4ojDFC0zrJ+mE 1oAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=esL3X6Su1G5rSrNA4VMuiKnP8clvPOeMjLLBxlqFzMI=; b=ZsZCXam5ac5jY8LOwpcjOy2Z34WA4InD797uxwMQ8lnAC8OjxmG9l3d5gDH7CzKx4K dn6NHSXmLqsKXF/GIO4VN8Q6+Z5dfkhz7LOVobzA5ouIxSNZ0RYhyYZDiAXKyBzh5gKu Nm9xC00+MD88VnGPzym7PwvOMMubYUNpRqIHKp2O411y5p8TPVX3sC8AxRUZakYsWOK3 AKI+Kor9RLzwq97ivsdPKRhd/TDCh+ackP1SbK4GDUkyGH9/zVqZzPFEw7L93+XBlkc9 Se/TCs9Tl19AQw4vvErw79LNPgk4Q3Xm54qBLE8Y5zSB85KPvVcvgXeMxVbMxrirmJ4c 3MIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=srsGv4QD; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n11si23488817pgp.127.2021.04.08.06.44.45; Thu, 08 Apr 2021 06:45:09 -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=@kernel.org header.s=k20201202 header.b=srsGv4QD; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231726AbhDHNoR (ORCPT + 99 others); Thu, 8 Apr 2021 09:44:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:46284 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230467AbhDHNoQ (ORCPT ); Thu, 8 Apr 2021 09:44:16 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 29FAF61041; Thu, 8 Apr 2021 13:44:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617889445; bh=+0nlg2lxYHP/+WmaERtnHRADuls/CQxYMRQaiEsLuyg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=srsGv4QDJ2YXtQ3dk+ip8ynfU9TQwj+XOJO0yeP1q/LRRrCala/MD5cB0so0Dzit5 GwDZ8HxCNp7deVknSUTaAw6CEeR47cirXBLZ9xM3SUwoNi4hvAG/K3o5hntkoic/UH mfFlGsnPmaL33yk12y6Ecbu6luRfD0CS2kPX7exYxogrR6ob5CO4KZOCSwYXxAeTMC DvtAo+aWbwRfmJByuWya175fC5dTY/agHSNyTTZCg87JLWUj/r6Ku6v/gCvF6DGakR /P8JxrWlRNAI4q4lzmeRJIR6etcUMlpNQrYtpi3jvbycoDqqzee+6uNImojZBJ1mDb tv7hgzrr2IZ/g== Date: Thu, 8 Apr 2021 14:43:47 +0100 From: Mark Brown To: Clark Wang Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, kernel@pengutronix.de, linux-imx@nxp.com, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] spi: imx: add a check for speed_hz before calculating the clock Message-ID: <20210408134347.GE4516@sirena.org.uk> References: <20210408103347.244313-1-xiaoning.wang@nxp.com> <20210408103347.244313-2-xiaoning.wang@nxp.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="3O1VwFp74L81IIeR" Content-Disposition: inline In-Reply-To: <20210408103347.244313-2-xiaoning.wang@nxp.com> X-Cookie: Editing is a rewording activity. User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --3O1VwFp74L81IIeR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Apr 08, 2021 at 06:33:47PM +0800, Clark Wang wrote: > When some drivers use spi to send data, spi_transfer->speed_hz is > not assigned. If spidev->max_speed_hz is not assigned as well, it > will cause an error in configuring the clock. > Add a check for these two values before configuring the clock. An > error will be returned when they are not assigned. For the case where the transfer speed is not set __spi_validate() will take the controller's maximum speed so the controller should just be able to unconditionally use the transfer's speed. Your issue is therefore that the controllers are sometimes not setting a maximum speed which this doesn't seem to fix AFAICT? I'd expect the driver to be able to work one out based on the input clock. > struct spi_imx_devtype_data { > void (*intctrl)(struct spi_imx_data *, int); > int (*prepare_message)(struct spi_imx_data *, struct spi_message *); > - int (*prepare_transfer)(struct spi_imx_data *, struct spi_device *, > - struct spi_transfer *); > + int (*prepare_transfer)(struct spi_imx_data *, struct spi_device *); > void (*trigger)(struct spi_imx_data *); > int (*rx_available)(struct spi_imx_data *); > void (*reset)(struct spi_imx_data *); This seems to be a fairly big and surprising refactoring for the described change. It's quite hard to tie the change to the changelog. --3O1VwFp74L81IIeR Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmBvCJIACgkQJNaLcl1U h9CADAf/XsYEv65PROf5zL0d1q8Q96nubfrHJIDDSDpsrbRMWbKAwEGxTBGWBT2F 3+xODJnXIhu/V5sXJ/dkh8Q8nfNaxdY/aRQE6lkX29Iu6midNb1gG2xb6M/D4ztz KfaCiJpVwjs5iHpo6rLMwo/oAi7bFCfw2UFFSVbP4VZVkTqvZNJJL/RtSN2czbJa 69FAma1YVxRQF37b2WDFN18gm7XYyyF6WXU/f2qNRerh8qm6LfupTqKljtpsuzf8 AO6ottepa2ttjKxtb6/cHuLLHWym0ip0Rq1KGj5Jtcrkma/H/zH1859VJaicXKW9 1g0Si9UTTT1LjADlzAz4YhhjsRdEKg== =kJw/ -----END PGP SIGNATURE----- --3O1VwFp74L81IIeR--