Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
45bb5065
Commit
45bb5065
authored
Sep 01, 2013
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'spi/topic/octeon' into spi-next
parents
455765f0
f79cc88e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
44 deletions
+5
-44
drivers/spi/spi-octeon.c
drivers/spi/spi-octeon.c
+5
-44
No files found.
drivers/spi/spi-octeon.c
View file @
45bb5065
...
@@ -28,7 +28,6 @@
...
@@ -28,7 +28,6 @@
#define OCTEON_SPI_MAX_CLOCK_HZ 16000000
#define OCTEON_SPI_MAX_CLOCK_HZ 16000000
struct
octeon_spi
{
struct
octeon_spi
{
struct
spi_master
*
my_master
;
u64
register_base
;
u64
register_base
;
u64
last_cfg
;
u64
last_cfg
;
u64
cs_enax
;
u64
cs_enax
;
...
@@ -64,7 +63,6 @@ static int octeon_spi_do_transfer(struct octeon_spi *p,
...
@@ -64,7 +63,6 @@ static int octeon_spi_do_transfer(struct octeon_spi *p,
unsigned
int
speed_hz
;
unsigned
int
speed_hz
;
int
mode
;
int
mode
;
bool
cpha
,
cpol
;
bool
cpha
,
cpol
;
int
bits_per_word
;
const
u8
*
tx_buf
;
const
u8
*
tx_buf
;
u8
*
rx_buf
;
u8
*
rx_buf
;
int
len
;
int
len
;
...
@@ -76,12 +74,9 @@ static int octeon_spi_do_transfer(struct octeon_spi *p,
...
@@ -76,12 +74,9 @@ static int octeon_spi_do_transfer(struct octeon_spi *p,
mode
=
msg_setup
->
mode
;
mode
=
msg_setup
->
mode
;
cpha
=
mode
&
SPI_CPHA
;
cpha
=
mode
&
SPI_CPHA
;
cpol
=
mode
&
SPI_CPOL
;
cpol
=
mode
&
SPI_CPOL
;
bits_per_word
=
msg_setup
->
bits_per_word
;
if
(
xfer
->
speed_hz
)
if
(
xfer
->
speed_hz
)
speed_hz
=
xfer
->
speed_hz
;
speed_hz
=
xfer
->
speed_hz
;
if
(
xfer
->
bits_per_word
)
bits_per_word
=
xfer
->
bits_per_word
;
if
(
speed_hz
>
OCTEON_SPI_MAX_CLOCK_HZ
)
if
(
speed_hz
>
OCTEON_SPI_MAX_CLOCK_HZ
)
speed_hz
=
OCTEON_SPI_MAX_CLOCK_HZ
;
speed_hz
=
OCTEON_SPI_MAX_CLOCK_HZ
;
...
@@ -166,19 +161,6 @@ static int octeon_spi_do_transfer(struct octeon_spi *p,
...
@@ -166,19 +161,6 @@ static int octeon_spi_do_transfer(struct octeon_spi *p,
return
xfer
->
len
;
return
xfer
->
len
;
}
}
static
int
octeon_spi_validate_bpw
(
struct
spi_device
*
spi
,
u32
speed
)
{
switch
(
speed
)
{
case
8
:
break
;
default:
dev_err
(
&
spi
->
dev
,
"Error: %d bits per word not supported
\n
"
,
speed
);
return
-
EINVAL
;
}
return
0
;
}
static
int
octeon_spi_transfer_one_message
(
struct
spi_master
*
master
,
static
int
octeon_spi_transfer_one_message
(
struct
spi_master
*
master
,
struct
spi_message
*
msg
)
struct
spi_message
*
msg
)
{
{
...
@@ -196,15 +178,6 @@ static int octeon_spi_transfer_one_message(struct spi_master *master,
...
@@ -196,15 +178,6 @@ static int octeon_spi_transfer_one_message(struct spi_master *master,
goto
err
;
goto
err
;
}
}
list_for_each_entry
(
xfer
,
&
msg
->
transfers
,
transfer_list
)
{
if
(
xfer
->
bits_per_word
)
{
status
=
octeon_spi_validate_bpw
(
msg
->
spi
,
xfer
->
bits_per_word
);
if
(
status
)
goto
err
;
}
}
list_for_each_entry
(
xfer
,
&
msg
->
transfers
,
transfer_list
)
{
list_for_each_entry
(
xfer
,
&
msg
->
transfers
,
transfer_list
)
{
bool
last_xfer
=
&
xfer
->
transfer_list
==
msg
->
transfers
.
prev
;
bool
last_xfer
=
&
xfer
->
transfer_list
==
msg
->
transfers
.
prev
;
int
r
=
octeon_spi_do_transfer
(
p
,
msg
,
xfer
,
last_xfer
);
int
r
=
octeon_spi_do_transfer
(
p
,
msg
,
xfer
,
last_xfer
);
...
@@ -236,14 +209,9 @@ static struct octeon_spi_setup *octeon_spi_new_setup(struct spi_device *spi)
...
@@ -236,14 +209,9 @@ static struct octeon_spi_setup *octeon_spi_new_setup(struct spi_device *spi)
static
int
octeon_spi_setup
(
struct
spi_device
*
spi
)
static
int
octeon_spi_setup
(
struct
spi_device
*
spi
)
{
{
int
r
;
struct
octeon_spi_setup
*
new_setup
;
struct
octeon_spi_setup
*
new_setup
;
struct
octeon_spi_setup
*
old_setup
=
spi_get_ctldata
(
spi
);
struct
octeon_spi_setup
*
old_setup
=
spi_get_ctldata
(
spi
);
r
=
octeon_spi_validate_bpw
(
spi
,
spi
->
bits_per_word
);
if
(
r
)
return
r
;
new_setup
=
octeon_spi_new_setup
(
spi
);
new_setup
=
octeon_spi_new_setup
(
spi
);
if
(
!
new_setup
)
if
(
!
new_setup
)
return
-
ENOMEM
;
return
-
ENOMEM
;
...
@@ -261,14 +229,8 @@ static void octeon_spi_cleanup(struct spi_device *spi)
...
@@ -261,14 +229,8 @@ static void octeon_spi_cleanup(struct spi_device *spi)
kfree
(
old_setup
);
kfree
(
old_setup
);
}
}
static
int
octeon_spi_nop_transfer_hardware
(
struct
spi_master
*
master
)
{
return
0
;
}
static
int
octeon_spi_probe
(
struct
platform_device
*
pdev
)
static
int
octeon_spi_probe
(
struct
platform_device
*
pdev
)
{
{
struct
resource
*
res_mem
;
struct
resource
*
res_mem
;
struct
spi_master
*
master
;
struct
spi_master
*
master
;
struct
octeon_spi
*
p
;
struct
octeon_spi
*
p
;
...
@@ -278,8 +240,7 @@ static int octeon_spi_probe(struct platform_device *pdev)
...
@@ -278,8 +240,7 @@ static int octeon_spi_probe(struct platform_device *pdev)
if
(
!
master
)
if
(
!
master
)
return
-
ENOMEM
;
return
-
ENOMEM
;
p
=
spi_master_get_devdata
(
master
);
p
=
spi_master_get_devdata
(
master
);
platform_set_drvdata
(
pdev
,
p
);
platform_set_drvdata
(
pdev
,
master
);
p
->
my_master
=
master
;
res_mem
=
platform_get_resource
(
pdev
,
IORESOURCE_MEM
,
0
);
res_mem
=
platform_get_resource
(
pdev
,
IORESOURCE_MEM
,
0
);
...
@@ -307,9 +268,8 @@ static int octeon_spi_probe(struct platform_device *pdev)
...
@@ -307,9 +268,8 @@ static int octeon_spi_probe(struct platform_device *pdev)
master
->
setup
=
octeon_spi_setup
;
master
->
setup
=
octeon_spi_setup
;
master
->
cleanup
=
octeon_spi_cleanup
;
master
->
cleanup
=
octeon_spi_cleanup
;
master
->
prepare_transfer_hardware
=
octeon_spi_nop_transfer_hardware
;
master
->
transfer_one_message
=
octeon_spi_transfer_one_message
;
master
->
transfer_one_message
=
octeon_spi_transfer_one_message
;
master
->
unprepare_transfer_hardware
=
octeon_spi_nop_transfer_hardware
;
master
->
bits_per_word_mask
=
SPI_BPW_MASK
(
8
)
;
master
->
dev
.
of_node
=
pdev
->
dev
.
of_node
;
master
->
dev
.
of_node
=
pdev
->
dev
.
of_node
;
err
=
spi_register_master
(
master
);
err
=
spi_register_master
(
master
);
...
@@ -328,10 +288,11 @@ static int octeon_spi_probe(struct platform_device *pdev)
...
@@ -328,10 +288,11 @@ static int octeon_spi_probe(struct platform_device *pdev)
static
int
octeon_spi_remove
(
struct
platform_device
*
pdev
)
static
int
octeon_spi_remove
(
struct
platform_device
*
pdev
)
{
{
struct
octeon_spi
*
p
=
platform_get_drvdata
(
pdev
);
struct
spi_master
*
master
=
platform_get_drvdata
(
pdev
);
struct
octeon_spi
*
p
=
spi_master_get_devdata
(
master
);
u64
register_base
=
p
->
register_base
;
u64
register_base
=
p
->
register_base
;
spi_unregister_master
(
p
->
my_
master
);
spi_unregister_master
(
master
);
/* Clear the CSENA* and put everything in a known state. */
/* Clear the CSENA* and put everything in a known state. */
cvmx_write_csr
(
register_base
+
OCTEON_SPI_CFG
,
0
);
cvmx_write_csr
(
register_base
+
OCTEON_SPI_CFG
,
0
);
...
...
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