aboutsummaryrefslogtreecommitdiff
path: root/drivers/misc/eeprom/at25.c
AgeCommit message (Collapse)AuthorFilesLines
2020-09-17eeprom: at25: set type id as EEPROMVadym Kochan1-0/+1
Set type as NVMEM_TYPE_EEPROM to expose this info via sysfs: $ cat /sys/bus/nvmem/devices/{DEVICE}/type EEPROM Signed-off-by: Vadym Kochan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2020-08-31Merge 5.9-rc3 into char-misc-nextGreg Kroah-Hartman1-5/+5
We need the fixes in here as well. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2020-08-28eeprom: at25: set minimum read/write access stride to 1Christian Eggers1-1/+1
SPI eeproms are addressed by byte. Signed-off-by: Christian Eggers <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2020-08-28eeprom: at25: allow page sizes greater than 16 bitChristian Eggers1-1/+1
Storage technologies like FRAM have no "write pages", the whole chip can be written within one SPI transfer. For these chips, the page size can be set equal to the device size. Currently available devices are already bigger than 64 kiB. Signed-off-by: Christian Eggers <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2020-08-23treewide: Use fallthrough pseudo-keywordGustavo A. R. Silva1-5/+5
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case. [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through Signed-off-by: Gustavo A. R. Silva <[email protected]>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152Thomas Gleixner1-5/+1
Based on 1 normalized pattern(s): 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 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 3029 file(s). Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Allison Randal <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-10-15eeprom: at25: remove unneeded 'at25_remove'YueHaibing1-10/+0
Fixes gcc '-Wunused-but-set-variable' warning: drivers/misc/eeprom/at25.c: In function 'at25_remove': drivers/misc/eeprom/at25.c:384:20: warning: variable 'at25' set but not used [-Wunused-but-set-variable] Since commit 96d08fb43e30 ("eeprom: at25: use devm_nvmem_register()"), at25_remove is do nothing, so can be removed. Signed-off-by: YueHaibing <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-09-28eeprom: at25: use devm_nvmem_register()Bartosz Golaszewski1-2/+1
Use the resource managed variant of nvmem_register(). Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Srinivas Kandagatla <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-07-07eeprom: at25: mark expected switch fall-throughsGustavo A. R. Silva1-0/+4
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-03-23eeprom: at25: sizeof t should be sizeof(t)Devang Panchal1-1/+1
Resolved checkpatch warning "sizeof t should be sizeof(t)" issue found by checkpatch. Signed-off-by: Devang Panchal <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-12-18eeprom: at25: Add DT support for EEPROMs with odd address bitsGeert Uytterhoeven1-0/+3
Certain EEPROMS have a size that is larger than the number of address bytes would allow, and store the MSB of the address in bit 3 of the instruction byte. This can be described in platform data using EE_INSTR_BIT3_IS_ADDR, or in DT using the obsolete legacy "at25,addr-mode" property. But currently there exists no non-deprecated way to describe this in DT. Hence extend the existing "address-width" DT property to allow specifying 9 address bits, and enable support for that in the driver. This has been tested with a Microchip 25LC040A. Signed-off-by: Geert Uytterhoeven <[email protected]> Reviewed-by: Rob Herring <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-09-27at25: fix debug and error messagingAndy Shevchenko1-13/+7
The patch does the following: - fixes specifiers and removes explicit casting of the parameters - joins literals to one line - increases readability of the parameters Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-05-01eeprom: at25: Fix SPI device leakMark Brown1-1/+1
The at25 driver is using spi_dev_get() apparently just to take a copy of the SPI device used to instantiate it but never calls spi_dev_put() to free it. Since the device is guaranteed to exist between probe() and remove() there should be no need for the driver to take an extra reference to it so fix the leak by just using a straight assignment. Signed-off-by: Mark Brown <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-05-01eeprom: at25: remove nvmem regmap dependencySrinivas Kandagatla1-70/+19
This patch moves to nvmem support in the driver to use callback instead of regmap. Signed-off-by: Srinivas Kandagatla <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-03-01eeprom: at25: extend driver to plug into the NVMEM frameworkAndrew Lunn1-55/+69
Add a regmap for accessing the EEPROM, and then use that with the NVMEM framework. Enable backwards compatibility in the NVMEM config, so that the 'eeprom' file in sys is provided by the framework. Signed-off-by: Andrew Lunn <[email protected]> Acked-by: Srinivas Kandagatla <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-03-01eeprom: at25: Remove in kernel API for accessing the EEPROMAndrew Lunn1-26/+0
The setup() callback is not used by any in kernel code. Remove it. Any new code which requires access to the eeprom can use the NVMEM API. Signed-off-by: Andrew Lunn <[email protected]> Acked-by: Srinivas Kandagatla <[email protected]> Acked-by: Wolfram Sang <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2016-02-07misc: eeprom: use kobj_to_dev()Geliang Tang1-2/+2
Use kobj_to_dev() instead of open-coding it. Signed-off-by: Geliang Tang <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2015-10-28spi: Drop owner assignment from spi_driversAndrew F. Davis1-1/+0
An spi_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Andrew F. Davis <[email protected]> Acked-by: Jonathan Cameron <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2014-11-04misc: at25: Make use of device property APIMika Westerberg1-21/+13
Make use of device property API in this driver so that both DT and ACPI based systems can use this driver. In addition we hard-code the name of the chip to be "at25" for the reason that there is no common mechanism to fetch name of the firmware node. The only existing user (arch/arm/boot/dts/phy3250.dts) uses the same name so it should continue to work. Signed-off-by: Mika Westerberg <[email protected]> Acked-by: Grant Likely <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
2014-02-07drivers/misc: delete non-required instances of include <linux/init.h>Paul Gortmaker1-1/+0
None of these files are actually using any __init type directives and hence don't need to include <linux/init.h>. Most are just a left over from __devinit and __cpuinit removal, or simply due to code getting copied from one driver to the next. Cc: Arnd Bergmann <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Signed-off-by: Paul Gortmaker <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-10-16misc/at25, dt: support probing at25 SPI EEPROM from DTJan Luebbe1-0/+7
The commit d6ae0d578d24303941c1424b049d2cae28277666 introduced devicetree binding documentation for this driver, but the driver itself does not yet support the documented compatible entry. Fix this by adding the documented entry to the driver. Signed-off-by: Jan Luebbe <[email protected]> Signed-off-by: Markus Pargmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-05-30drivers/misc: at25: convert to use devm_kzallocNikolay Balandin1-17/+8
Use devm_kzalloc to make cleanup paths simpler Signed-off-by: Nikolay Balandin <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Reviewed-by: Jingoo Han <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2013-04-05misc: at25: use spi_get_drvdata() and spi_set_drvdata()Jingoo Han1-2/+2
Use the wrapper functions for getting and setting the driver data using spi_device instead of using dev_{get|set}_drvdata with &spi->dev, so we can directly pass a struct spi_device. Signed-off-by: Jingoo Han <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2012-11-21misc: remove use of __devexitBill Pemberton1-1/+1
CONFIG_HOTPLUG is going away as an option so __devexit is no longer needed. Signed-off-by: Bill Pemberton <[email protected]> Cc: "Michał Mirosław" <[email protected]> Cc: Wolfram Sang <[email protected]> Cc: Eric Piel <[email protected]> Cc: Jiri Slaby <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2012-11-21drivers/misc: remove use of __devexit_pBill Pemberton1-1/+1
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer needed. Signed-off-by: Bill Pemberton <[email protected]> Cc: "Michał Mirosław" <[email protected]> Cc: Wolfram Sang <[email protected]> Cc: Eric Piel <[email protected]> Cc: Jiri Slaby <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2012-09-05misc/at25, dt: Improve at25 SPI eeprom device tree bindings.David Daney1-25/+58
Commit 002176db (misc: at25: Parse dt settings) added device tree bindings the differ significantly in style from the I2C EEPROM bindings and don't seem well vetted. Here I deprecate (but still support) the "at25,*" properties, and add what I hope is a better alternative. These new bindings also happen to be deployed in the field and were previously submitted for consideration here: https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-May/015556.html The advantages of the new bindings are that they are similar to the I2C EEPROMs and they don't conflate read-only and the address width modes in a binary encoded blob. Signed-off-by: David Daney <[email protected]> Cc: Alexandre Pereira da Silva <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Michael Hennerich <[email protected]> Cc: Axel Lin <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2012-06-14misc: at25: Parse dt settingsAlexandre Pereira da Silva1-16/+45
This adds dt support to the at25 eeprom driver. Signed-off-by: Alexandre Pereira da Silva <[email protected]> Tested-by: Roland Stigge <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2012-04-18Support M95040 SPI EEPROMIvo Sieben1-3/+16
Updated the generic SPI EEPROM driver AT25 for support of an additional address bit in the instruction byte. Certain EEPROMS have a size that is larger than the number of address bytes would allow (e.g. like M95040 from ST that has 512 Byte size but uses only one address byte (A0 to A7) for addressing.) For the extra address bit (A8, A16 or A24) bit 3 of the instruction byte is used. This instruction bit is normally defined as don't care for other AT25 like chips. Reviewed-by: Wolfram Sang <[email protected]> Signed-off-by: Ivo Sieben <[email protected]> Acked-by: Chris Wright <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2012-01-24MISC: convert drivers/misc/* to use module_spi_driver()Axel Lin1-11/+1
This patch converts the drivers in drivers/misc/* to use the module_spi_driver() macro which makes the code smaller and a bit simpler. Signed-off-by: Axel Lin <[email protected]> Cc: Michael Hennerich <[email protected]> Cc: Anatolij Gustschin <[email protected]> Cc: Daniel Mack <[email protected]> Acked-by: Michael Hennerich <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-05-21sysfs: add struct file* to bin_attr callbacksChris Wright1-2/+4
This allows bin_attr->read,write,mmap callbacks to check file specific data (such as inode owner) as part of any privilege validation. Signed-off-by: Chris Wright <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2010-03-14init dynamic bin_attribute structuresWolfram Sang1-0/+1
Commit 6992f5334995af474c2b58d010d08bc597f0f2fe ("sysfs: Use one lockdep class per sysfs attribute.") introduced this requirement. First, at25 was fixed manually. Then, other occurences were found with coccinelle and the following semantic patch. Results were reviewed and fixed up: @ init @ identifier struct_name, bin; @@ struct struct_name { ... struct bin_attribute bin; ... }; @ main extends init @ expression E; statement S; identifier name, err; @@ ( struct struct_name *name; | - struct struct_name *name = NULL; + struct struct_name *name; ) ... ( sysfs_bin_attr_init(&name->bin); | + sysfs_bin_attr_init(&name->bin); if (sysfs_create_bin_file(E, &name->bin)) S | + sysfs_bin_attr_init(&name->bin); err = sysfs_create_bin_file(E, &name->bin); ) Signed-off-by: Wolfram Sang <[email protected]> Cc: Eric W. Biederman <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2009-09-23spi: prefix modalias with "spi:"Anton Vorontsov1-1/+1
This makes it consistent with other buses (platform, i2c, vio, ...). I'm not sure why we use the prefixes, but there must be a reason. This was easy enough to do it, and I did it. Signed-off-by: Anton Vorontsov <[email protected]> Cc: David Brownell <[email protected]> Cc: David Woodhouse <[email protected]> Cc: Grant Likely <[email protected]> Cc: Jean Delvare <[email protected]> Cc: Ben Dooks <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Dmitry Torokhov <[email protected]> Cc: Samuel Ortiz <[email protected]> Cc: "John W. Linville" <[email protected]> Acked-by: Mike Frysinger <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2009-07-29eeprom/at25: bugfix "not ready" timeout after writeSebastian Heutling1-2/+2
Under certain circumstances msleep(1) within the loop, which waits for the EEPROM to be finished, might take longer than the timeout. On the next loop the status register might now return to be ready and therefore the loop finishes. The following check now tests if a timeout occurred and if so returns an error although the device reported it was ready. This fix replaces testing the occurrence of the timeout by testing the "not ready" bit in the status register. Signed-off-by: Sebastian Heutling <[email protected]> Signed-off-by: David Brownell <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2009-04-13at25: make input buffers of at25_*write() constGeert Uytterhoeven1-2/+3
| drivers/misc/eeprom/at25.c:358: warning: assignment from incompatible pointer type Signed-off-by: Geert Uytterhoeven <[email protected]> Cc: Kevin Hilman <[email protected]> Cc: David Brownell <[email protected]> Cc: Jean Delvare <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2009-04-02memory_accessor: implement the new memory_accessor interfaces for SPI EEPROMsDavid Brownell1-14/+44
- Define new setup() hook to export the accessor - Implement accessor methods Moves some error checking out of the sysfs interface code into the layer below it, which is now shared by both sysfs and memory access code. Signed-off-by: David Brownell <[email protected]> Signed-off-by: Kevin Hilman <[email protected]> Cc: Jean Delvare <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
2009-01-26spi: Move at25 (for SPI eeproms) to /drivers/misc/eepromWolfram Sang1-0/+389
Signed-off-by: Wolfram Sang <[email protected]> Signed-off-by: Jean Delvare <[email protected]>