From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 442A1202C48 for ; Sun, 16 Aug 2026 17:01:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786899678; cv=none; b=ZXxmoZoCex01NyWzsXb+B2he/CQnS6Qqx83D/5atgfncFe82PGCkiC6Md0+QY6hwpLhqtA/8y9mD1Dtv1K0PQb/huuUbJ5EtppUFDEjp05G4DjDdPDc88AK9Swmd+ChajrRiyfatE3JqUldXdRN+qwcJBywxUo6IH2gwVRpxG6Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786899678; c=relaxed/simple; bh=t/faCkX6zNUj6uDocKsoA8Xw78tuvC2b/0uJCwDeMDg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=KfcccEv7zWJE4gumd/+iOL7ep2mpJcDnaALfVHhqWz+xwJ/SvveHlbQxGkSkuKRhcIbm6RtTRFjMRri65+wjIb/PAAcHdZ5Pxh84ndsJWwXLoL/YiwX2bU/fv73LCXgvECjmh8zMR96Ee6IxeirF0SW1QyDn73Yq0aVCQslrPvM= 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=lXgzgJii; arc=none smtp.client-ip=209.85.214.182 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="lXgzgJii" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2cace91f112so29325665ad.0 for ; Sun, 16 Aug 2026 10:01:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786899677; x=1787504477; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=YWxpd5Q6UjfdNyoiy9yJ7GYjxxl6+mNhx7E9nYtgtxo=; b=lXgzgJiixIEmwTwdKBnw94tmyq3Ge+Twvg1uWDoHs+rgezXM8uDejdoIogRS0YSfH+ 8feB99APCH1GGHtC1+tQ2+U7mZTGAWKXqgC+YmNVpPWOsFNvsatYBJz77F4XW9G0UVYw G8g6YxwqqnWpubD4H0aNc5uNYbA+luUy9ndY0qv/dytl1QjW72XdiGvg93ZKA+ACffYw ZxievtXyTzFDrJYIz5kwvreX/xa7QYC9POLz811LxUtPiv1EnEPm03IQlK45CH17lMMD 8tXP+3Tp0a46LaOyDRKKFVh0ThExmherecvq58+khNatqrSoMu99Qjrs4pQPIBv6bVk+ ufVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786899677; x=1787504477; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=YWxpd5Q6UjfdNyoiy9yJ7GYjxxl6+mNhx7E9nYtgtxo=; b=piQlZUKMHuYc5ZTQPMHWNOvOOpgfPwEAMPl63zF6519vn3DHbzVRPceI/lzwClfOw8 PIqY69cIVaQZ7dPIkGz/TqCPGAHFVhMAy1skO7axi5nncxInYWMJ3jmb/AyNx47He4PY X1S8hgCaZfDyZ711q0uH1dCYG3Qy9tDmu9gWheW4nQarhtDqRXCgROGku8ZD89hClHGl G4gsnlVTjl8ltT2gaFJ8Z/pzfQV9BPfba5NsoSGW65EMyO4QKL+nYL4fq3vBFWTQmQE7 Giu6nPe3tcGI0xjiuka5YamWHhynU8r0DZk7y+OE9vbDJaqXGjz270SMOTbEn/jDU1Fc BKFA== X-Forwarded-Encrypted: i=1; AHgh+RpgpX5Nxpmw40Yn147AxC+sUUzKazufwD5sP3mvUmEE0mrUfVaMsvpZIhoNrU4R+thCR6npajlvaaGm7NY=@vger.kernel.org X-Gm-Message-State: AOJu0YxUZsVGQHziFIUIxU8aAizfq/Vk0J6scjc+dYySJASl4jZVXMy9 aonSR/okSooj6y9BQLey2CEC8APksbDoi6A3FLATfuKp40JlXAZalm9JXkmVXWhC X-Gm-Gg: AR+sD12qbfPI8p6/Z7Lzjlhl5cXFWrH+vp7A11xlb3lyey/H1lCf5j1SgW8N4rcuyws KCpuKEUsm+DO5OeWsGLdBGHHWvX/pZ2ate3SKkZ66GBZeKBnbh/KNAX80iQyAwRQnKVEpaBt1ei +KiVFrOdL7XQ7B4/hNsDTfeSUXp4+fA66/GQhvqfwi4Jr4yt4KUrDeC0I3txlC7TAY5Uvw5T0zh LLoZZP0S5m2LuyySnc3/S1xnp/ovwJzXZqtjwOlEM60iljXMC2YcY+aGKC4tsskccWs0OItnIiN x6uXUfhMrv3Fhqy/C6ZiVpkKnTv1i7kM4Rv5bC/PF4dXXh/SXUL0UwIz/LYJl5vLUdkRKBIIExc V+RvqxrSrZBJ3Vr/qA/wVp9PlT1onj+ryAYId6CxtHGedVCX8yyACn8c0ahHRRSPdiB8+vO17jX Ri4CXwF/Lx8HpJ/p1T3r4HTRorHgmltMBzm7Bpy7yO+gywHuLdVN532/SITzfShCGikvmIpuSUq 5g/eN6tpCQoRoj9sFBx X-Received: by 2002:a17:903:3d05:b0:2c9:aae1:a611 with SMTP id d9443c01a7336-2d3b0fc1d57mr241491965ad.23.1786899676468; Sun, 16 Aug 2026 10:01:16 -0700 (PDT) Received: from localhost ([123.110.162.152]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2d3aeb2b07csm26037385ad.51.2026.08.16.10.01.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Aug 2026 10:01:15 -0700 (PDT) From: Huasin Liao To: asmadeus@codewreck.org Cc: miquel.raynal@bootlin.com, vigneshr@ti.com, richard@nod.at, tudor.ambarus@linaro.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, huasin.liao@airoha.com Subject: Re: [PATCH] mtd: spinand: winbond: add support for W25N04LV Date: Mon, 17 Aug 2026 00:56:14 +0800 Message-Id: <20260816165614.16262-1-huasinliao@gmail.com> X-Mailer: git-send-email 2.39.3 (Apple Git-146) In-Reply-To: References: 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=UTF-8 Content-Transfer-Encoding: 8bit Dominique Martinet wrote on Sun, Aug 16, 2026 at 20:19:02 +0900: > Huasin Liao wrote on Sun, Aug 16, 2026 at 05:31:24PM +0800: >> diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c >> index 9b78c1e6cbc9..892220a12b22 100644 >> --- a/drivers/mtd/nand/spi/winbond.c >> +++ b/drivers/mtd/nand/spi/winbond.c >> @@ -345,6 +345,35 @@ static const struct mtd_ooblayout_ops w25n02kv_ooblayout = { >> .free = w25n02kv_ooblayout_free, >> }; >> >> +static int w25n04lv_ooblayout_ecc(struct mtd_info *mtd, int section, >> + struct mtd_oob_region *region) >> +{ >> + if (section > 7) >> + return -ERANGE; >> + >> + region->offset = 128 + (16 * section); >> + region->length = 13; >> + >> + return 0; >> +} >> + >> +static int w25n04lv_ooblayout_free(struct mtd_info *mtd, int section, >> + struct mtd_oob_region *region) >> +{ >> + if (section > 7) >> + return -ERANGE; >> + >> + region->offset = (16 * section) + 2; >> + region->length = 14; >> + >> + return 0; >> +} >> + >> +static const struct mtd_ooblayout_ops w25n04lv_ooblayout = { >> + .ecc = w25n04lv_ooblayout_ecc, >> + .free = w25n04lv_ooblayout_free, > > FWIW, these two are the same as what I consolidated in > https://lore.kernel.org/r/20260814-w25n04lw-v3-1-c6a7423ac7d0@atmark-techno.com > using oobsize, so we probably want to reuse that here too Thanks for the pointer, and good to see Miquel is fine with reusing w25n02kv_ooblayout. Once your patch lands, I'll rebase on top of it and switch from w25n04lv_ooblayout to w25n02kv_ooblayout — is that in line with what you'd expect? Huasin Liao