From patchwork Thu Nov 27 23:12:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 5400141 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 05C729F319 for ; Thu, 27 Nov 2014 23:14:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 832272012E for ; Thu, 27 Nov 2014 23:14:45 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 97C85200F4 for ; Thu, 27 Nov 2014 23:14:44 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xu8FC-0003cm-NF; Thu, 27 Nov 2014 23:13:02 +0000 Received: from mout.kundenserver.de ([212.227.126.187]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Xu8F8-0003Ui-64 for linux-arm-kernel@lists.infradead.org; Thu, 27 Nov 2014 23:12:59 +0000 Received: from wuerfel.localnet (HSI-KBW-149-172-15-242.hsi13.kabel-badenwuerttemberg.de [149.172.15.242]) by mrelayeu.kundenserver.de (node=mreue007) with ESMTP (Nemesis) id 0LplfX-1YMsPN0G9f-00flsM; Fri, 28 Nov 2014 00:12:26 +0100 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 00/11] ARM: at91: remove !DT support for at91rm9200 Date: Fri, 28 Nov 2014 00:12:25 +0100 Message-ID: <3935244.Dm2HkZj2Bg@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <20141127171243.GL4508@piout.net> References: <3550407.q87bWB4Jdt@wuerfel> <20141127171243.GL4508@piout.net> MIME-Version: 1.0 X-Provags-ID: V02:K0:BxbU4ZRvKd1aV5hbzZDdwG8ai9K3+A0cZ7M1Wvt1KNh L47ewH+apncbtoRRASZgU0HP/7D/BmsnOdwYpihgzAAn0FZTlu gVqLkJmwU+x/iEyZZ4LjTHws9oJk66YUXuy55zWP57+ijBIXt4 LLd3Vo3j6MzquyfucQZqXBIMkOZGGh9moRxkpjCfipskhPfX4q 4195TPGQM47QH3fQDWc0v9F9wt6Ev4jhx/7b7N+dHoy2/12ile soZN19JXsqNR4D1jN2nYgA6jsz60I35za1Dct8OmgPiHa1OOig hnzzR0M5yIpysQeWZ7TQC3cDv1R9KWjRMsxP9AdSNa5u48Gkfo f0IgMVETEc+kfQhpJUZU= X-UI-Out-Filterresults: notjunk:1; X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141127_151258_644051_08284C24 X-CRM114-Status: GOOD ( 21.33 ) X-Spam-Score: -0.0 (/) Cc: Boris BREZILLON , Nicolas Ferre , linux-kernel@vger.kernel.org, Ludovic Desroches , Alexandre Belloni , Jean-Christophe PLAGNIOL-VILLARD X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Thursday 27 November 2014 18:12:43 Alexandre Belloni wrote: > > As discussed some weeks ago, I prepared patches to switch sama5d[3-4] to > multiplatform. We are still missing the SMC and matrix drivers to switch > sam9 and rm9200. I just looked at the drivers because I got curious, and to see if there are still any low-hanging fruit, but I guess you already picked them all ;-) > The currently affected drivers are: > - drivers/ata/pata_at91.c (SMC) > - drivers/pcmcia/at91_cf.c (SMC) I guess the SMC should live in drivers/memory with an interface similar to mvebu-devbus.c? Seems doable but nontrivial. > - drivers/usb/gadget/udc/at91_udc.c (Matrix, this is the only one > for sam9) Is at91_matrix a pin controller? With the board files removed, the udc driver has the only two remaining calls to at91_matrix_{read,write} for setting the pullup, so that could be modeled as a trivial pinctrl driver > - sound/atmel/ac97c.c (that one is still not converted to DT anyway...) This one seems fairly straightforward to do, including a DT binding, but the result is still ugly as it supports the at32 chips that do things very differently. The patch below gets it to compile and should be enough as a replacement once a compatible string gets added. > - drivers/watchdog/at91rm9200_wdt.c (WIP, will be converted properly to > an MFD) I think we discussed this one before. Remind me why we can't just convert it to use watchdog_register() for simplification and then move whatever remains into the arch/arm/mach-at91/at91rm9200_time.c file, or both into drivers/clocksource. Arnd 8<---- ASoC: atmel/ac97c: remove platform_data dependency As at91 gets changed to multiplatform, we can't use the mach/cpu.h header any more, but this is ok as it only gets used to check for cpu_is_at32ap7000(), which arch/avr32. In order to make the driver work without platform_data, this also changes the reset gpio line handling so it can look up the gpio descriptor from DT. It is still missing a compatible string and a binding that describes the valid DT properties. Signed-off-by: Arnd Bergmann diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c index b59427d5a697..4eec216b7f92 100644 --- a/sound/atmel/ac97c.c +++ b/sound/atmel/ac97c.c @@ -34,10 +34,10 @@ #include #include +#ifdef CONFIG_AVR32 #include - -#ifdef CONFIG_ARCH_AT91 -#include +#else +#define cpu_is_at32ap7000() (0) #endif #include "ac97c.h" @@ -78,7 +78,7 @@ struct atmel_ac97c { void __iomem *regs; int irq; int opened; - int reset_pin; + struct gpio_desc *reset_pin; }; #define get_chip(card) ((struct atmel_ac97c *)(card)->private_data) @@ -890,11 +890,11 @@ static void atmel_ac97c_reset(struct atmel_ac97c *chip) ac97c_writel(chip, CAMR, 0); ac97c_writel(chip, COMR, 0); - if (gpio_is_valid(chip->reset_pin)) { - gpio_set_value(chip->reset_pin, 0); + if (chip->reset_pin) { + gpiod_set_value(chip->reset_pin, 0); /* AC97 v2.2 specifications says minimum 1 us. */ udelay(2); - gpio_set_value(chip->reset_pin, 1); + gpiod_set_value(chip->reset_pin, 1); } else { ac97c_writel(chip, MR, AC97C_MR_WRST | AC97C_MR_ENA); udelay(2); @@ -923,7 +923,7 @@ static int atmel_ac97c_probe(struct platform_device *pdev) } pdata = pdev->dev.platform_data; - if (!pdata) { + if (cpu_is_at32ap7000() && !pdata) { dev_dbg(&pdev->dev, "no platform data\n"); return -ENXIO; } @@ -980,16 +980,18 @@ static int atmel_ac97c_probe(struct platform_device *pdev) goto err_ioremap; } - if (gpio_is_valid(pdata->reset_pin)) { - if (gpio_request(pdata->reset_pin, "reset_pin")) { + if (pdata && gpio_is_valid(pdata->reset_pin)) { + if (devm_gpio_request(&pdev->dev, pdata->reset_pin, "reset")) { dev_dbg(&pdev->dev, "reset pin not available\n"); - chip->reset_pin = -ENODEV; + chip->reset_pin = NULL; } else { gpio_direction_output(pdata->reset_pin, 1); - chip->reset_pin = pdata->reset_pin; + chip->reset_pin = gpio_to_desc(pdata->reset_pin); } } else { - chip->reset_pin = -EINVAL; + chip->reset_pin = devm_gpiod_get(&pdev->dev, "reset", 0); + if (IS_ERR(chip->reset_pin)) + chip->reset_pin = NULL; } atmel_ac97c_reset(chip); @@ -1113,9 +1115,6 @@ err_dma: chip->dma.tx_chan = NULL; } err_ac97_bus: - if (gpio_is_valid(chip->reset_pin)) - gpio_free(chip->reset_pin); - iounmap(chip->regs); err_ioremap: free_irq(irq, chip); @@ -1170,9 +1169,6 @@ static int atmel_ac97c_remove(struct platform_device *pdev) struct snd_card *card = platform_get_drvdata(pdev); struct atmel_ac97c *chip = get_chip(card); - if (gpio_is_valid(chip->reset_pin)) - gpio_free(chip->reset_pin); - ac97c_writel(chip, CAMR, 0); ac97c_writel(chip, COMR, 0); ac97c_writel(chip, MR, 0);