From patchwork Thu Jun 28 09:57:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10493481 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 67BD460230 for ; Thu, 28 Jun 2018 10:03:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 50D0A2996C for ; Thu, 28 Jun 2018 10:03:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 44E8A29975; Thu, 28 Jun 2018 10:03:51 +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 AD36E2996C for ; Thu, 28 Jun 2018 10:03:50 +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=u/11mBS1oMMgdv/XN++5bPlnKTIqhkoBnxRhsJtdB8M=; b=F96Ar8VpoAazhXhR3wFWIbHLFO km2mKs8wzMqJM4byqAvReGEVjnC++rPlTBwot4OfqqEfTn3mzu8fa+QwETVs1Sj9hgyqMA8blOF5U REUHhBAw6CtsTowdNEhRzL/Mpnka2gu3lEbmCJ2jwpnMNNYkrCVB6ecZt2QeIXJNXU6opGwZzzTAX lqfBHcFhPaGAsbWPpg0iCHs5nchK9c4PSNsnDZiHv5wiloQmeTv8Ush7MyjUVAMf4QVdPDgbsShWH POT8m8NerzoiBtWBB7+OalhfjGKgqQ2yI+Nwic9dTRzN39UFugLbOWC5mY8jJcZEzoDfyIpLD9Fwt YGDmwAbA==; 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 1fYTm7-00015O-Jn; Thu, 28 Jun 2018 10:03:39 +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 1fYTgt-000555-82 for linux-arm-kernel@lists.infradead.org; Thu, 28 Jun 2018 09:58:24 +0000 Received: by mail-wr0-x241.google.com with SMTP id b8-v6so4853835wro.6 for ; Thu, 28 Jun 2018 02:58:04 -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=r7WYSUzGcq7/MP5C4xc6YSD5QdcxhW2yAPFKkY64HOQbyXraMm23s8Lx+U8McdkeGq 4p5Oi3kGGVq9U0JO0Co3j/dVolRKfOA12pmcOUI+ppHcKYyvcb7WGG1wNMuuPxnD25Dy pSiBFxvG2YKnME0fNqOH6K25IbeKatitiqYJhCjVl16m+IhXoITX9s19XRiLyh8cpfFW KLQQuxrfOg5Nw1/RQaMMAk9P15TCMlLd6zd+HkMGxTB0u4m5tiZhi9Y+Du42Q2NWanv6 IN2bsAdGFz/BJENYgEo/mQHuUL3RJ2QPQgD4he5PjEdiSmCR+cP8vAfhPCHuYzob5kAV zAHQ== 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=P12w8cu1jvJyzQC6F1HbBe7ZeBcGaTqNjvG7HNHI5DCXWvCay5fTPvhvC1QQ1r5+/R DLK13eps6cEqZgpZOLXSBBSjrwUt43yAV4nGEAthCAKot9M3BbjMmTqd0erhabiRG4WE JpPEwSe8Nie+hVEWsPZGmyJmUuCuX6TLCG6nTqzpkIDKEaNEvqtBx0uEvGfTPDT8j88+ mIXvfS/aKrX2juCQwDYUNZOtpl+Jd9E7XDJJBjpAa7kBLXQWSwRikpI52iNyxPUALPQk uzvSppuIvaCJy/GAyv0t/86Cd17OPGL8CL8Ya1Nl1fU6DfK/9XrjOiSQ7nMwfXqL2wlX 0dHA== X-Gm-Message-State: APt69E20Y0eM0vi2y5FrMVba5rYNqSrqI/TfSE9m6WVQ7mZ8Ce8m/8D3 vP3jX7GHRPOOSx8GUr2UmqScTw== X-Google-Smtp-Source: AAOMgpcRjqKXfqSGRyN5o/x87AFjGuWCK+V6kjD9BDr16+2zftA//qviaAwz1nW2ZvHQXoQ1QY77Wg== X-Received: by 2002:a5d:4b0a:: with SMTP id v10-v6mr2271290wrq.87.1530179883476; Thu, 28 Jun 2018 02:58:03 -0700 (PDT) Received: from brgl-bgdev.baylibre.local (AStLambert-681-1-87-41.w90-86.abo.wanadoo.fr. [90.86.29.41]) by smtp.gmail.com with ESMTPSA id s8-v6sm1550352wrm.84.2018.06.28.02.58.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jun 2018 02:58:02 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , David Lechner , Michael Turquette , Stephen Boyd Subject: [PATCH v3 07/13] ARM: davinci: da850-evm: use aemif platform driver in legacy mode Date: Thu, 28 Jun 2018 11:57:42 +0200 Message-Id: <20180628095748.4462-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180628095748.4462-1-brgl@bgdev.pl> References: <20180628095748.4462-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180628_025815_703822_49185320 X-CRM114-Status: GOOD ( 16.62 ) 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, linux-clk@vger.kernel.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 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); } }