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
741b31df
Commit
741b31df
authored
Jun 20, 2024
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
spi: Merge up fixes
We need the fixes to apply new changes to the Cirrus drivers.
parents
78b05172
df75470b
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
30 deletions
+23
-30
drivers/spi/spi-cs42l43.c
drivers/spi/spi-cs42l43.c
+3
-3
drivers/spi/spi-imx.c
drivers/spi/spi-imx.c
+2
-12
drivers/spi/spi-stm32-qspi.c
drivers/spi/spi-stm32-qspi.c
+5
-7
drivers/spi/spi.c
drivers/spi/spi.c
+10
-6
include/linux/spi/spi.h
include/linux/spi/spi.h
+3
-2
No files found.
drivers/spi/spi-cs42l43.c
View file @
741b31df
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
#include <linux/units.h>
#include <linux/units.h>
#define CS42L43_FIFO_SIZE 16
#define CS42L43_FIFO_SIZE 16
#define CS42L43_SPI_ROOT_HZ
(40 * HZ_PER_MHZ)
#define CS42L43_SPI_ROOT_HZ
49152000
#define CS42L43_SPI_MAX_LENGTH 65532
#define CS42L43_SPI_MAX_LENGTH 65532
enum
cs42l43_spi_cmd
{
enum
cs42l43_spi_cmd
{
...
@@ -54,7 +54,7 @@ static const struct software_node ampr = {
...
@@ -54,7 +54,7 @@ static const struct software_node ampr = {
static
struct
spi_board_info
ampl_info
=
{
static
struct
spi_board_info
ampl_info
=
{
.
modalias
=
"cs35l56"
,
.
modalias
=
"cs35l56"
,
.
max_speed_hz
=
20
*
HZ_PER_MHZ
,
.
max_speed_hz
=
11
*
HZ_PER_MHZ
,
.
chip_select
=
0
,
.
chip_select
=
0
,
.
mode
=
SPI_MODE_0
,
.
mode
=
SPI_MODE_0
,
.
swnode
=
&
ampl
,
.
swnode
=
&
ampl
,
...
@@ -62,7 +62,7 @@ static struct spi_board_info ampl_info = {
...
@@ -62,7 +62,7 @@ static struct spi_board_info ampl_info = {
static
struct
spi_board_info
ampr_info
=
{
static
struct
spi_board_info
ampr_info
=
{
.
modalias
=
"cs35l56"
,
.
modalias
=
"cs35l56"
,
.
max_speed_hz
=
20
*
HZ_PER_MHZ
,
.
max_speed_hz
=
11
*
HZ_PER_MHZ
,
.
chip_select
=
1
,
.
chip_select
=
1
,
.
mode
=
SPI_MODE_0
,
.
mode
=
SPI_MODE_0
,
.
swnode
=
&
ampr
,
.
swnode
=
&
ampr
,
...
...
drivers/spi/spi-imx.c
View file @
741b31df
...
@@ -660,18 +660,8 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx,
...
@@ -660,18 +660,8 @@ static int mx51_ecspi_prepare_transfer(struct spi_imx_data *spi_imx,
ctrl
|=
(
spi_imx
->
target_burst
*
8
-
1
)
ctrl
|=
(
spi_imx
->
target_burst
*
8
-
1
)
<<
MX51_ECSPI_CTRL_BL_OFFSET
;
<<
MX51_ECSPI_CTRL_BL_OFFSET
;
else
{
else
{
if
(
spi_imx
->
usedma
)
{
ctrl
|=
(
spi_imx
->
bits_per_word
-
1
)
ctrl
|=
(
spi_imx
->
bits_per_word
-
1
)
<<
MX51_ECSPI_CTRL_BL_OFFSET
;
<<
MX51_ECSPI_CTRL_BL_OFFSET
;
}
else
{
if
(
spi_imx
->
count
>=
MX51_ECSPI_CTRL_MAX_BURST
)
ctrl
|=
(
MX51_ECSPI_CTRL_MAX_BURST
*
BITS_PER_BYTE
-
1
)
<<
MX51_ECSPI_CTRL_BL_OFFSET
;
else
ctrl
|=
(
spi_imx
->
count
/
DIV_ROUND_UP
(
spi_imx
->
bits_per_word
,
BITS_PER_BYTE
)
*
spi_imx
->
bits_per_word
-
1
)
<<
MX51_ECSPI_CTRL_BL_OFFSET
;
}
}
}
/* set clock speed */
/* set clock speed */
...
...
drivers/spi/spi-stm32-qspi.c
View file @
741b31df
...
@@ -349,7 +349,7 @@ static int stm32_qspi_wait_poll_status(struct stm32_qspi *qspi)
...
@@ -349,7 +349,7 @@ static int stm32_qspi_wait_poll_status(struct stm32_qspi *qspi)
static
int
stm32_qspi_get_mode
(
u8
buswidth
)
static
int
stm32_qspi_get_mode
(
u8
buswidth
)
{
{
if
(
buswidth
=
=
4
)
if
(
buswidth
>
=
4
)
return
CCR_BUSWIDTH_4
;
return
CCR_BUSWIDTH_4
;
return
buswidth
;
return
buswidth
;
...
@@ -653,9 +653,7 @@ static int stm32_qspi_setup(struct spi_device *spi)
...
@@ -653,9 +653,7 @@ static int stm32_qspi_setup(struct spi_device *spi)
return
-
EINVAL
;
return
-
EINVAL
;
mode
=
spi
->
mode
&
(
SPI_TX_OCTAL
|
SPI_RX_OCTAL
);
mode
=
spi
->
mode
&
(
SPI_TX_OCTAL
|
SPI_RX_OCTAL
);
if
((
mode
==
SPI_TX_OCTAL
||
mode
==
SPI_RX_OCTAL
)
||
if
(
mode
&&
gpiod_count
(
qspi
->
dev
,
"cs"
)
==
-
ENOENT
)
{
((
mode
==
(
SPI_TX_OCTAL
|
SPI_RX_OCTAL
))
&&
gpiod_count
(
qspi
->
dev
,
"cs"
)
==
-
ENOENT
))
{
dev_err
(
qspi
->
dev
,
"spi-rx-bus-width
\\
/spi-tx-bus-width
\\
/cs-gpios
\n
"
);
dev_err
(
qspi
->
dev
,
"spi-rx-bus-width
\\
/spi-tx-bus-width
\\
/cs-gpios
\n
"
);
dev_err
(
qspi
->
dev
,
"configuration not supported
\n
"
);
dev_err
(
qspi
->
dev
,
"configuration not supported
\n
"
);
...
@@ -676,10 +674,10 @@ static int stm32_qspi_setup(struct spi_device *spi)
...
@@ -676,10 +674,10 @@ static int stm32_qspi_setup(struct spi_device *spi)
qspi
->
cr_reg
=
CR_APMS
|
3
<<
CR_FTHRES_SHIFT
|
CR_SSHIFT
|
CR_EN
;
qspi
->
cr_reg
=
CR_APMS
|
3
<<
CR_FTHRES_SHIFT
|
CR_SSHIFT
|
CR_EN
;
/*
/*
* Dual flash mode is only enable in case SPI_TX_OCTAL
and SPI_T
X_OCTAL
* Dual flash mode is only enable in case SPI_TX_OCTAL
or SPI_R
X_OCTAL
*
are both
set in spi->mode and "cs-gpios" properties is found in DT
*
is
set in spi->mode and "cs-gpios" properties is found in DT
*/
*/
if
(
mode
==
(
SPI_TX_OCTAL
|
SPI_RX_OCTAL
)
)
{
if
(
mode
)
{
qspi
->
cr_reg
|=
CR_DFM
;
qspi
->
cr_reg
|=
CR_DFM
;
dev_dbg
(
qspi
->
dev
,
"Dual flash mode enable"
);
dev_dbg
(
qspi
->
dev
,
"Dual flash mode enable"
);
}
}
...
...
drivers/spi/spi.c
View file @
741b31df
...
@@ -689,11 +689,13 @@ static int __spi_add_device(struct spi_device *spi)
...
@@ -689,11 +689,13 @@ static int __spi_add_device(struct spi_device *spi)
* Make sure that multiple logical CS doesn't map to the same physical CS.
* Make sure that multiple logical CS doesn't map to the same physical CS.
* For example, spi->chip_select[0] != spi->chip_select[1] and so on.
* For example, spi->chip_select[0] != spi->chip_select[1] and so on.
*/
*/
if
(
!
spi_controller_is_target
(
ctlr
))
{
for
(
idx
=
0
;
idx
<
SPI_CS_CNT_MAX
;
idx
++
)
{
for
(
idx
=
0
;
idx
<
SPI_CS_CNT_MAX
;
idx
++
)
{
status
=
spi_dev_check_cs
(
dev
,
spi
,
idx
,
spi
,
idx
+
1
);
status
=
spi_dev_check_cs
(
dev
,
spi
,
idx
,
spi
,
idx
+
1
);
if
(
status
)
if
(
status
)
return
status
;
return
status
;
}
}
}
/* Set the bus ID string */
/* Set the bus ID string */
spi_dev_set_name
(
spi
);
spi_dev_set_name
(
spi
);
...
@@ -4132,7 +4134,8 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
...
@@ -4132,7 +4134,8 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
xfer
->
tx_nbits
!=
SPI_NBITS_SINGLE
&&
if
(
xfer
->
tx_nbits
!=
SPI_NBITS_SINGLE
&&
xfer
->
tx_nbits
!=
SPI_NBITS_DUAL
&&
xfer
->
tx_nbits
!=
SPI_NBITS_DUAL
&&
xfer
->
tx_nbits
!=
SPI_NBITS_QUAD
)
xfer
->
tx_nbits
!=
SPI_NBITS_QUAD
&&
xfer
->
tx_nbits
!=
SPI_NBITS_OCTAL
)
return
-
EINVAL
;
return
-
EINVAL
;
if
((
xfer
->
tx_nbits
==
SPI_NBITS_DUAL
)
&&
if
((
xfer
->
tx_nbits
==
SPI_NBITS_DUAL
)
&&
!
(
spi
->
mode
&
(
SPI_TX_DUAL
|
SPI_TX_QUAD
)))
!
(
spi
->
mode
&
(
SPI_TX_DUAL
|
SPI_TX_QUAD
)))
...
@@ -4147,7 +4150,8 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
...
@@ -4147,7 +4150,8 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
xfer
->
rx_nbits
!=
SPI_NBITS_SINGLE
&&
if
(
xfer
->
rx_nbits
!=
SPI_NBITS_SINGLE
&&
xfer
->
rx_nbits
!=
SPI_NBITS_DUAL
&&
xfer
->
rx_nbits
!=
SPI_NBITS_DUAL
&&
xfer
->
rx_nbits
!=
SPI_NBITS_QUAD
)
xfer
->
rx_nbits
!=
SPI_NBITS_QUAD
&&
xfer
->
rx_nbits
!=
SPI_NBITS_OCTAL
)
return
-
EINVAL
;
return
-
EINVAL
;
if
((
xfer
->
rx_nbits
==
SPI_NBITS_DUAL
)
&&
if
((
xfer
->
rx_nbits
==
SPI_NBITS_DUAL
)
&&
!
(
spi
->
mode
&
(
SPI_RX_DUAL
|
SPI_RX_QUAD
)))
!
(
spi
->
mode
&
(
SPI_RX_DUAL
|
SPI_RX_QUAD
)))
...
...
include/linux/spi/spi.h
View file @
741b31df
...
@@ -1088,12 +1088,13 @@ struct spi_transfer {
...
@@ -1088,12 +1088,13 @@ struct spi_transfer {
unsigned
dummy_data
:
1
;
unsigned
dummy_data
:
1
;
unsigned
cs_off
:
1
;
unsigned
cs_off
:
1
;
unsigned
cs_change
:
1
;
unsigned
cs_change
:
1
;
unsigned
tx_nbits
:
3
;
unsigned
tx_nbits
:
4
;
unsigned
rx_nbits
:
3
;
unsigned
rx_nbits
:
4
;
unsigned
timestamped
:
1
;
unsigned
timestamped
:
1
;
#define SPI_NBITS_SINGLE 0x01
/* 1-bit transfer */
#define SPI_NBITS_SINGLE 0x01
/* 1-bit transfer */
#define SPI_NBITS_DUAL 0x02
/* 2-bit transfer */
#define SPI_NBITS_DUAL 0x02
/* 2-bit transfer */
#define SPI_NBITS_QUAD 0x04
/* 4-bit transfer */
#define SPI_NBITS_QUAD 0x04
/* 4-bit transfer */
#define SPI_NBITS_OCTAL 0x08
/* 8-bit transfer */
u8
bits_per_word
;
u8
bits_per_word
;
struct
spi_delay
delay
;
struct
spi_delay
delay
;
struct
spi_delay
cs_change_delay
;
struct
spi_delay
cs_change_delay
;
...
...
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