Google
  Web www.spinics.net

Re: interfacing FPGA to AT91RM9200

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On Wed, Sep 03, 2008 at 11:37:08AM +0530, Manila Goel wrote:
> As u hv suggested i hv configured EBI and SMC as under:
> 
> int __iomem *addPtr;        // probably should be volatile!
> #define BASE_ADDRESS 0x50000000
> AT91_SYS->EBI_CSA &= 0xffffffef;
> AT91_SYS->EBI_CFGR &= 0xfffffffe;
> 
> AT91_SYS->EBI_SMC2_CSR[4]=(AT91C_SMC2_NWS&0x01)|AT91C_SMC2_WSEN|AT91C_SMC2_BAT|AT91C_SMC2_DBW_16;
> addPtr=(int __iomem*)ioremap(BASE_ADDRESS,4);
> writew(data,addPtr);

Umm, no.  Firstly, casts for the hell of it are bad.  Really, they are.
Don't use casts lightly.  If you have to put a cast in, THINK very
carefully.

Secondly, you're not checking the return value of ioremap.  Typical
embedded programmers. 8)

	void __iomem *ptr = ioremap(BASE_ADDRESS, 4);
	if (ptr)
		writew(data, ptr);

is all that you need.

(as for your problem, I can't help you with that.)

-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php

[Site Home]     [Linux ARM Kernel]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Tools]     [DDR & Rambus]     [Monitors]

Add to Google Google PageRank Checking tool