Received: by 10.223.185.116 with SMTP id b49csp1040995wrg; Fri, 16 Feb 2018 11:18:53 -0800 (PST) X-Google-Smtp-Source: AH8x226S13UKjKSmXGxqWfIjtA6FdIPi54uCqRwSBVQcxbXMuFL6LMOEh6RQ9gWgz4h7gKB1Doi2 X-Received: by 10.98.135.204 with SMTP id i195mr7013164pfe.41.1518808733019; Fri, 16 Feb 2018 11:18:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518808732; cv=none; d=google.com; s=arc-20160816; b=kY/w8yvtm3TUA15+yB9ISVZjNaup77TGPEId2bw043wmK2aTORLlyKx8HHTUySjx4y 0IEX5LLYIRi4ni9FQ6RHhDUWRkH1GzP/mhQ7HzdaoMFGGDSNQ1seZiMFsd8JHn9EwQ60 Ekjp8/b6KT123SaRRQW6mYdqW7If+lyFQ4RlnyMB18fguHSqbWBN5UB3JXaL8pRk53my mgwzS9gePwT1IxSXQTtST+Z3otvndU2v1mxucwE6FdX8bBkJZxLqWwAXTyVHPG3rafJG rUBt/aX4JL6B3GtRkM1QhTp1kkeuwQmB3hT5vqqLMu0NxXCVioY6/JodC6AA8GrNIjN6 4aNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=soKgHlCcVLN8p2YAQ3OJgn4j9l7sS8uxEi2h0crl60U=; b=hBc/WhTH+rm2A+xh2ho/Jvhoe5Gv1Mow/T0Rjgt9d5qRbP++hqxQZUmKGbeq4rderE Ow0VUmPRjYwTYw0lMpEUAbhIM+n7V7JvxpGf3LIsYnNVk0fsDW9zVjAGbMR+0ZUO9frz 4hwx2EDojmbEuBuo7bJkS1AG9lU06WlH/KUSjGDWs5gdQDPzj+j32JPuihlpD1a7HVUO siElxpTBNawfg38T1tznZVDB/5FGV/SS5T/GpctHNP9/gtNez5Th9mRGl0Dv4BQD4B9n 6BVlIZPh0LMdOVw4VrB3KmF+Jjw3lLAIpWxSgXB2+znoJX4wqhclhAsU34stFACqW7QW oYag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=K5S+oirz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m5si4458850pgp.355.2018.02.16.11.18.38; Fri, 16 Feb 2018 11:18:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=K5S+oirz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161247AbeBPQsM (ORCPT + 99 others); Fri, 16 Feb 2018 11:48:12 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:44055 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161145AbeBPQr2 (ORCPT ); Fri, 16 Feb 2018 11:47:28 -0500 Received: by mail-wr0-f195.google.com with SMTP id v65so3497126wrc.11 for ; Fri, 16 Feb 2018 08:47:27 -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=R82MlHesFNtxjWqM6Ul5dDE1ukcDvJssH0R3TbXkiPhL0BMy5n0YXXrbeANhIZp2Ud JnxUEJ/uTzcb1Sm5AgY1I+EdyXJCnKYUz2XkrG3IFbMhvpYrxPBF1R+PvVIpjuNSOfMN d5/Q4SiwxiGCtgvo9V4jFlTvQQUSdrekL1fwee3SeCIgtOTqE+ygXZNR5zIyU9FvWJcr 93OMPFHgxj5qMEfkPCVm6IFwj8Y2FpV39Lh0lyslWwlyM3/ADXs4VduLv5htsxQD7RiN 5970uWOQn7KFa33mZJXWLS2wMoPpnQVj2Y5ltnrGnPo8TxdRjxxjwhWdk9qOBWG8aHlw /2Ow== X-Gm-Message-State: APf1xPDMDuCJqCTfzFnuxYZ3rbfT8yYwbVWZEMTPF8E1S3FapedK3Fs9 0ifqQZ3z7rJoIcVrUwgQjxGcEg== 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 Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org, David Lechner , Bartosz Golaszewski 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); } } -- 2.16.1