Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
linux-seco-imx
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Jira
Code
Merge requests
11
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Clea OS
bsp
nxp
linux-seco-imx
Commits
44c5d739
Commit
44c5d739
authored
15 years ago
by
Russell King
Browse files
Options
Downloads
Patches
Plain Diff
ARM: PNX4008: kzalloc i2c drivers internal data
Signed-off-by:
Russell King
<
rmk+kernel@arm.linux.org.uk
>
parent
88d968b2
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
arch/arm/mach-pnx4008/i2c.c
+7
-18
7 additions, 18 deletions
arch/arm/mach-pnx4008/i2c.c
drivers/i2c/busses/i2c-pnx.c
+19
-10
19 additions, 10 deletions
drivers/i2c/busses/i2c-pnx.c
include/linux/i2c-pnx.h
+2
-2
2 additions, 2 deletions
include/linux/i2c-pnx.h
with
28 additions
and
30 deletions
arch/arm/mach-pnx4008/i2c.c
+
7
−
18
View file @
44c5d739
...
@@ -18,45 +18,34 @@
...
@@ -18,45 +18,34 @@
#include
<mach/irqs.h>
#include
<mach/irqs.h>
#include
<mach/i2c.h>
#include
<mach/i2c.h>
static
struct
i2c_pnx_algo_data
pnx_algo_data0
=
{
.
base
=
PNX4008_I2C1_BASE
,
.
irq
=
I2C_1_INT
,
};
static
struct
i2c_pnx_algo_data
pnx_algo_data1
=
{
.
base
=
PNX4008_I2C2_BASE
,
.
irq
=
I2C_2_INT
,
};
static
struct
i2c_pnx_algo_data
pnx_algo_data2
=
{
.
base
=
(
PNX4008_USB_CONFIG_BASE
+
0x300
),
.
irq
=
USB_I2C_INT
,
};
static
struct
i2c_adapter
pnx_adapter0
=
{
static
struct
i2c_adapter
pnx_adapter0
=
{
.
name
=
I2C_CHIP_NAME
"0"
,
.
name
=
I2C_CHIP_NAME
"0"
,
.
algo_data
=
&
pnx_algo_data0
,
};
};
static
struct
i2c_adapter
pnx_adapter1
=
{
static
struct
i2c_adapter
pnx_adapter1
=
{
.
name
=
I2C_CHIP_NAME
"1"
,
.
name
=
I2C_CHIP_NAME
"1"
,
.
algo_data
=
&
pnx_algo_data1
,
};
};
static
struct
i2c_adapter
pnx_adapter2
=
{
static
struct
i2c_adapter
pnx_adapter2
=
{
.
name
=
"USB-I2C"
,
.
name
=
"USB-I2C"
,
.
algo_data
=
&
pnx_algo_data2
,
};
};
static
struct
i2c_pnx_data
i2c0_data
=
{
static
struct
i2c_pnx_data
i2c0_data
=
{
.
adapter
=
&
pnx_adapter0
,
.
adapter
=
&
pnx_adapter0
,
.
base
=
PNX4008_I2C1_BASE
,
.
irq
=
I2C_1_INT
,
};
};
static
struct
i2c_pnx_data
i2c1_data
=
{
static
struct
i2c_pnx_data
i2c1_data
=
{
.
adapter
=
&
pnx_adapter1
,
.
adapter
=
&
pnx_adapter1
,
.
base
=
PNX4008_I2C2_BASE
,
.
irq
=
I2C_2_INT
,
};
};
static
struct
i2c_pnx_data
i2c2_data
=
{
static
struct
i2c_pnx_data
i2c2_data
=
{
.
adapter
=
&
pnx_adapter2
,
.
adapter
=
&
pnx_adapter2
,
.
base
=
(
PNX4008_USB_CONFIG_BASE
+
0x300
),
.
irq
=
USB_I2C_INT
,
};
};
static
struct
platform_device
i2c0_device
=
{
static
struct
platform_device
i2c0_device
=
{
...
...
This diff is collapsed.
Click to expand it.
drivers/i2c/busses/i2c-pnx.c
+
19
−
10
View file @
44c5d739
...
@@ -587,10 +587,16 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
...
@@ -587,10 +587,16 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
goto
out
;
goto
out
;
}
}
alg_data
=
kzalloc
(
sizeof
(
*
alg_data
),
GFP_KERNEL
);
if
(
!
alg_data
)
{
ret
=
-
ENOMEM
;
goto
err_kzalloc
;
}
platform_set_drvdata
(
pdev
,
i2c_pnx
);
platform_set_drvdata
(
pdev
,
i2c_pnx
);
i2c_pnx
->
adapter
->
algo
=
&
pnx_algorithm
;
i2c_pnx
->
adapter
->
algo
=
&
pnx_algorithm
;
alg_data
=
i2c_pnx
->
adapter
->
algo_data
;
i2c_pnx
->
adapter
->
algo_data
=
alg_data
;
alg_data
->
clk
=
clk_get
(
&
pdev
->
dev
,
NULL
);
alg_data
->
clk
=
clk_get
(
&
pdev
->
dev
,
NULL
);
if
(
IS_ERR
(
alg_data
->
clk
))
{
if
(
IS_ERR
(
alg_data
->
clk
))
{
...
@@ -603,16 +609,16 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
...
@@ -603,16 +609,16 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
alg_data
->
mif
.
timer
.
data
=
(
unsigned
long
)
i2c_pnx
->
adapter
;
alg_data
->
mif
.
timer
.
data
=
(
unsigned
long
)
i2c_pnx
->
adapter
;
/* Register I/O resource */
/* Register I/O resource */
if
(
!
request_mem_region
(
alg_data
->
base
,
I2C_PNX_REGION_SIZE
,
if
(
!
request_mem_region
(
i2c_pnx
->
base
,
I2C_PNX_REGION_SIZE
,
pdev
->
name
))
{
pdev
->
name
))
{
dev_err
(
&
pdev
->
dev
,
dev_err
(
&
pdev
->
dev
,
"I/O region 0x%08x for I2C already in use.
\n
"
,
"I/O region 0x%08x for I2C already in use.
\n
"
,
alg_data
->
base
);
i2c_pnx
->
base
);
ret
=
-
ENODEV
;
ret
=
-
ENODEV
;
goto
out_clkget
;
goto
out_clkget
;
}
}
alg_data
->
ioaddr
=
ioremap
(
alg_data
->
base
,
I2C_PNX_REGION_SIZE
);
alg_data
->
ioaddr
=
ioremap
(
i2c_pnx
->
base
,
I2C_PNX_REGION_SIZE
);
if
(
!
alg_data
->
ioaddr
)
{
if
(
!
alg_data
->
ioaddr
)
{
dev_err
(
&
pdev
->
dev
,
"Couldn't ioremap I2C I/O region
\n
"
);
dev_err
(
&
pdev
->
dev
,
"Couldn't ioremap I2C I/O region
\n
"
);
ret
=
-
ENOMEM
;
ret
=
-
ENOMEM
;
...
@@ -647,7 +653,7 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
...
@@ -647,7 +653,7 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
}
}
init_completion
(
&
alg_data
->
mif
.
complete
);
init_completion
(
&
alg_data
->
mif
.
complete
);
ret
=
request_irq
(
alg_data
->
irq
,
i2c_pnx_interrupt
,
ret
=
request_irq
(
i2c_pnx
->
irq
,
i2c_pnx_interrupt
,
0
,
pdev
->
name
,
i2c_pnx
->
adapter
);
0
,
pdev
->
name
,
i2c_pnx
->
adapter
);
if
(
ret
)
if
(
ret
)
goto
out_clock
;
goto
out_clock
;
...
@@ -662,21 +668,23 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
...
@@ -662,21 +668,23 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
}
}
dev_dbg
(
&
pdev
->
dev
,
"%s: Master at %#8x, irq %d.
\n
"
,
dev_dbg
(
&
pdev
->
dev
,
"%s: Master at %#8x, irq %d.
\n
"
,
i2c_pnx
->
adapter
->
name
,
alg_data
->
base
,
alg_data
->
irq
);
i2c_pnx
->
adapter
->
name
,
i2c_pnx
->
base
,
i2c_pnx
->
irq
);
return
0
;
return
0
;
out_irq:
out_irq:
free_irq
(
alg_data
->
irq
,
i2c_pnx
->
adapter
);
free_irq
(
i2c_pnx
->
irq
,
i2c_pnx
->
adapter
);
out_clock:
out_clock:
clk_disable
(
alg_data
->
clk
);
clk_disable
(
alg_data
->
clk
);
out_unmap:
out_unmap:
iounmap
(
alg_data
->
ioaddr
);
iounmap
(
alg_data
->
ioaddr
);
out_release:
out_release:
release_mem_region
(
alg_data
->
base
,
I2C_PNX_REGION_SIZE
);
release_mem_region
(
i2c_pnx
->
base
,
I2C_PNX_REGION_SIZE
);
out_clkget:
out_clkget:
clk_put
(
alg_data
->
clk
);
clk_put
(
alg_data
->
clk
);
out_drvdata:
out_drvdata:
kfree
(
alg_data
);
err_kzalloc:
platform_set_drvdata
(
pdev
,
NULL
);
platform_set_drvdata
(
pdev
,
NULL
);
out:
out:
return
ret
;
return
ret
;
...
@@ -688,12 +696,13 @@ static int __devexit i2c_pnx_remove(struct platform_device *pdev)
...
@@ -688,12 +696,13 @@ static int __devexit i2c_pnx_remove(struct platform_device *pdev)
struct
i2c_adapter
*
adap
=
i2c_pnx
->
adapter
;
struct
i2c_adapter
*
adap
=
i2c_pnx
->
adapter
;
struct
i2c_pnx_algo_data
*
alg_data
=
adap
->
algo_data
;
struct
i2c_pnx_algo_data
*
alg_data
=
adap
->
algo_data
;
free_irq
(
alg_data
->
irq
,
i2c_pnx
->
adapter
);
free_irq
(
i2c_pnx
->
irq
,
i2c_pnx
->
adapter
);
i2c_del_adapter
(
adap
);
i2c_del_adapter
(
adap
);
clk_disable
(
alg_data
->
clk
);
clk_disable
(
alg_data
->
clk
);
iounmap
(
alg_data
->
ioaddr
);
iounmap
(
alg_data
->
ioaddr
);
release_mem_region
(
alg_data
->
base
,
I2C_PNX_REGION_SIZE
);
release_mem_region
(
i2c_pnx
->
base
,
I2C_PNX_REGION_SIZE
);
clk_put
(
alg_data
->
clk
);
clk_put
(
alg_data
->
clk
);
kfree
(
alg_data
);
platform_set_drvdata
(
pdev
,
NULL
);
platform_set_drvdata
(
pdev
,
NULL
);
return
0
;
return
0
;
...
...
This diff is collapsed.
Click to expand it.
include/linux/i2c-pnx.h
+
2
−
2
View file @
44c5d739
...
@@ -25,9 +25,7 @@ struct i2c_pnx_mif {
...
@@ -25,9 +25,7 @@ struct i2c_pnx_mif {
};
};
struct
i2c_pnx_algo_data
{
struct
i2c_pnx_algo_data
{
u32
base
;
void
__iomem
*
ioaddr
;
void
__iomem
*
ioaddr
;
int
irq
;
struct
i2c_pnx_mif
mif
;
struct
i2c_pnx_mif
mif
;
int
last
;
int
last
;
struct
clk
*
clk
;
struct
clk
*
clk
;
...
@@ -35,6 +33,8 @@ struct i2c_pnx_algo_data {
...
@@ -35,6 +33,8 @@ struct i2c_pnx_algo_data {
struct
i2c_pnx_data
{
struct
i2c_pnx_data
{
struct
i2c_adapter
*
adapter
;
struct
i2c_adapter
*
adapter
;
u32
base
;
int
irq
;
};
};
#endif
/* __I2C_PNX_H__ */
#endif
/* __I2C_PNX_H__ */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment