| 1 | # Cavium CN81xx documentation |
| 2 | |
| 3 | ## Reference code |
| 4 | |
| 5 | ```{eval-rst} |
| 6 | The Cavium reference code is called `BDK`_ (board development kit) and is part |
| 7 | of the `Octeon-TX-SDK`_. Parts of the `BDK`_ have been integrated into coreoboot. |
| 8 | ``` |
| 9 | |
| 10 | ## SOC code |
| 11 | |
| 12 | The SOC folder contains functions for: |
| 13 | * TWSI |
| 14 | * UART |
| 15 | * TIMER |
| 16 | * SPI |
| 17 | * MMU |
| 18 | * DRAM |
| 19 | * CLOCK |
| 20 | * GPIO |
| 21 | * Secondary CPUs |
| 22 | * PCI |
| 23 | |
| 24 | All other hardware is initialized by the BDK code, which is invoked from |
| 25 | ramstage. |
| 26 | |
| 27 | ## Notes about the hardware |
| 28 | |
| 29 | Cavium SoC do **not** have embedded SRAM. The **BOOTROM** setups the |
| 30 | L2 cache and loads 192KiB of firmware starting from 0x20000 to a fixed |
| 31 | location. It then jumps to the firmware. |
| 32 | |
| 33 | ```{eval-rst} |
| 34 | For more details have a look at `Cavium CN8XXX Bootflow`_. |
| 35 | ``` |
| 36 | |
| 37 | ## CAR setup |
| 38 | |
| 39 | For Cache-as-RAM we only need to lock the cachelines which are used by bootblock |
| 40 | or romstage until DRAM has been set up. At the end of romstage the cachelines |
| 41 | are unlocked and the contents are flushed to DRAM. |
| 42 | Locked cachelines are never evicted. |
| 43 | |
| 44 | The CAR setup is done in `bootblock_custom.S` and thus doesn't use the common |
| 45 | aarch64 `bootblock.S` code. |
| 46 | |
| 47 | ## DRAM setup |
| 48 | |
| 49 | ```{eval-rst} |
| 50 | The DRAM setup is done by the `BDK`_. |
| 51 | ``` |
| 52 | |
| 53 | ## PCI setup |
| 54 | |
| 55 | The PCI setup is done using the MMCONF mechanism. |
| 56 | Besides configuring device visibility (secure/unsecure) the MSI-X interrupts |
| 57 | needs to be configured. |
| 58 | |
| 59 | ## Devicetree patching |
| 60 | |
| 61 | The Linux devicetree needs to be patched, depending on the available hardware |
| 62 | and their configuration. Some values depends on fuses, some on user selectable |
| 63 | configuration. |
| 64 | |
| 65 | The following SoC specific fixes are made: |
| 66 | |
| 67 | 1. Fix SCLK |
| 68 | 2. Fix UUA refclock |
| 69 | 3. Remove unused PEM entries |
| 70 | 4. Remove unused QLM entries |
| 71 | 5. Set local MAC address |
| 72 | |
| 73 | ## CN81xx quirks |
| 74 | |
| 75 | The CN81xx needs some quirks that are not documented or hidden in the code. |
| 76 | |
| 77 | ### Violation of PCI spec |
| 78 | |
| 79 | **Problem:** |
| 80 | |
| 81 | * The PCI device 01:01.0 is disabled, but a multifunction device. |
| 82 | * The PCI device 01:01.2 - 00:01.7 is enabled and can't be found by the coreboot |
| 83 | PCI allocator. |
| 84 | |
| 85 | **Solution:** |
| 86 | |
| 87 | The PCI Bus 0 and 1 are scanned manually in SOC's PCI code. |
| 88 | |
| 89 | |
| 90 | ### Crash accessing SLI memory |
| 91 | |
| 92 | **Problem:** |
| 93 | |
| 94 | The SLI memory region decodes to attached PCIe devices. |
| 95 | Accessing the memory region results in 'Data Abort Exception' if the link of the |
| 96 | PCIe device never had been enabled. |
| 97 | |
| 98 | **Solution:** |
| 99 | |
| 100 | Enable the PCIe link at least once. (You can disabling the link and the SLI |
| 101 | memory reads as 0xffffffff.) |
| 102 | |
| 103 | |
| 104 | ### RNG Data Abort Exception |
| 105 | |
| 106 | **Problem:** |
| 107 | |
| 108 | 'Data Abort Exception' on accessing the enabled RNG. |
| 109 | |
| 110 | **Solution**: |
| 111 | |
| 112 | Read the BDK_RNM_CTL_STATUS register at least once after writing it. |
| 113 | |
| 114 | |
| 115 | ```{eval-rst} |
| 116 | .. _Octeon-TX-SDK: https://github.com/Cavium-Open-Source-Distributions/OCTEON-TX-SDK |
| 117 | .. _Cavium CN8XXX Bootflow: ../bootflow.html |
| 118 | .. _BDK: ../../../vendorcode/cavium/bdk.html |
| 119 | ``` |