Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp4900492imm; Tue, 26 Jun 2018 02:28:16 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJsxkgt6K9/UTrOX5DUsj4h1QqnFnzaDfj9e/mUXJ7EO1Twwr2ndg61vLChhjtOJExGPiNU X-Received: by 2002:a17:902:7891:: with SMTP id q17-v6mr823044pll.186.1530005296161; Tue, 26 Jun 2018 02:28:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530005296; cv=none; d=google.com; s=arc-20160816; b=fZb592PTkQcqSi2rHGLLSLNryo4+QKafmyRHew0VUBYhLUEu46d8Gcj25a6bl1J/Kl FgkAI/qX41ymEPZZdsz9v3yXjAKdFBWhXUpRGUVmPj2M4aYhOPqMRshrf3+1UuoEk3Jt XZ1EH1A/92LQkdSmF8aqcFtNVXJYWm9jlmis/CgkOw5HSY1ZSw/9VwRhgndy9zxNORRH dvdE/E9+HzP1JuXIoDEk+7a6FOYYK7am9FI2ubBy3TYi7AVboUFC6wRpOLOTdIkEUsy4 jGQbtsBha+4+ELWwvK5paBM/aX9avBv68sjved5P/nDPqWHW/tBcQVevDJu/Qux51uUa e0dg== 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=Ys0pHhAz6lKrrz6odTeZF3ZKvLxJEqE7KZ9Ja4OaoXo=; b=kiLKyK3e4ohPtQV0KkomCse0McmNTvfi2NZdNN3fbXttSQtu1Jjkf1IzxHNdqFPpT3 +bbytkG8JhhZdZtvOKpa4GtK405bGVZD8eHykQ1OXVKenHab0ep9PY7O6OeZYVuA9qcG fcOd/mVqnai2YG03d6hLKOROXxWWeArCbKGeQCEB6rnluP8x5kXR40sTFuPztnnb+eKr t1iOnSYmYlqHODM1C6oey1WVnoP5+gbjcJOQTlwdiUw3vBQVkN+OYQK7og550mhuN7mw 25rtBrH9e8ltV5yTH8AGn1S+Q4eXCqbBjw6AGu85SViOKWha6NPj929lW3gR28Tj2bzy MASg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b="k/awcZDP"; 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 t22-v6si1206684plo.263.2018.06.26.02.28.01; Tue, 26 Jun 2018 02:28:16 -0700 (PDT) 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="k/awcZDP"; 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 S964813AbeFZJ0f (ORCPT + 99 others); Tue, 26 Jun 2018 05:26:35 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:33116 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933822AbeFZJZu (ORCPT ); Tue, 26 Jun 2018 05:25:50 -0400 Received: by mail-wr0-f194.google.com with SMTP id k16-v6so16486045wro.0 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=MP4k0EwVSIeLwq8Y6156mkxhRtsM7lCDdLTBTkt3geIxDSEyXqVaZ412XE510G6GDH eXI9npKO6dli7OxAf6pOSJBj52MdByoW2rA7llk+TE0hrP6UwD02tuHe1lx8WjGcV47z /vwgbJxOOGaSsr/VOesCIOnj1S7jwwbsHSK/UaG3t79o7ptb5r5XTTpjgVpHdJjdWfku jj/ExZl2IvXRstlfLzgSPiNkDqxNPJMY6i2xDsQA5Il1qb6v1DV6m5XPmpJ5GMjXU30d YgA3UC3TMWxn9d+wKNuHHbVvSMOmwoC6aDMBGqsYEQTDfrfxlnyvmyEl2NgJzhGpCZqF Faog== X-Gm-Message-State: APt69E2p6QgbC2Qi+ufV0exEy5K74NHdds400/gZ6WsjK9juicfsgtZO eE4JJC6QRo5eOzQerhSvJ5u5XQ== 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-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 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); } } -- 2.17.1