From nobody Sat May 10 02:42:03 2025 Delivered-To: importer2@patchew.org Received-SPF: pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; envelope-from=linux-kernel-owner@vger.kernel.org; helo=vger.kernel.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail(p=quarantine dis=quarantine) header.from=ti.com ARC-Seal: i=1; a=rsa-sha256; t=1609844432; cv=none; d=zohomail.com; s=zohoarc; b=P5RmcUyRP90fFwclxL6MEkadmXM8KEaX4aEXRM83IsJRO9p4NspdSZx01ju1mUcsN3PsP9RaUdudOshDgGMgMQYF/bfqRB5B8cI8paEreXbZeQXXXyLaCy5CtUcbLWmsjxQuyG/hKL+K+T0cbwRmsXB3bid/oqwghrEnkIFK4yY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609844432; h=Content-Type:Cc:Date:From:In-Reply-To:List-Id:MIME-Version:Message-ID:References:Subject:To; bh=yK8Pv0bZeIziewv1Y1FPS7K/gywEI5+sW2FlNM7zRpk=; b=WDrP8jcwD7SwP55V//dyUMJlugv6vYTviHEL6ew7VtDwbC+KKzdYwtBCHGkTHJNmD5tMAvUgPxIdoisHhnC4U1ZIZTQ4CAx+c+NLJAKHW0PXHEsipHXl7LNaIROydvm53xRmKLoZU0mLgTHdViOZwDHIRqWqpJAxgxnQo1JmkY4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mx.zohomail.com with SMTP id 1609844431967794.986903826102; Tue, 5 Jan 2021 03:00:31 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729336AbhAELAU (ORCPT ); Tue, 5 Jan 2021 06:00:20 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:53086 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729070AbhAELAU (ORCPT ); Tue, 5 Jan 2021 06:00:20 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 105Awc0Y106808; Tue, 5 Jan 2021 04:58:38 -0600 Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 105AwcIP102815 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 5 Jan 2021 04:58:38 -0600 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Tue, 5 Jan 2021 04:58:38 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Tue, 5 Jan 2021 04:58:38 -0600 Received: from gsaswath-HP-ProBook-640-G5.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 105AwK9A056260; Tue, 5 Jan 2021 04:58:32 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1609844318; bh=yK8Pv0bZeIziewv1Y1FPS7K/gywEI5+sW2FlNM7zRpk=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=aqHrOjwHlG7bQuS7toKGJ1or6eSY45dEZ3HP9CpL6F1QTGvpgdGWdY/yj4stRun1q dwAamQMB1PC1BHPvWXRIYZs4VGZG210sGemGU4h3g/6C8Ay2RIURDKpHqmGRtS3FCT ZDsBYxLbzhq621mgUEBGiSKxl8PZCu82X4e8sqkk= From: Aswath Govindraju CC: Vignesh Raghavendra , Sekhar Nori , Kishon Vijay Abraham I , Pratyush Yadav , Aswath Govindraju , Rob Herring , Arnd Bergmann , Greg Kroah-Hartman , Vadym Kochan , , Subject: [PATCH v2 1/2] Documentation: devicetree: Add new compatible string for eeprom microchip 93LC46B Date: Tue, 5 Jan 2021 16:28:11 +0530 Message-ID: <20210105105817.17644-2-a-govindraju@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210105105817.17644-1-a-govindraju@ti.com> References: <20210105105817.17644-1-a-govindraju@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add a new compatible string for eeprom microchip 93LC46B in eeprom-93xx46 dt-binding file as it belongs to the 93xx46 family of devices. Signed-off-by: Aswath Govindraju --- Documentation/devicetree/bindings/misc/eeprom-93xx46.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/misc/eeprom-93xx46.txt b/Doc= umentation/devicetree/bindings/misc/eeprom-93xx46.txt index a8ebb4621f79..7b636b7a8311 100644 --- a/Documentation/devicetree/bindings/misc/eeprom-93xx46.txt +++ b/Documentation/devicetree/bindings/misc/eeprom-93xx46.txt @@ -4,6 +4,7 @@ Required properties: - compatible : shall be one of: "atmel,at93c46d" "eeprom-93xx46" + "microchip,93lc46b" - data-size : number of data bits per word (either 8 or 16) =20 Optional properties: --=20 2.17.1 From nobody Sat May 10 02:42:03 2025 Delivered-To: importer2@patchew.org Received-SPF: pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; envelope-from=linux-kernel-owner@vger.kernel.org; helo=vger.kernel.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail(p=quarantine dis=quarantine) header.from=ti.com ARC-Seal: i=1; a=rsa-sha256; t=1609844481; cv=none; d=zohomail.com; s=zohoarc; b=cw6b/6DsXb81phM30G8bvZVe+Jg3nfi4a2kOOnJgfe/VyeqZ4JtMOWbQV5gkqO9hTilHMy6YvE0uaL96T5ji5apD5jwLiah+DLi+8Y0ytpHW8rsKOLTOyNKhXMRy9hwx6HbW2qU0oN5GF8qNoRpr/EmCf3G5fn4iygnTeWQQ5ME= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609844481; h=Content-Type:Cc:Date:From:In-Reply-To:List-Id:MIME-Version:Message-ID:References:Subject:To; bh=AytViMSSM5J0cU6Cfi4k0xvLSDRJDzCcGCKwmlG9ANM=; b=CnW6JNoM3D8Kktlcxx7iUkQ1Wn1ADMMu74m5vGvz36rxZP47wBvtlhuNxROAomuqndn4awVxZkg50hAC+Z2IGrjF58sQoDJuwgXK49qlRPePNlHudinWlFQXRr04VP1jdKZNTLSvyYriY5XbxHNOJmQTcDgcYkwSXzZ3uQbtSqo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mx.zohomail.com with SMTP id 1609844481902958.0100189161582; Tue, 5 Jan 2021 03:01:21 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729379AbhAELAe (ORCPT ); Tue, 5 Jan 2021 06:00:34 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:45594 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728507AbhAELAd (ORCPT ); Tue, 5 Jan 2021 06:00:33 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 105AwofM058823; Tue, 5 Jan 2021 04:58:50 -0600 Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 105Awo7w103055 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 5 Jan 2021 04:58:50 -0600 Received: from DLEE104.ent.ti.com (157.170.170.34) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Tue, 5 Jan 2021 04:58:50 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Tue, 5 Jan 2021 04:58:50 -0600 Received: from gsaswath-HP-ProBook-640-G5.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 105AwK9B056260; Tue, 5 Jan 2021 04:58:44 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1609844330; bh=AytViMSSM5J0cU6Cfi4k0xvLSDRJDzCcGCKwmlG9ANM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=Q1m5n4XkoR+TslLpY5CETwl0nLz4sdY5QUGzHUARjX5ZgXBj5Er9LTQeMA2prVMN6 OnI6KQyn99VlH8ridDR/zEa1K50Qmz5LqLar6GDv2YqTPCXeR7kqw1gtENQDuKXJGQ 2S+4Rl5vOKnXKDm9J6ekTuqd6kdrgC4z+JlmK9lU= From: Aswath Govindraju CC: Vignesh Raghavendra , Sekhar Nori , Kishon Vijay Abraham I , Pratyush Yadav , Aswath Govindraju , Rob Herring , Arnd Bergmann , Greg Kroah-Hartman , Vadym Kochan , , Subject: [PATCH v2 2/2] misc: eeprom_93xx46: Add quirk to support Microchip 93LC46B eeprom Date: Tue, 5 Jan 2021 16:28:12 +0530 Message-ID: <20210105105817.17644-3-a-govindraju@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210105105817.17644-1-a-govindraju@ti.com> References: <20210105105817.17644-1-a-govindraju@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" A dummy zero bit is sent preceding the data during a read transfer by the Microchip 93LC46B eeprom (section 2.7 of[1]). This results in right shift of data during a read. In order to ignore this bit a quirk can be added to send an extra zero bit after the read address. Add a quirk to ignore the zero bit sent before data by adding a zero bit after the read address. [1] - https://www.mouser.com/datasheet/2/268/20001749K-277859.pdf Signed-off-by: Aswath Govindraju --- drivers/misc/eeprom/eeprom_93xx46.c | 15 +++++++++++++++ include/linux/eeprom_93xx46.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/drivers/misc/eeprom/eeprom_93xx46.c b/drivers/misc/eeprom/eepr= om_93xx46.c index 7c45f82b4302..a18247696ce7 100644 --- a/drivers/misc/eeprom/eeprom_93xx46.c +++ b/drivers/misc/eeprom/eeprom_93xx46.c @@ -35,6 +35,10 @@ static const struct eeprom_93xx46_devtype_data atmel_at9= 3c46d_data =3D { EEPROM_93XX46_QUIRK_INSTRUCTION_LENGTH, }; =20 +static const struct eeprom_93xx46_devtype_data microchip_93lc46b_data =3D { + .quirks =3D EEPROM_93XX46_QUIRK_EXTRA_READ_CYCLE, +}; + struct eeprom_93xx46_dev { struct spi_device *spi; struct eeprom_93xx46_platform_data *pdata; @@ -55,6 +59,11 @@ static inline bool has_quirk_instruction_length(struct e= eprom_93xx46_dev *edev) return edev->pdata->quirks & EEPROM_93XX46_QUIRK_INSTRUCTION_LENGTH; } =20 +static inline bool has_quirk_extra_read_cycle(struct eeprom_93xx46_dev *ed= ev) +{ + return edev->pdata->quirks & EEPROM_93XX46_QUIRK_EXTRA_READ_CYCLE; +} + static int eeprom_93xx46_read(void *priv, unsigned int off, void *val, size_t count) { @@ -96,6 +105,11 @@ static int eeprom_93xx46_read(void *priv, unsigned int = off, dev_dbg(&edev->spi->dev, "read cmd 0x%x, %d Hz\n", cmd_addr, edev->spi->max_speed_hz); =20 + if (has_quirk_extra_read_cycle(edev)) { + cmd_addr <<=3D 1; + bits +=3D 1; + } + spi_message_init(&m); =20 t[0].tx_buf =3D (char *)&cmd_addr; @@ -363,6 +377,7 @@ static void select_deassert(void *context) static const struct of_device_id eeprom_93xx46_of_table[] =3D { { .compatible =3D "eeprom-93xx46", }, { .compatible =3D "atmel,at93c46d", .data =3D &atmel_at93c46d_data, }, + { .compatible =3D "microchip,93lc46b", .data =3D µchip_93lc46b_data,= }, {} }; MODULE_DEVICE_TABLE(of, eeprom_93xx46_of_table); diff --git a/include/linux/eeprom_93xx46.h b/include/linux/eeprom_93xx46.h index eec7928ff8fe..99580c22f91a 100644 --- a/include/linux/eeprom_93xx46.h +++ b/include/linux/eeprom_93xx46.h @@ -16,6 +16,8 @@ struct eeprom_93xx46_platform_data { #define EEPROM_93XX46_QUIRK_SINGLE_WORD_READ (1 << 0) /* Instructions such as EWEN are (addrlen + 2) in length. */ #define EEPROM_93XX46_QUIRK_INSTRUCTION_LENGTH (1 << 1) +/* Add extra cycle after address during a read */ +#define EEPROM_93XX46_QUIRK_EXTRA_READ_CYCLE BIT(2) =20 /* * optional hooks to control additional logic --=20 2.17.1