MIPS: Loongson1B: Add dmaengine and NAND device
Subsystems (2)
Keguang Zhang
maintainercover MIPS: Loongson1B: Add dmaengine and NAND device
From: Kelvin Cheung <[email protected]>
This patchset is to add dmaengine and NAND device
for Loongson1B.
Kelvin Cheung (4):
MIPS: Loongson1B: Add dma_slave_map to DMA platform data
MIPS: Loongson1B: Add Loongson1 dmaengine device
MIPS: Loongson1B: Add Loongson1 NAND device
MIPS: Loongson1B: Enable NAND by default
arch/mips/configs/loongson1b_defconfig | 13 ++-- arch/mips/include/asm/mach-loongson32/dma.h | 7 ++- arch/mips/include/asm/mach-loongson32/nand.h | 4 -- .../include/asm/mach-loongson32/platform.h | 4 ++ arch/mips/loongson32/common/platform.c | 63 +++++++++++++++++++ arch/mips/loongson32/ls1b/board.c | 37 ++++++++++- 6 files changed, 113 insertions(+), 15 deletions(-)
base-commit: 33ae8f801ad8bec48e886d368739feb2816478f2
Signature · 1 line
2.30.2
Keguang Zhang
maintainerPATCH 1/4 MIPS: Loongson1B: Add dma_slave_map to DMA platform data
From: Kelvin Cheung <[email protected]>
This patch add dma_slave_map to DMA platform data, and remove unnecessary DMA filter declaration.
--- 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(-)
arch/mips/include/asm/mach-loongson32/dma.h +4 -3
@@ -8,14 +8,15 @@#ifndef __ASM_MACH_LOONGSON32_DMA_H#define __ASM_MACH_LOONGSON32_DMA_H +#include <linux/dmaengine.h> +#define LS1X_DMA_CHANNEL0 0#define LS1X_DMA_CHANNEL1 1#define LS1X_DMA_CHANNEL2 2struct 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 */
arch/mips/include/asm/mach-loongson32/nand.h +0 -4
@@ -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 */
Signature · 1 line
2.30.2
Keguang Zhang
maintainerPATCH 2/4 MIPS: Loongson1B: Add Loongson1 dmaengine device
In reply to Keguang ZhangFrom: Kelvin Cheung <[email protected]>
This patch adds DMA Engine device its platform data for Loongson1B.
--- .../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(-)
arch/mips/include/asm/mach-loongson32/platform.h +2 -0
@@ -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);
arch/mips/loongson32/common/platform.c +36 -0
@@ -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 ,
arch/mips/loongson32/ls1b/board.c +14 -1
@@ -12,6 +12,17 @@#include <nand.h> #include <platform.h> +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);
Signature · 1 line
2.30.2
Keguang Zhang
maintainerPATCH 3/4 MIPS: Loongson1B: Add Loongson1 NAND device
In reply to Keguang ZhangFrom: Kelvin Cheung <[email protected]>
This patch adds NAND device and its platform data for Loongson1B.
--- .../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(+)
arch/mips/include/asm/mach-loongson32/platform.h +2 -0
@@ -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);
arch/mips/loongson32/common/platform.c +27 -0
@@ -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 );
arch/mips/loongson32/ls1b/board.c +22 -0
@@ -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);
Signature · 1 line
2.30.2
Keguang Zhang
maintainerPATCH 4/4 MIPS: Loongson1B: Enable NAND by default
In reply to Keguang ZhangFrom: Kelvin Cheung <[email protected]>
Update defconfig to enable NAND by default.
--- arch/mips/configs/loongson1b_defconfig | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
arch/mips/configs/loongson1b_defconfig +6 -7
@@ -14,10 +14,12 @@ CONFIG_EXPERT=y CONFIG_PERF_EVENTS=y # CONFIG_COMPAT_BRK is not set CONFIG_MACH_LOONGSON32=y -# CONFIG_SECCOMP is not set # CONFIG_SUSPEND is not set +# CONFIG_SECCOMP is not set +# CONFIG_GCC_PLUGINS is not set CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y +CONFIG_MODULE_FORCE_UNLOAD=y CONFIG_MODVERSIONS=y # CONFIG_BLK_DEV_BSG is not set # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
@@ -28,9 +30,6 @@ CONFIG_INET=y CONFIG_IP_PNP=y CONFIG_IP_PNP_DHCP=y CONFIG_SYN_COOKIES=y -# CONFIG_INET_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET_XFRM_MODE_TUNNEL is not set -# CONFIG_INET_XFRM_MODE_BEET is not set # CONFIG_INET_DIAG is not set # CONFIG_IPV6 is not set # CONFIG_WIRELESS is not set
@@ -41,6 +40,7 @@ CONFIG_MTD=y CONFIG_MTD_CMDLINE_PARTS=y CONFIG_MTD_BLOCK=y CONFIG_MTD_RAW_NAND=y +CONFIG_MTD_NAND_LOONGSON1=y CONFIG_MTD_UBI=y CONFIG_BLK_DEV_LOOP=y CONFIG_SCSI=m
@@ -92,6 +92,7 @@ CONFIG_LEDS_TRIGGERS=y CONFIG_LEDS_TRIGGER_HEARTBEAT=y CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_LOONGSON1=y +CONFIG_DMADEVICES=y # CONFIG_IOMMU_SUPPORT is not set CONFIG_EXT2_FS=y CONFIG_EXT2_FS_XATTR=y
@@ -112,12 +113,10 @@ CONFIG_NFS_FS=y CONFIG_ROOT_NFS=y CONFIG_NLS_CODEPAGE_437=m CONFIG_NLS_ISO8859_1=m -# CONFIG_CRYPTO_ECHAINIV is not set # CONFIG_CRYPTO_HW is not set CONFIG_DYNAMIC_DEBUG=y -# CONFIG_ENABLE_MUST_CHECK is not set -CONFIG_DEBUG_FS=y CONFIG_MAGIC_SYSRQ=y +CONFIG_DEBUG_FS=y # CONFIG_SCHED_DEBUG is not set # CONFIG_DEBUG_PREEMPT is not set # CONFIG_FTRACE is not set
Signature · 1 line
2.30.2
Thomas Bogendoerfer
maintainerQuoted 4 lines · Keguang Zhang
From: Kelvin Cheung <[email protected]>
This patchset is to add dmaengine and NAND device
for Loongson1B.
as I saw two more versions of this series, is this something to look at and apply ?
For future submissions, could you please add a changelog when you update a series ? Thanks a lot.
Thomas.
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]