aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-22 18:53:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-22 18:53:59 -0400
commitfb2123fad3b499f0898835b19dbb93b18d27ee98 (patch)
tree7273754cded304f52dbbef86d23dda96e0a8452a
parenta481991467d38afb43c3921d5b5b59ccb61b04ba (diff)
parent991214386dee8a3cd9adc743778f472ac8a12bbc (diff)
Merge tag 'char-misc-3.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull Char/Misc patches from Greg Kroah-Hartman: "Here are a few various char/misc tree patches for the 3.5-rc1 merge window. Nothing major here at all, just different driver updates and some parport dead code removal. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>" * tag 'char-misc-3.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: parport: remove unused dead code from lowlevel drivers xilinx_hwicap: reset XHI_MAX_RETRIES xilinx_hwicap: add support for virtex6 FPGAs Support M95040 SPI EEPROM misc: add support for bmp18x chips to the bmp085 driver misc: bmp085: add device tree properties misc: clean up bmp085 driver misc: do not mark exported functions __devexit misc: add missing __devexit_p() annotations pch_phub: delete duplicate definitions misc: Fix irq leak in max8997_muic_probe error path
-rw-r--r--Documentation/devicetree/bindings/misc/bmp085.txt20
-rw-r--r--Documentation/devicetree/bindings/vendor-prefixes.txt1
-rw-r--r--drivers/char/xilinx_hwicap/xilinx_hwicap.c30
-rw-r--r--drivers/char/xilinx_hwicap/xilinx_hwicap.h2
-rw-r--r--drivers/misc/Kconfig26
-rw-r--r--drivers/misc/Makefile2
-rw-r--r--drivers/misc/ad525x_dpot.c2
-rw-r--r--drivers/misc/bh1780gli.c2
-rw-r--r--drivers/misc/bmp085-i2c.c91
-rw-r--r--drivers/misc/bmp085-spi.c91
-rw-r--r--drivers/misc/bmp085.c356
-rw-r--r--drivers/misc/bmp085.h33
-rw-r--r--drivers/misc/eeprom/at25.c19
-rw-r--r--drivers/misc/max8997-muic.c6
-rw-r--r--drivers/misc/pch_phub.c4
-rw-r--r--drivers/misc/pti.c2
-rw-r--r--drivers/parport/parport_amiga.c36
-rw-r--r--drivers/parport/parport_atari.c9
-rw-r--r--drivers/parport/parport_mfc3.c35
-rw-r--r--drivers/parport/parport_pc.c276
-rw-r--r--drivers/parport/parport_sunbpp.c21
-rw-r--r--include/linux/spi/eeprom.h10
22 files changed, 503 insertions, 571 deletions
diff --git a/Documentation/devicetree/bindings/misc/bmp085.txt b/Documentation/devicetree/bindings/misc/bmp085.txt
new file mode 100644
index 000000000000..91dfda2e4e11
--- /dev/null
+++ b/Documentation/devicetree/bindings/misc/bmp085.txt
@@ -0,0 +1,20 @@
1BMP085/BMP18x digital pressure sensors
2
3Required properties:
4- compatible: bosch,bmp085
5
6Optional properties:
7- chip-id: configurable chip id for non-default chip revisions
8- temp-measurement-period: temperature measurement period (milliseconds)
9- default-oversampling: default oversampling value to be used at startup,
10 value range is 0-3 with rising sensitivity.
11
12Example:
13
14pressure@77 {
15 compatible = "bosch,bmp085";
16 reg = <0x77>;
17 chip-id = <10>;
18 temp-measurement-period = <100>;
19 default-oversampling = <2>;
20};
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 82ac057a24a9..107d8addf0e4 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -8,6 +8,7 @@ amcc Applied Micro Circuits Corporation (APM, formally AMCC)
8apm Applied Micro Circuits Corporation (APM) 8apm Applied Micro Circuits Corporation (APM)
9arm ARM Ltd. 9arm ARM Ltd.
10atmel Atmel Corporation 10atmel Atmel Corporation
11bosch Bosch Sensortec GmbH
11cavium Cavium, Inc. 12cavium Cavium, Inc.
12chrp Common Hardware Reference Platform 13chrp Common Hardware Reference Platform
13cortina Cortina Systems, Inc. 14cortina Cortina Systems, Inc.
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
index 31ba11ca75e1..2c5d15beea35 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c
@@ -167,6 +167,7 @@ static const struct config_registers v4_config_registers = {
167 .BOOTSTS = UNIMPLEMENTED, 167 .BOOTSTS = UNIMPLEMENTED,
168 .CTL_1 = UNIMPLEMENTED, 168 .CTL_1 = UNIMPLEMENTED,
169}; 169};
170
170static const struct config_registers v5_config_registers = { 171static const struct config_registers v5_config_registers = {
171 .CRC = 0, 172 .CRC = 0,
172 .FAR = 1, 173 .FAR = 1,
@@ -192,6 +193,31 @@ static const struct config_registers v5_config_registers = {
192 .CTL_1 = 19, 193 .CTL_1 = 19,
193}; 194};
194 195
196static const struct config_registers v6_config_registers = {
197 .CRC = 0,
198 .FAR = 1,
199 .FDRI = 2,
200 .FDRO = 3,
201 .CMD = 4,
202 .CTL = 5,
203 .MASK = 6,
204 .STAT = 7,
205 .LOUT = 8,
206 .COR = 9,
207 .MFWR = 10,
208 .FLR = UNIMPLEMENTED,
209 .KEY = UNIMPLEMENTED,
210 .CBC = 11,
211 .IDCODE = 12,
212 .AXSS = 13,
213 .C0R_1 = 14,
214 .CSOB = 15,
215 .WBSTAR = 16,
216 .TIMER = 17,
217 .BOOTSTS = 22,
218 .CTL_1 = 24,
219};
220
195/** 221/**
196 * hwicap_command_desync - Send a DESYNC command to the ICAP port. 222 * hwicap_command_desync - Send a DESYNC command to the ICAP port.
197 * @drvdata: a pointer to the drvdata. 223 * @drvdata: a pointer to the drvdata.
@@ -744,6 +770,8 @@ static int __devinit hwicap_of_probe(struct platform_device *op,
744 regs = &v4_config_registers; 770 regs = &v4_config_registers;
745 } else if (!strcmp(family, "virtex5")) { 771 } else if (!strcmp(family, "virtex5")) {
746 regs = &v5_config_registers; 772 regs = &v5_config_registers;
773 } else if (!strcmp(family, "virtex6")) {
774 regs = &v6_config_registers;
747 } 775 }
748 } 776 }
749 return hwicap_setup(&op->dev, id ? *id : -1, &res, config, 777 return hwicap_setup(&op->dev, id ? *id : -1, &res, config,
@@ -785,6 +813,8 @@ static int __devinit hwicap_drv_probe(struct platform_device *pdev)
785 regs = &v4_config_registers; 813 regs = &v4_config_registers;
786 } else if (!strcmp(family, "virtex5")) { 814 } else if (!strcmp(family, "virtex5")) {
787 regs = &v5_config_registers; 815 regs = &v5_config_registers;
816 } else if (!strcmp(family, "virtex6")) {
817 regs = &v6_config_registers;
788 } 818 }
789 } 819 }
790 820
diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.h b/drivers/char/xilinx_hwicap/xilinx_hwicap.h
index 8cca11981c5f..d31ee23c9f13 100644
--- a/drivers/char/xilinx_hwicap/xilinx_hwicap.h
+++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.h
@@ -86,7 +86,7 @@ struct hwicap_driver_config {
86}; 86};
87 87
88/* Number of times to poll the done regsiter */ 88/* Number of times to poll the done regsiter */
89#define XHI_MAX_RETRIES 10 89#define XHI_MAX_RETRIES 5000
90 90
91/************ Constant Definitions *************/ 91/************ Constant Definitions *************/
92 92
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index c7795096d43b..968469555956 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -452,14 +452,32 @@ config ARM_CHARLCD
452 still useful. 452 still useful.
453 453
454config BMP085 454config BMP085
455 tristate "BMP085 digital pressure sensor" 455 bool
456 depends on SYSFS
457
458config BMP085_I2C
459 tristate "BMP085 digital pressure sensor on I2C"
460 select BMP085
461 select REGMAP_I2C
456 depends on I2C && SYSFS 462 depends on I2C && SYSFS
457 help 463 help
458 If you say yes here you get support for the Bosch Sensortec 464 Say Y here if you want to support Bosch Sensortec's digital pressure
459 BMP085 digital pressure sensor. 465 sensor hooked to an I2C bus.
466
467 To compile this driver as a module, choose M here: the
468 module will be called bmp085-i2c.
469
470config BMP085_SPI
471 tristate "BMP085 digital pressure sensor on SPI"
472 select BMP085
473 select REGMAP_SPI
474 depends on SPI_MASTER && SYSFS
475 help
476 Say Y here if you want to support Bosch Sensortec's digital pressure
477 sensor hooked to an SPI bus.
460 478
461 To compile this driver as a module, choose M here: the 479 To compile this driver as a module, choose M here: the
462 module will be called bmp085. 480 module will be called bmp085-spi.
463 481
464config PCH_PHUB 482config PCH_PHUB
465 tristate "Intel EG20T PCH/LAPIS Semicon IOH(ML7213/ML7223/ML7831) PHUB" 483 tristate "Intel EG20T PCH/LAPIS Semicon IOH(ML7213/ML7223/ML7831) PHUB"
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 3e1d80106f04..509d0569dc04 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -11,6 +11,8 @@ obj-$(CONFIG_ATMEL_PWM) += atmel_pwm.o
11obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o 11obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o
12obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o 12obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o
13obj-$(CONFIG_BMP085) += bmp085.o 13obj-$(CONFIG_BMP085) += bmp085.o
14obj-$(CONFIG_BMP085_I2C) += bmp085-i2c.o
15obj-$(CONFIG_BMP085_SPI) += bmp085-spi.o
14obj-$(CONFIG_ICS932S401) += ics932s401.o 16obj-$(CONFIG_ICS932S401) += ics932s401.o
15obj-$(CONFIG_LKDTM) += lkdtm.o 17obj-$(CONFIG_LKDTM) += lkdtm.o
16obj-$(CONFIG_TIFM_CORE) += tifm_core.o 18obj-$(CONFIG_TIFM_CORE) += tifm_core.o
diff --git a/drivers/misc/ad525x_dpot.c b/drivers/misc/ad525x_dpot.c
index 1d1d42615915..6938f1be664d 100644
--- a/drivers/misc/ad525x_dpot.c
+++ b/drivers/misc/ad525x_dpot.c
@@ -749,7 +749,7 @@ exit:
749} 749}
750EXPORT_SYMBOL(ad_dpot_probe); 750EXPORT_SYMBOL(ad_dpot_probe);
751 751
752__devexit int ad_dpot_remove(struct device *dev) 752int ad_dpot_remove(struct device *dev)
753{ 753{
754 struct dpot_data *data = dev_get_drvdata(dev); 754 struct dpot_data *data = dev_get_drvdata(dev);
755 int i; 755 int i;
diff --git a/drivers/misc/bh1780gli.c b/drivers/misc/bh1780gli.c
index 54f6f39f990a..f1f9877f3fdf 100644
--- a/drivers/misc/bh1780gli.c
+++ b/drivers/misc/bh1780gli.c
@@ -248,7 +248,7 @@ static const struct i2c_device_id bh1780_id[] = {
248 248
249static struct i2c_driver bh1780_driver = { 249static struct i2c_driver bh1780_driver = {
250 .probe = bh1780_probe, 250 .probe = bh1780_probe,
251 .remove = bh1780_remove, 251 .remove = __devexit_p(bh1780_remove),
252 .id_table = bh1780_id, 252 .id_table = bh1780_id,
253 .driver = { 253 .driver = {
254 .name = "bh1780", 254 .name = "bh1780",
diff --git a/drivers/misc/bmp085-i2c.c b/drivers/misc/bmp085-i2c.c
new file mode 100644
index 000000000000..9943971c13e3
--- /dev/null
+++ b/drivers/misc/bmp085-i2c.c
@@ -0,0 +1,91 @@
1/*
2 * Copyright (c) 2012 Bosch Sensortec GmbH
3 * Copyright (c) 2012 Unixphere AB
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20#include <linux/module.h>
21#include <linux/i2c.h>
22#include <linux/err.h>
23#include "bmp085.h"
24
25#define BMP085_I2C_ADDRESS 0x77
26
27static const unsigned short normal_i2c[] = { BMP085_I2C_ADDRESS,
28 I2C_CLIENT_END };
29
30static int bmp085_i2c_detect(struct i2c_client *client,
31 struct i2c_board_info *info)
32{
33 if (client->addr != BMP085_I2C_ADDRESS)
34 return -ENODEV;
35
36 return bmp085_detect(&client->dev);
37}
38
39static int __devinit bmp085_i2c_probe(struct i2c_client *client,
40 const struct i2c_device_id *id)
41{
42 int err;
43 struct regmap *regmap = devm_regmap_init_i2c(client,
44 &bmp085_regmap_config);
45
46 if (IS_ERR(regmap)) {
47 err = PTR_ERR(regmap);
48 dev_err(&client->dev, "Failed to init regmap: %d\n", err);
49 return err;
50 }
51
52 return bmp085_probe(&client->dev, regmap);
53}
54
55static int bmp085_i2c_remove(struct i2c_client *client)
56{
57 return bmp085_remove(&client->dev);
58}
59
60static const struct of_device_id bmp085_of_match[] = {
61 { .compatible = "bosch,bmp085", },
62 { },
63};
64MODULE_DEVICE_TABLE(of, bmp085_of_match);
65
66static const struct i2c_device_id bmp085_id[] = {
67 { BMP085_NAME, 0 },
68 { "bmp180", 0 },
69 { }
70};
71MODULE_DEVICE_TABLE(i2c, bmp085_id);
72
73static struct i2c_driver bmp085_i2c_driver = {
74 .driver = {
75 .owner = THIS_MODULE,
76 .name = BMP085_NAME,
77 .of_match_table = bmp085_of_match
78 },
79 .id_table = bmp085_id,
80 .probe = bmp085_i2c_probe,
81 .remove = __devexit_p(bmp085_i2c_remove),
82
83 .detect = bmp085_i2c_detect,
84 .address_list = normal_i2c
85};
86
87module_i2c_driver(bmp085_i2c_driver);
88
89MODULE_AUTHOR("Eric Andersson <eric.andersson@unixphere.com>");
90MODULE_DESCRIPTION("BMP085 I2C bus driver");
91MODULE_LICENSE("GPL");
diff --git a/drivers/misc/bmp085-spi.c b/drivers/misc/bmp085-spi.c
new file mode 100644
index 000000000000..78aaff9b5231
--- /dev/null
+++ b/drivers/misc/bmp085-spi.c
@@ -0,0 +1,91 @@
1/*
2 * Copyright (c) 2012 Bosch Sensortec GmbH
3 * Copyright (c) 2012 Unixphere AB
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20#include <linux/module.h>
21#include <linux/spi/spi.h>
22#include <linux/err.h>
23#include "bmp085.h"
24
25static int __devinit bmp085_spi_probe(struct spi_device *client)
26{
27 int err;
28 struct regmap *regmap;
29
30 client->bits_per_word = 8;
31 err = spi_setup(client);
32 if (err < 0) {
33 dev_err(&client->dev, "spi_setup failed!\n");
34 return err;
35 }
36
37 regmap = devm_regmap_init_spi(client, &bmp085_regmap_config);
38 if (IS_ERR(regmap)) {
39 err = PTR_ERR(regmap);
40 dev_err(&client->dev, "Failed to init regmap: %d\n", err);
41 return err;
42 }
43
44 return bmp085_probe(&client->dev, regmap);
45}
46
47static int bmp085_spi_remove(struct spi_device *client)
48{
49 return bmp085_remove(&client->dev);
50}
51
52static const struct of_device_id bmp085_of_match[] = {
53 { .compatible = "bosch,bmp085", },
54 { },
55};
56MODULE_DEVICE_TABLE(of, bmp085_of_match);
57
58static const struct spi_device_id bmp085_id[] = {
59 { "bmp180", 0 },
60 { "bmp181", 0 },
61 { }
62};
63MODULE_DEVICE_TABLE(spi, bmp085_id);
64
65static struct spi_driver bmp085_spi_driver = {
66 .driver = {
67 .owner = THIS_MODULE,
68 .name = BMP085_NAME,
69 .of_match_table = bmp085_of_match
70 },
71 .id_table = bmp085_id,
72 .probe = bmp085_spi_probe,
73 .remove = __devexit_p(bmp085_spi_remove)
74};
75
76static int __init bmp085_spi_init(void)
77{
78 return spi_register_driver(&bmp085_spi_driver);
79}
80
81static void __exit bmp085_spi_exit(void)
82{
83 spi_unregister_driver(&bmp085_spi_driver);
84}
85
86MODULE_AUTHOR("Eric Andersson <eric.andersson@unixphere.com>");
87MODULE_DESCRIPTION("BMP085 SPI bus driver");
88MODULE_LICENSE("GPL");
89
90module_init(bmp085_spi_init);
91module_exit(bmp085_spi_exit);
diff --git a/drivers/misc/bmp085.c b/drivers/misc/bmp085.c
index 76c3064629f1..62e418293b7e 100644
--- a/drivers/misc/bmp085.c
+++ b/drivers/misc/bmp085.c
@@ -1,62 +1,62 @@
1/* Copyright (c) 2010 Christoph Mair <christoph.mair@gmail.com> 1/* Copyright (c) 2010 Christoph Mair <christoph.mair@gmail.com>
2 2 * Copyright (c) 2012 Bosch Sensortec GmbH
3 This driver supports the bmp085 digital barometric pressure 3 * Copyright (c) 2012 Unixphere AB
4 and temperature sensor from Bosch Sensortec. The datasheet 4 *
5 is available from their website: 5 * This driver supports the bmp085 and bmp18x digital barometric pressure
6 http://www.bosch-sensortec.com/content/language1/downloads/BST-BMP085-DS000-05.pdf 6 * and temperature sensors from Bosch Sensortec. The datasheets
7 7 * are available from their website:
8 A pressure measurement is issued by reading from pressure0_input. 8 * http://www.bosch-sensortec.com/content/language1/downloads/BST-BMP085-DS000-05.pdf
9 The return value ranges from 30000 to 110000 pascal with a resulution 9 * http://www.bosch-sensortec.com/content/language1/downloads/BST-BMP180-DS000-07.pdf
10 of 1 pascal (0.01 millibar) which enables measurements from 9000m above 10 *
11 to 500m below sea level. 11 * A pressure measurement is issued by reading from pressure0_input.
12 12 * The return value ranges from 30000 to 110000 pascal with a resulution
13 The temperature can be read from temp0_input. Values range from 13 * of 1 pascal (0.01 millibar) which enables measurements from 9000m above
14 -400 to 850 representing the ambient temperature in degree celsius 14 * to 500m below sea level.
15 multiplied by 10.The resolution is 0.1 celsius. 15 *
16 16 * The temperature can be read from temp0_input. Values range from
17 Because ambient pressure is temperature dependent, a temperature 17 * -400 to 850 representing the ambient temperature in degree celsius
18 measurement will be executed automatically even if the user is reading 18 * multiplied by 10.The resolution is 0.1 celsius.
19 from pressure0_input. This happens if the last temperature measurement 19 *
20 has been executed more then one second ago. 20 * Because ambient pressure is temperature dependent, a temperature
21 21 * measurement will be executed automatically even if the user is reading
22 To decrease RMS noise from pressure measurements, the bmp085 can 22 * from pressure0_input. This happens if the last temperature measurement
23 autonomously calculate the average of up to eight samples. This is 23 * has been executed more then one second ago.
24 set up by writing to the oversampling sysfs file. Accepted values 24 *
25 are 0, 1, 2 and 3. 2^x when x is the value written to this file 25 * To decrease RMS noise from pressure measurements, the bmp085 can
26 specifies the number of samples used to calculate the ambient pressure. 26 * autonomously calculate the average of up to eight samples. This is
27 RMS noise is specified with six pascal (without averaging) and decreases 27 * set up by writing to the oversampling sysfs file. Accepted values
28 down to 3 pascal when using an oversampling setting of 3. 28 * are 0, 1, 2 and 3. 2^x when x is the value written to this file
29 29 * specifies the number of samples used to calculate the ambient pressure.
30 This program is free software; you can redistribute it and/or modify 30 * RMS noise is specified with six pascal (without averaging) and decreases
31 it under the terms of the GNU General Public License as published by 31 * down to 3 pascal when using an oversampling setting of 3.
32 the Free Software Foundation; either version 2 of the License, or 32 *
33 (at your option) any later version. 33 * This program is free software; you can redistribute it and/or modify
34 34 * it under the terms of the GNU General Public License as published by
35 This program is distributed in the hope that it will be useful, 35 * the Free Software Foundation; either version 2 of the License, or
36 but WITHOUT ANY WARRANTY; without even the implied warranty of 36 * (at your option) any later version.
37 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 37 *
38 GNU General Public License for more details. 38 * This program is distributed in the hope that it will be useful,
39 39 * but WITHOUT ANY WARRANTY; without even the implied warranty of
40 You should have received a copy of the GNU General Public License 40 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
41 along with this program; if not, write to the Free Software 41 * GNU General Public License for more details.
42 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 42 *
43*/ 43 * You should have received a copy of the GNU General Public License
44 44 * along with this program; if not, write to the Free Software
45 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
46 */
45 47
46#include <linux/module.h> 48#include <linux/module.h>
49#include <linux/device.h>
47#include <linux/init.h> 50#include <linux/init.h>
48#include <linux/i2c.h>
49#include <linux/slab.h> 51#include <linux/slab.h>
50#include <linux/delay.h> 52#include <linux/delay.h>
53#include <linux/of.h>
54#include "bmp085.h"
51 55
52
53#define BMP085_I2C_ADDRESS 0x77
54#define BMP085_CHIP_ID 0x55 56#define BMP085_CHIP_ID 0x55
55
56#define BMP085_CALIBRATION_DATA_START 0xAA 57#define BMP085_CALIBRATION_DATA_START 0xAA
57#define BMP085_CALIBRATION_DATA_LENGTH 11 /* 16 bit values */ 58#define BMP085_CALIBRATION_DATA_LENGTH 11 /* 16 bit values */
58#define BMP085_CHIP_ID_REG 0xD0 59#define BMP085_CHIP_ID_REG 0xD0
59#define BMP085_VERSION_REG 0xD1
60#define BMP085_CTRL_REG 0xF4 60#define BMP085_CTRL_REG 0xF4
61#define BMP085_TEMP_MEASUREMENT 0x2E 61#define BMP085_TEMP_MEASUREMENT 0x2E
62#define BMP085_PRESSURE_MEASUREMENT 0x34 62#define BMP085_PRESSURE_MEASUREMENT 0x34
@@ -65,12 +65,6 @@
65#define BMP085_CONVERSION_REGISTER_XLSB 0xF8 65#define BMP085_CONVERSION_REGISTER_XLSB 0xF8
66#define BMP085_TEMP_CONVERSION_TIME 5 66#define BMP085_TEMP_CONVERSION_TIME 5
67 67
68#define BMP085_CLIENT_NAME "bmp085"
69
70
71static const unsigned short normal_i2c[] = { BMP085_I2C_ADDRESS,
72 I2C_CLIENT_END };
73
74struct bmp085_calibration_data { 68struct bmp085_calibration_data {
75 s16 AC1, AC2, AC3; 69 s16 AC1, AC2, AC3;
76 u16 AC4, AC5, AC6; 70 u16 AC4, AC5, AC6;
@@ -78,35 +72,30 @@ struct bmp085_calibration_data {
78 s16 MB, MC, MD; 72 s16 MB, MC, MD;
79}; 73};
80 74
81
82/* Each client has this additional data */
83struct bmp085_data { 75struct bmp085_data {
84 struct i2c_client *client; 76 struct device *dev;
85 struct mutex lock; 77 struct regmap *regmap;
86 struct bmp085_calibration_data calibration; 78 struct mutex lock;
87 u32 raw_temperature; 79 struct bmp085_calibration_data calibration;
88 u32 raw_pressure; 80 u8 oversampling_setting;
89 unsigned char oversampling_setting; 81 u32 raw_temperature;
82 u32 raw_pressure;
83 u32 temp_measurement_period;
90 unsigned long last_temp_measurement; 84 unsigned long last_temp_measurement;
91 s32 b6; /* calculated temperature correction coefficient */ 85 u8 chip_id;
86 s32 b6; /* calculated temperature correction coefficient */
92}; 87};
93 88
94 89static s32 bmp085_read_calibration_data(struct bmp085_data *data)
95static s32 bmp085_read_calibration_data(struct i2c_client *client)
96{ 90{
97 u16 tmp[BMP085_CALIBRATION_DATA_LENGTH]; 91 u16 tmp[BMP085_CALIBRATION_DATA_LENGTH];
98 struct bmp085_data *data = i2c_get_clientdata(client);
99 struct bmp085_calibration_data *cali = &(data->calibration); 92 struct bmp085_calibration_data *cali = &(data->calibration);
100 s32 status = i2c_smbus_read_i2c_block_data(client, 93 s32 status = regmap_bulk_read(data->regmap,
101 BMP085_CALIBRATION_DATA_START, 94 BMP085_CALIBRATION_DATA_START, (u8 *)tmp,
102 BMP085_CALIBRATION_DATA_LENGTH*sizeof(u16), 95 (BMP085_CALIBRATION_DATA_LENGTH << 1));
103 (u8 *)tmp);
104 if (status < 0) 96 if (status < 0)
105 return status; 97 return status;
106 98
107 if (status != BMP085_CALIBRATION_DATA_LENGTH*sizeof(u16))
108 return -EIO;
109
110 cali->AC1 = be16_to_cpu(tmp[0]); 99 cali->AC1 = be16_to_cpu(tmp[0]);
111 cali->AC2 = be16_to_cpu(tmp[1]); 100 cali->AC2 = be16_to_cpu(tmp[1]);
112 cali->AC3 = be16_to_cpu(tmp[2]); 101 cali->AC3 = be16_to_cpu(tmp[2]);
@@ -121,30 +110,26 @@ static s32 bmp085_read_calibration_data(struct i2c_client *client)
121 return 0; 110 return 0;
122} 111}
123 112
124
125static s32 bmp085_update_raw_temperature(struct bmp085_data *data) 113static s32 bmp085_update_raw_temperature(struct bmp085_data *data)
126{ 114{
127 u16 tmp; 115 u16 tmp;
128 s32 status; 116 s32 status;
129 117
130 mutex_lock(&data->lock); 118 mutex_lock(&data->lock);
131 status = i2c_smbus_write_byte_data(data->client, BMP085_CTRL_REG, 119 status = regmap_write(data->regmap, BMP085_CTRL_REG,
132 BMP085_TEMP_MEASUREMENT); 120 BMP085_TEMP_MEASUREMENT);
133 if (status != 0) { 121 if (status < 0) {
134 dev_err(&data->client->dev, 122 dev_err(data->dev,
135 "Error while requesting temperature measurement.\n"); 123 "Error while requesting temperature measurement.\n");
136 goto exit; 124 goto exit;
137 } 125 }
138 msleep(BMP085_TEMP_CONVERSION_TIME); 126 msleep(BMP085_TEMP_CONVERSION_TIME);
139 127
140 status = i2c_smbus_read_i2c_block_data(data->client, 128 status = regmap_bulk_read(data->regmap, BMP085_CONVERSION_REGISTER_MSB,
141 BMP085_CONVERSION_REGISTER_MSB, sizeof(tmp), (u8 *)&tmp); 129 &tmp, sizeof(tmp));
142 if (status < 0) 130 if (status < 0) {
143 goto exit; 131 dev_err(data->dev,
144 if (status != sizeof(tmp)) {
145 dev_err(&data->client->dev,
146 "Error while reading temperature measurement result\n"); 132 "Error while reading temperature measurement result\n");
147 status = -EIO;
148 goto exit; 133 goto exit;
149 } 134 }
150 data->raw_temperature = be16_to_cpu(tmp); 135 data->raw_temperature = be16_to_cpu(tmp);
@@ -162,10 +147,11 @@ static s32 bmp085_update_raw_pressure(struct bmp085_data *data)
162 s32 status; 147 s32 status;
163 148
164 mutex_lock(&data->lock); 149 mutex_lock(&data->lock);
165 status = i2c_smbus_write_byte_data(data->client, BMP085_CTRL_REG, 150 status = regmap_write(data->regmap, BMP085_CTRL_REG,
166 BMP085_PRESSURE_MEASUREMENT + (data->oversampling_setting<<6)); 151 BMP085_PRESSURE_MEASUREMENT +
167 if (status != 0) { 152 (data->oversampling_setting << 6));
168 dev_err(&data->client->dev, 153 if (status < 0) {
154 dev_err(data->dev,
169 "Error while requesting pressure measurement.\n"); 155 "Error while requesting pressure measurement.\n");
170 goto exit; 156 goto exit;
171 } 157 }
@@ -174,14 +160,11 @@ static s32 bmp085_update_raw_pressure(struct bmp085_data *data)
174 msleep(2+(3 << data->oversampling_setting)); 160 msleep(2+(3 << data->oversampling_setting));
175 161
176 /* copy data into a u32 (4 bytes), but skip the first byte. */ 162 /* copy data into a u32 (4 bytes), but skip the first byte. */
177 status = i2c_smbus_read_i2c_block_data(data->client, 163 status = regmap_bulk_read(data->regmap, BMP085_CONVERSION_REGISTER_MSB,
178 BMP085_CONVERSION_REGISTER_MSB, 3, ((u8 *)&tmp)+1); 164 ((u8 *)&tmp)+1, 3);
179 if (status < 0) 165 if (status < 0) {
180 goto exit; 166 dev_err(data->dev,
181 if (status != 3) {
182 dev_err(&data->client->dev,
183 "Error while reading pressure measurement results\n"); 167 "Error while reading pressure measurement results\n");
184 status = -EIO;
185 goto exit; 168 goto exit;
186 } 169 }
187 data->raw_pressure = be32_to_cpu((tmp)); 170 data->raw_pressure = be32_to_cpu((tmp));
@@ -193,7 +176,6 @@ exit:
193 return status; 176 return status;
194} 177}
195 178
196
197/* 179/*
198 * This function starts the temperature measurement and returns the value 180 * This function starts the temperature measurement and returns the value
199 * in tenth of a degree celsius. 181 * in tenth of a degree celsius.
@@ -205,7 +187,7 @@ static s32 bmp085_get_temperature(struct bmp085_data *data, int *temperature)
205 int status; 187 int status;
206 188
207 status = bmp085_update_raw_temperature(data); 189 status = bmp085_update_raw_temperature(data);
208 if (status != 0) 190 if (status < 0)
209 goto exit; 191 goto exit;
210 192
211 x1 = ((data->raw_temperature - cali->AC6) * cali->AC5) >> 15; 193 x1 = ((data->raw_temperature - cali->AC6) * cali->AC5) >> 15;
@@ -222,8 +204,10 @@ exit:
222/* 204/*
223 * This function starts the pressure measurement and returns the value 205 * This function starts the pressure measurement and returns the value
224 * in millibar. Since the pressure depends on the ambient temperature, 206 * in millibar. Since the pressure depends on the ambient temperature,
225 * a temperature measurement is executed if the last known value is older 207 * a temperature measurement is executed according to the given temperature
226 * than one second. 208 * measurement period (default is 1 sec boundary). This period could vary
209 * and needs to be adjusted according to the sensor environment, i.e. if big
210 * temperature variations then the temperature needs to be read out often.
227 */ 211 */
228static s32 bmp085_get_pressure(struct bmp085_data *data, int *pressure) 212static s32 bmp085_get_pressure(struct bmp085_data *data, int *pressure)
229{ 213{
@@ -234,16 +218,16 @@ static s32 bmp085_get_pressure(struct bmp085_data *data, int *pressure)
234 int status; 218 int status;
235 219
236 /* alt least every second force an update of the ambient temperature */ 220 /* alt least every second force an update of the ambient temperature */
237 if (data->last_temp_measurement == 0 || 221 if ((data->last_temp_measurement == 0) ||
238 time_is_before_jiffies(data->last_temp_measurement + 1*HZ)) { 222 time_is_before_jiffies(data->last_temp_measurement + 1*HZ)) {
239 status = bmp085_get_temperature(data, NULL); 223 status = bmp085_get_temperature(data, NULL);
240 if (status != 0) 224 if (status < 0)
241 goto exit; 225 return status;
242 } 226 }
243 227
244 status = bmp085_update_raw_pressure(data); 228 status = bmp085_update_raw_pressure(data);
245 if (status != 0) 229 if (status < 0)
246 goto exit; 230 return status;
247 231
248 x1 = (data->b6 * data->b6) >> 12; 232 x1 = (data->b6 * data->b6) >> 12;
249 x1 *= cali->B2; 233 x1 *= cali->B2;
@@ -274,15 +258,14 @@ static s32 bmp085_get_pressure(struct bmp085_data *data, int *pressure)
274 258
275 *pressure = p; 259 *pressure = p;
276 260
277exit: 261 return 0;
278 return status;
279} 262}
280 263
281/* 264/*
282 * This function sets the chip-internal oversampling. Valid values are 0..3. 265 * This function sets the chip-internal oversampling. Valid values are 0..3.
283 * The chip will use 2^oversampling samples for internal averaging. 266 * The chip will use 2^oversampling samples for internal averaging.
284 * This influences the measurement time and the accuracy; larger values 267 * This influences the measurement time and the accuracy; larger values
285 * increase both. The datasheet gives on overview on how measurement time, 268 * increase both. The datasheet gives an overview on how measurement time,
286 * accuracy and noise correlate. 269 * accuracy and noise correlate.
287 */ 270 */
288static void bmp085_set_oversampling(struct bmp085_data *data, 271static void bmp085_set_oversampling(struct bmp085_data *data,
@@ -306,22 +289,25 @@ static ssize_t set_oversampling(struct device *dev,
306 struct device_attribute *attr, 289 struct device_attribute *attr,
307 const char *buf, size_t count) 290 const char *buf, size_t count)
308{ 291{
309 struct i2c_client *client = to_i2c_client(dev); 292 struct bmp085_data *data = dev_get_drvdata(dev);
310 struct bmp085_data *data = i2c_get_clientdata(client);
311 unsigned long oversampling; 293 unsigned long oversampling;
312 int success = strict_strtoul(buf, 10, &oversampling); 294 int err = kstrtoul(buf, 10, &oversampling);
313 if (success == 0) { 295
296 if (err == 0) {
297 mutex_lock(&data->lock);
314 bmp085_set_oversampling(data, oversampling); 298 bmp085_set_oversampling(data, oversampling);
299 mutex_unlock(&data->lock);
315 return count; 300 return count;
316 } 301 }
317 return success; 302
303 return err;
318} 304}
319 305
320static ssize_t show_oversampling(struct device *dev, 306static ssize_t show_oversampling(struct device *dev,
321 struct device_attribute *attr, char *buf) 307 struct device_attribute *attr, char *buf)
322{ 308{
323 struct i2c_client *client = to_i2c_client(dev); 309 struct bmp085_data *data = dev_get_drvdata(dev);
324 struct bmp085_data *data = i2c_get_clientdata(client); 310
325 return sprintf(buf, "%u\n", bmp085_get_oversampling(data)); 311 return sprintf(buf, "%u\n", bmp085_get_oversampling(data));
326} 312}
327static DEVICE_ATTR(oversampling, S_IWUSR | S_IRUGO, 313static DEVICE_ATTR(oversampling, S_IWUSR | S_IRUGO,
@@ -333,11 +319,10 @@ static ssize_t show_temperature(struct device *dev,
333{ 319{
334 int temperature; 320 int temperature;
335 int status; 321 int status;
336 struct i2c_client *client = to_i2c_client(dev); 322 struct bmp085_data *data = dev_get_drvdata(dev);
337 struct bmp085_data *data = i2c_get_clientdata(client);
338 323
339 status = bmp085_get_temperature(data, &temperature); 324 status = bmp085_get_temperature(data, &temperature);
340 if (status != 0) 325 if (status < 0)
341 return status; 326 return status;
342 else 327 else
343 return sprintf(buf, "%d\n", temperature); 328 return sprintf(buf, "%d\n", temperature);
@@ -350,11 +335,10 @@ static ssize_t show_pressure(struct device *dev,
350{ 335{
351 int pressure; 336 int pressure;
352 int status; 337 int status;
353 struct i2c_client *client = to_i2c_client(dev); 338 struct bmp085_data *data = dev_get_drvdata(dev);
354 struct bmp085_data *data = i2c_get_clientdata(client);
355 339
356 status = bmp085_get_pressure(data, &pressure); 340 status = bmp085_get_pressure(data, &pressure);
357 if (status != 0) 341 if (status < 0)
358 return status; 342 return status;
359 else 343 else
360 return sprintf(buf, "%d\n", pressure); 344 return sprintf(buf, "%d\n", pressure);
@@ -373,38 +357,70 @@ static const struct attribute_group bmp085_attr_group = {
373 .attrs = bmp085_attributes, 357 .attrs = bmp085_attributes,
374}; 358};
375 359
376static int bmp085_detect(struct i2c_client *client, struct i2c_board_info *info) 360int bmp085_detect(struct device *dev)
377{ 361{
378 if (client->addr != BMP085_I2C_ADDRESS) 362 struct bmp085_data *data = dev_get_drvdata(dev);
379 return -ENODEV; 363 unsigned int id;
364 int ret;
380 365
381 if (i2c_smbus_read_byte_data(client, BMP085_CHIP_ID_REG) != BMP085_CHIP_ID) 366 ret = regmap_read(data->regmap, BMP085_CHIP_ID_REG, &id);
367 if (ret < 0)
368 return ret;
369
370 if (id != data->chip_id)
382 return -ENODEV; 371 return -ENODEV;
383 372
384 return 0; 373 return 0;
385} 374}
375EXPORT_SYMBOL_GPL(bmp085_detect);
386 376
387static int bmp085_init_client(struct i2c_client *client) 377static void __init bmp085_get_of_properties(struct bmp085_data *data)
388{ 378{
389 unsigned char version; 379#ifdef CONFIG_OF
390 int status; 380 struct device_node *np = data->dev->of_node;
391 struct bmp085_data *data = i2c_get_clientdata(client); 381 u32 prop;
392 data->client = client; 382
393 status = bmp085_read_calibration_data(client); 383 if (!np)
394 if (status != 0) 384 return;
395 goto exit; 385
396 version = i2c_smbus_read_byte_data(client, BMP085_VERSION_REG); 386 if (!of_property_read_u32(np, "chip-id", &prop))
387 data->chip_id = prop & 0xff;
388
389 if (!of_property_read_u32(np, "temp-measurement-period", &prop))
390 data->temp_measurement_period = (prop/100)*HZ;
391
392 if (!of_property_read_u32(np, "default-oversampling", &prop))
393 data->oversampling_setting = prop & 0xff;
394#endif
395}
396
397static int bmp085_init_client(struct bmp085_data *data)
398{
399 int status = bmp085_read_calibration_data(data);
400
401 if (status < 0)
402 return status;
403
404 /* default settings */
405 data->chip_id = BMP085_CHIP_ID;
397 data->last_temp_measurement = 0; 406 data->last_temp_measurement = 0;
407 data->temp_measurement_period = 1*HZ;
398 data->oversampling_setting = 3; 408 data->oversampling_setting = 3;
409
410 bmp085_get_of_properties(data);
411
399 mutex_init(&data->lock); 412 mutex_init(&data->lock);
400 dev_info(&data->client->dev, "BMP085 ver. %d.%d found.\n", 413
401 (version & 0x0F), (version & 0xF0) >> 4); 414 return 0;
402exit:
403 return status;
404} 415}
405 416
406static int __devinit bmp085_probe(struct i2c_client *client, 417struct regmap_config bmp085_regmap_config = {
407 const struct i2c_device_id *id) 418 .reg_bits = 8,
419 .val_bits = 8
420};
421EXPORT_SYMBOL_GPL(bmp085_regmap_config);
422
423__devinit int bmp085_probe(struct device *dev, struct regmap *regmap)
408{ 424{
409 struct bmp085_data *data; 425 struct bmp085_data *data;
410 int err = 0; 426 int err = 0;
@@ -415,58 +431,48 @@ static int __devinit bmp085_probe(struct i2c_client *client,
415 goto exit; 431 goto exit;
416 } 432 }
417 433
418 /* default settings after POR */ 434 dev_set_drvdata(dev, data);
419 data->oversampling_setting = 0x00; 435 data->dev = dev;
420 436 data->regmap = regmap;
421 i2c_set_clientdata(client, data);
422 437
423 /* Initialize the BMP085 chip */ 438 /* Initialize the BMP085 chip */
424 err = bmp085_init_client(client); 439 err = bmp085_init_client(data);
425 if (err != 0) 440 if (err < 0)
426 goto exit_free; 441 goto exit_free;
427 442
443 err = bmp085_detect(dev);
444 if (err < 0) {
445 dev_err(dev, "%s: chip_id failed!\n", BMP085_NAME);
446 goto exit_free;
447 }
448
428 /* Register sysfs hooks */ 449 /* Register sysfs hooks */
429 err = sysfs_create_group(&client->dev.kobj, &bmp085_attr_group); 450 err = sysfs_create_group(&dev->kobj, &bmp085_attr_group);
430 if (err) 451 if (err)
431 goto exit_free; 452 goto exit_free;
432 453
433 dev_info(&data->client->dev, "Successfully initialized bmp085!\n"); 454 dev_info(dev, "Successfully initialized %s!\n", BMP085_NAME);
434 goto exit; 455
456 return 0;
435 457
436exit_free: 458exit_free:
437 kfree(data); 459 kfree(data);
438exit: 460exit:
439 return err; 461 return err;
440} 462}
463EXPORT_SYMBOL_GPL(bmp085_probe);
441 464
442static int __devexit bmp085_remove(struct i2c_client *client) 465int bmp085_remove(struct device *dev)
443{ 466{
444 sysfs_remove_group(&client->dev.kobj, &bmp085_attr_group); 467 struct bmp085_data *data = dev_get_drvdata(dev);
445 kfree(i2c_get_clientdata(client));
446 return 0;
447}
448 468
449static const struct i2c_device_id bmp085_id[] = { 469 sysfs_remove_group(&data->dev->kobj, &bmp085_attr_group);
450 { "bmp085", 0 }, 470 kfree(data);
451 { }
452};
453MODULE_DEVICE_TABLE(i2c, bmp085_id);
454
455static struct i2c_driver bmp085_driver = {
456 .driver = {
457 .owner = THIS_MODULE,
458 .name = "bmp085"
459 },
460 .id_table = bmp085_id,
461 .probe = bmp085_probe,
462 .remove = __devexit_p(bmp085_remove),
463
464 .detect = bmp085_detect,
465 .address_list = normal_i2c
466};
467 471
468module_i2c_driver(bmp085_driver); 472 return 0;
473}
474EXPORT_SYMBOL_GPL(bmp085_remove);
469 475
470MODULE_AUTHOR("Christoph Mair <christoph.mair@gmail.com"); 476MODULE_AUTHOR("Christoph Mair <christoph.mair@gmail.com>");
471MODULE_DESCRIPTION("BMP085 driver"); 477MODULE_DESCRIPTION("BMP085 driver");
472MODULE_LICENSE("GPL"); 478MODULE_LICENSE("GPL");
diff --git a/drivers/misc/bmp085.h b/drivers/misc/bmp085.h
new file mode 100644
index 000000000000..2b8f615bca92
--- /dev/null
+++ b/drivers/misc/bmp085.h
@@ -0,0 +1,33 @@
1/*
2 * Copyright (c) 2012 Bosch Sensortec GmbH
3 * Copyright (c) 2012 Unixphere AB
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20#ifndef _BMP085_H
21#define _BMP085_H
22
23#include <linux/regmap.h>
24
25#define BMP085_NAME "bmp085"
26
27extern struct regmap_config bmp085_regmap_config;
28
29int bmp085_probe(struct device *dev, struct regmap *regmap);
30int bmp085_remove(struct device *dev);
31int bmp085_detect(struct device *dev);
32
33#endif
diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c
index 01ab3c9b4cf7..0842c2994ee2 100644
--- a/drivers/misc/eeprom/at25.c
+++ b/drivers/misc/eeprom/at25.c
@@ -50,6 +50,7 @@ struct at25_data {
50#define AT25_SR_BP1 0x08 50#define AT25_SR_BP1 0x08
51#define AT25_SR_WPEN 0x80 /* writeprotect enable */ 51#define AT25_SR_WPEN 0x80 /* writeprotect enable */
52 52
53#define AT25_INSTR_BIT3 0x08 /* Additional address bit in instr */
53 54
54#define EE_MAXADDRLEN 3 /* 24 bit addresses, up to 2 MBytes */ 55#define EE_MAXADDRLEN 3 /* 24 bit addresses, up to 2 MBytes */
55 56
@@ -75,6 +76,7 @@ at25_ee_read(
75 ssize_t status; 76 ssize_t status;
76 struct spi_transfer t[2]; 77 struct spi_transfer t[2];
77 struct spi_message m; 78 struct spi_message m;
79 u8 instr;
78 80
79 if (unlikely(offset >= at25->bin.size)) 81 if (unlikely(offset >= at25->bin.size))
80 return 0; 82 return 0;
@@ -84,7 +86,12 @@ at25_ee_read(
84 return count; 86 return count;
85 87
86 cp = command; 88 cp = command;
87 *cp++ = AT25_READ; 89
90 instr = AT25_READ;
91 if (at25->chip.flags & EE_INSTR_BIT3_IS_ADDR)
92 if (offset >= (1U << (at25->addrlen * 8)))
93 instr |= AT25_INSTR_BIT3;
94 *cp++ = instr;
88 95
89 /* 8/16/24-bit address is written MSB first */ 96 /* 8/16/24-bit address is written MSB first */
90 switch (at25->addrlen) { 97 switch (at25->addrlen) {
@@ -167,14 +174,14 @@ at25_ee_write(struct at25_data *at25, const char *buf, loff_t off,
167 /* For write, rollover is within the page ... so we write at 174 /* For write, rollover is within the page ... so we write at
168 * most one page, then manually roll over to the next page. 175 * most one page, then manually roll over to the next page.
169 */ 176 */
170 bounce[0] = AT25_WRITE;
171 mutex_lock(&at25->lock); 177 mutex_lock(&at25->lock);
172 do { 178 do {
173 unsigned long timeout, retries; 179 unsigned long timeout, retries;
174 unsigned segment; 180 unsigned segment;
175 unsigned offset = (unsigned) off; 181 unsigned offset = (unsigned) off;
176 u8 *cp = bounce + 1; 182 u8 *cp = bounce;
177 int sr; 183 int sr;
184 u8 instr;
178 185
179 *cp = AT25_WREN; 186 *cp = AT25_WREN;
180 status = spi_write(at25->spi, cp, 1); 187 status = spi_write(at25->spi, cp, 1);
@@ -184,6 +191,12 @@ at25_ee_write(struct at25_data *at25, const char *buf, loff_t off,
184 break; 191 break;
185 } 192 }
186 193
194 instr = AT25_WRITE;
195 if (at25->chip.flags & EE_INSTR_BIT3_IS_ADDR)
196 if (offset >= (1U << (at25->addrlen * 8)))
197 instr |= AT25_INSTR_BIT3;
198 *cp++ = instr;
199
187 /* 8/16/24-bit address is written MSB first */ 200 /* 8/16/24-bit address is written MSB first */
188 switch (at25->addrlen) { 201 switch (at25->addrlen) {
189 default: /* case 3 */ 202 default: /* case 3 */
diff --git a/drivers/misc/max8997-muic.c b/drivers/misc/max8997-muic.c
index 19591eaa492a..2e7df9c56491 100644
--- a/drivers/misc/max8997-muic.c
+++ b/drivers/misc/max8997-muic.c
@@ -440,10 +440,6 @@ static int __devinit max8997_muic_probe(struct platform_device *pdev)
440 "failed: irq request (IRQ: %d," 440 "failed: irq request (IRQ: %d,"
441 " error :%d)\n", 441 " error :%d)\n",
442 muic_irq->irq, ret); 442 muic_irq->irq, ret);
443
444 for (i = i - 1; i >= 0; i--)
445 free_irq(muic_irq->irq, info);
446
447 goto err_irq; 443 goto err_irq;
448 } 444 }
449 } 445 }
@@ -457,6 +453,8 @@ static int __devinit max8997_muic_probe(struct platform_device *pdev)
457 return ret; 453 return ret;
458 454
459err_irq: 455err_irq:
456 while (--i >= 0)
457 free_irq(pdata->irq_base + muic_irqs[i].irq, info);
460err_pdata: 458err_pdata:
461 kfree(info); 459 kfree(info);
462err_kfree: 460err_kfree:
diff --git a/drivers/misc/pch_phub.c b/drivers/misc/pch_phub.c
index 10fc4785dba7..9fbcacd703d5 100644
--- a/drivers/misc/pch_phub.c
+++ b/drivers/misc/pch_phub.c
@@ -65,10 +65,6 @@
65#define PCI_VENDOR_ID_ROHM 0x10db 65#define PCI_VENDOR_ID_ROHM 0x10db
66#define PCI_DEVICE_ID_ROHM_ML7213_PHUB 0x801A 66#define PCI_DEVICE_ID_ROHM_ML7213_PHUB 0x801A
67 67
68/* Macros for ML7213 */
69#define PCI_VENDOR_ID_ROHM 0x10db
70#define PCI_DEVICE_ID_ROHM_ML7213_PHUB 0x801A
71
72/* Macros for ML7223 */ 68/* Macros for ML7223 */
73#define PCI_DEVICE_ID_ROHM_ML7223_mPHUB 0x8012 /* for Bus-m */ 69#define PCI_DEVICE_ID_ROHM_ML7223_mPHUB 0x8012 /* for Bus-m */
74#define PCI_DEVICE_ID_ROHM_ML7223_nPHUB 0x8002 /* for Bus-n */ 70#define PCI_DEVICE_ID_ROHM_ML7223_nPHUB 0x8002 /* for Bus-n */
diff --git a/drivers/misc/pti.c b/drivers/misc/pti.c
index 383133b201a1..b7eb545394b1 100644
--- a/drivers/misc/pti.c
+++ b/drivers/misc/pti.c
@@ -888,7 +888,7 @@ static struct pci_driver pti_pci_driver = {
888 .name = PCINAME, 888 .name = PCINAME,
889 .id_table = pci_ids, 889 .id_table = pci_ids,
890 .probe = pti_pci_probe, 890 .probe = pti_pci_probe,
891 .remove = pti_pci_remove, 891 .remove = __devexit_p(pti_pci_remove),
892}; 892};
893 893
894/** 894/**
diff --git a/drivers/parport/parport_amiga.c b/drivers/parport/parport_amiga.c
index 8bef6d60f88b..ee78e0ee6e05 100644
--- a/drivers/parport/parport_amiga.c
+++ b/drivers/parport/parport_amiga.c
@@ -48,23 +48,6 @@ static unsigned char amiga_read_data(struct parport *p)
48 return ciaa.prb; 48 return ciaa.prb;
49} 49}
50 50
51#if 0
52static unsigned char control_pc_to_amiga(unsigned char control)
53{
54 unsigned char ret = 0;
55
56 if (control & PARPORT_CONTROL_SELECT) /* XXX: What is SELECP? */
57 ;
58 if (control & PARPORT_CONTROL_INIT) /* INITP */
59 /* reset connected to cpu reset pin */;
60 if (control & PARPORT_CONTROL_AUTOFD) /* AUTOLF */
61 /* Not connected */;
62 if (control & PARPORT_CONTROL_STROBE) /* Strobe */
63 /* Handled only directly by hardware */;
64 return ret;
65}
66#endif
67
68static unsigned char control_amiga_to_pc(unsigned char control) 51static unsigned char control_amiga_to_pc(unsigned char control)
69{ 52{
70 return PARPORT_CONTROL_SELECT | 53 return PARPORT_CONTROL_SELECT |
@@ -95,25 +78,6 @@ static unsigned char amiga_frob_control( struct parport *p, unsigned char mask,
95 return old; 78 return old;
96} 79}
97 80
98#if 0 /* currently unused */
99static unsigned char status_pc_to_amiga(unsigned char status)
100{
101 unsigned char ret = 1;
102
103 if (status & PARPORT_STATUS_BUSY) /* Busy */
104 ret &= ~1;
105 if (status & PARPORT_STATUS_ACK) /* Ack */
106 /* handled in hardware */;
107 if (status & PARPORT_STATUS_PAPEROUT) /* PaperOut */
108 ret |= 2;
109 if (status & PARPORT_STATUS_SELECT) /* select */
110 ret |= 4;
111 if (status & PARPORT_STATUS_ERROR) /* error */
112 /* not connected */;
113 return ret;
114}
115#endif
116
117static unsigned char status_amiga_to_pc(unsigned char status) 81static unsigned char status_amiga_to_pc(unsigned char status)
118{ 82{
119 unsigned char ret = PARPORT_STATUS_BUSY | PARPORT_STATUS_ACK | PARPORT_STATUS_ERROR; 83 unsigned char ret = PARPORT_STATUS_BUSY | PARPORT_STATUS_ACK | PARPORT_STATUS_ERROR;
diff --git a/drivers/parport/parport_atari.c b/drivers/parport/parport_atari.c
index 0b28fccec03f..7ad59ac68cf6 100644
--- a/drivers/parport/parport_atari.c
+++ b/drivers/parport/parport_atari.c
@@ -130,15 +130,6 @@ parport_atari_data_forward(struct parport *p)
130static void 130static void
131parport_atari_data_reverse(struct parport *p) 131parport_atari_data_reverse(struct parport *p)
132{ 132{
133#if 0 /* too dangerous, can kill sound chip */
134 unsigned long flags;
135
136 local_irq_save(flags);
137 /* Soundchip port B as input. */
138 sound_ym.rd_data_reg_sel = 7;
139 sound_ym.wd_data = sound_ym.rd_data_reg_sel & ~0x40;
140 local_irq_restore(flags);
141#endif
142} 133}
143 134
144static struct parport_operations parport_atari_ops = { 135static struct parport_operations parport_atari_ops = {
diff --git a/drivers/parport/parport_mfc3.c b/drivers/parport/parport_mfc3.c
index 1c0c642b3e23..7578d79b3688 100644
--- a/drivers/parport/parport_mfc3.c
+++ b/drivers/parport/parport_mfc3.c
@@ -147,25 +147,6 @@ DPRINTK(KERN_DEBUG "frob_control mask %02x, value %02x\n",mask,val);
147 return old; 147 return old;
148} 148}
149 149
150#if 0 /* currently unused */
151static unsigned char status_pc_to_mfc3(unsigned char status)
152{
153 unsigned char ret = 1;
154
155 if (status & PARPORT_STATUS_BUSY) /* Busy */
156 ret &= ~1;
157 if (status & PARPORT_STATUS_ACK) /* Ack */
158 ret |= 8;
159 if (status & PARPORT_STATUS_PAPEROUT) /* PaperOut */
160 ret |= 2;
161 if (status & PARPORT_STATUS_SELECT) /* select */
162 ret |= 4;
163 if (status & PARPORT_STATUS_ERROR) /* error */
164 ret |= 16;
165 return ret;
166}
167#endif
168
169static unsigned char status_mfc3_to_pc(unsigned char status) 150static unsigned char status_mfc3_to_pc(unsigned char status)
170{ 151{
171 unsigned char ret = PARPORT_STATUS_BUSY; 152 unsigned char ret = PARPORT_STATUS_BUSY;
@@ -184,14 +165,6 @@ static unsigned char status_mfc3_to_pc(unsigned char status)
184 return ret; 165 return ret;
185} 166}
186 167
187#if 0 /* currently unused */
188static void mfc3_write_status( struct parport *p, unsigned char status)
189{
190DPRINTK(KERN_DEBUG "write_status %02x\n",status);
191 pia(p)->ppra = (pia(p)->ppra & 0xe0) | status_pc_to_mfc3(status);
192}
193#endif
194
195static unsigned char mfc3_read_status(struct parport *p) 168static unsigned char mfc3_read_status(struct parport *p)
196{ 169{
197 unsigned char status; 170 unsigned char status;
@@ -201,14 +174,6 @@ DPRINTK(KERN_DEBUG "read_status %02x\n", status);
201 return status; 174 return status;
202} 175}
203 176
204#if 0 /* currently unused */
205static void mfc3_change_mode( struct parport *p, int m)
206{
207 /* XXX: This port only has one mode, and I am
208 not sure about the corresponding PC-style mode*/
209}
210#endif
211
212static int use_cnt = 0; 177static int use_cnt = 0;
213 178
214static irqreturn_t mfc3_interrupt(int irq, void *dev_id) 179static irqreturn_t mfc3_interrupt(int irq, void *dev_id)
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 0cb64f50cecd..402956321d33 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -197,54 +197,6 @@ static int change_mode(struct parport *p, int m)
197 ECR_WRITE(p, oecr); 197 ECR_WRITE(p, oecr);
198 return 0; 198 return 0;
199} 199}
200
201#ifdef CONFIG_PARPORT_1284
202/* Find FIFO lossage; FIFO is reset */
203#if 0
204static int get_fifo_residue(struct parport *p)
205{
206 int residue;
207 int cnfga;
208 const struct parport_pc_private *priv = p->physport->private_data;
209
210 /* Adjust for the contents of the FIFO. */
211 for (residue = priv->fifo_depth; ; residue--) {
212 if (inb(ECONTROL(p)) & 0x2)
213 /* Full up. */
214 break;
215
216 outb(0, FIFO(p));
217 }
218
219 printk(KERN_DEBUG "%s: %d PWords were left in FIFO\n", p->name,
220 residue);
221
222 /* Reset the FIFO. */
223 frob_set_mode(p, ECR_PS2);
224
225 /* Now change to config mode and clean up. FIXME */
226 frob_set_mode(p, ECR_CNF);
227 cnfga = inb(CONFIGA(p));
228 printk(KERN_DEBUG "%s: cnfgA contains 0x%02x\n", p->name, cnfga);
229
230 if (!(cnfga & (1<<2))) {
231 printk(KERN_DEBUG "%s: Accounting for extra byte\n", p->name);
232 residue++;
233 }
234
235 /* Don't care about partial PWords until support is added for
236 * PWord != 1 byte. */
237
238 /* Back to PS2 mode. */
239 frob_set_mode(p, ECR_PS2);
240
241 DPRINTK(KERN_DEBUG
242 "*** get_fifo_residue: done residue collecting (ecr = 0x%2.2x)\n",
243 inb(ECONTROL(p)));
244 return residue;
245}
246#endif /* 0 */
247#endif /* IEEE 1284 support */
248#endif /* FIFO support */ 200#endif /* FIFO support */
249 201
250/* 202/*
@@ -940,234 +892,6 @@ static size_t parport_pc_ecp_write_block_pio(struct parport *port,
940 892
941 return written; 893 return written;
942} 894}
943
944#if 0
945static size_t parport_pc_ecp_read_block_pio(struct parport *port,
946 void *buf, size_t length,
947 int flags)
948{
949 size_t left = length;
950 size_t fifofull;
951 int r;
952 const int fifo = FIFO(port);
953 const struct parport_pc_private *priv = port->physport->private_data;
954 const int fifo_depth = priv->fifo_depth;
955 char *bufp = buf;
956
957 port = port->physport;
958 DPRINTK(KERN_DEBUG "parport_pc: parport_pc_ecp_read_block_pio\n");
959 dump_parport_state("enter fcn", port);
960
961 /* Special case: a timeout of zero means we cannot call schedule().
962 * Also if O_NONBLOCK is set then use the default implementation. */
963 if (port->cad->timeout <= PARPORT_INACTIVITY_O_NONBLOCK)
964 return parport_ieee1284_ecp_read_data(port, buf,
965 length, flags);
966
967 if (port->ieee1284.mode == IEEE1284_MODE_ECPRLE) {
968 /* If the peripheral is allowed to send RLE compressed
969 * data, it is possible for a byte to expand to 128
970 * bytes in the FIFO. */
971 fifofull = 128;
972 } else {
973 fifofull = fifo_depth;
974 }
975
976 /* If the caller wants less than a full FIFO's worth of data,
977 * go through software emulation. Otherwise we may have to throw
978 * away data. */
979 if (length < fifofull)
980 return parport_ieee1284_ecp_read_data(port, buf,
981 length, flags);
982
983 if (port->ieee1284.phase != IEEE1284_PH_REV_IDLE) {
984 /* change to reverse-idle phase (must be in forward-idle) */
985
986 /* Event 38: Set nAutoFd low (also make sure nStrobe is high) */
987 parport_frob_control(port,
988 PARPORT_CONTROL_AUTOFD
989 | PARPORT_CONTROL_STROBE,
990 PARPORT_CONTROL_AUTOFD);
991 parport_pc_data_reverse(port); /* Must be in PS2 mode */
992 udelay(5);
993 /* Event 39: Set nInit low to initiate bus reversal */
994 parport_frob_control(port,
995 PARPORT_CONTROL_INIT,
996 0);
997 /* Event 40: Wait for nAckReverse (PError) to go low */
998 r = parport_wait_peripheral(port, PARPORT_STATUS_PAPEROUT, 0);
999 if (r) {
1000 printk(KERN_DEBUG "%s: PE timeout Event 40 (%d) "
1001 "in ecp_read_block_pio\n", port->name, r);
1002 return 0;
1003 }
1004 }
1005
1006 /* Set up ECP FIFO mode.*/
1007/* parport_pc_frob_control(port,
1008 PARPORT_CONTROL_STROBE |
1009 PARPORT_CONTROL_AUTOFD,
1010 PARPORT_CONTROL_AUTOFD); */
1011 r = change_mode(port, ECR_ECP); /* ECP FIFO */
1012 if (r)
1013 printk(KERN_DEBUG "%s: Warning change_mode ECR_ECP failed\n",
1014 port->name);
1015
1016 port->ieee1284.phase = IEEE1284_PH_REV_DATA;
1017
1018 /* the first byte must be collected manually */
1019 dump_parport_state("pre 43", port);
1020 /* Event 43: Wait for nAck to go low */
1021 r = parport_wait_peripheral(port, PARPORT_STATUS_ACK, 0);
1022 if (r) {
1023 /* timed out while reading -- no data */
1024 printk(KERN_DEBUG "PIO read timed out (initial byte)\n");
1025 goto out_no_data;
1026 }
1027 /* read byte */
1028 *bufp++ = inb(DATA(port));
1029 left--;
1030 dump_parport_state("43-44", port);
1031 /* Event 44: nAutoFd (HostAck) goes high to acknowledge */
1032 parport_pc_frob_control(port,
1033 PARPORT_CONTROL_AUTOFD,
1034 0);
1035 dump_parport_state("pre 45", port);
1036 /* Event 45: Wait for nAck to go high */
1037 /* r = parport_wait_peripheral(port, PARPORT_STATUS_ACK,
1038 PARPORT_STATUS_ACK); */
1039 dump_parport_state("post 45", port);
1040 r = 0;
1041 if (r) {
1042 /* timed out while waiting for peripheral to respond to ack */
1043 printk(KERN_DEBUG "ECP PIO read timed out (waiting for nAck)\n");
1044
1045 /* keep hold of the byte we've got already */
1046 goto out_no_data;
1047 }
1048 /* Event 46: nAutoFd (HostAck) goes low to accept more data */
1049 parport_pc_frob_control(port,
1050 PARPORT_CONTROL_AUTOFD,
1051 PARPORT_CONTROL_AUTOFD);
1052
1053
1054 dump_parport_state("rev idle", port);
1055 /* Do the transfer. */
1056 while (left > fifofull) {
1057 int ret;
1058 unsigned long expire = jiffies + port->cad->timeout;
1059 unsigned char ecrval = inb(ECONTROL(port));
1060
1061 if (need_resched() && time_before(jiffies, expire))
1062 /* Can't yield the port. */
1063 schedule();
1064
1065 /* At this point, the FIFO may already be full. In
1066 * that case ECP is already holding back the
1067 * peripheral (assuming proper design) with a delayed
1068 * handshake. Work fast to avoid a peripheral
1069 * timeout. */
1070
1071 if (ecrval & 0x01) {
1072 /* FIFO is empty. Wait for interrupt. */
1073 dump_parport_state("FIFO empty", port);
1074
1075 /* Anyone else waiting for the port? */
1076 if (port->waithead) {
1077 printk(KERN_DEBUG "Somebody wants the port\n");
1078 break;
1079 }
1080
1081 /* Clear serviceIntr */
1082 ECR_WRITE(port, ecrval & ~(1<<2));
1083false_alarm:
1084 dump_parport_state("waiting", port);
1085 ret = parport_wait_event(port, HZ);
1086 DPRINTK(KERN_DEBUG "parport_wait_event returned %d\n",
1087 ret);
1088 if (ret < 0)
1089 break;
1090 ret = 0;
1091 if (!time_before(jiffies, expire)) {
1092 /* Timed out. */
1093 dump_parport_state("timeout", port);
1094 printk(KERN_DEBUG "PIO read timed out\n");
1095 break;
1096 }
1097 ecrval = inb(ECONTROL(port));
1098 if (!(ecrval & (1<<2))) {
1099 if (need_resched() &&
1100 time_before(jiffies, expire)) {
1101 schedule();
1102 }
1103 goto false_alarm;
1104 }
1105
1106 /* Depending on how the FIFO threshold was
1107 * set, how long interrupt service took, and
1108 * how fast the peripheral is, we might be
1109 * lucky and have a just filled FIFO. */
1110 continue;
1111 }
1112
1113 if (ecrval & 0x02) {
1114 /* FIFO is full. */
1115 dump_parport_state("FIFO full", port);
1116 insb(fifo, bufp, fifo_depth);
1117 bufp += fifo_depth;
1118 left -= fifo_depth;
1119 continue;
1120 }
1121
1122 DPRINTK(KERN_DEBUG
1123 "*** ecp_read_block_pio: reading one byte from the FIFO\n");
1124
1125 /* FIFO not filled. We will cycle this loop for a while
1126 * and either the peripheral will fill it faster,
1127 * tripping a fast empty with insb, or we empty it. */
1128 *bufp++ = inb(fifo);
1129 left--;
1130 }
1131
1132 /* scoop up anything left in the FIFO */
1133 while (left && !(inb(ECONTROL(port) & 0x01))) {
1134 *bufp++ = inb(fifo);
1135 left--;
1136 }
1137
1138 port->ieee1284.phase = IEEE1284_PH_REV_IDLE;
1139 dump_parport_state("rev idle2", port);
1140
1141out_no_data:
1142
1143 /* Go to forward idle mode to shut the peripheral up (event 47). */
1144 parport_frob_control(port, PARPORT_CONTROL_INIT, PARPORT_CONTROL_INIT);
1145
1146 /* event 49: PError goes high */
1147 r = parport_wait_peripheral(port,
1148 PARPORT_STATUS_PAPEROUT,
1149 PARPORT_STATUS_PAPEROUT);
1150 if (r) {
1151 printk(KERN_DEBUG
1152 "%s: PE timeout FWDIDLE (%d) in ecp_read_block_pio\n",
1153 port->name, r);
1154 }
1155
1156 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE;
1157
1158 /* Finish up. */
1159 {
1160 int lost = get_fifo_residue(port);
1161 if (lost)
1162 /* Shouldn't happen with compliant peripherals. */
1163 printk(KERN_DEBUG "%s: DATA LOSS (%d bytes)!\n",
1164 port->name, lost);
1165 }
1166
1167 dump_parport_state("fwd idle", port);
1168 return length - left;
1169}
1170#endif /* 0 */
1171#endif /* IEEE 1284 support */ 895#endif /* IEEE 1284 support */
1172#endif /* Allowed to use FIFO/DMA */ 896#endif /* Allowed to use FIFO/DMA */
1173 897
diff --git a/drivers/parport/parport_sunbpp.c b/drivers/parport/parport_sunbpp.c
index 9390a534a2b2..983a2d2df659 100644
--- a/drivers/parport/parport_sunbpp.c
+++ b/drivers/parport/parport_sunbpp.c
@@ -82,27 +82,6 @@ static unsigned char parport_sunbpp_read_data(struct parport *p)
82 return sbus_readb(&regs->p_dr); 82 return sbus_readb(&regs->p_dr);
83} 83}
84 84
85#if 0
86static void control_pc_to_sunbpp(struct parport *p, unsigned char status)
87{
88 struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->base;
89 unsigned char value_tcr = sbus_readb(&regs->p_tcr);
90 unsigned char value_or = sbus_readb(&regs->p_or);
91
92 if (status & PARPORT_CONTROL_STROBE)
93 value_tcr |= P_TCR_DS;
94 if (status & PARPORT_CONTROL_AUTOFD)
95 value_or |= P_OR_AFXN;
96 if (status & PARPORT_CONTROL_INIT)
97 value_or |= P_OR_INIT;
98 if (status & PARPORT_CONTROL_SELECT)
99 value_or |= P_OR_SLCT_IN;
100
101 sbus_writeb(value_or, &regs->p_or);
102 sbus_writeb(value_tcr, &regs->p_tcr);
103}
104#endif
105
106static unsigned char status_sunbpp_to_pc(struct parport *p) 85static unsigned char status_sunbpp_to_pc(struct parport *p)
107{ 86{
108 struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->base; 87 struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->base;
diff --git a/include/linux/spi/eeprom.h b/include/linux/spi/eeprom.h
index 306e7b1c69ed..403e007aef68 100644
--- a/include/linux/spi/eeprom.h
+++ b/include/linux/spi/eeprom.h
@@ -20,6 +20,16 @@ struct spi_eeprom {
20#define EE_ADDR3 0x0004 /* 24 bit addrs */ 20#define EE_ADDR3 0x0004 /* 24 bit addrs */
21#define EE_READONLY 0x0008 /* disallow writes */ 21#define EE_READONLY 0x0008 /* disallow writes */
22 22
23 /*
24 * Certain EEPROMS have a size that is larger than the number of address
25 * bytes would allow (e.g. like M95040 from ST that has 512 Byte size
26 * but uses only one address byte (A0 to A7) for addressing.) For
27 * the extra address bit (A8, A16 or A24) bit 3 of the instruction byte
28 * is used. This instruction bit is normally defined as don't care for
29 * other AT25 like chips.
30 */
31#define EE_INSTR_BIT3_IS_ADDR 0x0010
32
23 /* for exporting this chip's data to other kernel code */ 33 /* for exporting this chip's data to other kernel code */
24 void (*setup)(struct memory_accessor *mem, void *context); 34 void (*setup)(struct memory_accessor *mem, void *context);
25 void *context; 35 void *context;