hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/arch/mips/alchemy/devboards/db1000.c
....@@ -1,22 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * DBAu1000/1500/1100 PBAu1100/1500 board support
34 *
45 * Copyright 2000, 2008 MontaVista Software Inc.
56 * Author: MontaVista Software, Inc. <source@mvista.com>
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; either version 2 of the License, or
10
- * (at your option) any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
17
- * You should have received a copy of the GNU General Public License
18
- * along with this program; if not, write to the Free Software
19
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
207 */
218
229 #include <linux/clk.h>
....@@ -27,7 +14,6 @@
2714 #include <linux/interrupt.h>
2815 #include <linux/leds.h>
2916 #include <linux/mmc/host.h>
30
-#include <linux/module.h>
3117 #include <linux/platform_device.h>
3218 #include <linux/pm.h>
3319 #include <linux/spi/spi.h>
....@@ -82,6 +68,8 @@
8268 return -1;
8369 }
8470
71
+static u64 au1xxx_all_dmamask = DMA_BIT_MASK(32);
72
+
8573 static struct resource alchemy_pci_host_res[] = {
8674 [0] = {
8775 .start = AU1500_PCI_PHYS_ADDR,
....@@ -120,13 +108,11 @@
120108 }
121109 };
122110
123
-static u64 au1100_lcd_dmamask = DMA_BIT_MASK(32);
124
-
125111 static struct platform_device au1100_lcd_device = {
126112 .name = "au1100-lcd",
127113 .id = 0,
128114 .dev = {
129
- .dma_mask = &au1100_lcd_dmamask,
115
+ .dma_mask = &au1xxx_all_dmamask,
130116 .coherent_dma_mask = DMA_BIT_MASK(32),
131117 },
132118 .num_resources = ARRAY_SIZE(au1100_lcd_resources),
....@@ -170,18 +156,18 @@
170156
171157 static struct platform_device db1x00_audio_dev = {
172158 .name = "db1000-audio",
159
+ .dev = {
160
+ .dma_mask = &au1xxx_all_dmamask,
161
+ .coherent_dma_mask = DMA_BIT_MASK(32),
162
+ },
173163 };
174164
175165 /******************************************************************************/
176166
167
+#ifdef CONFIG_MMC_AU1X
177168 static irqreturn_t db1100_mmc_cd(int irq, void *ptr)
178169 {
179
- void (*mmc_cd)(struct mmc_host *, unsigned long);
180
- /* link against CONFIG_MMC=m */
181
- mmc_cd = symbol_get(mmc_detect_change);
182
- mmc_cd(ptr, msecs_to_jiffies(500));
183
- symbol_put(mmc_detect_change);
184
-
170
+ mmc_detect_change(ptr, msecs_to_jiffies(500));
185171 return IRQ_HANDLED;
186172 }
187173
....@@ -338,13 +324,11 @@
338324 }
339325 };
340326
341
-static u64 au1xxx_mmc_dmamask = DMA_BIT_MASK(32);
342
-
343327 static struct platform_device db1100_mmc0_dev = {
344328 .name = "au1xxx-mmc",
345329 .id = 0,
346330 .dev = {
347
- .dma_mask = &au1xxx_mmc_dmamask,
331
+ .dma_mask = &au1xxx_all_dmamask,
348332 .coherent_dma_mask = DMA_BIT_MASK(32),
349333 .platform_data = &db1100_mmc_platdata[0],
350334 },
....@@ -379,65 +363,14 @@
379363 .name = "au1xxx-mmc",
380364 .id = 1,
381365 .dev = {
382
- .dma_mask = &au1xxx_mmc_dmamask,
366
+ .dma_mask = &au1xxx_all_dmamask,
383367 .coherent_dma_mask = DMA_BIT_MASK(32),
384368 .platform_data = &db1100_mmc_platdata[1],
385369 },
386370 .num_resources = ARRAY_SIZE(au1100_mmc1_res),
387371 .resource = au1100_mmc1_res,
388372 };
389
-
390
-/******************************************************************************/
391
-
392
-static void db1000_irda_set_phy_mode(int mode)
393
-{
394
- unsigned short mask = BCSR_RESETS_IRDA_MODE_MASK | BCSR_RESETS_FIR_SEL;
395
-
396
- switch (mode) {
397
- case AU1000_IRDA_PHY_MODE_OFF:
398
- bcsr_mod(BCSR_RESETS, mask, BCSR_RESETS_IRDA_MODE_OFF);
399
- break;
400
- case AU1000_IRDA_PHY_MODE_SIR:
401
- bcsr_mod(BCSR_RESETS, mask, BCSR_RESETS_IRDA_MODE_FULL);
402
- break;
403
- case AU1000_IRDA_PHY_MODE_FIR:
404
- bcsr_mod(BCSR_RESETS, mask, BCSR_RESETS_IRDA_MODE_FULL |
405
- BCSR_RESETS_FIR_SEL);
406
- break;
407
- }
408
-}
409
-
410
-static struct au1k_irda_platform_data db1000_irda_platdata = {
411
- .set_phy_mode = db1000_irda_set_phy_mode,
412
-};
413
-
414
-static struct resource au1000_irda_res[] = {
415
- [0] = {
416
- .start = AU1000_IRDA_PHYS_ADDR,
417
- .end = AU1000_IRDA_PHYS_ADDR + 0x0fff,
418
- .flags = IORESOURCE_MEM,
419
- },
420
- [1] = {
421
- .start = AU1000_IRDA_TX_INT,
422
- .end = AU1000_IRDA_TX_INT,
423
- .flags = IORESOURCE_IRQ,
424
- },
425
- [2] = {
426
- .start = AU1000_IRDA_RX_INT,
427
- .end = AU1000_IRDA_RX_INT,
428
- .flags = IORESOURCE_IRQ,
429
- },
430
-};
431
-
432
-static struct platform_device db1000_irda_dev = {
433
- .name = "au1000-irda",
434
- .id = -1,
435
- .dev = {
436
- .platform_data = &db1000_irda_platdata,
437
- },
438
- .resource = au1000_irda_res,
439
- .num_resources = ARRAY_SIZE(au1000_irda_res),
440
-};
373
+#endif /* CONFIG_MMC_AU1X */
441374
442375 /******************************************************************************/
443376
....@@ -468,6 +401,8 @@
468401 .id = 0,
469402 .dev = {
470403 .platform_data = &db1100_spictl_pd,
404
+ .dma_mask = &au1xxx_all_dmamask,
405
+ .coherent_dma_mask = DMA_BIT_MASK(32),
471406 },
472407 };
473408
....@@ -497,15 +432,12 @@
497432 &db1x00_audio_dev,
498433 };
499434
500
-static struct platform_device *db1000_devs[] = {
501
- &db1000_irda_dev,
502
-};
503
-
504435 static struct platform_device *db1100_devs[] = {
505436 &au1100_lcd_device,
437
+#ifdef CONFIG_MMC_AU1X
506438 &db1100_mmc0_dev,
507439 &db1100_mmc1_dev,
508
- &db1000_irda_dev,
440
+#endif
509441 };
510442
511443 int __init db1000_dev_setup(void)
....@@ -565,7 +497,6 @@
565497 d1 = 3; /* GPIO number, NOT irq! */
566498 s0 = AU1000_GPIO1_INT;
567499 s1 = AU1000_GPIO4_INT;
568
- platform_add_devices(db1000_devs, ARRAY_SIZE(db1000_devs));
569500 } else if ((board == BCSR_WHOAMI_PB1500) ||
570501 (board == BCSR_WHOAMI_PB1500R2)) {
571502 c0 = AU1500_GPIO203_INT;