From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (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 50A703D904E for ; Tue, 5 May 2026 20:06:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778011616; cv=none; b=XsEYqDFHlhQZXLc6w+Aa245jhrMT1YDAgpZkjaeKCvjACCs5qZg//4Sp8nmAFrqk/9Zo8EK0teaOIv+wkuGZ76/SGiyFLMXu5Wt89j1j6Gymwov3HdpURDBuo6ZSlHBMkDu7OElqioEHlqx87qwAVdNJQUdu9cXVFLbPP2Q8XA8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778011616; c=relaxed/simple; bh=yxQQFbPDX0UTtERpG0VWGDpOZ1IZ+Hpgmk0WiA0iRi8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=nybelQ5UJZZUzdUuGE6UXYOZ2eKDlNnP99Crv50NVEiDbJis8BlE2nVeSJtTnfVQcLmvoznMr21RlLKwcERorDEGDxqlZujNKk7t+XhKS130r6lABnGddoZk7nPnWpVfiYHcWoCXe6WoM0NgfO+lJH6VYvrFmyWz5K/w/Ip5q9A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OKIITUVf; arc=none smtp.client-ip=209.85.221.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OKIITUVf" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-44ce78ab5feso2766275f8f.0 for ; Tue, 05 May 2026 13:06:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778011614; x=1778616414; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=U69pDkFx0w5rkGimfNd3UP42FE6wKyks8vJvY493nVM=; b=OKIITUVfuGpumt1b6vraWTOw4OafPe3gjzI3eJAmtt+6a3qfQOd62AOxj4HeG2s0g6 lNitogTXq3It4vdekGSUasfcRCGSJePT+cISWaJZcleW30mJ8RamGmacv2P7JQdw3enA miGhoBO6WhBlYg5Xfhpcje/jWvNPoeYr9oXttK71cEa3ey/F89CNRKJeY9XxJGDcDacj l2OVHsIvUEpdQxmRA5ZTrkekcad0NalNJEoxqaNPVBIbN4Stlo2cdCMilTNeUaYmbYX4 yBd6HROh1mLrqH4fqSSFxGGEnmNk64DVkRckzCcz0YODoqjRIBWIpdxXRkH60Zfyq2yQ KmUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778011614; x=1778616414; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=U69pDkFx0w5rkGimfNd3UP42FE6wKyks8vJvY493nVM=; b=OCXLd4YD70hp6+Gbes9MK4RwoRpwvWHtJDO4SQeIy5/12ON5+FauGUzKr1EeMtJNgi TT4/ZjtV5pGow1votwsuoHJOyc4kk1OVVWud5ojeBDzmRwvdTQU8dWXYHDSlS1BFHUeC QapYMT3lIWVD2EkXA8mL/dZf2Vp5RrlWCSdijc8zhSrndsSBNgTk06aD5JCJ8UR6vYBb E51p2eccZs2Q5x6wze11G36bsTTC6JXNphH1ZX6wQVQw3xpFYNw6eN78eBetpacM+asi PV8b7FO5FQnciv2WJtqqv0QN+kgzNf99mXS3ajCg8PlIeTRfycwyOnejyNiEnEZfIU+S uoYg== X-Forwarded-Encrypted: i=1; AFNElJ/fZtSF9TGE9IQetTnjHLJ0LUpHx6XTggMsK0e6sGlXo10cHjTwvjKasbcNbyGTiKgvcFy/kf3Kcm91z10=@vger.kernel.org X-Gm-Message-State: AOJu0YwSCcWXygLFLLdJ9zGqjHs2naXHaOemXemXv3zI1yCPc+dyMrDg cpTeuePySFwqF9Ictk2bOWLAi00hBESODm13P6xSgZfndcaZTU42qUKZ X-Gm-Gg: AeBDiev6exuw+9tdIjhfeoHq90ph11wtQotVHreHsHlyfSS0jwA8FoKldNAbJGwcN/c xE/9bJPGVFESyPxhERpnzsigc1EUPfugKQs+dJf7QyCJJsIWyCZR9mM5nf4s8Zk8WKcDmnHYnhH q/YCt/dL8/csdp7zvZxstFKsiInWWHDxYghOT0V8Bql3P+3SZMAAzgc6TW04HeOameq/T6lShb9 Ro2C/8i1Jh78CyUuk8ESxKDaG6tziT955ixcED5hYA2IoVn+o0/C1cksM8PmwYFmEasmwyGhbCY OphrY1KwZl/wag6JcxifFMacR34Rebv/Cf1/qCp2cyMvhuKL4eFqbXRdFhE0KMh6vPrpP1RiSMS c9dRyDhWsufyXmTC+2xamoNIGncEvLsoFynkVrygKTU4BKF35DNZkosStBB28/5tW+vihTMqpaD o2n2lJ1EdJt/VM/oTQxWz8VsSiKi7oHC0M9fYpMF+Jre2MkGw= X-Received: by 2002:a05:6000:144c:b0:43c:4810:dc4a with SMTP id ffacd0b85a97d-4515da9619bmr861987f8f.38.1778011613478; Tue, 05 May 2026 13:06:53 -0700 (PDT) Received: from builder ([2001:9e8:f130:ed16:be24:11ff:fe30:5d85]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45055f2203csm7049511f8f.37.2026.05.05.13.06.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 May 2026 13:06:52 -0700 (PDT) From: Jonas Jelonek To: Russell King , Andrew Lunn , Heiner Kallweit , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Chevallier Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?Bj=C3=B8rn=20Mork?= , Jonas Jelonek Subject: [PATCH net-next v6 0/2] net: sfp: extend SMBus support Date: Tue, 5 May 2026 20:06:45 +0000 Message-ID: <20260505200647.1125311-1-jelonek.jonas@gmail.com> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Today, the SFP driver only drives I2C adapters that advertise full I2C_FUNC_I2C, or SMBus-only adapters via single-byte transfers (with hwmon disabled). Several SoCs ship I2C/SMBus-only controllers that support more than just byte access -- e.g. word and I2C block -- and have SFP cages wired to them. Today, those adapters either work poorly or not at all. This series teaches the SFP driver to use the larger SMBus access modes when the adapter advertises them, and along the way starts honoring i2c_adapter quirks on read/write length so adapters that cap below the SFP block size are handled correctly. Patch 1 is a small prep doing only the quirks handling; patch 2 extends the SMBus path itself. Capability matrix supported by patch 2: - BYTE only: single-byte access (unchanged). - BYTE + WORD: word for >=2-byte chunks, byte tail. - I2C_BLOCK present: block as the universal transport. - WORD only (no BYTE/BLOCK): accepted with WARN_ONCE; works for even-length transfers, odd-length transfers will error at xfer time. Adapters with asymmetric R/W capabilities (e.g. only READ_I2C_BLOCK without WRITE_I2C_BLOCK) remain functionally correct but use the worse-supported direction's max for both directions, since i2c_max_block_size is a single field. No mainline I2C driver was seen advertising such asymmetry; per-direction sizes can be added later if needed. --- v5 -> v6: - Split adapter-quirks handling into a separate prep patch (1/2). - Use I2C_SMBUS_I2C_BLOCK_DATA in the block-write branch (was I2C_SMBUS_WORD_DATA), so block writes actually transfer this_len bytes (also flagged by Jakub's AI bot review). - In sfp_smbus_read/write, check i2c_smbus_xfer() return before copying smbus_data into the caller's buffer. - Use I2C_BLOCK as the universal transport when available (carries any length 1..32); drop the this_len > 2 guard on the block branches. - Broaden the SMBus gate to also accept BLOCK-only adapters (Russell). - Accept word-only adapters with WARN_ONCE rather than rejecting them (Andrew). - Add a short comment in sfp_i2c_configure() explaining the access hierarchy (Maxime). - Use the all-bits-set form via i2c_check_functionality() for the composite I2C_FUNC_SMBUS_* checks (Russell). v5: https://lore.kernel.org/netdev/20260116113105.244592-1-jelonek.jonas@gmail.com/ v4 -> v5: - made a more general approach, also covering word access v4: https://lore.kernel.org/netdev/20260109101321.2804-1-jelonek.jonas@gmail.com/ v3 -> v4: - fix formal issues v3: https://lore.kernel.org/netdev/20260105161242.578487-1-jelonek.jonas@gmail.com/ v2 -> v3: - fix previous attempt of v2 to fix return value v2: https://lore.kernel.org/netdev/20260105154653.575397-1-jelonek.jonas@gmail.com/ v1 -> v2: - return number of written bytes instead of zero v1: https://lore.kernel.org/netdev/20251228213331.472887-1-jelonek.jonas@gmail.com/ --- Jonas Jelonek (2): net: sfp: apply I2C adapter quirks to limit block size net: sfp: extend SMBus support drivers/net/phy/sfp.c | 144 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 116 insertions(+), 28 deletions(-) base-commit: 8c699be3dad7bba87cdda485dc099226cfc2f706 -- 2.51.0