Last active
August 29, 2015 14:23
-
-
Save pelwell/be227c51be0c97dedabe to your computer and use it in GitHub Desktop.
Patches to allow I2C2 to be enabled and used. Use with extreme caution.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 557b787b67d8037601d4efeb1ed2980156c75a60 Mon Sep 17 00:00:00 2001 | |
From: Phil Elwell <[email protected]> | |
Date: Mon, 22 Jun 2015 14:21:55 +0100 | |
Subject: [PATCH 1/2] BCM270X_DT: Sort nodes by bus address, and consolidate | |
aliases | |
--- | |
arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 19 ---------- | |
arch/arm/boot/dts/bcm2708-rpi-b.dts | 19 ---------- | |
arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 21 ----------- | |
arch/arm/boot/dts/bcm2708_common.dtsi | 63 +++++++++++++++++++++++--------- | |
arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 19 ---------- | |
5 files changed, 46 insertions(+), 95 deletions(-) | |
diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | |
index 0fa2210..33d0688 100644 | |
--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | |
+++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | |
@@ -5,25 +5,6 @@ | |
/ { | |
compatible = "brcm,bcm2708"; | |
model = "Raspberry Pi Model B+"; | |
- | |
- aliases { | |
- soc = &soc; | |
- spi0 = &spi0; | |
- i2c0 = &i2c0; | |
- i2c1 = &i2c1; | |
- i2s = &i2s; | |
- gpio = &gpio; | |
- intc = &intc; | |
- leds = &leds; | |
- audio = &audio; | |
- sound = &sound; | |
- uart0 = &uart0; | |
- uart1 = &uart1; | |
- clocks = &clocks; | |
- }; | |
- | |
- sound: sound { | |
- }; | |
}; | |
&gpio { | |
diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts | |
index 3fd49d0..a2498e4 100644 | |
--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts | |
+++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts | |
@@ -5,25 +5,6 @@ | |
/ { | |
compatible = "brcm,bcm2708"; | |
model = "Raspberry Pi Model B"; | |
- | |
- aliases { | |
- soc = &soc; | |
- spi0 = &spi0; | |
- i2c0 = &i2c0; | |
- i2c1 = &i2c1; | |
- i2s = &i2s; | |
- gpio = &gpio; | |
- intc = &intc; | |
- leds = &leds; | |
- audio = &audio; | |
- sound = &sound; | |
- uart0 = &uart0; | |
- uart1 = &uart1; | |
- clocks = &clocks; | |
- }; | |
- | |
- sound: sound { | |
- }; | |
}; | |
&gpio { | |
diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | |
index 3da7d3b..34d4bc6 100644 | |
--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | |
+++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | |
@@ -1,26 +1,5 @@ | |
/include/ "bcm2708.dtsi" | |
-/ { | |
- aliases { | |
- soc = &soc; | |
- spi0 = &spi0; | |
- i2c0 = &i2c0; | |
- i2c1 = &i2c1; | |
- i2s = &i2s; | |
- gpio = &gpio; | |
- intc = &intc; | |
- leds = &leds; | |
- audio = &audio; | |
- sound = &sound; | |
- uart0 = &uart0; | |
- uart1 = &uart1; | |
- clocks = &clocks; | |
- }; | |
- | |
- sound: sound { | |
- }; | |
-}; | |
- | |
&leds { | |
act_led: act { | |
label = "led0"; | |
diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi | |
index 8caa234..2f33d2d 100644 | |
--- a/arch/arm/boot/dts/bcm2708_common.dtsi | |
+++ b/arch/arm/boot/dts/bcm2708_common.dtsi | |
@@ -3,6 +3,31 @@ | |
/ { | |
interrupt-parent = <&intc>; | |
+ aliases { | |
+ audio = &audio; | |
+ sound = &sound; | |
+ soc = &soc; | |
+ dma = &dma; | |
+ intc = &intc; | |
+ watchdog = &watchdog; | |
+ random = &random; | |
+ mailbox = &mailbox; | |
+ gpio = &gpio; | |
+ uart0 = &uart0; | |
+ i2s = &i2s; | |
+ spi0 = &spi0; | |
+ i2c0 = &i2c0; | |
+ uart1 = &uart1; | |
+ mmc = &mmc; | |
+ i2c1 = &i2c1; | |
+ usb = &usb; | |
+ leds = &leds; | |
+ fb = &fb; | |
+ vchiq = &vchiq; | |
+ thermal = &thermal; | |
+ clocks = &clocks; | |
+ }; | |
+ | |
/* Onboard audio */ | |
audio: audio { | |
compatible = "brcm,bcm2835-audio"; | |
@@ -10,6 +35,10 @@ | |
status = "disabled"; | |
}; | |
+ /* External sound card */ | |
+ sound: sound { | |
+ }; | |
+ | |
soc: soc { | |
compatible = "simple-bus"; | |
#address-cells = <1>; | |
@@ -43,6 +72,12 @@ | |
#interrupt-cells = <2>; | |
}; | |
+ mailbox: mailbox@7e00b800 { | |
+ compatible = "brcm,bcm2708-vcio"; | |
+ reg = <0x7e00b880 0x40>; | |
+ interrupts = <0 1>; | |
+ }; | |
+ | |
watchdog: watchdog@7e100000 { | |
compatible = "brcm,bcm2835-pm-wdt"; | |
reg = <0x7e100000 0x28>; | |
@@ -55,12 +90,6 @@ | |
status = "disabled"; | |
}; | |
- mailbox: mailbox@7e00b800 { | |
- compatible = "brcm,bcm2708-vcio"; | |
- reg = <0x7e00b880 0x40>; | |
- interrupts = <0 1>; | |
- }; | |
- | |
gpio: gpio { | |
compatible = "brcm,bcm2835-gpio"; | |
reg = <0x7e200000 0xb4>; | |
@@ -73,17 +102,6 @@ | |
#interrupt-cells = <2>; | |
}; | |
- mmc: mmc@7e300000 { | |
- compatible = "brcm,bcm2835-mmc"; | |
- reg = <0x7e300000 0x100>; | |
- interrupts = <2 30>; | |
- clocks = <&clk_mmc>; | |
- dmas = <&dma 11>, | |
- <&dma 11>; | |
- dma-names = "tx", "rx"; | |
- status = "disabled"; | |
- }; | |
- | |
uart0: uart@7e201000 { | |
compatible = "arm,pl011", "arm,primecell"; | |
reg = <0x7e201000 0x1000>; | |
@@ -144,6 +162,17 @@ | |
status = "disabled"; | |
}; | |
+ mmc: mmc@7e300000 { | |
+ compatible = "brcm,bcm2835-mmc"; | |
+ reg = <0x7e300000 0x100>; | |
+ interrupts = <2 30>; | |
+ clocks = <&clk_mmc>; | |
+ dmas = <&dma 11>, | |
+ <&dma 11>; | |
+ dma-names = "tx", "rx"; | |
+ status = "disabled"; | |
+ }; | |
+ | |
i2c1: i2c@7e804000 { | |
compatible = "brcm,bcm2708-i2c"; | |
reg = <0x7e804000 0x1000>; | |
diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts | |
index 8aaaf1f..0827f39 100644 | |
--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts | |
+++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts | |
@@ -5,25 +5,6 @@ | |
/ { | |
compatible = "brcm,bcm2709"; | |
model = "Raspberry Pi 2 Model B"; | |
- | |
- aliases { | |
- soc = &soc; | |
- spi0 = &spi0; | |
- i2c0 = &i2c0; | |
- i2c1 = &i2c1; | |
- i2s = &i2s; | |
- gpio = &gpio; | |
- intc = &intc; | |
- leds = &leds; | |
- audio = &audio; | |
- sound = &sound; | |
- uart0 = &uart0; | |
- uart1 = &uart1; | |
- clocks = &clocks; | |
- }; | |
- | |
- sound: sound { | |
- }; | |
}; | |
&gpio { | |
-- | |
1.9.1 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From b786fdd05bae9d8a1a4ef8ba4650d1e8c5ca9faa Mon Sep 17 00:00:00 2001 | |
From: Phil Elwell <[email protected]> | |
Date: Mon, 22 Jun 2015 14:23:03 +0100 | |
Subject: [PATCH 2/2] BCM270X_DT: Add support for I2C2 | |
The third I2C bus (I2C2) is normally reserved for HDMI use. Careless | |
use of this bus can break an attached display - use with caution. | |
The interface is disabled by default - enable using the | |
i2c2_iknowwhatimdoing DT parameter. | |
--- | |
arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 6 ++++++ | |
arch/arm/boot/dts/bcm2708-rpi-b.dts | 6 ++++++ | |
arch/arm/boot/dts/bcm2708-rpi-cm.dts | 6 ++++++ | |
arch/arm/boot/dts/bcm2708_common.dtsi | 14 ++++++++++++++ | |
arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 6 ++++++ | |
drivers/i2c/busses/i2c-bcm2708.c | 5 ++++- | |
6 files changed, 42 insertions(+), 1 deletion(-) | |
diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | |
index 33d0688..9e1106b 100644 | |
--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | |
+++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | |
@@ -75,6 +75,10 @@ | |
clock-frequency = <100000>; | |
}; | |
+&i2c2 { | |
+ clock-frequency = <100000>; | |
+}; | |
+ | |
&i2s { | |
#sound-dai-cells = <0>; | |
pinctrl-names = "default"; | |
@@ -103,8 +107,10 @@ | |
spi = <&spi0>,"status"; | |
i2c0 = <&i2c0>,"status"; | |
i2c1 = <&i2c1>,"status"; | |
+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; | |
i2c0_baudrate = <&i2c0>,"clock-frequency:0"; | |
i2c1_baudrate = <&i2c1>,"clock-frequency:0"; | |
+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; | |
act_led_gpio = <&act_led>,"gpios:4"; | |
act_led_activelow = <&act_led>,"gpios:8"; | |
diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts | |
index a2498e4..43820f4 100644 | |
--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts | |
+++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts | |
@@ -75,6 +75,10 @@ | |
clock-frequency = <100000>; | |
}; | |
+&i2c2 { | |
+ clock-frequency = <100000>; | |
+}; | |
+ | |
&i2s { | |
#sound-dai-cells = <0>; | |
pinctrl-names = "default"; | |
@@ -97,8 +101,10 @@ | |
spi = <&spi0>,"status"; | |
i2c0 = <&i2c0>,"status"; | |
i2c1 = <&i2c1>,"status"; | |
+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; | |
i2c0_baudrate = <&i2c0>,"clock-frequency:0"; | |
i2c1_baudrate = <&i2c1>,"clock-frequency:0"; | |
+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; | |
act_led_gpio = <&act_led>,"gpios:4"; | |
act_led_activelow = <&act_led>,"gpios:8"; | |
diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dts b/arch/arm/boot/dts/bcm2708-rpi-cm.dts | |
index 5c0c7fa..3d5661a 100755 | |
--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dts | |
+++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts | |
@@ -65,6 +65,10 @@ | |
clock-frequency = <100000>; | |
}; | |
+&i2c2 { | |
+ clock-frequency = <100000>; | |
+}; | |
+ | |
&i2s { | |
#sound-dai-cells = <0>; | |
pinctrl-names = "default"; | |
@@ -79,7 +83,9 @@ | |
spi = <&spi0>,"status"; | |
i2c0 = <&i2c0>,"status"; | |
i2c1 = <&i2c1>,"status"; | |
+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; | |
i2c0_baudrate = <&i2c0>,"clock-frequency:0"; | |
i2c1_baudrate = <&i2c1>,"clock-frequency:0"; | |
+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; | |
}; | |
}; | |
diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi | |
index 2f33d2d..4053814 100644 | |
--- a/arch/arm/boot/dts/bcm2708_common.dtsi | |
+++ b/arch/arm/boot/dts/bcm2708_common.dtsi | |
@@ -20,6 +20,7 @@ | |
uart1 = &uart1; | |
mmc = &mmc; | |
i2c1 = &i2c1; | |
+ i2c2 = &i2c2; | |
usb = &usb; | |
leds = &leds; | |
fb = &fb; | |
@@ -183,6 +184,19 @@ | |
status = "disabled"; | |
}; | |
+ i2c2: i2c@7e805000 { | |
+ // Beware - this is shared with the HDMI module. | |
+ // Careless use may break (really) your display. | |
+ // Caveat emptor. | |
+ compatible = "brcm,bcm2708-i2c"; | |
+ reg = <0x7e805000 0x1000>; | |
+ interrupts = <2 21>; | |
+ clocks = <&clk_i2c>; | |
+ #address-cells = <1>; | |
+ #size-cells = <0>; | |
+ status = "disabled"; | |
+ }; | |
+ | |
usb: usb@7e980000 { | |
compatible = "brcm,bcm2708-usb"; | |
reg = <0x7e980000 0x10000>, | |
diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts | |
index 0827f39..a9e6421 100644 | |
--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts | |
+++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts | |
@@ -75,6 +75,10 @@ | |
clock-frequency = <100000>; | |
}; | |
+&i2c2 { | |
+ clock-frequency = <100000>; | |
+}; | |
+ | |
&i2s { | |
#sound-dai-cells = <0>; | |
pinctrl-names = "default"; | |
@@ -103,8 +107,10 @@ | |
spi = <&spi0>,"status"; | |
i2c0 = <&i2c0>,"status"; | |
i2c1 = <&i2c1>,"status"; | |
+ i2c2_iknowwhatimdoing = <&i2c2>,"status"; | |
i2c0_baudrate = <&i2c0>,"clock-frequency:0"; | |
i2c1_baudrate = <&i2c1>,"clock-frequency:0"; | |
+ i2c2_baudrate = <&i2c2>,"clock-frequency:0"; | |
act_led_gpio = <&act_led>,"gpios:4"; | |
act_led_activelow = <&act_led>,"gpios:8"; | |
diff --git a/drivers/i2c/busses/i2c-bcm2708.c b/drivers/i2c/busses/i2c-bcm2708.c | |
index 8773203..7a24fbe 100644 | |
--- a/drivers/i2c/busses/i2c-bcm2708.c | |
+++ b/drivers/i2c/busses/i2c-bcm2708.c | |
@@ -407,8 +407,11 @@ static int bcm2708_i2c_probe(struct platform_device *pdev) | |
case 1: | |
adap->class = I2C_CLASS_DDC; | |
break; | |
+ case 2: | |
+ adap->class = I2C_CLASS_DDC; | |
+ break; | |
default: | |
- dev_err(&pdev->dev, "can only bind to BSC 0 or 1\n"); | |
+ dev_err(&pdev->dev, "can only bind to BSC 0, 1 or 2\n"); | |
err = -ENXIO; | |
goto out_free_bi; | |
} | |
-- | |
1.9.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment