From patchwork Mon Mar 19 15:33:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10292583 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 763E0602C2 for ; Mon, 19 Mar 2018 15:35:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 640A6291A5 for ; Mon, 19 Mar 2018 15:35:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5852029486; Mon, 19 Mar 2018 15:35:52 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID 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 E80BA291A5 for ; Mon, 19 Mar 2018 15:35:51 +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=+eUW/WJ7Q65QwsiN6lOmqjtzjOVkYyJqSf4EHetN+3w=; b=H/vTKcxOOWVZN+IXQSgQjuAQAb wyC7sEkYuR3kDWJmOb9ju5jeBXchMXLWlB9g5YbBPbnH/PYl02TV0amxlegBJCLoPOgm6DpTP4Hs1 4PVNsPbHU6XKXo4cQJCiN2qRMofPY9qNrFlvmt+oZ1ApEURDChJzQjpwueeNF34sl5gi4IBwlQ/dH 9+6ndBpix2SVWaj5f5o7FceaYPHE8pF1wjngBx/kYfABWC+WD/SQJomQDR1tl06q8iGU3mEzEDuIm +KJNID0KrGOE9C4CxOciFbps9HZrnZW+MWQDlL/EthgxtqoUVMd8fEaDbgKO5vWLp4KbySsDsYf9L d7I3kE3A==; 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 1exwp5-00040p-4Q; Mon, 19 Mar 2018 15:35:43 +0000 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1exwnD-0002UH-M2 for linux-arm-kernel@lists.infradead.org; Mon, 19 Mar 2018 15:33:59 +0000 Received: by mail-wr0-x241.google.com with SMTP id d10so19080323wrf.3 for ; Mon, 19 Mar 2018 08:33:37 -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=dNT9LaR7tgzXjqGGstIjvW9sAWI2KIzFbK2PC+52NQk=; b=rCDHX5xkXAmMtW8hdw5a/ovi6WRmSKUEhTGnKEh1R93KpMYz8u785aeLgMaNlXdade JinS4mO9+LVtCgL2v9LIOGR8s0qcinqQGTLH72DiEHbmruwX881o//k7OHuU2/cStVGd J9jjY0n6UVaQECcyqaHso8anhHG6qnjE2HIQlR4GvO1WxP9eEdIDcTmQlq/9VFDEn+UF fIPosT12azzdWK0FQ1s5RWoas6UDuX96N6BLt1qF5wjaNCtxBn+zeIswfOOfx3hrd/en IPCyWnPX6UF8qThlH26n5rzLIgLmOQyyggZ5XfnLFCsmvgzk056tZmGeK5zx/M1IU4PJ z4yQ== 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=dNT9LaR7tgzXjqGGstIjvW9sAWI2KIzFbK2PC+52NQk=; b=F6lISsNAaZ4CzFQNcPaKh++FHxem+/E+il0VRpvYQVN+ro4UgFYj2MvcWYUI5ca/Lf Sc53uD1DIEfEWX+dxZl84+tA6MoR9T8W7ARaLGgRX0Rqt6EosRJRcRgaJioypUPs7dMm aZQY5mEvqMXIf3G90O7oUvjmnBt97vZhdR7yr9DoaHhhX+ZzdZLFnilVndCeALqhgqR2 F/n9bH4l7OBuoXYsVXTBprZYj5ujcReUopsKg/XpTavX1YHoyj6MjzA86tNlRC0ippFL KFw9ewsFogvxO2WRh1WtbuWjbyaNXH7tIaz7GXouwF46hihhxr2vPEgvtxiGxEv7m8YV LNiA== X-Gm-Message-State: AElRT7HvrZjA+WbVIR16zYnt9NSjRWxrmud42jGblTBpVx2BFcM0K+eR ge3EeqZnpbtOQW7tZXkNXsxcBQ== X-Google-Smtp-Source: AG47ELsGbjr7BlgpMKcee77MWCipgWDONWYgym5aYLjm43PfnlVDr6OXlEP8ELhcB4duLIHoDYGAXg== X-Received: by 10.223.186.206 with SMTP id w14mr10571895wrg.251.1521473616002; Mon, 19 Mar 2018 08:33:36 -0700 (PDT) Received: from brgl-bgdev.baylibre.local ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id w73sm695489wmw.42.2018.03.19.08.33.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Mar 2018 08:33:35 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Santosh Shilimkar Subject: [PATCH v2 3/4] ARM: davinci: add aemif & nand support to da850-lcdk in legacy mode Date: Mon, 19 Mar 2018 16:33:13 +0100 Message-Id: <20180319153314.26120-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180319153314.26120-1-brgl@bgdev.pl> References: <20180319153314.26120-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180319_083348_517419_26F898E4 X-CRM114-Status: GOOD ( 14.58 ) 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",