From patchwork Wed Jan 22 13:31:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 23521 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f199.google.com (mail-ie0-f199.google.com [209.85.223.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 77C08218CB for ; Wed, 22 Jan 2014 13:31:34 +0000 (UTC) Received: by mail-ie0-f199.google.com with SMTP id x13sf37734139ief.6 for ; Wed, 22 Jan 2014 05:31:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=cRJB8vY5V61FJgqxiz4A6JZjxcvwD0jo5w6uV7zVBpY=; b=DFeoFK/5OCwAMdZMyHXqH/6kTGuTsq0s8iO9RS/KrVWKsFz6VhVsRdMFN7H3IYQV7R lZcaWNXX+3GDu4Yhdpt1XzzIkGHpmVYMy1FPbufjEJyv+F/BjfH9xgxOhA3/o+8ZkpGs s95cvNOoZpb3ELV5gGQimwyLTMiZkxHm2lZRsVLc/Ewq2PPcHzm3ODNWszCEY4szRa7Y Y9mTrXw96UEkXJb6lswLz8h1x22gHEL/4ZLAenZmhazh1ODIicFv/r1XLgQgQuM0GuQp DG7b+MYxKdsMdBFko/3bD5Rt6ARPoAXcZHjJWTaXae7PFNQLNki3c4EFZiZPxBj59g81 td1Q== X-Gm-Message-State: ALoCoQmu4h//IYWdqjYoPkZrfuib36bcCRLmHFnHv9+ICJhofz/uKdn57if6TYlYc1G821hyrn87 X-Received: by 10.42.240.19 with SMTP id ky19mr497180icb.4.1390397493742; Wed, 22 Jan 2014 05:31:33 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.58.161 with SMTP id s1ls82609qeq.70.gmail; Wed, 22 Jan 2014 05:31:33 -0800 (PST) X-Received: by 10.220.92.135 with SMTP id r7mr907356vcm.11.1390397493433; Wed, 22 Jan 2014 05:31:33 -0800 (PST) Received: from mail-vb0-f49.google.com (mail-vb0-f49.google.com [209.85.212.49]) by mx.google.com with ESMTPS id cz20si4546420veb.15.2014.01.22.05.31.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Jan 2014 05:31:33 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.49 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.49; Received: by mail-vb0-f49.google.com with SMTP id x14so208517vbb.8 for ; Wed, 22 Jan 2014 05:31:33 -0800 (PST) X-Received: by 10.58.106.70 with SMTP id gs6mr939172veb.28.1390397493364; Wed, 22 Jan 2014 05:31:33 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp184743vcz; Wed, 22 Jan 2014 05:31:32 -0800 (PST) X-Received: by 10.194.61.133 with SMTP id p5mr1693780wjr.73.1390397492459; Wed, 22 Jan 2014 05:31:32 -0800 (PST) Received: from mail-we0-f179.google.com (mail-we0-f179.google.com [74.125.82.179]) by mx.google.com with ESMTPS id hk14si6797767wib.5.2014.01.22.05.31.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Jan 2014 05:31:32 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.179 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=74.125.82.179; Received: by mail-we0-f179.google.com with SMTP id w62so320071wes.10 for ; Wed, 22 Jan 2014 05:31:32 -0800 (PST) X-Received: by 10.194.71.47 with SMTP id r15mr1787388wju.19.1390397491995; Wed, 22 Jan 2014 05:31:31 -0800 (PST) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id po3sm14898693wjc.3.2014.01.22.05.31.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Jan 2014 05:31:31 -0800 (PST) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org Cc: Linus Walleij Subject: [PATCH 4/5] ARM: integrator: register the IM-PD1 VIC Date: Wed, 22 Jan 2014 14:31:10 +0100 Message-Id: <1390397471-6802-5-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <1390397471-6802-1-git-send-email-linus.walleij@linaro.org> References: <1390397471-6802-1-git-send-email-linus.walleij@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.49 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The peripherals on the IM-PD1 has never really been able to properly fire their IRQs to the main FPGA IRQ controller. Cascade it properly and register interrupts for all the devices in the array. Signed-off-by: Linus Walleij --- arch/arm/mach-integrator/Kconfig | 1 + arch/arm/mach-integrator/impd1.c | 45 ++++++++++++++++++++++++++++++++-------- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/arch/arm/mach-integrator/Kconfig b/arch/arm/mach-integrator/Kconfig index abeff25532ab..46be99007529 100644 --- a/arch/arm/mach-integrator/Kconfig +++ b/arch/arm/mach-integrator/Kconfig @@ -30,6 +30,7 @@ config ARCH_CINTEGRATOR config INTEGRATOR_IMPD1 tristate "Include support for Integrator/IM-PD1" depends on ARCH_INTEGRATOR_AP + select ARM_VIC help The IM-PD1 is an add-on logic module for the Integrator which allows ARM(R) Ltd PrimeCells to be developed and evaluated. diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c index aeeae0d79a18..d9b784824808 100644 --- a/arch/arm/mach-integrator/impd1.c +++ b/arch/arm/mach-integrator/impd1.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -35,6 +36,7 @@ MODULE_PARM_DESC(lmid, "logic module stack position"); struct impd1_module { void __iomem *base; + void __iomem *vic_base; }; void impd1_tweak_control(struct device *dev, u32 mask, u32 val) @@ -262,9 +264,6 @@ struct impd1_device { static struct impd1_device impd1_devs[] = { { - .offset = 0x03000000, - .id = 0x00041190, - }, { .offset = 0x00100000, .irq = { 1 }, .id = 0x00141011, @@ -304,9 +303,15 @@ static struct impd1_device impd1_devs[] = { } }; -static int impd1_probe(struct lm_device *dev) +/* + * Valid IRQs: 0 thru 9 and 11, 10 unused. + */ +#define IMPD1_VALID_IRQS 0x00000bffU + +static int __init impd1_probe(struct lm_device *dev) { struct impd1_module *impd1; + int irq_base; int i; if (dev->id != module_id) @@ -325,23 +330,45 @@ static int impd1_probe(struct lm_device *dev) if (!impd1->base) return -ENOMEM; - lm_set_drvdata(dev, impd1); + integrator_impd1_clk_init(impd1->base, dev->id); + + if (!devm_request_mem_region(&dev->dev, + dev->resource.start + 0x03000000, + SZ_4K, "VIC")) + return -EBUSY; - printk("IM-PD1 found at 0x%08lx\n", - (unsigned long)dev->resource.start); + impd1->vic_base = devm_ioremap(&dev->dev, + dev->resource.start + 0x03000000, + SZ_4K); + if (!impd1->vic_base) + return -ENOMEM; - integrator_impd1_clk_init(impd1->base, dev->id); + irq_base = vic_init_cascaded(impd1->vic_base, dev->irq, + IMPD1_VALID_IRQS, 0); + + lm_set_drvdata(dev, impd1); + + dev_info(&dev->dev, "IM-PD1 found at 0x%08lx\n", + (unsigned long)dev->resource.start); for (i = 0; i < ARRAY_SIZE(impd1_devs); i++) { struct impd1_device *idev = impd1_devs + i; struct amba_device *d; unsigned long pc_base; char devname[32]; + int irq1 = idev->irq[0]; + int irq2 = idev->irq[1]; + + /* Translate IRQs to IM-PD1 local numberspace */ + if (irq1) + irq1 += irq_base; + if (irq2) + irq2 += irq_base; pc_base = dev->resource.start + idev->offset; snprintf(devname, 32, "lm%x:%5.5lx", dev->id, idev->offset >> 12); d = amba_ahb_device_add_res(&dev->dev, devname, pc_base, SZ_4K, - dev->irq, dev->irq, + irq1, irq2, idev->platform_data, idev->id, &dev->resource); if (IS_ERR(d)) {