aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2020-02-01 20:04:57 +0100
committerLubomir Rintel <lkundrak@v3.sk>2020-03-23 18:58:56 +0100
commitaa1dabd5d90424bcd7ffc61cef960f0d74616af9 (patch)
treeb4bb2a50f50e6762cb2bdbace2cfc37b58efd0cb
parent1495653fa7e2c1804dd8b9af0331dd29313b3ac6 (diff)
downloadopenfirmware-aa1dabd5d90424bcd7ffc61cef960f0d74616af9.tar.gz
mmp2/twsi: move node creation from arm/olpc
Move twsi-i2c.fth out from arm/olpc/ into arm/mmp2/ and have it create all the device nodes. If the platform doesn't need any, it can disable them, just like olpc/build-fw.fth does. Having the device around makes it possible for code like arm/mmp3/gic.fth to just always assume the device nodes are always around.
-rw-r--r--cpu/arm/mmp2/twsi-i2c.fth9
-rw-r--r--cpu/arm/mmp2/twsi-node.fth11
-rw-r--r--cpu/arm/olpc/build-fw.fth37
-rw-r--r--cpu/arm/olpc/twsi-i2c.fth28
4 files changed, 50 insertions, 35 deletions
diff --git a/cpu/arm/mmp2/twsi-i2c.fth b/cpu/arm/mmp2/twsi-i2c.fth
new file mode 100644
index 00000000..7ceaf3f6
--- /dev/null
+++ b/cpu/arm/mmp2/twsi-i2c.fth
@@ -0,0 +1,9 @@
+purpose: Device tree nodes for I2C buses implemented by TWSI hardware
+
+\ baseadr clk irq mux?
+h# d4011000 mmp2-twsi0-clk# 7 false fload ${BP}/cpu/arm/mmp2/twsi-node.fth \ TWSI1
+h# d4031000 mmp2-twsi1-clk# 0 true fload ${BP}/cpu/arm/mmp2/twsi-node.fth \ TWSI2
+h# d4032000 mmp2-twsi2-clk# 1 true fload ${BP}/cpu/arm/mmp2/twsi-node.fth \ TWSI3
+h# d4033000 mmp2-twsi3-clk# 2 true fload ${BP}/cpu/arm/mmp2/twsi-node.fth \ TWSI4
+h# d4033800 mmp2-twsi4-clk# 3 true fload ${BP}/cpu/arm/mmp2/twsi-node.fth \ TWSI5
+h# d4034000 mmp2-twsi5-clk# 4 true fload ${BP}/cpu/arm/mmp2/twsi-node.fth \ TWSI6
diff --git a/cpu/arm/mmp2/twsi-node.fth b/cpu/arm/mmp2/twsi-node.fth
index 2d7d191f..c0116228 100644
--- a/cpu/arm/mmp2/twsi-node.fth
+++ b/cpu/arm/mmp2/twsi-node.fth
@@ -2,16 +2,15 @@
purpose: Create a device node for a TWSI device based on stack arguments
\ Put the following on the stack prior to floading this file:
-\ ( phys-addr clk irq mux? fast? linux-unit# )
-\ E.g: h# d4011000 1 7 false true 2
+\ ( phys-addr clk irq mux? )
+\ E.g: h# d4011000 1 7 false
root-device
new-device
-" linux,unit#" integer-property ( baseadr clock# irq# muxed-irq? fast? )
-" i2c" name ( baseadr clock# irq# muxed-irq? fast? )
-" mrvl,mmp-twsi" +compatible ( baseadr clock# irq# muxed-irq? fast? )
-[if] 0 0 " mrvl,i2c-fast-mode" property [then] ( baseadr clock# irq# muxed-irq? )
+" i2c" name ( baseadr clock# irq# muxed-irq? )
+" mrvl,mmp-twsi" +compatible ( baseadr clock# irq# muxed-irq? )
+0 0 " mrvl,i2c-fast-mode" property ( baseadr clock# irq# muxed-irq? )
[if]
" /interrupt-controller@158" encode-phandle " interrupt-parent" property
[then] ( baseadr clock# irq# )
diff --git a/cpu/arm/olpc/build-fw.fth b/cpu/arm/olpc/build-fw.fth
index a05aac95..703abdf1 100644
--- a/cpu/arm/olpc/build-fw.fth
+++ b/cpu/arm/olpc/build-fw.fth
@@ -111,7 +111,42 @@ fload ${BP}/cpu/arm/mmp2/watchdog.fth \ reset-all using watchdog timer
fload ${BP}/cpu/arm/olpc/smbus.fth \ Bit-banged SMBUS (I2C) using GPIOs
fload ${BP}/cpu/arm/olpc/gpio-i2c.fth
-fload ${BP}/cpu/arm/olpc/twsi-i2c.fth
+
+\ The unit# properties are chosen so that GPIO I2C nodes get lower addresses.
+\ Some Linux drivers expect to find devices on specific I2C bus numbers.
+fload ${BP}/cpu/arm/mmp2/twsi-i2c.fth
+devalias i2c2 /i2c@d4011000
+dev /i2c@d4011000
+ 2 " linux,unit#" integer-property
+device-end
+devalias i2c3 /i2c@d4031000
+dev /i2c@d4031000
+ 3 " linux,unit#" integer-property
+device-end
+dev /i2c@d4032000
+ " disabled" " status" string-property
+device-end
+devalias i2c5 /i2c@d4033000
+dev /i2c@d4033000
+ 5 " linux,unit#" integer-property
+device-end
+dev /i2c@d4033800
+ " disabled" " status" string-property
+device-end
+devalias i2c4 /i2c@d4034000
+dev /i2c@d4034000
+ 4 " linux,unit#" integer-property
+device-end
+
+[ifdef] soon-olpc-cl2 \ this breaks cl4-a1 boards, which ofw calls cl2.
+dev /i2c@d4033000 \ TWSI4
+new-device
+ h# 30 1 reg
+ " touchscreen" name
+ " raydium_ts" +compatible
+finish-device
+device-end
+[then]
0 0 " d4018000" " /" begin-package \ UART3
fload ${BP}/cpu/arm/mmp2/uart.fth
diff --git a/cpu/arm/olpc/twsi-i2c.fth b/cpu/arm/olpc/twsi-i2c.fth
deleted file mode 100644
index bac0d5f3..00000000
--- a/cpu/arm/olpc/twsi-i2c.fth
+++ /dev/null
@@ -1,28 +0,0 @@
-purpose: Device tree nodes for board-specific I2C buses implemented by TWSI hardware
-
-\ We omit nodes for unconnected TWSI channels
-\ The unit# properties are chosen so that GPIO I2C nodes get lower addresses.
-\ Some Linux drivers expect to find devices on specific I2C bus numbers.
-
-\ baseadr clk irq mux? fast? unit#
- h# d4011000 mmp2-twsi0-clk# 7 false true 2 fload ${BP}/cpu/arm/mmp2/twsi-node.fth \ TWSI1
- h# d4031000 mmp2-twsi1-clk# 0 true true 3 fload ${BP}/cpu/arm/mmp2/twsi-node.fth \ TWSI2
-\ h# d4032000 mmp2-twsi2-clk# 1 true true N fload ${BP}/cpu/arm/mmp2/twsi-node.fth \ TWSI3
- h# d4033000 mmp2-twsi3-clk# 2 true true 5 fload ${BP}/cpu/arm/mmp2/twsi-node.fth \ TWSI4
-\ h# d4033800 mmp2-twsi4-clk# 3 true true N fload ${BP}/cpu/arm/mmp2/twsi-node.fth \ TWSI5
- h# d4034000 mmp2-twsi5-clk# 4 true true 4 fload ${BP}/cpu/arm/mmp2/twsi-node.fth \ TWSI6
-
-devalias i2c2 /i2c@d4011000
-devalias i2c3 /i2c@d4031000
-devalias i2c5 /i2c@d4033000
-devalias i2c4 /i2c@d4034000
-
-[ifdef] soon-olpc-cl2 \ this breaks cl4-a1 boards, which ofw calls cl2.
-dev /i2c@d4033000 \ TWSI4
-new-device
- h# 30 1 reg
- " touchscreen" name
- " raydium_ts" +compatible
-finish-device
-device-end
-[then]