Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Simple VME FMC Carrier SVEC - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Simple VME FMC Carrier SVEC - Software
Commits
d983e45b
Commit
d983e45b
authored
Jun 05, 2013
by
Luis Fernando Ruiz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
svec: i2c read eeprom in a single loop.
parent
ed648eaf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
19 deletions
+19
-19
i2c.c
kernel/i2c.c
+19
-19
No files found.
kernel/i2c.c
View file @
d983e45b
...
...
@@ -51,9 +51,9 @@ static inline int mezzanine_present(struct fmc_device *fmc)
uint32_t
presence
;
presence
=
fmc_readl
(
fmc
,
GLD_I2C_CORE_BASE
+
GLD_REG_CSR
);
printk
(
"presence: 0x%08x read from 0x%08x
\n
"
,
presence
,
GLD_I2C_CORE_BASE
+
GLD_REG_CSR
);
/*printk("presence: 0x%08x read from 0x%08x\n", presence, GLD_I2C_CORE_BASE + GLD_REG_CSR);*/
presence
=
GLD_CSR_FMC_PRESENT_R
(
presence
)
&
(
1
<<
fmc
->
slot_id
);
printk
(
"presence: 0x%08x
\n
"
,
presence
);
/*printk("presence: 0x%08x\n", presence);*/
return
presence
;
}
...
...
@@ -182,29 +182,29 @@ void mi2c_scan(struct fmc_device *fmc)
int
svec_eeprom_read
(
struct
fmc_device
*
fmc
,
uint32_t
offset
,
void
*
buf
,
size_t
size
)
{
int
i
;
uint8_t
*
buf8
=
buf
;
unsigned
char
c
;
int
ret
=
size
;
uint8_t
*
buf8
=
buf
;
int
i2c_addr
=
fmc
->
eeprom_addr
;
for
(
i
=
0
;
i
<
size
;
i
++
)
{
mi2c_start
(
fmc
);
if
(
mi2c_put_byte
(
fmc
,
i2c_addr
<<
1
)
<
0
)
{
mi2c_stop
(
fmc
);
return
-
EIO
;
}
mi2c_put_byte
(
fmc
,
(
offset
>>
8
)
&
0xff
);
mi2c_put_byte
(
fmc
,
offset
&
0xff
);
offset
++
;
mi2c_start
(
fmc
);
if
(
mi2c_put_byte
(
fmc
,
i2c_addr
<<
1
)
<
0
)
{
mi2c_stop
(
fmc
);
mi2c_start
(
fmc
);
mi2c_put_byte
(
fmc
,
(
i2c_addr
<<
1
)
|
1
);
mi2c_get_byte
(
fmc
,
&
c
,
0
);
return
-
EIO
;
}
mi2c_put_byte
(
fmc
,
(
offset
>>
8
)
&
0xff
);
mi2c_put_byte
(
fmc
,
offset
&
0xff
);
mi2c_stop
(
fmc
);
mi2c_start
(
fmc
);
mi2c_put_byte
(
fmc
,
(
i2c_addr
<<
1
)
|
1
);
while
(
size
--
)
{
mi2c_get_byte
(
fmc
,
&
c
,
size
!=
0
);
*
buf8
++
=
c
;
mi2c_stop
(
fmc
);
/*printk("read 0x%08x, %4i to go\n", c, size);*/
}
return
size
;
mi2c_stop
(
fmc
);
return
ret
;
}
int
svec_eeprom_write
(
struct
fmc_device
*
fmc
,
uint32_t
offset
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment