summaryrefslogtreecommitdiffstats
path: root/drivers/eeprom/at24.c
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>
* 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: 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>
* eeprom: at24: Enable OF partition parsingSascha Hauer2013-11-081-0/+2
| | | | 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>
* eeprom: add at24 supportJean-Christophe PLAGNIOL-VILLARD2012-11-151-0/+460
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>