From patchwork Mon Apr 2 01:22:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 7568 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 455DE23E23 for ; Mon, 2 Apr 2012 01:22:18 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 07B7EA1812D for ; Mon, 2 Apr 2012 01:22:17 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id e36so4975195iag.11 for ; Sun, 01 Apr 2012 18:22:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=5Sob9K+15nrYevmTVNcXh2PUv99mtaUOvpOVNljXQkI=; b=V8CTWmKBWwzEbDl6B186G/aL7PzQdcG8Tl/2QuIxM6YSizzESFp0gqi2rcbKWfvnvP YInkh87XAZCZImwHIhGUzhpWqnPt3lWDB3n8tJ9TZO77zUhIhGIt3kCnWAl/xP7TPp47 XAD3hTFYlFHFEomieWr5bviRba6cTeccgH0hWu4VohaJGbJhVohdVS8rX91RBzGuVrXW erTTP3OBUv9tedEflkoN9ecdE/YJL1+ihf6oYeISnpUbZGJJQ8VcMKLyR6LeXOY5YoUk o5knq2cFdzY5v7S7f46f8FeCmuX6pFzbYKpitSa+cQUOxJye08VXW87PEL8VQAOKJaiF +vKg== Received: by 10.42.155.9 with SMTP id s9mr3257218icw.51.1333329737793; Sun, 01 Apr 2012 18:22:17 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.5.205 with SMTP id 13csp87710ibw; Sun, 1 Apr 2012 18:22:17 -0700 (PDT) Received: by 10.204.9.195 with SMTP id m3mr2840553bkm.78.1333329736595; Sun, 01 Apr 2012 18:22:16 -0700 (PDT) Received: from mail.df.lth.se (mail.df.lth.se. [194.47.250.12]) by mx.google.com with ESMTPS id ug8si8986822bkb.2.2012.04.01.18.22.15 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 01 Apr 2012 18:22:16 -0700 (PDT) Received-SPF: neutral (google.com: 194.47.250.12 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=194.47.250.12; Authentication-Results: mx.google.com; spf=neutral (google.com: 194.47.250.12 is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) smtp.mail=linus.walleij@linaro.org Received: from fecusia (c83-249-217-152.bredband.comhem.se [83.249.217.152]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.df.lth.se (Postfix) with ESMTPSA id 6B07065D8D; Mon, 2 Apr 2012 03:22:14 +0200 (CEST) Received: by fecusia (sSMTP sendmail emulation); Mon, 2 Apr 2012 03:22:14 +0200 From: "Linus Walleij" To: linux-arm-kernel@lists.infradead.org Cc: Shawn Guo , Linus Walleij , Srinidhi Kasagar , Rabin Vincent Subject: [PATCH 4/4] ARM: ux500: factor out dynamic amba device allocator Date: Mon, 2 Apr 2012 03:22:11 +0200 Message-Id: <1333329731-31735-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.7.7.6 X-Gm-Message-State: ALoCoQl4iGXLzy30UkeV6cCS5hhkYXMcqZP4QLWhuwup8Du++dSUDHl8Bnh9ejcmc24lelJ62iJb This replaces the dynamic device allocator in the ux500 machine with the common device allocator in the bus code. Cc: Srinidhi Kasagar Cc: Rabin Vincent Signed-off-by: Linus Walleij --- arch/arm/mach-ux500/devices-common.c | 33 --------------------------------- arch/arm/mach-ux500/devices-common.h | 23 ++++++++++------------- arch/arm/mach-ux500/devices-db8500.h | 2 +- 3 files changed, 11 insertions(+), 47 deletions(-) diff --git a/arch/arm/mach-ux500/devices-common.c b/arch/arm/mach-ux500/devices-common.c index c5312a4..dfdd4a5 100644 --- a/arch/arm/mach-ux500/devices-common.c +++ b/arch/arm/mach-ux500/devices-common.c @@ -11,7 +11,6 @@ #include #include #include -#include #include @@ -19,38 +18,6 @@ #include "devices-common.h" -struct amba_device * -dbx500_add_amba_device(struct device *parent, const char *name, - resource_size_t base, int irq, void *pdata, - unsigned int periphid) -{ - struct amba_device *dev; - int ret; - - dev = amba_device_alloc(name, base, SZ_4K); - if (!dev) - return ERR_PTR(-ENOMEM); - - dev->dma_mask = DMA_BIT_MASK(32); - dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); - - dev->irq[0] = irq; - - dev->periphid = periphid; - - dev->dev.platform_data = pdata; - - dev->dev.parent = parent; - - ret = amba_device_add(dev, &iomem_resource); - if (ret) { - amba_device_put(dev); - return ERR_PTR(ret); - } - - return dev; -} - static struct platform_device * dbx500_add_gpio(struct device *parent, int id, resource_size_t addr, int irq, struct nmk_gpio_platform_data *pdata) diff --git a/arch/arm/mach-ux500/devices-common.h b/arch/arm/mach-ux500/devices-common.h index 39c74ec..f75bcb2 100644 --- a/arch/arm/mach-ux500/devices-common.h +++ b/arch/arm/mach-ux500/devices-common.h @@ -11,13 +11,9 @@ #include #include #include +#include #include -extern struct amba_device * -dbx500_add_amba_device(struct device *parent, const char *name, - resource_size_t base, int irq, void *pdata, - unsigned int periphid); - struct spi_master_cntlr; static inline struct amba_device * @@ -25,8 +21,8 @@ dbx500_add_msp_spi(struct device *parent, const char *name, resource_size_t base, int irq, struct spi_master_cntlr *pdata) { - return dbx500_add_amba_device(parent, name, base, irq, - pdata, 0); + return amba_ahb_device_add(parent, name, base, SZ_4K, irq, 0, + pdata, 0); } static inline struct amba_device * @@ -34,8 +30,8 @@ dbx500_add_spi(struct device *parent, const char *name, resource_size_t base, int irq, struct spi_master_cntlr *pdata, u32 periphid) { - return dbx500_add_amba_device(parent, name, base, irq, - pdata, periphid); + return amba_ahb_device_add(parent, name, base, SZ_4K, irq, 0, + pdata, periphid); } struct mmci_platform_data; @@ -44,8 +40,8 @@ static inline struct amba_device * dbx500_add_sdi(struct device *parent, const char *name, resource_size_t base, int irq, struct mmci_platform_data *pdata, u32 periphid) { - return dbx500_add_amba_device(parent, name, base, irq, - pdata, periphid); + return amba_ahb_device_add(parent, name, base, SZ_4K, irq, 0, + pdata, periphid); } struct amba_pl011_data; @@ -54,7 +50,7 @@ static inline struct amba_device * dbx500_add_uart(struct device *parent, const char *name, resource_size_t base, int irq, struct amba_pl011_data *pdata) { - return dbx500_add_amba_device(parent, name, base, irq, pdata, 0); + return amba_ahb_device_add(parent, name, base, SZ_4K, irq, 0, pdata, 0); } struct nmk_i2c_controller; @@ -85,7 +81,8 @@ dbx500_add_i2c(struct device *parent, int id, resource_size_t base, int irq, static inline struct amba_device * dbx500_add_rtc(struct device *parent, resource_size_t base, int irq) { - return dbx500_add_amba_device(parent, "rtc-pl031", base, irq, NULL, 0); + return amba_apb_device_add(parent, "rtc-pl031", base, SZ_4K, irq, + 0, NULL, 0); } struct nmk_gpio_platform_data; diff --git a/arch/arm/mach-ux500/devices-db8500.h b/arch/arm/mach-ux500/devices-db8500.h index 9fd93e9..6fc7eb2 100644 --- a/arch/arm/mach-ux500/devices-db8500.h +++ b/arch/arm/mach-ux500/devices-db8500.h @@ -31,7 +31,7 @@ static inline struct amba_device * db8500_add_ssp(struct device *parent, const char *name, resource_size_t base, int irq, struct pl022_ssp_controller *pdata) { - return dbx500_add_amba_device(parent, name, base, irq, pdata, 0); + return amba_ahb_device_add(parent, name, base, SZ_4K, irq, 0, pdata, 0); }