Author: quozl Date: Tue Dec 30 01:53:50 2014 New Revision: 3752 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3752
Log: OLPC XO-4 - spin second core ready for new kernel, hack in a device tree change for the generic interrupt controller, but keep mmcore powered down. #12297.
Added: cpu/arm/mmp3/gic.fth Modified: cpu/arm/linux.fth cpu/arm/mmp3/dramrecal.fth cpu/arm/olpc/4.0/fw-version.fth cpu/arm/olpc/4.0/olpc.bth cpu/arm/olpc/build-fw.fth cpu/x86/pc/cpunode.fth cpu/x86/pc/olpc/gui.fth
Modified: cpu/arm/linux.fth ============================================================================== --- cpu/arm/linux.fth Mon Dec 8 01:24:07 2014 (r3751) +++ cpu/arm/linux.fth Tue Dec 30 01:53:50 2014 (r3752) @@ -107,6 +107,7 @@ \ args-buf cscount set-parameters ( ) \ then disable-interrupts +[ifdef] mmp3-gic mmp3-gic [then]
linux-base linux-base (init-program) \ Starting address, SP 0 to r0
Modified: cpu/arm/mmp3/dramrecal.fth ============================================================================== --- cpu/arm/mmp3/dramrecal.fth Mon Dec 8 01:24:07 2014 (r3751) +++ cpu/arm/mmp3/dramrecal.fth Tue Dec 30 01:53:50 2014 (r3752) @@ -125,7 +125,12 @@ : idle-cfg-clr ( mask -- ) h# 18 pmua-clr ; : idle-cfg-set ( mask -- ) h# 18 pmua-set ;
-: cc4-set ( mask -- ) h# 248 pmua-set ; +: cc2-set ( mask -- ) h# 150 pmua-set ; \ PMUA_CC2_PJ +: cc2-clr ( mask -- ) h# 150 pmua-clr ; + +: cc3-set ( mask -- ) h# 188 pmua-set ; \ PMUA_CC3_PJ + +: cc4-set ( mask -- ) h# 248 pmua-set ; \ PMUA_PJ_C0_CC4 : cc4-clr ( mask -- ) h# 248 pmua-clr ;
\ PXA2128_Registers_Manual_revF.pdf says to always write 0 to bits [14:0] @@ -281,11 +286,69 @@
alias do-wfi wfi
-: unused-cores-off ( -- ) +\ a reset handler for second core +code spin + mrs r0, cpsr + bic r0, r0, #0x1f + orr r0, r0, #0xd3 + msr cpsr,r0 + + mov r0, #0 \ set up for MCR + mcr p15, 0, r0, cr8, cr7, 0 \ invalidate TLBs + mcr p15, 0, r0, cr7, cr5, 0 \ invalidate icache + mcr p15, 0, r0, cr7, cr5, 6 \ invalidate BP array + mcr p15, 0, r0, cr7, cr10, 4 \ DSB + mcr p15, 0, r0, cr7, cr5, 4 \ ISB + + mrc p15, 0, r0, cr1, cr0, 0 + bic r0, r0, #0x00002000 \ clear bits 13 (--V-) + bic r0, r0, #0x00000007 \ clear bits 2:0 (-CAM) + orr r0, r0, #0x00000002 \ set bit 1 (--A-) Align + orr r0, r0, #0x00000800 \ set bit 11 (Z---) BTB + bic r0, r0, #0x00001000 \ set bit 12 (I) I-cache + mcr p15, 0, r0, cr1, cr0, 0 + + set r1,#0xd4019018 \ physical address of gpio set register + mov r0,#0x400 \ mask for port bit, storage led + str r0,[r1] + + set r1,#0xd4282c24 \ address of __sw_branch register + mov r0,#0x0 + str r0,[r1] \ clear register + begin + mov r3, #0x4000 \ delay loop constant + begin + subs r3, r3, #1 \ delay loop + = until + ldr r0, [r1] \ read __sw_branch register + cmp r0, #0x0 \ contains an address? + movne pc, r0 \ yes, then branch + again \ infinite loop +c; + +: enable-smp ( -- ) + ['] spin >physical 0 hw-install-handler 0 d# 4096 sync-cache + + h# 8 cc3-set \ moltres timerclk domain software reset, release + + \ moltres peripheral space configuration register + h# e000.0000 h# 94 ciu! \ set periphbase_addr + h# ffff.e001 h# 9c ciu! \ set periphbase_size, set periphbase_enable + + \ enable all clocks + h# ffff.ffff h# 0024 mpmu! \ MPMU_CGR_SP + h# ffff.ffff h# 1024 mpmu! \ MPMU_CGR_PJ + h# 3.ffff h# dc pmua! \ PMUA_GLB_CLK_CTRL + + h# 2000.0000 h# 200 pmua! \ PMUA_PJ_IDLE_CFG2, stay powered on WFI + 0 h# d428.2c24 l! \ clear __sw_branch register + h# 0200.0000 cc2-clr d# 1 ms h# 0200.0000 cc2-set \ reset mpcore2 +; + +: unused-core-off ( -- ) \ mmcore h# e320f003 0 instruction! \ Put WFI instruction in reset vector - h# 2000.0062 h# 200 pmua! \ PMUA_PJ_IDLE_CFG2 - mpcore2 deep sleep on WFI - h# 2000.0062 h# 204 pmua! \ PMUA_PJ_IDLE_CFG3 - mmcore deep sleep on WFI - h# 150 pmua@ h# 0600.0000 or h# 150 pmua! \ PMUA_CC2_PJ - unreset mpcore2 & mmcore + h# 2000.0062 h# 204 pmua! \ PMUA_PJ_IDLE_CFG3, power down on WFI + h# 0400.0000 cc2-set \ release reset ;
\ LICENSE_BEGIN
Added: cpu/arm/mmp3/gic.fth ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ cpu/arm/mmp3/gic.fth Tue Dec 30 01:53:50 2014 (r3752) @@ -0,0 +1,133 @@ +purpose: Generic Interrupt Controller node for Marvell MMP3 + +0 0 " e0001000" " /" begin-package + " interrupt-controller" device-name + " arm,arm11mp-gic" +compatible + 0 0 " interrupt-controller" property + 1 " #address-cells" integer-property + 1 " #size-cells" integer-property + 3 " #interrupt-cells" integer-property + h# e0001000 encode-int h# 1000 encode-int encode+ + h# e0000100 encode-int encode+ h# 100 encode-int encode+ " reg" property + + : encode-unit ( phys -- adr len ) push-hex (u.) pop-base ; + : decode-unit ( adr len -- phys ) push-hex $number if 0 then pop-base ; + + : make-gmux-node ( statreg maskreg irq# #irqs ) + new-device + " interrupt-controller" name ( maskreg statreg irq# #irqs ) + " mrvl,intc-nr-irqs" integer-property ( maskreg statreg irq# ) + 0 encode-int rot encode-int encode+ + 1 encode-int encode+ + " interrupts" property ( maskreg statreg ) + >r 4 encode-reg r> 4 encode-reg encode+ " reg" property ( ) + " mrvl,mmp3-mux-intc" +compatible + 0 0 " interrupt-controller" property + 1 " #interrupt-cells" integer-property + " mux status" encode-string " mux mask" encode-string encode+ " reg-names" property + finish-device + ; + + \ create mux nodes + h# 150 h# 168 4 4 make-gmux-node \ intcmux4 - USB_CHARGER, PMIC, SPMI, CHRG_DTC_OUT + h# 154 h# 16c 5 2 make-gmux-node \ intcmux5 - RTC_ALARM, RTC + h# 1bc h# 1a4 6 3 make-gmux-node \ intcmux6 - ETHERNET, res, HSI_INT_3 + h# 1c0 h# 1a8 8 4 make-gmux-node \ intcmux8 - GC2000, res, GC300, MOLTRES_NGIC_2 + h# 158 h# 170 d# 17 5 make-gmux-node \ intcmux17 - TWSI2,3,4,5,6 + h# 1c4 h# 1ac d# 18 3 make-gmux-node \ intcmux18 - Res, HSI_INT_2, MOLTRES_NGIC_1 + h# 1c8 h# 1b0 d# 30 2 make-gmux-node \ intcmux30 - ISP_DMA, DXO_ISP + h# 15c h# 174 d# 35 d# 31 make-gmux-node \ intcmux35 - MOLTRES_(various) (different from MMP2) + h# 1cc h# 1b4 d# 42 2 make-gmux-node \ intcmux42 - CCIC2, CCIC1 + h# 160 h# 178 d# 51 2 make-gmux-node \ intcmux51 - SSP1_SRDY, SSP3_SRDY + h# 184 h# 17c d# 55 4 make-gmux-node \ intcmux55 - MMC5, res, res, HSI_INT_1 + h# 188 h# 180 d# 57 d# 20 make-gmux-node \ intcmux57 - (various) + h# 1d0 h# 1b8 d# 58 5 make-gmux-node \ intcmux58 - MSP_CARD, KERMIT_INT_0, KERMIT_INT_1, res, HSI_INT_0 + h# 128 h# 11c d# 48 d# 24 make-gmux-node \ DMA mux - 16 PDMA, 4 ADMA, 2 VDMA channels +end-package + +dev / + " /interrupt-controller@e0001000" encode-phandle " interrupt-parent" property +dend + +: irqdef ( irq# -- ) + 0 encode-int + rot encode-int encode+ + 1 encode-int encode+ + " interrupts" property +; + +: irqdef2 ( irq# irq# -- ) + swap + 0 encode-int + rot encode-int encode+ + 1 encode-int encode+ + 0 encode-int encode+ + rot encode-int encode+ + 1 encode-int encode+ + " interrupts" property +; + +\ modify all irqs to use 3 cells instead of 1 +dev /timer d irqdef dend +\ dev /wakeup-rtc 1 0 irqdef2 dend +\ dev /thermal b irqdef dend +\ dev /audio 2 irqdef dend +dev /sspa 3 irqdef dend +\ dev /adma@c0ffd800 12 13 irqdef2 dend +\ dev /adma@c0ffd900 14 15 irqdef2 dend +\ dev /camera 1 irqdef dend +dev /ap-sp 28 irqdef dend +dev /usb 2c irqdef dend +dev /ec-spi 14 irqdef dend +\ dev /sd/sdhci@d4217000 0 irqdef dend +dev /sd/sdhci@d4280000 27 irqdef dend +dev /sd/sdhci@d4281000 35 irqdef dend +dev /sd/sdhci@d4280800 34 irqdef dend +\ dev /gpu 0 2 irqdef2 dend +dev /display 29 irqdef dend +dev /vmeta 1a irqdef dend +dev /flash 0 irqdef dend +dev /uart@d4016000 2e irqdef dend +dev /uart@d4030000 1b irqdef dend +dev /uart@d4017000 1c irqdef dend +dev /uart@d4018000 18 irqdef dend +dev /i2c@d4034000 4 irqdef dend +dev /i2c@d4033000 2 irqdef dend +dev /i2c@d4031000 0 irqdef dend +dev /i2c@d4011000 7 irqdef dend +dev /dma 30 irqdef dend +dev /gpio 31 irqdef dend + +\ modify all mux irq users to not point to ICU node +dev /sd/sdhci@d4217000 + " /interrupt-controller@e0001000/interrupt-controller@184" encode-phandle " interrupt-parent" property +dend +dev /camera@d420a000 + " /interrupt-controller@e0001000/interrupt-controller@1cc" encode-phandle " interrupt-parent" property +dend +dev /adma@c0ffd800 + " /interrupt-controller@e0001000/interrupt-controller@128" encode-phandle " interrupt-parent" property +dend +dev /adma@c0ffd900 + " /interrupt-controller@e0001000/interrupt-controller@128" encode-phandle " interrupt-parent" property +dend +dev /thermal + " /interrupt-controller@e0001000/interrupt-controller@188" encode-phandle " interrupt-parent" property +dend +dev /wakeup-rtc + " /interrupt-controller@e0001000/interrupt-controller@154" encode-phandle " interrupt-parent" property +dend +dev /gpu + " /interrupt-controller@e0001000/interrupt-controller@1c0" encode-phandle " interrupt-parent" property +dend +dev /i2c@d4034000 + " /interrupt-controller@e0001000/interrupt-controller@158" encode-phandle " interrupt-parent" property +dend +dev /i2c@d4033000 + " /interrupt-controller@e0001000/interrupt-controller@158" encode-phandle " interrupt-parent" property +dend +dev /i2c@d4031000 + " /interrupt-controller@e0001000/interrupt-controller@158" encode-phandle " interrupt-parent" property +dend + +: mmp3-gic ." mmp3-gic" cr ; \ 92ms
Modified: cpu/arm/olpc/4.0/fw-version.fth ============================================================================== --- cpu/arm/olpc/4.0/fw-version.fth Mon Dec 8 01:24:07 2014 (r3751) +++ cpu/arm/olpc/4.0/fw-version.fth Tue Dec 30 01:53:50 2014 (r3752) @@ -1,7 +1,7 @@ \ The overall firmware revision macro: FW_PREFIX Q7 -macro: FW_MAJOR B -macro: FW_MINOR 43 +macro: FW_MAJOR C +macro: FW_MINOR 00
\ Create a 2-character build/fw-suffix file to personalize your test builds " fw-suffix" $file-exists? [if]
Modified: cpu/arm/olpc/4.0/olpc.bth ============================================================================== --- cpu/arm/olpc/4.0/olpc.bth Mon Dec 8 01:24:07 2014 (r3751) +++ cpu/arm/olpc/4.0/olpc.bth Tue Dec 30 01:53:50 2014 (r3752) @@ -75,6 +75,7 @@ \ " fw.img" " firmware" $add-dropin " resetvec.img" " reset" $add-dropin
+ " ${BP}/cpu/arm/mmp3/gic.fth" " mmp3-gic-" $add-dropin \ " ${BP}/dev/usb2/hcd/ehci/build/ehci.fc" " class0c0320" $add-deflated-dropin " ${BP}/dev/usb2/device/hub/build/hub.fc" " usb,class9" $add-deflated-dropin " ${BP}/dev/usb2/device/generic/build/generic.fc" " usbdevice" $add-deflated-dropin
Modified: cpu/arm/olpc/build-fw.fth ============================================================================== --- cpu/arm/olpc/build-fw.fth Mon Dec 8 01:24:07 2014 (r3751) +++ cpu/arm/olpc/build-fw.fth Tue Dec 30 01:53:50 2014 (r3752) @@ -254,6 +254,7 @@ : wlan-reset ( -- ) wlan-reset-gpio# gpio-clr d# 20 ms wlan-reset-gpio# gpio-set ;
fload ${BP}/ofw/core/fdt.fth +[ifdef] mmp3 autoload: mmp3-gic- defines: mmp3-gic [then] fload ${BP}/cpu/arm/linux.fth
\ Create the alias unless it already exists @@ -617,6 +618,11 @@
[ifdef] mmp3 fload ${BP}/cpu/arm/mmp3/dramrecal.fth +: linux-hook-smp ( -- ) + [ ' linux-hook behavior compile, ] \ Chain to old behavior + enable-smp +; +' linux-hook-smp to linux-hook [then] [ifdef] mmp2 fload ${BP}/cpu/arm/mmp2/dramrecal.fth @@ -889,7 +895,7 @@
" probe-" do-drop-in
- [ifdef] unused-cores-off unused-cores-off [then] + [ifdef] unused-core-off unused-core-off [then] show-child
update-ec-flash? if
Modified: cpu/x86/pc/cpunode.fth ============================================================================== --- cpu/x86/pc/cpunode.fth Mon Dec 8 01:24:07 2014 (r3751) +++ cpu/x86/pc/cpunode.fth Tue Dec 30 01:53:50 2014 (r3752) @@ -29,6 +29,16 @@
finish-device
+[ifdef] olpc-cl4 +new-device + " cpu" device-name + " cpu" device-type + 1 " reg" integer-property + : open true ; + : close ; +finish-device +[then] + end-package
stand-init: CPU nodes
Modified: cpu/x86/pc/olpc/gui.fth ============================================================================== --- cpu/x86/pc/olpc/gui.fth Mon Dec 8 01:24:07 2014 (r3751) +++ cpu/x86/pc/olpc/gui.fth Tue Dec 30 01:53:50 2014 (r3752) @@ -498,15 +498,16 @@ " bigx" $show-centered ;
-: linux-hook-unfreeze - [ ' linux-hook behavior compile, ] -; -: linux-hook-freeze +defer show-going-hook ' noop to show-going-hook + +: linux-hook-gui [ ' linux-hook behavior compile, ] - show-going + show-going-hook ; -: freeze ( -- ) ['] linux-hook-freeze to linux-hook ; -: unfreeze ( -- ) ['] linux-hook-unfreeze to linux-hook ; +' linux-hook-gui to linux-hook + +: freeze ( -- ) ['] show-going to show-going-hook ; +: unfreeze ( -- ) ['] noop to show-going-hook ;
\ LICENSE_BEGIN
openfirmware@openfirmware.info