From patchwork Tue Apr 17 10:29:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10344747 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 E152E60216 for ; Tue, 17 Apr 2018 10:33:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E26AF28A2C for ; Tue, 17 Apr 2018 10:33:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D747D28A48; Tue, 17 Apr 2018 10:33:56 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI 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 427CC28A2C for ; Tue, 17 Apr 2018 10:33:56 +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=glRc4EjvrSoO9RxbnqEFPoGyfCdBvUAAFOIop3a+IDs=; b=F3e5oneB5+IU/BIBEHSrtpG87v fnD37o7QDZSUNR5u8u+pBJ/w+VJi5hQfMhoT94aFQh+Fgv+myu+FLTvzEQ4nBstqRl/sJIdfrHerc 5QOUS6e1sTkZYy99+++RrkWKNJZmecyR8suWiak8tRjxT/C87jKqtLLFruGSuY3bE1+KiPzHY/tdb UwLACiBAeEFxW+jDZ63jrzbZtg9Bl9WB2mAu9ZMMdjAV8pboiTLpqph69N7QSfuWxBP+lqxkMXFR6 PRqfym2JWAAV9S82wUz+v15TM8t+rxUKbDvd/6pO9CG2HGnjR3gXrGxWhzsoVw5eIT7WTB+CdiKDg l7ODCK7g==; 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 1f8Nvj-0000tg-5h; Tue, 17 Apr 2018 10:33:43 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f8Nrs-0002ac-Oz for linux-arm-kernel@bombadil.infradead.org; Tue, 17 Apr 2018 10:29:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=WqRXfHyKnstdjnry5+I9vhS35j0A2a3YqpankIg7bpg=; b=eOXIY5HTWeB7jV+SnJYi0JBDc hgATlR32GmYXPkicywafNj7OsOhJpLFQyF35iMWAa3+BmXynJePUyRO9QJOUrjI/cBvE3nYUaMCzy ZUJUW0sZsA3XkXEMuzzQs2wyM2FaxuD7zGDBWwADd144DaBllrWjd2/9tGDdWHSXA0idTLUQHd9Kh msUnnPqGheRRiZyCxIFdt+vvLw0OgrloIQq6MP3KxvwH1GpjfU6/DBTcdGehAeTCVY+0tphxCs6Cs 1blmRlnitwlasDFXREgRTwpMnFXgUDo746WborBJmiDZb5VYx6RmyVQZN73+apyAZotDxWfpKtqwB dXhmVhHwg==; Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f8Nrp-0000RC-WF for linux-arm-kernel@lists.infradead.org; Tue, 17 Apr 2018 10:29:42 +0000 Received: by mail-wr0-x242.google.com with SMTP id q13so30594347wre.3 for ; Tue, 17 Apr 2018 03:29:31 -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=WqRXfHyKnstdjnry5+I9vhS35j0A2a3YqpankIg7bpg=; b=GMHPjULck8yx9PkT+LgI7ZlRqaqrxciSMqehfip5ynwDfU8pBUli6mX2ItnP9V8zkW 7BrgI0ijel7GzRG9+BePinKRDeB8PtigtI/qT8KBzyaECoMm5+unfJgixtdbC3CWTTA6 NV4Xw8Ol9NHs/Qc/iHCFCF3ceR2tqu+nJGUdckigsQ14bFN4ZfTn0cxEg5oqBit1OUDu KPynueBvkpulnvMLPVcIrgR7CjGijPlDNQakng+isxmk5MY5BDhwtLodMplR+DB7iIya 14JWZ6YtNVrP1z4LFFOHaMZbjEVvixu0DfVucyh50rhSSn/ya+w+c0umWzLAy1iJcQDr SLSw== 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=WqRXfHyKnstdjnry5+I9vhS35j0A2a3YqpankIg7bpg=; b=kHrMgvM6qFwUtWZ5cHx3i89+YAa2SAXdtUCRQM8RR9IH7ZIdaekEUo5w7YIoOrGHEZ UTMk41aCv6RdFTktxVJHwWK5mkZEmF00yDhYbi6c1XmBDeL81R7nNACMOVUJstZ5m0jF Ui4fKGtdqEcewFiOe4KHLEVZeSF6TSn8Iw5CpzGdYCJBR1w0ME4F+DQEsmTVP6X+JsTq CGxQGF+h/sFpc+eRzrqnbqSPhjolmWmofG/m729x/oFYppWkVTO6k2QIXsTp8gUxnwW4 OA31irItMrbQeqmj1QU3p1I+DFpsgiFHBovI3iCycMN1qSfQBWq4VTiOL6YavJBfAgKB +dkg== X-Gm-Message-State: ALQs6tBGdgwRUM1Kx6yY5H2hWKnuM2mphXE3s454THeEOFYzs2DRqQAD /Ri+7vMNVCltkH0HYchWyG86cw== X-Google-Smtp-Source: AIpwx4+ikdOlWbgokx2kvzZVsyYzyyEXkM/cKnvIwmhY3mv/jTg8cyz9PrSJP2ov6ZwojhJ/AK8JlA== X-Received: by 10.223.227.73 with SMTP id n9mr1185043wrj.134.1523960969607; Tue, 17 Apr 2018 03:29:29 -0700 (PDT) Received: from brgl-bgdev.home ([2a01:cb1d:af:5b00:e837:b8d5:48c1:571b]) by smtp.gmail.com with ESMTPSA id r75sm8842252wmf.34.2018.04.17.03.29.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Apr 2018 03:29:29 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Santosh Shilimkar Subject: [RESEND PATCH v2 4/4] ARM: davinci: use aemif platform driver in legacy mode for da850-evm Date: Tue, 17 Apr 2018 12:29:17 +0200 Message-Id: <20180417102917.7794-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180417102917.7794-1-brgl@bgdev.pl> References: <20180417102917.7794-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180417_062942_101061_643A1F88 X-CRM114-Status: GOOD ( 20.92 ) 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); } }