* [U-Boot] [PATCH 1/6 V2] EXYNOS5: FDT: Add I2C device node data
2012-11-14 9:11 [U-Boot] [PATCH 0/6 V2] EXYNOS5: FDT Support for I2C Rajeshwari Shinde
@ 2012-11-14 9:11 ` Rajeshwari Shinde
2012-11-15 6:56 ` Heiko Schocher
2012-11-19 8:54 ` Heiko Schocher
2012-11-14 9:11 ` [U-Boot] [PATCH 2/6 V2] EXYNOS5 : FDT: Add Aliases for I2C device Rajeshwari Shinde
` (5 subsequent siblings)
6 siblings, 2 replies; 23+ messages in thread
From: Rajeshwari Shinde @ 2012-11-14 9:11 UTC (permalink / raw)
To: u-boot
Add I2C device node data for exynos
Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
---
Changes in V2:
Added Periph id to the I2C device node
arch/arm/dts/exynos-periph-id.dtsi | 35 +++++++++++++++++
arch/arm/dts/exynos5250.dtsi | 73 ++++++++++++++++++++++++++++++++++++
2 files changed, 108 insertions(+), 0 deletions(-)
create mode 100644 arch/arm/dts/exynos-periph-id.dtsi
diff --git a/arch/arm/dts/exynos-periph-id.dtsi b/arch/arm/dts/exynos-periph-id.dtsi
new file mode 100644
index 0000000..cfe2c3d
--- /dev/null
+++ b/arch/arm/dts/exynos-periph-id.dtsi
@@ -0,0 +1,35 @@
+/*
+ * U-Boot Peripheral ID header file for Exynos boards
+ *
+ * Copyright (c) 2012 The Chromium OS Authors.
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/*
+ * These values come from arch/arm/include/arch-exynos5/periph.h. For
+ * now they must be manually kept in sync.
+ */
+/define/ PERIPH_ID_I2C0 <0>;
+/define/ PERIPH_ID_I2C1 <1>;
+/define/ PERIPH_ID_I2C2 <2>;
+/define/ PERIPH_ID_I2C3 <3>;
+/define/ PERIPH_ID_I2C4 <4>;
+/define/ PERIPH_ID_I2C5 <5>;
+/define/ PERIPH_ID_I2C6 <6>;
+/define/ PERIPH_ID_I2C7 <7>;
diff --git a/arch/arm/dts/exynos5250.dtsi b/arch/arm/dts/exynos5250.dtsi
index db22db6..ae71ae4 100644
--- a/arch/arm/dts/exynos5250.dtsi
+++ b/arch/arm/dts/exynos5250.dtsi
@@ -18,6 +18,7 @@
*/
/include/ "skeleton.dtsi"
+/include/ "exynos-periph-id.dtsi"
/ {
compatible = "samsung,exynos5250";
@@ -33,4 +34,76 @@
compatible = "samsung,exynos-tmu";
reg = <0x10060000 0xffff>;
};
+
+ i2c at 12c60000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "samsung,s3c2440-i2c";
+ reg = <0x12C60000 0x100>;
+ samsung,periph-id = <PERIPH_ID_I2C0>;
+ interrupts = <0 56 0>;
+ };
+
+ i2c at 12c70000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "samsung,s3c2440-i2c";
+ reg = <0x12C70000 0x100>;
+ samsung,periph-id = <PERIPH_ID_I2C1>;
+ interrupts = <0 57 0>;
+ };
+
+ i2c at 12c80000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "samsung,s3c2440-i2c";
+ reg = <0x12C80000 0x100>;
+ samsung,periph-id = <PERIPH_ID_I2C2>;
+ interrupts = <0 58 0>;
+ };
+
+ i2c at 12c90000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "samsung,s3c2440-i2c";
+ reg = <0x12C90000 0x100>;
+ samsung,periph-id = <PERIPH_ID_I2C3>;
+ interrupts = <0 59 0>;
+ };
+
+ i2c at 12ca0000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "samsung,s3c2440-i2c";
+ reg = <0x12CA0000 0x100>;
+ samsung,periph-id = <PERIPH_ID_I2C4>;
+ interrupts = <0 60 0>;
+ };
+
+ i2c at 12cb0000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "samsung,s3c2440-i2c";
+ reg = <0x12CB0000 0x100>;
+ samsung,periph-id = <PERIPH_ID_I2C5>;
+ interrupts = <0 61 0>;
+ };
+
+ i2c at 12cc0000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "samsung,s3c2440-i2c";
+ reg = <0x12CC0000 0x100>;
+ samsung,periph-id = <PERIPH_ID_I2C6>;
+ interrupts = <0 62 0>;
+ };
+
+ i2c at 12cd0000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "samsung,s3c2440-i2c";
+ reg = <0x12CD0000 0x100>;
+ samsung,periph-id = <PERIPH_ID_I2C7>;
+ interrupts = <0 63 0>;
+ };
};
--
1.7.4.4
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [U-Boot] [PATCH 1/6 V2] EXYNOS5: FDT: Add I2C device node data
2012-11-14 9:11 ` [U-Boot] [PATCH 1/6 V2] EXYNOS5: FDT: Add I2C device node data Rajeshwari Shinde
@ 2012-11-15 6:56 ` Heiko Schocher
2012-11-15 10:58 ` Rajeshwari Birje
2012-11-19 8:54 ` Heiko Schocher
1 sibling, 1 reply; 23+ messages in thread
From: Heiko Schocher @ 2012-11-15 6:56 UTC (permalink / raw)
To: u-boot
Hello Rajeshwari
On 14.11.2012 10:11, Rajeshwari Shinde wrote:
> Add I2C device node data for exynos
>
> Signed-off-by: Rajeshwari Shinde<rajeshwari.s@samsung.com>
> Acked-by: Simon Glass<sjg@chromium.org>
> ---
> Changes in V2:
> Added Periph id to the I2C device node
> arch/arm/dts/exynos-periph-id.dtsi | 35 +++++++++++++++++
> arch/arm/dts/exynos5250.dtsi | 73 ++++++++++++++++++++++++++++++++++++
> 2 files changed, 108 insertions(+), 0 deletions(-)
> create mode 100644 arch/arm/dts/exynos-periph-id.dtsi
I tried to apply this patch to current mainline head
commit 59852d03867108217fe88e3bfc3e1e9cedfe63c5
Merge: 22b6fcb b3e5cd1
Author: Tom Rini <trini@ti.com>
Date: Fri Nov 9 08:47:25 2012 -0700
Merge branch 'master' of git://www.denx.de/git/u-boot-microblaze
but I got this error:
[hs at pollux u-boot-i2c]$ git am index.html
Applying: EXYNOS5: FDT: Add I2C device node data
error: arch/arm/dts/exynos5250.dtsi: does not exist in index
Patch failed at 0001 EXYNOS5: FDT: Add I2C device node data
When you have resolved this problem run "git am --resolved".
If you would prefer to skip this patch, instead run "git am --skip".
To restore the original branch and stop patching run "git am --abort".
[hs at pollux u-boot-i2c]$
Against which tree is this patchset? Should it go through
the samsung tree from Minkyu Kang found here:
http://git.denx.de/u-boot-samsung.git
? If so, I send my Acked-by for this patchset ...
bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
^ permalink raw reply [flat|nested] 23+ messages in thread
* [U-Boot] [PATCH 1/6 V2] EXYNOS5: FDT: Add I2C device node data
2012-11-15 6:56 ` Heiko Schocher
@ 2012-11-15 10:58 ` Rajeshwari Birje
2012-11-15 12:14 ` Minkyu Kang
0 siblings, 1 reply; 23+ messages in thread
From: Rajeshwari Birje @ 2012-11-15 10:58 UTC (permalink / raw)
To: u-boot
Hi Heiko,
Thank you for Acking the patchset.
It is based on u-boot-samsung, where the basic FDT support patches for
Exynos are submitted.
Regards
Rajeshwari Shinde.
On Thu, Nov 15, 2012 at 12:26 PM, Heiko Schocher <hs@denx.de> wrote:
> Hello Rajeshwari
>
>
> On 14.11.2012 10:11, Rajeshwari Shinde wrote:
>>
>> Add I2C device node data for exynos
>>
>> Signed-off-by: Rajeshwari Shinde<rajeshwari.s@samsung.com>
>> Acked-by: Simon Glass<sjg@chromium.org>
>> ---
>> Changes in V2:
>> Added Periph id to the I2C device node
>> arch/arm/dts/exynos-periph-id.dtsi | 35 +++++++++++++++++
>> arch/arm/dts/exynos5250.dtsi | 73
>> ++++++++++++++++++++++++++++++++++++
>> 2 files changed, 108 insertions(+), 0 deletions(-)
>> create mode 100644 arch/arm/dts/exynos-periph-id.dtsi
>
>
> I tried to apply this patch to current mainline head
> commit 59852d03867108217fe88e3bfc3e1e9cedfe63c5
> Merge: 22b6fcb b3e5cd1
> Author: Tom Rini <trini@ti.com>
> Date: Fri Nov 9 08:47:25 2012 -0700
>
> Merge branch 'master' of git://www.denx.de/git/u-boot-microblaze
>
> but I got this error:
>
> [hs at pollux u-boot-i2c]$ git am index.html
> Applying: EXYNOS5: FDT: Add I2C device node data
> error: arch/arm/dts/exynos5250.dtsi: does not exist in index
> Patch failed at 0001 EXYNOS5: FDT: Add I2C device node data
> When you have resolved this problem run "git am --resolved".
> If you would prefer to skip this patch, instead run "git am --skip".
> To restore the original branch and stop patching run "git am --abort".
> [hs at pollux u-boot-i2c]$
>
> Against which tree is this patchset? Should it go through
> the samsung tree from Minkyu Kang found here:
>
> http://git.denx.de/u-boot-samsung.git
>
> ? If so, I send my Acked-by for this patchset ...
>
> bye,
> Heiko
> --
> DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
^ permalink raw reply [flat|nested] 23+ messages in thread
* [U-Boot] [PATCH 1/6 V2] EXYNOS5: FDT: Add I2C device node data
2012-11-15 10:58 ` Rajeshwari Birje
@ 2012-11-15 12:14 ` Minkyu Kang
0 siblings, 0 replies; 23+ messages in thread
From: Minkyu Kang @ 2012-11-15 12:14 UTC (permalink / raw)
To: u-boot
Dear Heiko,
On 15/11/12 19:58, Rajeshwari Birje wrote:
> Hi Heiko,
>
> Thank you for Acking the patchset.
> It is based on u-boot-samsung, where the basic FDT support patches for
> Exynos are submitted.
>
> Regards
> Rajeshwari Shinde.
>
> On Thu, Nov 15, 2012 at 12:26 PM, Heiko Schocher <hs@denx.de> wrote:
>> Hello Rajeshwari
>>
>>
>> On 14.11.2012 10:11, Rajeshwari Shinde wrote:
>>>
>>> Add I2C device node data for exynos
>>>
>>> Signed-off-by: Rajeshwari Shinde<rajeshwari.s@samsung.com>
>>> Acked-by: Simon Glass<sjg@chromium.org>
>>> ---
>>> Changes in V2:
>>> Added Periph id to the I2C device node
>>> arch/arm/dts/exynos-periph-id.dtsi | 35 +++++++++++++++++
>>> arch/arm/dts/exynos5250.dtsi | 73
>>> ++++++++++++++++++++++++++++++++++++
>>> 2 files changed, 108 insertions(+), 0 deletions(-)
>>> create mode 100644 arch/arm/dts/exynos-periph-id.dtsi
>>
>>
>> I tried to apply this patch to current mainline head
>> commit 59852d03867108217fe88e3bfc3e1e9cedfe63c5
>> Merge: 22b6fcb b3e5cd1
>> Author: Tom Rini <trini@ti.com>
>> Date: Fri Nov 9 08:47:25 2012 -0700
>>
>> Merge branch 'master' of git://www.denx.de/git/u-boot-microblaze
>>
>> but I got this error:
>>
>> [hs at pollux u-boot-i2c]$ git am index.html
>> Applying: EXYNOS5: FDT: Add I2C device node data
>> error: arch/arm/dts/exynos5250.dtsi: does not exist in index
>> Patch failed at 0001 EXYNOS5: FDT: Add I2C device node data
>> When you have resolved this problem run "git am --resolved".
>> If you would prefer to skip this patch, instead run "git am --skip".
>> To restore the original branch and stop patching run "git am --abort".
>> [hs at pollux u-boot-i2c]$
>>
>> Against which tree is this patchset? Should it go through
>> the samsung tree from Minkyu Kang found here:
>>
>> http://git.denx.de/u-boot-samsung.git
>>
>> ? If so, I send my Acked-by for this patchset ...
>>
I'll merge this patchset to samsung tree.
Please send your Ack.
Thanks.
Minkyu Kang.
^ permalink raw reply [flat|nested] 23+ messages in thread
* [U-Boot] [PATCH 1/6 V2] EXYNOS5: FDT: Add I2C device node data
2012-11-14 9:11 ` [U-Boot] [PATCH 1/6 V2] EXYNOS5: FDT: Add I2C device node data Rajeshwari Shinde
2012-11-15 6:56 ` Heiko Schocher
@ 2012-11-19 8:54 ` Heiko Schocher
2012-11-19 16:42 ` Simon Glass
1 sibling, 1 reply; 23+ messages in thread
From: Heiko Schocher @ 2012-11-19 8:54 UTC (permalink / raw)
To: u-boot
Hello Rajeshwari,
On 14.11.2012 10:11, Rajeshwari Shinde wrote:
> Add I2C device node data for exynos
>
> Signed-off-by: Rajeshwari Shinde<rajeshwari.s@samsung.com>
> Acked-by: Simon Glass<sjg@chromium.org>
> ---
> Changes in V2:
> Added Periph id to the I2C device node
> arch/arm/dts/exynos-periph-id.dtsi | 35 +++++++++++++++++
> arch/arm/dts/exynos5250.dtsi | 73 ++++++++++++++++++++++++++++++++++++
> 2 files changed, 108 insertions(+), 0 deletions(-)
> create mode 100644 arch/arm/dts/exynos-periph-id.dtsi
Acked-by: Heiko Schocher <hs@denx.de>
bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
^ permalink raw reply [flat|nested] 23+ messages in thread
* [U-Boot] [PATCH 1/6 V2] EXYNOS5: FDT: Add I2C device node data
2012-11-19 8:54 ` Heiko Schocher
@ 2012-11-19 16:42 ` Simon Glass
2012-11-20 1:36 ` Minkyu Kang
0 siblings, 1 reply; 23+ messages in thread
From: Simon Glass @ 2012-11-19 16:42 UTC (permalink / raw)
To: u-boot
Hi,
On Mon, Nov 19, 2012 at 12:54 AM, Heiko Schocher <hs@denx.de> wrote:
> Hello Rajeshwari,
>
>
> On 14.11.2012 10:11, Rajeshwari Shinde wrote:
>>
>> Add I2C device node data for exynos
>>
>> Signed-off-by: Rajeshwari Shinde<rajeshwari.s@samsung.com>
>> Acked-by: Simon Glass<sjg@chromium.org>
>> ---
>> Changes in V2:
>> Added Periph id to the I2C device node
>> arch/arm/dts/exynos-periph-id.dtsi | 35 +++++++++++++++++
>> arch/arm/dts/exynos5250.dtsi | 73
>> ++++++++++++++++++++++++++++++++++++
>> 2 files changed, 108 insertions(+), 0 deletions(-)
>> create mode 100644 arch/arm/dts/exynos-periph-id.dtsi
>
>
> Acked-by: Heiko Schocher <hs@denx.de>
I'm sorry to say that there is one problem with this. It is using a
non-standard dtc feature (Stephen Warren's symbolic work), so I think
we should wait until Rajeshwari updates it to avoid that. I believe he
will do that soon.
Regards,
Simon
>
>
> bye,
> Heiko
> --
> DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
^ permalink raw reply [flat|nested] 23+ messages in thread
* [U-Boot] [PATCH 1/6 V2] EXYNOS5: FDT: Add I2C device node data
2012-11-19 16:42 ` Simon Glass
@ 2012-11-20 1:36 ` Minkyu Kang
0 siblings, 0 replies; 23+ messages in thread
From: Minkyu Kang @ 2012-11-20 1:36 UTC (permalink / raw)
To: u-boot
On 20/11/12 01:42, Simon Glass wrote:
> Hi,
>
> On Mon, Nov 19, 2012 at 12:54 AM, Heiko Schocher <hs@denx.de> wrote:
>> Hello Rajeshwari,
>>
>>
>> On 14.11.2012 10:11, Rajeshwari Shinde wrote:
>>>
>>> Add I2C device node data for exynos
>>>
>>> Signed-off-by: Rajeshwari Shinde<rajeshwari.s@samsung.com>
>>> Acked-by: Simon Glass<sjg@chromium.org>
>>> ---
>>> Changes in V2:
>>> Added Periph id to the I2C device node
>>> arch/arm/dts/exynos-periph-id.dtsi | 35 +++++++++++++++++
>>> arch/arm/dts/exynos5250.dtsi | 73
>>> ++++++++++++++++++++++++++++++++++++
>>> 2 files changed, 108 insertions(+), 0 deletions(-)
>>> create mode 100644 arch/arm/dts/exynos-periph-id.dtsi
>>
>>
>> Acked-by: Heiko Schocher <hs@denx.de>
>
> I'm sorry to say that there is one problem with this. It is using a
> non-standard dtc feature (Stephen Warren's symbolic work), so I think
> we should wait until Rajeshwari updates it to avoid that. I believe he
> will do that soon.
>
OK.
Thanks.
Minkyu Kang.
^ permalink raw reply [flat|nested] 23+ messages in thread
* [U-Boot] [PATCH 2/6 V2] EXYNOS5 : FDT: Add Aliases for I2C device
2012-11-14 9:11 [U-Boot] [PATCH 0/6 V2] EXYNOS5: FDT Support for I2C Rajeshwari Shinde
2012-11-14 9:11 ` [U-Boot] [PATCH 1/6 V2] EXYNOS5: FDT: Add I2C device node data Rajeshwari Shinde
@ 2012-11-14 9:11 ` Rajeshwari Shinde
2012-11-19 8:54 ` Heiko Schocher
2012-11-14 9:11 ` [U-Boot] [PATCH 3/6 V2] EXYNOS5: FDT: Add compatible string for I2C Rajeshwari Shinde
` (4 subsequent siblings)
6 siblings, 1 reply; 23+ messages in thread
From: Rajeshwari Shinde @ 2012-11-14 9:11 UTC (permalink / raw)
To: u-boot
This patch adds aliases for I2C.
Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
---
Changes in V2:
- None.
board/samsung/dts/exynos5250-smdk5250.dts | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/board/samsung/dts/exynos5250-smdk5250.dts b/board/samsung/dts/exynos5250-smdk5250.dts
index 2d3ecca..8722b36 100644
--- a/board/samsung/dts/exynos5250-smdk5250.dts
+++ b/board/samsung/dts/exynos5250-smdk5250.dts
@@ -16,6 +16,17 @@
model = "SAMSUNG SMDK5250 board based on EXYNOS5250";
compatible = "samsung,smdk5250", "samsung,exynos5250";
+ aliases {
+ i2c0 = "/i2c at 12c60000";
+ i2c1 = "/i2c at 12c70000";
+ i2c2 = "/i2c at 12c80000";
+ i2c3 = "/i2c at 12c90000";
+ i2c4 = "/i2c at 12ca0000";
+ i2c5 = "/i2c at 12cb0000";
+ i2c6 = "/i2c at 12cc0000";
+ i2c7 = "/i2c at 12cd0000";
+ };
+
sromc at 12250000 {
bank = <1>;
srom-timing = <1 9 12 1 6 1 1>;
--
1.7.4.4
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [U-Boot] [PATCH 2/6 V2] EXYNOS5 : FDT: Add Aliases for I2C device
2012-11-14 9:11 ` [U-Boot] [PATCH 2/6 V2] EXYNOS5 : FDT: Add Aliases for I2C device Rajeshwari Shinde
@ 2012-11-19 8:54 ` Heiko Schocher
0 siblings, 0 replies; 23+ messages in thread
From: Heiko Schocher @ 2012-11-19 8:54 UTC (permalink / raw)
To: u-boot
Hello Rajeshwari,
On 14.11.2012 10:11, Rajeshwari Shinde wrote:
> This patch adds aliases for I2C.
>
> Signed-off-by: Rajeshwari Shinde<rajeshwari.s@samsung.com>
> Acked-by: Simon Glass<sjg@chromium.org>
> ---
> Changes in V2:
> - None.
> board/samsung/dts/exynos5250-smdk5250.dts | 11 +++++++++++
> 1 files changed, 11 insertions(+), 0 deletions(-)
Acked-by: Heiko Schocher <hs@denx.de>
bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
^ permalink raw reply [flat|nested] 23+ messages in thread
* [U-Boot] [PATCH 3/6 V2] EXYNOS5: FDT: Add compatible string for I2C
2012-11-14 9:11 [U-Boot] [PATCH 0/6 V2] EXYNOS5: FDT Support for I2C Rajeshwari Shinde
2012-11-14 9:11 ` [U-Boot] [PATCH 1/6 V2] EXYNOS5: FDT: Add I2C device node data Rajeshwari Shinde
2012-11-14 9:11 ` [U-Boot] [PATCH 2/6 V2] EXYNOS5 : FDT: Add Aliases for I2C device Rajeshwari Shinde
@ 2012-11-14 9:11 ` Rajeshwari Shinde
2012-11-19 8:54 ` Heiko Schocher
2012-11-14 9:11 ` [U-Boot] [PATCH 4/6 V2] FDT: Api to find compatible id for a given node Rajeshwari Shinde
` (3 subsequent siblings)
6 siblings, 1 reply; 23+ messages in thread
From: Rajeshwari Shinde @ 2012-11-14 9:11 UTC (permalink / raw)
To: u-boot
Add required compatible information for I2C driver.
Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
---
Changes in V2:
- None
include/fdtdec.h | 1 +
lib/fdtdec.c | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/include/fdtdec.h b/include/fdtdec.h
index 180dfff..f9aac31 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -69,6 +69,7 @@ enum fdt_compat_id {
COMPAT_SMSC_LAN9215, /* SMSC 10/100 Ethernet LAN9215 */
COMPAT_SAMSUNG_EXYNOS5_SROMC, /* Exynos5 SROMC */
COMPAT_SAMSUNG_EXYNOS_TMU, /* Exynos TMU */
+ COMPAT_SAMSUNG_S3C2440_I2C, /* Exynos I2C Controller */
COMPAT_COUNT,
};
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 8e5ed21..6e8c24c 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -46,6 +46,7 @@ static const char * const compat_names[COMPAT_COUNT] = {
COMPAT(SMSC_LAN9215, "smsc,lan9215"),
COMPAT(SAMSUNG_EXYNOS5_SROMC, "samsung,exynos-sromc"),
COMPAT(SAMSUNG_EXYNOS_TMU, "samsung,exynos-tmu"),
+ COMPAT(SAMSUNG_S3C2440_I2C, "samsung,s3c2440-i2c"),
};
const char *fdtdec_get_compatible(enum fdt_compat_id id)
--
1.7.4.4
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [U-Boot] [PATCH 3/6 V2] EXYNOS5: FDT: Add compatible string for I2C
2012-11-14 9:11 ` [U-Boot] [PATCH 3/6 V2] EXYNOS5: FDT: Add compatible string for I2C Rajeshwari Shinde
@ 2012-11-19 8:54 ` Heiko Schocher
0 siblings, 0 replies; 23+ messages in thread
From: Heiko Schocher @ 2012-11-19 8:54 UTC (permalink / raw)
To: u-boot
Hello Rajeshwari,
On 14.11.2012 10:11, Rajeshwari Shinde wrote:
> Add required compatible information for I2C driver.
>
> Signed-off-by: Rajeshwari Shinde<rajeshwari.s@samsung.com>
> Acked-by: Simon Glass<sjg@chromium.org>
> ---
> Changes in V2:
> - None
> include/fdtdec.h | 1 +
> lib/fdtdec.c | 1 +
> 2 files changed, 2 insertions(+), 0 deletions(-)
Acked-by: Heiko Schocher <hs@denx.de>
bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
^ permalink raw reply [flat|nested] 23+ messages in thread
* [U-Boot] [PATCH 4/6 V2] FDT: Api to find compatible id for a given node
2012-11-14 9:11 [U-Boot] [PATCH 0/6 V2] EXYNOS5: FDT Support for I2C Rajeshwari Shinde
` (2 preceding siblings ...)
2012-11-14 9:11 ` [U-Boot] [PATCH 3/6 V2] EXYNOS5: FDT: Add compatible string for I2C Rajeshwari Shinde
@ 2012-11-14 9:11 ` Rajeshwari Shinde
2012-11-19 8:54 ` Heiko Schocher
2012-11-14 9:11 ` [U-Boot] [PATCH 5/6 V2] I2C: Driver changes for FDT support Rajeshwari Shinde
` (2 subsequent siblings)
6 siblings, 1 reply; 23+ messages in thread
From: Rajeshwari Shinde @ 2012-11-14 9:11 UTC (permalink / raw)
To: u-boot
This patch adds api to find compatible id for a given
FDT node
Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
---
Changes in V2:
- None
include/fdtdec.h | 14 ++++++++++++++
lib/fdtdec.c | 12 ++++++++++++
2 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/include/fdtdec.h b/include/fdtdec.h
index f9aac31..d501d7e 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -389,4 +389,18 @@ int fdtdec_get_byte_array(const void *blob, int node, const char *prop_name,
*/
const u8 *fdtdec_locate_byte_array(const void *blob, int node,
const char *prop_name, int count);
+
+/**
+ * Find the compatible ID for a given node.
+ *
+ * Generally each node has at least one compatible string attached to it.
+ * This function looks through our list of known compatible strings and
+ * returns the corresponding ID which matches the compatible string.
+ *
+ * @param blob FDT blob to use
+ * @param node Node containing compatible string to find
+ * @return compatible ID, or COMPAT_UNKNOWN if we cannot find a match
+ */
+enum fdt_compat_id fdtdec_lookup(const void *blob, int node);
+
#endif
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 6e8c24c..dbfca1a 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -516,3 +516,15 @@ const u8 *fdtdec_locate_byte_array(const void *blob, int node,
return NULL;
return cell;
}
+
+enum fdt_compat_id fdtdec_lookup(const void *blob, int node)
+{
+ enum fdt_compat_id id;
+
+ /* Search our drivers */
+ for (id = COMPAT_UNKNOWN; id < COMPAT_COUNT; id++)
+ if (0 == fdt_node_check_compatible(blob, node,
+ compat_names[id]))
+ return id;
+ return COMPAT_UNKNOWN;
+}
--
1.7.4.4
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [U-Boot] [PATCH 4/6 V2] FDT: Api to find compatible id for a given node
2012-11-14 9:11 ` [U-Boot] [PATCH 4/6 V2] FDT: Api to find compatible id for a given node Rajeshwari Shinde
@ 2012-11-19 8:54 ` Heiko Schocher
0 siblings, 0 replies; 23+ messages in thread
From: Heiko Schocher @ 2012-11-19 8:54 UTC (permalink / raw)
To: u-boot
Hello Rajeshwari,
On 14.11.2012 10:11, Rajeshwari Shinde wrote:
> This patch adds api to find compatible id for a given
> FDT node
>
> Signed-off-by: Rajeshwari Shinde<rajeshwari.s@samsung.com>
> Acked-by: Simon Glass<sjg@chromium.org>
> ---
> Changes in V2:
> - None
> include/fdtdec.h | 14 ++++++++++++++
> lib/fdtdec.c | 12 ++++++++++++
> 2 files changed, 26 insertions(+), 0 deletions(-)
Acked-by: Heiko Schocher <hs@denx.de>
bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
^ permalink raw reply [flat|nested] 23+ messages in thread
* [U-Boot] [PATCH 5/6 V2] I2C: Driver changes for FDT support
2012-11-14 9:11 [U-Boot] [PATCH 0/6 V2] EXYNOS5: FDT Support for I2C Rajeshwari Shinde
` (3 preceding siblings ...)
2012-11-14 9:11 ` [U-Boot] [PATCH 4/6 V2] FDT: Api to find compatible id for a given node Rajeshwari Shinde
@ 2012-11-14 9:11 ` Rajeshwari Shinde
2012-11-14 18:45 ` Simon Glass
` (2 more replies)
2012-11-14 9:11 ` [U-Boot] [PATCH 6/6 V2] SMDK5250: Initialise I2C using FDT Rajeshwari Shinde
2012-11-14 18:48 ` [U-Boot] [PATCH 0/6 V2] EXYNOS5: FDT Support for I2C Simon Glass
6 siblings, 3 replies; 23+ messages in thread
From: Rajeshwari Shinde @ 2012-11-14 9:11 UTC (permalink / raw)
To: u-boot
Functions added to get the I2C bus number and reset I2C bus using
FDT node.
Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
---
Changes in V2:
- Added periph id to I2C bus structure.
- Modified i2c_get_bus_num_fdt function to compare with node.
- Board i2c init moved to driver in case of FDT.
drivers/i2c/s3c24x0_i2c.c | 90 ++++++++++++++++++++++++++++++++++++++++++++-
drivers/i2c/s3c24x0_i2c.h | 8 ++++
include/i2c.h | 26 +++++++++++++
3 files changed, 123 insertions(+), 1 deletions(-)
diff --git a/drivers/i2c/s3c24x0_i2c.c b/drivers/i2c/s3c24x0_i2c.c
index 9bc4c7f..840585d 100644
--- a/drivers/i2c/s3c24x0_i2c.c
+++ b/drivers/i2c/s3c24x0_i2c.c
@@ -27,9 +27,11 @@
*/
#include <common.h>
+#include <fdtdec.h>
#ifdef CONFIG_EXYNOS5
#include <asm/arch/clk.h>
#include <asm/arch/cpu.h>
+#include <asm/arch/pinmux.h>
#else
#include <asm/arch/s3c24x0_cpu.h>
#endif
@@ -60,7 +62,14 @@
#define I2C_TIMEOUT 1 /* 1 second */
-static unsigned int g_current_bus; /* Stores Current I2C Bus */
+/*
+ * For SPL boot some boards need i2c before SDRAM is initialised so force
+ * variables to live in SRAM
+ */
+static unsigned int g_current_bus __attribute__((section(".data")));
+static struct s3c24x0_i2c_bus i2c_bus[CONFIG_MAX_I2C_NUM]
+ __attribute__((section(".data")));
+static int i2c_busses __attribute__((section(".data")));
#ifndef CONFIG_EXYNOS5
static int GetI2CSDA(void)
@@ -507,4 +516,83 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
(i2c, I2C_WRITE, chip << 1, &xaddr[4 - alen], alen, buffer,
len) != 0);
}
+
+#ifdef CONFIG_OF_CONTROL
+void board_i2c_init(const void *blob)
+{
+
+ int node_list[CONFIG_MAX_I2C_NUM];
+ int count, i;
+
+ count = fdtdec_find_aliases_for_id(blob, "i2c",
+ COMPAT_SAMSUNG_S3C2440_I2C, node_list,
+ CONFIG_MAX_I2C_NUM);
+ for (i = 0; i < count; i++) {
+ struct s3c24x0_i2c_bus *bus;
+ int node = node_list[i];
+
+ if (node < 0)
+ continue;
+ bus = &i2c_bus[i];
+ bus->regs = (struct s3c24x0_i2c *)
+ fdtdec_get_addr(blob, node, "reg");
+ bus->id = (enum periph_id)
+ fdtdec_get_int(blob, node, "samsung,periph-id", -1);
+ bus->node = node;
+ bus->bus_num = i2c_busses++;
+ exynos_pinmux_config(bus->id, 0);
+ }
+
+}
+
+static struct s3c24x0_i2c_bus *get_bus(unsigned int bus_idx)
+{
+ if (bus_idx < i2c_busses)
+ return &i2c_bus[bus_idx];
+ debug("Undefined bus: %d\n", bus_idx);
+ return NULL;
+}
+
+int i2c_get_bus_num_fdt(const void *blob, int node)
+{
+ enum fdt_compat_id compat;
+ int i;
+
+ compat = fdtdec_lookup(blob, node);
+ if (compat != COMPAT_SAMSUNG_S3C2440_I2C) {
+ debug("%s: Not a supported I2C node\n", __func__);
+ return -1;
+ }
+ for (i = 0; i < i2c_busses; i++) {
+ if (node == i2c_bus[i].node)
+ return i;
+ }
+
+ debug("%s: Can't find any matched I2C bus\n", __func__);
+ return -1;
+}
+
+int i2c_reset_port_fdt(const void *blob, int node)
+{
+ struct s3c24x0_i2c_bus *i2c;
+
+ int bus;
+
+ bus = i2c_get_bus_num_fdt(blob, node);
+ if (bus < 0) {
+ debug("could not get bus for node %d\n", node);
+ return -1;
+ }
+ i2c = get_bus(bus);
+ if (!i2c) {
+ debug("get_bus() failed for node node %d\n", node);
+ return -1;
+ }
+
+ i2c_ch_init(i2c->regs, CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+
+ return 0;
+}
+#endif
+
#endif /* CONFIG_HARD_I2C */
diff --git a/drivers/i2c/s3c24x0_i2c.h b/drivers/i2c/s3c24x0_i2c.h
index 2dd4b06..1243bf1 100644
--- a/drivers/i2c/s3c24x0_i2c.h
+++ b/drivers/i2c/s3c24x0_i2c.h
@@ -30,4 +30,12 @@ struct s3c24x0_i2c {
u32 iicds;
u32 iiclc;
};
+
+struct s3c24x0_i2c_bus {
+ int node; /* device tree node */
+ int bus_num; /* i2c bus number */
+ struct s3c24x0_i2c *regs;
+ enum periph_id id;
+};
+
#endif /* _S3C24X0_I2C_H */
diff --git a/include/i2c.h b/include/i2c.h
index 16f099d..efb097f 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -262,4 +262,30 @@ extern int get_multi_scl_pin(void);
extern int get_multi_sda_pin(void);
extern int multi_i2c_init(void);
#endif
+
+/**
+ * Get FDT values for i2c bus.
+ *
+ * @param blob Device tree blbo
+ * @return the number of I2C bus
+ */
+void board_i2c_init(const void *blob);
+
+/**
+ * Find the I2C bus number by given a FDT I2C node.
+ *
+ * @param blob Device tree blbo
+ * @param node FDT I2C node to find
+ * @return the number of I2C bus (zero based), or -1 on error
+ */
+int i2c_get_bus_num_fdt(const void *blob, int node);
+
+/**
+ * Reset the I2C bus represented by the given a FDT I2C node.
+ *
+ * @param blob Device tree blbo
+ * @param node FDT I2C node to find
+ * @return 0 if port was reset, -1 if not found
+ */
+int i2c_reset_port_fdt(const void *blob, int node);
#endif /* _I2C_H_ */
--
1.7.4.4
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [U-Boot] [PATCH 5/6 V2] I2C: Driver changes for FDT support
2012-11-14 9:11 ` [U-Boot] [PATCH 5/6 V2] I2C: Driver changes for FDT support Rajeshwari Shinde
@ 2012-11-14 18:45 ` Simon Glass
2012-11-15 6:59 ` Heiko Schocher
2012-11-19 8:54 ` Heiko Schocher
2 siblings, 0 replies; 23+ messages in thread
From: Simon Glass @ 2012-11-14 18:45 UTC (permalink / raw)
To: u-boot
Hi,
On Wed, Nov 14, 2012 at 1:11 AM, Rajeshwari Shinde
<rajeshwari.s@samsung.com> wrote:
> Functions added to get the I2C bus number and reset I2C bus using
> FDT node.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
> ---
> Changes in V2:
> - Added periph id to I2C bus structure.
> - Modified i2c_get_bus_num_fdt function to compare with node.
> - Board i2c init moved to driver in case of FDT.
This looks good to me, apart from a small thing you can probably drop below.
> drivers/i2c/s3c24x0_i2c.c | 90 ++++++++++++++++++++++++++++++++++++++++++++-
> drivers/i2c/s3c24x0_i2c.h | 8 ++++
> include/i2c.h | 26 +++++++++++++
> 3 files changed, 123 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/i2c/s3c24x0_i2c.c b/drivers/i2c/s3c24x0_i2c.c
> index 9bc4c7f..840585d 100644
> --- a/drivers/i2c/s3c24x0_i2c.c
> +++ b/drivers/i2c/s3c24x0_i2c.c
> @@ -27,9 +27,11 @@
> */
>
> #include <common.h>
> +#include <fdtdec.h>
> #ifdef CONFIG_EXYNOS5
> #include <asm/arch/clk.h>
> #include <asm/arch/cpu.h>
> +#include <asm/arch/pinmux.h>
> #else
> #include <asm/arch/s3c24x0_cpu.h>
> #endif
> @@ -60,7 +62,14 @@
> #define I2C_TIMEOUT 1 /* 1 second */
>
>
> -static unsigned int g_current_bus; /* Stores Current I2C Bus */
> +/*
> + * For SPL boot some boards need i2c before SDRAM is initialised so force
> + * variables to live in SRAM
> + */
> +static unsigned int g_current_bus __attribute__((section(".data")));
> +static struct s3c24x0_i2c_bus i2c_bus[CONFIG_MAX_I2C_NUM]
> + __attribute__((section(".data")));
> +static int i2c_busses __attribute__((section(".data")));
>
> #ifndef CONFIG_EXYNOS5
> static int GetI2CSDA(void)
> @@ -507,4 +516,83 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
> (i2c, I2C_WRITE, chip << 1, &xaddr[4 - alen], alen, buffer,
> len) != 0);
> }
> +
> +#ifdef CONFIG_OF_CONTROL
> +void board_i2c_init(const void *blob)
> +{
> +
> + int node_list[CONFIG_MAX_I2C_NUM];
> + int count, i;
> +
> + count = fdtdec_find_aliases_for_id(blob, "i2c",
> + COMPAT_SAMSUNG_S3C2440_I2C, node_list,
> + CONFIG_MAX_I2C_NUM);
> + for (i = 0; i < count; i++) {
> + struct s3c24x0_i2c_bus *bus;
> + int node = node_list[i];
> +
> + if (node < 0)
> + continue;
> + bus = &i2c_bus[i];
> + bus->regs = (struct s3c24x0_i2c *)
> + fdtdec_get_addr(blob, node, "reg");
> + bus->id = (enum periph_id)
> + fdtdec_get_int(blob, node, "samsung,periph-id", -1);
> + bus->node = node;
> + bus->bus_num = i2c_busses++;
> + exynos_pinmux_config(bus->id, 0);
> + }
> +
> +}
> +
> +static struct s3c24x0_i2c_bus *get_bus(unsigned int bus_idx)
> +{
> + if (bus_idx < i2c_busses)
> + return &i2c_bus[bus_idx];
> + debug("Undefined bus: %d\n", bus_idx);
> + return NULL;
> +}
> +
> +int i2c_get_bus_num_fdt(const void *blob, int node)
> +{
> + enum fdt_compat_id compat;
> + int i;
> +
> + compat = fdtdec_lookup(blob, node);
> + if (compat != COMPAT_SAMSUNG_S3C2440_I2C) {
> + debug("%s: Not a supported I2C node\n", __func__);
> + return -1;
> + }
I think you can drop this check, since your code immediately below
will handle a missing node.
> + for (i = 0; i < i2c_busses; i++) {
> + if (node == i2c_bus[i].node)
> + return i;
> + }
> +
> + debug("%s: Can't find any matched I2C bus\n", __func__);
> + return -1;
> +}
> +
> +int i2c_reset_port_fdt(const void *blob, int node)
> +{
> + struct s3c24x0_i2c_bus *i2c;
> +
> + int bus;
> +
> + bus = i2c_get_bus_num_fdt(blob, node);
> + if (bus < 0) {
> + debug("could not get bus for node %d\n", node);
> + return -1;
> + }
> + i2c = get_bus(bus);
> + if (!i2c) {
> + debug("get_bus() failed for node node %d\n", node);
> + return -1;
> + }
> +
> + i2c_ch_init(i2c->regs, CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
> +
> + return 0;
> +}
> +#endif
> +
> #endif /* CONFIG_HARD_I2C */
> diff --git a/drivers/i2c/s3c24x0_i2c.h b/drivers/i2c/s3c24x0_i2c.h
> index 2dd4b06..1243bf1 100644
> --- a/drivers/i2c/s3c24x0_i2c.h
> +++ b/drivers/i2c/s3c24x0_i2c.h
> @@ -30,4 +30,12 @@ struct s3c24x0_i2c {
> u32 iicds;
> u32 iiclc;
> };
> +
> +struct s3c24x0_i2c_bus {
> + int node; /* device tree node */
> + int bus_num; /* i2c bus number */
> + struct s3c24x0_i2c *regs;
> + enum periph_id id;
> +};
> +
> #endif /* _S3C24X0_I2C_H */
> diff --git a/include/i2c.h b/include/i2c.h
> index 16f099d..efb097f 100644
> --- a/include/i2c.h
> +++ b/include/i2c.h
> @@ -262,4 +262,30 @@ extern int get_multi_scl_pin(void);
> extern int get_multi_sda_pin(void);
> extern int multi_i2c_init(void);
> #endif
> +
> +/**
> + * Get FDT values for i2c bus.
> + *
> + * @param blob Device tree blbo
> + * @return the number of I2C bus
> + */
> +void board_i2c_init(const void *blob);
> +
> +/**
> + * Find the I2C bus number by given a FDT I2C node.
> + *
> + * @param blob Device tree blbo
> + * @param node FDT I2C node to find
> + * @return the number of I2C bus (zero based), or -1 on error
> + */
> +int i2c_get_bus_num_fdt(const void *blob, int node);
> +
> +/**
> + * Reset the I2C bus represented by the given a FDT I2C node.
> + *
> + * @param blob Device tree blbo
> + * @param node FDT I2C node to find
> + * @return 0 if port was reset, -1 if not found
> + */
> +int i2c_reset_port_fdt(const void *blob, int node);
> #endif /* _I2C_H_ */
> --
> 1.7.4.4
>
Regards,
Simon
^ permalink raw reply [flat|nested] 23+ messages in thread
* [U-Boot] [PATCH 5/6 V2] I2C: Driver changes for FDT support
2012-11-14 9:11 ` [U-Boot] [PATCH 5/6 V2] I2C: Driver changes for FDT support Rajeshwari Shinde
2012-11-14 18:45 ` Simon Glass
@ 2012-11-15 6:59 ` Heiko Schocher
2012-11-15 11:00 ` Rajeshwari Birje
2012-11-19 8:54 ` Heiko Schocher
2 siblings, 1 reply; 23+ messages in thread
From: Heiko Schocher @ 2012-11-15 6:59 UTC (permalink / raw)
To: u-boot
Hello Rajeshwari,
On 14.11.2012 10:11, Rajeshwari Shinde wrote:
> Functions added to get the I2C bus number and reset I2C bus using
> FDT node.
>
> Signed-off-by: Simon Glass<sjg@chromium.org>
> Signed-off-by: Rajeshwari Shinde<rajeshwari.s@samsung.com>
> ---
> Changes in V2:
> - Added periph id to I2C bus structure.
> - Modified i2c_get_bus_num_fdt function to compare with node.
> - Board i2c init moved to driver in case of FDT.
> drivers/i2c/s3c24x0_i2c.c | 90 ++++++++++++++++++++++++++++++++++++++++++++-
> drivers/i2c/s3c24x0_i2c.h | 8 ++++
> include/i2c.h | 26 +++++++++++++
> 3 files changed, 123 insertions(+), 1 deletions(-)
patch looks good, just some nitpicking comments ...
> diff --git a/drivers/i2c/s3c24x0_i2c.c b/drivers/i2c/s3c24x0_i2c.c
> index 9bc4c7f..840585d 100644
> --- a/drivers/i2c/s3c24x0_i2c.c
> +++ b/drivers/i2c/s3c24x0_i2c.c
[...]
> @@ -507,4 +516,83 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len)
> (i2c, I2C_WRITE, chip<< 1,&xaddr[4 - alen], alen, buffer,
> len) != 0);
> }
> +
> +#ifdef CONFIG_OF_CONTROL
> +void board_i2c_init(const void *blob)
> +{
> +
> + int node_list[CONFIG_MAX_I2C_NUM];
> + int count, i;
> +
> + count = fdtdec_find_aliases_for_id(blob, "i2c",
> + COMPAT_SAMSUNG_S3C2440_I2C, node_list,
> + CONFIG_MAX_I2C_NUM);
> + for (i = 0; i< count; i++) {
> + struct s3c24x0_i2c_bus *bus;
> + int node = node_list[i];
> +
> + if (node< 0)
> + continue;
> + bus =&i2c_bus[i];
^
space please
> + bus->regs = (struct s3c24x0_i2c *)
> + fdtdec_get_addr(blob, node, "reg");
> + bus->id = (enum periph_id)
> + fdtdec_get_int(blob, node, "samsung,periph-id", -1);
> + bus->node = node;
> + bus->bus_num = i2c_busses++;
> + exynos_pinmux_config(bus->id, 0);
> + }
> +
> +}
> +
> +static struct s3c24x0_i2c_bus *get_bus(unsigned int bus_idx)
> +{
> + if (bus_idx< i2c_busses)
^
space please
> + return&i2c_bus[bus_idx];
^
space please
> + debug("Undefined bus: %d\n", bus_idx);
> + return NULL;
> +}
> +
> +int i2c_get_bus_num_fdt(const void *blob, int node)
> +{
> + enum fdt_compat_id compat;
> + int i;
> +
> + compat = fdtdec_lookup(blob, node);
> + if (compat != COMPAT_SAMSUNG_S3C2440_I2C) {
> + debug("%s: Not a supported I2C node\n", __func__);
> + return -1;
> + }
> + for (i = 0; i< i2c_busses; i++) {
> + if (node == i2c_bus[i].node)
> + return i;
> + }
> +
> + debug("%s: Can't find any matched I2C bus\n", __func__);
> + return -1;
> +}
> +
> +int i2c_reset_port_fdt(const void *blob, int node)
> +{
> + struct s3c24x0_i2c_bus *i2c;
> +
> + int bus;
> +
> + bus = i2c_get_bus_num_fdt(blob, node);
> + if (bus< 0) {
^
space
> + debug("could not get bus for node %d\n", node);
> + return -1;
> + }
> + i2c = get_bus(bus);
> + if (!i2c) {
> + debug("get_bus() failed for node node %d\n", node);
> + return -1;
> + }
> +
> + i2c_ch_init(i2c->regs, CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
> +
> + return 0;
> +}
> +#endif
> +
> #endif /* CONFIG_HARD_I2C */
> diff --git a/drivers/i2c/s3c24x0_i2c.h b/drivers/i2c/s3c24x0_i2c.h
> index 2dd4b06..1243bf1 100644
> --- a/drivers/i2c/s3c24x0_i2c.h
> +++ b/drivers/i2c/s3c24x0_i2c.h
> @@ -30,4 +30,12 @@ struct s3c24x0_i2c {
> u32 iicds;
> u32 iiclc;
> };
> +
> +struct s3c24x0_i2c_bus {
> + int node; /* device tree node */
> + int bus_num; /* i2c bus number */
> + struct s3c24x0_i2c *regs;
> + enum periph_id id;
> +};
> +
> #endif /* _S3C24X0_I2C_H */
> diff --git a/include/i2c.h b/include/i2c.h
> index 16f099d..efb097f 100644
> --- a/include/i2c.h
> +++ b/include/i2c.h
> @@ -262,4 +262,30 @@ extern int get_multi_scl_pin(void);
> extern int get_multi_sda_pin(void);
> extern int multi_i2c_init(void);
> #endif
> +
> +/**
> + * Get FDT values for i2c bus.
> + *
> + * @param blob Device tree blbo
^
blob
> + * @return the number of I2C bus
> + */
> +void board_i2c_init(const void *blob);
> +
> +/**
> + * Find the I2C bus number by given a FDT I2C node.
> + *
> + * @param blob Device tree blbo
^
blob
> + * @param node FDT I2C node to find
> + * @return the number of I2C bus (zero based), or -1 on error
> + */
> +int i2c_get_bus_num_fdt(const void *blob, int node);
> +
> +/**
> + * Reset the I2C bus represented by the given a FDT I2C node.
> + *
> + * @param blob Device tree blbo
> + * @param node FDT I2C node to find
> + * @return 0 if port was reset, -1 if not found
> + */
> +int i2c_reset_port_fdt(const void *blob, int node);
> #endif /* _I2C_H_ */
Thanks!
Reviewed-by: Heiko Schocher <hs@denx.de>
bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
^ permalink raw reply [flat|nested] 23+ messages in thread
* [U-Boot] [PATCH 5/6 V2] I2C: Driver changes for FDT support
2012-11-15 6:59 ` Heiko Schocher
@ 2012-11-15 11:00 ` Rajeshwari Birje
0 siblings, 0 replies; 23+ messages in thread
From: Rajeshwari Birje @ 2012-11-15 11:00 UTC (permalink / raw)
To: u-boot
Hi Heiko,
Thank you for the comments will modify the same and resend the patch.
Regards,
Rajeshwari Shinde.
On Thu, Nov 15, 2012 at 12:29 PM, Heiko Schocher <hs@denx.de> wrote:
> Hello Rajeshwari,
>
>
> On 14.11.2012 10:11, Rajeshwari Shinde wrote:
>>
>> Functions added to get the I2C bus number and reset I2C bus using
>> FDT node.
>>
>> Signed-off-by: Simon Glass<sjg@chromium.org>
>> Signed-off-by: Rajeshwari Shinde<rajeshwari.s@samsung.com>
>> ---
>> Changes in V2:
>> - Added periph id to I2C bus structure.
>> - Modified i2c_get_bus_num_fdt function to compare with node.
>> - Board i2c init moved to driver in case of FDT.
>> drivers/i2c/s3c24x0_i2c.c | 90
>> ++++++++++++++++++++++++++++++++++++++++++++-
>> drivers/i2c/s3c24x0_i2c.h | 8 ++++
>> include/i2c.h | 26 +++++++++++++
>> 3 files changed, 123 insertions(+), 1 deletions(-)
>
>
> patch looks good, just some nitpicking comments ...
>
>
>> diff --git a/drivers/i2c/s3c24x0_i2c.c b/drivers/i2c/s3c24x0_i2c.c
>> index 9bc4c7f..840585d 100644
>> --- a/drivers/i2c/s3c24x0_i2c.c
>> +++ b/drivers/i2c/s3c24x0_i2c.c
>
> [...]
>>
>> @@ -507,4 +516,83 @@ int i2c_write(uchar chip, uint addr, int alen, uchar
>> *buffer, int len)
>> (i2c, I2C_WRITE, chip<< 1,&xaddr[4 - alen], alen, buffer,
>>
>> len) != 0);
>> }
>> +
>> +#ifdef CONFIG_OF_CONTROL
>> +void board_i2c_init(const void *blob)
>> +{
>> +
>> + int node_list[CONFIG_MAX_I2C_NUM];
>> + int count, i;
>> +
>> + count = fdtdec_find_aliases_for_id(blob, "i2c",
>> + COMPAT_SAMSUNG_S3C2440_I2C, node_list,
>> + CONFIG_MAX_I2C_NUM);
>> + for (i = 0; i< count; i++) {
>> + struct s3c24x0_i2c_bus *bus;
>> + int node = node_list[i];
>> +
>> + if (node< 0)
>> + continue;
>> + bus =&i2c_bus[i];
>
> ^
> space please
>
>> + bus->regs = (struct s3c24x0_i2c *)
>> + fdtdec_get_addr(blob, node, "reg");
>> + bus->id = (enum periph_id)
>> + fdtdec_get_int(blob, node, "samsung,periph-id",
>> -1);
>> + bus->node = node;
>> + bus->bus_num = i2c_busses++;
>> + exynos_pinmux_config(bus->id, 0);
>> + }
>> +
>> +}
>> +
>> +static struct s3c24x0_i2c_bus *get_bus(unsigned int bus_idx)
>> +{
>> + if (bus_idx< i2c_busses)
>
> ^
> space please
>>
>> + return&i2c_bus[bus_idx];
>
> ^
> space please
>
>> + debug("Undefined bus: %d\n", bus_idx);
>> + return NULL;
>> +}
>> +
>> +int i2c_get_bus_num_fdt(const void *blob, int node)
>> +{
>> + enum fdt_compat_id compat;
>> + int i;
>> +
>> + compat = fdtdec_lookup(blob, node);
>> + if (compat != COMPAT_SAMSUNG_S3C2440_I2C) {
>> + debug("%s: Not a supported I2C node\n", __func__);
>> + return -1;
>> + }
>> + for (i = 0; i< i2c_busses; i++) {
>> + if (node == i2c_bus[i].node)
>> + return i;
>> + }
>> +
>> + debug("%s: Can't find any matched I2C bus\n", __func__);
>> + return -1;
>> +}
>> +
>> +int i2c_reset_port_fdt(const void *blob, int node)
>> +{
>> + struct s3c24x0_i2c_bus *i2c;
>> +
>> + int bus;
>> +
>> + bus = i2c_get_bus_num_fdt(blob, node);
>> + if (bus< 0) {
>
> ^
> space
>
>> + debug("could not get bus for node %d\n", node);
>> + return -1;
>> + }
>> + i2c = get_bus(bus);
>> + if (!i2c) {
>> + debug("get_bus() failed for node node %d\n", node);
>> + return -1;
>> + }
>> +
>> + i2c_ch_init(i2c->regs, CONFIG_SYS_I2C_SPEED,
>> CONFIG_SYS_I2C_SLAVE);
>> +
>> + return 0;
>> +}
>> +#endif
>> +
>> #endif /* CONFIG_HARD_I2C */
>> diff --git a/drivers/i2c/s3c24x0_i2c.h b/drivers/i2c/s3c24x0_i2c.h
>> index 2dd4b06..1243bf1 100644
>> --- a/drivers/i2c/s3c24x0_i2c.h
>> +++ b/drivers/i2c/s3c24x0_i2c.h
>> @@ -30,4 +30,12 @@ struct s3c24x0_i2c {
>> u32 iicds;
>> u32 iiclc;
>> };
>> +
>> +struct s3c24x0_i2c_bus {
>> + int node; /* device tree node */
>> + int bus_num; /* i2c bus number */
>> + struct s3c24x0_i2c *regs;
>> + enum periph_id id;
>> +};
>> +
>> #endif /* _S3C24X0_I2C_H */
>> diff --git a/include/i2c.h b/include/i2c.h
>> index 16f099d..efb097f 100644
>> --- a/include/i2c.h
>> +++ b/include/i2c.h
>> @@ -262,4 +262,30 @@ extern int get_multi_scl_pin(void);
>> extern int get_multi_sda_pin(void);
>> extern int multi_i2c_init(void);
>> #endif
>> +
>> +/**
>> + * Get FDT values for i2c bus.
>> + *
>> + * @param blob Device tree blbo
>
> ^
> blob
>
>> + * @return the number of I2C bus
>> + */
>> +void board_i2c_init(const void *blob);
>> +
>> +/**
>> + * Find the I2C bus number by given a FDT I2C node.
>> + *
>> + * @param blob Device tree blbo
>
> ^
> blob
>
>> + * @param node FDT I2C node to find
>> + * @return the number of I2C bus (zero based), or -1 on error
>> + */
>> +int i2c_get_bus_num_fdt(const void *blob, int node);
>> +
>> +/**
>> + * Reset the I2C bus represented by the given a FDT I2C node.
>> + *
>> + * @param blob Device tree blbo
>> + * @param node FDT I2C node to find
>> + * @return 0 if port was reset, -1 if not found
>> + */
>> +int i2c_reset_port_fdt(const void *blob, int node);
>> #endif /* _I2C_H_ */
>
>
> Thanks!
>
> Reviewed-by: Heiko Schocher <hs@denx.de>
>
> bye,
> Heiko
> --
> DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
^ permalink raw reply [flat|nested] 23+ messages in thread
* [U-Boot] [PATCH 5/6 V2] I2C: Driver changes for FDT support
2012-11-14 9:11 ` [U-Boot] [PATCH 5/6 V2] I2C: Driver changes for FDT support Rajeshwari Shinde
2012-11-14 18:45 ` Simon Glass
2012-11-15 6:59 ` Heiko Schocher
@ 2012-11-19 8:54 ` Heiko Schocher
2 siblings, 0 replies; 23+ messages in thread
From: Heiko Schocher @ 2012-11-19 8:54 UTC (permalink / raw)
To: u-boot
Hello Rajeshwari,
On 14.11.2012 10:11, Rajeshwari Shinde:wrote
> Functions added to get the I2C bus number and reset I2C bus using
> FDT node.
>
> Signed-off-by: Simon Glass<sjg@chromium.org>
> Signed-off-by: Rajeshwari Shinde<rajeshwari.s@samsung.com>
> ---
> Changes in V2:
> - Added periph id to I2C bus structure.
> - Modified i2c_get_bus_num_fdt function to compare with node.
> - Board i2c init moved to driver in case of FDT.
> drivers/i2c/s3c24x0_i2c.c | 90 ++++++++++++++++++++++++++++++++++++++++++++-
> drivers/i2c/s3c24x0_i2c.h | 8 ++++
> include/i2c.h | 26 +++++++++++++
> 3 files changed, 123 insertions(+), 1 deletions(-)
Acked-by: Heiko Schocher <hs@denx.de>
bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
^ permalink raw reply [flat|nested] 23+ messages in thread
* [U-Boot] [PATCH 6/6 V2] SMDK5250: Initialise I2C using FDT
2012-11-14 9:11 [U-Boot] [PATCH 0/6 V2] EXYNOS5: FDT Support for I2C Rajeshwari Shinde
` (4 preceding siblings ...)
2012-11-14 9:11 ` [U-Boot] [PATCH 5/6 V2] I2C: Driver changes for FDT support Rajeshwari Shinde
@ 2012-11-14 9:11 ` Rajeshwari Shinde
2012-11-14 18:46 ` Simon Glass
2012-11-19 8:54 ` Heiko Schocher
2012-11-14 18:48 ` [U-Boot] [PATCH 0/6 V2] EXYNOS5: FDT Support for I2C Simon Glass
6 siblings, 2 replies; 23+ messages in thread
From: Rajeshwari Shinde @ 2012-11-14 9:11 UTC (permalink / raw)
To: u-boot
This patch initialises I2C using FDT.
Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
---
Changes since V2:
- board_i2c_init moved to driver in case of FDT.
board/samsung/smdk5250/smdk5250.c | 20 +-------------------
1 files changed, 1 insertions(+), 19 deletions(-)
diff --git a/board/samsung/smdk5250/smdk5250.c b/board/samsung/smdk5250/smdk5250.c
index db2457b..5ebc665 100644
--- a/board/samsung/smdk5250/smdk5250.c
+++ b/board/samsung/smdk5250/smdk5250.c
@@ -272,24 +272,6 @@ static int board_uart_init(void)
return 0;
}
-#ifdef CONFIG_SYS_I2C_INIT_BOARD
-static int board_i2c_init(void)
-{
- int i, err;
-
- for (i = 0; i < CONFIG_MAX_I2C_NUM; i++) {
- err = exynos_pinmux_config((PERIPH_ID_I2C0 + i),
- PINMUX_FLAG_NONE);
- if (err) {
- debug("I2C%d not configured\n", (PERIPH_ID_I2C0 + i));
- return err;
- }
- }
- i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
- return 0;
-}
-#endif
-
#ifdef CONFIG_BOARD_EARLY_INIT_F
int board_early_init_f(void)
{
@@ -300,7 +282,7 @@ int board_early_init_f(void)
return err;
}
#ifdef CONFIG_SYS_I2C_INIT_BOARD
- err = board_i2c_init();
+ board_i2c_init(gd->fdt_blob);
#endif
return err;
}
--
1.7.4.4
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [U-Boot] [PATCH 6/6 V2] SMDK5250: Initialise I2C using FDT
2012-11-14 9:11 ` [U-Boot] [PATCH 6/6 V2] SMDK5250: Initialise I2C using FDT Rajeshwari Shinde
@ 2012-11-14 18:46 ` Simon Glass
2012-11-19 8:54 ` Heiko Schocher
1 sibling, 0 replies; 23+ messages in thread
From: Simon Glass @ 2012-11-14 18:46 UTC (permalink / raw)
To: u-boot
On Wed, Nov 14, 2012 at 1:11 AM, Rajeshwari Shinde
<rajeshwari.s@samsung.com> wrote:
> This patch initialises I2C using FDT.
>
> Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
> ---
> Changes since V2:
> - board_i2c_init moved to driver in case of FDT.
> board/samsung/smdk5250/smdk5250.c | 20 +-------------------
> 1 files changed, 1 insertions(+), 19 deletions(-)
>
> diff --git a/board/samsung/smdk5250/smdk5250.c b/board/samsung/smdk5250/smdk5250.c
> index db2457b..5ebc665 100644
> --- a/board/samsung/smdk5250/smdk5250.c
> +++ b/board/samsung/smdk5250/smdk5250.c
> @@ -272,24 +272,6 @@ static int board_uart_init(void)
> return 0;
> }
>
> -#ifdef CONFIG_SYS_I2C_INIT_BOARD
> -static int board_i2c_init(void)
> -{
> - int i, err;
> -
> - for (i = 0; i < CONFIG_MAX_I2C_NUM; i++) {
> - err = exynos_pinmux_config((PERIPH_ID_I2C0 + i),
> - PINMUX_FLAG_NONE);
> - if (err) {
> - debug("I2C%d not configured\n", (PERIPH_ID_I2C0 + i));
> - return err;
> - }
> - }
> - i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
> - return 0;
> -}
> -#endif
> -
> #ifdef CONFIG_BOARD_EARLY_INIT_F
> int board_early_init_f(void)
> {
> @@ -300,7 +282,7 @@ int board_early_init_f(void)
> return err;
> }
> #ifdef CONFIG_SYS_I2C_INIT_BOARD
> - err = board_i2c_init();
> + board_i2c_init(gd->fdt_blob);
> #endif
> return err;
> }
> --
> 1.7.4.4
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* [U-Boot] [PATCH 6/6 V2] SMDK5250: Initialise I2C using FDT
2012-11-14 9:11 ` [U-Boot] [PATCH 6/6 V2] SMDK5250: Initialise I2C using FDT Rajeshwari Shinde
2012-11-14 18:46 ` Simon Glass
@ 2012-11-19 8:54 ` Heiko Schocher
1 sibling, 0 replies; 23+ messages in thread
From: Heiko Schocher @ 2012-11-19 8:54 UTC (permalink / raw)
To: u-boot
Hello Rajeshwari,
On 14.11.2012 10:11, Rajeshwari Shinde wrote:
> This patch initialises I2C using FDT.
>
> Signed-off-by: Rajeshwari Shinde<rajeshwari.s@samsung.com>
> ---
> Changes since V2:
> - board_i2c_init moved to driver in case of FDT.
> board/samsung/smdk5250/smdk5250.c | 20 +-------------------
> 1 files changed, 1 insertions(+), 19 deletions(-)
Acked-by: Heiko Schocher <hs@denx.de>
bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
^ permalink raw reply [flat|nested] 23+ messages in thread
* [U-Boot] [PATCH 0/6 V2] EXYNOS5: FDT Support for I2C
2012-11-14 9:11 [U-Boot] [PATCH 0/6 V2] EXYNOS5: FDT Support for I2C Rajeshwari Shinde
` (5 preceding siblings ...)
2012-11-14 9:11 ` [U-Boot] [PATCH 6/6 V2] SMDK5250: Initialise I2C using FDT Rajeshwari Shinde
@ 2012-11-14 18:48 ` Simon Glass
6 siblings, 0 replies; 23+ messages in thread
From: Simon Glass @ 2012-11-14 18:48 UTC (permalink / raw)
To: u-boot
Hi Rajeshwari,
On Wed, Nov 14, 2012 at 1:11 AM, Rajeshwari Shinde
<rajeshwari.s@samsung.com> wrote:
> This patch set adds FDT support for I2C driver and
> API's to acess the bus number using the fdt node
> and also reset the port.
>
> Changes in V2:
> - Baord i2c init moved to I2C driver in case of FDT.
> - Added Periph id to device node.
> - Modified i2c_get_bus_num_fdt api to compare using
> node.
Looks good. I pointed out a minor issue in the driver patch.
> Rajeshwari Shinde (6):
> EXYNOS5: FDT: Add I2C device node data
> EXYNOS5 : FDT: Add Aliases for I2C device
> EXYNOS5: FDT: Add compatible string for I2C
> FDT: Api to find compatible id for a given node
> I2C: Driver changes for FDT support
> SMDK5250: Initialise I2C using FDT
>
> arch/arm/dts/exynos-periph-id.dtsi | 35 +++++++++++
> arch/arm/dts/exynos5250.dtsi | 73 +++++++++++++++++++++++
> board/samsung/dts/exynos5250-smdk5250.dts | 11 ++++
> board/samsung/smdk5250/smdk5250.c | 20 +------
> drivers/i2c/s3c24x0_i2c.c | 90 ++++++++++++++++++++++++++++-
> drivers/i2c/s3c24x0_i2c.h | 8 +++
> include/fdtdec.h | 15 +++++
> include/i2c.h | 26 ++++++++
> lib/fdtdec.c | 13 ++++
> 9 files changed, 271 insertions(+), 20 deletions(-)
> create mode 100644 arch/arm/dts/exynos-periph-id.dtsi
>
> --
> 1.7.4.4
>
Regards,
Simon
^ permalink raw reply [flat|nested] 23+ messages in thread