Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp7787690imm; Thu, 28 Jun 2018 09:16:43 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd5EVltoeR8IjmyR+r3zUNJ0lHhoPJIS0FIJC0fD7ABHDhKtc8XUYH29eA7u1qixsOJIXGr X-Received: by 2002:a62:8a0a:: with SMTP id y10-v6mr10802408pfd.237.1530202603204; Thu, 28 Jun 2018 09:16:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530202603; cv=none; d=google.com; s=arc-20160816; b=GmL233SQVX1GWtOHYJT62kP8jraIsmgWzERh21ycN/cZLrzOZSV4V97LVPV+vMvaIF cgmbY0F2M3TCVClVuy1eWL+t8Gl8ByBl+yHLpsErnkOTQ7BkkYuSBxzyV9pNrY19VPno WMDFN2NtCFHcfMcPPqr4M0MSOYA8VdZpN0GLfHcO41ZVANsH0NxKpb75crzEgo6MiiBa +A6f26mQ3mq3SBAgjd/tmc2+r8W8pTLY43F2hpnaIQjewuAgK2Efwr3oxZ9mE5rhMQF8 vQgM6ZMv3IJI1VABRkRCmWas2yaBU5CMSywGFyKuobTFj4RIKqS970L8aNiSITmLTl/M SQ/w== 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=ieOVdXFuQ0Ypy4nZNCf8F3f8W2dBU0wy10Az+EpEPN0jEKSeS0SUEXEPSwcKomQMIE IbkjRxmoHTwRFfxbCHWQa6K3Msw5GEBBZlMUJ6XM9Xb8NOC/BQ5seeXORCY+QuTKf9s3 c11Q4Y6W08pPQWkjiQQljmFwKppPkqbxr15PloxJehjaf17EBKP8nnS4dFySx80heSus A7lIzifNAd+tfj2cNaEHY2b+Hhgw0jeaIBu5YiUsEDvs1R4WrOEojOUB6QDK391BafxA gew6trYwk23GV5bHwa2GWNIpnx7xxxj0xp3H4uv0DJcbqmwchH0bM6PYXGlzPxJc9WLJ m9+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=r7WYSUzG; 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 c14-v6si7795082pfl.319.2018.06.28.09.15.50; Thu, 28 Jun 2018 09:16:43 -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=r7WYSUzG; 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 S965203AbeF1J7r (ORCPT + 99 others); Thu, 28 Jun 2018 05:59:47 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:46793 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935224AbeF1J6E (ORCPT ); Thu, 28 Jun 2018 05:58:04 -0400 Received: by mail-wr0-f196.google.com with SMTP id t6-v6so4838619wrq.13 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=GbPzRPk74JhRwtLmGafA6TuXTHBIDgS7i818RVJG4/IfIy8IT/3QzTTIKCAS9KO7y5 eDHfMwKSnkzx+PnT/M70/JgbPWDilV2aEzCqJE33YS2RkHcAszyk8CqC3iQRIqyqfdn9 gUQ4iumbdUWUbm6kgupOImOMIh6Dm6hhVxPAtFgcBWvSxAN2KUkZuqmoKe38ct6Mwl+c 4/m557/Oqf+dIWmzqmzAHVxFHPuMbRq5ZisM0K8y2uJqCAk2FO2o4HYybNkOZqfCFcci YTktleBRgRepC3cgPkr0GsRAHd5YZYy5mBQ+BeKRUoiBesY0iitIa7C6gTEQeMaETr+s susQ== X-Gm-Message-State: APt69E1UehahYLTjU+3MgBEj3/n0RHiWdbNYKMPMZNep9TYHxUXTgKDd 0MVmevDGlcuxn5jS3JFgpg8VAQ== 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 Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, Bartosz Golaszewski 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> 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