blob: a00563ede870bb0355fbce504147c834553cb0be [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) {
Jean-Christophe PLAGNIOL-VILLARD90a92a72009-03-27 23:26:42 +01007 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 Pearsedcbfd2e2007-08-14 10:14:05 +01009
10
Jean-Christophe PLAGNIOL-VILLARD2a325ce2009-03-27 23:26:42 +010011 if(AT91C_BASE_PIOB->PIO_ODSR & CONFIG_SYS_DATAFLASH_MMC_PIO)
Peter Pearsedcbfd2e2007-08-14 10:14:05 +010012 return 1;
Jean-Christophe PLAGNIOL-VILLARD2a325ce2009-03-27 23:26:42 +010013
Peter Pearsedcbfd2e2007-08-14 10:14:05 +010014 return 0;
15}
16
17void AT91F_SelectMMC(void) {
Jean-Christophe PLAGNIOL-VILLARD90a92a72009-03-27 23:26:42 +010018 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 Pearsedcbfd2e2007-08-14 10:14:05 +010020 /* Set Output */
Jean-Christophe PLAGNIOL-VILLARD90a92a72009-03-27 23:26:42 +010021 AT91C_BASE_PIOB->PIO_SODR = CONFIG_SYS_DATAFLASH_MMC_PIO;
Peter Pearsedcbfd2e2007-08-14 10:14:05 +010022}
23
24void AT91F_SelectSPI(void) {
Jean-Christophe PLAGNIOL-VILLARD90a92a72009-03-27 23:26:42 +010025 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 Pearsedcbfd2e2007-08-14 10:14:05 +010027 /* Clear Output */
Jean-Christophe PLAGNIOL-VILLARD90a92a72009-03-27 23:26:42 +010028 AT91C_BASE_PIOB->PIO_CODR = CONFIG_SYS_DATAFLASH_MMC_PIO;
Peter Pearsedcbfd2e2007-08-14 10:14:05 +010029}