Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp7787692imm; Thu, 28 Jun 2018 09:16:43 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfuM3BbeWFrLtUimUOaH+nZ34mc/YS6IjjSdDI5p5TyW8OvYsq9FHCv9uQZ2FM7+oDyqyFs X-Received: by 2002:a62:d646:: with SMTP id r67-v6mr271077pfg.130.1530202603254; 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=wMe2yyI9Pb78qyxg6gjQfHHjASKkF75vFfVR+YCvQdhwN55TrNZyjYQ8Bg7yybc/mI Ml2OzIEbj7g9+sQgMWE55N7DQRJwFz6uoC9rWGniOjMZZLVejwY0vvguSdq500bMmK69 BUezbs734+w2pTEtyi8ZsdLagZgwv7GhnUii0AIDZQdgQK4hojXzAXu4ajkoM36F4OoI hnGTJZL3Njctvc5eg3rMqApAO5VVjLcH+nzzsWBg504/BigYFzPD06ObbMMeTJiZemj5 oq6XGvZ8Pp6Cbw59omUCxOUSfw1eSjFxY1+hGEnJM5/G3mHyfhRO6r91nzxvbLL3aE2J OYlA== 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=lAhMUc/l4KiVTdUhpawHGobcE1HM9P6vl2vFXum80D4=; b=SR7NpyIqTidL/6BhuhaMybB+oLkqywuas1jnr8mWGS3dmbiQWa22thpeqpz9/yOshk hYhQ02i1yqirPESlcj7Tj3pBnzanQYYH5lei8CqJV+NNjiIf6vhAi1TOJp9d5tQ6bmz9 nMK6uhJFq6/9M44dHqYJClt1Z7uac6eJ9cbwzj9aLpIZbRMnrO0P0rV8myoN5gTWf0aP 5/dI6+kGbEA1n3TccGq+EuWVXhQGYBek2/Mxt4tnwTqHlKYq2WShV1yXLuXzyr8azfRm COkhVDZ/q0kEJAImgMoBkW408u8phgROUCF09Lk0VHmLWBy1xHm3DmoCRrZwoevMENae ekPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b="PsYd/XrJ"; 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 b4-v6si6076739pgc.654.2018.06.28.09.16.05; 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="PsYd/XrJ"; 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 S965252AbeF1KAB (ORCPT + 99 others); Thu, 28 Jun 2018 06:00:01 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:37948 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935208AbeF1J6D (ORCPT ); Thu, 28 Jun 2018 05:58:03 -0400 Received: by mail-wm0-f66.google.com with SMTP id 69-v6so8311493wmf.3 for ; Thu, 28 Jun 2018 02:58:03 -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=lAhMUc/l4KiVTdUhpawHGobcE1HM9P6vl2vFXum80D4=; b=PsYd/XrJHVsTR6gi+vVloFbT8pEufxPYju4h5apDyKld+QZEreFwO6SMzahYyiEDYb 93csPBJpjlIWr973gYf1PGl8vG01XWLEl6wW4xgF/eGKaoRShTNNcgAQX+6AxBtGw+FJ lnbQ5Fbftmoh0DrT7TZSNvl1YhXVkVTLa5+DERBheg0oPDZyq+Ikt/Kp+rgJY7Q5/sCh 3FxVwQVvl/G8IOoF98n7rZWfq0DYWPszTh22iS8TV7euPWRt5NIQTsNJQGemmCWmlGen pEnMvVUlm3yU5i3rlAAdVW+x+7+y//ocLsVIkFVpStn6o1Qze/lAF5ZlVrmjYFgx98rE 63DA== 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=lAhMUc/l4KiVTdUhpawHGobcE1HM9P6vl2vFXum80D4=; b=nLdxubmXn5/b14ZnHtUxvKhx/h5yuDYP1RYM363/jft0goAa/L2esHYrwZMHXDQrYd J8LvMsTT4RuRD/J1WC8zC8uhQG1I9dg7NMDuHKrxGBcho/M36CTDDYmpQK3gYX3k84UN b7gCnWUFyRMPj/j8K1AE8aOZbH0nhWuD0afSwiFjMCUfixtAtyteF32e0b8rR3jcy3h+ j0trODdr/Uw9UrqbmC5pMhrYjz7ae8BriWR6gzK7zzgHjPqDGwAf8QdOesmTgbkZrrMk 4laE7sESy8TY2TDfhKDKvBj632IF3b+Iw7JJcKDV699DDKYy1hBZSTWTvKo9K7xvYjKf jmSg== X-Gm-Message-State: APt69E3k8rM6VlZ4GApOKHW+T+vYB9sk0GCAobj5NevKB1rpag0s5O2J Khtrt+PEiVjC8Pjb1tcJPaNuhw== X-Received: by 2002:a1c:647:: with SMTP id 68-v6mr8029688wmg.82.1530179882411; Thu, 28 Jun 2018 02:58:02 -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.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jun 2018 02:58:01 -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 06/13] ARM: davinci: omapl138-hawk: add aemif & nand support Date: Thu, 28 Jun 2018 11:57:41 +0200 Message-Id: <20180628095748.4462-7-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 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..8e8d51f4a276 100644 --- a/arch/arm/mach-davinci/board-omapl138-hawk.c +++ b/arch/arm/mach-davinci/board-omapl138-hawk.c @@ -15,7 +15,12 @@ #include #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