|
| 1 | +/* BeagleG: expose the PRU to userspace as /dev/uioN via the kernel's |
| 2 | + * generic uio_pdrv_genirq driver -- no PRU-specific kernel driver |
| 3 | + * needed. Two things are wired up: |
| 4 | + * |
| 5 | + * - interrupts: PRU system event 19, raised by the firmware when a |
| 6 | + * motion segment completes (must match PRU0_ARM_INTERRUPT in |
| 7 | + * src/motor-interface-pru.p), routed through the PRUSS interrupt |
| 8 | + * controller as event 19 -> INTC channel 2 -> host interrupt 2. |
| 9 | + * This is the same routing libprussdrv's PRUSS_INTC_INITDATA |
| 10 | + * programs for the uio_pruss backend. Cell meaning per the binding |
| 11 | + * https://www.kernel.org/doc/Documentation/devicetree/bindings/interrupt-controller/ti,pruss-intc.yaml |
| 12 | + * - reg: the PRU0 memories, exported as UIO mmap regions in |
| 13 | + * declaration order: map 0 = PRU0 data RAM, map 1 = PRU0 control, |
| 14 | + * map 2 = PRU0 instruction RAM. This order is the backend's mmap |
| 15 | + * contract (src/uio-genirq-interface.cc); the offset-selects-region |
| 16 | + * mmap convention is |
| 17 | + * https://www.kernel.org/doc/html/latest/driver-api/uio-howto.html |
| 18 | + * |
| 19 | + * The addresses come from the AM335x Technical Reference Manual, TI |
| 20 | + * document SPRUH73 (page anchors per revision Q): the PRU-ICSS sits |
| 21 | + * on the L4_FAST interconnect, occupying 0x4a30_0000..0x4a37_ffff -- |
| 22 | + * Table 2-4 "L4 Fast Peripheral Memory Map", |
| 23 | + * https://www.ti.com/lit/pdf/spruh73#page=185 -- and within it PRU0 |
| 24 | + * data RAM is at offset 0x00000 (8 KiB), the PRU0 control registers |
| 25 | + * at 0x22000 and PRU0 instruction RAM at 0x34000 (8 KiB) -- section |
| 26 | + * 4.3.2, Table 4-8 "Global Memory Map", |
| 27 | + * https://www.ti.com/lit/pdf/spruh73#page=207. The kernel's hardware |
| 28 | + * description carries the same values in |
| 29 | + * arch/arm/boot/dts/ti/omap/am33xx.dtsi (pruss node). |
| 30 | + * |
| 31 | + * Needs uio_pdrv_genirq.of_id=generic-uio on the kernel command line; |
| 32 | + * see INSTALL.md for the full setup. |
| 33 | + */ |
| 34 | +/dts-v1/; |
| 35 | +/plugin/; |
| 36 | + |
| 37 | +/ { |
| 38 | + /* This overlay depends only on the AM335x chip (its PRU-ICSS), |
| 39 | + * not on any board, so it declares the chip-level compatible. |
| 40 | + * Boards list their identity from most to least specific -- the |
| 41 | + * BeagleBone Green, for example: "ti,am335x-bone-green", |
| 42 | + * "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx" -- and |
| 43 | + * a match on any entry suffices. This single generic string |
| 44 | + * therefore covers every AM335x board (Black, Green, Green |
| 45 | + * Wireless, PocketBeagle, ...), including boards that do not |
| 46 | + * exist yet, while an explicit board list would only assert a |
| 47 | + * board dependence this overlay does not have. |
| 48 | + */ |
| 49 | + compatible = "ti,am33xx"; |
| 50 | + |
| 51 | + fragment@0 { |
| 52 | + target-path = "/"; |
| 53 | + __overlay__ { |
| 54 | + #address-cells = <1>; |
| 55 | + #size-cells = <1>; |
| 56 | + beagleg_pru_irq@4a300000 { |
| 57 | + compatible = "generic-uio"; |
| 58 | + reg = <0x4a300000 0x2000>, /* PRU0 data RAM */ |
| 59 | + <0x4a322000 0x1000>, /* PRU0 control */ |
| 60 | + <0x4a334000 0x2000>; /* PRU0 instruction RAM */ |
| 61 | + interrupt-parent = <&pruss_intc>; |
| 62 | + interrupts = <19 2 2>; /* sysevent 19, channel 2, host 2 */ |
| 63 | + }; |
| 64 | + }; |
| 65 | + }; |
| 66 | + |
| 67 | + /* BeagleG owns PRU0, so keep the kernel's pru_rproc from binding |
| 68 | + * it: with two independent writers of the same IRAM/control |
| 69 | + * registers, a remoteproc "start" while BeagleG runs would race. |
| 70 | + * Same mutual exclusion the historical PRU-UIO overlays used; |
| 71 | + * PRU1 is left available to remoteproc. |
| 72 | + * |
| 73 | + * Ordering matters: overlays merge last-writer-wins with no |
| 74 | + * conflict detection, so an overlay applied after this one that |
| 75 | + * touches &pru0 would silently undo the lockout. Load this file |
| 76 | + * through the uboot_overlay_pru slot of /boot/uEnv.txt -- u-boot |
| 77 | + * applies that slot after all generic uboot_overlay_addrN cape |
| 78 | + * slots (bb.org u-boot, include/configs/ti_armv7_common.h), so |
| 79 | + * the PRU0 claim stays the effective last word -- and keep |
| 80 | + * PRU-touching overlays out of the even-later slots |
| 81 | + * (uboot_overlay_pru_add, dtb_overlay). All merging happens in |
| 82 | + * u-boot before Linux boots, so pru_rproc never probes PRU0; the |
| 83 | + * result is verifiable at runtime: |
| 84 | + * /proc/device-tree/ocp/interconnect@4a000000/segment@0/ |
| 85 | + * target-module@300000/pruss@0/pru@34000/status == "disabled". |
| 86 | + */ |
| 87 | + fragment@1 { |
| 88 | + target = <&pru0>; |
| 89 | + __overlay__ { |
| 90 | + status = "disabled"; |
| 91 | + }; |
| 92 | + }; |
| 93 | +}; |
0 commit comments