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
2aab3501
Commit
2aab3501
authored
May 08, 2013
by
Juan David González Cobas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
svec: kill blanks/tabs and useless comments
parent
edae999b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
37 deletions
+33
-37
svec-fmc.c
kernel/svec-fmc.c
+0
-1
svec-i2c.c
kernel/svec-i2c.c
+33
-36
No files found.
kernel/svec-fmc.c
View file @
2aab3501
...
...
@@ -119,7 +119,6 @@ static int svec_gpio_config(struct fmc_device *fmc, struct fmc_gpio *gpio,
static
int
svec_read_ee
(
struct
fmc_device
*
fmc
,
int
pos
,
void
*
data
,
int
len
)
{
if
(
!
(
fmc
->
flags
&
FMC_DEVICE_HAS_GOLDEN
))
return
-
ENOTSUPP
;
return
svec_eeprom_read
(
fmc
,
pos
,
data
,
len
);
...
...
kernel/svec-i2c.c
View file @
2aab3501
...
...
@@ -18,6 +18,7 @@ module_param_named(i2c_dump, svec_i2c_dump, int, 0444);
static
uint32_t
core_offset
[]
=
{
0x10000
,
0x11000
};
/* shifted versions of fmc_readl/writel to the i2c core */
static
void
i2c_writel
(
struct
fmc_device
*
fmc
,
uint32_t
val
,
int
offset
)
{
fmc_writel
(
fmc
,
val
,
core_offset
[
fmc
->
slot_id
]
+
offset
);
...
...
@@ -28,9 +29,6 @@ static uint32_t i2c_readl(struct fmc_device *fmc, int offset)
return
fmc_readl
(
fmc
,
core_offset
[
fmc
->
slot_id
]
+
offset
);
}
#define fmc_readl i2c_readl
#define fmc_writel i2c_writel
/* Stupid dumping tool */
static
void
dumpstruct
(
char
*
name
,
void
*
ptr
,
int
size
)
{
...
...
@@ -51,9 +49,9 @@ static void oc_i2c_init(struct fmc_device *fmc)
{
const
int
prescaler
=
200
;
fm
c_writel
(
fmc
,
(
prescaler
>>
8
)
&
0xff
,
I2C_REG_PRER_HI
);
fm
c_writel
(
fmc
,
prescaler
&
0xff
,
I2C_REG_PRER_LO
);
fm
c_writel
(
fmc
,
I2C_CTR_EN
,
I2C_REG_CTR
);
i2
c_writel
(
fmc
,
(
prescaler
>>
8
)
&
0xff
,
I2C_REG_PRER_HI
);
i2
c_writel
(
fmc
,
prescaler
&
0xff
,
I2C_REG_PRER_LO
);
i2
c_writel
(
fmc
,
I2C_CTR_EN
,
I2C_REG_CTR
);
}
static
uint32_t
oc_i2c_wait_busy
(
struct
fmc_device
*
fmc
)
...
...
@@ -61,7 +59,7 @@ static uint32_t oc_i2c_wait_busy(struct fmc_device *fmc)
uint32_t
sr
;
do
{
sr
=
fm
c_readl
(
fmc
,
I2C_REG_SR
);
sr
=
i2
c_readl
(
fmc
,
I2C_REG_SR
);
}
while
(
sr
&
I2C_SR_TIP
);
return
sr
;
...
...
@@ -71,19 +69,19 @@ static int oc_i2c_scan_bus(struct fmc_device *fmc)
{
int
i
,
ack
;
uint32_t
sr
;
for
(
i
=
0
;
i
<
256
;
i
+=
2
)
{
fm
c_writel
(
fmc
,
i
|
1
,
I2C_REG_TXR
);
fm
c_writel
(
fmc
,
I2C_CR_STA
|
I2C_CR_WR
,
I2C_REG_CR
);
i2
c_writel
(
fmc
,
i
|
1
,
I2C_REG_TXR
);
i2
c_writel
(
fmc
,
I2C_CR_STA
|
I2C_CR_WR
,
I2C_REG_CR
);
sr
=
oc_i2c_wait_busy
(
fmc
);
ack
=
!
(
sr
&
I2C_SR_RXACK
);
if
(
ack
)
{
pr_info
(
"Device found at address 0x%x
\n
"
,
i
>>
1
);
fm
c_writel
(
fmc
,
0
,
I2C_REG_TXR
);
fm
c_writel
(
fmc
,
I2C_CR_STO
|
I2C_CR_WR
,
I2C_REG_CR
);
i2
c_writel
(
fmc
,
0
,
I2C_REG_TXR
);
i2
c_writel
(
fmc
,
I2C_CR_STO
|
I2C_CR_WR
,
I2C_REG_CR
);
oc_i2c_wait_busy
(
fmc
);
return
1
;
}
...
...
@@ -94,52 +92,52 @@ static int oc_i2c_scan_bus(struct fmc_device *fmc)
static
int
oc_i2c_write
(
struct
fmc_device
*
fmc
,
int
i2c_addr
,
const
uint8_t
*
buf
,
size_t
size
)
{
uint32_t
sr
;
fmc_writel
(
fmc
,
i2c_addr
<<
1
,
I2C_REG_TXR
);
fmc_writel
(
fmc
,
I2C_CR_STA
|
I2C_CR_WR
,
I2C_REG_CR
);
uint32_t
sr
;
pr_debug
(
"%s: entering [ addr %x ]
\n
"
,
__func__
,
i2c_addr
);
i2c_writel
(
fmc
,
i2c_addr
<<
1
,
I2C_REG_TXR
);
i2c_writel
(
fmc
,
I2C_CR_STA
|
I2C_CR_WR
,
I2C_REG_CR
);
sr
=
oc_i2c_wait_busy
(
fmc
);
if
(
sr
&
I2C_SR_RXACK
)
return
-
1
;
while
(
size
--
)
{
fm
c_writel
(
fmc
,
*
buf
++
,
I2C_REG_TXR
);
fm
c_writel
(
fmc
,
I2C_CR_WR
|
(
size
==
0
?
I2C_CR_STO
:
0
),
I2C_REG_CR
);
i2
c_writel
(
fmc
,
*
buf
++
,
I2C_REG_TXR
);
i2
c_writel
(
fmc
,
I2C_CR_WR
|
(
size
==
0
?
I2C_CR_STO
:
0
),
I2C_REG_CR
);
sr
=
oc_i2c_wait_busy
(
fmc
);
if
(
sr
&
I2C_SR_RXACK
)
return
-
1
;
}
// fmc_writel(fmc, I2C_CR_STO, I2C_REG_CR);
// sr = oc_i2c_wait_busy(fmc);
return
0
;
}
static
int
oc_i2c_read
(
struct
fmc_device
*
fmc
,
int
i2c_addr
,
uint8_t
*
buf
,
size_t
size
)
{
uint32_t
sr
;
uint32_t
sr
;
pr_debug
(
"%s: entering size %zd
\n
"
,
__func__
,
size
);
i2c_writel
(
fmc
,
(
i2c_addr
<<
1
)
|
1
,
I2C_REG_TXR
);
i2c_writel
(
fmc
,
I2C_CR_STA
|
I2C_CR_WR
,
I2C_REG_CR
);
fmc_writel
(
fmc
,
(
i2c_addr
<<
1
)
|
1
,
I2C_REG_TXR
);
fmc_writel
(
fmc
,
I2C_CR_STA
|
I2C_CR_WR
,
I2C_REG_CR
);
sr
=
oc_i2c_wait_busy
(
fmc
);
if
(
sr
&
I2C_SR_RXACK
)
return
-
1
;
while
(
size
--
)
{
uint8_t
r
;
fm
c_writel
(
fmc
,
I2C_CR_RD
,
I2C_REG_CR
);
i2
c_writel
(
fmc
,
I2C_CR_RD
,
I2C_REG_CR
);
sr
=
oc_i2c_wait_busy
(
fmc
);
if
(
sr
&
I2C_SR_RXACK
)
return
-
1
;
r
=
fm
c_readl
(
fmc
,
I2C_REG_RXR
)
&
0xff
;
r
=
i2
c_readl
(
fmc
,
I2C_REG_RXR
)
&
0xff
;
*
buf
++
=
r
;
}
fm
c_writel
(
fmc
,
I2C_CR_STO
|
I2C_CR_RD
,
I2C_REG_CR
);
i2
c_writel
(
fmc
,
I2C_CR_STO
|
I2C_CR_RD
,
I2C_REG_CR
);
sr
=
oc_i2c_wait_busy
(
fmc
);
return
0
;
...
...
@@ -149,7 +147,7 @@ int svec_eeprom_read(struct fmc_device *fmc, uint32_t offset,
void
*
buf
,
size_t
size
)
{
uint8_t
txbuf
[
2
];
txbuf
[
0
]
=
(
offset
>>
8
)
&
0xff
;
txbuf
[
1
]
=
offset
&
0xff
;
...
...
@@ -163,14 +161,13 @@ int svec_eeprom_write(struct fmc_device *fmc, uint32_t offset,
const
void
*
buf
,
size_t
size
)
{
uint8_t
txbuf
[
2
];
txbuf
[
0
]
=
(
offset
>>
8
)
&
0xff
;
txbuf
[
1
]
=
offset
&
0xff
;
oc_i2c_write
(
fmc
,
fmc
->
eeprom_addr
,
txbuf
,
2
);
oc_i2c_write
(
fmc
,
fmc
->
eeprom_addr
,
buf
,
size
);
// oc_i2c_read(fmc, i2c_addr, buf, size);
return
size
;
}
...
...
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