diff options
author | Jesper Nilsson <jesper.nilsson@axis.com> | 2008-01-17 08:50:47 -0500 |
---|---|---|
committer | Jesper Nilsson <jesper.nilsson@axis.com> | 2008-02-08 05:06:29 -0500 |
commit | e5d5cf2442038b8ad3e0f90b00e5acdd18d5fa98 (patch) | |
tree | 5f1307e1a0a2081c22d941264828559a6c3a2e2c /arch/cris | |
parent | 3d6c03fc223e6ed3b7cb4cf850a7da4a376d02d3 (diff) |
CRIS v10: Fix bugs in i2c_init and i2c_readreg
- Set the variable first to zero after first setup, so we can
stop multiple calls to i2c_init from trying to setup i2c.
- The last byte read by the master in an i2c transfer needs to
be NACKed, not ACKed.
- Also, remove useless CVS log and CVS id tags.
Diffstat (limited to 'arch/cris')
-rw-r--r-- | arch/cris/arch-v10/drivers/i2c.c | 81 |
1 files changed, 3 insertions, 78 deletions
diff --git a/arch/cris/arch-v10/drivers/i2c.c b/arch/cris/arch-v10/drivers/i2c.c index aca81ddaf60f..d6d22067d0c8 100644 --- a/arch/cris/arch-v10/drivers/i2c.c +++ b/arch/cris/arch-v10/drivers/i2c.c | |||
@@ -6,85 +6,9 @@ | |||
6 | *! kernel modules (i2c_writereg/readreg) and from userspace using | 6 | *! kernel modules (i2c_writereg/readreg) and from userspace using |
7 | *! ioctl()'s | 7 | *! ioctl()'s |
8 | *! | 8 | *! |
9 | *! Nov 30 1998 Torbjorn Eliasson Initial version. | 9 | *! (C) Copyright 1999-2007 Axis Communications AB, LUND, SWEDEN |
10 | *! Bjorn Wesen Elinux kernel version. | ||
11 | *! Jan 14 2000 Johan Adolfsson Fixed PB shadow register stuff - | ||
12 | *! don't use PB_I2C if DS1302 uses same bits, | ||
13 | *! use PB. | ||
14 | *! $Log: i2c.c,v $ | ||
15 | *! Revision 1.13 2005/03/07 13:13:07 starvik | ||
16 | *! Added spinlocks to protect states etc | ||
17 | *! | ||
18 | *! Revision 1.12 2005/01/05 06:11:22 starvik | ||
19 | *! No need to do local_irq_disable after local_irq_save. | ||
20 | *! | ||
21 | *! Revision 1.11 2004/12/13 12:21:52 starvik | ||
22 | *! Added I/O and DMA allocators from Linux 2.4 | ||
23 | *! | ||
24 | *! Revision 1.9 2004/08/24 06:49:14 starvik | ||
25 | *! Whitespace cleanup | ||
26 | *! | ||
27 | *! Revision 1.8 2004/06/08 08:48:26 starvik | ||
28 | *! Removed unused code | ||
29 | *! | ||
30 | *! Revision 1.7 2004/05/28 09:26:59 starvik | ||
31 | *! Modified I2C initialization to work in 2.6. | ||
32 | *! | ||
33 | *! Revision 1.6 2004/05/14 07:58:03 starvik | ||
34 | *! Merge of changes from 2.4 | ||
35 | *! | ||
36 | *! Revision 1.4 2002/12/11 13:13:57 starvik | ||
37 | *! Added arch/ to v10 specific includes | ||
38 | *! Added fix from Linux 2.4 in serial.c (flush_to_flip_buffer) | ||
39 | *! | ||
40 | *! Revision 1.3 2002/11/20 11:56:11 starvik | ||
41 | *! Merge of Linux 2.5.48 | ||
42 | *! | ||
43 | *! Revision 1.2 2002/11/18 13:16:06 starvik | ||
44 | *! Linux 2.5 port of latest 2.4 drivers | ||
45 | *! | ||
46 | *! Revision 1.9 2002/10/31 15:32:26 starvik | ||
47 | *! Update Port B register and shadow even when running with hardware support | ||
48 | *! to avoid glitches when reading bits | ||
49 | *! Never set direction to out in i2c_inbyte | ||
50 | *! Removed incorrect clock toggling at end of i2c_inbyte | ||
51 | *! | ||
52 | *! Revision 1.8 2002/08/13 06:31:53 starvik | ||
53 | *! Made SDA and SCL line configurable | ||
54 | *! Modified i2c_inbyte to work with PCF8563 | ||
55 | *! | ||
56 | *! Revision 1.7 2001/04/04 13:11:36 markusl | ||
57 | *! Updated according to review remarks | ||
58 | *! | ||
59 | *! Revision 1.6 2001/03/19 12:43:00 markusl | ||
60 | *! Made some symbols unstatic (used by the eeprom driver) | ||
61 | *! | ||
62 | *! Revision 1.5 2001/02/27 13:52:48 bjornw | ||
63 | *! malloc.h -> slab.h | ||
64 | *! | ||
65 | *! Revision 1.4 2001/02/15 07:17:40 starvik | ||
66 | *! Corrected usage if port_pb_i2c_shadow | ||
67 | *! | ||
68 | *! Revision 1.3 2001/01/26 17:55:13 bjornw | ||
69 | *! * Made I2C_USES_PB_NOT_PB_I2C a CONFIG option instead of assigning it | ||
70 | *! magically. Config.in needs to set it for the options that need it, like | ||
71 | *! Dallas 1302 support. Actually, it should be default since it screws up | ||
72 | *! the PB bits even if you don't use I2C.. | ||
73 | *! * Include linux/config.h to get the above | ||
74 | *! | ||
75 | *! Revision 1.2 2001/01/18 15:49:30 bjornw | ||
76 | *! 2.4 port of I2C including some cleanups (untested of course) | ||
77 | *! | ||
78 | *! Revision 1.1 2001/01/18 15:35:25 bjornw | ||
79 | *! Verbatim copy of the Etrax i2c driver, 2.0 elinux version | ||
80 | *! | ||
81 | *! | ||
82 | *! --------------------------------------------------------------------------- | ||
83 | *! | ||
84 | *! (C) Copyright 1999-2002 Axis Communications AB, LUND, SWEDEN | ||
85 | *! | 10 | *! |
86 | *!***************************************************************************/ | 11 | *!***************************************************************************/ |
87 | /* $Id: i2c.c,v 1.13 2005/03/07 13:13:07 starvik Exp $ */ | ||
88 | 12 | ||
89 | /****************** INCLUDE FILES SECTION ***********************************/ | 13 | /****************** INCLUDE FILES SECTION ***********************************/ |
90 | 14 | ||
@@ -622,7 +546,7 @@ i2c_readreg(unsigned char theSlave, unsigned char theReg) | |||
622 | * last received byte needs to be nacked | 546 | * last received byte needs to be nacked |
623 | * instead of acked | 547 | * instead of acked |
624 | */ | 548 | */ |
625 | i2c_sendack(); | 549 | i2c_sendnack(); |
626 | /* | 550 | /* |
627 | * end sequence | 551 | * end sequence |
628 | */ | 552 | */ |
@@ -708,6 +632,7 @@ i2c_init(void) | |||
708 | if (!first) { | 632 | if (!first) { |
709 | return res; | 633 | return res; |
710 | } | 634 | } |
635 | first = 0; | ||
711 | 636 | ||
712 | /* Setup and enable the Port B I2C interface */ | 637 | /* Setup and enable the Port B I2C interface */ |
713 | 638 | ||