diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2020-02-12 22:35:50 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2021-01-10 02:10:56 +0100 |
commit | 01b16ef2e0072d3dfccdc0813cc0581cfd027c2f (patch) | |
tree | af56fcb76b17eeaa95e0823a74c5e7143db75bd1 | |
parent | 7fda9c90accaeb359783b159687f3a7c6d902639 (diff) | |
download | openfirmware-01b16ef2e0072d3dfccdc0813cc0581cfd027c2f.tar.gz |
mmp2/uart: factor out the UART nodes
-rw-r--r-- | cpu/arm/mmp2/devices.fth | 8 | ||||
-rw-r--r-- | cpu/arm/mmp2/uart-node.fth | 25 | ||||
-rw-r--r-- | cpu/arm/mmp2/uart.fth | 46 | ||||
-rw-r--r-- | cpu/arm/mmp3/thunderstone/fw.bth | 10 | ||||
-rw-r--r-- | cpu/arm/olpc/build-fw.fth | 26 |
5 files changed, 56 insertions, 59 deletions
diff --git a/cpu/arm/mmp2/devices.fth b/cpu/arm/mmp2/devices.fth index bf1a6364..38578102 100644 --- a/cpu/arm/mmp2/devices.fth +++ b/cpu/arm/mmp2/devices.fth @@ -68,11 +68,9 @@ fload ${BP}/cpu/arm/mmp2/irq.fth fload ${BP}/cpu/arm/mmp2/watchdog.fth \ reset-all using watchdog timer -0 0 " d4018000" " /" begin-package \ UART3 - fload ${BP}/cpu/arm/mmp2/uart.fth - d# 24 " interrupts" integer-property -end-package -devalias com1 /uart +fload ${BP}/cpu/arm/mmp2/uart.fth + +devalias com1 /uart@d4018000 : com1 " com1" ; ' com1 is fallback-device diff --git a/cpu/arm/mmp2/uart-node.fth b/cpu/arm/mmp2/uart-node.fth new file mode 100644 index 00000000..78be2db0 --- /dev/null +++ b/cpu/arm/mmp2/uart-node.fth @@ -0,0 +1,25 @@ +" uart" name +[ifdef] olpc +" mrvl,mmp-uart" +compatible +[then] +" intel,xscale-uart" +compatible +my-space h# 20 reg + +2 " reg-shift" integer-property + +: write ( adr len -- actual ) + 0 max tuck ( actual adr actual ) + bounds ?do i c@ uemit loop ( actual ) +; +: read ( adr len -- actual ) + 0= if drop 0 exit then + ukey? if ( adr ) + ukey swap c! 1 ( actual ) + else ( adr ) + drop -2 ( -2 ) + then +; +: open ( -- okay? ) true ; +: close ( -- ) ; +: install-abort ; +: remove-abort ; diff --git a/cpu/arm/mmp2/uart.fth b/cpu/arm/mmp2/uart.fth index 6ab26c38..88b501fb 100644 --- a/cpu/arm/mmp2/uart.fth +++ b/cpu/arm/mmp2/uart.fth @@ -1,25 +1,25 @@ - " uart" name -[ifdef] olpc - " mrvl,mmp-uart" +compatible -[then] - " intel,xscale-uart" +compatible - my-space h# 20 reg +purpose: Device tree nodes for UARTs - 2 " reg-shift" integer-property +0 0 " d4018000" " /" begin-package \ UART3 + fload ${BP}/cpu/arm/mmp2/uart-node.fth + " /clocks" encode-phandle mmp2-uart2-clk# encode-int encode+ " clocks" property + d# 24 " interrupts" integer-property +end-package - : write ( adr len -- actual ) - 0 max tuck ( actual adr actual ) - bounds ?do i c@ uemit loop ( actual ) - ; - : read ( adr len -- actual ) - 0= if drop 0 exit then - ukey? if ( adr ) - ukey swap c! 1 ( actual ) - else ( adr ) - drop -2 ( -2 ) - then - ; - : open ( -- okay? ) true ; - : close ( -- ) ; - : install-abort ; - : remove-abort ; +0 0 " d4017000" " /" begin-package \ UART2 + fload ${BP}/cpu/arm/mmp2/uart-node.fth + " /clocks" encode-phandle mmp2-uart1-clk# encode-int encode+ " clocks" property + d# 28 " interrupts" integer-property +end-package + +0 0 " d4030000" " /" begin-package \ UART1 + fload ${BP}/cpu/arm/mmp2/uart-node.fth + d# 27 " interrupts" integer-property + " /clocks" encode-phandle mmp2-uart0-clk# encode-int encode+ " clocks" property +end-package + +0 0 " d4016000" " /" begin-package \ UART4 + fload ${BP}/cpu/arm/mmp2/uart-node.fth + " /clocks" encode-phandle mmp2-uart3-clk# encode-int encode+ " clocks" property + d# 46 " interrupts" integer-property +end-package diff --git a/cpu/arm/mmp3/thunderstone/fw.bth b/cpu/arm/mmp3/thunderstone/fw.bth index 792eef88..d6d51bb3 100644 --- a/cpu/arm/mmp3/thunderstone/fw.bth +++ b/cpu/arm/mmp3/thunderstone/fw.bth @@ -89,13 +89,9 @@ warning ! fload ${BP}/cpu/arm/mmp2/watchdog.fth \ reset-all using watchdog timer -0 0 " d4018000" " /" begin-package \ UART3 - fload ${BP}/cpu/arm/mmp2/uart.fth - " /clocks" encode-phandle mmp2-uart2-clk# encode-int encode+ " clocks" property - d# 24 " interrupts" integer-property - 1 " linux,unit#" integer-property -end-package -devalias com1 /uart +fload ${BP}/cpu/arm/mmp2/uart.fth + +devalias com1 /uart@d4018000 : com1 " com1" ; ' com1 is fallback-device diff --git a/cpu/arm/olpc/build-fw.fth b/cpu/arm/olpc/build-fw.fth index f9e1d24f..a8ef3463 100644 --- a/cpu/arm/olpc/build-fw.fth +++ b/cpu/arm/olpc/build-fw.fth @@ -148,34 +148,12 @@ finish-device device-end [then] -0 0 " d4018000" " /" begin-package \ UART3 - fload ${BP}/cpu/arm/mmp2/uart.fth - " /clocks" encode-phandle mmp2-uart2-clk# encode-int encode+ " clocks" property - d# 24 " interrupts" integer-property -end-package - -0 0 " d4017000" " /" begin-package \ UART2 - fload ${BP}/cpu/arm/mmp2/uart.fth - " /clocks" encode-phandle mmp2-uart1-clk# encode-int encode+ " clocks" property - d# 28 " interrupts" integer-property -end-package +fload ${BP}/cpu/arm/mmp2/uart.fth -devalias com1 /uart +devalias com1 /uart@d4017000 : com1 " com1" ; ' com1 is fallback-device -0 0 " d4030000" " /" begin-package \ UART1 - fload ${BP}/cpu/arm/mmp2/uart.fth - d# 27 " interrupts" integer-property - " /clocks" encode-phandle mmp2-uart0-clk# encode-int encode+ " clocks" property -end-package - -0 0 " d4016000" " /" begin-package \ UART4 - fload ${BP}/cpu/arm/mmp2/uart.fth - " /clocks" encode-phandle mmp2-uart3-clk# encode-int encode+ " clocks" property - d# 46 " interrupts" integer-property -end-package - \needs md5init fload ${BP}/ofw/ppp/md5.fth \ MD5 hash fload ${BP}/dev/olpc/spiflash/flashif.fth \ Generic FLASH interface |