diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /drivers/misc/eeprom | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'drivers/misc/eeprom')
-rw-r--r-- | drivers/misc/eeprom/Kconfig | 4 | ||||
-rw-r--r-- | drivers/misc/eeprom/at24.c | 4 | ||||
-rw-r--r-- | drivers/misc/eeprom/at25.c | 129 | ||||
-rw-r--r-- | drivers/misc/eeprom/eeprom.c | 14 | ||||
-rw-r--r-- | drivers/misc/eeprom/eeprom_93cx6.c | 88 | ||||
-rw-r--r-- | drivers/misc/eeprom/eeprom_93xx46.c | 18 | ||||
-rw-r--r-- | drivers/misc/eeprom/max6875.c | 14 |
7 files changed, 76 insertions, 195 deletions
diff --git a/drivers/misc/eeprom/Kconfig b/drivers/misc/eeprom/Kconfig index c9e695ea7c9..26cf12ca7f5 100644 --- a/drivers/misc/eeprom/Kconfig +++ b/drivers/misc/eeprom/Kconfig | |||
@@ -50,7 +50,7 @@ config EEPROM_LEGACY | |||
50 | 50 | ||
51 | config EEPROM_MAX6875 | 51 | config EEPROM_MAX6875 |
52 | tristate "Maxim MAX6874/5 power supply supervisor" | 52 | tristate "Maxim MAX6874/5 power supply supervisor" |
53 | depends on I2C | 53 | depends on I2C && EXPERIMENTAL |
54 | help | 54 | help |
55 | If you say yes here you get read-only support for the user EEPROM of | 55 | If you say yes here you get read-only support for the user EEPROM of |
56 | the Maxim MAX6874/5 EEPROM-programmable, quad power-supply | 56 | the Maxim MAX6874/5 EEPROM-programmable, quad power-supply |
@@ -85,7 +85,7 @@ config EEPROM_93XX46 | |||
85 | 85 | ||
86 | config EEPROM_DIGSY_MTC_CFG | 86 | config EEPROM_DIGSY_MTC_CFG |
87 | bool "DigsyMTC display configuration EEPROMs device" | 87 | bool "DigsyMTC display configuration EEPROMs device" |
88 | depends on GPIO_MPC5200 && SPI_GPIO | 88 | depends on PPC_MPC5200_GPIO && GPIOLIB && SPI_GPIO |
89 | help | 89 | help |
90 | This option enables access to display configuration EEPROMs | 90 | This option enables access to display configuration EEPROMs |
91 | on digsy_mtc board. You have to additionally select Microwire | 91 | on digsy_mtc board. You have to additionally select Microwire |
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index 2baeec56edf..ab1ad41786d 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c | |||
@@ -656,7 +656,7 @@ err_out: | |||
656 | return err; | 656 | return err; |
657 | } | 657 | } |
658 | 658 | ||
659 | static int at24_remove(struct i2c_client *client) | 659 | static int __devexit at24_remove(struct i2c_client *client) |
660 | { | 660 | { |
661 | struct at24_data *at24; | 661 | struct at24_data *at24; |
662 | int i; | 662 | int i; |
@@ -680,7 +680,7 @@ static struct i2c_driver at24_driver = { | |||
680 | .owner = THIS_MODULE, | 680 | .owner = THIS_MODULE, |
681 | }, | 681 | }, |
682 | .probe = at24_probe, | 682 | .probe = at24_probe, |
683 | .remove = at24_remove, | 683 | .remove = __devexit_p(at24_remove), |
684 | .id_table = at24_ids, | 684 | .id_table = at24_ids, |
685 | }; | 685 | }; |
686 | 686 | ||
diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c index b08cf8a0878..c627e4174cc 100644 --- a/drivers/misc/eeprom/at25.c +++ b/drivers/misc/eeprom/at25.c | |||
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | #include <linux/spi/spi.h> | 20 | #include <linux/spi/spi.h> |
21 | #include <linux/spi/eeprom.h> | 21 | #include <linux/spi/eeprom.h> |
22 | #include <linux/of.h> | 22 | |
23 | 23 | ||
24 | /* | 24 | /* |
25 | * NOTE: this is an *EEPROM* driver. The vagaries of product naming | 25 | * NOTE: this is an *EEPROM* driver. The vagaries of product naming |
@@ -50,7 +50,6 @@ 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 */ | ||
54 | 53 | ||
55 | #define EE_MAXADDRLEN 3 /* 24 bit addresses, up to 2 MBytes */ | 54 | #define EE_MAXADDRLEN 3 /* 24 bit addresses, up to 2 MBytes */ |
56 | 55 | ||
@@ -76,7 +75,6 @@ at25_ee_read( | |||
76 | ssize_t status; | 75 | ssize_t status; |
77 | struct spi_transfer t[2]; | 76 | struct spi_transfer t[2]; |
78 | struct spi_message m; | 77 | struct spi_message m; |
79 | u8 instr; | ||
80 | 78 | ||
81 | if (unlikely(offset >= at25->bin.size)) | 79 | if (unlikely(offset >= at25->bin.size)) |
82 | return 0; | 80 | return 0; |
@@ -86,12 +84,7 @@ at25_ee_read( | |||
86 | return count; | 84 | return count; |
87 | 85 | ||
88 | cp = command; | 86 | cp = command; |
89 | 87 | *cp++ = AT25_READ; | |
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; | ||
95 | 88 | ||
96 | /* 8/16/24-bit address is written MSB first */ | 89 | /* 8/16/24-bit address is written MSB first */ |
97 | switch (at25->addrlen) { | 90 | switch (at25->addrlen) { |
@@ -174,14 +167,14 @@ at25_ee_write(struct at25_data *at25, const char *buf, loff_t off, | |||
174 | /* For write, rollover is within the page ... so we write at | 167 | /* For write, rollover is within the page ... so we write at |
175 | * most one page, then manually roll over to the next page. | 168 | * most one page, then manually roll over to the next page. |
176 | */ | 169 | */ |
170 | bounce[0] = AT25_WRITE; | ||
177 | mutex_lock(&at25->lock); | 171 | mutex_lock(&at25->lock); |
178 | do { | 172 | do { |
179 | unsigned long timeout, retries; | 173 | unsigned long timeout, retries; |
180 | unsigned segment; | 174 | unsigned segment; |
181 | unsigned offset = (unsigned) off; | 175 | unsigned offset = (unsigned) off; |
182 | u8 *cp = bounce; | 176 | u8 *cp = bounce + 1; |
183 | int sr; | 177 | int sr; |
184 | u8 instr; | ||
185 | 178 | ||
186 | *cp = AT25_WREN; | 179 | *cp = AT25_WREN; |
187 | status = spi_write(at25->spi, cp, 1); | 180 | status = spi_write(at25->spi, cp, 1); |
@@ -191,12 +184,6 @@ at25_ee_write(struct at25_data *at25, const char *buf, loff_t off, | |||
191 | break; | 184 | break; |
192 | } | 185 | } |
193 | 186 | ||
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 | |||
200 | /* 8/16/24-bit address is written MSB first */ | 187 | /* 8/16/24-bit address is written MSB first */ |
201 | switch (at25->addrlen) { | 188 | switch (at25->addrlen) { |
202 | default: /* case 3 */ | 189 | default: /* case 3 */ |
@@ -302,90 +289,28 @@ static ssize_t at25_mem_write(struct memory_accessor *mem, const char *buf, | |||
302 | 289 | ||
303 | /*-------------------------------------------------------------------------*/ | 290 | /*-------------------------------------------------------------------------*/ |
304 | 291 | ||
305 | static int at25_np_to_chip(struct device *dev, | ||
306 | struct device_node *np, | ||
307 | struct spi_eeprom *chip) | ||
308 | { | ||
309 | u32 val; | ||
310 | |||
311 | memset(chip, 0, sizeof(*chip)); | ||
312 | strncpy(chip->name, np->name, sizeof(chip->name)); | ||
313 | |||
314 | if (of_property_read_u32(np, "size", &val) == 0 || | ||
315 | of_property_read_u32(np, "at25,byte-len", &val) == 0) { | ||
316 | chip->byte_len = val; | ||
317 | } else { | ||
318 | dev_err(dev, "Error: missing \"size\" property\n"); | ||
319 | return -ENODEV; | ||
320 | } | ||
321 | |||
322 | if (of_property_read_u32(np, "pagesize", &val) == 0 || | ||
323 | of_property_read_u32(np, "at25,page-size", &val) == 0) { | ||
324 | chip->page_size = (u16)val; | ||
325 | } else { | ||
326 | dev_err(dev, "Error: missing \"pagesize\" property\n"); | ||
327 | return -ENODEV; | ||
328 | } | ||
329 | |||
330 | if (of_property_read_u32(np, "at25,addr-mode", &val) == 0) { | ||
331 | chip->flags = (u16)val; | ||
332 | } else { | ||
333 | if (of_property_read_u32(np, "address-width", &val)) { | ||
334 | dev_err(dev, | ||
335 | "Error: missing \"address-width\" property\n"); | ||
336 | return -ENODEV; | ||
337 | } | ||
338 | switch (val) { | ||
339 | case 8: | ||
340 | chip->flags |= EE_ADDR1; | ||
341 | break; | ||
342 | case 16: | ||
343 | chip->flags |= EE_ADDR2; | ||
344 | break; | ||
345 | case 24: | ||
346 | chip->flags |= EE_ADDR3; | ||
347 | break; | ||
348 | default: | ||
349 | dev_err(dev, | ||
350 | "Error: bad \"address-width\" property: %u\n", | ||
351 | val); | ||
352 | return -ENODEV; | ||
353 | } | ||
354 | if (of_find_property(np, "read-only", NULL)) | ||
355 | chip->flags |= EE_READONLY; | ||
356 | } | ||
357 | return 0; | ||
358 | } | ||
359 | |||
360 | static int at25_probe(struct spi_device *spi) | 292 | static int at25_probe(struct spi_device *spi) |
361 | { | 293 | { |
362 | struct at25_data *at25 = NULL; | 294 | struct at25_data *at25 = NULL; |
363 | struct spi_eeprom chip; | 295 | const struct spi_eeprom *chip; |
364 | struct device_node *np = spi->dev.of_node; | ||
365 | int err; | 296 | int err; |
366 | int sr; | 297 | int sr; |
367 | int addrlen; | 298 | int addrlen; |
368 | 299 | ||
369 | /* Chip description */ | 300 | /* Chip description */ |
370 | if (!spi->dev.platform_data) { | 301 | chip = spi->dev.platform_data; |
371 | if (np) { | 302 | if (!chip) { |
372 | err = at25_np_to_chip(&spi->dev, np, &chip); | 303 | dev_dbg(&spi->dev, "no chip description\n"); |
373 | if (err) | 304 | err = -ENODEV; |
374 | goto fail; | 305 | goto fail; |
375 | } else { | 306 | } |
376 | dev_err(&spi->dev, "Error: no chip description\n"); | ||
377 | err = -ENODEV; | ||
378 | goto fail; | ||
379 | } | ||
380 | } else | ||
381 | chip = *(struct spi_eeprom *)spi->dev.platform_data; | ||
382 | 307 | ||
383 | /* For now we only support 8/16/24 bit addressing */ | 308 | /* For now we only support 8/16/24 bit addressing */ |
384 | if (chip.flags & EE_ADDR1) | 309 | if (chip->flags & EE_ADDR1) |
385 | addrlen = 1; | 310 | addrlen = 1; |
386 | else if (chip.flags & EE_ADDR2) | 311 | else if (chip->flags & EE_ADDR2) |
387 | addrlen = 2; | 312 | addrlen = 2; |
388 | else if (chip.flags & EE_ADDR3) | 313 | else if (chip->flags & EE_ADDR3) |
389 | addrlen = 3; | 314 | addrlen = 3; |
390 | else { | 315 | else { |
391 | dev_dbg(&spi->dev, "unsupported address type\n"); | 316 | dev_dbg(&spi->dev, "unsupported address type\n"); |
@@ -410,7 +335,7 @@ static int at25_probe(struct spi_device *spi) | |||
410 | } | 335 | } |
411 | 336 | ||
412 | mutex_init(&at25->lock); | 337 | mutex_init(&at25->lock); |
413 | at25->chip = chip; | 338 | at25->chip = *chip; |
414 | at25->spi = spi_dev_get(spi); | 339 | at25->spi = spi_dev_get(spi); |
415 | dev_set_drvdata(&spi->dev, at25); | 340 | dev_set_drvdata(&spi->dev, at25); |
416 | at25->addrlen = addrlen; | 341 | at25->addrlen = addrlen; |
@@ -431,7 +356,7 @@ static int at25_probe(struct spi_device *spi) | |||
431 | at25->mem.read = at25_mem_read; | 356 | at25->mem.read = at25_mem_read; |
432 | 357 | ||
433 | at25->bin.size = at25->chip.byte_len; | 358 | at25->bin.size = at25->chip.byte_len; |
434 | if (!(chip.flags & EE_READONLY)) { | 359 | if (!(chip->flags & EE_READONLY)) { |
435 | at25->bin.write = at25_bin_write; | 360 | at25->bin.write = at25_bin_write; |
436 | at25->bin.attr.mode |= S_IWUSR; | 361 | at25->bin.attr.mode |= S_IWUSR; |
437 | at25->mem.write = at25_mem_write; | 362 | at25->mem.write = at25_mem_write; |
@@ -441,8 +366,8 @@ static int at25_probe(struct spi_device *spi) | |||
441 | if (err) | 366 | if (err) |
442 | goto fail; | 367 | goto fail; |
443 | 368 | ||
444 | if (chip.setup) | 369 | if (chip->setup) |
445 | chip.setup(&at25->mem, chip.context); | 370 | chip->setup(&at25->mem, chip->context); |
446 | 371 | ||
447 | dev_info(&spi->dev, "%Zd %s %s eeprom%s, pagesize %u\n", | 372 | dev_info(&spi->dev, "%Zd %s %s eeprom%s, pagesize %u\n", |
448 | (at25->bin.size < 1024) | 373 | (at25->bin.size < 1024) |
@@ -450,7 +375,7 @@ static int at25_probe(struct spi_device *spi) | |||
450 | : (at25->bin.size / 1024), | 375 | : (at25->bin.size / 1024), |
451 | (at25->bin.size < 1024) ? "Byte" : "KByte", | 376 | (at25->bin.size < 1024) ? "Byte" : "KByte", |
452 | at25->chip.name, | 377 | at25->chip.name, |
453 | (chip.flags & EE_READONLY) ? " (readonly)" : "", | 378 | (chip->flags & EE_READONLY) ? " (readonly)" : "", |
454 | at25->chip.page_size); | 379 | at25->chip.page_size); |
455 | return 0; | 380 | return 0; |
456 | fail: | 381 | fail: |
@@ -459,7 +384,7 @@ fail: | |||
459 | return err; | 384 | return err; |
460 | } | 385 | } |
461 | 386 | ||
462 | static int at25_remove(struct spi_device *spi) | 387 | static int __devexit at25_remove(struct spi_device *spi) |
463 | { | 388 | { |
464 | struct at25_data *at25; | 389 | struct at25_data *at25; |
465 | 390 | ||
@@ -477,10 +402,20 @@ static struct spi_driver at25_driver = { | |||
477 | .owner = THIS_MODULE, | 402 | .owner = THIS_MODULE, |
478 | }, | 403 | }, |
479 | .probe = at25_probe, | 404 | .probe = at25_probe, |
480 | .remove = at25_remove, | 405 | .remove = __devexit_p(at25_remove), |
481 | }; | 406 | }; |
482 | 407 | ||
483 | module_spi_driver(at25_driver); | 408 | static int __init at25_init(void) |
409 | { | ||
410 | return spi_register_driver(&at25_driver); | ||
411 | } | ||
412 | module_init(at25_init); | ||
413 | |||
414 | static void __exit at25_exit(void) | ||
415 | { | ||
416 | spi_unregister_driver(&at25_driver); | ||
417 | } | ||
418 | module_exit(at25_exit); | ||
484 | 419 | ||
485 | MODULE_DESCRIPTION("Driver for most SPI EEPROMs"); | 420 | MODULE_DESCRIPTION("Driver for most SPI EEPROMs"); |
486 | MODULE_AUTHOR("David Brownell"); | 421 | MODULE_AUTHOR("David Brownell"); |
diff --git a/drivers/misc/eeprom/eeprom.c b/drivers/misc/eeprom/eeprom.c index c169e07654c..45060ddc4e5 100644 --- a/drivers/misc/eeprom/eeprom.c +++ b/drivers/misc/eeprom/eeprom.c | |||
@@ -229,10 +229,22 @@ static struct i2c_driver eeprom_driver = { | |||
229 | .address_list = normal_i2c, | 229 | .address_list = normal_i2c, |
230 | }; | 230 | }; |
231 | 231 | ||
232 | module_i2c_driver(eeprom_driver); | 232 | static int __init eeprom_init(void) |
233 | { | ||
234 | return i2c_add_driver(&eeprom_driver); | ||
235 | } | ||
236 | |||
237 | static void __exit eeprom_exit(void) | ||
238 | { | ||
239 | i2c_del_driver(&eeprom_driver); | ||
240 | } | ||
241 | |||
233 | 242 | ||
234 | MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl> and " | 243 | MODULE_AUTHOR("Frodo Looijaard <frodol@dds.nl> and " |
235 | "Philip Edelbrock <phil@netroedge.com> and " | 244 | "Philip Edelbrock <phil@netroedge.com> and " |
236 | "Greg Kroah-Hartman <greg@kroah.com>"); | 245 | "Greg Kroah-Hartman <greg@kroah.com>"); |
237 | MODULE_DESCRIPTION("I2C EEPROM driver"); | 246 | MODULE_DESCRIPTION("I2C EEPROM driver"); |
238 | MODULE_LICENSE("GPL"); | 247 | MODULE_LICENSE("GPL"); |
248 | |||
249 | module_init(eeprom_init); | ||
250 | module_exit(eeprom_exit); | ||
diff --git a/drivers/misc/eeprom/eeprom_93cx6.c b/drivers/misc/eeprom/eeprom_93cx6.c index 0ff4b02177b..7b33de95c4b 100644 --- a/drivers/misc/eeprom/eeprom_93cx6.c +++ b/drivers/misc/eeprom/eeprom_93cx6.c | |||
@@ -63,7 +63,6 @@ static void eeprom_93cx6_startup(struct eeprom_93cx6 *eeprom) | |||
63 | eeprom->reg_data_out = 0; | 63 | eeprom->reg_data_out = 0; |
64 | eeprom->reg_data_clock = 0; | 64 | eeprom->reg_data_clock = 0; |
65 | eeprom->reg_chip_select = 1; | 65 | eeprom->reg_chip_select = 1; |
66 | eeprom->drive_data = 1; | ||
67 | eeprom->register_write(eeprom); | 66 | eeprom->register_write(eeprom); |
68 | 67 | ||
69 | /* | 68 | /* |
@@ -102,7 +101,6 @@ static void eeprom_93cx6_write_bits(struct eeprom_93cx6 *eeprom, | |||
102 | */ | 101 | */ |
103 | eeprom->reg_data_in = 0; | 102 | eeprom->reg_data_in = 0; |
104 | eeprom->reg_data_out = 0; | 103 | eeprom->reg_data_out = 0; |
105 | eeprom->drive_data = 1; | ||
106 | 104 | ||
107 | /* | 105 | /* |
108 | * Start writing all bits. | 106 | * Start writing all bits. |
@@ -142,7 +140,6 @@ static void eeprom_93cx6_read_bits(struct eeprom_93cx6 *eeprom, | |||
142 | */ | 140 | */ |
143 | eeprom->reg_data_in = 0; | 141 | eeprom->reg_data_in = 0; |
144 | eeprom->reg_data_out = 0; | 142 | eeprom->reg_data_out = 0; |
145 | eeprom->drive_data = 0; | ||
146 | 143 | ||
147 | /* | 144 | /* |
148 | * Start reading all bits. | 145 | * Start reading all bits. |
@@ -234,88 +231,3 @@ void eeprom_93cx6_multiread(struct eeprom_93cx6 *eeprom, const u8 word, | |||
234 | } | 231 | } |
235 | EXPORT_SYMBOL_GPL(eeprom_93cx6_multiread); | 232 | EXPORT_SYMBOL_GPL(eeprom_93cx6_multiread); |
236 | 233 | ||
237 | /** | ||
238 | * eeprom_93cx6_wren - set the write enable state | ||
239 | * @eeprom: Pointer to eeprom structure | ||
240 | * @enable: true to enable writes, otherwise disable writes | ||
241 | * | ||
242 | * Set the EEPROM write enable state to either allow or deny | ||
243 | * writes depending on the @enable value. | ||
244 | */ | ||
245 | void eeprom_93cx6_wren(struct eeprom_93cx6 *eeprom, bool enable) | ||
246 | { | ||
247 | u16 command; | ||
248 | |||
249 | /* start the command */ | ||
250 | eeprom_93cx6_startup(eeprom); | ||
251 | |||
252 | /* create command to enable/disable */ | ||
253 | |||
254 | command = enable ? PCI_EEPROM_EWEN_OPCODE : PCI_EEPROM_EWDS_OPCODE; | ||
255 | command <<= (eeprom->width - 2); | ||
256 | |||
257 | eeprom_93cx6_write_bits(eeprom, command, | ||
258 | PCI_EEPROM_WIDTH_OPCODE + eeprom->width); | ||
259 | |||
260 | eeprom_93cx6_cleanup(eeprom); | ||
261 | } | ||
262 | EXPORT_SYMBOL_GPL(eeprom_93cx6_wren); | ||
263 | |||
264 | /** | ||
265 | * eeprom_93cx6_write - write data to the EEPROM | ||
266 | * @eeprom: Pointer to eeprom structure | ||
267 | * @addr: Address to write data to. | ||
268 | * @data: The data to write to address @addr. | ||
269 | * | ||
270 | * Write the @data to the specified @addr in the EEPROM and | ||
271 | * waiting for the device to finish writing. | ||
272 | * | ||
273 | * Note, since we do not expect large number of write operations | ||
274 | * we delay in between parts of the operation to avoid using excessive | ||
275 | * amounts of CPU time busy waiting. | ||
276 | */ | ||
277 | void eeprom_93cx6_write(struct eeprom_93cx6 *eeprom, u8 addr, u16 data) | ||
278 | { | ||
279 | int timeout = 100; | ||
280 | u16 command; | ||
281 | |||
282 | /* start the command */ | ||
283 | eeprom_93cx6_startup(eeprom); | ||
284 | |||
285 | command = PCI_EEPROM_WRITE_OPCODE << eeprom->width; | ||
286 | command |= addr; | ||
287 | |||
288 | /* send write command */ | ||
289 | eeprom_93cx6_write_bits(eeprom, command, | ||
290 | PCI_EEPROM_WIDTH_OPCODE + eeprom->width); | ||
291 | |||
292 | /* send data */ | ||
293 | eeprom_93cx6_write_bits(eeprom, data, 16); | ||
294 | |||
295 | /* get ready to check for busy */ | ||
296 | eeprom->drive_data = 0; | ||
297 | eeprom->reg_chip_select = 1; | ||
298 | eeprom->register_write(eeprom); | ||
299 | |||
300 | /* wait at-least 250ns to get DO to be the busy signal */ | ||
301 | usleep_range(1000, 2000); | ||
302 | |||
303 | /* wait for DO to go high to signify finish */ | ||
304 | |||
305 | while (true) { | ||
306 | eeprom->register_read(eeprom); | ||
307 | |||
308 | if (eeprom->reg_data_out) | ||
309 | break; | ||
310 | |||
311 | usleep_range(1000, 2000); | ||
312 | |||
313 | if (--timeout <= 0) { | ||
314 | printk(KERN_ERR "%s: timeout\n", __func__); | ||
315 | break; | ||
316 | } | ||
317 | } | ||
318 | |||
319 | eeprom_93cx6_cleanup(eeprom); | ||
320 | } | ||
321 | EXPORT_SYMBOL_GPL(eeprom_93cx6_write); | ||
diff --git a/drivers/misc/eeprom/eeprom_93xx46.c b/drivers/misc/eeprom/eeprom_93xx46.c index a6b5d5e7348..0c7ebb1e19e 100644 --- a/drivers/misc/eeprom/eeprom_93xx46.c +++ b/drivers/misc/eeprom/eeprom_93xx46.c | |||
@@ -309,7 +309,7 @@ static ssize_t eeprom_93xx46_store_erase(struct device *dev, | |||
309 | } | 309 | } |
310 | static DEVICE_ATTR(erase, S_IWUSR, NULL, eeprom_93xx46_store_erase); | 310 | static DEVICE_ATTR(erase, S_IWUSR, NULL, eeprom_93xx46_store_erase); |
311 | 311 | ||
312 | static int eeprom_93xx46_probe(struct spi_device *spi) | 312 | static int __devinit eeprom_93xx46_probe(struct spi_device *spi) |
313 | { | 313 | { |
314 | struct eeprom_93xx46_platform_data *pd; | 314 | struct eeprom_93xx46_platform_data *pd; |
315 | struct eeprom_93xx46_dev *edev; | 315 | struct eeprom_93xx46_dev *edev; |
@@ -370,7 +370,7 @@ fail: | |||
370 | return err; | 370 | return err; |
371 | } | 371 | } |
372 | 372 | ||
373 | static int eeprom_93xx46_remove(struct spi_device *spi) | 373 | static int __devexit eeprom_93xx46_remove(struct spi_device *spi) |
374 | { | 374 | { |
375 | struct eeprom_93xx46_dev *edev = dev_get_drvdata(&spi->dev); | 375 | struct eeprom_93xx46_dev *edev = dev_get_drvdata(&spi->dev); |
376 | 376 | ||
@@ -389,10 +389,20 @@ static struct spi_driver eeprom_93xx46_driver = { | |||
389 | .owner = THIS_MODULE, | 389 | .owner = THIS_MODULE, |
390 | }, | 390 | }, |
391 | .probe = eeprom_93xx46_probe, | 391 | .probe = eeprom_93xx46_probe, |
392 | .remove = eeprom_93xx46_remove, | 392 | .remove = __devexit_p(eeprom_93xx46_remove), |
393 | }; | 393 | }; |
394 | 394 | ||
395 | module_spi_driver(eeprom_93xx46_driver); | 395 | static int __init eeprom_93xx46_init(void) |
396 | { | ||
397 | return spi_register_driver(&eeprom_93xx46_driver); | ||
398 | } | ||
399 | module_init(eeprom_93xx46_init); | ||
400 | |||
401 | static void __exit eeprom_93xx46_exit(void) | ||
402 | { | ||
403 | spi_unregister_driver(&eeprom_93xx46_driver); | ||
404 | } | ||
405 | module_exit(eeprom_93xx46_exit); | ||
396 | 406 | ||
397 | MODULE_LICENSE("GPL"); | 407 | MODULE_LICENSE("GPL"); |
398 | MODULE_DESCRIPTION("Driver for 93xx46 EEPROMs"); | 408 | MODULE_DESCRIPTION("Driver for 93xx46 EEPROMs"); |
diff --git a/drivers/misc/eeprom/max6875.c b/drivers/misc/eeprom/max6875.c index e36157d5d3a..5653a3ce051 100644 --- a/drivers/misc/eeprom/max6875.c +++ b/drivers/misc/eeprom/max6875.c | |||
@@ -208,8 +208,20 @@ static struct i2c_driver max6875_driver = { | |||
208 | .id_table = max6875_id, | 208 | .id_table = max6875_id, |
209 | }; | 209 | }; |
210 | 210 | ||
211 | module_i2c_driver(max6875_driver); | 211 | static int __init max6875_init(void) |
212 | { | ||
213 | return i2c_add_driver(&max6875_driver); | ||
214 | } | ||
215 | |||
216 | static void __exit max6875_exit(void) | ||
217 | { | ||
218 | i2c_del_driver(&max6875_driver); | ||
219 | } | ||
220 | |||
212 | 221 | ||
213 | MODULE_AUTHOR("Ben Gardner <bgardner@wabtec.com>"); | 222 | MODULE_AUTHOR("Ben Gardner <bgardner@wabtec.com>"); |
214 | MODULE_DESCRIPTION("MAX6875 driver"); | 223 | MODULE_DESCRIPTION("MAX6875 driver"); |
215 | MODULE_LICENSE("GPL"); | 224 | MODULE_LICENSE("GPL"); |
225 | |||
226 | module_init(max6875_init); | ||
227 | module_exit(max6875_exit); | ||