Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3880101pxj; Tue, 11 May 2021 14:09:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzThcDVnu+qGwfPBC/d6PjEJ6oDoN6XQ1YH3SG+ZLdrg63a1EwPVLltcTUr1YmLcYhxglaI X-Received: by 2002:a17:906:f1d4:: with SMTP id gx20mr33446390ejb.108.1620767357775; Tue, 11 May 2021 14:09:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620767357; cv=none; d=google.com; s=arc-20160816; b=Vs2xvyKYrfzAuz1AxBrz+rxMK0ta0dd54/U4ep7ByZLk/yZBgHaMzjKc388aYE5YqU fUVEWzJzqjKLwC79qWZRyDLK25mdoyRFxfznJ9IHUMqHaM4amOhfd1GQ5ZxoYCo5tGRg kYwxeFH7nqfNXYkYfURdbo3lBKsl0lgyTEcyTOPmdFHHeF9v+G8j+v39Gb+9iVVM+8Og tDfte2957x/qdtJ8py7nmiebWzpfWHo5pVbdmNmLgCc9oyr1Rap1sVwalSCKEoUOYYYK LQPbvFGMBLnU8qkG0UUDzV3mA9vJCWLeiEbE4ypEmA7ajj+oGChKDLSDJHPeOSOjnCRh P6OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=1ef02PWSF48Sz/FNHvGEO8OEGPAAsLFajeo0+FhcSuU=; b=EwT96ROXGeTJLzjEa7LYv5z2RCWBfGLaPfe9zFKNvd/jHrAF1Ujw1rDFkaQqP8XHLA zzhNmzdDEqpbSExBnFxOssmLXDBLzs4DGLXrzt2CUsTw322xP7nLuPQEnKEOubSyWavc I2x/WK9PM7sHa8/Z2owzAAI4dRbtIEtve89cRDCvoBrgNIBIwtC00bLBdBK+qGq58Jaj nsvO9tJ9u6OTBP26LNYoVcrLepe45PKAaxfKIc+cpNSdCacHWSXIjigeN2CLXULpWhb9 78vTpUOQ6Q00Lafu4m6VFhl5M7gqTNqaL4LYHLJdq2ksEymj9ifKcIvD6ZGn6UhhH7Mu DB8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a3si13917276ejd.575.2021.05.11.14.08.53; Tue, 11 May 2021 14:09:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230035AbhEKVIw (ORCPT + 99 others); Tue, 11 May 2021 17:08:52 -0400 Received: from 82-65-109-163.subs.proxad.net ([82.65.109.163]:38246 "EHLO luna.linkmauve.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229736AbhEKVIp (ORCPT ); Tue, 11 May 2021 17:08:45 -0400 Received: by luna.linkmauve.fr (Postfix, from userid 1000) id 64FD0F4063B; Tue, 11 May 2021 23:07:33 +0200 (CEST) From: Emmanuel Gil Peyrot To: Arnd Bergmann , =?UTF-8?q?Jonathan=20Neusch=C3=A4fer?= , linux-kernel@vger.kernel.org Cc: Emmanuel Gil Peyrot , =?UTF-8?q?Jonathan=20Neusch=C3=A4fer?= , Rob Herring , Greg Kroah-Hartman , Aswath Govindraju , Vadym Kochan , devicetree@vger.kernel.org Subject: [PATCH v3 2/3] misc: eeprom_93xx46: Add new 93c56 and 93c66 compatible strings Date: Tue, 11 May 2021 23:07:25 +0200 Message-Id: <20210511210727.24895-3-linkmauve@linkmauve.fr> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210511210727.24895-1-linkmauve@linkmauve.fr> References: <20210424212543.13929-1-linkmauve@linkmauve.fr> <20210511210727.24895-1-linkmauve@linkmauve.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These two devices have respectively 2048 and 4096 bits of storage, compared to 1024 for the 93c46. Signed-off-by: Emmanuel Gil Peyrot Reviewed-by: Jonathan Neuschäfer --- drivers/misc/eeprom/eeprom_93xx46.c | 35 ++++++++++++++++++++++++++--- include/linux/eeprom_93xx46.h | 3 +++ 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/drivers/misc/eeprom/eeprom_93xx46.c b/drivers/misc/eeprom/eeprom_93xx46.c index ffdb8e5a26e0..29d8971ec558 100644 --- a/drivers/misc/eeprom/eeprom_93xx46.c +++ b/drivers/misc/eeprom/eeprom_93xx46.c @@ -29,14 +29,29 @@ struct eeprom_93xx46_devtype_data { unsigned int quirks; + unsigned char flags; +}; + +static const struct eeprom_93xx46_devtype_data at93c46_data = { + .flags = EE_SIZE1K, +}; + +static const struct eeprom_93xx46_devtype_data at93c56_data = { + .flags = EE_SIZE2K, +}; + +static const struct eeprom_93xx46_devtype_data at93c66_data = { + .flags = EE_SIZE4K, }; static const struct eeprom_93xx46_devtype_data atmel_at93c46d_data = { + .flags = EE_SIZE1K, .quirks = EEPROM_93XX46_QUIRK_SINGLE_WORD_READ | EEPROM_93XX46_QUIRK_INSTRUCTION_LENGTH, }; static const struct eeprom_93xx46_devtype_data microchip_93lc46b_data = { + .flags = EE_SIZE1K, .quirks = EEPROM_93XX46_QUIRK_EXTRA_READ_CYCLE, }; @@ -381,8 +396,11 @@ static void select_deassert(void *context) } static const struct of_device_id eeprom_93xx46_of_table[] = { - { .compatible = "eeprom-93xx46", }, + { .compatible = "eeprom-93xx46", .data = &at93c46_data, }, + { .compatible = "atmel,at93c46", .data = &at93c46_data, }, { .compatible = "atmel,at93c46d", .data = &atmel_at93c46d_data, }, + { .compatible = "atmel,at93c56", .data = &at93c56_data, }, + { .compatible = "atmel,at93c66", .data = &at93c66_data, }, { .compatible = "microchip,93lc46b", .data = µchip_93lc46b_data, }, {} }; @@ -432,6 +450,7 @@ static int eeprom_93xx46_probe_dt(struct spi_device *spi) const struct eeprom_93xx46_devtype_data *data = of_id->data; pd->quirks = data->quirks; + pd->flags |= data->flags; } spi->dev.platform_data = pd; @@ -461,7 +480,16 @@ static int eeprom_93xx46_probe(struct spi_device *spi) if (!edev) return -ENOMEM; - edev->size = 128; + if (pd->flags & EE_SIZE1K) + edev->size = 128; + else if (pd->flags & EE_SIZE2K) + edev->size = 256; + else if (pd->flags & EE_SIZE4K) + edev->size = 512; + else { + dev_err(&spi->dev, "unspecified size\n"); + return -EINVAL; + } if (pd->flags & EE_ADDR8) edev->addrlen = ilog2(edev->size); @@ -496,8 +524,9 @@ static int eeprom_93xx46_probe(struct spi_device *spi) if (IS_ERR(edev->nvmem)) return PTR_ERR(edev->nvmem); - dev_info(&spi->dev, "%d-bit eeprom %s\n", + dev_info(&spi->dev, "%d-bit eeprom containing %d bytes %s\n", (pd->flags & EE_ADDR8) ? 8 : 16, + edev->size, (pd->flags & EE_READONLY) ? "(readonly)" : ""); if (!(pd->flags & EE_READONLY)) { diff --git a/include/linux/eeprom_93xx46.h b/include/linux/eeprom_93xx46.h index 99580c22f91a..34c2175e6a1e 100644 --- a/include/linux/eeprom_93xx46.h +++ b/include/linux/eeprom_93xx46.h @@ -10,6 +10,9 @@ struct eeprom_93xx46_platform_data { #define EE_ADDR8 0x01 /* 8 bit addr. cfg */ #define EE_ADDR16 0x02 /* 16 bit addr. cfg */ #define EE_READONLY 0x08 /* forbid writing */ +#define EE_SIZE1K 0x10 /* 1 kb of data, that is a 93xx46 */ +#define EE_SIZE2K 0x20 /* 2 kb of data, that is a 93xx56 */ +#define EE_SIZE4K 0x40 /* 4 kb of data, that is a 93xx66 */ unsigned int quirks; /* Single word read transfers only; no sequential read. */ -- 2.31.1