From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753964AbbKXRA1 (ORCPT ); Tue, 24 Nov 2015 12:00:27 -0500 Received: from mail-wm0-f49.google.com ([74.125.82.49]:34680 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751256AbbKXRAZ (ORCPT ); Tue, 24 Nov 2015 12:00:25 -0500 Date: Tue, 24 Nov 2015 17:00:20 +0000 From: Lee Jones To: Nicolas Boichat Cc: linux-kernel@vger.kernel.org, Javier Martinez Canillas , Olof Johansson , dianders@chromium.org, rspangler@chromium.org, gwendal@chromium.org, linux-spi@vger.kernel.org, Mark Brown Subject: Re: [PATCH v2] mfd: cros ec: Lock the SPI bus while holding chipselect Message-ID: <20151124170020.GE12874@x1> References: <1447043150-4806-1-git-send-email-drinkcat@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1447043150-4806-1-git-send-email-drinkcat@chromium.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 09 Nov 2015, Nicolas Boichat wrote: > cros_ec_cmd_xfer_spi and cros_ec_pkt_xfer_spi generally work like > this: > - Pull CS down (active), wait a bit, then send a command > - Wait for response (multiple requests) > - Wait a while, pull CS up (inactive) > > These operations, individually, lock the SPI bus, but there is > nothing preventing the SPI framework from interleaving messages > intended for other devices as the bus is unlocked in between. > > This is a problem as the EC expects CS to be held low for the > whole duration. > > Solution: Lock the SPI bus during the whole transaction, to make > sure that no other messages can be interleaved. > > Signed-off-by: Nicolas Boichat > --- > > v2: Move bus_unlock earlier in the functions. > > Applies on top on linux-next/master (20151109) > > drivers/mfd/cros_ec_spi.c | 41 +++++++++++++++++++++++++++++------------ > 1 file changed, 29 insertions(+), 12 deletions(-) Code changes look okay, but I think you can drop the comments. -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog