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
nexedi
linux
Commits
2337ff45
Commit
2337ff45
authored
Jul 04, 2019
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'spi-5.2' into spi-linus
parents
6fbc7275
2b947137
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
13 deletions
+59
-13
drivers/spi/spi-qup.c
drivers/spi/spi-qup.c
+45
-6
drivers/spi/spi-stm32-qspi.c
drivers/spi/spi-stm32-qspi.c
+2
-2
drivers/spi/spi-uniphier.c
drivers/spi/spi-uniphier.c
+12
-5
No files found.
drivers/spi/spi-qup.c
View file @
2337ff45
...
...
@@ -273,6 +273,9 @@ static void spi_qup_read(struct spi_qup *controller, u32 *opflags)
writel_relaxed
(
QUP_OP_IN_SERVICE_FLAG
,
controller
->
base
+
QUP_OPERATIONAL
);
if
(
!
remainder
)
goto
exit
;
if
(
is_block_mode
)
{
num_words
=
(
remainder
>
words_per_block
)
?
words_per_block
:
remainder
;
...
...
@@ -302,11 +305,13 @@ static void spi_qup_read(struct spi_qup *controller, u32 *opflags)
* to refresh opflags value because MAX_INPUT_DONE_FLAG may now be
* present and this is used to determine if transaction is complete
*/
exit:
if
(
!
remainder
)
{
*
opflags
=
readl_relaxed
(
controller
->
base
+
QUP_OPERATIONAL
);
if
(
is_block_mode
&&
*
opflags
&
QUP_OP_MAX_INPUT_DONE_FLAG
)
writel_relaxed
(
QUP_OP_IN_SERVICE_FLAG
,
controller
->
base
+
QUP_OPERATIONAL
);
}
}
static
void
spi_qup_write_to_fifo
(
struct
spi_qup
*
controller
,
u32
num_words
)
...
...
@@ -354,6 +359,10 @@ static void spi_qup_write(struct spi_qup *controller)
writel_relaxed
(
QUP_OP_OUT_SERVICE_FLAG
,
controller
->
base
+
QUP_OPERATIONAL
);
/* make sure the interrupt is valid */
if
(
!
remainder
)
return
;
if
(
is_block_mode
)
{
num_words
=
(
remainder
>
words_per_block
)
?
words_per_block
:
remainder
;
...
...
@@ -567,10 +576,24 @@ static int spi_qup_do_pio(struct spi_device *spi, struct spi_transfer *xfer,
return
0
;
}
static
bool
spi_qup_data_pending
(
struct
spi_qup
*
controller
)
{
unsigned
int
remainder_tx
,
remainder_rx
;
remainder_tx
=
DIV_ROUND_UP
(
spi_qup_len
(
controller
)
-
controller
->
tx_bytes
,
controller
->
w_size
);
remainder_rx
=
DIV_ROUND_UP
(
spi_qup_len
(
controller
)
-
controller
->
rx_bytes
,
controller
->
w_size
);
return
remainder_tx
||
remainder_rx
;
}
static
irqreturn_t
spi_qup_qup_irq
(
int
irq
,
void
*
dev_id
)
{
struct
spi_qup
*
controller
=
dev_id
;
u32
opflags
,
qup_err
,
spi_err
;
unsigned
long
flags
;
int
error
=
0
;
qup_err
=
readl_relaxed
(
controller
->
base
+
QUP_ERROR_FLAGS
);
...
...
@@ -602,6 +625,11 @@ static irqreturn_t spi_qup_qup_irq(int irq, void *dev_id)
error
=
-
EIO
;
}
spin_lock_irqsave
(
&
controller
->
lock
,
flags
);
if
(
!
controller
->
error
)
controller
->
error
=
error
;
spin_unlock_irqrestore
(
&
controller
->
lock
,
flags
);
if
(
spi_qup_is_dma_xfer
(
controller
->
mode
))
{
writel_relaxed
(
opflags
,
controller
->
base
+
QUP_OPERATIONAL
);
}
else
{
...
...
@@ -610,11 +638,22 @@ static irqreturn_t spi_qup_qup_irq(int irq, void *dev_id)
if
(
opflags
&
QUP_OP_OUT_SERVICE_FLAG
)
spi_qup_write
(
controller
);
if
(
!
spi_qup_data_pending
(
controller
))
complete
(
&
controller
->
done
);
}
if
(
(
opflags
&
QUP_OP_MAX_INPUT_DONE_FLAG
)
||
error
)
if
(
error
)
complete
(
&
controller
->
done
);
if
(
opflags
&
QUP_OP_MAX_INPUT_DONE_FLAG
)
{
if
(
!
spi_qup_is_dma_xfer
(
controller
->
mode
))
{
if
(
spi_qup_data_pending
(
controller
))
return
IRQ_HANDLED
;
}
complete
(
&
controller
->
done
);
}
return
IRQ_HANDLED
;
}
...
...
drivers/spi/spi-stm32-qspi.c
View file @
2337ff45
...
...
@@ -29,7 +29,7 @@
#define CR_SSHIFT BIT(4)
#define CR_DFM BIT(6)
#define CR_FSEL BIT(7)
#define CR_FTHRES_
MASK GENMASK(12, 8)
#define CR_FTHRES_
SHIFT 8
#define CR_TEIE BIT(16)
#define CR_TCIE BIT(17)
#define CR_FTIE BIT(18)
...
...
@@ -463,7 +463,7 @@ static int stm32_qspi_setup(struct spi_device *spi)
flash
->
presc
=
presc
;
mutex_lock
(
&
qspi
->
lock
);
qspi
->
cr_reg
=
FIELD_PREP
(
CR_FTHRES_MASK
,
3
)
|
CR_SSHIFT
|
CR_EN
;
qspi
->
cr_reg
=
3
<<
CR_FTHRES_SHIFT
|
CR_SSHIFT
|
CR_EN
;
writel_relaxed
(
qspi
->
cr_reg
,
qspi
->
io_base
+
QSPI_CR
);
/* set dcr fsize to max address */
...
...
drivers/spi/spi-uniphier.c
View file @
2337ff45
...
...
@@ -328,7 +328,12 @@ static int uniphier_spi_transfer_one(struct spi_master *master,
struct
spi_transfer
*
t
)
{
struct
uniphier_spi_priv
*
priv
=
spi_master_get_devdata
(
master
);
int
status
;
struct
device
*
dev
=
master
->
dev
.
parent
;
unsigned
long
time_left
;
/* Terminate and return success for 0 byte length transfer */
if
(
!
t
->
len
)
return
0
;
uniphier_spi_setup_transfer
(
spi
,
t
);
...
...
@@ -338,13 +343,15 @@ static int uniphier_spi_transfer_one(struct spi_master *master,
uniphier_spi_irq_enable
(
spi
,
SSI_IE_RCIE
|
SSI_IE_RORIE
);
status
=
wait_for_completion_timeout
(
&
priv
->
xfer_done
,
time_left
=
wait_for_completion_timeout
(
&
priv
->
xfer_done
,
msecs_to_jiffies
(
SSI_TIMEOUT_MS
));
uniphier_spi_irq_disable
(
spi
,
SSI_IE_RCIE
|
SSI_IE_RORIE
);
if
(
status
<
0
)
return
status
;
if
(
!
time_left
)
{
dev_err
(
dev
,
"transfer timeout.
\n
"
);
return
-
ETIMEDOUT
;
}
return
priv
->
error
;
}
...
...
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