Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
071db7a6
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
14
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
071db7a6
编写于
6月 20, 2018
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'spi-4.18' into spi-4.19 for DSPI dep
上级
d87e08f1
8570043e
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
82 addition
and
62 deletion
+82
-62
drivers/spi/spi-cadence.c
drivers/spi/spi-cadence.c
+1
-1
drivers/spi/spi-fsl-dspi.c
drivers/spi/spi-fsl-dspi.c
+12
-0
drivers/spi/spi-orion.c
drivers/spi/spi-orion.c
+40
-37
drivers/spi/spi-sh-msiof.c
drivers/spi/spi-sh-msiof.c
+29
-24
未找到文件。
drivers/spi/spi-cadence.c
浏览文件 @
071db7a6
...
...
@@ -319,7 +319,7 @@ static void cdns_spi_fill_tx_fifo(struct cdns_spi *xspi)
*/
if
(
cdns_spi_read
(
xspi
,
CDNS_SPI_ISR
)
&
CDNS_SPI_IXR_TXFULL
)
u
sleep_range
(
10
,
2
0
);
u
delay
(
1
0
);
if
(
xspi
->
txbuf
)
cdns_spi_write
(
xspi
,
CDNS_SPI_TXD
,
*
xspi
->
txbuf
++
);
...
...
drivers/spi/spi-fsl-dspi.c
浏览文件 @
071db7a6
...
...
@@ -857,11 +857,23 @@ static int dspi_resume(struct device *dev)
static
SIMPLE_DEV_PM_OPS
(
dspi_pm
,
dspi_suspend
,
dspi_resume
);
static
const
struct
regmap_range
dspi_volatile_ranges
[]
=
{
regmap_reg_range
(
SPI_MCR
,
SPI_TCR
),
regmap_reg_range
(
SPI_SR
,
SPI_SR
),
regmap_reg_range
(
SPI_PUSHR
,
SPI_RXFR3
),
};
static
const
struct
regmap_access_table
dspi_volatile_table
=
{
.
yes_ranges
=
dspi_volatile_ranges
,
.
n_yes_ranges
=
ARRAY_SIZE
(
dspi_volatile_ranges
),
};
static
const
struct
regmap_config
dspi_regmap_config
=
{
.
reg_bits
=
32
,
.
val_bits
=
32
,
.
reg_stride
=
4
,
.
max_register
=
0x88
,
.
volatile_table
=
&
dspi_volatile_table
,
};
static
void
dspi_init
(
struct
fsl_dspi
*
dspi
)
...
...
drivers/spi/spi-orion.c
浏览文件 @
071db7a6
...
...
@@ -20,6 +20,7 @@
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_device.h>
#include <linux/of_gpio.h>
#include <linux/clk.h>
#include <linux/sizes.h>
#include <linux/gpio.h>
...
...
@@ -681,9 +682,9 @@ static int orion_spi_probe(struct platform_device *pdev)
goto
out_rel_axi_clk
;
}
/* Scan all SPI devices of this controller for direct mapped devices */
for_each_available_child_of_node
(
pdev
->
dev
.
of_node
,
np
)
{
u32
cs
;
int
cs_gpio
;
/* Get chip-select number from the "reg" property */
status
=
of_property_read_u32
(
np
,
"reg"
,
&
cs
);
...
...
@@ -694,6 +695,44 @@ static int orion_spi_probe(struct platform_device *pdev)
continue
;
}
/*
* Initialize the CS GPIO:
* - properly request the actual GPIO signal
* - de-assert the logical signal so that all GPIO CS lines
* are inactive when probing for slaves
* - find an unused physical CS which will be driven for any
* slave which uses a CS GPIO
*/
cs_gpio
=
of_get_named_gpio
(
pdev
->
dev
.
of_node
,
"cs-gpios"
,
cs
);
if
(
cs_gpio
>
0
)
{
char
*
gpio_name
;
int
cs_flags
;
if
(
spi
->
unused_hw_gpio
==
-
1
)
{
dev_info
(
&
pdev
->
dev
,
"Selected unused HW CS#%d for any GPIO CSes
\n
"
,
cs
);
spi
->
unused_hw_gpio
=
cs
;
}
gpio_name
=
devm_kasprintf
(
&
pdev
->
dev
,
GFP_KERNEL
,
"%s-CS%d"
,
dev_name
(
&
pdev
->
dev
),
cs
);
if
(
!
gpio_name
)
{
status
=
-
ENOMEM
;
goto
out_rel_axi_clk
;
}
cs_flags
=
of_property_read_bool
(
np
,
"spi-cs-high"
)
?
GPIOF_OUT_INIT_LOW
:
GPIOF_OUT_INIT_HIGH
;
status
=
devm_gpio_request_one
(
&
pdev
->
dev
,
cs_gpio
,
cs_flags
,
gpio_name
);
if
(
status
)
{
dev_err
(
&
pdev
->
dev
,
"Can't request GPIO for CS %d
\n
"
,
cs
);
goto
out_rel_axi_clk
;
}
}
/*
* Check if an address is configured for this SPI device. If
* not, the MBus mapping via the 'ranges' property in the 'soc'
...
...
@@ -740,44 +779,8 @@ static int orion_spi_probe(struct platform_device *pdev)
if
(
status
<
0
)
goto
out_rel_pm
;
if
(
master
->
cs_gpios
)
{
int
i
;
for
(
i
=
0
;
i
<
master
->
num_chipselect
;
++
i
)
{
char
*
gpio_name
;
if
(
!
gpio_is_valid
(
master
->
cs_gpios
[
i
]))
{
continue
;
}
gpio_name
=
devm_kasprintf
(
&
pdev
->
dev
,
GFP_KERNEL
,
"%s-CS%d"
,
dev_name
(
&
pdev
->
dev
),
i
);
if
(
!
gpio_name
)
{
status
=
-
ENOMEM
;
goto
out_rel_master
;
}
status
=
devm_gpio_request
(
&
pdev
->
dev
,
master
->
cs_gpios
[
i
],
gpio_name
);
if
(
status
)
{
dev_err
(
&
pdev
->
dev
,
"Can't request GPIO for CS %d
\n
"
,
master
->
cs_gpios
[
i
]);
goto
out_rel_master
;
}
if
(
spi
->
unused_hw_gpio
==
-
1
)
{
dev_info
(
&
pdev
->
dev
,
"Selected unused HW CS#%d for any GPIO CSes
\n
"
,
i
);
spi
->
unused_hw_gpio
=
i
;
}
}
}
return
status
;
out_rel_master:
spi_unregister_master
(
master
);
out_rel_pm:
pm_runtime_disable
(
&
pdev
->
dev
);
out_rel_axi_clk:
...
...
drivers/spi/spi-sh-msiof.c
浏览文件 @
071db7a6
...
...
@@ -49,6 +49,7 @@ struct sh_msiof_spi_priv {
struct
platform_device
*
pdev
;
struct
sh_msiof_spi_info
*
info
;
struct
completion
done
;
struct
completion
done_txdma
;
unsigned
int
tx_fifo_size
;
unsigned
int
rx_fifo_size
;
unsigned
int
min_div_pow
;
...
...
@@ -649,19 +650,21 @@ static int sh_msiof_slave_abort(struct spi_master *master)
p
->
slave_aborted
=
true
;
complete
(
&
p
->
done
);
complete
(
&
p
->
done_txdma
);
return
0
;
}
static
int
sh_msiof_wait_for_completion
(
struct
sh_msiof_spi_priv
*
p
)
static
int
sh_msiof_wait_for_completion
(
struct
sh_msiof_spi_priv
*
p
,
struct
completion
*
x
)
{
if
(
spi_controller_is_slave
(
p
->
master
))
{
if
(
wait_for_completion_interruptible
(
&
p
->
done
)
||
if
(
wait_for_completion_interruptible
(
x
)
||
p
->
slave_aborted
)
{
dev_dbg
(
&
p
->
pdev
->
dev
,
"interrupted
\n
"
);
return
-
EINTR
;
}
}
else
{
if
(
!
wait_for_completion_timeout
(
&
p
->
done
,
HZ
))
{
if
(
!
wait_for_completion_timeout
(
x
,
HZ
))
{
dev_err
(
&
p
->
pdev
->
dev
,
"timeout
\n
"
);
return
-
ETIMEDOUT
;
}
...
...
@@ -711,7 +714,7 @@ static int sh_msiof_spi_txrx_once(struct sh_msiof_spi_priv *p,
}
/* wait for tx fifo to be emptied / rx fifo to be filled */
ret
=
sh_msiof_wait_for_completion
(
p
);
ret
=
sh_msiof_wait_for_completion
(
p
,
&
p
->
done
);
if
(
ret
)
goto
stop_reset
;
...
...
@@ -740,10 +743,7 @@ static int sh_msiof_spi_txrx_once(struct sh_msiof_spi_priv *p,
static
void
sh_msiof_dma_complete
(
void
*
arg
)
{
struct
sh_msiof_spi_priv
*
p
=
arg
;
sh_msiof_write
(
p
,
IER
,
0
);
complete
(
&
p
->
done
);
complete
(
arg
);
}
static
int
sh_msiof_dma_once
(
struct
sh_msiof_spi_priv
*
p
,
const
void
*
tx
,
...
...
@@ -764,7 +764,7 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx,
return
-
EAGAIN
;
desc_rx
->
callback
=
sh_msiof_dma_complete
;
desc_rx
->
callback_param
=
p
;
desc_rx
->
callback_param
=
&
p
->
done
;
cookie
=
dmaengine_submit
(
desc_rx
);
if
(
dma_submit_error
(
cookie
))
return
cookie
;
...
...
@@ -782,13 +782,8 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx,
goto
no_dma_tx
;
}
if
(
rx
)
{
/* No callback */
desc_tx
->
callback
=
NULL
;
}
else
{
desc_tx
->
callback
=
sh_msiof_dma_complete
;
desc_tx
->
callback_param
=
p
;
}
desc_tx
->
callback_param
=
&
p
->
done_txdma
;
cookie
=
dmaengine_submit
(
desc_tx
);
if
(
dma_submit_error
(
cookie
))
{
ret
=
cookie
;
...
...
@@ -805,6 +800,8 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx,
sh_msiof_write
(
p
,
IER
,
ier_bits
);
reinit_completion
(
&
p
->
done
);
if
(
tx
)
reinit_completion
(
&
p
->
done_txdma
);
p
->
slave_aborted
=
false
;
/* Now start DMA */
...
...
@@ -819,17 +816,24 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx,
goto
stop_dma
;
}
/* wait for tx/rx DMA completion */
ret
=
sh_msiof_wait_for_completion
(
p
);
if
(
tx
)
{
/* wait for tx DMA completion */
ret
=
sh_msiof_wait_for_completion
(
p
,
&
p
->
done_txdma
);
if
(
ret
)
goto
stop_reset
;
}
if
(
!
rx
)
{
reinit_completion
(
&
p
->
done
);
sh_msiof_write
(
p
,
IER
,
IER_TEOFE
);
if
(
rx
)
{
/* wait for rx DMA completion */
ret
=
sh_msiof_wait_for_completion
(
p
,
&
p
->
done
);
if
(
ret
)
goto
stop_reset
;
sh_msiof_write
(
p
,
IER
,
0
);
}
else
{
/* wait for tx fifo to be emptied */
ret
=
sh_msiof_wait_for_completion
(
p
);
sh_msiof_write
(
p
,
IER
,
IER_TEOFE
);
ret
=
sh_msiof_wait_for_completion
(
p
,
&
p
->
done
);
if
(
ret
)
goto
stop_reset
;
}
...
...
@@ -1327,6 +1331,7 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
p
->
min_div_pow
=
chipdata
->
min_div_pow
;
init_completion
(
&
p
->
done
);
init_completion
(
&
p
->
done_txdma
);
p
->
clk
=
devm_clk_get
(
&
pdev
->
dev
,
NULL
);
if
(
IS_ERR
(
p
->
clk
))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录