From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753699AbcFMTzK (ORCPT ); Mon, 13 Jun 2016 15:55:10 -0400 Received: from down.free-electrons.com ([37.187.137.238]:44126 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751708AbcFMTzG (ORCPT ); Mon, 13 Jun 2016 15:55:06 -0400 Date: Mon, 13 Jun 2016 21:55:02 +0200 From: Maxime Ripard To: Michal Suchanek Cc: linux-sunxi@googlegroups.com, stable@vger.kernel.org, Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Chen-Yu Tsai , Russell King , Mark Brown , Arnd Bergmann , Olof Johansson , Krzysztof Kozlowski , Javier Martinez Canillas , Simon Horman , Sjoerd Simons , Thierry Reding , Alison Wang , Timo Sigurdsson , Jonathan Liu , Gerhard Bertelsmann , Priit Laes , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org Subject: Re: [PATCH v3 01/13] spi: sunxi: set maximum and minimum speed of SPI master Message-ID: <20160613195502.GA2600@lukather> References: <2db0ce0ea1ddc17e9bb790c8cc50bcb4bb97be58.1465490774.git.hramrach@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="C7zPtVaVf+AK4Oqc" Content-Disposition: inline In-Reply-To: <2db0ce0ea1ddc17e9bb790c8cc50bcb4bb97be58.1465490774.git.hramrach@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --C7zPtVaVf+AK4Oqc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 13, 2016 at 05:46:49PM -0000, Michal Suchanek wrote: > The speed limits are unset in the sun4i and sun6i SPI drivers. >=20 > The maximum speed of SPI master is used when maximum speed of SPI slave > is not specified. Also the __spi_validate function should check that > transfer speeds do not exceed the master limits. >=20 > The user manual for A10 and A31 specifies maximum > speed of the SPI clock as 100MHz and minimum as 3kHz. >=20 > Setting the SPI clock to out-of-spec values can lock up the SoC. >=20 > Signed-off-by: Michal Suchanek > -- > v2: > new patch > v3: > fix constant style > --- > drivers/spi/spi-sun4i.c | 2 ++ > drivers/spi/spi-sun6i.c | 2 ++ > 2 files changed, 4 insertions(+) >=20 > diff --git a/drivers/spi/spi-sun4i.c b/drivers/spi/spi-sun4i.c > index 1ddd9e2..4213508 100644 > --- a/drivers/spi/spi-sun4i.c > +++ b/drivers/spi/spi-sun4i.c > @@ -387,6 +387,8 @@ static int sun4i_spi_probe(struct platform_device *pd= ev) > } > =20 > sspi->master =3D master; > + master->max_speed_hz =3D 100 * 1000 * 1000; > + master->min_speed_hz =3D 3 * 1000; > master->set_cs =3D sun4i_spi_set_cs; > master->transfer_one =3D sun4i_spi_transfer_one; > master->num_chipselect =3D 4; > diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c > index 42e2c4b..fe70695 100644 > --- a/drivers/spi/spi-sun6i.c > +++ b/drivers/spi/spi-sun6i.c > @@ -386,6 +386,8 @@ static int sun6i_spi_probe(struct platform_device *pd= ev) > } > =20 > sspi->master =3D master; > + master->max_speed_hz =3D 100 * 1000 * 1000; > + master->min_speed_hz =3D 3 * 1000; > master->set_cs =3D sun6i_spi_set_cs; > master->transfer_one =3D sun6i_spi_transfer_one; > master->num_chipselect =3D 4; I really don't get why you want to do that kind of padding, when no one does in the rest of the driver, or the rest of the kernel. Once properly changed, Acked-by: Maxime Ripard Thanks, Maxime --=20 Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com --C7zPtVaVf+AK4Oqc Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXXw+WAAoJEBx+YmzsjxAggbAP/i3j7Ax9XN5zRI16Qt44rEAn M6r958+FQFSwBXYRSphSLRF6jlHoGoPSsmLx4cQph10+7K++2X6KqCs2WAQGXvbc FJVYdeC7KWGTn/+AIIW2ygeq/r6cjWdRwrHKQi2IvCMUdfog8fy8Zgle/m0Komsd ZYXJaW6TnCn5HJXMd/9y3s54NWGHOthZkSRvdD+bSKgp/p5bHQ2kLkqDjphYkHzH KHI6bHk8YZQBzhtCrHs0tTopKLip4xAcHOkhfkznELg2PWsZWitLUoDYcAwIgVwG ZjOnmQcGyEDC3LTYH5V4qxfa3y7olqrPjosbsdjEPCCLW3d/+L29L4ESl2sCPoKI 043XCWEywl+gA/hGPgm/CcuapcYApIRPpLIfyf7N80chLLBZvq29BbXARNu7pGCP SovSkKkubYQaFALaAWhnq8iNvbVTwd/JeV84qjchcAuaMqpCuVfdcQw14XtmPhPC dmyvSsdpS0TxFm4OGSlLYAYJyZNO7OoqFY33DvFYTr876aYJNhr5xpjX8d+bLdzL pmcal09EW9PKNMPCsYxPuCmOe0e7BHqjDJA8IrvMBmCqn8Gy9lCeo+T8dide0G4s HZBzkBE3y17Hsnh9X7GnMZEtWCaeBGT8ks2E/GKIdt5nTlP9RS+SXIsFy44jDwgq b9SeLukbeImMPnJtI2Ho =vXou -----END PGP SIGNATURE----- --C7zPtVaVf+AK4Oqc--