From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C2FA0189912 for ; Mon, 24 Feb 2025 09:32:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740389579; cv=none; b=hunxXsbeF+DPNhCqTHOluZwdBHtiRULqPql0w88rSf2liIQRA/0OYR1sl0mRw7zwMxjBoz7eMjyyl0H3xl0/WzDqM4ZENX4Q66RdSFlVl/nUabUU4cBN/6GyZ8Og5Mhx0T5LRUuOaZXmgpVWuU2+vwhuvNVovyDgnyAK9chuPFw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740389579; c=relaxed/simple; bh=GJw38/7zb3uA+OAobw5YbPXz0q12/WPSDUd/mmzwGCw=; h=Message-ID:Subject:From:To:Date:In-Reply-To:References: Content-Type:MIME-Version; b=qNoip7o78O/EB5+inPsHnWdlMV+mpxH/RYXV973toTNkQ6U/pqcKtsiuGcAUBEaVsKqah2gmBuIyznAW6S2qK3RjNGXIXEafnqGs9egJWstV0U05YwD6hdmI/6IJ979+MzbQPbudgzAYsPlm1KJ+9kj8lWhxe6TQoqqUIbfuSWE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tmUpA-0002iD-0i; Mon, 24 Feb 2025 10:32:28 +0100 Received: from lupine.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::4e] helo=lupine) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tmUp9-002ZLh-14; Mon, 24 Feb 2025 10:32:27 +0100 Received: from pza by lupine with local (Exim 4.96) (envelope-from ) id 1tmUp9-0003W5-0p; Mon, 24 Feb 2025 10:32:27 +0100 Message-ID: Subject: Re: [PATCH v16 2/3] i2c: aspeed: support AST2600 i2c new register mode driver From: Philipp Zabel To: Ryan Chen , "benh@kernel.crashing.org" , "joel@jms.id.au" , "andi.shyti@kernel.org" , "robh@kernel.org" , "krzk+dt@kernel.org" , "conor+dt@kernel.org" , "andrew@codeconstruct.com.au" , "andriy.shevchenko@linux.intel.com" , "linux-i2c@vger.kernel.org" , "openbmc@lists.ozlabs.org" , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-aspeed@lists.ozlabs.org" , "linux-kernel@vger.kernel.org" Date: Mon, 24 Feb 2025 10:32:27 +0100 In-Reply-To: References: <20250224055936.1804279-1-ryan_chen@aspeedtech.com> <20250224055936.1804279-3-ryan_chen@aspeedtech.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4-2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org On Mo, 2025-02-24 at 09:04 +0000, Ryan Chen wrote: > > Subject: Re: [PATCH v16 2/3] i2c: aspeed: support AST2600 i2c new > > register > > mode driver > >=20 > > On Mo, 2025-02-24 at 13:59 +0800, Ryan Chen wrote: > > > Add i2c new register mode driver to support AST2600 i2c new > > > register > > > mode. AST2600 i2c controller have legacy and new register mode. > > > The > > > new register mode have global register support 4 base clock for > > > scl > > > clock selection, and new clock divider mode. The new register > > > mode > > > have separate register set to control i2c controller and target. > > > This > > > patch is for i2c controller mode driver. > > >=20 > > > Signed-off-by: Ryan Chen > > > --- > > > =C2=A0drivers/i2c/busses/Kconfig | 11 + > > > =C2=A0drivers/i2c/busses/Makefile | 1 + > > > =C2=A0drivers/i2c/busses/i2c-ast2600.c | 1036 > > > ++++++++++++++++++++++++++++++ > > > =C2=A03 files changed, 1048 insertions(+) > > > =C2=A0create mode 100644 drivers/i2c/busses/i2c-ast2600.c > > >=20 > > [...] > > > diff --git a/drivers/i2c/busses/i2c-ast2600.c > > > b/drivers/i2c/busses/i2c-ast2600.c > > > new file mode 100644 > > > index 000000000000..bfac507693dd > > > --- /dev/null > > > +++ b/drivers/i2c/busses/i2c-ast2600.c > > > @@ -0,0 +1,1036 @@ > > [...] > > > +static int ast2600_i2c_probe(struct platform_device *pdev) { > > > + struct device *dev =3D &pdev->dev; > > > + struct ast2600_i2c_bus *i2c_bus; > > > + struct resource *res; > > > + u32 global_ctrl; > > > + int ret; > > > + > > > + i2c_bus =3D devm_kzalloc(dev, sizeof(*i2c_bus), > > > GFP_KERNEL); > > > + if (!i2c_bus) > > > + return -ENOMEM; > > > + > > > + i2c_bus->reg_base =3D devm_platform_ioremap_resource(pdev, > > > 0); > > > + if (IS_ERR(i2c_bus->reg_base)) > > > + return PTR_ERR(i2c_bus->reg_base); > > > + > > > + i2c_bus->rst =3D devm_reset_control_get_shared(dev, NULL); > > > + if (IS_ERR(i2c_bus->rst)) > > > + return dev_err_probe(dev, PTR_ERR(i2c_bus->rst), > > > "Missing reset > > > +ctrl\n"); > > > + > > > + reset_control_deassert(i2c_bus->rst); > >=20 > > No reset_control_assert() in the error paths below? You could get > > that and > > simplify this by using devm_reset_control_get_shared_deasserted(). > >=20 > Sorry, devm_reset_control_get_shared_deasserted is new for me. > Do you mean modify by following=20 >=20 > i2c_bus->rst =3D devm_reset_control_get_shared_deasserted(dev, NULL); > if (IS_ERR(i2c_bus->rst)) > =C2=A0=C2=A0=C2=A0=C2=A0return dev_err_probe(dev, PTR_ERR(i2c_bus->rst), = "Missing reset > ctrl\n"); >=20 > - reset_control_deassert(i2c_bus->rst); Yes see [1]. Remove the reset_control_assert() in ast2600_i2c_remove() as well. [1] https://docs.kernel.org/driver-api/reset.html#c.devm_reset_control_get_= shared_deasserted regards Philipp