From owner-freebsd-mips@FreeBSD.ORG Mon Jan 5 08:44:38 2015 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 5CB3EC50; Mon, 5 Jan 2015 08:44:38 +0000 (UTC) Received: from mail-wi0-x22a.google.com (mail-wi0-x22a.google.com [IPv6:2a00:1450:400c:c05::22a]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E39F03BDA; Mon, 5 Jan 2015 08:44:37 +0000 (UTC) Received: by mail-wi0-f170.google.com with SMTP id bs8so3645856wib.5; Mon, 05 Jan 2015 00:44:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=aL6P/LL8uGERFmXFwIeCUUJPHi6wdDa5jNJpr8Rq3Oo=; b=XmBnoKf95+cCer8jfrshEDtHPGgRZkbct9++0dRKyNHj8g5H9nC1yan4YoEQNLsZq0 L742R5zkEt8A2JcVLCw1TURnVsmUPgpIzZFd4xGP09E6nu66rFrleVDtCk6DmXbUTPM2 rThGkMDcV6nZmURBbp+NN5MVg/XZqaU7XkyW1SkHptNnlTgVVTL4LzE/FQryeG1wNcx5 OXqU5HdBXGE4Smhnhg6mj4To3TVXPcvvvKyxhTfiy4lWm01S0h7FJDxQ6uhZ3FLb7jUH 71/bQwwt8NcBis8s8Ry2MiOurywFUXMgpcDV0fWn8bErYypS/UppjSplmiJgqCycXoQU 5hBQ== MIME-Version: 1.0 X-Received: by 10.180.87.36 with SMTP id u4mr23171795wiz.20.1420447475332; Mon, 05 Jan 2015 00:44:35 -0800 (PST) Sender: adrian.chadd@gmail.com Received: by 10.216.41.136 with HTTP; Mon, 5 Jan 2015 00:44:35 -0800 (PST) Date: Mon, 5 Jan 2015 00:44:35 -0800 X-Google-Sender-Auth: DtjVS3U0cYbU6OwiRX2upXj042s Message-ID: Subject: interrupt muxes, bus memory space and other fun amusing things From: Adrian Chadd To: John Baldwin , Ian Lepore , Warner Losh , "freebsd-mips@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jan 2015 08:44:38 -0000 Hi, I have FreeBSD-HEAD booting on the newer Atheros MIPS SoC (QCA955x series) but now I have to sort out the mess which is how the memory and IRQs are routed. I'd appreciate some help with this. Unlike something hierarchical like PCI, there's a mostly-flat device memory layout. Ie, things behind each interrupt "mux" aren't grouped into some contiguous memory region. On earlier chips the only interrupt multiplexer is the atheros peripheral bus, and it has things like USB 1, UART, hwpmc, etc. The wifi, EHCI USB, PCI, ethernet were assigned normal MIPS CPU interrupts and those devices hung off of nexus0. Now with the AR934x the on-board wifi hides behind one level of interrupt mux, which I'm currently getting wrong by referencing IP2 (nexus irq0) directly. Now, that's good enough for this, but not for what the QCA955x does. The QCA955x has: * IP6 - the APB mux - it has a mask and status register pair for interrupts for peripheral devices; * IP2 - PCIE root complex 1, WMAC * IP3 - PCIE root complex 2, USB1, USB2. The more annoying thing is that IP6 has its own status/mask registers, but IP2/IP3 have a shared status register for multiplexing. (Ie, half the bits are for IP2, half the bits are for IP3.) So if I were Linux, I'd just implement a mux that pretends to trigger interrupts in a much bigger IRQ space. Ie, they map IP0..IP7 to irq0..7, then they pick another IRQ range for the AHB interrupts, and another IRQ range for the IP2/IP3 interrupt mux. They have a hard-coded mux that takes care of triggering the software IRQ based on the hardware interrupt and mux register contents. So, how should I approach this? The other thing - right now mips/atheros/apb.c registers for a memory region that happens to be big enough to cover the vast majority of devices in the system. However, now I have regions covered by the APB, the IP2 mux and the IP3 mux. If I were evil, and I've thought about it, I've thought about just extending apb.c to include registering for three nexus0 interrupts and doing the muxing itself. That way only one bus thing is covering the entirety of peripheral memory. But it seems .. inelegant. Thanks! The QCA955x is pretty sweet btw - 600MHz DDR3, 720MHz CPU clock, dual-issue out of order pipeline. It's pretty freaking fast. ath> go 0x80050100 ## Starting application at 0x80050100 ... CPU platform: Atheros AR9558 rev 0 CPU Frequency=720 MHz CPU DDR Frequency=600 MHz CPU AHB Frequency=200 MHz platform frequency: 720 MHz CPU reference clock: 40 MHz CPU MDIO clock: 40 MHz .. -adrian