Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1858956lqg; Mon, 4 Mar 2024 06:09:29 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW76pKTRi9ZSue8fGNHKeH+6tVynI0DT/2KTnCUehQEaxLOw4G514Da2V+uauytYSyKLT9Wsb8xKS8bAxXW6/p4puqN6NcIMSfz8YcOhg== X-Google-Smtp-Source: AGHT+IHSO5TX8u/SlQmKDc/1NSnDMlFplMT/iOM+yDu8yVSxhKZ9FJvK/8AoVG3ZdY0bApI9tLRo X-Received: by 2002:aa7:db58:0:b0:567:3141:63ab with SMTP id n24-20020aa7db58000000b00567314163abmr3054508edt.35.1709561369756; Mon, 04 Mar 2024 06:09:29 -0800 (PST) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id s5-20020a50ab05000000b00566afb7bb1asi3496146edc.62.2024.03.04.06.09.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 06:09:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90710-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@kernel.org header.s=k20201202 header.b=QKhwZti5; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-90710-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90710-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 99A681F27C6D for ; Mon, 4 Mar 2024 14:08:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9208F3FE37; Mon, 4 Mar 2024 14:08:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="QKhwZti5" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 9A1573FB0D; Mon, 4 Mar 2024 14:08:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709561321; cv=none; b=dsqXffidY5YY9E1ToJ02qnvTxFubhmXD2bmN0rP9YnZdPBzd+nES0qpRpqXprfzh4cfi/fX1AnjOf6yxBead030d1rR9I+9hxa0lkaN/ze3GvhKWgcNVEUqaPFK1fkdyVJcH2ksFZoMgehlRv/Yviwl2C24+0INxa5u1DwZ81Do= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709561321; c=relaxed/simple; bh=mGavApi6w7ofRRdajIRCPCMtvgMiEtdIO9FBAOcKrK0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JWe9o+DqDU6bpsRIYDjHgd+tVI17X5xFsuOZbLFYluxwlOmN2GTO/wc5tY+4ocxZWWdq+TPro1Rv66it9HA5YrMym3ptGNHHXnymFOM9e713knZDAuYLInLxnqAbVKXQE0X+OEgAqqcosOQ1wCCjULpmWP9Q/ZD4GXDLRXeZVEk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QKhwZti5; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63D70C43390; Mon, 4 Mar 2024 14:08:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709561321; bh=mGavApi6w7ofRRdajIRCPCMtvgMiEtdIO9FBAOcKrK0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QKhwZti5qxer0MQBIkoAhnJwwnxBdoHzXNIrtkspZueeH6FpLx3XTPV1NhCPPLz29 BULfYRkejdIO2Pop70eNvGR76v3kQj3XY/B0xCkYz6zu6HsB/lMO1CpYKpQQG+yRSD 6eBIYcL9JDBIu4nPI3o9gNIidBt8NkQk42Jw+xuPRTFYIuruzVMRNytiyVrOWaopBp poiJO9tsmy9OzxJrWUR38CrzBu1dwevCTH3pwORypoOnQmlBYBhEigR4VwKrpOU6zN w0EG2NbthUoGWVqpGdPO6L1zbAVxYc3Fhg+5OvspiJf802zwQpfVrb0wtEmam37HSm vapr3O4W8lMqw== Date: Mon, 4 Mar 2024 15:08:37 +0100 From: Andi Shyti To: =?utf-8?B?VGjDqW8=?= Lebrun Cc: Linus Walleij , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Thomas Bogendoerfer , linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Gregory Clement , Vladimir Kondratiev , Thomas Petazzoni , Tawfik Bayouk , Andi Shyti Subject: Re: [PATCH v2 09/11] i2c: nomadik: support Mobileye EyeQ5 I2C controller Message-ID: References: <20240229-mbly-i2c-v2-0-b32ed18c098c@bootlin.com> <20240229-mbly-i2c-v2-9-b32ed18c098c@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240229-mbly-i2c-v2-9-b32ed18c098c@bootlin.com> Hi Theo, .. > +#include > #include > +#include > +#include > +#include > #include > -#include > -#include > -#include > #include > -#include > -#include > -#include > #include > -#include > +#include > +#include > #include > #include > +#include > +#include > +#include Please reorder the headers in a different patch. > #define DRIVER_NAME "nmk-i2c" > .. > +static inline u8 nmk_i2c_readb(const struct nmk_i2c_dev *priv, > + unsigned long reg) > +{ > + if (priv->has_32b_bus) > + return readl(priv->virtbase + reg); > + else > + return readb(priv->virtbase + reg); nit: no need for the else (your choice though, if you want to have ti coherent with the write counterpart). > +} > + > +static inline void nmk_i2c_writeb(const struct nmk_i2c_dev *priv, u32 val, > + unsigned long reg) > +{ > + if (priv->has_32b_bus) > + writel(val, priv->virtbase + reg); > + else > + writeb(val, priv->virtbase + reg); > +} .. > +static int nmk_i2c_eyeq5_probe(struct nmk_i2c_dev *priv) > +{ > + struct device *dev = &priv->adev->dev; > + struct device_node *np = dev->of_node; > + unsigned int shift, speed_mode; > + struct regmap *olb; > + unsigned int id; > + > + priv->has_32b_bus = true; > + > + olb = syscon_regmap_lookup_by_phandle_args(np, "mobileye,olb", 1, &id); > + if (IS_ERR_OR_NULL(olb)) { > + if (!olb) > + olb = ERR_PTR(-ENOENT); > + return dev_err_probe(dev, PTR_ERR(olb), > + "failed OLB lookup: %lu\n", PTR_ERR(olb)); just return PTR_ERR(olb) and use dev_err_probe() in the upper layer probe. > + } > + > + if (priv->clk_freq <= 400000) > + speed_mode = 0b00; > + else if (priv->clk_freq <= 1000000) > + speed_mode = 0b01; > + else > + speed_mode = 0b10; would be nice to have these as defines. > + > + shift = NMK_I2C_EYEQ5_OLB_IOCR2_SHIFT(id); > + regmap_update_bits(olb, NMK_I2C_EYEQ5_OLB_IOCR2, > + 0b11 << shift, speed_mode << shift); please define these values and for hexadecimals use 0x... > + return 0; > +} > + > static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id) > { > int ret = 0; > @@ -1001,8 +1065,17 @@ static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id) > > priv->vendor = vendor; > priv->adev = adev; > + priv->has_32b_bus = false; > nmk_i2c_of_probe(np, priv); > > + if (of_device_is_compatible(np, "mobileye,eyeq5-i2c")) { > + ret = nmk_i2c_eyeq5_probe(priv); > + if (ret) { > + dev_info(dev, "%s: %d: %d\n", __func__, __LINE__, ret); > + return ret; > + } as said above, use dev_err_probe here. Andi > + } > + > if (priv->tft > max_fifo_threshold) { > dev_warn(dev, "requested TX FIFO threshold %u, adjusted down to %u\n", > priv->tft, max_fifo_threshold); > > -- > 2.44.0 >