* [PATCH 0/2] eeprom: eeprom_93xx46: Add support for microchip 93LC46B eeprom
@ 2020-12-18 14:08 Aswath Govindraju
2020-12-18 14:08 ` [PATCH 1/2] Documentation: devicetree: Add new compatible string for eeprom microchip 93LC46B Aswath Govindraju
2020-12-18 14:08 ` [PATCH 2/2] misc: eeprom_93xx46: Add quirk to support Microchip 93LC46B eeprom Aswath Govindraju
0 siblings, 2 replies; 5+ messages in thread
From: Aswath Govindraju @ 2020-12-18 14:08 UTC (permalink / raw)
Cc: Vignesh Raghavendra, Sekhar Nori, Kishon Vijay Abraham I,
Pratyush Yadav, Aswath Govindraju, Rob Herring, Arnd Bergmann,
Greg Kroah-Hartman, Vadym Kochan, devicetree, linux-kernel
This series of patches adds support for microchip 93LC46B eeprom by
- Adding a new compatible string
- Adding a quirk to send extra bit after the address to ignore the
zero bit sent before data, during a read transfer.
Aswath Govindraju (2):
Documentation: devicetree: Add new compatible string for eeprom
microchip 93LC46B
misc: eeprom_93xx46: Add quirk to support Microchip 93LC46B eeprom
.../devicetree/bindings/misc/eeprom-93xx46.txt | 1 +
drivers/misc/eeprom/eeprom_93xx46.c | 15 +++++++++++++++
include/linux/eeprom_93xx46.h | 2 ++
3 files changed, 18 insertions(+)
--
2.17.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] Documentation: devicetree: Add new compatible string for eeprom microchip 93LC46B
2020-12-18 14:08 [PATCH 0/2] eeprom: eeprom_93xx46: Add support for microchip 93LC46B eeprom Aswath Govindraju
@ 2020-12-18 14:08 ` Aswath Govindraju
2020-12-31 19:17 ` Rob Herring
2020-12-18 14:08 ` [PATCH 2/2] misc: eeprom_93xx46: Add quirk to support Microchip 93LC46B eeprom Aswath Govindraju
1 sibling, 1 reply; 5+ messages in thread
From: Aswath Govindraju @ 2020-12-18 14:08 UTC (permalink / raw)
Cc: Vignesh Raghavendra, Sekhar Nori, Kishon Vijay Abraham I,
Pratyush Yadav, Aswath Govindraju, Rob Herring, Arnd Bergmann,
Greg Kroah-Hartman, Vadym Kochan, devicetree, linux-kernel
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 <a-govindraju@ti.com>
---
Documentation/devicetree/bindings/misc/eeprom-93xx46.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/misc/eeprom-93xx46.txt b/Documentation/devicetree/bindings/misc/eeprom-93xx46.txt
index a8ebb4621f79..9f272361f117 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)
Optional properties:
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] misc: eeprom_93xx46: Add quirk to support Microchip 93LC46B eeprom
2020-12-18 14:08 [PATCH 0/2] eeprom: eeprom_93xx46: Add support for microchip 93LC46B eeprom Aswath Govindraju
2020-12-18 14:08 ` [PATCH 1/2] Documentation: devicetree: Add new compatible string for eeprom microchip 93LC46B Aswath Govindraju
@ 2020-12-18 14:08 ` Aswath Govindraju
1 sibling, 0 replies; 5+ messages in thread
From: Aswath Govindraju @ 2020-12-18 14:08 UTC (permalink / raw)
Cc: Vignesh Raghavendra, Sekhar Nori, Kishon Vijay Abraham I,
Pratyush Yadav, Aswath Govindraju, Rob Herring, Arnd Bergmann,
Greg Kroah-Hartman, Vadym Kochan, devicetree, linux-kernel
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 <a-govindraju@ti.com>
---
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/eeprom_93xx46.c
index 7c45f82b4302..b144e7981f36 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_at93c46d_data = {
EEPROM_93XX46_QUIRK_INSTRUCTION_LENGTH,
};
+static const struct eeprom_93xx46_devtype_data microchip_93LC46B_data = {
+ .quirks = 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 eeprom_93xx46_dev *edev)
return edev->pdata->quirks & EEPROM_93XX46_QUIRK_INSTRUCTION_LENGTH;
}
+static inline bool has_quirk_extra_read_cycle(struct eeprom_93xx46_dev *edev)
+{
+ 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);
+ if (has_quirk_extra_read_cycle(edev)) {
+ cmd_addr <<= 1;
+ bits += 1;
+ }
+
spi_message_init(&m);
t[0].tx_buf = (char *)&cmd_addr;
@@ -363,6 +377,7 @@ static void select_deassert(void *context)
static const struct of_device_id eeprom_93xx46_of_table[] = {
{ .compatible = "eeprom-93xx46", },
{ .compatible = "atmel,at93c46d", .data = &atmel_at93c46d_data, },
+ { .compatible = "microchip,93LC46B", .data = µ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)
/*
* optional hooks to control additional logic
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] Documentation: devicetree: Add new compatible string for eeprom microchip 93LC46B
2020-12-18 14:08 ` [PATCH 1/2] Documentation: devicetree: Add new compatible string for eeprom microchip 93LC46B Aswath Govindraju
@ 2020-12-31 19:17 ` Rob Herring
2021-01-05 6:53 ` Aswath Govindraju
0 siblings, 1 reply; 5+ messages in thread
From: Rob Herring @ 2020-12-31 19:17 UTC (permalink / raw)
To: Aswath Govindraju
Cc: Vignesh Raghavendra, Sekhar Nori, Kishon Vijay Abraham I,
Pratyush Yadav, Arnd Bergmann, Greg Kroah-Hartman, Vadym Kochan,
devicetree, linux-kernel
On Fri, Dec 18, 2020 at 07:38:10PM +0530, Aswath Govindraju wrote:
> 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 <a-govindraju@ti.com>
> ---
> Documentation/devicetree/bindings/misc/eeprom-93xx46.txt | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/Documentation/devicetree/bindings/misc/eeprom-93xx46.txt b/Documentation/devicetree/bindings/misc/eeprom-93xx46.txt
> index a8ebb4621f79..9f272361f117 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"
Generally, we use lowercase and that's the existing pattern here.
> - data-size : number of data bits per word (either 8 or 16)
>
> Optional properties:
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] Documentation: devicetree: Add new compatible string for eeprom microchip 93LC46B
2020-12-31 19:17 ` Rob Herring
@ 2021-01-05 6:53 ` Aswath Govindraju
0 siblings, 0 replies; 5+ messages in thread
From: Aswath Govindraju @ 2021-01-05 6:53 UTC (permalink / raw)
To: Rob Herring
Cc: Vignesh Raghavendra, Sekhar Nori, Kishon Vijay Abraham I,
Pratyush Yadav, Arnd Bergmann, Greg Kroah-Hartman, Vadym Kochan,
devicetree, linux-kernel
Hi Rob,
On 01/01/21 12:47 am, Rob Herring wrote:
> On Fri, Dec 18, 2020 at 07:38:10PM +0530, Aswath Govindraju wrote:
>> 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 <a-govindraju@ti.com>
>> ---
>> Documentation/devicetree/bindings/misc/eeprom-93xx46.txt | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/Documentation/devicetree/bindings/misc/eeprom-93xx46.txt b/Documentation/devicetree/bindings/misc/eeprom-93xx46.txt
>> index a8ebb4621f79..9f272361f117 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"
>
> Generally, we use lowercase and that's the existing pattern here.
ohh ok. I was trying to match the compatible string exactly with the the
device name. I will make this change in the respin.
Thanks,
Aswath
>
>> - data-size : number of data bits per word (either 8 or 16)
>>
>> Optional properties:
>> --
>> 2.17.1
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-01-05 6:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-18 14:08 [PATCH 0/2] eeprom: eeprom_93xx46: Add support for microchip 93LC46B eeprom Aswath Govindraju
2020-12-18 14:08 ` [PATCH 1/2] Documentation: devicetree: Add new compatible string for eeprom microchip 93LC46B Aswath Govindraju
2020-12-31 19:17 ` Rob Herring
2021-01-05 6:53 ` Aswath Govindraju
2020-12-18 14:08 ` [PATCH 2/2] misc: eeprom_93xx46: Add quirk to support Microchip 93LC46B eeprom Aswath Govindraju
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).