forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
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>
....@@ -82,6 +69,8 @@
8269 return -1;
8370 }
8471
72
+static u64 au1xxx_all_dmamask = DMA_BIT_MASK(32);
73
+
8574 static struct resource alchemy_pci_host_res[] = {
8675 [0] = {
8776 .start = AU1500_PCI_PHYS_ADDR,
....@@ -120,13 +109,11 @@
120109 }
121110 };
122111
123
-static u64 au1100_lcd_dmamask = DMA_BIT_MASK(32);
124
-
125112 static struct platform_device au1100_lcd_device = {
126113 .name = "au1100-lcd",
127114 .id = 0,
128115 .dev = {
129
- .dma_mask = &au1100_lcd_dmamask,
116
+ .dma_mask = &au1xxx_all_dmamask,
130117 .coherent_dma_mask = DMA_BIT_MASK(32),
131118 },
132119 .num_resources = ARRAY_SIZE(au1100_lcd_resources),
....@@ -170,6 +157,10 @@
170157
171158 static struct platform_device db1x00_audio_dev = {
172159 .name = "db1000-audio",
160
+ .dev = {
161
+ .dma_mask = &au1xxx_all_dmamask,
162
+ .coherent_dma_mask = DMA_BIT_MASK(32),
163
+ },
173164 };
174165
175166 /******************************************************************************/
....@@ -338,13 +329,11 @@
338329 }
339330 };
340331
341
-static u64 au1xxx_mmc_dmamask = DMA_BIT_MASK(32);
342
-
343332 static struct platform_device db1100_mmc0_dev = {
344333 .name = "au1xxx-mmc",
345334 .id = 0,
346335 .dev = {
347
- .dma_mask = &au1xxx_mmc_dmamask,
336
+ .dma_mask = &au1xxx_all_dmamask,
348337 .coherent_dma_mask = DMA_BIT_MASK(32),
349338 .platform_data = &db1100_mmc_platdata[0],
350339 },
....@@ -379,64 +368,12 @@
379368 .name = "au1xxx-mmc",
380369 .id = 1,
381370 .dev = {
382
- .dma_mask = &au1xxx_mmc_dmamask,
371
+ .dma_mask = &au1xxx_all_dmamask,
383372 .coherent_dma_mask = DMA_BIT_MASK(32),
384373 .platform_data = &db1100_mmc_platdata[1],
385374 },
386375 .num_resources = ARRAY_SIZE(au1100_mmc1_res),
387376 .resource = au1100_mmc1_res,
388
-};
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),
440377 };
441378
442379 /******************************************************************************/
....@@ -468,6 +405,8 @@
468405 .id = 0,
469406 .dev = {
470407 .platform_data = &db1100_spictl_pd,
408
+ .dma_mask = &au1xxx_all_dmamask,
409
+ .coherent_dma_mask = DMA_BIT_MASK(32),
471410 },
472411 };
473412
....@@ -497,15 +436,10 @@
497436 &db1x00_audio_dev,
498437 };
499438
500
-static struct platform_device *db1000_devs[] = {
501
- &db1000_irda_dev,
502
-};
503
-
504439 static struct platform_device *db1100_devs[] = {
505440 &au1100_lcd_device,
506441 &db1100_mmc0_dev,
507442 &db1100_mmc1_dev,
508
- &db1000_irda_dev,
509443 };
510444
511445 int __init db1000_dev_setup(void)
....@@ -565,7 +499,6 @@
565499 d1 = 3; /* GPIO number, NOT irq! */
566500 s0 = AU1000_GPIO1_INT;
567501 s1 = AU1000_GPIO4_INT;
568
- platform_add_devices(db1000_devs, ARRAY_SIZE(db1000_devs));
569502 } else if ((board == BCSR_WHOAMI_PB1500) ||
570503 (board == BCSR_WHOAMI_PB1500R2)) {
571504 c0 = AU1500_GPIO203_INT;