aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/alchemy/devboards/db1550.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/alchemy/devboards/db1550.c')
-rw-r--r--arch/mips/alchemy/devboards/db1550.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/arch/mips/alchemy/devboards/db1550.c b/arch/mips/alchemy/devboards/db1550.c
index bbd8d9884702..7e89936f763e 100644
--- a/arch/mips/alchemy/devboards/db1550.c
+++ b/arch/mips/alchemy/devboards/db1550.c
@@ -4,6 +4,7 @@
4 * (c) 2011 Manuel Lauss <manuel.lauss@googlemail.com> 4 * (c) 2011 Manuel Lauss <manuel.lauss@googlemail.com>
5 */ 5 */
6 6
7#include <linux/clk.h>
7#include <linux/dma-mapping.h> 8#include <linux/dma-mapping.h>
8#include <linux/gpio.h> 9#include <linux/gpio.h>
9#include <linux/i2c.h> 10#include <linux/i2c.h>
@@ -31,16 +32,16 @@
31static void __init db1550_hw_setup(void) 32static void __init db1550_hw_setup(void)
32{ 33{
33 void __iomem *base; 34 void __iomem *base;
35 unsigned long v;
34 36
35 /* complete SPI setup: link psc0_intclk to a 48MHz source, 37 /* complete SPI setup: link psc0_intclk to a 48MHz source,
36 * and assign GPIO16 to PSC0_SYNC1 (SPI cs# line) as well as PSC1_SYNC 38 * and assign GPIO16 to PSC0_SYNC1 (SPI cs# line) as well as PSC1_SYNC
37 * for AC97 on PB1550. 39 * for AC97 on PB1550.
38 */ 40 */
39 base = (void __iomem *)SYS_CLKSRC; 41 v = alchemy_rdsys(AU1000_SYS_CLKSRC);
40 __raw_writel(__raw_readl(base) | 0x000001e0, base); 42 alchemy_wrsys(v | 0x000001e0, AU1000_SYS_CLKSRC);
41 base = (void __iomem *)SYS_PINFUNC; 43 v = alchemy_rdsys(AU1000_SYS_PINFUNC);
42 __raw_writel(__raw_readl(base) | 1 | SYS_PF_PSC1_S1, base); 44 alchemy_wrsys(v | 1 | SYS_PF_PSC1_S1, AU1000_SYS_PINFUNC);
43 wmb();
44 45
45 /* reset the AC97 codec now, the reset time in the psc-ac97 driver 46 /* reset the AC97 codec now, the reset time in the psc-ac97 driver
46 * is apparently too short although it's ridiculous as it is. 47 * is apparently too short although it's ridiculous as it is.
@@ -151,7 +152,7 @@ static void au1550_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
151 152
152static int au1550_nand_device_ready(struct mtd_info *mtd) 153static int au1550_nand_device_ready(struct mtd_info *mtd)
153{ 154{
154 return __raw_readl((void __iomem *)MEM_STSTAT) & 1; 155 return alchemy_rdsmem(AU1000_MEM_STSTAT) & 1;
155} 156}
156 157
157static struct mtd_partition db1550_nand_parts[] = { 158static struct mtd_partition db1550_nand_parts[] = {
@@ -217,7 +218,7 @@ static struct platform_device pb1550_nand_dev = {
217 218
218static void __init pb1550_nand_setup(void) 219static void __init pb1550_nand_setup(void)
219{ 220{
220 int boot_swapboot = (au_readl(MEM_STSTAT) & (0x7 << 1)) | 221 int boot_swapboot = (alchemy_rdsmem(AU1000_MEM_STSTAT) & (0x7 << 1)) |
221 ((bcsr_read(BCSR_STATUS) >> 6) & 0x1); 222 ((bcsr_read(BCSR_STATUS) >> 6) & 0x1);
222 223
223 gpio_direction_input(206); /* de-assert NAND CS# */ 224 gpio_direction_input(206); /* de-assert NAND CS# */
@@ -574,6 +575,7 @@ static void __init pb1550_devices(void)
574int __init db1550_dev_setup(void) 575int __init db1550_dev_setup(void)
575{ 576{
576 int swapped, id; 577 int swapped, id;
578 struct clk *c;
577 579
578 id = (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)) != BCSR_WHOAMI_DB1550); 580 id = (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)) != BCSR_WHOAMI_DB1550);
579 581
@@ -582,6 +584,17 @@ int __init db1550_dev_setup(void)
582 spi_register_board_info(db1550_spi_devs, 584 spi_register_board_info(db1550_spi_devs,
583 ARRAY_SIZE(db1550_i2c_devs)); 585 ARRAY_SIZE(db1550_i2c_devs));
584 586
587 c = clk_get(NULL, "psc0_intclk");
588 if (!IS_ERR(c)) {
589 clk_prepare_enable(c);
590 clk_put(c);
591 }
592 c = clk_get(NULL, "psc2_intclk");
593 if (!IS_ERR(c)) {
594 clk_prepare_enable(c);
595 clk_put(c);
596 }
597
585 /* Audio PSC clock is supplied by codecs (PSC1, 3) FIXME: platdata!! */ 598 /* Audio PSC clock is supplied by codecs (PSC1, 3) FIXME: platdata!! */
586 __raw_writel(PSC_SEL_CLK_SERCLK, 599 __raw_writel(PSC_SEL_CLK_SERCLK,
587 (void __iomem *)KSEG1ADDR(AU1550_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET); 600 (void __iomem *)KSEG1ADDR(AU1550_PSC1_PHYS_ADDR) + PSC_SEL_OFFSET);