Peter Pearse | dcbfd2e | 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) { |
Jean-Christophe PLAGNIOL-VILLARD | 90a92a7 | 2009-03-27 23:26:42 +0100 | [diff] [blame] | 7 | AT91C_BASE_PIOB->PIO_PER = CONFIG_SYS_DATAFLASH_MMC_PIO; /* Set in PIO mode */ |
| 8 | AT91C_BASE_PIOB->PIO_OER = CONFIG_SYS_DATAFLASH_MMC_PIO; /* Configure in output */ |
Peter Pearse | dcbfd2e | 2007-08-14 10:14:05 +0100 | [diff] [blame] | 9 | |
| 10 | |
Jean-Christophe PLAGNIOL-VILLARD | 2a325ce | 2009-03-27 23:26:42 +0100 | [diff] [blame] | 11 | if(AT91C_BASE_PIOB->PIO_ODSR & CONFIG_SYS_DATAFLASH_MMC_PIO) |
Peter Pearse | dcbfd2e | 2007-08-14 10:14:05 +0100 | [diff] [blame] | 12 | return 1; |
Jean-Christophe PLAGNIOL-VILLARD | 2a325ce | 2009-03-27 23:26:42 +0100 | [diff] [blame] | 13 | |
Peter Pearse | dcbfd2e | 2007-08-14 10:14:05 +0100 | [diff] [blame] | 14 | return 0; |
| 15 | } |
| 16 | |
| 17 | void AT91F_SelectMMC(void) { |
Jean-Christophe PLAGNIOL-VILLARD | 90a92a7 | 2009-03-27 23:26:42 +0100 | [diff] [blame] | 18 | AT91C_BASE_PIOB->PIO_PER = CONFIG_SYS_DATAFLASH_MMC_PIO; /* Set in PIO mode */ |
| 19 | AT91C_BASE_PIOB->PIO_OER = CONFIG_SYS_DATAFLASH_MMC_PIO; /* Configure in output */ |
Peter Pearse | dcbfd2e | 2007-08-14 10:14:05 +0100 | [diff] [blame] | 20 | /* Set Output */ |
Jean-Christophe PLAGNIOL-VILLARD | 90a92a7 | 2009-03-27 23:26:42 +0100 | [diff] [blame] | 21 | AT91C_BASE_PIOB->PIO_SODR = CONFIG_SYS_DATAFLASH_MMC_PIO; |
Peter Pearse | dcbfd2e | 2007-08-14 10:14:05 +0100 | [diff] [blame] | 22 | } |
| 23 | |
| 24 | void AT91F_SelectSPI(void) { |
Jean-Christophe PLAGNIOL-VILLARD | 90a92a7 | 2009-03-27 23:26:42 +0100 | [diff] [blame] | 25 | AT91C_BASE_PIOB->PIO_PER = CONFIG_SYS_DATAFLASH_MMC_PIO; /* Set in PIO mode */ |
| 26 | AT91C_BASE_PIOB->PIO_OER = CONFIG_SYS_DATAFLASH_MMC_PIO; /* Configure in output */ |
Peter Pearse | dcbfd2e | 2007-08-14 10:14:05 +0100 | [diff] [blame] | 27 | /* Clear Output */ |
Jean-Christophe PLAGNIOL-VILLARD | 90a92a7 | 2009-03-27 23:26:42 +0100 | [diff] [blame] | 28 | AT91C_BASE_PIOB->PIO_CODR = CONFIG_SYS_DATAFLASH_MMC_PIO; |
Peter Pearse | dcbfd2e | 2007-08-14 10:14:05 +0100 | [diff] [blame] | 29 | } |