From patchwork Thu May 20 13:48:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keguang Zhang X-Patchwork-Id: 12270315 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F669C433ED for ; Thu, 20 May 2021 13:48:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 71F7C61057 for ; Thu, 20 May 2021 13:48:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236981AbhETNts (ORCPT ); Thu, 20 May 2021 09:49:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236592AbhETNtr (ORCPT ); Thu, 20 May 2021 09:49:47 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E16CC061760; Thu, 20 May 2021 06:48:24 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id k15so11889012pgb.10; Thu, 20 May 2021 06:48:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=72s6c6EcdlMIZMwgXcJgm4iKdxHr+h9j9N+5N1yhI6M=; b=bODgCssctx+pCb7LX0d+Bj/TYWd5cooZLaOPRLI4HLFDPD9prqjvQ7frRg6ipOLhX0 L+E97o8Vz0Fz9Vu9dOrAhopdFNPKLECBCVrE0VErERDNVap5OeLQqrkGbsuVnnxvMXkf nYk6ND01GfIg1dSzSHZjvkdsRpqAZLFqQBFV4pg6UAAuHLjZYsdW6YSqnytWjh44ynwQ 4op3tQvzfXGWZIpbEDs77TLNLVb92RnNzlaWtcvWd2uuVHVBahlcE5gPuSJmPu7HKL7p yFIrMc3s9y9tBHGXJAKcWzmXGYm0wn+sqGNFwnQnJ7qQUv+qWO4cV3e4bEeZ/Wx6Zpiy meJQ== 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:mime-version:content-transfer-encoding; bh=72s6c6EcdlMIZMwgXcJgm4iKdxHr+h9j9N+5N1yhI6M=; b=BcotlnohgQ2MewJObJ6VMxDouEGOED9Wd8fq+8wLaAoYBqAUoq2/0narR63DffgiU/ 3pR4ae8E81AarNNZFqtKxNwfaz/TkDzjIkGbg0MI0Y2yYQ0CJ0VgkGqk/zW5Zc7S03Qm 72bXqWEO+XKDDU3qpCWsPb0syFIW0cJ/ssUkYNaKQjxgNbe7vhv7HxsdVT3eRBQUFv4V MEq4Wl0WuvKh7fES8QH0xv3xztS2WhzliU36JGe/ZmMqFWKJ9eWmQZvglpQQwND/7Jw7 S6e3CQWGjXzKILnzAgG07jTyu/BRrUDQqrX2swvz4KOjQjBPmRNYjyYc87faQuLdjrW1 Hbjw== X-Gm-Message-State: AOAM5309ZNFxsMO8NgDP8JUVUoQ8sGxBBfveepixJPvUk8Lpr16xBgwX 5OC1/xOy2DG+3M29CMmuCZ9cCCEr2ces9w== X-Google-Smtp-Source: ABdhPJxeLfeZNSHECtxmHenD8UvyDSC63OoKr+q6cLtOXtzh8nljWzEB4jxyXIiVlPsPs4eapLYO8w== X-Received: by 2002:a62:6481:0:b029:249:ecee:a05d with SMTP id y123-20020a6264810000b0290249eceea05dmr4647793pfb.9.1621518503556; Thu, 20 May 2021 06:48:23 -0700 (PDT) Received: from kelvin-System-Product-Name.lan ([117.173.226.141]) by smtp.gmail.com with ESMTPSA id t14sm1954025pfg.168.2021.05.20.06.48.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 06:48:23 -0700 (PDT) From: Keguang Zhang To: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Thomas Bogendoerfer , Keguang Zhang Subject: [PATCH 1/3] MIPS: Loongson1B: Add dma_slave_map to DMA platform data Date: Thu, 20 May 2021 21:48:07 +0800 Message-Id: <20210520134809.27143-2-keguang.zhang@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210520134809.27143-1-keguang.zhang@gmail.com> References: <20210520134809.27143-1-keguang.zhang@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org From: Keguang Zhang This patch add dma_slave_map to DMA platform data, and remove unnecessary DMA filter declaration. Signed-off-by: Keguang Zhang --- arch/mips/include/asm/mach-loongson32/dma.h | 7 ++++--- arch/mips/include/asm/mach-loongson32/nand.h | 4 ---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/arch/mips/include/asm/mach-loongson32/dma.h b/arch/mips/include/asm/mach-loongson32/dma.h index e917b3ccb2c2..1bcf1eb8fe3d 100644 --- a/arch/mips/include/asm/mach-loongson32/dma.h +++ b/arch/mips/include/asm/mach-loongson32/dma.h @@ -8,14 +8,15 @@ #ifndef __ASM_MACH_LOONGSON32_DMA_H #define __ASM_MACH_LOONGSON32_DMA_H +#include + #define LS1X_DMA_CHANNEL0 0 #define LS1X_DMA_CHANNEL1 1 #define LS1X_DMA_CHANNEL2 2 struct plat_ls1x_dma { - int nr_channels; + const struct dma_slave_map *slave_map; + int slavecnt; }; -extern struct plat_ls1x_dma ls1b_dma_pdata; - #endif /* __ASM_MACH_LOONGSON32_DMA_H */ diff --git a/arch/mips/include/asm/mach-loongson32/nand.h b/arch/mips/include/asm/mach-loongson32/nand.h index aaf5ed19d78d..d6eff2fadca2 100644 --- a/arch/mips/include/asm/mach-loongson32/nand.h +++ b/arch/mips/include/asm/mach-loongson32/nand.h @@ -19,8 +19,4 @@ struct plat_ls1x_nand { int wait_cycle; }; -extern struct plat_ls1x_nand ls1b_nand_pdata; - -bool ls1x_dma_filter_fn(struct dma_chan *chan, void *param); - #endif /* __ASM_MACH_LOONGSON32_NAND_H */ From patchwork Thu May 20 13:48:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keguang Zhang X-Patchwork-Id: 12270317 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91733C433B4 for ; Thu, 20 May 2021 13:48:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7396C611ED for ; Thu, 20 May 2021 13:48:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236571AbhETNtx (ORCPT ); Thu, 20 May 2021 09:49:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236846AbhETNtv (ORCPT ); Thu, 20 May 2021 09:49:51 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CA3DC061574; Thu, 20 May 2021 06:48:28 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id c17so12402107pfn.6; Thu, 20 May 2021 06:48:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jSviSkHyrGMFbzFJ20Y6mJ+z2w/lKcoIrG5pt7LN5uo=; b=HRfhfRYI/z41ZOmtimTQVFLvKwmiMKwB9ytM1W0u9NnaS9JxjLBbaOjQhC6TSqEB72 2F0acoG8E86AS0zjpyxI8zIKSDw89V6EqDDW2iLrvmfbSjQvVWU2ZtSbVlmB/vvvIfhg 7XOJ3qQHu++MInq7Ej0P67ZtZkG0jKdhmwLn4aNMXfmc812mFA134zbJ9Z4aO/k7w8rn RP9+s5tW2kAgk2+KliPI9amblo48DEBrbYoIpY7GmHtG7v2GjeIUGg6Wk0NTVWOVDuFi 8hfJDJzP5DE6kSyRG5oupbi5CMft0RkKti9bcr7nMqPNo4qt9csDLokooR+h3+DQPxiU wHKw== 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:mime-version:content-transfer-encoding; bh=jSviSkHyrGMFbzFJ20Y6mJ+z2w/lKcoIrG5pt7LN5uo=; b=m6WFf9VNoak9Oi0VeYbo0v2iujW+R5doUsojIFn41vMEM4iXNrgUCrjrWWx5YddvDa eWY0sq9MOcThTM6Egt4MLFXEZK6GOWQuGqyszDSMUZaLoXDKyvmWp+cnyrZUwfrzioBw rKM3Y6r/JQeILJK7QWsC0SkkrF8UxFnngE+59VtTtBsGIY69a7KfoLAM+sg1mqeYE/+H bL7e/fiB1ZF4J9minZGXLeoZYJ+/en5Q1Bv7o/rBkW8eLtamcmRhljFMW9r0bwCUXFjD sCwkTGFXwysHsJ0LnjhXqpXwVFpF9Sk0MxIKjE+In9yrrilwp4WUDNTaXSRzbVMxM2A7 qEMw== X-Gm-Message-State: AOAM532nx+DJkFHvor+x3hGM5j3QGSO/a3Q4/QIElIrdCQZ/Uqn/JW2J nG3W3DEwkrG4TRAW/mLDTfuEC+8xPTYAdg== X-Google-Smtp-Source: ABdhPJwiSpld/9NCsgPD6JbQ9oRLwnODRZ0Id+3dbtBsQl87DQBAjeOwzr/ge7nam7zeKGucZEOGng== X-Received: by 2002:a63:5c04:: with SMTP id q4mr4664602pgb.127.1621518507458; Thu, 20 May 2021 06:48:27 -0700 (PDT) Received: from kelvin-System-Product-Name.lan ([117.173.226.141]) by smtp.gmail.com with ESMTPSA id t14sm1954025pfg.168.2021.05.20.06.48.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 06:48:27 -0700 (PDT) From: Keguang Zhang To: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Thomas Bogendoerfer , Keguang Zhang Subject: [PATCH 2/3] MIPS: Loongson1B: Add Loongson1 dmaengine device Date: Thu, 20 May 2021 21:48:08 +0800 Message-Id: <20210520134809.27143-3-keguang.zhang@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210520134809.27143-1-keguang.zhang@gmail.com> References: <20210520134809.27143-1-keguang.zhang@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org From: Keguang Zhang This patch adds DMA Engine device its platform data for Loongson1B. Signed-off-by: Keguang Zhang --- .../include/asm/mach-loongson32/platform.h | 2 ++ arch/mips/loongson32/common/platform.c | 36 +++++++++++++++++++ arch/mips/loongson32/ls1b/board.c | 15 +++++++- 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/arch/mips/include/asm/mach-loongson32/platform.h b/arch/mips/include/asm/mach-loongson32/platform.h index eb83e2741887..d4d2a9baacdb 100644 --- a/arch/mips/include/asm/mach-loongson32/platform.h +++ b/arch/mips/include/asm/mach-loongson32/platform.h @@ -13,6 +13,7 @@ extern struct platform_device ls1x_uart_pdev; extern struct platform_device ls1x_cpufreq_pdev; +extern struct platform_device ls1x_dma_pdev; extern struct platform_device ls1x_eth0_pdev; extern struct platform_device ls1x_eth1_pdev; extern struct platform_device ls1x_ehci_pdev; @@ -22,6 +23,7 @@ extern struct platform_device ls1x_rtc_pdev; extern struct platform_device ls1x_wdt_pdev; void __init ls1x_clk_init(void); +void __init ls1x_dma_set_platdata(struct plat_ls1x_dma *pdata); void __init ls1x_rtc_set_extclk(struct platform_device *pdev); void __init ls1x_serial_set_uartclk(struct platform_device *pdev); diff --git a/arch/mips/loongson32/common/platform.c b/arch/mips/loongson32/common/platform.c index 794c96c2a4cd..2092a7ff32e0 100644 --- a/arch/mips/loongson32/common/platform.c +++ b/arch/mips/loongson32/common/platform.c @@ -77,6 +77,42 @@ struct platform_device ls1x_cpufreq_pdev = { }, }; +/* DMA */ +static struct resource ls1x_dma_resources[] = { + [0] = { + .start = LS1X_DMAC_BASE, + .end = LS1X_DMAC_BASE + SZ_4 - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = LS1X_DMA0_IRQ, + .end = LS1X_DMA0_IRQ, + .flags = IORESOURCE_IRQ, + }, + [2] = { + .start = LS1X_DMA1_IRQ, + .end = LS1X_DMA1_IRQ, + .flags = IORESOURCE_IRQ, + }, + [3] = { + .start = LS1X_DMA2_IRQ, + .end = LS1X_DMA2_IRQ, + .flags = IORESOURCE_IRQ, + }, +}; + +struct platform_device ls1x_dma_pdev = { + .name = "ls1x-dma", + .id = -1, + .num_resources = ARRAY_SIZE(ls1x_dma_resources), + .resource = ls1x_dma_resources, +}; + +void __init ls1x_dma_set_platdata(struct plat_ls1x_dma *pdata) +{ + ls1x_dma_pdev.dev.platform_data = pdata; +} + /* Synopsys Ethernet GMAC */ static struct stmmac_mdio_bus_data ls1x_mdio_bus_data = { .phy_mask = 0, diff --git a/arch/mips/loongson32/ls1b/board.c b/arch/mips/loongson32/ls1b/board.c index 727e06718dab..2be4d8544444 100644 --- a/arch/mips/loongson32/ls1b/board.c +++ b/arch/mips/loongson32/ls1b/board.c @@ -12,6 +12,17 @@ #include #include +static const struct dma_slave_map ls1x_dma_slave_map[] = { + { "ls1x-nand", "dmachan0", (void *)LS1X_DMA_CHANNEL0 }, + { "ls1x-ac97", "dmachan1", (void *)LS1X_DMA_CHANNEL1 }, + { "ls1x-ac97", "dmachan2", (void *)LS1X_DMA_CHANNEL2 }, +}; + +struct plat_ls1x_dma ls1x_dma_pdata = { + .slave_map = ls1x_dma_slave_map, + .slavecnt = ARRAY_SIZE(ls1x_dma_slave_map), +}; + static const struct gpio_led ls1x_gpio_leds[] __initconst = { { .name = "LED9", @@ -36,6 +47,7 @@ static const struct gpio_led_platform_data ls1x_led_pdata __initconst = { static struct platform_device *ls1b_platform_devices[] __initdata = { &ls1x_uart_pdev, &ls1x_cpufreq_pdev, + &ls1x_dma_pdev, &ls1x_eth0_pdev, &ls1x_eth1_pdev, &ls1x_ehci_pdev, @@ -48,11 +60,12 @@ static struct platform_device *ls1b_platform_devices[] __initdata = { static int __init ls1b_platform_init(void) { ls1x_serial_set_uartclk(&ls1x_uart_pdev); + ls1x_dma_set_platdata(&ls1x_dma_pdata); gpio_led_register_device(-1, &ls1x_led_pdata); return platform_add_devices(ls1b_platform_devices, - ARRAY_SIZE(ls1b_platform_devices)); + ARRAY_SIZE(ls1b_platform_devices)); } arch_initcall(ls1b_platform_init); From patchwork Thu May 20 13:48:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keguang Zhang X-Patchwork-Id: 12270319 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7DC1C43460 for ; Thu, 20 May 2021 13:48:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8CC43611BD for ; Thu, 20 May 2021 13:48:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236592AbhETNtz (ORCPT ); Thu, 20 May 2021 09:49:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237057AbhETNty (ORCPT ); Thu, 20 May 2021 09:49:54 -0400 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30721C061574; Thu, 20 May 2021 06:48:32 -0700 (PDT) Received: by mail-pg1-x536.google.com with SMTP id t193so11914193pgb.4; Thu, 20 May 2021 06:48:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5MamIp7PZGVhgWJnWNhA+A/xgbg9bu8rRNXQhAtg6wI=; b=fpNu6NIyHvTank++gp8/bGPqB3MFKrCJfoUNsyA3rRLaGpIbV2goXc3PzrOECwTtRd S4XVsOqlUgGJnoOeA5qcQFkaffUA5JXleZ7nh9pnrCZWe7oZiwElqAbmcvSclkhQVHqz yW7vudQ18Gi392vp0RMI2hUd/JujMwfsf2yhLOQpqAdhVfgP8x79/9TXc71EG5yCoiNO O/lznvYG9uDOxdTTw0twM7nCgMnzphWdbz+OF2s+DVS93vxlRNwnrns2ls4UgBlrD3dG 23yitraE25Pv28B6rGQo3V1+wcls8co2cgiUEqIypWgbx8EuKuhiQgIZ4GFNDlNKecn+ RIFA== 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:mime-version:content-transfer-encoding; bh=5MamIp7PZGVhgWJnWNhA+A/xgbg9bu8rRNXQhAtg6wI=; b=HbY14fzw0jdYdydAGXm27xFmo6vrWTRUHKUfKdRxd82H8b1AXAq97K+05caIpPdUfb QExsdnbyG+nhJJFc/Rq8OfQ+2J5LATa8d2BkitQRt6c+EMVCQXCAXVa2iKukL3bkUFoQ vTAJJSTuCufspG2e92CuVqMAol/T3/BzMOhpUJk3iiuGEqivN0kM5ICMk6RzidYEeKNG MtHudZZjuBRlyfwD6FXMnbHMWWIy1dvn3UTk6RuczkCQIyjyoAqevR18xiqSsYJcyKo4 /m7v6Q2YHqxb0IC9DcyAiTARB9d2liSigQA/MydrSyKzU/WqcAJ7vizM9OUGbt1wafu1 Gv/A== X-Gm-Message-State: AOAM530hqfXrpE0xl5KcP93VrWSa76oXuqq60a6AGlCGLiGsV5K1+gQ6 aqoWhYk58kcSJn42slv8dZJfpv2PjorYTA== X-Google-Smtp-Source: ABdhPJy5cc7QdiEfdhN2ETnUTrA4+AAJTTBYsWw1kXay6ZmdC+SwzrqZbTQ8PkKaTU5I6cqY3MlccQ== X-Received: by 2002:a63:5503:: with SMTP id j3mr4777321pgb.256.1621518511299; Thu, 20 May 2021 06:48:31 -0700 (PDT) Received: from kelvin-System-Product-Name.lan ([117.173.226.141]) by smtp.gmail.com with ESMTPSA id t14sm1954025pfg.168.2021.05.20.06.48.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 May 2021 06:48:30 -0700 (PDT) From: Keguang Zhang To: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Thomas Bogendoerfer , Keguang Zhang Subject: [PATCH 3/3] MIPS: Loongson1B: Add Loongson1 NAND device Date: Thu, 20 May 2021 21:48:09 +0800 Message-Id: <20210520134809.27143-4-keguang.zhang@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210520134809.27143-1-keguang.zhang@gmail.com> References: <20210520134809.27143-1-keguang.zhang@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org From: Keguang Zhang This patch adds NAND device and its platform data for Loongson1B. Signed-off-by: Keguang Zhang --- .../include/asm/mach-loongson32/platform.h | 2 ++ arch/mips/loongson32/common/platform.c | 27 +++++++++++++++++++ arch/mips/loongson32/ls1b/board.c | 22 +++++++++++++++ 3 files changed, 51 insertions(+) diff --git a/arch/mips/include/asm/mach-loongson32/platform.h b/arch/mips/include/asm/mach-loongson32/platform.h index d4d2a9baacdb..daf02b5c83a7 100644 --- a/arch/mips/include/asm/mach-loongson32/platform.h +++ b/arch/mips/include/asm/mach-loongson32/platform.h @@ -19,11 +19,13 @@ extern struct platform_device ls1x_eth1_pdev; extern struct platform_device ls1x_ehci_pdev; extern struct platform_device ls1x_gpio0_pdev; extern struct platform_device ls1x_gpio1_pdev; +extern struct platform_device ls1x_nand_pdev; extern struct platform_device ls1x_rtc_pdev; extern struct platform_device ls1x_wdt_pdev; void __init ls1x_clk_init(void); void __init ls1x_dma_set_platdata(struct plat_ls1x_dma *pdata); +void __init ls1x_nand_set_platdata(struct plat_ls1x_nand *pdata); void __init ls1x_rtc_set_extclk(struct platform_device *pdev); void __init ls1x_serial_set_uartclk(struct platform_device *pdev); diff --git a/arch/mips/loongson32/common/platform.c b/arch/mips/loongson32/common/platform.c index 2092a7ff32e0..d47a84ecf193 100644 --- a/arch/mips/loongson32/common/platform.c +++ b/arch/mips/loongson32/common/platform.c @@ -287,6 +287,33 @@ struct platform_device ls1x_gpio1_pdev = { .resource = ls1x_gpio1_resources, }; +/* NAND Flash */ +static struct resource ls1x_nand_resources[] = { + [0] = { + .start = LS1X_NAND_BASE, + .end = LS1X_NAND_BASE + SZ_32 - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .name = "dmachan0", + .start = LS1X_DMA_CHANNEL0, + .end = LS1X_DMA_CHANNEL0, + .flags = IORESOURCE_DMA, + }, +}; + +struct platform_device ls1x_nand_pdev = { + .name = "ls1x-nand", + .id = -1, + .num_resources = ARRAY_SIZE(ls1x_nand_resources), + .resource = ls1x_nand_resources, +}; + +void __init ls1x_nand_set_platdata(struct plat_ls1x_nand *pdata) +{ + ls1x_nand_pdev.dev.platform_data = pdata; +} + /* USB EHCI */ static u64 ls1x_ehci_dmamask = DMA_BIT_MASK(32); diff --git a/arch/mips/loongson32/ls1b/board.c b/arch/mips/loongson32/ls1b/board.c index 2be4d8544444..dd5a0ce9e4fb 100644 --- a/arch/mips/loongson32/ls1b/board.c +++ b/arch/mips/loongson32/ls1b/board.c @@ -23,6 +23,26 @@ struct plat_ls1x_dma ls1x_dma_pdata = { .slavecnt = ARRAY_SIZE(ls1x_dma_slave_map), }; +static struct mtd_partition ls1x_nand_parts[] = { + { + .name = "kernel", + .offset = 0, + .size = SZ_16M, + }, + { + .name = "rootfs", + .offset = MTDPART_OFS_APPEND, + .size = MTDPART_SIZ_FULL, + }, +}; + +struct plat_ls1x_nand ls1x_nand_pdata = { + .parts = ls1x_nand_parts, + .nr_parts = ARRAY_SIZE(ls1x_nand_parts), + .hold_cycle = 0x2, + .wait_cycle = 0xc, +}; + static const struct gpio_led ls1x_gpio_leds[] __initconst = { { .name = "LED9", @@ -53,6 +73,7 @@ static struct platform_device *ls1b_platform_devices[] __initdata = { &ls1x_ehci_pdev, &ls1x_gpio0_pdev, &ls1x_gpio1_pdev, + &ls1x_nand_pdev, &ls1x_rtc_pdev, &ls1x_wdt_pdev, }; @@ -61,6 +82,7 @@ static int __init ls1b_platform_init(void) { ls1x_serial_set_uartclk(&ls1x_uart_pdev); ls1x_dma_set_platdata(&ls1x_dma_pdata); + ls1x_nand_set_platdata(&ls1x_nand_pdata); gpio_led_register_device(-1, &ls1x_led_pdata);