Peter Pearse | 051c257 | 2007-08-14 10:14:05 +0100 | [diff] [blame] | 1 | #include <config.h> |
| 2 | #include <common.h> |
| 3 | #include <asm/hardware.h> |
| 4 | #include <dataflash.h> |
| 5 | |
| 6 | int 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 | |
| 21 | void 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 Denk | 0611c49 | 2007-08-14 18:42:36 +0200 | [diff] [blame] | 26 | AT91C_BASE_PIOB->PIO_SODR = DATAFLASH_MMC_SELECT; |
| 27 | #endif |
Peter Pearse | 051c257 | 2007-08-14 10:14:05 +0100 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | void 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 Denk | 0611c49 | 2007-08-14 18:42:36 +0200 | [diff] [blame] | 35 | AT91C_BASE_PIOB->PIO_CODR = DATAFLASH_MMC_SELECT; |
| 36 | #endif |
Peter Pearse | 051c257 | 2007-08-14 10:14:05 +0100 | [diff] [blame] | 37 | } |