summaryrefslogtreecommitdiffstats
path: root/drivers/eeprom
Commit message (Collapse)AuthorAgeFilesLines
* eeprom: at24: Select NVMEM as a dependencyAndrey Smirnov2019-09-091-0/+1
| | | | | | | | NVMEM subsystem is now a mandatory dependecy for EEPROM_AT24. Fixes: 815e7140de ("eeprom: at24: Convert the driver to NVMEM") Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* eeprom: at24: Convert the driver to NVMEMAndrey Smirnov2019-08-141-21/+27
| | | | | | | | | | Convert AT24 driver to use NVMEM subsystem instead of explicitly creating a dedicated cdev. This way it becomes possible to access the contenst of EEPROM via NVMEM API, which could be usefull for things like MAC-addresses and such. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* eeprom: at24: Drop at24_cdev_protect()Andrey Smirnov2019-08-141-20/+17
| | | | | | | | | | Instead of exposing a dedictaed .protect() callback, mimic the behaviour of corresponding driver in Linux and adjust the value of WP pin in .write() callback as necessary. This is done in order to convert this driver to NVMEM subsytem. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* devfs: Drop dev_lseek_default()Andrey Smirnov2019-01-292-2/+0
| | | | | | | | | | | | | | | | | | | | | Only the following cdevs do not declare an .lseek() operation: - Console devices in common/console.c - Firmware framework in common/firmware.c - JTAG driver in drivers/misc/jtag.c - UBI in drivers/mtd/ubi/barebox.c Of those four, first two are marked DEVFS_IS_CHARACTER_DEV and implement only .write() operation and the last two don't implement anything but .ioctl(). While there's probably no meaningful way to use lseek() against any of those devices, there doesn't seem to be any harm in allowing it either. Change devfs_lseek() to ignore absense of .lseek() callback and drop dev_lseek_default() and all references to it in the codebase. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: introduce device_i2c_driver() macroMarco Felsch2018-10-191-8/+1
| | | | | | | | | Add macro and dependency to avoid boilerplate code. Since now simple i2c drivers only have to include the i2c.h header and call the device_i2c_driver() macro to register a i2c device driver. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rename file_operations -> cdev_operationsSascha Hauer2018-04-062-2/+2
| | | | | | | | Linux also has struct file_operations which are something different. Rename our file_operations to cdev_operations which better matches what we have. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* eeprom: at24: fix 'assignment from incompatible pointer type' warningAntony Pavlov2017-10-161-1/+1
| | | | | | | | | | | | | | The patch fixes this compiler's warning: CC drivers/eeprom/at24.o drivers/eeprom/at24.c: In function ‘at24_probe’: drivers/eeprom/at24.c:453:21: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types] at24->fops.protect = at24_cdev_protect, ^ Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* eeprom: at24: add the "read-only" dt parameter supportAntony Pavlov2017-04-281-0/+4
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: use of_property_read_bool where appropriateSascha Hauer2017-04-121-1/+1
| | | | | | Use of_property_read_bool where boolean properties are read. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: partition: Register the of partition fixup for of partition usersSascha Hauer2017-03-312-0/+3
| | | | | | | at24, at25 and mci core are using of_parse_partitions(). Register the fixup for them aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2016-07-111-6/+1
|\
| * eeprom: at24: Use xasprintf for small allocationSascha Hauer2016-07-051-6/+1
| | | | | | | | | | | | | | The code for error checking shouldn't be bigger than the allocated string. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | eeprom: at24: fix discarding const qualifierSascha Hauer2016-06-281-2/+5
|/ | | | | | | | fixes: at24.c:434:10: warning: assignment discards 'const' qualifier from pointer target type Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* eeprom: at24: make device name setup more robustUwe Kleine-König2016-05-311-1/+19
| | | | | | | | | | | | With two eeproms that have a different compatible string (in my case "at,24c64" and "at,24c32") dev->id is 0 for both which results in a failure to bind the device that is probed later. So pick a name more intelligently: If there is an alias defined in the device tree, use this one, otherwise pick a free index. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* eeprom: at24: check return value of devfs_create and fix error pathUwe Kleine-König2016-05-311-2/+9
| | | | | | | | | | | | if devfs_create failed because "eeprom0" already exists of_parse_partitions must not be called, otherwise the already existing eeprom gets assigned partitions that don't belog there. Also free dummy clients in the error path and the write protect gpio only if it is actually valid. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* eeprom: at25: check return value of devfs_createUwe Kleine-König2016-05-311-1/+4
| | | | | | | | Also only emit the message that the device was probed when it actually was. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* string: Fix (v)asprintf prototypesSascha Hauer2016-04-151-1/+1
| | | | | | | | | | Our asprintf and vasprintf have different prototypes than the glibc functions. This causes trouble when we want to share barebox code with userspace code. Change the prototypes for (v)asprintf to match the glibc prototypes. Since the current (v)asprintf are convenient to use change the existing functions to b(v)asprintf. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* eeprom/at25: parse partitions from device treeHarald Welte2016-02-181-0/+1
| | | | | | | | | | | | Unlike at24 (I2C), the at25 (spi) EEPROM driver doesn't check if the device tree node contains partition definitions. This means that one for example cannot have bootstate partitions on an at25 EEPROM, while it works on an at24 EEPROM. This patch adds device tree based partition support to the at25 driver. Signed-off-by: Harald Welte <laforge@gnumonks.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* eeprom: Support pagesize OF device tree propertyTrent Piepho2015-11-261-6/+12
| | | | | | | | Allows specifying the page size when the eeproms are in the device tree. Same as the Linux kernel device-tree bindings for at24. Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* eeprom: Add support for 24c1025 EEPROMTrent Piepho2015-11-261-2/+6
| | | | | | | | | | | | This is the Microchip version of the Atmel 24c1024, which is already supported. The key difference between them is that the I2C address bit used to select between the two banks is bit 2 for the 1025 and not bit 0 as in the 1024. Add a flag to describe this difference. Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* at24: support write-protect GPIOJan Luebbe2015-08-201-0/+38
| | | | | Signed-off-by: Jan Luebbe <jluebbe@debian.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* of: use 'const void *' for struct of_device_id.dataAntony Pavlov2015-04-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 2011 barebox' of_device_id struct uses unsigned long type for data field: struct of_device_id { char *compatible; unsigned long data; }; Almost always struct of_device_id.data field are used as pointer and need 'unsigned long' casting. E.g. see 'git grep -A 4 of_device_id drivers/' output: drivers/ata/sata-imx.c:static __maybe_unused struct of_device_id imx_sata_dt_ids[] = { drivers/ata/sata-imx.c- { drivers/ata/sata-imx.c- .compatible = "fsl,imx6q-ahci", drivers/ata/sata-imx.c- .data = (unsigned long)&data_imx6, drivers/ata/sata-imx.c- }, { Here is of_device_id struct in linux kernel v4.0: struct of_device_id { char name[32]; char type[32]; char compatible[128]; const void *data; }; Changing of_device_id.data type to 'const void *data' will increase barebox' linux kernel compatibility and decrease number of 'unsigned long' casts. Part of the patch was done using the 'coccinelle' tool with the following semantic patch: @rule1@ identifier dev; identifier type; identifier func; @@ func(...) { <... - dev_get_drvdata(dev, (unsigned long *)&type) + dev_get_drvdata(dev, (const void **)&type) ...> } @rule2@ identifier dev; identifier type; identifier func; identifier data; @@ func(...) { <... - dev_get_drvdata(dev, (unsigned long *)&type->data) + dev_get_drvdata(dev, (const void **)&type->data) ...> } Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* fix format specifiersSascha Hauer2014-06-051-2/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* eeprom: at25: Add dt probe supportSascha Hauer2014-05-151-12/+86
| | | | | | The parsing code has been taken directly from Linux 3.15-rc5. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* remove redundant NULL check on freeLucas Stach2014-02-101-2/+1
| | | | | | | | free() already checks the pointer to be non NULL. No need to do it again. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* eeprom: at24: Enable OF partition parsingSascha Hauer2013-11-081-0/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Introduce device_spi_driver() macro and use it for SPI driversAlexander Shiyan2013-03-141-8/+1
| | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* I2C: Rename i2c_register_driver() for using with register_driver_macro()Alexander Shiyan2013-03-141-1/+1
| | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* SPI: Rename spi_register_driver() for using with register_driver_macro()Alexander Shiyan2013-03-141-1/+1
| | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'kconfig'Sascha Hauer2012-12-081-3/+3
|\
| * Cleanup Kconfig filesAlexander Shiyan2012-12-081-3/+3
| | | | | | | | | | | | | | | | | | This patch provides a global cleanup barebox Kconfig files. This includes replacing spaces to tabs, formatting in accordance format, removing extraneous lines and spaces. No functional changes. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | at25: use dev_lseek_default as at24 doesAntony Pavlov2012-12-031-6/+1
|/ | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* eeprom: add at24 supportJean-Christophe PLAGNIOL-VILLARD2012-11-153-0/+480
| | | | | | | | | | | | | | | | | | | | | | This driver to get read/write support to most I2C EEPROMs, after you configure the driver to know about each EEPROM on your target board. Use these generic chip names, instead of vendor-specific ones like at24c64 or 24lc02: 24c00, 24c01, 24c02, spd (readonly 24c02), 24c04, 24c08, 24c16, 24c32, 24c64, 24c128, 24c256, 24c512, 24c1024 Unless you like data loss puzzles, always be sure that any chip you configure as a 24c32 (32 kbit) or larger is NOT really a 24c16 (16 kbit) or smaller, and vice versa. Marking the chip as read-only won't help recover from this. Also, if your chip has any software write-protect mechanism you may want to review the code to make sure this driver won't turn it on by accident. Based on linux 3.6 Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* SPI: Put SPI devices on their own busSascha Hauer2012-09-141-1/+1
| | | | | | | | | This patch adds a SPI bus on which the SPI devices and drivers register. This makes it cleaner as SPI devices won't accidently end up probed by a platform_device driver. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* use loff_t for file offsetsSascha Hauer2012-06-301-4/+4
| | | | | | | This is a first step for 64bit file support: Make the file sizes/offsets 64bit. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* eeprom: add at25 eeprom driverHubert Feurstein2011-06-213-0/+331
This commit adds support for most spi eeproms, such as the Atmel at25 models. Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>