From patchwork Tue Apr 17 10:29:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10344755 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 2B33960216 for ; Tue, 17 Apr 2018 10:44:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2AB7428A29 for ; Tue, 17 Apr 2018 10:44:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E9C628A4F; Tue, 17 Apr 2018 10:44:42 +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 8E7CB28A29 for ; Tue, 17 Apr 2018 10:44:40 +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=uLTUDwrUGqb8YazIkVgwCS3+elWw/fGiuGs7r0RdGcE=; b=VRjNoz9d0vT3v+98eKlEV359oU zDwIlFSPQHzwfOq14U3Z7Srtv12OyKgsXkA9WmYT2vIBPL/kvQJ9oKxCn+46llEg1+7Thd6Kdz1bq y9p8oG4X3BHS9vhHv7kWuGGuY6yC7PACBtSnVcnjX/ddRSq4TfsZLnvLICtKPabc17n+Lhtugo9gG 7fwWFHd92y8RhcTwlJ1ZGNt8sxz6C3p3drtVxlAKicQ4hruUcqjGkIbImR8IkjftkyumbA7S8Yx0f mp5r171MnMY45D+BeacnT2bOiox1uEQBAfcIrJV/M1l+Lxj6Ac6AW20DvFhaJpdpKqPVjUwefGiTx reh/Bf+Q==; 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 1f8O6C-0001eP-6U; Tue, 17 Apr 2018 10:44:32 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f8O69-0001NL-Uz for linux-arm-kernel@bombadil.infradead.org; Tue, 17 Apr 2018 10:44:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=/nCbi8kfWY4J9c9G0x+sjE4QOW4sey/0dqBXD6QxW0M=; b=CGSzjM5Fjrq7d3zwtPi+GgUGD 7kFwiM8q9rdzrCWlV+9xOXM1dmAKV7s9tmGvHg83+VZGEFi9Z01OdNQI9PZQ8/V87674pyRPpb75c 64D+tNBf6bgPWGyf11ka8pPjXzsiro1U0wv2p8jDJ1U5LJiEnTot0rxIfnSTjeB7zCcmX68fOakvs f/jnI6GUwz/JgFMFbijnVeAb2cErfviVDjefnrT+JFgS3ONGdg53vPTwpKv96v0/VNay7l8VML6qw HQJUHyM1gvY9o6y93OVr2pfqit1VgqMn6n8eIIM8yA8v4/OW3CFKZg2Eu+W9CVfT2nku7Vlywct0z kt+umRTdA==; Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f8Nrn-0000x4-Ex for linux-arm-kernel@lists.infradead.org; Tue, 17 Apr 2018 10:29:41 +0000 Received: by mail-wr0-x241.google.com with SMTP id s18so34005652wrg.9 for ; Tue, 17 Apr 2018 03:29:29 -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=/nCbi8kfWY4J9c9G0x+sjE4QOW4sey/0dqBXD6QxW0M=; b=IUbMXgSW6o7vVW6Pif1ZenQkRKVh3Gdg31ngnmFViZvePemVMjotrGUIMn1uV8WcOF ZF3PTQn5DfEc4i7mURjDid6Vj2Gebw6DFyhX2bra4fwBRbJAAJ3Tc5wQMMX5garVrzOo 2ynPRn/b2rHE5ui7ZzNBRMj5Sxx9NXrrQtn8tLE776T3RZy4x9LIsY3JTXwZZKcoL+CW dqDlbj0DO80ZWIFmZQImE01YeMGqkM96Zt8RyqVgZPAoRqvA0Djv5VLODyzrenQVnXxU arOE1HU1X01YS42Bcq48ubFycqdyv+DB/RCxitQf4FEuR+ze28LGa0FIkM5VH7yjvlZf hI6w== 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=/nCbi8kfWY4J9c9G0x+sjE4QOW4sey/0dqBXD6QxW0M=; b=NAvS5YbmGLjQgrxnxEbIgzCfuLa4IrHOsEf6810g4YQe8qR2NO6FG0rVSePbJqbyL4 8wPKqT5F7fFKIfiwsxL3DcdpUtUUy+IwE2le8xYdtJUE+QTmn6v/ENvkIrU57+qGA2S7 Nu2qrWo8ptRpngsPPJhxwP4Vk8rx7FzjI5A+m2fkxEnnfUY0MvTBmUpufmUfxLUd6OJm lo2jHhsKS/M7+BVpv9C2MSMgnBI5tkQBGs41+DJwm3HXU4pGiJOnWdD9YZBZQolMIhsV tNizJpelmrsuQBX+7lKa+Il6r4UcAUf4XAIvMXYfhosU9FTz7xKRL/5lJov+BThOQIUR 3+PA== X-Gm-Message-State: ALQs6tD9an2MIQBY5bOD7VzLI4zAJy/K0y6WDYnLkXUy09a6uIhpvQ8C yw73xyEMlwU2lJdwtLV8SdhEEg== X-Google-Smtp-Source: AIpwx496nWnV9YoXhj+XZbktriQWfg8Ni0FBp3DcsUXCzFIKCjLiUTKg8bRSNVFNFHBuckABLx2/6w== X-Received: by 10.223.175.40 with SMTP id z37mr1230236wrc.72.1523960968313; Tue, 17 Apr 2018 03:29:28 -0700 (PDT) Received: from brgl-bgdev.home ([2a01:cb1d:af:5b00:e837:b8d5:48c1:571b]) by smtp.gmail.com with ESMTPSA id r75sm8842252wmf.34.2018.04.17.03.29.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Apr 2018 03:29:27 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Santosh Shilimkar Subject: [RESEND PATCH v2 3/4] ARM: davinci: add aemif & nand support to da850-lcdk in legacy mode Date: Tue, 17 Apr 2018 12:29:16 +0200 Message-Id: <20180417102917.7794-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180417102917.7794-1-brgl@bgdev.pl> References: <20180417102917.7794-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180417_112939_500916_6DE699CE X-CRM114-Status: GOOD ( 15.88 ) 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 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 have support for aemif & nand from board files. As an example add support for nand to da850-lcdk in legacy mode. 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 6c997c59a3cd..9c3de56b54e4 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 @@ -162,6 +167,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_128K, + .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 = { + .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), + .id = 0, + } +}; + +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", + .dev = { + .platform_data = &omapl138_hawk_aemif_pdata, + }, + .resource = omapl138_hawk_aemif_resource, + .num_resources = ARRAY_SIZE(omapl138_hawk_aemif_resource), + .id = -1, +}; + +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; @@ -294,6 +422,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",