18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * cx18 System Control Block initialization 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 68c2ecf20Sopenharmony_ci * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#ifndef CX18_SCB_H 108c2ecf20Sopenharmony_ci#define CX18_SCB_H 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#include "cx18-mailbox.h" 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci/* NOTE: All ACK interrupts are in the SW2 register. All non-ACK interrupts 158c2ecf20Sopenharmony_ci are in the SW1 register. */ 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#define IRQ_APU_TO_CPU 0x00000001 188c2ecf20Sopenharmony_ci#define IRQ_CPU_TO_APU_ACK 0x00000001 198c2ecf20Sopenharmony_ci#define IRQ_HPU_TO_CPU 0x00000002 208c2ecf20Sopenharmony_ci#define IRQ_CPU_TO_HPU_ACK 0x00000002 218c2ecf20Sopenharmony_ci#define IRQ_PPU_TO_CPU 0x00000004 228c2ecf20Sopenharmony_ci#define IRQ_CPU_TO_PPU_ACK 0x00000004 238c2ecf20Sopenharmony_ci#define IRQ_EPU_TO_CPU 0x00000008 248c2ecf20Sopenharmony_ci#define IRQ_CPU_TO_EPU_ACK 0x00000008 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci#define IRQ_CPU_TO_APU 0x00000010 278c2ecf20Sopenharmony_ci#define IRQ_APU_TO_CPU_ACK 0x00000010 288c2ecf20Sopenharmony_ci#define IRQ_HPU_TO_APU 0x00000020 298c2ecf20Sopenharmony_ci#define IRQ_APU_TO_HPU_ACK 0x00000020 308c2ecf20Sopenharmony_ci#define IRQ_PPU_TO_APU 0x00000040 318c2ecf20Sopenharmony_ci#define IRQ_APU_TO_PPU_ACK 0x00000040 328c2ecf20Sopenharmony_ci#define IRQ_EPU_TO_APU 0x00000080 338c2ecf20Sopenharmony_ci#define IRQ_APU_TO_EPU_ACK 0x00000080 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci#define IRQ_CPU_TO_HPU 0x00000100 368c2ecf20Sopenharmony_ci#define IRQ_HPU_TO_CPU_ACK 0x00000100 378c2ecf20Sopenharmony_ci#define IRQ_APU_TO_HPU 0x00000200 388c2ecf20Sopenharmony_ci#define IRQ_HPU_TO_APU_ACK 0x00000200 398c2ecf20Sopenharmony_ci#define IRQ_PPU_TO_HPU 0x00000400 408c2ecf20Sopenharmony_ci#define IRQ_HPU_TO_PPU_ACK 0x00000400 418c2ecf20Sopenharmony_ci#define IRQ_EPU_TO_HPU 0x00000800 428c2ecf20Sopenharmony_ci#define IRQ_HPU_TO_EPU_ACK 0x00000800 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci#define IRQ_CPU_TO_PPU 0x00001000 458c2ecf20Sopenharmony_ci#define IRQ_PPU_TO_CPU_ACK 0x00001000 468c2ecf20Sopenharmony_ci#define IRQ_APU_TO_PPU 0x00002000 478c2ecf20Sopenharmony_ci#define IRQ_PPU_TO_APU_ACK 0x00002000 488c2ecf20Sopenharmony_ci#define IRQ_HPU_TO_PPU 0x00004000 498c2ecf20Sopenharmony_ci#define IRQ_PPU_TO_HPU_ACK 0x00004000 508c2ecf20Sopenharmony_ci#define IRQ_EPU_TO_PPU 0x00008000 518c2ecf20Sopenharmony_ci#define IRQ_PPU_TO_EPU_ACK 0x00008000 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci#define IRQ_CPU_TO_EPU 0x00010000 548c2ecf20Sopenharmony_ci#define IRQ_EPU_TO_CPU_ACK 0x00010000 558c2ecf20Sopenharmony_ci#define IRQ_APU_TO_EPU 0x00020000 568c2ecf20Sopenharmony_ci#define IRQ_EPU_TO_APU_ACK 0x00020000 578c2ecf20Sopenharmony_ci#define IRQ_HPU_TO_EPU 0x00040000 588c2ecf20Sopenharmony_ci#define IRQ_EPU_TO_HPU_ACK 0x00040000 598c2ecf20Sopenharmony_ci#define IRQ_PPU_TO_EPU 0x00080000 608c2ecf20Sopenharmony_ci#define IRQ_EPU_TO_PPU_ACK 0x00080000 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci#define SCB_OFFSET 0xDC0000 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci/* If Firmware uses fixed memory map, it shall not allocate the area 658c2ecf20Sopenharmony_ci between SCB_OFFSET and SCB_OFFSET+SCB_RESERVED_SIZE-1 inclusive */ 668c2ecf20Sopenharmony_ci#define SCB_RESERVED_SIZE 0x10000 678c2ecf20Sopenharmony_ci 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci/* This structure is used by EPU to provide memory descriptors in its memory */ 708c2ecf20Sopenharmony_cistruct cx18_mdl_ent { 718c2ecf20Sopenharmony_ci u32 paddr; /* Physical address of a buffer segment */ 728c2ecf20Sopenharmony_ci u32 length; /* Length of the buffer segment */ 738c2ecf20Sopenharmony_ci}; 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_cistruct cx18_scb { 768c2ecf20Sopenharmony_ci /* These fields form the System Control Block which is used at boot time 778c2ecf20Sopenharmony_ci for localizing the IPC data as well as the code positions for all 788c2ecf20Sopenharmony_ci processors. The offsets are from the start of this struct. */ 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ci /* Offset where to find the Inter-Processor Communication data */ 818c2ecf20Sopenharmony_ci u32 ipc_offset; 828c2ecf20Sopenharmony_ci u32 reserved01[7]; 838c2ecf20Sopenharmony_ci /* Offset where to find the start of the CPU code */ 848c2ecf20Sopenharmony_ci u32 cpu_code_offset; 858c2ecf20Sopenharmony_ci u32 reserved02[3]; 868c2ecf20Sopenharmony_ci /* Offset where to find the start of the APU code */ 878c2ecf20Sopenharmony_ci u32 apu_code_offset; 888c2ecf20Sopenharmony_ci u32 reserved03[3]; 898c2ecf20Sopenharmony_ci /* Offset where to find the start of the HPU code */ 908c2ecf20Sopenharmony_ci u32 hpu_code_offset; 918c2ecf20Sopenharmony_ci u32 reserved04[3]; 928c2ecf20Sopenharmony_ci /* Offset where to find the start of the PPU code */ 938c2ecf20Sopenharmony_ci u32 ppu_code_offset; 948c2ecf20Sopenharmony_ci u32 reserved05[3]; 958c2ecf20Sopenharmony_ci 968c2ecf20Sopenharmony_ci /* These fields form Inter-Processor Communication data which is used 978c2ecf20Sopenharmony_ci by all processors to locate the information needed for communicating 988c2ecf20Sopenharmony_ci with other processors */ 998c2ecf20Sopenharmony_ci 1008c2ecf20Sopenharmony_ci /* Fields for CPU: */ 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci /* bit 0: 1/0 processor ready/not ready. Set other bits to 0. */ 1038c2ecf20Sopenharmony_ci u32 cpu_state; 1048c2ecf20Sopenharmony_ci u32 reserved1[7]; 1058c2ecf20Sopenharmony_ci /* Offset to the mailbox used for sending commands from APU to CPU */ 1068c2ecf20Sopenharmony_ci u32 apu2cpu_mb_offset; 1078c2ecf20Sopenharmony_ci /* Value to write to register SW1 register set (0xC7003100) after the 1088c2ecf20Sopenharmony_ci command is ready */ 1098c2ecf20Sopenharmony_ci u32 apu2cpu_irq; 1108c2ecf20Sopenharmony_ci /* Value to write to register SW2 register set (0xC7003140) after the 1118c2ecf20Sopenharmony_ci command is cleared */ 1128c2ecf20Sopenharmony_ci u32 cpu2apu_irq_ack; 1138c2ecf20Sopenharmony_ci u32 reserved2[13]; 1148c2ecf20Sopenharmony_ci 1158c2ecf20Sopenharmony_ci u32 hpu2cpu_mb_offset; 1168c2ecf20Sopenharmony_ci u32 hpu2cpu_irq; 1178c2ecf20Sopenharmony_ci u32 cpu2hpu_irq_ack; 1188c2ecf20Sopenharmony_ci u32 reserved3[13]; 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci u32 ppu2cpu_mb_offset; 1218c2ecf20Sopenharmony_ci u32 ppu2cpu_irq; 1228c2ecf20Sopenharmony_ci u32 cpu2ppu_irq_ack; 1238c2ecf20Sopenharmony_ci u32 reserved4[13]; 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci u32 epu2cpu_mb_offset; 1268c2ecf20Sopenharmony_ci u32 epu2cpu_irq; 1278c2ecf20Sopenharmony_ci u32 cpu2epu_irq_ack; 1288c2ecf20Sopenharmony_ci u32 reserved5[13]; 1298c2ecf20Sopenharmony_ci u32 reserved6[8]; 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci /* Fields for APU: */ 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_ci u32 apu_state; 1348c2ecf20Sopenharmony_ci u32 reserved11[7]; 1358c2ecf20Sopenharmony_ci u32 cpu2apu_mb_offset; 1368c2ecf20Sopenharmony_ci u32 cpu2apu_irq; 1378c2ecf20Sopenharmony_ci u32 apu2cpu_irq_ack; 1388c2ecf20Sopenharmony_ci u32 reserved12[13]; 1398c2ecf20Sopenharmony_ci 1408c2ecf20Sopenharmony_ci u32 hpu2apu_mb_offset; 1418c2ecf20Sopenharmony_ci u32 hpu2apu_irq; 1428c2ecf20Sopenharmony_ci u32 apu2hpu_irq_ack; 1438c2ecf20Sopenharmony_ci u32 reserved13[13]; 1448c2ecf20Sopenharmony_ci 1458c2ecf20Sopenharmony_ci u32 ppu2apu_mb_offset; 1468c2ecf20Sopenharmony_ci u32 ppu2apu_irq; 1478c2ecf20Sopenharmony_ci u32 apu2ppu_irq_ack; 1488c2ecf20Sopenharmony_ci u32 reserved14[13]; 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci u32 epu2apu_mb_offset; 1518c2ecf20Sopenharmony_ci u32 epu2apu_irq; 1528c2ecf20Sopenharmony_ci u32 apu2epu_irq_ack; 1538c2ecf20Sopenharmony_ci u32 reserved15[13]; 1548c2ecf20Sopenharmony_ci u32 reserved16[8]; 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_ci /* Fields for HPU: */ 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_ci u32 hpu_state; 1598c2ecf20Sopenharmony_ci u32 reserved21[7]; 1608c2ecf20Sopenharmony_ci u32 cpu2hpu_mb_offset; 1618c2ecf20Sopenharmony_ci u32 cpu2hpu_irq; 1628c2ecf20Sopenharmony_ci u32 hpu2cpu_irq_ack; 1638c2ecf20Sopenharmony_ci u32 reserved22[13]; 1648c2ecf20Sopenharmony_ci 1658c2ecf20Sopenharmony_ci u32 apu2hpu_mb_offset; 1668c2ecf20Sopenharmony_ci u32 apu2hpu_irq; 1678c2ecf20Sopenharmony_ci u32 hpu2apu_irq_ack; 1688c2ecf20Sopenharmony_ci u32 reserved23[13]; 1698c2ecf20Sopenharmony_ci 1708c2ecf20Sopenharmony_ci u32 ppu2hpu_mb_offset; 1718c2ecf20Sopenharmony_ci u32 ppu2hpu_irq; 1728c2ecf20Sopenharmony_ci u32 hpu2ppu_irq_ack; 1738c2ecf20Sopenharmony_ci u32 reserved24[13]; 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_ci u32 epu2hpu_mb_offset; 1768c2ecf20Sopenharmony_ci u32 epu2hpu_irq; 1778c2ecf20Sopenharmony_ci u32 hpu2epu_irq_ack; 1788c2ecf20Sopenharmony_ci u32 reserved25[13]; 1798c2ecf20Sopenharmony_ci u32 reserved26[8]; 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_ci /* Fields for PPU: */ 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ci u32 ppu_state; 1848c2ecf20Sopenharmony_ci u32 reserved31[7]; 1858c2ecf20Sopenharmony_ci u32 cpu2ppu_mb_offset; 1868c2ecf20Sopenharmony_ci u32 cpu2ppu_irq; 1878c2ecf20Sopenharmony_ci u32 ppu2cpu_irq_ack; 1888c2ecf20Sopenharmony_ci u32 reserved32[13]; 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_ci u32 apu2ppu_mb_offset; 1918c2ecf20Sopenharmony_ci u32 apu2ppu_irq; 1928c2ecf20Sopenharmony_ci u32 ppu2apu_irq_ack; 1938c2ecf20Sopenharmony_ci u32 reserved33[13]; 1948c2ecf20Sopenharmony_ci 1958c2ecf20Sopenharmony_ci u32 hpu2ppu_mb_offset; 1968c2ecf20Sopenharmony_ci u32 hpu2ppu_irq; 1978c2ecf20Sopenharmony_ci u32 ppu2hpu_irq_ack; 1988c2ecf20Sopenharmony_ci u32 reserved34[13]; 1998c2ecf20Sopenharmony_ci 2008c2ecf20Sopenharmony_ci u32 epu2ppu_mb_offset; 2018c2ecf20Sopenharmony_ci u32 epu2ppu_irq; 2028c2ecf20Sopenharmony_ci u32 ppu2epu_irq_ack; 2038c2ecf20Sopenharmony_ci u32 reserved35[13]; 2048c2ecf20Sopenharmony_ci u32 reserved36[8]; 2058c2ecf20Sopenharmony_ci 2068c2ecf20Sopenharmony_ci /* Fields for EPU: */ 2078c2ecf20Sopenharmony_ci 2088c2ecf20Sopenharmony_ci u32 epu_state; 2098c2ecf20Sopenharmony_ci u32 reserved41[7]; 2108c2ecf20Sopenharmony_ci u32 cpu2epu_mb_offset; 2118c2ecf20Sopenharmony_ci u32 cpu2epu_irq; 2128c2ecf20Sopenharmony_ci u32 epu2cpu_irq_ack; 2138c2ecf20Sopenharmony_ci u32 reserved42[13]; 2148c2ecf20Sopenharmony_ci 2158c2ecf20Sopenharmony_ci u32 apu2epu_mb_offset; 2168c2ecf20Sopenharmony_ci u32 apu2epu_irq; 2178c2ecf20Sopenharmony_ci u32 epu2apu_irq_ack; 2188c2ecf20Sopenharmony_ci u32 reserved43[13]; 2198c2ecf20Sopenharmony_ci 2208c2ecf20Sopenharmony_ci u32 hpu2epu_mb_offset; 2218c2ecf20Sopenharmony_ci u32 hpu2epu_irq; 2228c2ecf20Sopenharmony_ci u32 epu2hpu_irq_ack; 2238c2ecf20Sopenharmony_ci u32 reserved44[13]; 2248c2ecf20Sopenharmony_ci 2258c2ecf20Sopenharmony_ci u32 ppu2epu_mb_offset; 2268c2ecf20Sopenharmony_ci u32 ppu2epu_irq; 2278c2ecf20Sopenharmony_ci u32 epu2ppu_irq_ack; 2288c2ecf20Sopenharmony_ci u32 reserved45[13]; 2298c2ecf20Sopenharmony_ci u32 reserved46[8]; 2308c2ecf20Sopenharmony_ci 2318c2ecf20Sopenharmony_ci u32 semaphores[8]; /* Semaphores */ 2328c2ecf20Sopenharmony_ci 2338c2ecf20Sopenharmony_ci u32 reserved50[32]; /* Reserved for future use */ 2348c2ecf20Sopenharmony_ci 2358c2ecf20Sopenharmony_ci struct cx18_mailbox apu2cpu_mb; 2368c2ecf20Sopenharmony_ci struct cx18_mailbox hpu2cpu_mb; 2378c2ecf20Sopenharmony_ci struct cx18_mailbox ppu2cpu_mb; 2388c2ecf20Sopenharmony_ci struct cx18_mailbox epu2cpu_mb; 2398c2ecf20Sopenharmony_ci 2408c2ecf20Sopenharmony_ci struct cx18_mailbox cpu2apu_mb; 2418c2ecf20Sopenharmony_ci struct cx18_mailbox hpu2apu_mb; 2428c2ecf20Sopenharmony_ci struct cx18_mailbox ppu2apu_mb; 2438c2ecf20Sopenharmony_ci struct cx18_mailbox epu2apu_mb; 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci struct cx18_mailbox cpu2hpu_mb; 2468c2ecf20Sopenharmony_ci struct cx18_mailbox apu2hpu_mb; 2478c2ecf20Sopenharmony_ci struct cx18_mailbox ppu2hpu_mb; 2488c2ecf20Sopenharmony_ci struct cx18_mailbox epu2hpu_mb; 2498c2ecf20Sopenharmony_ci 2508c2ecf20Sopenharmony_ci struct cx18_mailbox cpu2ppu_mb; 2518c2ecf20Sopenharmony_ci struct cx18_mailbox apu2ppu_mb; 2528c2ecf20Sopenharmony_ci struct cx18_mailbox hpu2ppu_mb; 2538c2ecf20Sopenharmony_ci struct cx18_mailbox epu2ppu_mb; 2548c2ecf20Sopenharmony_ci 2558c2ecf20Sopenharmony_ci struct cx18_mailbox cpu2epu_mb; 2568c2ecf20Sopenharmony_ci struct cx18_mailbox apu2epu_mb; 2578c2ecf20Sopenharmony_ci struct cx18_mailbox hpu2epu_mb; 2588c2ecf20Sopenharmony_ci struct cx18_mailbox ppu2epu_mb; 2598c2ecf20Sopenharmony_ci 2608c2ecf20Sopenharmony_ci struct cx18_mdl_ack cpu_mdl_ack[CX18_MAX_STREAMS][CX18_MAX_MDL_ACKS]; 2618c2ecf20Sopenharmony_ci struct cx18_mdl_ent cpu_mdl[1]; 2628c2ecf20Sopenharmony_ci}; 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_civoid cx18_init_scb(struct cx18 *cx); 2658c2ecf20Sopenharmony_ci 2668c2ecf20Sopenharmony_ci#endif 267