From patchwork Mon Mar 19 15:33:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10292581 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 D0B77602C2 for ; Mon, 19 Mar 2018 15:35:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB6EC291A5 for ; Mon, 19 Mar 2018 15:35:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE3B629486; Mon, 19 Mar 2018 15:35:17 +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 27FCC291A5 for ; Mon, 19 Mar 2018 15:35:17 +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=C4UW7VIKBoGcnVb790bEeCyA2aTObYQ1XC3vVRo+F1M=; b=emABzFFJrZZGEOCLIgwjor8Ign ZpFun9D2qkSgHSUlcjQoRI6wtwozio7G2DllYVwDfrCbqvTDTD4g3lK+ZOUkqc/McggOwmAvh2WEH Amf5mE21hElHuWqyxoVKwMCVD/gxUKc/a8fJYs8McJNso30J3u5FVDwvRDW6d3/pdwjtp5s4LVWKb gOa6XST2FvZdWGi5UqnY9zYKoa0wQ8WVBi0CjpsyH4Edf99oL5gsejvPN4e/ZE4vZicMecYOKJrAl EOuAGVkj+nrHjThNCBU8gvW8Sfwdf6nWdUhc1Y3IEFcjHDDm3DxswhMseJl2VhQtBWqO7queg9M6C UrONAzsg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1exwoZ-0003UM-W4; Mon, 19 Mar 2018 15:35:12 +0000 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1exwnD-0002Ve-MM for linux-arm-kernel@lists.infradead.org; Mon, 19 Mar 2018 15:33:54 +0000 Received: by mail-wr0-x241.google.com with SMTP id o8so19110451wra.1 for ; Mon, 19 Mar 2018 08:33:41 -0700 (PDT) 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=tUwkyhnq+FZruNDemzQxU7L0R1XCEkU9YKMr4T8gTeg=; b=jzsatIYGVXjLQTYW0/O+6WakdDfeSjxF2gbofzs26i4R7127qGsEhp/W3hKT0aUdQX uzJfmpSCU+c/zng1TaW+gK+GupPeN3eaPdOtT9ohLgp5xRM2Tgqj6IRCSz8P+tUV0CGY ldFyOntY0+FGhOps0trGjcyj9+rLofQ3H1qwgKTtPXCkAQtTbSgzVNpHprnXXWDRN+OP IME3v5to47zOOJb51QWL1i3xXqVAdvcbsdju8fojnuAvFdIuFUgpedR10QSIqCtGqHE+ 1UW6RTAag4eMbx1aDzfrHDYBHZGv+cWhwKEMCH5CYaVjtw93LtS4IxvTlgBU3m3OOgRW QQgQ== 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=tUwkyhnq+FZruNDemzQxU7L0R1XCEkU9YKMr4T8gTeg=; b=NVbSvS58xqWItJZX7l/QuiT4Tm6xtJU+niA1icwiZZ4osj+CoyVoyxZRNAiN4APleb i1vYriewiFLOiToHvSLWroifqjJEtfl6LQSyC+7gy8Vruu8Wd5MrZCgTdhFt4oFWJ1yU ROX8QBYJMZXghgK8rkzJ7GAP1HCg+1PFf0+b0bGnDffrhq0l8/g9jm8eiFUaoYdYgmdn KPaGyv5fiD8xpBIgwPtfTGrrMfOl84vu1VTktGU6urRD7YdWvIcuNCS87cpZXMLgo1hK eT4WztUZW0l/MKOyiMllJW/wRWfNL7W5NACENq37D5vxOuNuvRQ7WyyAaYEmRW+i+iYe 4EIw== X-Gm-Message-State: AElRT7HlSEcTZM3SfAwG5TCG1AKkFWhd8H4MINS4GI7rqVyRct7So7Zg NIGOlg/0URZ7GCtd5kE1bK/cQg== X-Google-Smtp-Source: AG47ELtSEHVS7uXIpezPSTCtCuPLqUBEWn9JkKcHAUsjw61jkTep08GfNUZawaeqo2gvXTcCpwxHtA== X-Received: by 10.223.139.144 with SMTP id o16mr9576447wra.279.1521473620005; Mon, 19 Mar 2018 08:33:40 -0700 (PDT) Received: from brgl-bgdev.baylibre.local ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id w73sm695489wmw.42.2018.03.19.08.33.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Mar 2018 08:33:39 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Santosh Shilimkar Subject: [PATCH v2 4/4] ARM: davinci: use aemif platform driver in legacy mode for da850-evm Date: Mon, 19 Mar 2018 16:33:14 +0100 Message-Id: <20180319153314.26120-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180319153314.26120-1-brgl@bgdev.pl> References: <20180319153314.26120-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180319_083348_353400_C4753FF6 X-CRM114-Status: GOOD ( 17.61 ) 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-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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. Note: the id of davinci_nand is changed to 0 in order to make it work with the new common-clock framework based psc driver. 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 78a670aafea0..f1c2c8c8c4af 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 = 0, + .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); } }