From patchwork Fri Feb 16 16:47:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10225109 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4DC03602CB for ; Fri, 16 Feb 2018 16:57:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3BEE328ED2 for ; Fri, 16 Feb 2018 16:57:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3005E290F1; Fri, 16 Feb 2018 16:57:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A30C328ED2 for ; Fri, 16 Feb 2018 16:57:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=LTaoU/Yqve8fpk5ILi3OiHWvdfQUO4KvCKvs2DoazWw=; b=Kej7aefcIS8cJI9kjY8U6Zt9AV Nqw2K6raZntcEt8c/RZQ8TJFVJpkIf+1b/aE0wCv8ZfK8jPa+LVXUx2lxka562knBMVPlBTK7H+dQ btdph5OOqbvKlpxc1B2P1vT7brR5KYvzL96US9y6WHGNwV2kZlodimq6xzyAtOw45pw6UkSxmytxt hOKHHPUvLVoxgUd6YLVAX0ERrvE/kfudXfj1j6EqXPxXbTPuE5x+eCsBwuyo3mJP7dzaqtvTDLaK2 xD1FF8LYNGWOOtVG4M+dTd9hyrFsw38yi7YsuMY0l3Aw0cWqOJT9cph80GvKX9bJR2sCsQgWJ2JOb Pa4cPFZw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1emjK7-0007Yo-SR; Fri, 16 Feb 2018 16:57:23 +0000 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1emjAg-0007PZ-U8 for linux-arm-kernel@lists.infradead.org; Fri, 16 Feb 2018 16:48:02 +0000 Received: by mail-wr0-x242.google.com with SMTP id f8so3515558wrh.8 for ; Fri, 16 Feb 2018 08:47:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=soKgHlCcVLN8p2YAQ3OJgn4j9l7sS8uxEi2h0crl60U=; b=K5S+oirzAUF2I5PSi2G4U3elaeMVGd/JWMX7OG6+Mkul56B50OmnE6B6TbgYu3nMee Ivtl1Iw2ZQkQ2q1esfVMUgES82M58duTVjs1FquSFgjbTK7TwvXZs7YpllB+WBjyJnYH nAltPtw1Lg+RHjvTEbIfr5vX8hi1P6F8GABB/9p2qtLGjKmNeFb25lG8AlMpdoq13ToF TlJjphleX3vDomFQP27LuzdO962CJnLAWv/wIQbWQkn2ix8hFevv1gNW8X3+HhNuLpF7 uPZfppLB1ZUSjludp9ZSyRv273QfQZB8USIrklWLpPVVcf67H1FgCwoOJAf8b05dIacf HoZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=soKgHlCcVLN8p2YAQ3OJgn4j9l7sS8uxEi2h0crl60U=; b=cMloi9wQDjbvhXS6nOsbsGN5EmGzUgPcxDlGkWvdjEzj2rIoU4FqLi02QVLJ55Bi6+ mSCrq/ZeTXNpXUr7/piu6W+TGgacaS/PpNkUKQe3P8p4ye6+9KqzT/hy6HzPCgCOPr08 ZxtVmIuKIWSiU1cCXm0DJ5y1GVyEAjCv8Bkqa/C9b4bovUtpNpW8JrRWQ2tInGoUndoB cqRkDNYQeBHg7hJgUum+08SQQCasMWHp5gc4RRH5j9qIwhFCynsPJROvNn42H5ZkKspa 8+b+PSc+ttoT/CRQtqyB6aDSu3zSUXoC/HUcPym6q7fsIouAk9nPLByy0JfbNB+6C6hK eo5w== X-Gm-Message-State: APf1xPBrbSSYP7VgUmU0sda6XcoMav+CoOALBLFj2NND50WtFiCe3Hh0 OM8Iju943Z8IB5YEUKCFTMFYVw== X-Google-Smtp-Source: AH8x224UDuZvtkPKRf4TdYBhr8VsAUFi2fGgsnbvSpu5OqP+tZ8kOP8HSKw8vnw5jMou6duLvvrrRA== X-Received: by 10.223.187.20 with SMTP id r20mr6376598wrg.93.1518799646907; Fri, 16 Feb 2018 08:47:26 -0800 (PST) Received: from brgl-bgdev.baylibre.local ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id 90sm7832826wrp.2.2018.02.16.08.47.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Feb 2018 08:47:26 -0800 (PST) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Santosh Shilimkar , Boris Brezillon , Richard Weinberger , David Woodhouse , Brian Norris , Marek Vasut , Cyrille Pitchen Subject: [PATCH 6/6] ARM: davinci: use aemif platform driver in legacy mode for da850-evm Date: Fri, 16 Feb 2018 17:47:12 +0100 Message-Id: <20180216164712.25898-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180216164712.25898-1-brgl@bgdev.pl> References: <20180216164712.25898-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180216_084739_130775_D66DAD23 X-CRM114-Status: GOOD ( 17.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, David Lechner MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We now support board files in aemif. Use the platform driver instead of the handcrafted API in da850-evm. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/board-da850-evm.c | 93 ++++++++++++++++++--------------- 1 file changed, 51 insertions(+), 42 deletions(-) diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c index 828194045a2b..88e1d00a1f56 100644 --- a/arch/arm/mach-davinci/board-da850-evm.c +++ b/arch/arm/mach-davinci/board-da850-evm.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -185,16 +186,6 @@ static struct resource da850_evm_norflash_resource[] = { }, }; -static struct platform_device da850_evm_norflash_device = { - .name = "physmap-flash", - .id = 0, - .dev = { - .platform_data = &da850_evm_norflash_data, - }, - .num_resources = 1, - .resource = da850_evm_norflash_resource, -}; - /* DA850/OMAP-L138 EVM includes a 512 MByte large-page NAND flash * (128K blocks). It may be used instead of the (default) SPI flash * to boot, using TI's tools to install the secondary boot loader @@ -265,37 +256,58 @@ static struct resource da850_evm_nandflash_resource[] = { }, }; -static struct platform_device da850_evm_nandflash_device = { - .name = "davinci-nand", - .id = 1, - .dev = { - .platform_data = &da850_evm_nandflash_data, - }, - .num_resources = ARRAY_SIZE(da850_evm_nandflash_resource), - .resource = da850_evm_nandflash_resource, +static struct resource da850_evm_aemif_resource[] = { + { + .start = DA8XX_AEMIF_CTL_BASE, + .end = DA8XX_AEMIF_CTL_BASE + SZ_32K, + .flags = IORESOURCE_MEM, + } }; -static struct platform_device *da850_evm_devices[] = { - &da850_evm_nandflash_device, - &da850_evm_norflash_device, +static struct aemif_abus_data da850_evm_aemif_abus_data[] = { + { + .cs = 3, + } }; -#define DA8XX_AEMIF_CE2CFG_OFFSET 0x10 -#define DA8XX_AEMIF_ASIZE_16BIT 0x1 - -static void __init da850_evm_init_nor(void) -{ - void __iomem *aemif_addr; - - aemif_addr = ioremap(DA8XX_AEMIF_CTL_BASE, SZ_32K); +static struct platform_device da850_evm_aemif_devices[] = { + { + .name = "davinci-nand", + .id = 1, + .dev = { + .platform_data = &da850_evm_nandflash_data, + }, + .num_resources = ARRAY_SIZE(da850_evm_nandflash_resource), + .resource = da850_evm_nandflash_resource, + }, + { + .name = "physmap-flash", + .id = 0, + .dev = { + .platform_data = &da850_evm_norflash_data, + }, + .num_resources = 1, + .resource = da850_evm_norflash_resource, + } +}; - /* Configure data bus width of CS2 to 16 bit */ - writel(readl(aemif_addr + DA8XX_AEMIF_CE2CFG_OFFSET) | - DA8XX_AEMIF_ASIZE_16BIT, - aemif_addr + DA8XX_AEMIF_CE2CFG_OFFSET); +static struct aemif_platform_data da850_evm_aemif_pdata = { + .cs_offset = 2, + .abus_data = da850_evm_aemif_abus_data, + .num_abus_data = ARRAY_SIZE(da850_evm_aemif_abus_data), + .sub_devices = da850_evm_aemif_devices, + .num_sub_devices = ARRAY_SIZE(da850_evm_aemif_devices), +}; - iounmap(aemif_addr); -} +static struct platform_device da850_evm_aemif_device = { + .name = "ti-aemif", + .dev = { + .platform_data = &da850_evm_aemif_pdata, + }, + .resource = da850_evm_aemif_resource, + .num_resources = ARRAY_SIZE(da850_evm_aemif_resource), + .id = -1, +}; static const short da850_evm_nand_pins[] = { DA850_EMA_D_0, DA850_EMA_D_1, DA850_EMA_D_2, DA850_EMA_D_3, @@ -338,13 +350,10 @@ static inline void da850_evm_setup_nor_nand(void) pr_warn("%s: NOR mux setup failed: %d\n", __func__, ret); - da850_evm_init_nor(); - - platform_add_devices(da850_evm_devices, - ARRAY_SIZE(da850_evm_devices)); - - if (davinci_aemif_setup(&da850_evm_nandflash_device)) - pr_warn("%s: Cannot configure AEMIF.\n", __func__); + ret = platform_device_register(&da850_evm_aemif_device); + if (ret) + pr_warn("%s: registering aemif failed: %d\n", + __func__, ret); } }