aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/alchemy
diff options
context:
space:
mode:
authorManuel Lauss <manuel.lauss@googlemail.com>2011-12-08 05:42:15 -0500
committerRalf Baechle <ralf@linux-mips.org>2011-12-08 05:42:15 -0500
commite734ae13f125096f8467f90e00c27166860245cd (patch)
tree90b334383398e58dcaface5ed7696b62d9fbf717 /arch/mips/alchemy
parentcd671c16f0b18c83d949218867b2d88583080b36 (diff)
MIPS: Alchemy: Hook up IrDA on DB1000/DB1100
Add necessary transceiver control platform data and hook up the IrDA peripheral on the DB1000 and DB1100 boards. Signed-off-by: Manuel Lauss <manuel.lauss@googlemail.com> To: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/2878/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/alchemy')
-rw-r--r--arch/mips/alchemy/devboards/db1000.c74
1 files changed, 57 insertions, 17 deletions
diff --git a/arch/mips/alchemy/devboards/db1000.c b/arch/mips/alchemy/devboards/db1000.c
index a3a448033037..5206d2fbe0c6 100644
--- a/arch/mips/alchemy/devboards/db1000.c
+++ b/arch/mips/alchemy/devboards/db1000.c
@@ -66,23 +66,6 @@ void __init board_setup(void)
66 DB1000_BCSR_PHYS_ADDR + DB1000_BCSR_HEXLED_OFS); 66 DB1000_BCSR_PHYS_ADDR + DB1000_BCSR_HEXLED_OFS);
67 67
68 printk(KERN_INFO "AMD Alchemy %s Board\n", board_type_str()); 68 printk(KERN_INFO "AMD Alchemy %s Board\n", board_type_str());
69
70#if defined(CONFIG_IRDA) && defined(CONFIG_AU1000_FIR)
71 {
72 u32 pin_func;
73
74 /* Set IRFIRSEL instead of GPIO15 */
75 pin_func = au_readl(SYS_PINFUNC) | SYS_PF_IRF;
76 au_writel(pin_func, SYS_PINFUNC);
77 /* Power off until the driver is in use */
78 bcsr_mod(BCSR_RESETS, BCSR_RESETS_IRDA_MODE_MASK,
79 BCSR_RESETS_IRDA_MODE_OFF);
80 }
81#endif
82 bcsr_write(BCSR_PCMCIA, 0); /* turn off PCMCIA power */
83
84 /* Enable GPIO[31:0] inputs */
85 alchemy_gpio1_input_enable();
86} 69}
87 70
88 71
@@ -389,6 +372,57 @@ static struct platform_device db1100_mmc1_dev = {
389 .resource = au1100_mmc1_res, 372 .resource = au1100_mmc1_res,
390}; 373};
391 374
375/******************************************************************************/
376
377static void db1000_irda_set_phy_mode(int mode)
378{
379 unsigned short mask = BCSR_RESETS_IRDA_MODE_MASK | BCSR_RESETS_FIR_SEL;
380
381 switch (mode) {
382 case AU1000_IRDA_PHY_MODE_OFF:
383 bcsr_mod(BCSR_RESETS, mask, BCSR_RESETS_IRDA_MODE_OFF);
384 break;
385 case AU1000_IRDA_PHY_MODE_SIR:
386 bcsr_mod(BCSR_RESETS, mask, BCSR_RESETS_IRDA_MODE_FULL);
387 break;
388 case AU1000_IRDA_PHY_MODE_FIR:
389 bcsr_mod(BCSR_RESETS, mask, BCSR_RESETS_IRDA_MODE_FULL |
390 BCSR_RESETS_FIR_SEL);
391 break;
392 }
393}
394
395static struct au1k_irda_platform_data db1000_irda_platdata = {
396 .set_phy_mode = db1000_irda_set_phy_mode,
397};
398
399static struct resource au1000_irda_res[] = {
400 [0] = {
401 .start = AU1000_IRDA_PHYS_ADDR,
402 .end = AU1000_IRDA_PHYS_ADDR + 0x0fff,
403 .flags = IORESOURCE_MEM,
404 },
405 [1] = {
406 .start = AU1000_IRDA_TX_INT,
407 .end = AU1000_IRDA_TX_INT,
408 .flags = IORESOURCE_IRQ,
409 },
410 [2] = {
411 .start = AU1000_IRDA_RX_INT,
412 .end = AU1000_IRDA_RX_INT,
413 .flags = IORESOURCE_IRQ,
414 },
415};
416
417static struct platform_device db1000_irda_dev = {
418 .name = "au1000-irda",
419 .id = -1,
420 .dev = {
421 .platform_data = &db1000_irda_platdata,
422 },
423 .resource = au1000_irda_res,
424 .num_resources = ARRAY_SIZE(au1000_irda_res),
425};
392 426
393static struct platform_device *db1x00_devs[] = { 427static struct platform_device *db1x00_devs[] = {
394 &db1x00_codec_dev, 428 &db1x00_codec_dev,
@@ -397,10 +431,15 @@ static struct platform_device *db1x00_devs[] = {
397 &db1x00_audio_dev, 431 &db1x00_audio_dev,
398}; 432};
399 433
434static struct platform_device *db1000_devs[] = {
435 &db1000_irda_dev,
436};
437
400static struct platform_device *db1100_devs[] = { 438static struct platform_device *db1100_devs[] = {
401 &au1100_lcd_device, 439 &au1100_lcd_device,
402 &db1100_mmc0_dev, 440 &db1100_mmc0_dev,
403 &db1100_mmc1_dev, 441 &db1100_mmc1_dev,
442 &db1000_irda_dev,
404}; 443};
405 444
406static int __init db1000_dev_init(void) 445static int __init db1000_dev_init(void)
@@ -434,6 +473,7 @@ static int __init db1000_dev_init(void)
434 d1 = AU1000_GPIO3_INT; 473 d1 = AU1000_GPIO3_INT;
435 s0 = AU1000_GPIO1_INT; 474 s0 = AU1000_GPIO1_INT;
436 s1 = AU1000_GPIO4_INT; 475 s1 = AU1000_GPIO4_INT;
476 platform_add_devices(db1000_devs, ARRAY_SIZE(db1000_devs));
437 } else 477 } else
438 return 0; /* unknown board, no further dev setup to do */ 478 return 0; /* unknown board, no further dev setup to do */
439 479