From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C1EFC2BA19 for ; Sun, 5 Apr 2020 09:26:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 54E56206B8 for ; Sun, 5 Apr 2020 09:26:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586078789; bh=XrVuvReqCn7qRHsh+DwZX7M+CiBM1sQe2eII1bqWaHs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=HWsaekYd8pBq14BUXrEOHbWQMtHNEJJ5lnFrjgidr9CU/iZr5tclW9+D43fvc1/6d Jppe8GraijNy3nBOZVURDkU+fvYpeLUnd9+2bqd/QSXNrHcFLFwesLLw7toG5pmd3C GGOTdgCysKrJQdB3bjZKwOD62iRYsAwzcxdw77y4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726444AbgDEJ02 (ORCPT ); Sun, 5 Apr 2020 05:26:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:34980 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726399AbgDEJ02 (ORCPT ); Sun, 5 Apr 2020 05:26:28 -0400 Received: from archlinux (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DA1EC20678; Sun, 5 Apr 2020 09:26:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586078787; bh=XrVuvReqCn7qRHsh+DwZX7M+CiBM1sQe2eII1bqWaHs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=nvE1wq9fIX48SjSa/e6YPrOhaPnSxiSRHOUxfDPNNKuedK35cxsjuSHtsg+VqVrQ+ VCl6xsqU29r12ESCh/vWxJf3eeUTI+EWTpAPYeTEJEEja97OvRrO3fnU/3v20TCxjh 4NheFU4gMFmvh53wYih9MU2sRRCN/HgWIo+PetY4= Date: Sun, 5 Apr 2020 10:26:23 +0100 From: Jonathan Cameron To: Lorenzo Bianconi Cc: Lorenzo Bianconi , "linux-iio@vger.kernel.org" , "mario.tesi@st.com" , Vitor Soares Subject: Re: [PATCH] iio: imu: st_lsm6dsx: flush hw FIFO before resetting the device Message-ID: <20200405102623.4a850ca7@archlinux> In-Reply-To: References: <20200404180642.6e2014c6@archlinux> X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org On Sat, 4 Apr 2020 19:09:18 +0200 Lorenzo Bianconi wrote: > > > > On Sat, 4 Apr 2020 18:29:25 +0200 > > Lorenzo Bianconi wrote: > > > > > > > > > > Hi Lorenzo, > > > > > > > > From: Lorenzo Bianconi > > > > Date: Fri, Mar 13, 2020 at 18:06:00 > > > > > > > > > flush hw FIFO before device reset in order to avoid possible races > > > > > on interrupt line 1. If the first interrupt line is asserted during > > > > > hw reset the device will work in I3C-only mode (if it is supported) > > > > > > > > > > > Hi Jonathan, > > > > > > any news about this patch? Maybe I am wrong but I am not able to find > > > it in your tree. > > > Thanks in advance. > > > > I'm running a bit behind on catching up with fixes after it became obvious > > they wouldn't make the merge window. > > > > Applied to the fixes-togreg branch of iio.git and marked for stable. > > > > ack, thx...sorry for all the noise around it. No problem - it reminded me to actually do something about this and other patches in the same position ;) Jonathan > > Regards, > Lorenzo > > > > > > > Regards, > > > Lorenzo > > > > > > > > > > > Fixes: 801a6e0af0c6 ("iio: imu: st_lsm6dsx: add support to LSM6DSO") > > > > > Fixes: 43901008fde0 ("iio: imu: st_lsm6dsx: add support to LSM6DSR") > > > > > Reported-by: Mario Tesi > > > > > Signed-off-by: Lorenzo Bianconi > > > > > --- > > > > > This is a new version of: "iio: imu: st_lsm6dsx: disable I3C support during > > > > > device reset" > > > > > https://urldefense.proofpoint.com/v2/url?u=https-3A__patchwork.kernel.org_patch_11425389_&d=DwIDAg&c=DPL6_X_6JkXFx7AXWqB0tg&r=qVuU64u9x77Y0Kd0PhDK_lpxFgg6PK9PateHwjb_DY0&m=d7oUzE4fWeY3JqYqqd-uW_v1SJkij_sOpXRvpm3-Thg&s=BEgROrIZoG9oGrwQEENFz0DP88VioXUhpeZP2Y168XI&e= > > > > > --- > > > > > drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 24 +++++++++++++++++++- > > > > > 1 file changed, 23 insertions(+), 1 deletion(-) > > > > > > > > > > diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c > > > > > index 84d219ae6aee..4426524b59f2 100644 > > > > > --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c > > > > > +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c > > > > > @@ -2036,11 +2036,21 @@ static int st_lsm6dsx_init_hw_timer(struct st_lsm6dsx_hw *hw) > > > > > return 0; > > > > > } > > > > > > > > > > -static int st_lsm6dsx_init_device(struct st_lsm6dsx_hw *hw) > > > > > +static int st_lsm6dsx_reset_device(struct st_lsm6dsx_hw *hw) > > > > > { > > > > > const struct st_lsm6dsx_reg *reg; > > > > > int err; > > > > > > > > > > + /* > > > > > + * flush hw FIFO before device reset in order to avoid > > > > > + * possible races on interrupt line 1. If the first interrupt > > > > > + * line is asserted during hw reset the device will work in > > > > > + * I3C-only mode (if it is supported) > > > > > + */ > > > > > + err = st_lsm6dsx_flush_fifo(hw); > > > > > + if (err < 0 && err != -ENOTSUPP) > > > > > + return err; > > > > > + > > > > > /* device sw reset */ > > > > > reg = &hw->settings->reset; > > > > > err = regmap_update_bits(hw->regmap, reg->addr, reg->mask, > > > > > @@ -2059,6 +2069,18 @@ static int st_lsm6dsx_init_device(struct st_lsm6dsx_hw *hw) > > > > > > > > > > msleep(50); > > > > > > > > > > + return 0; > > > > > +} > > > > > + > > > > > +static int st_lsm6dsx_init_device(struct st_lsm6dsx_hw *hw) > > > > > +{ > > > > > + const struct st_lsm6dsx_reg *reg; > > > > > + int err; > > > > > + > > > > > + err = st_lsm6dsx_reset_device(hw); > > > > > + if (err < 0) > > > > > + return err; > > > > > + > > > > > /* enable Block Data Update */ > > > > > reg = &hw->settings->bdu; > > > > > err = regmap_update_bits(hw->regmap, reg->addr, reg->mask, > > > > > -- > > > > > 2.24.1 > > > > > > > > I tested the patch and the I3C interface is working fine in this version. > > > > > > > > Reviewed-by: Vitor Soares > > > > Tested-by: Vitor Soares > > > > > > > > > > Best regards, > > > > Vitor > > > > Soares > > > > > > > > > > > > > >