[U-Boot] [PATCH 08/11] Blackfin: bf60x: add rsi/sdh support

Sonic Zhang
2013-03-05T02:22:00Z

Hi Wolfgang,

On Mon, Mar 4, 2013 at 7:21 PM, Wolfgang Denk <wd@denx.de> wrote:
> Dear Sonic Zhang,
>
> In message <CAJxxZ0O_OZk7w_CDfJkzPwDMFqwT1m-Yn_Bz6yzHRDFqT6wrBw@mail.gmail.com> you wrote:
>>
>> Maybe I didn't describe it clearly. Yes, I return 0 at the end of this
>> function. But, the same function may return UNUSABLE_ERR(-17) at the
>> beginning if the data flags match MMC_DATA_WRITE. That's why the
>> function can't return void. Is anything contradicting in my
>> explanation?
>
> I see. Sorry, I missed that other return.
>
> One additional question, though:
>
>> /* kick off transfer */
>> bfin_write_SDH_DATA_CTL(bfin_read_SDH_DATA_CTL() | DTX_DMA_E | DTX_E);
>>
>> - return ret;
>> + return 0;
>
> Are the bfin_read_SDH_DATA_CTL() and bfin_write_SDH_DATA_CTL()
> supposed to always work, i. e. are we positively sure that these can
> never fail, so there is no need to test the return code and handle
> error conditions?

Yes, bfin_write_XXX and bfin_read_XXX are simply defined as memory
access operations. They either succeed or cause hardware error
exception.

#define bfin_read_SDH_DATA_CTL() bfin_read16(SDH_DATA_CTL)
#define _bfin_readX(addr, size, asm_size, asm_ext) ({ \
u32 __v; \
__asm__ __volatile__( \
"%0 = " #asm_size "[%1]" #asm_ext ";" \
: "=d" (__v) \
: "a" (addr) \
); \
__v; })

Regards,

Sonic