forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/arch/sh/boards/mach-migor/setup.c
....@@ -5,7 +5,7 @@
55 * Copyright (C) 2008 Magnus Damm
66 */
77 #include <linux/clkdev.h>
8
-#include <linux/dma-mapping.h>
8
+#include <linux/dma-map-ops.h>
99 #include <linux/init.h>
1010 #include <linux/platform_device.h>
1111 #include <linux/interrupt.h>
....@@ -15,7 +15,7 @@
1515 #include <linux/mmc/host.h>
1616 #include <linux/mtd/physmap.h>
1717 #include <linux/mfd/tmio.h>
18
-#include <linux/mtd/rawnand.h>
18
+#include <linux/mtd/platnand.h>
1919 #include <linux/i2c.h>
2020 #include <linux/regulator/fixed.h>
2121 #include <linux/regulator/machine.h>
....@@ -166,23 +166,21 @@
166166 },
167167 };
168168
169
-static void migor_nand_flash_cmd_ctl(struct mtd_info *mtd, int cmd,
169
+static void migor_nand_flash_cmd_ctl(struct nand_chip *chip, int cmd,
170170 unsigned int ctrl)
171171 {
172
- struct nand_chip *chip = mtd_to_nand(mtd);
173
-
174172 if (cmd == NAND_CMD_NONE)
175173 return;
176174
177175 if (ctrl & NAND_CLE)
178
- writeb(cmd, chip->IO_ADDR_W + 0x00400000);
176
+ writeb(cmd, chip->legacy.IO_ADDR_W + 0x00400000);
179177 else if (ctrl & NAND_ALE)
180
- writeb(cmd, chip->IO_ADDR_W + 0x00800000);
178
+ writeb(cmd, chip->legacy.IO_ADDR_W + 0x00800000);
181179 else
182
- writeb(cmd, chip->IO_ADDR_W);
180
+ writeb(cmd, chip->legacy.IO_ADDR_W);
183181 }
184182
185
-static int migor_nand_flash_ready(struct mtd_info *mtd)
183
+static int migor_nand_flash_ready(struct nand_chip *chip)
186184 {
187185 return gpio_get_value(GPIO_PTA1); /* NAND_RBn */
188186 }
....@@ -604,11 +602,9 @@
604602
605603 /* Initialize CEU platform device separately to map memory first */
606604 device_initialize(&migor_ceu_device.dev);
607
- arch_setup_pdev_archdata(&migor_ceu_device);
608605 dma_declare_coherent_memory(&migor_ceu_device.dev,
609
- ceu_dma_membase, ceu_dma_membase,
610
- ceu_dma_membase + CEU_BUFFER_MEMORY_SIZE - 1,
611
- DMA_MEMORY_EXCLUSIVE);
606
+ ceu_dma_membase, ceu_dma_membase,
607
+ CEU_BUFFER_MEMORY_SIZE);
612608
613609 platform_device_add(&migor_ceu_device);
614610
....@@ -633,7 +629,10 @@
633629 phys_addr_t phys;
634630 phys_addr_t size = CEU_BUFFER_MEMORY_SIZE;
635631
636
- phys = memblock_alloc_base(size, PAGE_SIZE, MEMBLOCK_ALLOC_ANYWHERE);
632
+ phys = memblock_phys_alloc(size, PAGE_SIZE);
633
+ if (!phys)
634
+ panic("Failed to allocate CEU memory\n");
635
+
637636 memblock_free(phys, size);
638637 memblock_remove(phys, size);
639638