Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp4901945imm; Tue, 26 Jun 2018 02:30:09 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKPyTpldoT+pAkUpXUrlGRiHd/3Mk55ZMY9xkMBFVy+N6OjVh4xNQqJ9P6ShLTzkM2mYqyC X-Received: by 2002:a63:3201:: with SMTP id y1-v6mr665223pgy.419.1530005409517; Tue, 26 Jun 2018 02:30:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530005409; cv=none; d=google.com; s=arc-20160816; b=1DGVEfhVgxbTmuONS3uJ7zNVcoaq/yyR17Tj1Y9j2/LvdLm+dln7BAGHgnrEmbNNG3 lKnrsPPJCplE1mykICEnyDJbgBGdvqRxsppmlo09PbDyHkGX+LYX0B5h9wslE6JU+L1y 3OFV1FK4Yg75XrE+Iv7yrm/6v1p6oyTjo6GP/iqMIHHySD6NcePI9M9JrMh6UodRqK8u DcpcPYmS70Dryg7Xawvxu6CwrEvUqD+4syWzpdoI1x4I+KNDTwrTh4MUGa6o8LANKQu0 p8YLOGVj1y2/yGQf3H44ekCN30suZ8+Sbsgl4glDEx9FVzM/WtWk6riiXgZexJ0H0IG4 GABA== 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=GUfHyn6VK1PqeVsGt0SkIxjoM2BJY7WdUiFWdv18igw=; b=J8PTxAYV1+6tWdlSyxvwLPtyrT0ixlUla7LLDoDqmRBppuqWespguiGvu37eCxfbLv PicpcxAVafjCRTHdTVDMNni/NIV0NQXQJSURUyMPM8geHZwAE0xhx8YLHHUtwbOMN2zH xwW4fLwwBOc99QPaSYAMcZasl7Z7vTEQy1Zc/5RQ+sOGlNopwoPRl+TdOaU/eSupbiQA dzPdXL4S1TMVT9KfVPNcrtYCuTmHHr2l+RZL3U8CWzP1G9VXCB4BQ7gQyOYVrO7T7oIp IyXvAN3u4DFRRc+/OCNa9gyGDoa87ng+Duq1wWiVc7yRkICM/NQyblVqqIpg8HQJSCbl KGqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b="Gy/BGYMS"; 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 x8-v6si1213688plr.422.2018.06.26.02.29.55; Tue, 26 Jun 2018 02:30:09 -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="Gy/BGYMS"; 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 S933989AbeFZJ2A (ORCPT + 99 others); Tue, 26 Jun 2018 05:28:00 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:53845 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934379AbeFZJZt (ORCPT ); Tue, 26 Jun 2018 05:25:49 -0400 Received: by mail-wm0-f68.google.com with SMTP id x6-v6so1037140wmc.3 for ; Tue, 26 Jun 2018 02:25:49 -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=GUfHyn6VK1PqeVsGt0SkIxjoM2BJY7WdUiFWdv18igw=; b=Gy/BGYMSDpI/Mmofe6kQfwzE92tqDkLk/C/QS1MxeUtROqI6PypJYfI2F1HN14p2A0 cy6xN/4/ewbHemFIJBJ8tOd3qPGcmuqEP8WE2/5ziUvA+ZN9vETSoEPZ94PfJHtHHQFX Z6WYToL+P/tt2GmR1VdS98M9BAzegUZd01WpwbU0f89QHEIr8QWrp9Ea9l2mYqID34cy DgeEFwjBUjr1idlUFHbM/S8WlLRFpuNzi81XRp6TpRMt4JA8u7z2Cn/ReXT0UZjln34H HQsooMObdFgTNHYD+PCpbZsbf4mcQH/L8sPzoeEbuJnGIsNKEZ9QK/vhzS6GWGwxm8E3 LFbw== 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=GUfHyn6VK1PqeVsGt0SkIxjoM2BJY7WdUiFWdv18igw=; b=Ua+MtcrQOleCI9dz8oxP0D5kNSbCDReQ8LMPP2a41BT+Sh5RBd6woEPRg5IY2W2d4s EQodKUlc9RGJos57NtnGz05l5ebp4w6zdJ6VHSW+qYCMRjyQndYAmu/5aZvgOxI6aIZj 8HhyWxL/BifjrYhlxCiBZLJQCdWTMuptnsXoouzWrkyqhMestXiFCGFIJB+FW4wARdVZ CEqvFrc2IHZk/o3aUReh1w4arIXVdrcbkqp8ghNtaAPwe1le2Fxtb8y/iMLcqH9o97fg iYT6UFFJWZZjOD8zAnVBqktn8cao5Z8wZVFVMkZrwO6GcN4O39gSVaNiIeP/+b2mrsxM qQ/g== X-Gm-Message-State: APt69E0I0BQxJKXT9iFtkxHKSc1hA5+X1FBR68HA8Q88fpHPPdPZDSwv mtXb5Vj0IAxuEjaPmPVyXJ055g== X-Received: by 2002:a1c:ca01:: with SMTP id a1-v6mr988375wmg.128.1530005148536; Tue, 26 Jun 2018 02:25:48 -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.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Jun 2018 02:25:47 -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 06/13] ARM: davinci: omapl138-hawk: add aemif & nand support Date: Tue, 26 Jun 2018 11:25:30 +0200 Message-Id: <20180626092537.6737-7-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 have support for aemif & nand from board files. As an example add support for nand to da850-hawk. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/board-omapl138-hawk.c | 132 ++++++++++++++++++++ 1 file changed, 132 insertions(+) diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c index 466e87b24e9a..8d8e3165a45c 100644 --- a/arch/arm/mach-davinci/board-omapl138-hawk.c +++ b/arch/arm/mach-davinci/board-omapl138-hawk.c @@ -16,6 +16,11 @@ #include #include #include +#include +#include +#include +#include +#include #include #include @@ -166,6 +171,129 @@ static __init void omapl138_hawk_mmc_init(void) gpiod_remove_lookup_table(&mmc_gpios_table); } +static struct mtd_partition omapl138_hawk_nandflash_partition[] = { + { + .name = "u-boot env", + .offset = 0, + .size = SZ_128K, + .mask_flags = MTD_WRITEABLE, + }, + { + .name = "u-boot", + .offset = MTDPART_OFS_APPEND, + .size = SZ_512K, + .mask_flags = MTD_WRITEABLE, + }, + { + .name = "free space", + .offset = MTDPART_OFS_APPEND, + .size = MTDPART_SIZ_FULL, + .mask_flags = 0, + }, +}; + +static struct davinci_aemif_timing omapl138_hawk_nandflash_timing = { + .wsetup = 24, + .wstrobe = 21, + .whold = 14, + .rsetup = 19, + .rstrobe = 50, + .rhold = 0, + .ta = 20, +}; + +static struct davinci_nand_pdata omapl138_hawk_nandflash_data = { + .core_chipsel = 1, + .parts = omapl138_hawk_nandflash_partition, + .nr_parts = ARRAY_SIZE(omapl138_hawk_nandflash_partition), + .ecc_mode = NAND_ECC_HW, + .ecc_bits = 4, + .bbt_options = NAND_BBT_USE_FLASH, + .options = NAND_BUSWIDTH_16, + .timing = &omapl138_hawk_nandflash_timing, + .mask_chipsel = 0, + .mask_ale = 0, + .mask_cle = 0, +}; + +static struct resource omapl138_hawk_nandflash_resource[] = { + { + .start = DA8XX_AEMIF_CS3_BASE, + .end = DA8XX_AEMIF_CS3_BASE + SZ_32M, + .flags = IORESOURCE_MEM, + }, + { + .start = DA8XX_AEMIF_CTL_BASE, + .end = DA8XX_AEMIF_CTL_BASE + SZ_32K, + .flags = IORESOURCE_MEM, + }, +}; + +static struct resource omapl138_hawk_aemif_resource[] = { + { + .start = DA8XX_AEMIF_CTL_BASE, + .end = DA8XX_AEMIF_CTL_BASE + SZ_32K, + .flags = IORESOURCE_MEM, + } +}; + +static struct aemif_abus_data omapl138_hawk_aemif_abus_data[] = { + { + .cs = 3, + } +}; + +static struct platform_device omapl138_hawk_aemif_devices[] = { + { + .name = "davinci_nand", + .id = 1, + .dev = { + .platform_data = &omapl138_hawk_nandflash_data, + }, + .resource = omapl138_hawk_nandflash_resource, + .num_resources = ARRAY_SIZE(omapl138_hawk_nandflash_resource), + } +}; + +static struct aemif_platform_data omapl138_hawk_aemif_pdata = { + .cs_offset = 2, + .abus_data = omapl138_hawk_aemif_abus_data, + .num_abus_data = ARRAY_SIZE(omapl138_hawk_aemif_abus_data), + .sub_devices = omapl138_hawk_aemif_devices, + .num_sub_devices = ARRAY_SIZE(omapl138_hawk_aemif_devices), +}; + +static struct platform_device omapl138_hawk_aemif_device = { + .name = "ti-aemif", + .id = -1, + .dev = { + .platform_data = &omapl138_hawk_aemif_pdata, + }, + .resource = omapl138_hawk_aemif_resource, + .num_resources = ARRAY_SIZE(omapl138_hawk_aemif_resource), +}; + +static const short omapl138_hawk_nand_pins[] = { + DA850_EMA_WAIT_1, DA850_NEMA_OE, DA850_NEMA_WE, DA850_NEMA_CS_3, + DA850_EMA_D_0, DA850_EMA_D_1, DA850_EMA_D_2, DA850_EMA_D_3, + DA850_EMA_D_4, DA850_EMA_D_5, DA850_EMA_D_6, DA850_EMA_D_7, + DA850_EMA_D_8, DA850_EMA_D_9, DA850_EMA_D_10, DA850_EMA_D_11, + DA850_EMA_D_12, DA850_EMA_D_13, DA850_EMA_D_14, DA850_EMA_D_15, + DA850_EMA_A_1, DA850_EMA_A_2, + -1 +}; + +static int omapl138_hawk_register_aemif(void) +{ + int ret; + + ret = davinci_cfg_reg_list(omapl138_hawk_nand_pins); + if (ret) + pr_warn("%s: NAND mux setup failed: %d\n", __func__, ret); + + return platform_device_register(&omapl138_hawk_aemif_device); +} + static irqreturn_t omapl138_hawk_usb_ocic_irq(int irq, void *dev_id); static da8xx_ocic_handler_t hawk_usb_ocic_handler; @@ -298,6 +426,10 @@ static __init void omapl138_hawk_init(void) omapl138_hawk_usb_init(); + ret = omapl138_hawk_register_aemif(); + if (ret) + pr_warn("%s: aemif registration failed: %d\n", __func__, ret); + ret = da8xx_register_watchdog(); if (ret) pr_warn("%s: watchdog registration failed: %d\n", -- 2.17.1