diff options
Diffstat (limited to 'drivers/eeprom/at24.c')
-rw-r--r-- | drivers/eeprom/at24.c | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/drivers/eeprom/at24.c b/drivers/eeprom/at24.c index 1d35088c6b..23cb0e1fbb 100644 --- a/drivers/eeprom/at24.c +++ b/drivers/eeprom/at24.c @@ -1,13 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* * at24.c - handle most I2C EEPROMs * * Copyright (C) 2005-2007 David Brownell * Copyright (C) 2008 Wolfram Sang, Pengutronix - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. */ #include <common.h> @@ -103,6 +99,8 @@ static struct platform_device_id at24_ids[] = { /* old variants can't be handled with this generic entry! */ { "24c01", AT24_DEVICE_MAGIC(1024 / 8, 0) }, { "24c02", AT24_DEVICE_MAGIC(2048 / 8, 0) }, + { "24mac402", AT24_DEVICE_MAGIC(2048 / 8, AT24_FLAG_READONLY) }, + { "24mac602", AT24_DEVICE_MAGIC(2048 / 8, AT24_FLAG_READONLY) }, /* spd is a 24c02 in memory DIMMs */ { "spd", AT24_DEVICE_MAGIC(2048 / 8, AT24_FLAG_READONLY | AT24_FLAG_IRUGO) }, @@ -365,12 +363,7 @@ static int at24_nvmem_write(void *ctx, unsigned off, const void *buf, size_t cou return at24_write(ctx, buf, off, count); } -static const struct nvmem_bus at24_nvmem_bus = { - .write = at24_nvmem_write, - .read = at24_nvmem_read, -}; - -static int at24_probe(struct device_d *dev) +static int at24_probe(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct at24_platform_data chip; @@ -394,8 +387,8 @@ static int at24_probe(struct device_d *dev) chip.byte_len = BIT(magic & AT24_BITMASK(AT24_SIZE_BYTELEN)); magic >>= AT24_SIZE_BYTELEN; chip.flags = magic & AT24_BITMASK(AT24_SIZE_FLAGS); - if (dev->device_node && - !of_property_read_u32(dev->device_node, "pagesize", &page_size)) + if (dev->of_node && + !of_property_read_u32(dev->of_node, "pagesize", &page_size)) chip.page_size = page_size; else { /* @@ -431,7 +424,7 @@ static int at24_probe(struct device_d *dev) at24->chip = chip; at24->num_addresses = num_addresses; - alias = of_alias_get(dev->device_node); + alias = of_alias_get(dev->of_node); if (alias) { devname = xstrdup(alias); } else { @@ -445,7 +438,7 @@ static int at24_probe(struct device_d *dev) writable = !(chip.flags & AT24_FLAG_READONLY); - if (of_get_property(dev->device_node, "read-only", NULL)) + if (of_get_property(dev->of_node, "read-only", NULL)) writable = 0; if (writable) { @@ -460,10 +453,10 @@ static int at24_probe(struct device_d *dev) } at24->wp_gpio = -1; - if (dev->device_node) { + if (dev->of_node) { enum of_gpio_flags flags; - at24->wp_gpio = of_get_named_gpio_flags(dev->device_node, - "wp-gpios", 0, &flags); + at24->wp_gpio = of_get_named_gpio_flags(dev->of_node, + "wp-gpios", 0, &flags); if (gpio_is_valid(at24->wp_gpio)) { at24->wp_active_low = flags & OF_GPIO_ACTIVE_LOW; gpio_request(at24->wp_gpio, "eeprom-wp"); @@ -491,7 +484,8 @@ static int at24_probe(struct device_d *dev) at24->nvmem_config.dev = dev; at24->nvmem_config.priv = at24; at24->nvmem_config.read_only = !writable; - at24->nvmem_config.bus = &at24_nvmem_bus; + at24->nvmem_config.reg_write = at24_nvmem_write; + at24->nvmem_config.reg_read = at24_nvmem_read; at24->nvmem_config.stride = 1; at24->nvmem_config.word_size = 1; at24->nvmem_config.size = chip.byte_len; @@ -519,7 +513,7 @@ err_out: } -static struct driver_d at24_driver = { +static struct driver at24_driver = { .name = "at24", .probe = at24_probe, .id_table = at24_ids, |