1*b285192aSMauro Carvalho Chehab /* 2*b285192aSMauro Carvalho Chehab * cx18 System Control Block initialization 3*b285192aSMauro Carvalho Chehab * 4*b285192aSMauro Carvalho Chehab * Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 5*b285192aSMauro Carvalho Chehab * Copyright (C) 2008 Andy Walls <awalls@md.metrocast.net> 6*b285192aSMauro Carvalho Chehab * 7*b285192aSMauro Carvalho Chehab * This program is free software; you can redistribute it and/or modify 8*b285192aSMauro Carvalho Chehab * it under the terms of the GNU General Public License as published by 9*b285192aSMauro Carvalho Chehab * the Free Software Foundation; either version 2 of the License, or 10*b285192aSMauro Carvalho Chehab * (at your option) any later version. 11*b285192aSMauro Carvalho Chehab * 12*b285192aSMauro Carvalho Chehab * This program is distributed in the hope that it will be useful, 13*b285192aSMauro Carvalho Chehab * but WITHOUT ANY WARRANTY; without even the implied warranty of 14*b285192aSMauro Carvalho Chehab * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15*b285192aSMauro Carvalho Chehab * GNU General Public License for more details. 16*b285192aSMauro Carvalho Chehab * 17*b285192aSMauro Carvalho Chehab * You should have received a copy of the GNU General Public License 18*b285192aSMauro Carvalho Chehab * along with this program; if not, write to the Free Software 19*b285192aSMauro Carvalho Chehab * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 20*b285192aSMauro Carvalho Chehab * 02111-1307 USA 21*b285192aSMauro Carvalho Chehab */ 22*b285192aSMauro Carvalho Chehab 23*b285192aSMauro Carvalho Chehab #include "cx18-driver.h" 24*b285192aSMauro Carvalho Chehab #include "cx18-io.h" 25*b285192aSMauro Carvalho Chehab #include "cx18-scb.h" 26*b285192aSMauro Carvalho Chehab 27*b285192aSMauro Carvalho Chehab void cx18_init_scb(struct cx18 *cx) 28*b285192aSMauro Carvalho Chehab { 29*b285192aSMauro Carvalho Chehab cx18_setup_page(cx, SCB_OFFSET); 30*b285192aSMauro Carvalho Chehab cx18_memset_io(cx, cx->scb, 0, 0x10000); 31*b285192aSMauro Carvalho Chehab 32*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_APU_TO_CPU, &cx->scb->apu2cpu_irq); 33*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_CPU_TO_APU_ACK, &cx->scb->cpu2apu_irq_ack); 34*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_HPU_TO_CPU, &cx->scb->hpu2cpu_irq); 35*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_CPU_TO_HPU_ACK, &cx->scb->cpu2hpu_irq_ack); 36*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_PPU_TO_CPU, &cx->scb->ppu2cpu_irq); 37*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_CPU_TO_PPU_ACK, &cx->scb->cpu2ppu_irq_ack); 38*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_EPU_TO_CPU, &cx->scb->epu2cpu_irq); 39*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_CPU_TO_EPU_ACK, &cx->scb->cpu2epu_irq_ack); 40*b285192aSMauro Carvalho Chehab 41*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_CPU_TO_APU, &cx->scb->cpu2apu_irq); 42*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_APU_TO_CPU_ACK, &cx->scb->apu2cpu_irq_ack); 43*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_HPU_TO_APU, &cx->scb->hpu2apu_irq); 44*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_APU_TO_HPU_ACK, &cx->scb->apu2hpu_irq_ack); 45*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_PPU_TO_APU, &cx->scb->ppu2apu_irq); 46*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_APU_TO_PPU_ACK, &cx->scb->apu2ppu_irq_ack); 47*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_EPU_TO_APU, &cx->scb->epu2apu_irq); 48*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_APU_TO_EPU_ACK, &cx->scb->apu2epu_irq_ack); 49*b285192aSMauro Carvalho Chehab 50*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_CPU_TO_HPU, &cx->scb->cpu2hpu_irq); 51*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_HPU_TO_CPU_ACK, &cx->scb->hpu2cpu_irq_ack); 52*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_APU_TO_HPU, &cx->scb->apu2hpu_irq); 53*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_HPU_TO_APU_ACK, &cx->scb->hpu2apu_irq_ack); 54*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_PPU_TO_HPU, &cx->scb->ppu2hpu_irq); 55*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_HPU_TO_PPU_ACK, &cx->scb->hpu2ppu_irq_ack); 56*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_EPU_TO_HPU, &cx->scb->epu2hpu_irq); 57*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_HPU_TO_EPU_ACK, &cx->scb->hpu2epu_irq_ack); 58*b285192aSMauro Carvalho Chehab 59*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_CPU_TO_PPU, &cx->scb->cpu2ppu_irq); 60*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_PPU_TO_CPU_ACK, &cx->scb->ppu2cpu_irq_ack); 61*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_APU_TO_PPU, &cx->scb->apu2ppu_irq); 62*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_PPU_TO_APU_ACK, &cx->scb->ppu2apu_irq_ack); 63*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_HPU_TO_PPU, &cx->scb->hpu2ppu_irq); 64*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_PPU_TO_HPU_ACK, &cx->scb->ppu2hpu_irq_ack); 65*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_EPU_TO_PPU, &cx->scb->epu2ppu_irq); 66*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_PPU_TO_EPU_ACK, &cx->scb->ppu2epu_irq_ack); 67*b285192aSMauro Carvalho Chehab 68*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_CPU_TO_EPU, &cx->scb->cpu2epu_irq); 69*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_EPU_TO_CPU_ACK, &cx->scb->epu2cpu_irq_ack); 70*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_APU_TO_EPU, &cx->scb->apu2epu_irq); 71*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_EPU_TO_APU_ACK, &cx->scb->epu2apu_irq_ack); 72*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_HPU_TO_EPU, &cx->scb->hpu2epu_irq); 73*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_EPU_TO_HPU_ACK, &cx->scb->epu2hpu_irq_ack); 74*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_PPU_TO_EPU, &cx->scb->ppu2epu_irq); 75*b285192aSMauro Carvalho Chehab cx18_writel(cx, IRQ_EPU_TO_PPU_ACK, &cx->scb->epu2ppu_irq_ack); 76*b285192aSMauro Carvalho Chehab 77*b285192aSMauro Carvalho Chehab cx18_writel(cx, SCB_OFFSET + offsetof(struct cx18_scb, apu2cpu_mb), 78*b285192aSMauro Carvalho Chehab &cx->scb->apu2cpu_mb_offset); 79*b285192aSMauro Carvalho Chehab cx18_writel(cx, SCB_OFFSET + offsetof(struct cx18_scb, hpu2cpu_mb), 80*b285192aSMauro Carvalho Chehab &cx->scb->hpu2cpu_mb_offset); 81*b285192aSMauro Carvalho Chehab cx18_writel(cx, SCB_OFFSET + offsetof(struct cx18_scb, ppu2cpu_mb), 82*b285192aSMauro Carvalho Chehab &cx->scb->ppu2cpu_mb_offset); 83*b285192aSMauro Carvalho Chehab cx18_writel(cx, SCB_OFFSET + offsetof(struct cx18_scb, epu2cpu_mb), 84*b285192aSMauro Carvalho Chehab &cx->scb->epu2cpu_mb_offset); 85*b285192aSMauro Carvalho Chehab cx18_writel(cx, SCB_OFFSET + offsetof(struct cx18_scb, cpu2apu_mb), 86*b285192aSMauro Carvalho Chehab &cx->scb->cpu2apu_mb_offset); 87*b285192aSMauro Carvalho Chehab cx18_writel(cx, SCB_OFFSET + offsetof(struct cx18_scb, hpu2apu_mb), 88*b285192aSMauro Carvalho Chehab &cx->scb->hpu2apu_mb_offset); 89*b285192aSMauro Carvalho Chehab cx18_writel(cx, SCB_OFFSET + offsetof(struct cx18_scb, ppu2apu_mb), 90*b285192aSMauro Carvalho Chehab &cx->scb->ppu2apu_mb_offset); 91*b285192aSMauro Carvalho Chehab cx18_writel(cx, SCB_OFFSET + offsetof(struct cx18_scb, epu2apu_mb), 92*b285192aSMauro Carvalho Chehab &cx->scb->epu2apu_mb_offset); 93*b285192aSMauro Carvalho Chehab cx18_writel(cx, SCB_OFFSET + offsetof(struct cx18_scb, cpu2hpu_mb), 94*b285192aSMauro Carvalho Chehab &cx->scb->cpu2hpu_mb_offset); 95*b285192aSMauro Carvalho Chehab cx18_writel(cx, SCB_OFFSET + offsetof(struct cx18_scb, apu2hpu_mb), 96*b285192aSMauro Carvalho Chehab &cx->scb->apu2hpu_mb_offset); 97*b285192aSMauro Carvalho Chehab cx18_writel(cx, SCB_OFFSET + offsetof(struct cx18_scb, ppu2hpu_mb), 98*b285192aSMauro Carvalho Chehab &cx->scb->ppu2hpu_mb_offset); 99*b285192aSMauro Carvalho Chehab cx18_writel(cx, SCB_OFFSET + offsetof(struct cx18_scb, epu2hpu_mb), 100*b285192aSMauro Carvalho Chehab &cx->scb->epu2hpu_mb_offset); 101*b285192aSMauro Carvalho Chehab cx18_writel(cx, SCB_OFFSET + offsetof(struct cx18_scb, cpu2ppu_mb), 102*b285192aSMauro Carvalho Chehab &cx->scb->cpu2ppu_mb_offset); 103*b285192aSMauro Carvalho Chehab cx18_writel(cx, SCB_OFFSET + offsetof(struct cx18_scb, apu2ppu_mb), 104*b285192aSMauro Carvalho Chehab &cx->scb->apu2ppu_mb_offset); 105*b285192aSMauro Carvalho Chehab cx18_writel(cx, SCB_OFFSET + offsetof(struct cx18_scb, hpu2ppu_mb), 106*b285192aSMauro Carvalho Chehab &cx->scb->hpu2ppu_mb_offset); 107*b285192aSMauro Carvalho Chehab cx18_writel(cx, SCB_OFFSET + offsetof(struct cx18_scb, epu2ppu_mb), 108*b285192aSMauro Carvalho Chehab &cx->scb->epu2ppu_mb_offset); 109*b285192aSMauro Carvalho Chehab cx18_writel(cx, SCB_OFFSET + offsetof(struct cx18_scb, cpu2epu_mb), 110*b285192aSMauro Carvalho Chehab &cx->scb->cpu2epu_mb_offset); 111*b285192aSMauro Carvalho Chehab cx18_writel(cx, SCB_OFFSET + offsetof(struct cx18_scb, apu2epu_mb), 112*b285192aSMauro Carvalho Chehab &cx->scb->apu2epu_mb_offset); 113*b285192aSMauro Carvalho Chehab cx18_writel(cx, SCB_OFFSET + offsetof(struct cx18_scb, hpu2epu_mb), 114*b285192aSMauro Carvalho Chehab &cx->scb->hpu2epu_mb_offset); 115*b285192aSMauro Carvalho Chehab cx18_writel(cx, SCB_OFFSET + offsetof(struct cx18_scb, ppu2epu_mb), 116*b285192aSMauro Carvalho Chehab &cx->scb->ppu2epu_mb_offset); 117*b285192aSMauro Carvalho Chehab 118*b285192aSMauro Carvalho Chehab cx18_writel(cx, SCB_OFFSET + offsetof(struct cx18_scb, cpu_state), 119*b285192aSMauro Carvalho Chehab &cx->scb->ipc_offset); 120*b285192aSMauro Carvalho Chehab 121*b285192aSMauro Carvalho Chehab cx18_writel(cx, 1, &cx->scb->epu_state); 122*b285192aSMauro Carvalho Chehab } 123