blob: 767d28090d18e757b4df80fed6aa05017072acd6 [file] [log] [blame]
Peter Pearsedcbfd2e2007-08-14 10:14:05 +01001#include <config.h>
2#include <common.h>
3#include <asm/hardware.h>
4#include <dataflash.h>
5
6int AT91F_GetMuxStatus(void) {
7#ifdef DATAFLASH_MMC_SELECT
8 AT91C_BASE_PIOB->PIO_PER = DATAFLASH_MMC_SELECT; /* Set in PIO mode */
9 AT91C_BASE_PIOB->PIO_OER = DATAFLASH_MMC_SELECT; /* Configure in output */
10
11
12 if(AT91C_BASE_PIOB->PIO_ODSR & DATAFLASH_MMC_SELECT) {
13 return 1;
14 } else {
15 return 0;
16 }
17#endif
18 return 0;
19}
20
21void AT91F_SelectMMC(void) {
22#ifdef DATAFLASH_MMC_SELECT
23 AT91C_BASE_PIOB->PIO_PER = DATAFLASH_MMC_SELECT; /* Set in PIO mode */
24 AT91C_BASE_PIOB->PIO_OER = DATAFLASH_MMC_SELECT; /* Configure in output */
25 /* Set Output */
Wolfgang Denkf01dbb52007-08-14 18:42:36 +020026 AT91C_BASE_PIOB->PIO_SODR = DATAFLASH_MMC_SELECT;
27#endif
Peter Pearsedcbfd2e2007-08-14 10:14:05 +010028}
29
30void AT91F_SelectSPI(void) {
31#ifdef DATAFLASH_MMC_SELECT
32 AT91C_BASE_PIOB->PIO_PER = DATAFLASH_MMC_SELECT; /* Set in PIO mode */
33 AT91C_BASE_PIOB->PIO_OER = DATAFLASH_MMC_SELECT; /* Configure in output */
34 /* Clear Output */
Wolfgang Denkf01dbb52007-08-14 18:42:36 +020035 AT91C_BASE_PIOB->PIO_CODR = DATAFLASH_MMC_SELECT;
36#endif
Peter Pearsedcbfd2e2007-08-14 10:14:05 +010037}