Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Software for White Rabbit PTP Core
Manage
Activity
Members
Labels
Plan
Issues
39
Issue boards
Milestones
Wiki
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
Software for White Rabbit PTP Core
Commits
f5a4a27c
Commit
f5a4a27c
authored
10 years ago
by
Grzegorz Daniluk
Browse files
Options
Downloads
Patches
Plain Diff
sdb-eeprom: adding erase function for i2c eeprom
parent
d5abb7e8
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dev/sdb-eeprom.c
+29
-0
29 additions, 0 deletions
dev/sdb-eeprom.c
with
29 additions
and
0 deletions
dev/sdb-eeprom.c
+
29
−
0
View file @
f5a4a27c
...
@@ -110,6 +110,34 @@ static int sdb_i2c_write(struct sdbfs *fs, int offset, void *buf, int count)
...
@@ -110,6 +110,34 @@ static int sdb_i2c_write(struct sdbfs *fs, int offset, void *buf, int count)
return
count
;
return
count
;
}
}
static
int
sdb_i2c_erase
(
struct
sdbfs
*
fs
,
int
offset
,
int
count
)
{
int
i
,
busy
;
struct
i2c_params
*
p
=
fs
->
drvdata
;
for
(
i
=
0
;
i
<
count
;
i
++
)
{
mi2c_start
(
p
->
ifnum
);
if
(
mi2c_put_byte
(
p
->
ifnum
,
p
->
addr
<<
1
)
<
0
)
{
mi2c_stop
(
p
->
ifnum
);
return
-
1
;
}
mi2c_put_byte
(
p
->
ifnum
,
(
offset
>>
8
)
&
0xff
);
mi2c_put_byte
(
p
->
ifnum
,
offset
&
0xff
);
mi2c_put_byte
(
p
->
ifnum
,
0xff
);
offset
++
;
mi2c_stop
(
p
->
ifnum
);
do
{
/* wait until the chip becomes ready */
mi2c_start
(
p
->
ifnum
);
busy
=
mi2c_put_byte
(
p
->
ifnum
,
p
->
addr
<<
1
);
mi2c_stop
(
p
->
ifnum
);
}
while
(
busy
);
}
return
count
;
}
/*
/*
* A trivial dumper, just to show what's up in there
* A trivial dumper, just to show what's up in there
*/
*/
...
@@ -186,6 +214,7 @@ void eeprom_init(int chosen_i2cif, int chosen_i2c_addr)
...
@@ -186,6 +214,7 @@ void eeprom_init(int chosen_i2cif, int chosen_i2c_addr)
wrc_sdb
.
drvdata
=
&
i2c_params
;
wrc_sdb
.
drvdata
=
&
i2c_params
;
wrc_sdb
.
read
=
sdb_i2c_read
;
wrc_sdb
.
read
=
sdb_i2c_read
;
wrc_sdb
.
write
=
sdb_i2c_write
;
wrc_sdb
.
write
=
sdb_i2c_write
;
wrc_sdb
.
erase
=
sdb_i2c_erase
;
goto
found_exit
;
goto
found_exit
;
}
}
if
(
i
==
ARRAY_SIZE
(
entry_points
))
{
if
(
i
==
ARRAY_SIZE
(
entry_points
))
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment