From patchwork Tue Jun 26 09:25:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10488459 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 31296602D8 for ; Tue, 26 Jun 2018 09:27:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DCEA28856 for ; Tue, 26 Jun 2018 09:27:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 223F528868; Tue, 26 Jun 2018 09:27:18 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF68D28856 for ; Tue, 26 Jun 2018 09:27:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934579AbeFZJ0a (ORCPT ); Tue, 26 Jun 2018 05:26:30 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:38443 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933850AbeFZJZu (ORCPT ); Tue, 26 Jun 2018 05:25:50 -0400 Received: by mail-wr0-f194.google.com with SMTP id e18-v6so16475372wrs.5 for ; Tue, 26 Jun 2018 02:25:50 -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=Ys0pHhAz6lKrrz6odTeZF3ZKvLxJEqE7KZ9Ja4OaoXo=; b=k/awcZDPx7qmhpJdmpg40fzYE91rkJvR6CLCgPl6wVQ4H2aSGhoKKq6KPOmvbmPxd9 R7CnfeIo17vpC7+RYKgf++f459or/kdkHkQTycnwdYQSD54ZA65xikfa8DLP58iAjabA oDMwP4y54FuvBBwcus+fDstNc0s+MVCxDjZL/gaevYTB16zlkkwmklJ7GJCCP5P2a8jA Z/sEd6OrQrZGb+LvWZrgafO/E2s31KNv8MnXRXWIAXDp4aEiukvFcqcHDroJnoMYewAn sb0gjD0jC7KpeykF/OuBK1eygEZkLq0R1rEsiJSLLebqLOidQjkKgBPTS2Gfb3Lm9yWP 7rRg== 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=Ys0pHhAz6lKrrz6odTeZF3ZKvLxJEqE7KZ9Ja4OaoXo=; b=UmU3xZvZP3gKxYps+G1yG73iJfDlVStVeZ/jdCcHZNl+QOQ1Mz5AjdtL7OHIVB8wvh M3YqqojwgdkMFy2V3mgadnvetQ2MA0P7i64ix9Qe2ESMhMOiREnCBVexhvBuEM+9MJjb zimsnVRrqOQvNiF7o1juibEuJRTqSWD5WSXinqridJWuEBwWBb+XyuVCCWRIT700yey3 OKumLwzVQvw7IednjajplSKsV/x+Y7c9TkG4m+KR1ifQjckq93tWzaZokv1JAzhCgwsN 6cFXM9FBIKIotW+sVugmoczABvWOMCdUV11mfXuyvLio3nnhffKGYXy8Ux/2PY2ZKv2j sLXA== X-Gm-Message-State: APt69E3VW37zgMQwl1ZSlkeZa+yY2t57rq6RrMrnA7piJWyRn/1ycHrx rJK/hTG4Egp+KzwTmzIxK/ZSCw== X-Google-Smtp-Source: AAOMgpc69GQ/nXBv6JWZy/LYP8/VT31yMJP4vezQnwONHNqYJgc+qQf8wtc2UDAdTg3cPjztRNQOeQ== X-Received: by 2002:adf:ec02:: with SMTP id x2-v6mr697986wrn.245.1530005149601; Tue, 26 Jun 2018 02:25:49 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-NIC-1-55-10.w2-15.abo.wanadoo.fr. [2.15.147.10]) by smtp.gmail.com with ESMTPSA id a8-v6sm1528791wrn.50.2018.06.26.02.25.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Jun 2018 02:25:49 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , David Lechner , Michael Turquette , Stephen Boyd Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 07/13] ARM: davinci: da850-evm: use aemif platform driver in legacy mode Date: Tue, 26 Jun 2018 11:25:31 +0200 Message-Id: <20180626092537.6737-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180626092537.6737-1-brgl@bgdev.pl> References: <20180626092537.6737-1-brgl@bgdev.pl> Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We now support board files in the aemif driver. Register a platform device instead of using 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 442c16773f09..ace66f368f8d 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 @@ -266,37 +257,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", + .id = -1, + .dev = { + .platform_data = &da850_evm_aemif_pdata, + }, + .resource = da850_evm_aemif_resource, + .num_resources = ARRAY_SIZE(da850_evm_aemif_resource), +}; static const short da850_evm_nand_pins[] = { DA850_EMA_D_0, DA850_EMA_D_1, DA850_EMA_D_2, DA850_EMA_D_3, @@ -339,13 +351,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); } }