Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
c3cef3f3
Commit
c3cef3f3
authored
Aug 20, 2007
by
Russell King
Committed by
Russell King
Oct 12, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ARM] pxa: update pxa i2c driver to use clk support
Signed-off-by:
Russell King
<
rmk+kernel@arm.linux.org.uk
>
parent
72e3524c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
20 deletions
+25
-20
drivers/i2c/busses/i2c-pxa.c
drivers/i2c/busses/i2c-pxa.c
+25
-20
No files found.
drivers/i2c/busses/i2c-pxa.c
View file @
c3cef3f3
...
@@ -31,6 +31,8 @@
...
@@ -31,6 +31,8 @@
#include <linux/interrupt.h>
#include <linux/interrupt.h>
#include <linux/i2c-pxa.h>
#include <linux/i2c-pxa.h>
#include <linux/platform_device.h>
#include <linux/platform_device.h>
#include <linux/err.h>
#include <linux/clk.h>
#include <asm/hardware.h>
#include <asm/hardware.h>
#include <asm/irq.h>
#include <asm/irq.h>
...
@@ -48,6 +50,7 @@ struct pxa_i2c {
...
@@ -48,6 +50,7 @@ struct pxa_i2c {
unsigned
int
slave_addr
;
unsigned
int
slave_addr
;
struct
i2c_adapter
adap
;
struct
i2c_adapter
adap
;
struct
clk
*
clk
;
#ifdef CONFIG_I2C_PXA_SLAVE
#ifdef CONFIG_I2C_PXA_SLAVE
struct
i2c_slave_client
*
slave
;
struct
i2c_slave_client
*
slave
;
#endif
#endif
...
@@ -869,6 +872,12 @@ static int i2c_pxa_probe(struct platform_device *dev)
...
@@ -869,6 +872,12 @@ static int i2c_pxa_probe(struct platform_device *dev)
sprintf
(
i2c
->
adap
.
name
,
"pxa_i2c-i2c.%u"
,
dev
->
id
);
sprintf
(
i2c
->
adap
.
name
,
"pxa_i2c-i2c.%u"
,
dev
->
id
);
i2c
->
clk
=
clk_get
(
&
dev
->
dev
,
"I2CCLK"
);
if
(
IS_ERR
(
i2c
->
clk
))
{
ret
=
PTR_ERR
(
i2c
->
clk
);
goto
eclk
;
}
i2c
->
reg_base
=
ioremap
(
res
->
start
,
res_len
(
res
));
i2c
->
reg_base
=
ioremap
(
res
->
start
,
res_len
(
res
));
if
(
!
i2c
->
reg_base
)
{
if
(
!
i2c
->
reg_base
)
{
ret
=
-
EIO
;
ret
=
-
EIO
;
...
@@ -889,22 +898,19 @@ static int i2c_pxa_probe(struct platform_device *dev)
...
@@ -889,22 +898,19 @@ static int i2c_pxa_probe(struct platform_device *dev)
}
}
#endif
#endif
clk_enable
(
i2c
->
clk
);
#ifdef CONFIG_PXA27x
switch
(
dev
->
id
)
{
switch
(
dev
->
id
)
{
case
0
:
case
0
:
#ifdef CONFIG_PXA27x
pxa_gpio_mode
(
GPIO117_I2CSCL_MD
);
pxa_gpio_mode
(
GPIO117_I2CSCL_MD
);
pxa_gpio_mode
(
GPIO118_I2CSDA_MD
);
pxa_gpio_mode
(
GPIO118_I2CSDA_MD
);
#endif
pxa_set_cken
(
CKEN_I2C
,
1
);
break
;
break
;
#ifdef CONFIG_PXA27x
case
1
:
case
1
:
local_irq_disable
();
local_irq_disable
();
PCFR
|=
PCFR_PI2CEN
;
PCFR
|=
PCFR_PI2CEN
;
local_irq_enable
();
local_irq_enable
();
pxa_set_cken
(
CKEN_PWRI2C
,
1
);
#endif
}
}
#endif
ret
=
request_irq
(
irq
,
i2c_pxa_handler
,
IRQF_DISABLED
,
ret
=
request_irq
(
irq
,
i2c_pxa_handler
,
IRQF_DISABLED
,
i2c
->
adap
.
name
,
i2c
);
i2c
->
adap
.
name
,
i2c
);
...
@@ -948,19 +954,18 @@ static int i2c_pxa_probe(struct platform_device *dev)
...
@@ -948,19 +954,18 @@ static int i2c_pxa_probe(struct platform_device *dev)
eadapt:
eadapt:
free_irq
(
irq
,
i2c
);
free_irq
(
irq
,
i2c
);
ereqirq:
ereqirq:
switch
(
dev
->
id
)
{
clk_disable
(
i2c
->
clk
);
case
0
:
pxa_set_cken
(
CKEN_I2C
,
0
);
break
;
#ifdef CONFIG_PXA27x
#ifdef CONFIG_PXA27x
case
1
:
if
(
dev
->
id
==
1
)
{
pxa_set_cken
(
CKEN_PWRI2C
,
0
);
local_irq_disable
();
local_irq_disable
();
PCFR
&=
~
PCFR_PI2CEN
;
PCFR
&=
~
PCFR_PI2CEN
;
local_irq_enable
();
local_irq_enable
();
#endif
}
}
#endif
eremap:
eremap:
clk_put
(
i2c
->
clk
);
eclk:
kfree
(
i2c
);
kfree
(
i2c
);
emalloc:
emalloc:
release_mem_region
(
res
->
start
,
res_len
(
res
));
release_mem_region
(
res
->
start
,
res_len
(
res
));
...
@@ -975,18 +980,18 @@ static int i2c_pxa_remove(struct platform_device *dev)
...
@@ -975,18 +980,18 @@ static int i2c_pxa_remove(struct platform_device *dev)
i2c_del_adapter
(
&
i2c
->
adap
);
i2c_del_adapter
(
&
i2c
->
adap
);
free_irq
(
i2c
->
irq
,
i2c
);
free_irq
(
i2c
->
irq
,
i2c
);
switch
(
dev
->
id
)
{
c
ase
0
:
c
lk_disable
(
i2c
->
clk
);
pxa_set_cken
(
CKEN_I2C
,
0
);
clk_put
(
i2c
->
clk
);
break
;
#ifdef CONFIG_PXA27x
#ifdef CONFIG_PXA27x
case
1
:
if
(
dev
->
id
==
1
)
{
pxa_set_cken
(
CKEN_PWRI2C
,
0
);
local_irq_disable
();
local_irq_disable
();
PCFR
&=
~
PCFR_PI2CEN
;
PCFR
&=
~
PCFR_PI2CEN
;
local_irq_enable
();
local_irq_enable
();
#endif
}
}
#endif
release_mem_region
(
i2c
->
iobase
,
i2c
->
iosize
);
release_mem_region
(
i2c
->
iobase
,
i2c
->
iosize
);
kfree
(
i2c
);
kfree
(
i2c
);
...
...
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