Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1176915rdb; Mon, 19 Feb 2024 06:46:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU8XVu5ocXRqbAYqtJrKqq/9Tnu+SjAXtFCBc6d5ANJlltqN2mtOqYgymsCfaNW3k4fq12+G6/HS1GSq5bXFv1OZ92dSfMQmMnABy5ipw== X-Google-Smtp-Source: AGHT+IHvD3exez7Wr/idruWoSq6/IDT86WldzSBm9LGjXeb9RNRGgp7PeCDBAfIgoxTrCldXR8uW X-Received: by 2002:a17:906:bc86:b0:a3e:389b:caa3 with SMTP id lv6-20020a170906bc8600b00a3e389bcaa3mr4746539ejb.53.1708353993749; Mon, 19 Feb 2024 06:46:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708353993; cv=pass; d=google.com; s=arc-20160816; b=VxU5brlQq5LmRn4ltbINN/Y48COn8N4ETh1k7mQjfWhPGQ/B2XlTvzEBvBPrU8A5Om 2pkTT82xG+YyGBXwY8K3yVntLwmahqGbUnS8qV8blNYzwcp8TzSaCl/ikyIJMU5ILjkz 9NZ7rw4lmosJKgVd/qh1hC5tlSr192yK1GeeYramsatzp4k5BiqALsQWlavHdDxOm6gG EW8xs0IiIlP3SGA6iFZ8FK+7c2XxmR52kvHpabELD5OA074h0FW6NV+ceTjfCl2tabU4 yJKTwSm9biU3K0irO8Ri+Yb/EtmO9loOZdKD7x8mHInBkFU7FtiHS4om6CMWvvZjhyLH cFqQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=CEbqbxunOK1j7HlndGF87g5ivfAom1/PXvbiALIF138=; fh=pw4Q+2XICZ2w5cqpoRRQJtL5dgBHYA0uaMB9zjdt25Q=; b=maKty+uv/Kmyud8zwaZsf7yX9tEA5PC1CkS6L5sSlvdj5FwjZ/XZr9lkt2nVW6gNrS LgNEanDif0P/pRC2Bd4cX5ijQFC9L07Tw2HkcvwkR3N24dPYznNZqj8bwZ/mazwjbKyz N6I9dkTqPIdRTjNYGUmjSOGDVdGzvkWbZFZJJ+2V/JaSejBmwshZ3p7Ujx6FAvTjxy7s cs1zL3OOqhBQGvBdIBqFD6NBxyzYRArhTRHTSvfHaAdmpqb9afCA2mhJ6Al2LyBnf1CM GLJU2jbb98tiI3rgjH1S7O5jFGhfSo6Xz5QE/4qToX5wIDdgKjDbWUQw3iHQLJtpvWdf EkrA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GGh6izYw; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-71487-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71487-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id md9-20020a170906ae8900b00a3ed20f7ddcsi286097ejb.782.2024.02.19.06.46.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 06:46:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71487-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GGh6izYw; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-71487-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71487-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 DED661F21A44 for ; Mon, 19 Feb 2024 14:36:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B2B8F1E890; Mon, 19 Feb 2024 14:35:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="GGh6izYw" Received: from mail-yw1-f180.google.com (mail-yw1-f180.google.com [209.85.128.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 29032383A3 for ; Mon, 19 Feb 2024 14:35:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708353354; cv=none; b=OqCGkGxzRwJpuLlPTCvElwAl9Csk4kCTlF+f2ddl5HDIzrwewSHhffvthqalIxDfYxmzsnXK8OL+AIwR86vZrLdky+9YOI4JtsQheHXWEFJWNh1YYYMLsQc8Z6eAajqpkk5/Yrm9MTaxKyx0KeAXP1WYSCWDuHYrtlelbMwbWYY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708353354; c=relaxed/simple; bh=1RkS6CvafEx+T4LVSMCS6FBn6mLD7Rqrzm5hwLpeVkY=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=RgLJLbaX/zlRr+Tv4kou7LeU1UPXXz4pDzoc8x8+AMp47ZYvnW9AvhyMa7bK/v+yCN1uT7n1F2gzW4uOjvyKvIH1tAB9h0Z/uiytv0BFaKqYpiUysvNQvJjUs0T8J6eiNF7Y2SByvzgK8JTFdpQU/Rsw9GDVM8QHFQyDVjneaPo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=GGh6izYw; arc=none smtp.client-ip=209.85.128.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-607cd210962so36422527b3.2 for ; Mon, 19 Feb 2024 06:35:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1708353352; x=1708958152; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=CEbqbxunOK1j7HlndGF87g5ivfAom1/PXvbiALIF138=; b=GGh6izYwiyn0/JNsol6uc7v2uVUZgYTerVNlzw0aG7duOty0wRLsDcc18MHQOw1AxD vjSUKeO4kPeDphY/IPJcxXjnou8vF3YhZ3jtociqWxoChE1xJQY96tneVdbMPIM8icsN qVEudVi90OCVL+IOK1y/PFW7D7frJeoz1bISvLkpuAhyr5jjoj3KkobJ+ozfH47sq8XI VCAaDyB4YXRu2TJBX4uA7z1ZxQlpDtQPPSLyDkKo3eZD/oLGPdruWkFhMhw9tynSHIJM 1e2hjpq5ajN42q8E8xENxA7t+kzZmeOaMEWthnG70ptklQE7NBehuHKpEG0JN4aNYAT3 SwAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708353352; x=1708958152; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CEbqbxunOK1j7HlndGF87g5ivfAom1/PXvbiALIF138=; b=OZM3+4FmnyvYILRZ58pf0k2QKAKevmdYTdkEgmTQDh8eQZWZseVrRZQceccYpHhn6v zxGExw+1TVDMnNA6V7bB/MBCIRS7uNmCf0qOQakuAY5Q0DK1un1DdWPV55Xu0XYoS5Qv mlpTtoMN1Tx6P2wQ9/tK2mOYRvQcbLGTJ2PiYFZtXsRf1MW6rLc9wB3K2RlYmWzpUmCv Wv8J0r45YyiIY6mzsAY1knMea5fXJRyEZ92r/87CAELM4ecGh9ahqQkBLGzfNJ1Fv43W Gy2aG2EuKNHtW4hO97mYM9LuqjvFAdtqagGCwQJLCyYepgFuu4IX4yrHJ5+eEx9EJPYh DsRg== X-Forwarded-Encrypted: i=1; AJvYcCUvC1DhPDG0oZL9FqpkIEOXmP0K5H86OICHknz9G3bC69ExRCqke96GqSo+nPR/R3tMzfd3QAKkvrJw5829CilEj0dduty/OLkIrHk/ X-Gm-Message-State: AOJu0YzenhxbCLlfoy7UzNikJ1aG06K6mtEfWHbFHX7Wjm4rfXkm8p3G cx639hpO5mi/g9fRDcImj8gy0xf5yskZ2fX5sNILGHQIjL+ikp45LMdQ8gnrbV9L2oNr39ZZJbe W7zidXnxUzzP3SPEJwKcK38AyQv10i7H2d0miAw== X-Received: by 2002:a81:4885:0:b0:608:1cf8:bfb2 with SMTP id v127-20020a814885000000b006081cf8bfb2mr5252664ywa.1.1708353352208; Mon, 19 Feb 2024 06:35:52 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240215-mbly-i2c-v1-0-19a336e91dca@bootlin.com> <20240215-mbly-i2c-v1-10-19a336e91dca@bootlin.com> In-Reply-To: <20240215-mbly-i2c-v1-10-19a336e91dca@bootlin.com> From: Linus Walleij Date: Mon, 19 Feb 2024 15:35:41 +0100 Message-ID: Subject: Re: [PATCH 10/13] i2c: nomadik: support Mobileye EyeQ5 I2C controller To: =?UTF-8?B?VGjDqW8gTGVicnVu?= Cc: Andi Shyti , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 to > 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_TF= R); > + else > + writeb(*priv->cli.buffer, priv->virtbase + I2C_TF= R); 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. 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. 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()? Other accessors such as iowrite* are perhaps viable in this case, I'm not s= ure. Yours, Linus Walleij