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
58b860ed
Commit
58b860ed
authored
May 02, 2019
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'spi-5.1' into spi-linus
parents
37624b58
7e95b166
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
243 additions
and
152 deletions
+243
-152
drivers/spi/atmel-quadspi.c
drivers/spi/atmel-quadspi.c
+4
-2
drivers/spi/spi-fsl-lpspi.c
drivers/spi/spi-fsl-lpspi.c
+2
-2
drivers/spi/spi-gpio.c
drivers/spi/spi-gpio.c
+0
-1
drivers/spi/spi-imx.c
drivers/spi/spi-imx.c
+1
-1
drivers/spi/spi-pic32.c
drivers/spi/spi-pic32.c
+1
-1
drivers/spi/spi-pxa2xx.c
drivers/spi/spi-pxa2xx.c
+6
-2
drivers/spi/spi-rspi.c
drivers/spi/spi-rspi.c
+50
-69
drivers/spi/spi-stm32-qspi.c
drivers/spi/spi-stm32-qspi.c
+1
-3
drivers/spi/spi-stm32.c
drivers/spi/spi-stm32.c
+3
-2
drivers/spi/spi-tegra114.c
drivers/spi/spi-tegra114.c
+149
-64
drivers/spi/spi-tegra20-slink.c
drivers/spi/spi-tegra20-slink.c
+9
-3
drivers/spi/spi-topcliff-pch.c
drivers/spi/spi-topcliff-pch.c
+13
-2
drivers/spi/spi.c
drivers/spi/spi.c
+4
-0
No files found.
drivers/spi/atmel-quadspi.c
View file @
58b860ed
...
...
@@ -570,7 +570,8 @@ static int atmel_qspi_remove(struct platform_device *pdev)
static
int
__maybe_unused
atmel_qspi_suspend
(
struct
device
*
dev
)
{
struct
atmel_qspi
*
aq
=
dev_get_drvdata
(
dev
);
struct
spi_controller
*
ctrl
=
dev_get_drvdata
(
dev
);
struct
atmel_qspi
*
aq
=
spi_controller_get_devdata
(
ctrl
);
clk_disable_unprepare
(
aq
->
qspick
);
clk_disable_unprepare
(
aq
->
pclk
);
...
...
@@ -580,7 +581,8 @@ static int __maybe_unused atmel_qspi_suspend(struct device *dev)
static
int
__maybe_unused
atmel_qspi_resume
(
struct
device
*
dev
)
{
struct
atmel_qspi
*
aq
=
dev_get_drvdata
(
dev
);
struct
spi_controller
*
ctrl
=
dev_get_drvdata
(
dev
);
struct
atmel_qspi
*
aq
=
spi_controller_get_devdata
(
ctrl
);
clk_prepare_enable
(
aq
->
pclk
);
clk_prepare_enable
(
aq
->
qspick
);
...
...
drivers/spi/spi-fsl-lpspi.c
View file @
58b860ed
...
...
@@ -62,7 +62,7 @@
#define CFGR1_PCSPOL BIT(8)
#define CFGR1_NOSTALL BIT(3)
#define CFGR1_MASTER BIT(0)
#define FSR_
RXCOUNT (BIT(16)|BIT(17)|BIT(18)
)
#define FSR_
TXCOUNT (0xFF
)
#define RSR_RXEMPTY BIT(1)
#define TCR_CPOL BIT(31)
#define TCR_CPHA BIT(30)
...
...
@@ -452,7 +452,7 @@ static irqreturn_t fsl_lpspi_isr(int irq, void *dev_id)
}
if
(
temp_SR
&
SR_MBF
||
readl
(
fsl_lpspi
->
base
+
IMX7ULP_FSR
)
&
FSR_
R
XCOUNT
)
{
readl
(
fsl_lpspi
->
base
+
IMX7ULP_FSR
)
&
FSR_
T
XCOUNT
)
{
writel
(
SR_FCF
,
fsl_lpspi
->
base
+
IMX7ULP_SR
);
fsl_lpspi_intctrl
(
fsl_lpspi
,
IER_FCIE
);
return
IRQ_HANDLED
;
...
...
drivers/spi/spi-gpio.c
View file @
58b860ed
...
...
@@ -35,7 +35,6 @@
* platform_device->driver_data ... points to spi_gpio
*
* spi->controller_state ... reserved for bitbang framework code
* spi->controller_data ... holds chipselect GPIO
*
* spi->master->dev.driver_data ... points to spi_gpio->bitbang
*/
...
...
drivers/spi/spi-imx.c
View file @
58b860ed
...
...
@@ -1494,7 +1494,7 @@ static int spi_imx_transfer(struct spi_device *spi,
/* flush rxfifo before transfer */
while
(
spi_imx
->
devtype_data
->
rx_available
(
spi_imx
))
spi_imx
->
rx
(
spi_imx
);
readl
(
spi_imx
->
base
+
MXC_CSPIRXDATA
);
if
(
spi_imx
->
slave_mode
)
return
spi_imx_pio_transfer_slave
(
spi
,
transfer
);
...
...
drivers/spi/spi-pic32.c
View file @
58b860ed
...
...
@@ -559,7 +559,7 @@ static int pic32_spi_one_transfer(struct spi_master *master,
dev_err
(
&
spi
->
dev
,
"wait error/timedout
\n
"
);
if
(
dma_issued
)
{
dmaengine_terminate_all
(
master
->
dma_rx
);
dmaengine_terminate_all
(
master
->
dma_
r
x
);
dmaengine_terminate_all
(
master
->
dma_
t
x
);
}
ret
=
-
ETIMEDOUT
;
}
else
{
...
...
drivers/spi/spi-pxa2xx.c
View file @
58b860ed
...
...
@@ -884,10 +884,14 @@ static unsigned int ssp_get_clk_div(struct driver_data *drv_data, int rate)
rate
=
min_t
(
int
,
ssp_clk
,
rate
);
/*
* Calculate the divisor for the SCR (Serial Clock Rate), avoiding
* that the SSP transmission rate can be greater than the device rate
*/
if
(
ssp
->
type
==
PXA25x_SSP
||
ssp
->
type
==
CE4100_SSP
)
return
(
ssp_clk
/
(
2
*
rate
)
-
1
)
&
0xff
;
return
(
DIV_ROUND_UP
(
ssp_clk
,
2
*
rate
)
-
1
)
&
0xff
;
else
return
(
ssp_clk
/
rate
-
1
)
&
0xfff
;
return
(
DIV_ROUND_UP
(
ssp_clk
,
rate
)
-
1
)
&
0xfff
;
}
static
unsigned
int
pxa2xx_ssp_get_clk_div
(
struct
driver_data
*
drv_data
,
...
...
drivers/spi/spi-rspi.c
View file @
58b860ed
...
...
@@ -271,7 +271,8 @@ static int rspi_set_config_register(struct rspi_data *rspi, int access_size)
/* Sets parity, interrupt mask */
rspi_write8
(
rspi
,
0x00
,
RSPI_SPCR2
);
/* Sets SPCMD */
/* Resets sequencer */
rspi_write8
(
rspi
,
0
,
RSPI_SPSCR
);
rspi
->
spcmd
|=
SPCMD_SPB_8_TO_16
(
access_size
);
rspi_write16
(
rspi
,
rspi
->
spcmd
,
RSPI_SPCMD0
);
...
...
@@ -315,7 +316,8 @@ static int rspi_rz_set_config_register(struct rspi_data *rspi, int access_size)
rspi_write8
(
rspi
,
0x00
,
RSPI_SSLND
);
rspi_write8
(
rspi
,
0x00
,
RSPI_SPND
);
/* Sets SPCMD */
/* Resets sequencer */
rspi_write8
(
rspi
,
0
,
RSPI_SPSCR
);
rspi
->
spcmd
|=
SPCMD_SPB_8_TO_16
(
access_size
);
rspi_write16
(
rspi
,
rspi
->
spcmd
,
RSPI_SPCMD0
);
...
...
@@ -366,7 +368,8 @@ static int qspi_set_config_register(struct rspi_data *rspi, int access_size)
/* Sets buffer to allow normal operation */
rspi_write8
(
rspi
,
0x00
,
QSPI_SPBFCR
);
/* Sets SPCMD */
/* Resets sequencer */
rspi_write8
(
rspi
,
0
,
RSPI_SPSCR
);
rspi_write16
(
rspi
,
rspi
->
spcmd
,
RSPI_SPCMD0
);
/* Sets RSPI mode */
...
...
@@ -736,27 +739,22 @@ static int qspi_trigger_transfer_out_in(struct rspi_data *rspi, const u8 *tx,
while
(
len
>
0
)
{
n
=
qspi_set_send_trigger
(
rspi
,
len
);
qspi_set_receive_trigger
(
rspi
,
len
);
if
(
n
==
QSPI_BUFFER_SIZE
)
{
ret
=
rspi_wait_for_tx_empty
(
rspi
);
if
(
ret
<
0
)
{
dev_err
(
&
rspi
->
ctlr
->
dev
,
"transmit timeout
\n
"
);
return
ret
;
}
for
(
i
=
0
;
i
<
n
;
i
++
)
rspi_write_data
(
rspi
,
*
tx
++
);
ret
=
rspi_wait_for_tx_empty
(
rspi
);
if
(
ret
<
0
)
{
dev_err
(
&
rspi
->
ctlr
->
dev
,
"transmit timeout
\n
"
);
return
ret
;
}
for
(
i
=
0
;
i
<
n
;
i
++
)
rspi_write_data
(
rspi
,
*
tx
++
);
ret
=
rspi_wait_for_rx_full
(
rspi
);
if
(
ret
<
0
)
{
dev_err
(
&
rspi
->
ctlr
->
dev
,
"receive timeout
\n
"
);
return
ret
;
}
for
(
i
=
0
;
i
<
n
;
i
++
)
*
rx
++
=
rspi_read_data
(
rspi
);
}
else
{
ret
=
rspi_pio_transfer
(
rspi
,
tx
,
rx
,
n
);
if
(
ret
<
0
)
return
ret
;
ret
=
rspi_wait_for_rx_full
(
rspi
);
if
(
ret
<
0
)
{
dev_err
(
&
rspi
->
ctlr
->
dev
,
"receive timeout
\n
"
);
return
ret
;
}
for
(
i
=
0
;
i
<
n
;
i
++
)
*
rx
++
=
rspi_read_data
(
rspi
);
len
-=
n
;
}
...
...
@@ -793,19 +791,14 @@ static int qspi_transfer_out(struct rspi_data *rspi, struct spi_transfer *xfer)
while
(
n
>
0
)
{
len
=
qspi_set_send_trigger
(
rspi
,
n
);
if
(
len
==
QSPI_BUFFER_SIZE
)
{
ret
=
rspi_wait_for_tx_empty
(
rspi
);
if
(
ret
<
0
)
{
dev_err
(
&
rspi
->
ctlr
->
dev
,
"transmit timeout
\n
"
);
return
ret
;
}
for
(
i
=
0
;
i
<
len
;
i
++
)
rspi_write_data
(
rspi
,
*
tx
++
);
}
else
{
ret
=
rspi_pio_transfer
(
rspi
,
tx
,
NULL
,
len
);
if
(
ret
<
0
)
return
ret
;
ret
=
rspi_wait_for_tx_empty
(
rspi
);
if
(
ret
<
0
)
{
dev_err
(
&
rspi
->
ctlr
->
dev
,
"transmit timeout
\n
"
);
return
ret
;
}
for
(
i
=
0
;
i
<
len
;
i
++
)
rspi_write_data
(
rspi
,
*
tx
++
);
n
-=
len
;
}
...
...
@@ -830,19 +823,14 @@ static int qspi_transfer_in(struct rspi_data *rspi, struct spi_transfer *xfer)
while
(
n
>
0
)
{
len
=
qspi_set_receive_trigger
(
rspi
,
n
);
if
(
len
==
QSPI_BUFFER_SIZE
)
{
ret
=
rspi_wait_for_rx_full
(
rspi
);
if
(
ret
<
0
)
{
dev_err
(
&
rspi
->
ctlr
->
dev
,
"receive timeout
\n
"
);
return
ret
;
}
for
(
i
=
0
;
i
<
len
;
i
++
)
*
rx
++
=
rspi_read_data
(
rspi
);
}
else
{
ret
=
rspi_pio_transfer
(
rspi
,
NULL
,
rx
,
len
);
if
(
ret
<
0
)
return
ret
;
ret
=
rspi_wait_for_rx_full
(
rspi
);
if
(
ret
<
0
)
{
dev_err
(
&
rspi
->
ctlr
->
dev
,
"receive timeout
\n
"
);
return
ret
;
}
for
(
i
=
0
;
i
<
len
;
i
++
)
*
rx
++
=
rspi_read_data
(
rspi
);
n
-=
len
;
}
...
...
@@ -868,28 +856,6 @@ static int qspi_transfer_one(struct spi_controller *ctlr,
}
}
static
int
rspi_setup
(
struct
spi_device
*
spi
)
{
struct
rspi_data
*
rspi
=
spi_controller_get_devdata
(
spi
->
controller
);
rspi
->
max_speed_hz
=
spi
->
max_speed_hz
;
rspi
->
spcmd
=
SPCMD_SSLKP
;
if
(
spi
->
mode
&
SPI_CPOL
)
rspi
->
spcmd
|=
SPCMD_CPOL
;
if
(
spi
->
mode
&
SPI_CPHA
)
rspi
->
spcmd
|=
SPCMD_CPHA
;
/* CMOS output mode and MOSI signal from previous transfer */
rspi
->
sppcr
=
0
;
if
(
spi
->
mode
&
SPI_LOOP
)
rspi
->
sppcr
|=
SPPCR_SPLP
;
set_config_register
(
rspi
,
8
);
return
0
;
}
static
u16
qspi_transfer_mode
(
const
struct
spi_transfer
*
xfer
)
{
if
(
xfer
->
tx_buf
)
...
...
@@ -959,8 +925,24 @@ static int rspi_prepare_message(struct spi_controller *ctlr,
struct
spi_message
*
msg
)
{
struct
rspi_data
*
rspi
=
spi_controller_get_devdata
(
ctlr
);
struct
spi_device
*
spi
=
msg
->
spi
;
int
ret
;
rspi
->
max_speed_hz
=
spi
->
max_speed_hz
;
rspi
->
spcmd
=
SPCMD_SSLKP
;
if
(
spi
->
mode
&
SPI_CPOL
)
rspi
->
spcmd
|=
SPCMD_CPOL
;
if
(
spi
->
mode
&
SPI_CPHA
)
rspi
->
spcmd
|=
SPCMD_CPHA
;
/* CMOS output mode and MOSI signal from previous transfer */
rspi
->
sppcr
=
0
;
if
(
spi
->
mode
&
SPI_LOOP
)
rspi
->
sppcr
|=
SPPCR_SPLP
;
set_config_register
(
rspi
,
8
);
if
(
msg
->
spi
->
mode
&
(
SPI_TX_DUAL
|
SPI_TX_QUAD
|
SPI_RX_DUAL
|
SPI_RX_QUAD
))
{
/* Setup sequencer for messages with multiple transfer modes */
...
...
@@ -1267,7 +1249,6 @@ static int rspi_probe(struct platform_device *pdev)
init_waitqueue_head
(
&
rspi
->
wait
);
ctlr
->
bus_num
=
pdev
->
id
;
ctlr
->
setup
=
rspi_setup
;
ctlr
->
auto_runtime_pm
=
true
;
ctlr
->
transfer_one
=
ops
->
transfer_one
;
ctlr
->
prepare_message
=
rspi_prepare_message
;
...
...
drivers/spi/spi-stm32-qspi.c
View file @
58b860ed
...
...
@@ -76,7 +76,6 @@
#define QSPI_PSMAR 0x28
#define QSPI_PIR 0x2c
#define QSPI_LPTR 0x30
#define LPTR_DFT_TIMEOUT 0x10
#define STM32_QSPI_MAX_MMAP_SZ SZ_256M
#define STM32_QSPI_MAX_NORCHIP 2
...
...
@@ -372,8 +371,7 @@ static int stm32_qspi_setup(struct spi_device *spi)
flash
->
presc
=
presc
;
mutex_lock
(
&
qspi
->
lock
);
writel_relaxed
(
LPTR_DFT_TIMEOUT
,
qspi
->
io_base
+
QSPI_LPTR
);
cr
=
FIELD_PREP
(
CR_FTHRES_MASK
,
3
)
|
CR_TCEN
|
CR_SSHIFT
|
CR_EN
;
cr
=
FIELD_PREP
(
CR_FTHRES_MASK
,
3
)
|
CR_SSHIFT
|
CR_EN
;
writel_relaxed
(
cr
,
qspi
->
io_base
+
QSPI_CR
);
/* set dcr fsize to max address */
...
...
drivers/spi/spi-stm32.c
View file @
58b860ed
...
...
@@ -1839,8 +1839,9 @@ static int stm32_spi_probe(struct platform_device *pdev)
spi
->
irq
=
platform_get_irq
(
pdev
,
0
);
if
(
spi
->
irq
<=
0
)
{
dev_err
(
&
pdev
->
dev
,
"no irq: %d
\n
"
,
spi
->
irq
);
ret
=
-
ENOENT
;
ret
=
spi
->
irq
;
if
(
ret
!=
-
EPROBE_DEFER
)
dev_err
(
&
pdev
->
dev
,
"failed to get irq: %d
\n
"
,
ret
);
goto
err_master_put
;
}
ret
=
devm_request_threaded_irq
(
&
pdev
->
dev
,
spi
->
irq
,
...
...
drivers/spi/spi-tegra114.c
View file @
58b860ed
This diff is collapsed.
Click to expand it.
drivers/spi/spi-tegra20-slink.c
View file @
58b860ed
...
...
@@ -717,9 +717,6 @@ static int tegra_slink_start_transfer_one(struct spi_device *spi,
command2
=
tspi
->
command2_reg
;
command2
&=
~
(
SLINK_RXEN
|
SLINK_TXEN
);
tegra_slink_writel
(
tspi
,
command
,
SLINK_COMMAND
);
tspi
->
command_reg
=
command
;
tspi
->
cur_direction
=
0
;
if
(
t
->
rx_buf
)
{
command2
|=
SLINK_RXEN
;
...
...
@@ -729,9 +726,18 @@ static int tegra_slink_start_transfer_one(struct spi_device *spi,
command2
|=
SLINK_TXEN
;
tspi
->
cur_direction
|=
DATA_DIR_TX
;
}
/*
* Writing to the command2 register bevore the command register prevents
* a spike in chip_select line 0. This selects the chip_select line
* before changing the chip_select value.
*/
tegra_slink_writel
(
tspi
,
command2
,
SLINK_COMMAND2
);
tspi
->
command2_reg
=
command2
;
tegra_slink_writel
(
tspi
,
command
,
SLINK_COMMAND
);
tspi
->
command_reg
=
command
;
if
(
total_fifo_words
>
SLINK_FIFO_DEPTH
)
ret
=
tegra_slink_start_dma_based_transfer
(
tspi
,
t
);
else
...
...
drivers/spi/spi-topcliff-pch.c
View file @
58b860ed
...
...
@@ -1299,18 +1299,27 @@ static void pch_free_dma_buf(struct pch_spi_board_data *board_dat,
dma
->
rx_buf_virt
,
dma
->
rx_buf_dma
);
}
static
void
pch_alloc_dma_buf
(
struct
pch_spi_board_data
*
board_dat
,
static
int
pch_alloc_dma_buf
(
struct
pch_spi_board_data
*
board_dat
,
struct
pch_spi_data
*
data
)
{
struct
pch_spi_dma_ctrl
*
dma
;
int
ret
;
dma
=
&
data
->
dma
;
ret
=
0
;
/* Get Consistent memory for Tx DMA */
dma
->
tx_buf_virt
=
dma_alloc_coherent
(
&
board_dat
->
pdev
->
dev
,
PCH_BUF_SIZE
,
&
dma
->
tx_buf_dma
,
GFP_KERNEL
);
if
(
!
dma
->
tx_buf_virt
)
ret
=
-
ENOMEM
;
/* Get Consistent memory for Rx DMA */
dma
->
rx_buf_virt
=
dma_alloc_coherent
(
&
board_dat
->
pdev
->
dev
,
PCH_BUF_SIZE
,
&
dma
->
rx_buf_dma
,
GFP_KERNEL
);
if
(
!
dma
->
rx_buf_virt
)
ret
=
-
ENOMEM
;
return
ret
;
}
static
int
pch_spi_pd_probe
(
struct
platform_device
*
plat_dev
)
...
...
@@ -1387,7 +1396,9 @@ static int pch_spi_pd_probe(struct platform_device *plat_dev)
if
(
use_dma
)
{
dev_info
(
&
plat_dev
->
dev
,
"Use DMA for data transfers
\n
"
);
pch_alloc_dma_buf
(
board_dat
,
data
);
ret
=
pch_alloc_dma_buf
(
board_dat
,
data
);
if
(
ret
)
goto
err_spi_register_master
;
}
ret
=
spi_register_master
(
master
);
...
...
drivers/spi/spi.c
View file @
58b860ed
...
...
@@ -1039,6 +1039,8 @@ static int spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg)
if
(
max_tx
||
max_rx
)
{
list_for_each_entry
(
xfer
,
&
msg
->
transfers
,
transfer_list
)
{
if
(
!
xfer
->
len
)
continue
;
if
(
!
xfer
->
tx_buf
)
xfer
->
tx_buf
=
ctlr
->
dummy_tx
;
if
(
!
xfer
->
rx_buf
)
...
...
@@ -2195,6 +2197,8 @@ static int spi_get_gpio_descs(struct spi_controller *ctlr)
*/
cs
[
i
]
=
devm_gpiod_get_index_optional
(
dev
,
"cs"
,
i
,
GPIOD_OUT_LOW
);
if
(
IS_ERR
(
cs
[
i
]))
return
PTR_ERR
(
cs
[
i
]);
if
(
cs
[
i
])
{
/*
...
...
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