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
8e37befc
Commit
8e37befc
authored
Sep 01, 2013
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'spi/topic/imx' into spi-next
parents
497cb447
27743e0b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
50 deletions
+26
-50
drivers/spi/spi-imx.c
drivers/spi/spi-imx.c
+26
-50
No files found.
drivers/spi/spi-imx.c
View file @
8e37befc
...
...
@@ -619,6 +619,7 @@ static const struct of_device_id spi_imx_dt_ids[] = {
{
.
compatible
=
"fsl,imx51-ecspi"
,
.
data
=
&
imx51_ecspi_devtype_data
,
},
{
/* sentinel */
}
};
MODULE_DEVICE_TABLE
(
of
,
spi_imx_dt_ids
);
static
void
spi_imx_chipselect
(
struct
spi_device
*
spi
,
int
is_active
)
{
...
...
@@ -796,10 +797,11 @@ static int spi_imx_probe(struct platform_device *pdev)
if
(
!
gpio_is_valid
(
cs_gpio
))
continue
;
ret
=
gpio_request
(
spi_imx
->
chipselect
[
i
],
DRIVER_NAME
);
ret
=
devm_gpio_request
(
&
pdev
->
dev
,
spi_imx
->
chipselect
[
i
],
DRIVER_NAME
);
if
(
ret
)
{
dev_err
(
&
pdev
->
dev
,
"can't get cs gpios
\n
"
);
goto
out_
gpio_free
;
goto
out_
master_put
;
}
}
...
...
@@ -816,50 +818,44 @@ static int spi_imx_probe(struct platform_device *pdev)
(
struct
spi_imx_devtype_data
*
)
pdev
->
id_entry
->
driver_data
;
res
=
platform_get_resource
(
pdev
,
IORESOURCE_MEM
,
0
);
if
(
!
res
)
{
dev_err
(
&
pdev
->
dev
,
"can't get platform resource
\n
"
);
ret
=
-
ENOMEM
;
goto
out_gpio_free
;
}
if
(
!
request_mem_region
(
res
->
start
,
resource_size
(
res
),
pdev
->
name
))
{
dev_err
(
&
pdev
->
dev
,
"request_mem_region failed
\n
"
);
ret
=
-
EBUSY
;
goto
out_gpio_free
;
}
spi_imx
->
base
=
ioremap
(
res
->
start
,
resource_size
(
res
));
if
(
!
spi_imx
->
base
)
{
ret
=
-
EINVAL
;
goto
out_release_mem
;
spi_imx
->
base
=
devm_ioremap_resource
(
&
pdev
->
dev
,
res
);
if
(
IS_ERR
(
spi_imx
->
base
))
{
ret
=
PTR_ERR
(
spi_imx
->
base
);
goto
out_master_put
;
}
spi_imx
->
irq
=
platform_get_irq
(
pdev
,
0
);
if
(
spi_imx
->
irq
<
0
)
{
ret
=
-
EINVAL
;
goto
out_
iounmap
;
goto
out_
master_put
;
}
ret
=
request_irq
(
spi_imx
->
irq
,
spi_imx_isr
,
0
,
DRIVER_NAME
,
spi_imx
);
ret
=
devm_request_irq
(
&
pdev
->
dev
,
spi_imx
->
irq
,
spi_imx_isr
,
0
,
DRIVER_NAME
,
spi_imx
);
if
(
ret
)
{
dev_err
(
&
pdev
->
dev
,
"can't get irq%d: %d
\n
"
,
spi_imx
->
irq
,
ret
);
goto
out_
iounmap
;
goto
out_
master_put
;
}
spi_imx
->
clk_ipg
=
devm_clk_get
(
&
pdev
->
dev
,
"ipg"
);
if
(
IS_ERR
(
spi_imx
->
clk_ipg
))
{
ret
=
PTR_ERR
(
spi_imx
->
clk_ipg
);
goto
out_
free_irq
;
goto
out_
master_put
;
}
spi_imx
->
clk_per
=
devm_clk_get
(
&
pdev
->
dev
,
"per"
);
if
(
IS_ERR
(
spi_imx
->
clk_per
))
{
ret
=
PTR_ERR
(
spi_imx
->
clk_per
);
goto
out_
free_irq
;
goto
out_
master_put
;
}
clk_prepare_enable
(
spi_imx
->
clk_per
);
clk_prepare_enable
(
spi_imx
->
clk_ipg
);
ret
=
clk_prepare_enable
(
spi_imx
->
clk_per
);
if
(
ret
)
goto
out_master_put
;
ret
=
clk_prepare_enable
(
spi_imx
->
clk_ipg
);
if
(
ret
)
goto
out_put_per
;
spi_imx
->
spi_clk
=
clk_get_rate
(
spi_imx
->
clk_per
);
...
...
@@ -879,47 +875,27 @@ static int spi_imx_probe(struct platform_device *pdev)
return
ret
;
out_clk_put:
clk_disable_unprepare
(
spi_imx
->
clk_per
);
clk_disable_unprepare
(
spi_imx
->
clk_ipg
);
out_free_irq:
free_irq
(
spi_imx
->
irq
,
spi_imx
);
out_iounmap:
iounmap
(
spi_imx
->
base
);
out_release_mem:
release_mem_region
(
res
->
start
,
resource_size
(
res
));
out_gpio_free:
while
(
--
i
>=
0
)
{
if
(
gpio_is_valid
(
spi_imx
->
chipselect
[
i
]))
gpio_free
(
spi_imx
->
chipselect
[
i
]);
}
out_put_per:
clk_disable_unprepare
(
spi_imx
->
clk_per
);
out_master_put:
spi_master_put
(
master
);
kfree
(
master
);
return
ret
;
}
static
int
spi_imx_remove
(
struct
platform_device
*
pdev
)
{
struct
spi_master
*
master
=
platform_get_drvdata
(
pdev
);
struct
resource
*
res
=
platform_get_resource
(
pdev
,
IORESOURCE_MEM
,
0
);
struct
spi_imx_data
*
spi_imx
=
spi_master_get_devdata
(
master
);
int
i
;
spi_bitbang_stop
(
&
spi_imx
->
bitbang
);
writel
(
0
,
spi_imx
->
base
+
MXC_CSPICTRL
);
clk_disable_unprepare
(
spi_imx
->
clk_per
);
clk_disable_unprepare
(
spi_imx
->
clk_ipg
);
free_irq
(
spi_imx
->
irq
,
spi_imx
);
iounmap
(
spi_imx
->
base
);
for
(
i
=
0
;
i
<
master
->
num_chipselect
;
i
++
)
if
(
gpio_is_valid
(
spi_imx
->
chipselect
[
i
]))
gpio_free
(
spi_imx
->
chipselect
[
i
]);
clk_disable_unprepare
(
spi_imx
->
clk_per
);
spi_master_put
(
master
);
release_mem_region
(
res
->
start
,
resource_size
(
res
));
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