Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Simple PCIe FMC carrier SPEC - Software
Manage
Activity
Members
Labels
Plan
Issues
3
Issue boards
Milestones
Wiki
Code
Merge requests
0
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
Simple PCIe FMC carrier SPEC - Software
Commits
bca8e532
Commit
bca8e532
authored
12 years ago
by
Alessandro Rubini
Browse files
Options
Downloads
Patches
Plain Diff
spec-i2c.c: renamed constants, moved to header
parent
7c47276e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
kernel/spec-i2c.c
+6
-9
6 additions, 9 deletions
kernel/spec-i2c.c
kernel/spec.h
+8
-0
8 additions, 0 deletions
kernel/spec.h
with
14 additions
and
9 deletions
kernel/spec-i2c.c
+
6
−
9
View file @
bca8e532
...
...
@@ -23,10 +23,6 @@
static
int
spec_i2c_dump
;
module_param_named
(
i2c_dump
,
spec_i2c_dump
,
int
,
0444
);
/* The eeprom is at address 0x50 */
#define I2C_ADDR 0x50
#define I2C_SIZE (8 * 1024)
/* Stupid dumping tool */
static
void
dumpstruct
(
char
*
name
,
void
*
ptr
,
int
size
)
{
...
...
@@ -206,22 +202,23 @@ int spec_i2c_init(struct fmc_device *fmc)
mi2c_scan
(
fmc
);
buf
=
kmalloc
(
I2C
_SIZE
,
GFP_KERNEL
);
buf
=
kmalloc
(
SPEC_I2C_EEPROM
_SIZE
,
GFP_KERNEL
);
if
(
!
buf
)
return
-
ENOMEM
;
i
=
spec_eeprom_read
(
fmc
,
I2C_ADDR
,
0
,
buf
,
I2C_SIZE
);
if
(
i
!=
I2C_SIZE
)
{
i
=
spec_eeprom_read
(
fmc
,
SPEC_I2C_EEPROM_ADDR
,
0
,
buf
,
SPEC_I2C_EEPROM_SIZE
);
if
(
i
!=
SPEC_I2C_EEPROM_SIZE
)
{
dev_err
(
&
spec
->
pdev
->
dev
,
"EEPROM read error: retval is %i
\n
"
,
i
);
kfree
(
buf
);
return
-
EIO
;
}
fmc
->
eeprom
=
buf
;
fmc
->
eeprom_len
=
I2C
_SIZE
;
fmc
->
eeprom_len
=
SPEC_I2C_EEPROM
_SIZE
;
if
(
spec_i2c_dump
)
dumpstruct
(
"eeprom"
,
buf
,
I2C
_SIZE
);
dumpstruct
(
"eeprom"
,
buf
,
SPEC_I2C_EEPROM
_SIZE
);
return
0
;
}
...
...
This diff is collapsed.
Click to expand it.
kernel/spec.h
+
8
−
0
View file @
bca8e532
...
...
@@ -123,6 +123,14 @@ extern void spec_fmc_destroy(struct spec_dev *spec);
/* Functions in spec-i2c.c, used by spec-fmc.c */
extern
int
spec_i2c_init
(
struct
fmc_device
*
fmc
);
extern
void
spec_i2c_exit
(
struct
fmc_device
*
fmc
);
extern
int
spec_eeprom_read
(
struct
fmc_device
*
fmc
,
int
i2c_addr
,
uint32_t
offset
,
void
*
buf
,
size_t
size
);
extern
int
spec_eeprom_write
(
struct
fmc_device
*
fmc
,
int
i2c_addr
,
uint32_t
offset
,
void
*
buf
,
size_t
size
);
/* The eeprom is at address 0x50 */
#define SPEC_I2C_EEPROM_ADDR 0x50
#define SPEC_I2C_EEPROM_SIZE (8 * 1024)
/* Functions in spec-gpio.c */
extern
int
spec_gpio_init
(
struct
fmc_device
*
fmc
);
...
...
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