From patchwork Fri Sep 16 14:38:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Martin X-Patchwork-Id: 4134 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 44B6423EFD for ; Fri, 16 Sep 2011 14:38:28 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id 30EB1A18AEB for ; Fri, 16 Sep 2011 14:38:28 +0000 (UTC) Received: by fxe23 with SMTP id 23so2459420fxe.11 for ; Fri, 16 Sep 2011 07:38:28 -0700 (PDT) Received: by 10.223.61.66 with SMTP id s2mr18302fah.27.1316183907944; Fri, 16 Sep 2011 07:38:27 -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.152.11.8 with SMTP id m8cs130380lab; Fri, 16 Sep 2011 07:38:27 -0700 (PDT) Received: by 10.216.29.78 with SMTP id h56mr830846wea.51.1316183907232; Fri, 16 Sep 2011 07:38:27 -0700 (PDT) Received: from mail-wy0-f172.google.com (mail-wy0-f172.google.com [74.125.82.172]) by mx.google.com with ESMTPS id n55si7446875wed.32.2011.09.16.07.38.26 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 16 Sep 2011 07:38:27 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.172 is neither permitted nor denied by best guess record for domain of dave.martin@linaro.org) client-ip=74.125.82.172; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.172 is neither permitted nor denied by best guess record for domain of dave.martin@linaro.org) smtp.mail=dave.martin@linaro.org Received: by wyg24 with SMTP id 24so5144697wyg.17 for ; Fri, 16 Sep 2011 07:38:26 -0700 (PDT) Received: by 10.216.138.142 with SMTP id a14mr810906wej.63.1316183906345; Fri, 16 Sep 2011 07:38:26 -0700 (PDT) Received: from e103592.peterhouse.linaro.org (fw-lnat.cambridge.arm.com. [217.140.96.63]) by mx.google.com with ESMTPS id n21sm126982wbp.2.2011.09.16.07.38.23 (version=SSLv3 cipher=OTHER); Fri, 16 Sep 2011 07:38:24 -0700 (PDT) From: Dave Martin To: devicetree-discuss@lists.ozlabs.org, Grant Likely , linux-ide@vger.kernel.org Cc: patches@linaro.org, Jeff Garzik , linux-arm-kernel@lists.infradead.org, Dave Martin Subject: [PATCH] pata-generic/of: Make probing via device tree non-powerpc-specific Date: Fri, 16 Sep 2011 15:38:10 +0100 Message-Id: <1316183890-13677-1-git-send-email-dave.martin@linaro.org> X-Mailer: git-send-email 1.7.4.1 This patch enables device-tree-based probing of the pata-generic platform driver across all architectures: * make the pata_of_generic module depend on OF instead of PPC_OF; * supply some missing inclues; * replace endianness-sensitive raw access to device tree data with of_property_read_u32() calls. Signed-off-by: Dave Martin --- Tested on ARM Versatile Express, with my soon-to-be-posted device tree support patches. I'm not in a position to build/test this for powerpc easily -- if anyone is able to do that, it would be appreciated. Grant, does this require similar cleanup to the isp1760 USB hcd driver? Cheers ---Dave drivers/ata/Kconfig | 2 +- drivers/ata/pata_of_platform.c | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 5987e0b..c6ef9d0 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -820,7 +820,7 @@ config PATA_PLATFORM config PATA_OF_PLATFORM tristate "OpenFirmware platform device PATA support" - depends on PATA_PLATFORM && PPC_OF + depends on PATA_PLATFORM && OF help This option enables support for generic directly connected ATA devices commonly found on embedded systems with OpenFirmware diff --git a/drivers/ata/pata_of_platform.c b/drivers/ata/pata_of_platform.c index f305400..ac7c9f7 100644 --- a/drivers/ata/pata_of_platform.c +++ b/drivers/ata/pata_of_platform.c @@ -11,6 +11,9 @@ #include #include +#include +#include +#include #include #include @@ -21,10 +24,9 @@ static int __devinit pata_of_platform_probe(struct platform_device *ofdev) struct resource io_res; struct resource ctl_res; struct resource irq_res; - unsigned int reg_shift = 0; - int pio_mode = 0; + u32 reg_shift = 0; + u32 pio_mode = 0; int pio_mask; - const u32 *prop; ret = of_address_to_resource(dn, 0, &io_res); if (ret) { @@ -55,13 +57,9 @@ static int __devinit pata_of_platform_probe(struct platform_device *ofdev) else irq_res.flags = 0; - prop = of_get_property(dn, "reg-shift", NULL); - if (prop) - reg_shift = *prop; + of_property_read_u32(dn, "reg-shift", ®_shift); - prop = of_get_property(dn, "pio-mode", NULL); - if (prop) { - pio_mode = *prop; + if (of_property_read_u32(dn, "pio-mode", &pio_mode)) { if (pio_mode > 6) { dev_err(&ofdev->dev, "invalid pio-mode\n"); return -EINVAL;