forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 958e46acc8e900e8569dd467c1af9b8d2d019394
kernel/arch/mips/alchemy/devboards/db1200.c
....@@ -1,21 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * DBAu1200/PBAu1200 board platform device registration
34 *
45 * Copyright (C) 2008-2011 Manuel Lauss
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program; if not, write to the Free Software
18
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
196 */
207
218 #include <linux/clk.h>
....@@ -29,8 +16,7 @@
2916 #include <linux/leds.h>
3017 #include <linux/mmc/host.h>
3118 #include <linux/mtd/mtd.h>
32
-#include <linux/mtd/rawnand.h>
33
-#include <linux/mtd/partitions.h>
19
+#include <linux/mtd/platnand.h>
3420 #include <linux/platform_device.h>
3521 #include <linux/serial_8250.h>
3622 #include <linux/spi/spi.h>
....@@ -154,6 +140,8 @@
154140
155141 /******************************************************************************/
156142
143
+static u64 au1200_all_dmamask = DMA_BIT_MASK(32);
144
+
157145 static struct mtd_partition db1200_spiflash_parts[] = {
158146 {
159147 .name = "spi_flash",
....@@ -197,11 +185,10 @@
197185
198186 /**********************************************************************/
199187
200
-static void au1200_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
188
+static void au1200_nand_cmd_ctrl(struct nand_chip *this, int cmd,
201189 unsigned int ctrl)
202190 {
203
- struct nand_chip *this = mtd_to_nand(mtd);
204
- unsigned long ioaddr = (unsigned long)this->IO_ADDR_W;
191
+ unsigned long ioaddr = (unsigned long)this->legacy.IO_ADDR_W;
205192
206193 ioaddr &= 0xffffff00;
207194
....@@ -213,14 +200,14 @@
213200 /* assume we want to r/w real data by default */
214201 ioaddr += MEM_STNAND_DATA;
215202 }
216
- this->IO_ADDR_R = this->IO_ADDR_W = (void __iomem *)ioaddr;
203
+ this->legacy.IO_ADDR_R = this->legacy.IO_ADDR_W = (void __iomem *)ioaddr;
217204 if (cmd != NAND_CMD_NONE) {
218
- __raw_writeb(cmd, this->IO_ADDR_W);
205
+ __raw_writeb(cmd, this->legacy.IO_ADDR_W);
219206 wmb();
220207 }
221208 }
222209
223
-static int au1200_nand_device_ready(struct mtd_info *mtd)
210
+static int au1200_nand_device_ready(struct nand_chip *this)
224211 {
225212 return alchemy_rdsmem(AU1000_MEM_STSTAT) & 1;
226213 }
....@@ -326,13 +313,11 @@
326313 },
327314 };
328315
329
-static u64 au1200_ide_dmamask = DMA_BIT_MASK(32);
330
-
331316 static struct platform_device db1200_ide_dev = {
332317 .name = "pata_platform",
333318 .id = 0,
334319 .dev = {
335
- .dma_mask = &au1200_ide_dmamask,
320
+ .dma_mask = &au1200_all_dmamask,
336321 .coherent_dma_mask = DMA_BIT_MASK(32),
337322 .platform_data = &db1200_ide_info,
338323 },
....@@ -568,13 +553,11 @@
568553 }
569554 };
570555
571
-static u64 au1xxx_mmc_dmamask = DMA_BIT_MASK(32);
572
-
573556 static struct platform_device db1200_mmc0_dev = {
574557 .name = "au1xxx-mmc",
575558 .id = 0,
576559 .dev = {
577
- .dma_mask = &au1xxx_mmc_dmamask,
560
+ .dma_mask = &au1200_all_dmamask,
578561 .coherent_dma_mask = DMA_BIT_MASK(32),
579562 .platform_data = &db1200_mmc_platdata[0],
580563 },
....@@ -609,7 +592,7 @@
609592 .name = "au1xxx-mmc",
610593 .id = 1,
611594 .dev = {
612
- .dma_mask = &au1xxx_mmc_dmamask,
595
+ .dma_mask = &au1200_all_dmamask,
613596 .coherent_dma_mask = DMA_BIT_MASK(32),
614597 .platform_data = &db1200_mmc_platdata[1],
615598 },
....@@ -659,13 +642,11 @@
659642 }
660643 };
661644
662
-static u64 au1200_lcd_dmamask = DMA_BIT_MASK(32);
663
-
664645 static struct platform_device au1200_lcd_dev = {
665646 .name = "au1200-lcd",
666647 .id = 0,
667648 .dev = {
668
- .dma_mask = &au1200_lcd_dmamask,
649
+ .dma_mask = &au1200_all_dmamask,
669650 .coherent_dma_mask = DMA_BIT_MASK(32),
670651 .platform_data = &db1200fb_pd,
671652 },
....@@ -719,11 +700,9 @@
719700 .activate_cs = db1200_spi_cs_en,
720701 };
721702
722
-static u64 spi_dmamask = DMA_BIT_MASK(32);
723
-
724703 static struct platform_device db1200_spi_dev = {
725704 .dev = {
726
- .dma_mask = &spi_dmamask,
705
+ .dma_mask = &au1200_all_dmamask,
727706 .coherent_dma_mask = DMA_BIT_MASK(32),
728707 .platform_data = &db1200_spi_platdata,
729708 },
....@@ -768,6 +747,10 @@
768747 static struct platform_device db1200_sound_dev = {
769748 /* name assigned later based on switch setting */
770749 .id = 1, /* PSC ID */
750
+ .dev = {
751
+ .dma_mask = &au1200_all_dmamask,
752
+ .coherent_dma_mask = DMA_BIT_MASK(32),
753
+ },
771754 };
772755
773756 static struct platform_device db1200_stac_dev = {