]> git.ipfire.org Git - people/ms/u-boot.git/blob - board/atmel/at91rm9200ek/mux.c
bdd44e8cf73ef9cc0e7b407b1f74d6cac9905f34
[people/ms/u-boot.git] / board / atmel / at91rm9200ek / mux.c
1 #include <config.h>
2 #include <common.h>
3 #include <asm/hardware.h>
4 #include <asm/io.h>
5 #include <dataflash.h>
6
7 int AT91F_GetMuxStatus(void)
8 {
9 /* Set in PIO mode */
10 writel(CONFIG_SYS_DATAFLASH_MMC_PIO, AT91C_BASE_PIOB->PIO_PER);
11 /* Configure in output */
12 writel(CONFIG_SYS_DATAFLASH_MMC_PIO, AT91C_BASE_PIOB->PIO_OER);
13
14 if(readl(AT91C_BASE_PIOB->PIO_ODSR) & CONFIG_SYS_DATAFLASH_MMC_PIO)
15 return 1;
16
17 return 0;
18 }
19
20 void AT91F_SelectMMC(void)
21 {
22 /* Set in PIO mode */
23 writel(CONFIG_SYS_DATAFLASH_MMC_PIO, AT91C_BASE_PIOB->PIO_PER);
24 /* Configure in output */
25 writel(CONFIG_SYS_DATAFLASH_MMC_PIO, AT91C_BASE_PIOB->PIO_OER);
26 /* Set Output */
27 writel(CONFIG_SYS_DATAFLASH_MMC_PIO, AT91C_BASE_PIOB->PIO_SODR);
28 }
29
30 void AT91F_SelectSPI(void)
31 {
32 /* Set in PIO mode */
33 writel(CONFIG_SYS_DATAFLASH_MMC_PIO, AT91C_BASE_PIOB->PIO_PER);
34 /* Configure in output */
35 writel(CONFIG_SYS_DATAFLASH_MMC_PIO, AT91C_BASE_PIOB->PIO_OER);
36 /* Clear Output */
37 writel(CONFIG_SYS_DATAFLASH_MMC_PIO, AT91C_BASE_PIOB->PIO_CODR);
38 }