Peios Learn
Documentation

Peios

Peios Peios Kernel Universal Directory Project

Developer Tools

Trail Acta Provium clackatoo CAF GCSL Pekit

Applications

Framewright

Standards and Conventions

Standards and Conventions Peios Specifications
Peios Kernel

MIPS

Single-page view · as markdown

MIPS-specific Documentation

Peios Kernel / Hardware and drivers / Processor architectures / MIPS

  1. BMIPS DeviceTree Booting
  2. Ingenic JZ47xx SoCs Timer/Counter Unit hardware
  3. features

BMIPS DeviceTree Booting

Peios Kernel / Hardware and drivers / Processor architectures / MIPS

Some bootloaders only support a single entry point, at the start of the kernel image. Other bootloaders will jump to the ELF start address. Both schemes are supported; CONFIG_BOOT_RAW=y and CONFIG_NO_EXCEPT_FILL=y, so the first instruction immediately jumps to kernel_entry().

Similar to the arch/arm case (b), a DT-aware bootloader is expected to set up the following registers:

a0 : 0

a1 : 0xffffffff

a2 : Physical pointer to the device tree block (defined in chapter II) in RAM. The device tree can be located anywhere in the first 512MB of the physical address space (0x00000000 - 0x1fffffff), aligned on a 64 bit boundary.

Legacy bootloaders do not use this convention, and they do not pass in a DT block. In this case, Linux will look for a builtin DTB, selected via CONFIG_DT_*.

This convention is defined for 32-bit systems only, as there are not currently any 64-bit BMIPS implementations.

Feature status on mips architecture

Peios Kernel / Hardware and drivers / Processor architectures / MIPS

SubsystemFeatureKconfigStatusDescription
corecBPF-JITHAVE_CBPF_JITokarch supports cBPF JIT optimizations
coreeBPF-JITHAVE_EBPF_JITokarch supports eBPF JIT optimizations
coregeneric-idle-threadGENERIC_SMP_IDLE_THREADokarch makes use of the generic SMP idle thread facility
corejump-labelsHAVE_ARCH_JUMP_LABELokarch supports live patched, high efficiency branches
coremseal-system-mappingsARCH_SUPPORTS_MSEAL_SYSTEM_MAPPINGSTODOarch supports mseal system mappings
corethread-info-in-taskTHREAD_INFO_IN_TASKTODOarch makes use of the core kernel facility to embed thread_info in task_struct
coretracehookHAVE_ARCH_TRACEHOOKokarch supports tracehook (ptrace) register handling APIs
debugdebug-vm-pgtableARCH_HAS_DEBUG_VM_PGTABLETODOarch supports pgtable tests for semantics compliance
debuggcov-profile-allARCH_HAS_GCOV_PROFILE_ALLokarch supports whole-kernel GCOV code coverage profiling
debugKASANHAVE_ARCH_KASANTODOarch supports the KASAN runtime memory checker
debugkcovARCH_HAS_KCOVokarch supports kcov for coverage-guided fuzzing
debugkgdbHAVE_ARCH_KGDBokarch supports the kGDB kernel debugger
debugkmemleakHAVE_DEBUG_KMEMLEAKokarch supports the kernel memory leak detector
debugkprobesHAVE_KPROBESokarch supports live patched kernel probe
debugkprobes-on-ftraceHAVE_KPROBES_ON_FTRACETODOarch supports combined kprobes and ftrace live patching
debugkretprobesHAVE_KRETPROBESokarch supports kernel function-return probes
debugoptprobesHAVE_OPTPROBESTODOarch supports live patched optprobes
debugstackprotectorHAVE_STACKPROTECTORokarch supports compiler driven stack overflow protection
debuguprobesARCH_SUPPORTS_UPROBESokarch supports live patched user probes
debuguser-ret-profilerHAVE_USER_RETURN_NOTIFIERTODOarch supports user-space return from system call profiler
iodma-contiguousHAVE_DMA_CONTIGUOUSokarch supports the DMA CMA (continuous memory allocator)
lockingcmpxchg-localHAVE_CMPXCHG_LOCALTODOarch supports the this_cpu_cmpxchg() API
lockinglockdepLOCKDEP_SUPPORTokarch supports the runtime locking correctness debug facility
lockingqueued-rwlocksARCH_USE_QUEUED_RWLOCKSokarch supports queued rwlocks
lockingqueued-spinlocksARCH_USE_QUEUED_SPINLOCKSokarch supports queued spinlocks
perfkprobes-eventHAVE_REGS_AND_STACK_ACCESS_APIokarch supports kprobes with perf events
perfperf-regsHAVE_PERF_REGSokarch supports perf events register access
perfperf-stackdumpHAVE_PERF_USER_STACK_DUMPokarch supports perf events stack dumps
schedmembarrier-sync-coreARCH_HAS_MEMBARRIER_SYNC_CORETODOarch supports core serializing membarrier
schednuma-balancingARCH_SUPPORTS_NUMA_BALANCINGTODOarch supports NUMA balancing
seccompseccomp-filterHAVE_ARCH_SECCOMP_FILTERokarch supports seccomp filters
timearch-tick-broadcastARCH_HAS_TICK_BROADCASTokarch provides tick_broadcast()
timeclockevents!LEGACY_TIMER_TICKokarch support generic clock events
timeirq-time-acctHAVE_IRQ_TIME_ACCOUNTINGokarch supports precise IRQ time accounting
timeuser-context-trackingHAVE_CONTEXT_TRACKING_USERokarch supports user context tracking for NO_HZ_FULL
timevirt-cpuacctHAVE_VIRT_CPU_ACCOUNTINGokarch supports precise virtual CPU time accounting
vmbatch-unmap-tlb-flushARCH_WANT_BATCHED_UNMAP_TLB_FLUSHTODOarch supports deferral of TLB flush until multiple pages are unmapped
vmELF-ASLRARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUTokarch randomizes the stack, heap and binary images of ELF binaries
vmhuge-vmapHAVE_ARCH_HUGE_VMAPTODOarch supports the arch_vmap_pud_supported() and arch_vmap_pmd_supported() VM APIs
vmioremap_protHAVE_IOREMAP_PROTokarch has ioremap_prot()
vmpte_specialARCH_HAS_PTE_SPECIALokarch supports the pte_special()/pte_mkspecial() VM APIs
vmTHPHAVE_ARCH_TRANSPARENT_HUGEPAGEokarch supports transparent hugepages

Ingenic JZ47xx SoCs Timer/Counter Unit hardware

Peios Kernel / Hardware and drivers / Processor architectures / MIPS

The Timer/Counter Unit (TCU) in Ingenic JZ47xx SoCs is a multi-function hardware block. It features up to eight channels, that can be used as counters, timers, or PWM.

  • JZ4725B, JZ4750, JZ4755 only have six TCU channels. The other SoCs all have eight channels.

  • JZ4725B introduced a separate channel, called Operating System Timer (OST). It is a 32-bit programmable timer. On JZ4760B and above, it is 64-bit.

  • Each one of the TCU channels has its own clock, which can be reparented to three different clocks (pclk, ext, rtc), gated, and reclocked, through their TCSR register.

    • The watchdog and OST hardware blocks also feature a TCSR register with the same format in their register space.

    • The TCU registers used to gate/ungate can also gate/ungate the watchdog and OST clocks.

  • Each TCU channel works in one of two modes:

    • mode TCU1: channels cannot work in sleep mode, but are easier to operate.

    • mode TCU2: channels can work in sleep mode, but the operation is a bit more complicated than with TCU1 channels.

  • The mode of each TCU channel depends on the SoC used:

    • On the oldest SoCs (up to JZ4740), all of the eight channels operate in TCU1 mode.

    • On JZ4725B, channel 5 operates as TCU2, the others operate as TCU1.

    • On newest SoCs (JZ4750 and above), channels 1-2 operate as TCU2, the others operate as TCU1.

  • Each channel can generate an interrupt. Some channels share an interrupt line, some don't, and this changes between SoC versions:

    • on older SoCs (JZ4740 and below), channel 0 and channel 1 have their own interrupt line; channels 2-7 share the last interrupt line.

    • On JZ4725B, channel 0 has its own interrupt; channels 1-5 share one interrupt line; the OST uses the last interrupt line.

    • on newer SoCs (JZ4750 and above), channel 5 has its own interrupt; channels 0-4 and (if eight channels) 6-7 all share one interrupt line; the OST uses the last interrupt line.

Implementation #

The functionalities of the TCU hardware are spread across multiple drivers:

clocks

drivers/clk/ingenic/tcu.c

interrupts

drivers/irqchip/irq-ingenic-tcu.c

timers

drivers/clocksource/ingenic-timer.c

OST

drivers/clocksource/ingenic-ost.c

PWM

drivers/pwm/pwm-jz4740.c

watchdog

drivers/watchdog/jz4740_wdt.c

Because various functionalities of the TCU that belong to different drivers and frameworks can be controlled from the same registers, all of these drivers access their registers through the same regmap.

For more information regarding the devicetree bindings of the TCU drivers, have a look at Documentation/devicetree/bindings/timer/ingenic,tcu.yaml.

Peios Learn — documentation for Peios software.

Built with Trail.