hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/arch/mips/alchemy/devboards/db1300.c
....@@ -17,10 +17,8 @@
1717 #include <linux/interrupt.h>
1818 #include <linux/ata_platform.h>
1919 #include <linux/mmc/host.h>
20
-#include <linux/module.h>
2120 #include <linux/mtd/mtd.h>
22
-#include <linux/mtd/rawnand.h>
23
-#include <linux/mtd/partitions.h>
21
+#include <linux/mtd/platnand.h>
2422 #include <linux/platform_device.h>
2523 #include <linux/smsc911x.h>
2624 #include <linux/wm97xx.h>
....@@ -149,11 +147,12 @@
149147
150148 /**********************************************************************/
151149
152
-static void au1300_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
150
+static u64 au1300_all_dmamask = DMA_BIT_MASK(32);
151
+
152
+static void au1300_nand_cmd_ctrl(struct nand_chip *this, int cmd,
153153 unsigned int ctrl)
154154 {
155
- struct nand_chip *this = mtd_to_nand(mtd);
156
- unsigned long ioaddr = (unsigned long)this->IO_ADDR_W;
155
+ unsigned long ioaddr = (unsigned long)this->legacy.IO_ADDR_W;
157156
158157 ioaddr &= 0xffffff00;
159158
....@@ -165,14 +164,14 @@
165164 /* assume we want to r/w real data by default */
166165 ioaddr += MEM_STNAND_DATA;
167166 }
168
- this->IO_ADDR_R = this->IO_ADDR_W = (void __iomem *)ioaddr;
167
+ this->legacy.IO_ADDR_R = this->legacy.IO_ADDR_W = (void __iomem *)ioaddr;
169168 if (cmd != NAND_CMD_NONE) {
170
- __raw_writeb(cmd, this->IO_ADDR_W);
169
+ __raw_writeb(cmd, this->legacy.IO_ADDR_W);
171170 wmb();
172171 }
173172 }
174173
175
-static int au1300_nand_device_ready(struct mtd_info *mtd)
174
+static int au1300_nand_device_ready(struct nand_chip *this)
176175 {
177176 return alchemy_rdsmem(AU1000_MEM_STSTAT) & 1;
178177 }
....@@ -440,6 +439,8 @@
440439
441440 static struct platform_device db1300_ide_dev = {
442441 .dev = {
442
+ .dma_mask = &au1300_all_dmamask,
443
+ .coherent_dma_mask = DMA_BIT_MASK(32),
443444 .platform_data = &db1300_ide_info,
444445 },
445446 .name = "pata_platform",
....@@ -449,6 +450,7 @@
449450
450451 /**********************************************************************/
451452
453
+#ifdef CONFIG_MMC_AU1X
452454 static irqreturn_t db1300_mmc_cd(int irq, void *ptr)
453455 {
454456 disable_irq_nosync(irq);
....@@ -457,14 +459,7 @@
457459
458460 static irqreturn_t db1300_mmc_cdfn(int irq, void *ptr)
459461 {
460
- void (*mmc_cd)(struct mmc_host *, unsigned long);
461
-
462
- /* link against CONFIG_MMC=m. We can only be called once MMC core has
463
- * initialized the controller, so symbol_get() should always succeed.
464
- */
465
- mmc_cd = symbol_get(mmc_detect_change);
466
- mmc_cd(ptr, msecs_to_jiffies(200));
467
- symbol_put(mmc_detect_change);
462
+ mmc_detect_change(ptr, msecs_to_jiffies(200));
468463
469464 msleep(100); /* debounce */
470465 if (irq == DB1300_SD1_INSERT_INT)
....@@ -562,7 +557,9 @@
562557
563558 static struct platform_device db1300_sd1_dev = {
564559 .dev = {
565
- .platform_data = &db1300_sd1_platdata,
560
+ .dma_mask = &au1300_all_dmamask,
561
+ .coherent_dma_mask = DMA_BIT_MASK(32),
562
+ .platform_data = &db1300_sd1_platdata,
566563 },
567564 .name = "au1xxx-mmc",
568565 .id = 1,
....@@ -627,13 +624,16 @@
627624
628625 static struct platform_device db1300_sd0_dev = {
629626 .dev = {
630
- .platform_data = &db1300_sd0_platdata,
627
+ .dma_mask = &au1300_all_dmamask,
628
+ .coherent_dma_mask = DMA_BIT_MASK(32),
629
+ .platform_data = &db1300_sd0_platdata,
631630 },
632631 .name = "au1xxx-mmc",
633632 .id = 0,
634633 .resource = au1300_sd0_res,
635634 .num_resources = ARRAY_SIZE(au1300_sd0_res),
636635 };
636
+#endif /* CONFIG_MMC_AU1X */
637637
638638 /**********************************************************************/
639639
....@@ -654,10 +654,18 @@
654654
655655 static struct platform_device db1300_sndac97_dev = {
656656 .name = "db1300-ac97",
657
+ .dev = {
658
+ .dma_mask = &au1300_all_dmamask,
659
+ .coherent_dma_mask = DMA_BIT_MASK(32),
660
+ },
657661 };
658662
659663 static struct platform_device db1300_sndi2s_dev = {
660664 .name = "db1300-i2s",
665
+ .dev = {
666
+ .dma_mask = &au1300_all_dmamask,
667
+ .coherent_dma_mask = DMA_BIT_MASK(32),
668
+ },
661669 };
662670
663671 /**********************************************************************/
....@@ -702,13 +710,12 @@
702710 }
703711 };
704712
705
-static u64 au1300_lcd_dmamask = DMA_BIT_MASK(32);
706713
707714 static struct platform_device db1300_lcd_dev = {
708715 .name = "au1200-lcd",
709716 .id = 0,
710717 .dev = {
711
- .dma_mask = &au1300_lcd_dmamask,
718
+ .dma_mask = &au1300_all_dmamask,
712719 .coherent_dma_mask = DMA_BIT_MASK(32),
713720 .platform_data = &db1300fb_pd,
714721 },
....@@ -718,6 +725,7 @@
718725
719726 /**********************************************************************/
720727
728
+#if IS_ENABLED(CONFIG_TOUCHSCREEN_WM97XX)
721729 static void db1300_wm97xx_irqen(struct wm97xx *wm, int enable)
722730 {
723731 if (enable)
....@@ -749,6 +757,12 @@
749757
750758 return wm97xx_register_mach_ops(wm, &db1300_wm97xx_ops);
751759 }
760
+#else
761
+static int db1300_wm97xx_probe(struct platform_device *pdev)
762
+{
763
+ return -ENODEV;
764
+}
765
+#endif
752766
753767 static struct platform_driver db1300_wm97xx_driver = {
754768 .driver.name = "wm97xx-touch",
....@@ -764,8 +778,10 @@
764778 &db1300_5waysw_dev,
765779 &db1300_nand_dev,
766780 &db1300_ide_dev,
781
+#ifdef CONFIG_MMC_AU1X
767782 &db1300_sd0_dev,
768783 &db1300_sd1_dev,
784
+#endif
769785 &db1300_lcd_dev,
770786 &db1300_ac97_dev,
771787 &db1300_i2s_dev,