Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1180116rdb; Mon, 19 Feb 2024 06:52:53 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUo7J3jP+q5yG5lCiBVusOeVJc97UyzVUVGdg+a5Zky+QuU0iN7S4PAj/yVJQ9YbqY3eQ7glDaANfa2RdULQKcVKQaoaL6T46xM2xLjpw== X-Google-Smtp-Source: AGHT+IFgN/6SUpXjNJczIO5dve1/aHYRRTYeanvHpP+4M98KXorBzYAjKmeBj5rk13bQZ13UKZDK X-Received: by 2002:a17:906:16da:b0:a3e:7dbe:298b with SMTP id t26-20020a17090616da00b00a3e7dbe298bmr2429074ejd.24.1708354372686; Mon, 19 Feb 2024 06:52:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708354372; cv=pass; d=google.com; s=arc-20160816; b=VaOs0/tn2rSJs6gJBqA2A0ejxe2fQx6LutbQl3lGiLlUTcbOfFLc+OC3wDYmmOv+A4 oqT+QW288wPmfvABCcBRWaDSnEdz3kZC4dpr/gq7n+KWqEji0eAoSZQdi6t6SGKVqz95 aqP34TKjThDfdp03XTEzQQPGqjMuPhcw2KEsX7WPfJQbh/N6HYqx1SmAFfwZ21ve4+AB wBL5QfzEo5a5naQurmCHSPYSAe9L2tmuA9om8R479DcbErsMDcb8rDLw8A87qjlTiRS9 6Rsd+09V9Ra0tNIjKyYrk1ySiTKJRt0qi1hbELq/M1t6YHGY4Bj2X8en/zM1J5xdu0Uo 7inQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:references:subject:from:to:cc:message-id:date :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=7ZI2x7L+5DI9OHRIbLNWtIWuWsNLPZDbExC8tkmjT4Q=; fh=VxiA6NlNkYG7yRJR7zgUocvd5D+8Kt6BSDV3aFo6BHE=; b=ykGFG2bmRYhwKw7KndPkxPjEY1z2cgDnkKgmjdtuygfZS7so9iOQTEcU4tuACcFXLY C3nj1RdWkVc1K10904y9Usd4KKQk+gvn3HnCgmj86PKpybejAoiz9VYgcExxfulrpVLh hXFE5YHb+Dcol8SxEtlKLlvgj3oPB5Rw5QTuRJUfPK6c17Tg5OuDMB9HXaimLaprbqtW kDrcHBxFi5vfkVj1Jp+EVj6M/DEulWgO3U0CwtmDnQRHzXYq6OpYJMV+yRFf946Vvtih RoElmlqw26NnzcSx3yHfIeGR9ADrGbikJdDDOmjQx6khNNl2ERBe59+lbl5gXK+vDr7P nMDQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=aqUuKFXX; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-71512-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71512-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h21-20020a170906111500b00a3e891b5825si1069345eja.534.2024.02.19.06.52.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 06:52:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71512-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=pass header.i=@bootlin.com header.s=gm1 header.b=aqUuKFXX; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-71512-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71512-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com 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 73A661F211BB for ; Mon, 19 Feb 2024 14:52:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9567537141; Mon, 19 Feb 2024 14:52:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="aqUuKFXX" Received: from relay3-d.mail.gandi.net (relay3-d.mail.gandi.net [217.70.183.195]) (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 E64512EB10; Mon, 19 Feb 2024 14:52:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.195 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708354363; cv=none; b=dWpswNpDmPC2AiB2yPaOJRfNZiRBsbAdsXShXH1KKyjQio4ENTHZb2GZXTMhVPlfvUXgvvOhFQBzrPYr/v2ZbBK3Jroz0y60NRfWx8Oipf5W+hjpczXDW2RWaKqmWYt5dRJPF/IaRd9rG6yC86NeG+MWbzjg/PPMQgJS4cUwI2s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708354363; c=relaxed/simple; bh=KI8gYtgQc3D6K7JrkCR8/DBx6/PE/xTzlqPXlmn93UQ=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:To:From:Subject: References:In-Reply-To; b=CRNuHSDfF5W18RWl69H/IdD9TvWd7qJfuAfefKQv7itK7J0VR6tjb81RbUmXMLuxaRjlVdKRRDLovygLpyVGgtFuEi7PqSo7OHsXFyCzAVKld5yFmj3BzujNz24dqh94rZ8m/tJl0XKs2VcdC23T6jcy4T0KNPTYeJn2wykOrJI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=aqUuKFXX; arc=none smtp.client-ip=217.70.183.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 8A95A60005; Mon, 19 Feb 2024 14:52:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708354359; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7ZI2x7L+5DI9OHRIbLNWtIWuWsNLPZDbExC8tkmjT4Q=; b=aqUuKFXXla1EFJCYNm9WJ4ROhvvw47hyqdD5c80VjAQIDQNfR/kfOwXylSn/abIZA4gNmF VWHmcHDdT2mlxvLEhLkUEsIayg0Z+BGQc7mUH4uBrF4dsRcArXUys3waztbUWZQ9/ciM1F VL72U8mZnu23eFUEMiqSkrMtAR/W6ZpnrruMBCM3G6qACADeBL0DqXUDispK6q5Oc3ARim ZNL7tB/TW8Mm00WcsKUa3XtwhQqiMSqIAAL5intyz6tf57yjQIaY9IDUlzHp4YUNq5kJFx p7AyA6bgBPwKALcdR48Uks7g6qolAjjdBLUjjKP5iNiun1b9vSkKDNPBkzzJ8g== Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Mon, 19 Feb 2024 15:52:37 +0100 Message-Id: Cc: "Andi Shyti" , "Rob Herring" , "Krzysztof Kozlowski" , "Conor Dooley" , "Thomas Bogendoerfer" , , , , , , "Gregory Clement" , "Vladimir Kondratiev" , "Thomas Petazzoni" , "Tawfik Bayouk" To: "Linus Walleij" From: =?utf-8?q?Th=C3=A9o_Lebrun?= Subject: Re: [PATCH 10/13] i2c: nomadik: support Mobileye EyeQ5 I2C controller X-Mailer: aerc 0.15.2 References: <20240215-mbly-i2c-v1-0-19a336e91dca@bootlin.com> <20240215-mbly-i2c-v1-10-19a336e91dca@bootlin.com> In-Reply-To: X-GND-Sasl: theo.lebrun@bootlin.com Hello, On Mon Feb 19, 2024 at 3:35 PM CET, Linus Walleij wrote: > On Thu, Feb 15, 2024 at 5:52=E2=80=AFPM Th=C3=A9o Lebrun wrote: > > > Add compatible for the integration of the same DB8500 IP block into the > > Mobileye EyeQ5 platform. Two quirks are present: > > > > - The memory bus only supports 32-bit accesses. One writeb() is done t= o > > fill the Tx FIFO which we replace with a writel(). > > > > - A register must be configured for the I2C speed mode; it is located > > in a shared register region called OLB. We access that memory region > > using a syscon & regmap that gets passed as a phandle (mobileye,olb)= . > > > > A two-bit enum per controller is written into the register; that > > requires us to know the global index of the I2C > > controller (mobileye,id). > > > > We add #include and and sort > > headers. > > > > Signed-off-by: Th=C3=A9o Lebrun > > (...) > > > - writeb(*priv->cli.buffer, priv->virtbase + I2C_TFR); > > + if (priv->has_32b_bus) > > + writel(*priv->cli.buffer, priv->virtbase + I2C_= TFR); > > + else > > + writeb(*priv->cli.buffer, priv->virtbase + I2C_= TFR); > > Are the other byte accessors working flawlessly? I get the shivers. > If it's needed in one place I bet the others prefer 32bit access too. I see where your shivers come from; I'll investigate as I don't remember my conclusion from the time when I worked on this driver (a few months ago). > Further the MIPS is big-endian is it not? It feels that this just happens > to work because of byte order access? writel() is little-endian by > definition. Actually, no. Our platform is little-endian. The full story, summarised: the endianness of our cores in kernel and hypervisor mode is defined by a pin read at reset. User mode can toggle the endianness at runtime I believe, but that is not of our concern. Our endianness in kernel mode is little-endian because the pin in question is hardwired to the value meaning little-endian. > What happens if you replace all writeb():s with something like > > static void nmk_write_reg(struct nmk_i2c_dev *priv, u32 reg, u8 val) > { > if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN)) > writeb(val, priv->virtbase + reg + 3); > // if this doesn't work then use writeb((u32)val, > priv->virtbase + reg) I guess > else > writeb(val, priv->virtbase + reg); > } > > and conversely for readb()? As mentionned above, big endian isn't the worry for us. I'll be checking the readb() calls found in i2c_irq_handler() though. Thanks, -- Th=C3=A9o Lebrun, Bootlin Embedded Linux and Kernel engineering https://bootlin.com