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
adb25d53
Commit
adb25d53
authored
Jun 26, 2013
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'spi/topic/sirf' into spi-next
parents
f4e97581
237ce466
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
41 deletions
+14
-41
drivers/spi/spi-sirf.c
drivers/spi/spi-sirf.c
+14
-41
No files found.
drivers/spi/spi-sirf.c
View file @
adb25d53
...
...
@@ -19,7 +19,6 @@
#include <linux/of_gpio.h>
#include <linux/spi/spi.h>
#include <linux/spi/spi_bitbang.h>
#include <linux/pinctrl/consumer.h>
#define DRIVER_NAME "sirfsoc_spi"
...
...
@@ -127,7 +126,6 @@ struct sirfsoc_spi {
void
__iomem
*
base
;
u32
ctrl_freq
;
/* SPI controller clock speed */
struct
clk
*
clk
;
struct
pinctrl
*
p
;
/* rx & tx bufs from the spi_transfer */
const
void
*
tx
;
...
...
@@ -142,9 +140,6 @@ struct sirfsoc_spi {
unsigned
int
left_tx_cnt
;
unsigned
int
left_rx_cnt
;
/* tasklet to push tx msg into FIFO */
struct
tasklet_struct
tasklet_tx
;
int
chipselect
[
0
];
};
...
...
@@ -236,17 +231,6 @@ static void spi_sirfsoc_tx_word_u32(struct sirfsoc_spi *sspi)
sspi
->
left_tx_cnt
--
;
}
static
void
spi_sirfsoc_tasklet_tx
(
unsigned
long
arg
)
{
struct
sirfsoc_spi
*
sspi
=
(
struct
sirfsoc_spi
*
)
arg
;
/* Fill Tx FIFO while there are left words to be transmitted */
while
(
!
((
readl
(
sspi
->
base
+
SIRFSOC_SPI_TXFIFO_STATUS
)
&
SIRFSOC_SPI_FIFO_FULL
))
&&
sspi
->
left_tx_cnt
)
sspi
->
tx_word
(
sspi
);
}
static
irqreturn_t
spi_sirfsoc_irq
(
int
irq
,
void
*
dev_id
)
{
struct
sirfsoc_spi
*
sspi
=
dev_id
;
...
...
@@ -261,25 +245,25 @@ static irqreturn_t spi_sirfsoc_irq(int irq, void *dev_id)
writel
(
0x0
,
sspi
->
base
+
SIRFSOC_SPI_INT_EN
);
}
if
(
spi_stat
&
SIRFSOC_SPI_FRM_END
)
{
if
(
spi_stat
&
(
SIRFSOC_SPI_FRM_END
|
SIRFSOC_SPI_RXFIFO_THD_REACH
))
while
(
!
((
readl
(
sspi
->
base
+
SIRFSOC_SPI_RXFIFO_STATUS
)
&
SIRFSOC_SPI_FIFO_EMPTY
))
&&
sspi
->
left_rx_cnt
)
sspi
->
rx_word
(
sspi
);
/* Received all words */
if
((
sspi
->
left_rx_cnt
==
0
)
&&
(
sspi
->
left_tx_cnt
==
0
))
{
complete
(
&
sspi
->
done
);
writel
(
0x0
,
sspi
->
base
+
SIRFSOC_SPI_INT_EN
);
}
}
if
(
spi_stat
&
SIRFSOC_SPI_RXFIFO_THD_REACH
||
spi_stat
&
SIRFSOC_SPI_TXFIFO_THD_REACH
||
spi_stat
&
SIRFSOC_SPI_RX_FIFO_FULL
||
spi_stat
&
SIRFSOC_SPI_TXFIFO_EMPTY
)
tasklet_schedule
(
&
sspi
->
tasklet_tx
);
if
(
spi_stat
&
(
SIRFSOC_SPI_FIFO_EMPTY
|
SIRFSOC_SPI_TXFIFO_THD_REACH
))
while
(
!
((
readl
(
sspi
->
base
+
SIRFSOC_SPI_TXFIFO_STATUS
)
&
SIRFSOC_SPI_FIFO_FULL
))
&&
sspi
->
left_tx_cnt
)
sspi
->
tx_word
(
sspi
);
/* Received all words */
if
((
sspi
->
left_rx_cnt
==
0
)
&&
(
sspi
->
left_tx_cnt
==
0
))
{
complete
(
&
sspi
->
done
);
writel
(
0x0
,
sspi
->
base
+
SIRFSOC_SPI_INT_EN
);
}
return
IRQ_HANDLED
;
}
...
...
@@ -558,24 +542,16 @@ static int spi_sirfsoc_probe(struct platform_device *pdev)
SPI_BPW_MASK
(
16
)
|
SPI_BPW_MASK
(
32
);
sspi
->
bitbang
.
master
->
dev
.
of_node
=
pdev
->
dev
.
of_node
;
sspi
->
p
=
pinctrl_get_select_default
(
&
pdev
->
dev
);
ret
=
IS_ERR
(
sspi
->
p
);
if
(
ret
)
goto
free_master
;
sspi
->
clk
=
clk_get
(
&
pdev
->
dev
,
NULL
);
if
(
IS_ERR
(
sspi
->
clk
))
{
ret
=
-
EINVAL
;
goto
free_
pin
;
goto
free_
master
;
}
clk_prepare_enable
(
sspi
->
clk
);
sspi
->
ctrl_freq
=
clk_get_rate
(
sspi
->
clk
);
init_completion
(
&
sspi
->
done
);
tasklet_init
(
&
sspi
->
tasklet_tx
,
spi_sirfsoc_tasklet_tx
,
(
unsigned
long
)
sspi
);
writel
(
SIRFSOC_SPI_FIFO_RESET
,
sspi
->
base
+
SIRFSOC_SPI_RXFIFO_OP
);
writel
(
SIRFSOC_SPI_FIFO_RESET
,
sspi
->
base
+
SIRFSOC_SPI_TXFIFO_OP
);
writel
(
SIRFSOC_SPI_FIFO_START
,
sspi
->
base
+
SIRFSOC_SPI_RXFIFO_OP
);
...
...
@@ -594,8 +570,6 @@ static int spi_sirfsoc_probe(struct platform_device *pdev)
free_clk:
clk_disable_unprepare
(
sspi
->
clk
);
clk_put
(
sspi
->
clk
);
free_pin:
pinctrl_put
(
sspi
->
p
);
free_master:
spi_master_put
(
master
);
err_cs:
...
...
@@ -618,7 +592,6 @@ static int spi_sirfsoc_remove(struct platform_device *pdev)
}
clk_disable_unprepare
(
sspi
->
clk
);
clk_put
(
sspi
->
clk
);
pinctrl_put
(
sspi
->
p
);
spi_master_put
(
master
);
return
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