Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2679031rdb; Fri, 8 Dec 2023 16:08:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IF5WrG2eA6jwCpt347ArOdbBSdXT3aofmetbiQ/RNPpP0iD9xu8uqIs08Iieq6LhaHo7QD7 X-Received: by 2002:a17:902:da82:b0:1d0:5218:a7e9 with SMTP id j2-20020a170902da8200b001d05218a7e9mr898144plx.53.1702080488535; Fri, 08 Dec 2023 16:08:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702080488; cv=none; d=google.com; s=arc-20160816; b=Q6ZMrf72fZnl0z+oezZZhcavqwC9l09MxBHTspdrqK3k06yJahGeJ+tFQbR+NQ/00b gxxM5FggYkI+PFKUWHfi2CPydM+OfwSYKsNXk9+xoKUW4gtlUdx+j59SH2fmZdn4mpQz RV/9V95mErR2VBIrDnn3dWpDA0t2hZZdlmwnzOyjGQ49oXFz0wAeVyfWfwgMg6kqXevL +UuhRaCDrUG46qDzE6tpAUfDFW+9trkE+UcRg/daV5w2ipvJu1s4VoU6TKIHVhCPDKKw sx/+XUOjLX6S0wFFXpw8dovnlr6vCa3Wju71saLaCEKu1FSuFQtHXO8+fKWlu+1dMZ/F 6Ugw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=EACQNr5rRi+5G+i4NK6eHmhtAziQWFqQLwN3uxogwPw=; fh=D0MU7Wd1Yw0BQci30h2RBjlRurbwAz6+sZnxo3NrMB0=; b=uadba3U8IuqzDPIm4uCATTjtbgn1GJ/Fr9ZN4+QkTGAzmm4spzXooGbiYjqbHcxgY5 kOhe49yKCmq8VcrMg9iM3DZsJYeGPjgJIY0C92ANYnYqW5vumjqHbyMUSLMqq2AZuasS rvJhpvYRK8Xvc+p+IxOYC6HbZiQ92hmuRM/XMTVYvhh66tomiG9jnwFkSp7OJSOj7OVU YK2OoA/96cQ1VDkP1tyvqp1OvGWqjKxrIAepenh0FbW8abRQYsRbbQiJRvyJ+rBVao9p KpHSySPYWr3aDIRqqlOdrjPkf+G+NDvdnz0zdK0JkmTtuU8iNfocOWSiJIo+3kE5mGO9 sTMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ntoBUAsD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id h24-20020a170902ac9800b001cfce7988edsi2295254plr.417.2023.12.08.16.08.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 16:08:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ntoBUAsD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 48F5381C9AF8; Fri, 8 Dec 2023 16:08:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229986AbjLIAHs (ORCPT + 99 others); Fri, 8 Dec 2023 19:07:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229525AbjLIAHr (ORCPT ); Fri, 8 Dec 2023 19:07:47 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7222AC for ; Fri, 8 Dec 2023 16:07:53 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 101BEC433C7; Sat, 9 Dec 2023 00:07:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702080473; bh=0lDWjZhcpsj5eDD+T3hZ5cTAQQFykaGs0qkCTg3+7Gk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ntoBUAsDFYQIe/0ThhuUrrClxY/6XTFJ3ttIK7D0kCoxzlrPg7XRYTqNlhNe5SmtZ S2yKACJsl4idJTQ7L2eM6ADk958nQDtnL850qlg8YFPmR6a2XdkfYTeJmK18i51v/q 5GD3fPm6zeZMOfcElkERh74Xn6Lz2dESFx0cRsPtpck5igqTUlBtTzRVc+kk0g2+Xb gDWsQajUAb7a+r3W5tgjFGcI29ZyybtNQdmZnckY3bKgOE701cJvcSznVHkNBJJb3f CpIJRj75d9tLrlobYZmQkxfI/rgJ2ITmgUHOSozppyT6NQR3b366Z9z/cFA6LZnAuC 5JfMDuUAhFq+A== Date: Sat, 9 Dec 2023 01:07:47 +0100 From: Andi Shyti To: Alain Volmat Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue , Pierre-Yves MORDRET , Conor Dooley , Rob Herring , Valentin Caron , linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 4/7] i2c: stm32f7: add support for stm32mp25 soc Message-ID: <20231209000747.4l6462nlzj3po3sf@zenone.zhora.eu> References: <20231208164719.3584028-1-alain.volmat@foss.st.com> <20231208164719.3584028-5-alain.volmat@foss.st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231208164719.3584028-5-alain.volmat@foss.st.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Fri, 08 Dec 2023 16:08:04 -0800 (PST) Hi Alain, On Fri, Dec 08, 2023 at 05:47:13PM +0100, Alain Volmat wrote: > The stm32mp25 has only a single interrupt line used for both > events and errors. In order to cope with that, reorganise the > error handling code so that it can be called either from the > common handler (used in case of SoC having only a single IT line) > and the error handler for others. > The CR1 register also embeds a new FMP bit, necessary when running > at Fast Mode Plus frequency. This bit should be used instead of > the SYSCFG bit used on other platforms. > Add a new compatible to distinguish between the SoCs and two > boolean within the setup structure in order to know if the > platform has a single/multiple IT lines and if the FMP bit > within CR1 is available or not. > > Signed-off-by: Alain Volmat > Signed-off-by: Valentin Caron your SoB here should come last because you are the one sending the patch. > --- > drivers/i2c/busses/i2c-stm32f7.c | 230 ++++++++++++++++++------------- > 1 file changed, 133 insertions(+), 97 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c > index 2a011deec3c5..5634332900fb 100644 > --- a/drivers/i2c/busses/i2c-stm32f7.c > +++ b/drivers/i2c/busses/i2c-stm32f7.c > @@ -50,6 +50,7 @@ > #define STM32F7_I2C_TXDR 0x28 > > /* STM32F7 I2C control 1 */ > +#define STM32_I2C_CR1_FMP BIT(24) > #define STM32F7_I2C_CR1_PECEN BIT(23) > #define STM32F7_I2C_CR1_ALERTEN BIT(22) > #define STM32F7_I2C_CR1_SMBHEN BIT(20) > @@ -226,6 +227,8 @@ struct stm32f7_i2c_spec { > * @rise_time: Rise time (ns) > * @fall_time: Fall time (ns) > * @fmp_clr_offset: Fast Mode Plus clear register offset from set register > + * @single_it_line: Only a single IT line is used for both events/errors > + * @fmp_cr1_bit: Fast Mode Plus control is done via a bit in CR1 Is the Fast Mode Plus an optional feature? > */ > struct stm32f7_i2c_setup { > u32 speed_freq; > @@ -233,6 +236,8 @@ struct stm32f7_i2c_setup { > u32 rise_time; > u32 fall_time; > u32 fmp_clr_offset; > + bool single_it_line; > + bool fmp_cr1_bit; > }; [...] > -static irqreturn_t stm32f7_i2c_slave_isr_event(struct stm32f7_i2c_dev *i2c_dev) > +static irqreturn_t stm32f7_i2c_slave_isr_event(struct stm32f7_i2c_dev *i2c_dev, u32 status) > { > void __iomem *base = i2c_dev->base; > - u32 cr2, status, mask; > + u32 cr2, mask; > u8 val; > int ret; > > - status = readl_relaxed(i2c_dev->base + STM32F7_I2C_ISR); > - good to see this change here, relates to my comment in patch 1. But I think this should go on a different patch. > /* Slave transmitter mode */ > if (status & STM32F7_I2C_ISR_TXIS) { > i2c_slave_event(i2c_dev->slave_running, > @@ -1494,17 +1504,81 @@ static irqreturn_t stm32f7_i2c_slave_isr_event(struct stm32f7_i2c_dev *i2c_dev) > return IRQ_HANDLED; > } [...] > - setup = of_device_get_match_data(&pdev->dev); > - if (!setup) { > - dev_err(&pdev->dev, "Can't get device data\n"); > - return -ENODEV; > + ret = devm_request_threaded_irq(&pdev->dev, irq_error, > + NULL, > + stm32f7_i2c_isr_error_thread, > + IRQF_ONESHOT, > + pdev->name, i2c_dev); > + if (ret) { > + dev_err(&pdev->dev, "Failed to request irq error %i\n", > + irq_error); please use dev_err_probe(); > + return ret; > + } out of the scope of the patch and just for curiosity: does the driver work without being able to signal on the error interrupt line? Overall the patch looks good to me, though. Andi