From patchwork Sat Apr 20 13:55:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 2467991 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id 7E3AFDF2A1 for ; Sat, 20 Apr 2013 13:58:10 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UTYHc-0006KH-50; Sat, 20 Apr 2013 13:56:53 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UTYH9-0006Sz-Lz; Sat, 20 Apr 2013 13:56:23 +0000 Received: from mail-la0-x235.google.com ([2a00:1450:4010:c03::235]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UTYGn-0006RN-UW for linux-arm-kernel@lists.infradead.org; Sat, 20 Apr 2013 13:56:04 +0000 Received: by mail-la0-f53.google.com with SMTP id eg20so453013lab.40 for ; Sat, 20 Apr 2013 06:55:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=2F4rzkgYUbGya0G9W/0xAhSKjEoGBHmq92bGP3By2O8=; b=fkf0/8gXnFOrB8fMKk59+B9hfvcI9Js/0NQEOIRphxhNyn9iTdTXWYA3kBLwpYv5R6 3uY55wHGzS0gYyMI8itFUnVoAMw3qoKkRXccepPhVm8LcpX6YSU9su8UEKHLnrrga65C Z9sZoPy0e7nBlSlrRpT5qAEY/XhSP478kxjxQ68+nYeBZcsoNRA+Yo7hp8mIe3bnrA97 FSOF57CDFPKSIqFd3sJ+KihbH7HuhBQ3Fl1mpXtobDi+acG8EZ6LDdHHZ/zGYSNBNmSe VnvXNIL09+IYR3/AGLe7g/UznC1ABVFlK1RY2AHrouiDtHPUhT4VpF3bZEVNMo6a2ezR FklQ== X-Received: by 10.112.190.99 with SMTP id gp3mr9819755lbc.132.1366466159338; Sat, 20 Apr 2013 06:55:59 -0700 (PDT) Received: from localhost.localdomain (c83-249-208-67.bredband.comhem.se. [83.249.208.67]) by mx.google.com with ESMTPS id z10sm7468071lbz.1.2013.04.20.06.55.57 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 20 Apr 2013 06:55:58 -0700 (PDT) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org Subject: [RESEND PATCH 04/12] ARM: integrator: convert PCIv3 bridge to platform device Date: Sat, 20 Apr 2013 15:55:56 +0200 Message-Id: <1366466156-15463-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.1.4 X-Gm-Message-State: ALoCoQnQ862l0RfRrzjeNRmrGdLeq3UVtfEImNvaOIUk5YE3UQgF4eBpv2nPORUaO0Z/TL282l/o X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130420_095602_280922_59514A6A X-CRM114-Status: GOOD ( 18.25 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Linus Walleij X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This converts the PCIv3 driver to a platform device driver, and registers the device only on the Integrator/AP instead of bailing out in the initcall if the platform is not correct. Acked-by: Arnd Bergmann Signed-off-by: Linus Walleij --- arch/arm/mach-integrator/integrator_ap.c | 17 +++++++++++++++++ arch/arm/mach-integrator/pci_v3.c | 30 ++++++++++++++++++++---------- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c index ea96144..f190bab 100644 --- a/arch/arm/mach-integrator/integrator_ap.c +++ b/arch/arm/mach-integrator/integrator_ap.c @@ -494,6 +494,15 @@ static struct of_dev_auxdata ap_auxdata_lookup[] __initdata = { { /* sentinel */ }, }; +/* + * This is a placeholder that will get deleted when we move the PCI + * device over to the device tree. + */ +static struct platform_device pci_v3_device_of = { + .name = "pci-v3", + .id = 0, +}; + static void __init ap_init_of(void) { unsigned long sc_dec; @@ -550,6 +559,8 @@ static void __init ap_init_of(void) of_platform_populate(root, of_default_bus_match_table, ap_auxdata_lookup, parent); + platform_device_register(&pci_v3_device_of); + sc_dec = readl(ap_syscon_base + INTEGRATOR_SC_DEC_OFFSET); for (i = 0; i < 4; i++) { struct lm_device *lmdev; @@ -617,6 +628,11 @@ static void __init ap_map_io_atag(void) * for eventual deletion. */ +static struct platform_device pci_v3_device = { + .name = "pci-v3", + .id = 0, +}; + static struct resource cfi_flash_resource = { .start = INTEGRATOR_FLASH_BASE, .end = INTEGRATOR_FLASH_BASE + INTEGRATOR_FLASH_SIZE - 1, @@ -674,6 +690,7 @@ static void __init ap_init(void) unsigned long sc_dec; int i; + platform_device_register(&pci_v3_device); platform_device_register(&cfi_flash_device); ap_syscon_base = __io_address(INTEGRATOR_SC_BASE); diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c index b8d7033..2733c6c 100644 --- a/arch/arm/mach-integrator/pci_v3.c +++ b/arch/arm/mach-integrator/pci_v3.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -35,7 +36,6 @@ #include #include #include -#include #include @@ -649,7 +649,7 @@ static void __init pci_v3_postinit(void) /* * This routine handles multiple bridges. */ -static u8 __init integrator_swizzle(struct pci_dev *dev, u8 *pinp) +static u8 __init pci_v3_swizzle(struct pci_dev *dev, u8 *pinp) { if (*pinp == 0) *pinp = 1; @@ -665,16 +665,16 @@ static int irq_tab[4] __initdata = { * map the specified device/slot/pin to an IRQ. This works out such * that slot 9 pin 1 is INT0, pin 2 is INT1, and slot 10 pin 1 is INT1. */ -static int __init integrator_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) +static int __init pci_v3_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) { int intnr = ((slot - 9) + (pin - 1)) & 3; return irq_tab[intnr]; } -static struct hw_pci integrator_pci __initdata = { - .swizzle = integrator_swizzle, - .map_irq = integrator_map_irq, +static struct hw_pci pci_v3 __initdata = { + .swizzle = pci_v3_swizzle, + .map_irq = pci_v3_map_irq, .setup = pci_v3_setup, .nr_controllers = 1, .ops = &pci_v3_ops, @@ -682,11 +682,21 @@ static struct hw_pci integrator_pci __initdata = { .postinit = pci_v3_postinit, }; -static int __init integrator_pci_init(void) +static int __init pci_v3_probe(struct platform_device *pdev) { - if (machine_is_integrator()) - pci_common_init(&integrator_pci); + pci_common_init(&pci_v3); return 0; } -subsys_initcall(integrator_pci_init); +static struct platform_driver pci_v3_driver = { + .driver = { + .name = "pci-v3", + }, +}; + +static int __init pci_v3_init(void) +{ + return platform_driver_probe(&pci_v3_driver, pci_v3_probe); +} + +subsys_initcall(pci_v3_init);