From 1762f13b4aab88b685b1722f17dada247945624b Mon Sep 17 00:00:00 2001 From: Jean-Christophe PLAGNIOL-VILLARD Date: Mon, 31 Mar 2008 21:20:49 +0200 Subject: AT91SAM9: Move CONFIG_HAS_DATAFLASH to Makefile Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD diff --git a/cpu/arm926ejs/at91sam9/Makefile b/cpu/arm926ejs/at91sam9/Makefile index bf15e1e..203abc2 100644 --- a/cpu/arm926ejs/at91sam9/Makefile +++ b/cpu/arm926ejs/at91sam9/Makefile @@ -25,11 +25,14 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(SOC).a -COBJS = ether.o timer.o spi.o usb.o +COBJS-y += ether.o +COBJS-y += timer.o +COBJS-$(CONFIG_HAS_DATAFLASH) +=spi.o +COBJS-y += usb.o SOBJS = lowlevel_init.o -SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) -OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) +SRCS := $(SOBJS:.o=.S) $(COBJS-y:.o=.c) +OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS-y)) all: $(obj).depend $(LIB) diff --git a/cpu/arm926ejs/at91sam9/spi.c b/cpu/arm926ejs/at91sam9/spi.c index c819608..c9fe6d8 100644 --- a/cpu/arm926ejs/at91sam9/spi.c +++ b/cpu/arm926ejs/at91sam9/spi.c @@ -26,7 +26,6 @@ #include #include -#ifdef CONFIG_HAS_DATAFLASH #include #define AT91_SPI_PCS0_DATAFLASH_CARD 0xE /* Chip Select 0: NPCS0%1110 */ @@ -85,6 +84,7 @@ void AT91F_SpiInit(void) void AT91F_SpiEnable(int cs) { unsigned long mode; + switch (cs) { case 0: /* Configure SPI CS0 for Serial DataFlash AT45DBxx */ mode = readl(AT91_BASE_SPI + AT91_SPI_MR); @@ -116,12 +116,10 @@ unsigned int AT91F_SpiWrite(AT91PS_DataflashDesc pDesc) { unsigned int timeout; - pDesc->state = BUSY; writel(AT91_SPI_TXTDIS + AT91_SPI_RXTDIS, AT91_BASE_SPI + AT91_SPI_PTCR); - /* Initialize the Transmit and Receive Pointer */ writel((unsigned int)pDesc->rx_cmd_pt, AT91_BASE_SPI + AT91_SPI_RPR); writel((unsigned int)pDesc->tx_cmd_pt, AT91_BASE_SPI + AT91_SPI_TPR); @@ -157,4 +155,3 @@ unsigned int AT91F_SpiWrite(AT91PS_DataflashDesc pDesc) return DATAFLASH_OK; } -#endif -- cgit v0.10.2