summaryrefslogtreecommitdiffstats
path: root/drivers/eeprom
Commit message (Collapse)AuthorAgeFilesLines
* 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>