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
68aa4cb3
Commit
68aa4cb3
authored
Sep 01, 2013
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'spi/topic/pdata' into spi-next
parents
11c28cfc
b5f9a9d5
Changes
30
Show whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
125 additions
and
160 deletions
+125
-160
drivers/spi/spi-altera.c
drivers/spi/spi-altera.c
+1
-1
drivers/spi/spi-ath79.c
drivers/spi/spi-ath79.c
+1
-1
drivers/spi/spi-au1550.c
drivers/spi/spi-au1550.c
+1
-1
drivers/spi/spi-bcm63xx.c
drivers/spi/spi-bcm63xx.c
+3
-5
drivers/spi/spi-bfin-sport.c
drivers/spi/spi-bfin-sport.c
+1
-1
drivers/spi/spi-bfin-v3.c
drivers/spi/spi-bfin-v3.c
+1
-1
drivers/spi/spi-bfin5xx.c
drivers/spi/spi-bfin5xx.c
+1
-1
drivers/spi/spi-coldfire-qspi.c
drivers/spi/spi-coldfire-qspi.c
+3
-3
drivers/spi/spi-davinci.c
drivers/spi/spi-davinci.c
+2
-2
drivers/spi/spi-ep93xx.c
drivers/spi/spi-ep93xx.c
+1
-1
drivers/spi/spi-fsl-espi.c
drivers/spi/spi-fsl-espi.c
+2
-2
drivers/spi/spi-fsl-lib.c
drivers/spi/spi-fsl-lib.c
+1
-1
drivers/spi/spi-fsl-spi.c
drivers/spi/spi-fsl-spi.c
+7
-6
drivers/spi/spi-gpio.c
drivers/spi/spi-gpio.c
+2
-2
drivers/spi/spi-mpc512x-psc.c
drivers/spi/spi-mpc512x-psc.c
+1
-1
drivers/spi/spi-mpc52xx-psc.c
drivers/spi/spi-mpc52xx-psc.c
+1
-1
drivers/spi/spi-nuc900.c
drivers/spi/spi-nuc900.c
+1
-1
drivers/spi/spi-oc-tiny.c
drivers/spi/spi-oc-tiny.c
+1
-1
drivers/spi/spi-omap-100k.c
drivers/spi/spi-omap-100k.c
+1
-1
drivers/spi/spi-omap2-mcspi.c
drivers/spi/spi-omap2-mcspi.c
+1
-1
drivers/spi/spi-pl022.c
drivers/spi/spi-pl022.c
+2
-1
drivers/spi/spi-rspi.c
drivers/spi/spi-rspi.c
+13
-6
drivers/spi/spi-s3c24xx.c
drivers/spi/spi-s3c24xx.c
+3
-3
drivers/spi/spi-s3c64xx.c
drivers/spi/spi-s3c64xx.c
+2
-2
drivers/spi/spi-sh-msiof.c
drivers/spi/spi-sh-msiof.c
+1
-1
drivers/spi/spi-sh-sci.c
drivers/spi/spi-sh-sci.c
+1
-1
drivers/spi/spi-sirf.c
drivers/spi/spi-sirf.c
+2
-4
drivers/spi/spi-ti-ssp.c
drivers/spi/spi-ti-ssp.c
+1
-1
drivers/spi/spi-tle62x0.c
drivers/spi/spi-tle62x0.c
+1
-1
drivers/spi/spi-xilinx.c
drivers/spi/spi-xilinx.c
+66
-106
No files found.
drivers/spi/spi-altera.c
View file @
68aa4cb3
...
@@ -200,7 +200,7 @@ static irqreturn_t altera_spi_irq(int irq, void *dev)
...
@@ -200,7 +200,7 @@ static irqreturn_t altera_spi_irq(int irq, void *dev)
static
int
altera_spi_probe
(
struct
platform_device
*
pdev
)
static
int
altera_spi_probe
(
struct
platform_device
*
pdev
)
{
{
struct
altera_spi_platform_data
*
platp
=
pdev
->
dev
.
platform_data
;
struct
altera_spi_platform_data
*
platp
=
dev_get_platdata
(
&
pdev
->
dev
)
;
struct
altera_spi
*
hw
;
struct
altera_spi
*
hw
;
struct
spi_master
*
master
;
struct
spi_master
*
master
;
struct
resource
*
res
;
struct
resource
*
res
;
...
...
drivers/spi/spi-ath79.c
View file @
68aa4cb3
...
@@ -221,7 +221,7 @@ static int ath79_spi_probe(struct platform_device *pdev)
...
@@ -221,7 +221,7 @@ static int ath79_spi_probe(struct platform_device *pdev)
sp
=
spi_master_get_devdata
(
master
);
sp
=
spi_master_get_devdata
(
master
);
platform_set_drvdata
(
pdev
,
sp
);
platform_set_drvdata
(
pdev
,
sp
);
pdata
=
pdev
->
dev
.
platform_data
;
pdata
=
dev_get_platdata
(
&
pdev
->
dev
)
;
master
->
bits_per_word_mask
=
SPI_BPW_RANGE_MASK
(
1
,
32
);
master
->
bits_per_word_mask
=
SPI_BPW_RANGE_MASK
(
1
,
32
);
master
->
setup
=
ath79_spi_setup
;
master
->
setup
=
ath79_spi_setup
;
...
...
drivers/spi/spi-au1550.c
View file @
68aa4cb3
...
@@ -776,7 +776,7 @@ static int au1550_spi_probe(struct platform_device *pdev)
...
@@ -776,7 +776,7 @@ static int au1550_spi_probe(struct platform_device *pdev)
hw
=
spi_master_get_devdata
(
master
);
hw
=
spi_master_get_devdata
(
master
);
hw
->
master
=
spi_master_get
(
master
);
hw
->
master
=
spi_master_get
(
master
);
hw
->
pdata
=
pdev
->
dev
.
platform_data
;
hw
->
pdata
=
dev_get_platdata
(
&
pdev
->
dev
)
;
hw
->
dev
=
&
pdev
->
dev
;
hw
->
dev
=
&
pdev
->
dev
;
if
(
hw
->
pdata
==
NULL
)
{
if
(
hw
->
pdata
==
NULL
)
{
...
...
drivers/spi/spi-bcm63xx.c
View file @
68aa4cb3
...
@@ -353,7 +353,7 @@ static int bcm63xx_spi_probe(struct platform_device *pdev)
...
@@ -353,7 +353,7 @@ static int bcm63xx_spi_probe(struct platform_device *pdev)
{
{
struct
resource
*
r
;
struct
resource
*
r
;
struct
device
*
dev
=
&
pdev
->
dev
;
struct
device
*
dev
=
&
pdev
->
dev
;
struct
bcm63xx_spi_pdata
*
pdata
=
pdev
->
dev
.
platform_data
;
struct
bcm63xx_spi_pdata
*
pdata
=
dev_get_platdata
(
&
pdev
->
dev
)
;
int
irq
;
int
irq
;
struct
spi_master
*
master
;
struct
spi_master
*
master
;
struct
clk
*
clk
;
struct
clk
*
clk
;
...
@@ -474,8 +474,7 @@ static int bcm63xx_spi_remove(struct platform_device *pdev)
...
@@ -474,8 +474,7 @@ static int bcm63xx_spi_remove(struct platform_device *pdev)
#ifdef CONFIG_PM
#ifdef CONFIG_PM
static
int
bcm63xx_spi_suspend
(
struct
device
*
dev
)
static
int
bcm63xx_spi_suspend
(
struct
device
*
dev
)
{
{
struct
spi_master
*
master
=
struct
spi_master
*
master
=
dev_get_drvdata
(
dev
);
platform_get_drvdata
(
to_platform_device
(
dev
));
struct
bcm63xx_spi
*
bs
=
spi_master_get_devdata
(
master
);
struct
bcm63xx_spi
*
bs
=
spi_master_get_devdata
(
master
);
spi_master_suspend
(
master
);
spi_master_suspend
(
master
);
...
@@ -487,8 +486,7 @@ static int bcm63xx_spi_suspend(struct device *dev)
...
@@ -487,8 +486,7 @@ static int bcm63xx_spi_suspend(struct device *dev)
static
int
bcm63xx_spi_resume
(
struct
device
*
dev
)
static
int
bcm63xx_spi_resume
(
struct
device
*
dev
)
{
{
struct
spi_master
*
master
=
struct
spi_master
*
master
=
dev_get_drvdata
(
dev
);
platform_get_drvdata
(
to_platform_device
(
dev
));
struct
bcm63xx_spi
*
bs
=
spi_master_get_devdata
(
master
);
struct
bcm63xx_spi
*
bs
=
spi_master_get_devdata
(
master
);
clk_prepare_enable
(
bs
->
clk
);
clk_prepare_enable
(
bs
->
clk
);
...
...
drivers/spi/spi-bfin-sport.c
View file @
68aa4cb3
...
@@ -756,7 +756,7 @@ static int bfin_sport_spi_probe(struct platform_device *pdev)
...
@@ -756,7 +756,7 @@ static int bfin_sport_spi_probe(struct platform_device *pdev)
struct
bfin_sport_spi_master_data
*
drv_data
;
struct
bfin_sport_spi_master_data
*
drv_data
;
int
status
;
int
status
;
platform_info
=
dev
->
platform_data
;
platform_info
=
dev
_get_platdata
(
dev
)
;
/* Allocate master with space for drv_data */
/* Allocate master with space for drv_data */
master
=
spi_alloc_master
(
dev
,
sizeof
(
*
master
)
+
16
);
master
=
spi_alloc_master
(
dev
,
sizeof
(
*
master
)
+
16
);
...
...
drivers/spi/spi-bfin-v3.c
View file @
68aa4cb3
...
@@ -773,7 +773,7 @@ static irqreturn_t bfin_spi_rx_dma_isr(int irq, void *dev_id)
...
@@ -773,7 +773,7 @@ static irqreturn_t bfin_spi_rx_dma_isr(int irq, void *dev_id)
static
int
bfin_spi_probe
(
struct
platform_device
*
pdev
)
static
int
bfin_spi_probe
(
struct
platform_device
*
pdev
)
{
{
struct
device
*
dev
=
&
pdev
->
dev
;
struct
device
*
dev
=
&
pdev
->
dev
;
struct
bfin_spi3_master
*
info
=
dev
->
platform_data
;
struct
bfin_spi3_master
*
info
=
dev
_get_platdata
(
dev
)
;
struct
spi_master
*
master
;
struct
spi_master
*
master
;
struct
bfin_spi_master
*
drv_data
;
struct
bfin_spi_master
*
drv_data
;
struct
resource
*
mem
,
*
res
;
struct
resource
*
mem
,
*
res
;
...
...
drivers/spi/spi-bfin5xx.c
View file @
68aa4cb3
...
@@ -1271,7 +1271,7 @@ static int bfin_spi_probe(struct platform_device *pdev)
...
@@ -1271,7 +1271,7 @@ static int bfin_spi_probe(struct platform_device *pdev)
struct
resource
*
res
;
struct
resource
*
res
;
int
status
=
0
;
int
status
=
0
;
platform_info
=
dev
->
platform_data
;
platform_info
=
dev
_get_platdata
(
dev
)
;
/* Allocate master with space for drv_data */
/* Allocate master with space for drv_data */
master
=
spi_alloc_master
(
dev
,
sizeof
(
*
drv_data
));
master
=
spi_alloc_master
(
dev
,
sizeof
(
*
drv_data
));
...
...
drivers/spi/spi-coldfire-qspi.c
View file @
68aa4cb3
...
@@ -400,7 +400,7 @@ static int mcfqspi_probe(struct platform_device *pdev)
...
@@ -400,7 +400,7 @@ static int mcfqspi_probe(struct platform_device *pdev)
struct
mcfqspi_platform_data
*
pdata
;
struct
mcfqspi_platform_data
*
pdata
;
int
status
;
int
status
;
pdata
=
pdev
->
dev
.
platform_data
;
pdata
=
dev_get_platdata
(
&
pdev
->
dev
)
;
if
(
!
pdata
)
{
if
(
!
pdata
)
{
dev_dbg
(
&
pdev
->
dev
,
"platform data is missing
\n
"
);
dev_dbg
(
&
pdev
->
dev
,
"platform data is missing
\n
"
);
return
-
ENOENT
;
return
-
ENOENT
;
...
@@ -558,7 +558,7 @@ static int mcfqspi_resume(struct device *dev)
...
@@ -558,7 +558,7 @@ static int mcfqspi_resume(struct device *dev)
#ifdef CONFIG_PM_RUNTIME
#ifdef CONFIG_PM_RUNTIME
static
int
mcfqspi_runtime_suspend
(
struct
device
*
dev
)
static
int
mcfqspi_runtime_suspend
(
struct
device
*
dev
)
{
{
struct
mcfqspi
*
mcfqspi
=
platform_get_drvdata
(
to_platform_device
(
dev
)
);
struct
mcfqspi
*
mcfqspi
=
dev_get_drvdata
(
dev
);
clk_disable
(
mcfqspi
->
clk
);
clk_disable
(
mcfqspi
->
clk
);
...
@@ -567,7 +567,7 @@ static int mcfqspi_runtime_suspend(struct device *dev)
...
@@ -567,7 +567,7 @@ static int mcfqspi_runtime_suspend(struct device *dev)
static
int
mcfqspi_runtime_resume
(
struct
device
*
dev
)
static
int
mcfqspi_runtime_resume
(
struct
device
*
dev
)
{
{
struct
mcfqspi
*
mcfqspi
=
platform_get_drvdata
(
to_platform_device
(
dev
)
);
struct
mcfqspi
*
mcfqspi
=
dev_get_drvdata
(
dev
);
clk_enable
(
mcfqspi
->
clk
);
clk_enable
(
mcfqspi
->
clk
);
...
...
drivers/spi/spi-davinci.c
View file @
68aa4cb3
...
@@ -872,8 +872,8 @@ static int davinci_spi_probe(struct platform_device *pdev)
...
@@ -872,8 +872,8 @@ static int davinci_spi_probe(struct platform_device *pdev)
goto
free_master
;
goto
free_master
;
}
}
if
(
pdev
->
dev
.
platform_data
)
{
if
(
dev_get_platdata
(
&
pdev
->
dev
)
)
{
pdata
=
pdev
->
dev
.
platform_data
;
pdata
=
dev_get_platdata
(
&
pdev
->
dev
)
;
dspi
->
pdata
=
*
pdata
;
dspi
->
pdata
=
*
pdata
;
}
else
{
}
else
{
/* update dspi pdata with that from the DT */
/* update dspi pdata with that from the DT */
...
...
drivers/spi/spi-ep93xx.c
View file @
68aa4cb3
...
@@ -874,7 +874,7 @@ static int ep93xx_spi_probe(struct platform_device *pdev)
...
@@ -874,7 +874,7 @@ static int ep93xx_spi_probe(struct platform_device *pdev)
int
irq
;
int
irq
;
int
error
;
int
error
;
info
=
pdev
->
dev
.
platform_data
;
info
=
dev_get_platdata
(
&
pdev
->
dev
)
;
irq
=
platform_get_irq
(
pdev
,
0
);
irq
=
platform_get_irq
(
pdev
,
0
);
if
(
irq
<
0
)
{
if
(
irq
<
0
)
{
...
...
drivers/spi/spi-fsl-espi.c
View file @
68aa4cb3
...
@@ -584,7 +584,7 @@ static void fsl_espi_remove(struct mpc8xxx_spi *mspi)
...
@@ -584,7 +584,7 @@ static void fsl_espi_remove(struct mpc8xxx_spi *mspi)
static
struct
spi_master
*
fsl_espi_probe
(
struct
device
*
dev
,
static
struct
spi_master
*
fsl_espi_probe
(
struct
device
*
dev
,
struct
resource
*
mem
,
unsigned
int
irq
)
struct
resource
*
mem
,
unsigned
int
irq
)
{
{
struct
fsl_spi_platform_data
*
pdata
=
dev
->
platform_data
;
struct
fsl_spi_platform_data
*
pdata
=
dev
_get_platdata
(
dev
)
;
struct
spi_master
*
master
;
struct
spi_master
*
master
;
struct
mpc8xxx_spi
*
mpc8xxx_spi
;
struct
mpc8xxx_spi
*
mpc8xxx_spi
;
struct
fsl_espi_reg
*
reg_base
;
struct
fsl_espi_reg
*
reg_base
;
...
@@ -665,7 +665,7 @@ static struct spi_master * fsl_espi_probe(struct device *dev,
...
@@ -665,7 +665,7 @@ static struct spi_master * fsl_espi_probe(struct device *dev,
static
int
of_fsl_espi_get_chipselects
(
struct
device
*
dev
)
static
int
of_fsl_espi_get_chipselects
(
struct
device
*
dev
)
{
{
struct
device_node
*
np
=
dev
->
of_node
;
struct
device_node
*
np
=
dev
->
of_node
;
struct
fsl_spi_platform_data
*
pdata
=
dev
->
platform_data
;
struct
fsl_spi_platform_data
*
pdata
=
dev
_get_platdata
(
dev
)
;
const
u32
*
prop
;
const
u32
*
prop
;
int
len
;
int
len
;
...
...
drivers/spi/spi-fsl-lib.c
View file @
68aa4cb3
...
@@ -122,7 +122,7 @@ const char *mpc8xxx_spi_strmode(unsigned int flags)
...
@@ -122,7 +122,7 @@ const char *mpc8xxx_spi_strmode(unsigned int flags)
int
mpc8xxx_spi_probe
(
struct
device
*
dev
,
struct
resource
*
mem
,
int
mpc8xxx_spi_probe
(
struct
device
*
dev
,
struct
resource
*
mem
,
unsigned
int
irq
)
unsigned
int
irq
)
{
{
struct
fsl_spi_platform_data
*
pdata
=
dev
->
platform_data
;
struct
fsl_spi_platform_data
*
pdata
=
dev
_get_platdata
(
dev
)
;
struct
spi_master
*
master
;
struct
spi_master
*
master
;
struct
mpc8xxx_spi
*
mpc8xxx_spi
;
struct
mpc8xxx_spi
*
mpc8xxx_spi
;
int
ret
=
0
;
int
ret
=
0
;
...
...
drivers/spi/spi-fsl-spi.c
View file @
68aa4cb3
...
@@ -574,7 +574,7 @@ static void fsl_spi_grlib_cs_control(struct spi_device *spi, bool on)
...
@@ -574,7 +574,7 @@ static void fsl_spi_grlib_cs_control(struct spi_device *spi, bool on)
static
void
fsl_spi_grlib_probe
(
struct
device
*
dev
)
static
void
fsl_spi_grlib_probe
(
struct
device
*
dev
)
{
{
struct
fsl_spi_platform_data
*
pdata
=
dev
->
platform_data
;
struct
fsl_spi_platform_data
*
pdata
=
dev
_get_platdata
(
dev
)
;
struct
spi_master
*
master
=
dev_get_drvdata
(
dev
);
struct
spi_master
*
master
=
dev_get_drvdata
(
dev
);
struct
mpc8xxx_spi
*
mpc8xxx_spi
=
spi_master_get_devdata
(
master
);
struct
mpc8xxx_spi
*
mpc8xxx_spi
=
spi_master_get_devdata
(
master
);
struct
fsl_spi_reg
*
reg_base
=
mpc8xxx_spi
->
reg_base
;
struct
fsl_spi_reg
*
reg_base
=
mpc8xxx_spi
->
reg_base
;
...
@@ -600,7 +600,7 @@ static void fsl_spi_grlib_probe(struct device *dev)
...
@@ -600,7 +600,7 @@ static void fsl_spi_grlib_probe(struct device *dev)
static
struct
spi_master
*
fsl_spi_probe
(
struct
device
*
dev
,
static
struct
spi_master
*
fsl_spi_probe
(
struct
device
*
dev
,
struct
resource
*
mem
,
unsigned
int
irq
)
struct
resource
*
mem
,
unsigned
int
irq
)
{
{
struct
fsl_spi_platform_data
*
pdata
=
dev
->
platform_data
;
struct
fsl_spi_platform_data
*
pdata
=
dev
_get_platdata
(
dev
)
;
struct
spi_master
*
master
;
struct
spi_master
*
master
;
struct
mpc8xxx_spi
*
mpc8xxx_spi
;
struct
mpc8xxx_spi
*
mpc8xxx_spi
;
struct
fsl_spi_reg
*
reg_base
;
struct
fsl_spi_reg
*
reg_base
;
...
@@ -700,7 +700,8 @@ static struct spi_master * fsl_spi_probe(struct device *dev,
...
@@ -700,7 +700,8 @@ static struct spi_master * fsl_spi_probe(struct device *dev,
static
void
fsl_spi_cs_control
(
struct
spi_device
*
spi
,
bool
on
)
static
void
fsl_spi_cs_control
(
struct
spi_device
*
spi
,
bool
on
)
{
{
struct
device
*
dev
=
spi
->
dev
.
parent
->
parent
;
struct
device
*
dev
=
spi
->
dev
.
parent
->
parent
;
struct
mpc8xxx_spi_probe_info
*
pinfo
=
to_of_pinfo
(
dev
->
platform_data
);
struct
fsl_spi_platform_data
*
pdata
=
dev_get_platdata
(
dev
);
struct
mpc8xxx_spi_probe_info
*
pinfo
=
to_of_pinfo
(
pdata
);
u16
cs
=
spi
->
chip_select
;
u16
cs
=
spi
->
chip_select
;
int
gpio
=
pinfo
->
gpios
[
cs
];
int
gpio
=
pinfo
->
gpios
[
cs
];
bool
alow
=
pinfo
->
alow_flags
[
cs
];
bool
alow
=
pinfo
->
alow_flags
[
cs
];
...
@@ -711,7 +712,7 @@ static void fsl_spi_cs_control(struct spi_device *spi, bool on)
...
@@ -711,7 +712,7 @@ static void fsl_spi_cs_control(struct spi_device *spi, bool on)
static
int
of_fsl_spi_get_chipselects
(
struct
device
*
dev
)
static
int
of_fsl_spi_get_chipselects
(
struct
device
*
dev
)
{
{
struct
device_node
*
np
=
dev
->
of_node
;
struct
device_node
*
np
=
dev
->
of_node
;
struct
fsl_spi_platform_data
*
pdata
=
dev
->
platform_data
;
struct
fsl_spi_platform_data
*
pdata
=
dev
_get_platdata
(
dev
)
;
struct
mpc8xxx_spi_probe_info
*
pinfo
=
to_of_pinfo
(
pdata
);
struct
mpc8xxx_spi_probe_info
*
pinfo
=
to_of_pinfo
(
pdata
);
int
ngpios
;
int
ngpios
;
int
i
=
0
;
int
i
=
0
;
...
@@ -790,7 +791,7 @@ static int of_fsl_spi_get_chipselects(struct device *dev)
...
@@ -790,7 +791,7 @@ static int of_fsl_spi_get_chipselects(struct device *dev)
static
int
of_fsl_spi_free_chipselects
(
struct
device
*
dev
)
static
int
of_fsl_spi_free_chipselects
(
struct
device
*
dev
)
{
{
struct
fsl_spi_platform_data
*
pdata
=
dev
->
platform_data
;
struct
fsl_spi_platform_data
*
pdata
=
dev
_get_platdata
(
dev
)
;
struct
mpc8xxx_spi_probe_info
*
pinfo
=
to_of_pinfo
(
pdata
);
struct
mpc8xxx_spi_probe_info
*
pinfo
=
to_of_pinfo
(
pdata
);
int
i
;
int
i
;
...
@@ -889,7 +890,7 @@ static int plat_mpc8xxx_spi_probe(struct platform_device *pdev)
...
@@ -889,7 +890,7 @@ static int plat_mpc8xxx_spi_probe(struct platform_device *pdev)
int
irq
;
int
irq
;
struct
spi_master
*
master
;
struct
spi_master
*
master
;
if
(
!
pdev
->
dev
.
platform_data
)
if
(
!
dev_get_platdata
(
&
pdev
->
dev
)
)
return
-
EINVAL
;
return
-
EINVAL
;
mem
=
platform_get_resource
(
pdev
,
IORESOURCE_MEM
,
0
);
mem
=
platform_get_resource
(
pdev
,
IORESOURCE_MEM
,
0
);
...
...
drivers/spi/spi-gpio.c
View file @
68aa4cb3
...
@@ -420,7 +420,7 @@ static int spi_gpio_probe(struct platform_device *pdev)
...
@@ -420,7 +420,7 @@ static int spi_gpio_probe(struct platform_device *pdev)
if
(
status
>
0
)
if
(
status
>
0
)
use_of
=
1
;
use_of
=
1
;
pdata
=
pdev
->
dev
.
platform_data
;
pdata
=
dev_get_platdata
(
&
pdev
->
dev
)
;
#ifdef GENERIC_BITBANG
#ifdef GENERIC_BITBANG
if
(
!
pdata
||
!
pdata
->
num_chipselect
)
if
(
!
pdata
||
!
pdata
->
num_chipselect
)
return
-
ENODEV
;
return
-
ENODEV
;
...
@@ -506,7 +506,7 @@ static int spi_gpio_remove(struct platform_device *pdev)
...
@@ -506,7 +506,7 @@ static int spi_gpio_remove(struct platform_device *pdev)
int
status
;
int
status
;
spi_gpio
=
platform_get_drvdata
(
pdev
);
spi_gpio
=
platform_get_drvdata
(
pdev
);
pdata
=
pdev
->
dev
.
platform_data
;
pdata
=
dev_get_platdata
(
&
pdev
->
dev
)
;
/* stop() unregisters child devices too */
/* stop() unregisters child devices too */
status
=
spi_bitbang_stop
(
&
spi_gpio
->
bitbang
);
status
=
spi_bitbang_stop
(
&
spi_gpio
->
bitbang
);
...
...
drivers/spi/spi-mpc512x-psc.c
View file @
68aa4cb3
...
@@ -469,7 +469,7 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr,
...
@@ -469,7 +469,7 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr,
u32
size
,
unsigned
int
irq
,
u32
size
,
unsigned
int
irq
,
s16
bus_num
)
s16
bus_num
)
{
{
struct
fsl_spi_platform_data
*
pdata
=
dev
->
platform_data
;
struct
fsl_spi_platform_data
*
pdata
=
dev
_get_platdata
(
dev
)
;
struct
mpc512x_psc_spi
*
mps
;
struct
mpc512x_psc_spi
*
mps
;
struct
spi_master
*
master
;
struct
spi_master
*
master
;
int
ret
;
int
ret
;
...
...
drivers/spi/spi-mpc52xx-psc.c
View file @
68aa4cb3
...
@@ -366,7 +366,7 @@ static irqreturn_t mpc52xx_psc_spi_isr(int irq, void *dev_id)
...
@@ -366,7 +366,7 @@ static irqreturn_t mpc52xx_psc_spi_isr(int irq, void *dev_id)
static
int
mpc52xx_psc_spi_do_probe
(
struct
device
*
dev
,
u32
regaddr
,
static
int
mpc52xx_psc_spi_do_probe
(
struct
device
*
dev
,
u32
regaddr
,
u32
size
,
unsigned
int
irq
,
s16
bus_num
)
u32
size
,
unsigned
int
irq
,
s16
bus_num
)
{
{
struct
fsl_spi_platform_data
*
pdata
=
dev
->
platform_data
;
struct
fsl_spi_platform_data
*
pdata
=
dev
_get_platdata
(
dev
)
;
struct
mpc52xx_psc_spi
*
mps
;
struct
mpc52xx_psc_spi
*
mps
;
struct
spi_master
*
master
;
struct
spi_master
*
master
;
int
ret
;
int
ret
;
...
...
drivers/spi/spi-nuc900.c
View file @
68aa4cb3
...
@@ -350,7 +350,7 @@ static int nuc900_spi_probe(struct platform_device *pdev)
...
@@ -350,7 +350,7 @@ static int nuc900_spi_probe(struct platform_device *pdev)
hw
=
spi_master_get_devdata
(
master
);
hw
=
spi_master_get_devdata
(
master
);
hw
->
master
=
spi_master_get
(
master
);
hw
->
master
=
spi_master_get
(
master
);
hw
->
pdata
=
pdev
->
dev
.
platform_data
;
hw
->
pdata
=
dev_get_platdata
(
&
pdev
->
dev
)
;
hw
->
dev
=
&
pdev
->
dev
;
hw
->
dev
=
&
pdev
->
dev
;
if
(
hw
->
pdata
==
NULL
)
{
if
(
hw
->
pdata
==
NULL
)
{
...
...
drivers/spi/spi-oc-tiny.c
View file @
68aa4cb3
...
@@ -285,7 +285,7 @@ static int tiny_spi_of_probe(struct platform_device *pdev)
...
@@ -285,7 +285,7 @@ static int tiny_spi_of_probe(struct platform_device *pdev)
static
int
tiny_spi_probe
(
struct
platform_device
*
pdev
)
static
int
tiny_spi_probe
(
struct
platform_device
*
pdev
)
{
{
struct
tiny_spi_platform_data
*
platp
=
pdev
->
dev
.
platform_data
;
struct
tiny_spi_platform_data
*
platp
=
dev_get_platdata
(
&
pdev
->
dev
)
;
struct
tiny_spi
*
hw
;
struct
tiny_spi
*
hw
;
struct
spi_master
*
master
;
struct
spi_master
*
master
;
struct
resource
*
res
;
struct
resource
*
res
;
...
...
drivers/spi/spi-omap-100k.c
View file @
68aa4cb3
...
@@ -441,7 +441,7 @@ static int omap1_spi100k_probe(struct platform_device *pdev)
...
@@ -441,7 +441,7 @@ static int omap1_spi100k_probe(struct platform_device *pdev)
* You should allocate this with ioremap() before initializing
* You should allocate this with ioremap() before initializing
* the SPI.
* the SPI.
*/
*/
spi100k
->
base
=
(
void
__iomem
*
)
pdev
->
dev
.
platform_data
;
spi100k
->
base
=
(
void
__iomem
*
)
dev_get_platdata
(
&
pdev
->
dev
)
;
spi100k
->
ick
=
devm_clk_get
(
&
pdev
->
dev
,
"ick"
);
spi100k
->
ick
=
devm_clk_get
(
&
pdev
->
dev
,
"ick"
);
if
(
IS_ERR
(
spi100k
->
ick
))
{
if
(
IS_ERR
(
spi100k
->
ick
))
{
...
...
drivers/spi/spi-omap2-mcspi.c
View file @
68aa4cb3
...
@@ -1340,7 +1340,7 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
...
@@ -1340,7 +1340,7 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
if
(
of_get_property
(
node
,
"ti,pindir-d0-out-d1-in"
,
NULL
))
if
(
of_get_property
(
node
,
"ti,pindir-d0-out-d1-in"
,
NULL
))
mcspi
->
pin_dir
=
MCSPI_PINDIR_D0_OUT_D1_IN
;
mcspi
->
pin_dir
=
MCSPI_PINDIR_D0_OUT_D1_IN
;
}
else
{
}
else
{
pdata
=
pdev
->
dev
.
platform_data
;
pdata
=
dev_get_platdata
(
&
pdev
->
dev
)
;
master
->
num_chipselect
=
pdata
->
num_cs
;
master
->
num_chipselect
=
pdata
->
num_cs
;
if
(
pdev
->
id
!=
-
1
)
if
(
pdev
->
id
!=
-
1
)
master
->
bus_num
=
pdev
->
id
;
master
->
bus_num
=
pdev
->
id
;
...
...
drivers/spi/spi-pl022.c
View file @
68aa4cb3
...
@@ -2091,7 +2091,8 @@ pl022_platform_data_dt_get(struct device *dev)
...
@@ -2091,7 +2091,8 @@ pl022_platform_data_dt_get(struct device *dev)
static
int
pl022_probe
(
struct
amba_device
*
adev
,
const
struct
amba_id
*
id
)
static
int
pl022_probe
(
struct
amba_device
*
adev
,
const
struct
amba_id
*
id
)
{
{
struct
device
*
dev
=
&
adev
->
dev
;
struct
device
*
dev
=
&
adev
->
dev
;
struct
pl022_ssp_controller
*
platform_info
=
adev
->
dev
.
platform_data
;
struct
pl022_ssp_controller
*
platform_info
=
dev_get_platdata
(
&
adev
->
dev
);
struct
spi_master
*
master
;
struct
spi_master
*
master
;
struct
pl022
*
pl022
=
NULL
;
/*Data for this driver */
struct
pl022
*
pl022
=
NULL
;
/*Data for this driver */
struct
device_node
*
np
=
adev
->
dev
.
of_node
;
struct
device_node
*
np
=
adev
->
dev
.
of_node
;
...
...
drivers/spi/spi-rspi.c
View file @
68aa4cb3
...
@@ -564,8 +564,12 @@ static void rspi_work(struct work_struct *work)
...
@@ -564,8 +564,12 @@ static void rspi_work(struct work_struct *work)
unsigned
long
flags
;
unsigned
long
flags
;
int
ret
;
int
ret
;
while
(
1
)
{
spin_lock_irqsave
(
&
rspi
->
lock
,
flags
);
spin_lock_irqsave
(
&
rspi
->
lock
,
flags
);
while
(
!
list_empty
(
&
rspi
->
queue
))
{
if
(
list_empty
(
&
rspi
->
queue
))
{
spin_unlock_irqrestore
(
&
rspi
->
lock
,
flags
);
break
;
}
mesg
=
list_entry
(
rspi
->
queue
.
next
,
struct
spi_message
,
queue
);
mesg
=
list_entry
(
rspi
->
queue
.
next
,
struct
spi_message
,
queue
);
list_del_init
(
&
mesg
->
queue
);
list_del_init
(
&
mesg
->
queue
);
spin_unlock_irqrestore
(
&
rspi
->
lock
,
flags
);
spin_unlock_irqrestore
(
&
rspi
->
lock
,
flags
);
...
@@ -595,8 +599,6 @@ static void rspi_work(struct work_struct *work)
...
@@ -595,8 +599,6 @@ static void rspi_work(struct work_struct *work)
mesg
->
status
=
0
;
mesg
->
status
=
0
;
mesg
->
complete
(
mesg
->
context
);
mesg
->
complete
(
mesg
->
context
);
spin_lock_irqsave
(
&
rspi
->
lock
,
flags
);
}
}
return
;
return
;
...
@@ -664,12 +666,13 @@ static irqreturn_t rspi_irq(int irq, void *_sr)
...
@@ -664,12 +666,13 @@ static irqreturn_t rspi_irq(int irq, void *_sr)
static
int
rspi_request_dma
(
struct
rspi_data
*
rspi
,
static
int
rspi_request_dma
(
struct
rspi_data
*
rspi
,
struct
platform_device
*
pdev
)
struct
platform_device
*
pdev
)
{
{
struct
rspi_plat_data
*
rspi_pd
=
pdev
->
dev
.
platform_data
;
struct
rspi_plat_data
*
rspi_pd
=
dev_get_platdata
(
&
pdev
->
dev
);
struct
resource
*
res
=
platform_get_resource
(
pdev
,
IORESOURCE_MEM
,
0
);
dma_cap_mask_t
mask
;
dma_cap_mask_t
mask
;
struct
dma_slave_config
cfg
;
struct
dma_slave_config
cfg
;
int
ret
;
int
ret
;
if
(
!
rspi_pd
)
if
(
!
r
es
||
!
r
spi_pd
)
return
0
;
/* The driver assumes no error. */
return
0
;
/* The driver assumes no error. */
rspi
->
dma_width_16bit
=
rspi_pd
->
dma_width_16bit
;
rspi
->
dma_width_16bit
=
rspi_pd
->
dma_width_16bit
;
...
@@ -683,6 +686,8 @@ static int rspi_request_dma(struct rspi_data *rspi,
...
@@ -683,6 +686,8 @@ static int rspi_request_dma(struct rspi_data *rspi,
if
(
rspi
->
chan_rx
)
{
if
(
rspi
->
chan_rx
)
{
cfg
.
slave_id
=
rspi_pd
->
dma_rx_id
;
cfg
.
slave_id
=
rspi_pd
->
dma_rx_id
;
cfg
.
direction
=
DMA_DEV_TO_MEM
;
cfg
.
direction
=
DMA_DEV_TO_MEM
;
cfg
.
dst_addr
=
0
;
cfg
.
src_addr
=
res
->
start
+
RSPI_SPDR
;
ret
=
dmaengine_slave_config
(
rspi
->
chan_rx
,
&
cfg
);
ret
=
dmaengine_slave_config
(
rspi
->
chan_rx
,
&
cfg
);
if
(
!
ret
)
if
(
!
ret
)
dev_info
(
&
pdev
->
dev
,
"Use DMA when rx.
\n
"
);
dev_info
(
&
pdev
->
dev
,
"Use DMA when rx.
\n
"
);
...
@@ -698,6 +703,8 @@ static int rspi_request_dma(struct rspi_data *rspi,
...
@@ -698,6 +703,8 @@ static int rspi_request_dma(struct rspi_data *rspi,
if
(
rspi
->
chan_tx
)
{
if
(
rspi
->
chan_tx
)
{
cfg
.
slave_id
=
rspi_pd
->
dma_tx_id
;
cfg
.
slave_id
=
rspi_pd
->
dma_tx_id
;
cfg
.
direction
=
DMA_MEM_TO_DEV
;
cfg
.
direction
=
DMA_MEM_TO_DEV
;
cfg
.
dst_addr
=
res
->
start
+
RSPI_SPDR
;
cfg
.
src_addr
=
0
;
ret
=
dmaengine_slave_config
(
rspi
->
chan_tx
,
&
cfg
);
ret
=
dmaengine_slave_config
(
rspi
->
chan_tx
,
&
cfg
);
if
(
!
ret
)
if
(
!
ret
)
dev_info
(
&
pdev
->
dev
,
"Use DMA when tx
\n
"
);
dev_info
(
&
pdev
->
dev
,
"Use DMA when tx
\n
"
);
...
...
drivers/spi/spi-s3c24xx.c
View file @
68aa4cb3
...
@@ -525,7 +525,7 @@ static int s3c24xx_spi_probe(struct platform_device *pdev)
...
@@ -525,7 +525,7 @@ static int s3c24xx_spi_probe(struct platform_device *pdev)
memset
(
hw
,
0
,
sizeof
(
struct
s3c24xx_spi
));
memset
(
hw
,
0
,
sizeof
(
struct
s3c24xx_spi
));
hw
->
master
=
spi_master_get
(
master
);
hw
->
master
=
spi_master_get
(
master
);
hw
->
pdata
=
pdata
=
pdev
->
dev
.
platform_data
;
hw
->
pdata
=
pdata
=
dev_get_platdata
(
&
pdev
->
dev
)
;
hw
->
dev
=
&
pdev
->
dev
;
hw
->
dev
=
&
pdev
->
dev
;
if
(
pdata
==
NULL
)
{
if
(
pdata
==
NULL
)
{
...
@@ -690,7 +690,7 @@ static int s3c24xx_spi_remove(struct platform_device *dev)
...
@@ -690,7 +690,7 @@ static int s3c24xx_spi_remove(struct platform_device *dev)
static
int
s3c24xx_spi_suspend
(
struct
device
*
dev
)
static
int
s3c24xx_spi_suspend
(
struct
device
*
dev
)
{
{
struct
s3c24xx_spi
*
hw
=
platform_get_drvdata
(
to_platform_device
(
dev
)
);
struct
s3c24xx_spi
*
hw
=
dev_get_drvdata
(
dev
);
if
(
hw
->
pdata
&&
hw
->
pdata
->
gpio_setup
)
if
(
hw
->
pdata
&&
hw
->
pdata
->
gpio_setup
)
hw
->
pdata
->
gpio_setup
(
hw
->
pdata
,
0
);
hw
->
pdata
->
gpio_setup
(
hw
->
pdata
,
0
);
...
@@ -701,7 +701,7 @@ static int s3c24xx_spi_suspend(struct device *dev)
...
@@ -701,7 +701,7 @@ static int s3c24xx_spi_suspend(struct device *dev)
static
int
s3c24xx_spi_resume
(
struct
device
*
dev
)
static
int
s3c24xx_spi_resume
(
struct
device
*
dev
)
{
{
struct
s3c24xx_spi
*
hw
=
platform_get_drvdata
(
to_platform_device
(
dev
)
);
struct
s3c24xx_spi
*
hw
=
dev_get_drvdata
(
dev
);
s3c24xx_spi_initialsetup
(
hw
);
s3c24xx_spi_initialsetup
(
hw
);
return
0
;
return
0
;
...
...
drivers/spi/spi-s3c64xx.c
View file @
68aa4cb3
...
@@ -1275,7 +1275,7 @@ static struct s3c64xx_spi_info *s3c64xx_spi_parse_dt(struct device *dev)
...
@@ -1275,7 +1275,7 @@ static struct s3c64xx_spi_info *s3c64xx_spi_parse_dt(struct device *dev)
#else
#else
static
struct
s3c64xx_spi_info
*
s3c64xx_spi_parse_dt
(
struct
device
*
dev
)
static
struct
s3c64xx_spi_info
*
s3c64xx_spi_parse_dt
(
struct
device
*
dev
)
{
{
return
dev
->
platform_data
;
return
dev
_get_platdata
(
dev
)
;
}
}
#endif
#endif
...
@@ -1300,7 +1300,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
...
@@ -1300,7 +1300,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
struct
resource
*
mem_res
;
struct
resource
*
mem_res
;
struct
resource
*
res
;
struct
resource
*
res
;
struct
s3c64xx_spi_driver_data
*
sdd
;
struct
s3c64xx_spi_driver_data
*
sdd
;
struct
s3c64xx_spi_info
*
sci
=
pdev
->
dev
.
platform_data
;
struct
s3c64xx_spi_info
*
sci
=
dev_get_platdata
(
&
pdev
->
dev
)
;
struct
spi_master
*
master
;
struct
spi_master
*
master
;
int
ret
,
irq
;
int
ret
,
irq
;
char
clk_name
[
16
];
char
clk_name
[
16
];
...
...
drivers/spi/spi-sh-msiof.c
View file @
68aa4cb3
...
@@ -645,7 +645,7 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
...
@@ -645,7 +645,7 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
if
(
pdev
->
dev
.
of_node
)
if
(
pdev
->
dev
.
of_node
)
p
->
info
=
sh_msiof_spi_parse_dt
(
&
pdev
->
dev
);
p
->
info
=
sh_msiof_spi_parse_dt
(
&
pdev
->
dev
);
else
else
p
->
info
=
pdev
->
dev
.
platform_data
;
p
->
info
=
dev_get_platdata
(
&
pdev
->
dev
)
;
if
(
!
p
->
info
)
{
if
(
!
p
->
info
)
{
dev_err
(
&
pdev
->
dev
,
"failed to obtain device info
\n
"
);
dev_err
(
&
pdev
->
dev
,
"failed to obtain device info
\n
"
);
...
...
drivers/spi/spi-sh-sci.c
View file @
68aa4cb3
...
@@ -130,7 +130,7 @@ static int sh_sci_spi_probe(struct platform_device *dev)
...
@@ -130,7 +130,7 @@ static int sh_sci_spi_probe(struct platform_device *dev)
sp
=
spi_master_get_devdata
(
master
);
sp
=
spi_master_get_devdata
(
master
);
platform_set_drvdata
(
dev
,
sp
);
platform_set_drvdata
(
dev
,
sp
);
sp
->
info
=
dev
->
dev
.
platform_data
;
sp
->
info
=
dev
_get_platdata
(
&
dev
->
dev
)
;
/* setup spi bitbang adaptor */
/* setup spi bitbang adaptor */
sp
->
bitbang
.
master
=
spi_master_get
(
master
);
sp
->
bitbang
.
master
=
spi_master_get
(
master
);
...
...
drivers/spi/spi-sirf.c
View file @
68aa4cb3
...
@@ -599,8 +599,7 @@ static int spi_sirfsoc_remove(struct platform_device *pdev)
...
@@ -599,8 +599,7 @@ static int spi_sirfsoc_remove(struct platform_device *pdev)
#ifdef CONFIG_PM
#ifdef CONFIG_PM
static
int
spi_sirfsoc_suspend
(
struct
device
*
dev
)
static
int
spi_sirfsoc_suspend
(
struct
device
*
dev
)
{
{
struct
platform_device
*
pdev
=
to_platform_device
(
dev
);
struct
spi_master
*
master
=
dev_get_drvdata
(
dev
);
struct
spi_master
*
master
=
platform_get_drvdata
(
pdev
);
struct
sirfsoc_spi
*
sspi
=
spi_master_get_devdata
(
master
);
struct
sirfsoc_spi
*
sspi
=
spi_master_get_devdata
(
master
);
clk_disable
(
sspi
->
clk
);
clk_disable
(
sspi
->
clk
);
...
@@ -609,8 +608,7 @@ static int spi_sirfsoc_suspend(struct device *dev)
...
@@ -609,8 +608,7 @@ static int spi_sirfsoc_suspend(struct device *dev)
static
int
spi_sirfsoc_resume
(
struct
device
*
dev
)
static
int
spi_sirfsoc_resume
(
struct
device
*
dev
)
{
{
struct
platform_device
*
pdev
=
to_platform_device
(
dev
);
struct
spi_master
*
master
=
dev_get_drvdata
(
dev
);
struct
spi_master
*
master
=
platform_get_drvdata
(
pdev
);
struct
sirfsoc_spi
*
sspi
=
spi_master_get_devdata
(
master
);
struct
sirfsoc_spi
*
sspi
=
spi_master_get_devdata
(
master
);
clk_enable
(
sspi
->
clk
);
clk_enable
(
sspi
->
clk
);
...
...
drivers/spi/spi-ti-ssp.c
View file @
68aa4cb3
...
@@ -283,7 +283,7 @@ static int ti_ssp_spi_probe(struct platform_device *pdev)
...
@@ -283,7 +283,7 @@ static int ti_ssp_spi_probe(struct platform_device *pdev)
struct
device
*
dev
=
&
pdev
->
dev
;
struct
device
*
dev
=
&
pdev
->
dev
;
int
error
=
0
;
int
error
=
0
;
pdata
=
dev
->
platform_data
;
pdata
=
dev
_get_platdata
(
dev
)
;
if
(
!
pdata
)
{
if
(
!
pdata
)
{
dev_err
(
dev
,
"platform data not found
\n
"
);
dev_err
(
dev
,
"platform data not found
\n
"
);
return
-
EINVAL
;
return
-
EINVAL
;
...
...
drivers/spi/spi-tle62x0.c
View file @
68aa4cb3
...
@@ -247,7 +247,7 @@ static int tle62x0_probe(struct spi_device *spi)
...
@@ -247,7 +247,7 @@ static int tle62x0_probe(struct spi_device *spi)
int
ptr
;
int
ptr
;
int
ret
;
int
ret
;
pdata
=
spi
->
dev
.
platform_data
;
pdata
=
dev_get_platdata
(
&
spi
->
dev
)
;
if
(
pdata
==
NULL
)
{
if
(
pdata
==
NULL
)
{
dev_err
(
&
spi
->
dev
,
"no device data specified
\n
"
);
dev_err
(
&
spi
->
dev
,
"no device data specified
\n
"
);
return
-
EINVAL
;
return
-
EINVAL
;
...
...
drivers/spi/spi-xilinx.c
View file @
68aa4cb3
...
@@ -80,10 +80,9 @@ struct xilinx_spi {
...
@@ -80,10 +80,9 @@ struct xilinx_spi {
/* bitbang has to be first */
/* bitbang has to be first */
struct
spi_bitbang
bitbang
;
struct
spi_bitbang
bitbang
;
struct
completion
done
;
struct
completion
done
;
struct
resource
mem
;
/* phys mem */
void
__iomem
*
regs
;
/* virt. address of the control registers */
void
__iomem
*
regs
;
/* virt. address of the control registers */
u32
irq
;
int
irq
;
u8
*
rx_ptr
;
/* pointer in the Tx buffer */
u8
*
rx_ptr
;
/* pointer in the Tx buffer */
const
u8
*
tx_ptr
;
/* pointer in the Rx buffer */
const
u8
*
tx_ptr
;
/* pointer in the Rx buffer */
...
@@ -340,17 +339,34 @@ static const struct of_device_id xilinx_spi_of_match[] = {
...
@@ -340,17 +339,34 @@ static const struct of_device_id xilinx_spi_of_match[] = {
};
};
MODULE_DEVICE_TABLE
(
of
,
xilinx_spi_of_match
);
MODULE_DEVICE_TABLE
(
of
,
xilinx_spi_of_match
);
struct
spi_master
*
xilinx_spi_init
(
struct
device
*
dev
,
struct
resource
*
mem
,
static
int
xilinx_spi_probe
(
struct
platform_device
*
pdev
)
u32
irq
,
s16
bus_num
,
int
num_cs
,
int
bits_per_word
)
{
{
struct
spi_master
*
master
;
struct
xilinx_spi
*
xspi
;
struct
xilinx_spi
*
xspi
;
int
ret
;
struct
xspi_platform_data
*
pdata
;
struct
resource
*
res
;
int
ret
,
num_cs
=
0
,
bits_per_word
=
8
;
struct
spi_master
*
master
;
u32
tmp
;
u32
tmp
;
u8
i
;
pdata
=
dev_get_platdata
(
&
pdev
->
dev
);
if
(
pdata
)
{
num_cs
=
pdata
->
num_chipselect
;
bits_per_word
=
pdata
->
bits_per_word
;
}
else
{
of_property_read_u32
(
pdev
->
dev
.
of_node
,
"xlnx,num-ss-bits"
,
&
num_cs
);
}
master
=
spi_alloc_master
(
dev
,
sizeof
(
struct
xilinx_spi
));
if
(
!
num_cs
)
{
dev_err
(
&
pdev
->
dev
,
"Missing slave select configuration data
\n
"
);
return
-
EINVAL
;
}
master
=
spi_alloc_master
(
&
pdev
->
dev
,
sizeof
(
struct
xilinx_spi
));
if
(
!
master
)
if
(
!
master
)
return
NULL
;
return
-
ENODEV
;
/* the spi->mode bits understood by this driver: */
/* the spi->mode bits understood by this driver: */
master
->
mode_bits
=
SPI_CPOL
|
SPI_CPHA
;
master
->
mode_bits
=
SPI_CPOL
|
SPI_CPHA
;
...
@@ -362,22 +378,16 @@ struct spi_master *xilinx_spi_init(struct device *dev, struct resource *mem,
...
@@ -362,22 +378,16 @@ struct spi_master *xilinx_spi_init(struct device *dev, struct resource *mem,
xspi
->
bitbang
.
txrx_bufs
=
xilinx_spi_txrx_bufs
;
xspi
->
bitbang
.
txrx_bufs
=
xilinx_spi_txrx_bufs
;
init_completion
(
&
xspi
->
done
);
init_completion
(
&
xspi
->
done
);
if
(
!
request_mem_region
(
mem
->
start
,
resource_size
(
mem
),
res
=
platform_get_resource
(
pdev
,
IORESOURCE_MEM
,
0
);
XILINX_SPI_NAME
))
xspi
->
regs
=
devm_ioremap_resource
(
&
pdev
->
dev
,
res
);
if
(
IS_ERR
(
xspi
->
regs
))
{
ret
=
PTR_ERR
(
xspi
->
regs
);
goto
put_master
;
goto
put_master
;
xspi
->
regs
=
ioremap
(
mem
->
start
,
resource_size
(
mem
));
if
(
xspi
->
regs
==
NULL
)
{
dev_warn
(
dev
,
"ioremap failure
\n
"
);
goto
map_failed
;
}
}
master
->
bus_num
=
bus_num
;
master
->
bus_num
=
pdev
->
dev
.
id
;
master
->
num_chipselect
=
num_cs
;
master
->
num_chipselect
=
num_cs
;
master
->
dev
.
of_node
=
dev
->
of_node
;
master
->
dev
.
of_node
=
pdev
->
dev
.
of_node
;
xspi
->
mem
=
*
mem
;
xspi
->
irq
=
irq
;
/*
/*
* Detect endianess on the IP via loop bit in CR. Detection
* Detect endianess on the IP via loop bit in CR. Detection
...
@@ -407,113 +417,63 @@ struct spi_master *xilinx_spi_init(struct device *dev, struct resource *mem,
...
@@ -407,113 +417,63 @@ struct spi_master *xilinx_spi_init(struct device *dev, struct resource *mem,
}
else
if
(
xspi
->
bits_per_word
==
32
)
{
}
else
if
(
xspi
->
bits_per_word
==
32
)
{
xspi
->
tx_fn
=
xspi_tx32
;
xspi
->
tx_fn
=
xspi_tx32
;
xspi
->
rx_fn
=
xspi_rx32
;
xspi
->
rx_fn
=
xspi_rx32
;
}
else
}
else
{
goto
unmap_io
;
ret
=
-
EINVAL
;
goto
put_master
;
}
/* SPI controller initializations */
/* SPI controller initializations */
xspi_init_hw
(
xspi
);
xspi_init_hw
(
xspi
);
xspi
->
irq
=
platform_get_irq
(
pdev
,
0
);
if
(
xspi
->
irq
<
0
)
{
ret
=
xspi
->
irq
;
goto
put_master
;
}
/* Register for SPI Interrupt */
/* Register for SPI Interrupt */
ret
=
request_irq
(
xspi
->
irq
,
xilinx_spi_irq
,
0
,
XILINX_SPI_NAME
,
xspi
);
ret
=
devm_request_irq
(
&
pdev
->
dev
,
xspi
->
irq
,
xilinx_spi_irq
,
0
,
dev_name
(
&
pdev
->
dev
),
xspi
);
if
(
ret
)
if
(
ret
)
goto
unmap_io
;
goto
put_master
;
ret
=
spi_bitbang_start
(
&
xspi
->
bitbang
);
ret
=
spi_bitbang_start
(
&
xspi
->
bitbang
);
if
(
ret
)
{
if
(
ret
)
{
dev_err
(
dev
,
"spi_bitbang_start FAILED
\n
"
);
dev_err
(
&
pdev
->
dev
,
"spi_bitbang_start FAILED
\n
"
);
goto
free_irq
;
goto
put_master
;
}
dev_info
(
dev
,
"at 0x%08llX mapped to 0x%p, irq=%d
\n
"
,
(
unsigned
long
long
)
mem
->
start
,
xspi
->
regs
,
xspi
->
irq
);
return
master
;
free_irq:
free_irq
(
xspi
->
irq
,
xspi
);
unmap_io:
iounmap
(
xspi
->
regs
);
map_failed:
release_mem_region
(
mem
->
start
,
resource_size
(
mem
));
put_master:
spi_master_put
(
master
);
return
NULL
;
}
EXPORT_SYMBOL
(
xilinx_spi_init
);
void
xilinx_spi_deinit
(
struct
spi_master
*
master
)
{
struct
xilinx_spi
*
xspi
;
xspi
=
spi_master_get_devdata
(
master
);
spi_bitbang_stop
(
&
xspi
->
bitbang
);
free_irq
(
xspi
->
irq
,
xspi
);
iounmap
(
xspi
->
regs
);
release_mem_region
(
xspi
->
mem
.
start
,
resource_size
(
&
xspi
->
mem
));
spi_master_put
(
xspi
->
bitbang
.
master
);
}
EXPORT_SYMBOL
(
xilinx_spi_deinit
);
static
int
xilinx_spi_probe
(
struct
platform_device
*
dev
)
{
struct
xspi_platform_data
*
pdata
;
struct
resource
*
r
;
int
irq
,
num_cs
=
0
,
bits_per_word
=
8
;
struct
spi_master
*
master
;
u8
i
;
pdata
=
dev
->
dev
.
platform_data
;
if
(
pdata
)
{
num_cs
=
pdata
->
num_chipselect
;
bits_per_word
=
pdata
->
bits_per_word
;
}
#ifdef CONFIG_OF
if
(
dev
->
dev
.
of_node
)
{
const
__be32
*
prop
;
int
len
;
/* number of slave select bits is required */
prop
=
of_get_property
(
dev
->
dev
.
of_node
,
"xlnx,num-ss-bits"
,
&
len
);
if
(
prop
&&
len
>=
sizeof
(
*
prop
))
num_cs
=
__be32_to_cpup
(
prop
);
}
#endif
if
(
!
num_cs
)
{
dev_err
(
&
dev
->
dev
,
"Missing slave select configuration data
\n
"
);
return
-
EINVAL
;
}
}
dev_info
(
&
pdev
->
dev
,
"at 0x%08llX mapped to 0x%p, irq=%d
\n
"
,
r
=
platform_get_resource
(
dev
,
IORESOURCE_MEM
,
0
);
(
unsigned
long
long
)
res
->
start
,
xspi
->
regs
,
xspi
->
irq
);
if
(
!
r
)
return
-
ENODEV
;
irq
=
platform_get_irq
(
dev
,
0
);
if
(
irq
<
0
)
return
-
ENXIO
;
master
=
xilinx_spi_init
(
&
dev
->
dev
,
r
,
irq
,
dev
->
id
,
num_cs
,
bits_per_word
);
if
(
!
master
)
return
-
ENODEV
;
if
(
pdata
)
{
if
(
pdata
)
{
for
(
i
=
0
;
i
<
pdata
->
num_devices
;
i
++
)
for
(
i
=
0
;
i
<
pdata
->
num_devices
;
i
++
)
spi_new_device
(
master
,
pdata
->
devices
+
i
);
spi_new_device
(
master
,
pdata
->
devices
+
i
);
}
}
platform_set_drvdata
(
dev
,
master
);
platform_set_drvdata
(
p
dev
,
master
);
return
0
;
return
0
;
put_master:
spi_master_put
(
master
);
return
ret
;
}
}
static
int
xilinx_spi_remove
(
struct
platform_device
*
dev
)
static
int
xilinx_spi_remove
(
struct
platform_device
*
p
dev
)
{
{
xilinx_spi_deinit
(
platform_get_drvdata
(
dev
));
struct
spi_master
*
master
=
platform_get_drvdata
(
pdev
);
struct
xilinx_spi
*
xspi
=
spi_master_get_devdata
(
master
);
void
__iomem
*
regs_base
=
xspi
->
regs
;
spi_bitbang_stop
(
&
xspi
->
bitbang
);
/* Disable all the interrupts just in case */
xspi
->
write_fn
(
0
,
regs_base
+
XIPIF_V123B_IIER_OFFSET
);
/* Disable the global IPIF interrupt */
xspi
->
write_fn
(
0
,
regs_base
+
XIPIF_V123B_DGIER_OFFSET
);
spi_master_put
(
xspi
->
bitbang
.
master
);
return
0
;
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