[U-Boot] [PATCH] MCI support for AT91 family processors.

Albin Tonnerre albin.tonnerre at free-electrons.com
Thu Sep 10 15:05:32 CEST 2009


[Ccing Haavard, as he's the maintainer for the atmel_mci driver]

Hi Sami,

On Sat, 29 Aug 2009 20:18 +0300, Sami Kantoluoto wrote :
> Fixed to parse CSD correctly on little endian processors as gcc orders
> bitfields differently between big and little endian ones.
> 
> Signed-off-by: Sami Kantoluoto <sami.kantoluoto at embedtronics.fi>

>  static void mmc_dump_cid(const struct mmc_cid *cid)
>  {
>  	printf("Manufacturer ID:       %02X\n", cid->mid);
> @@ -298,7 +345,7 @@ static void mmc_dump_csd(const struct mmc_csd *csd)
>  {
>  	unsigned long *csd_raw = (unsigned long *)csd;
>  	printf("CSD data: %08lx %08lx %08lx %08lx\n",
> -	       csd_raw[0], csd_raw[1], csd_raw[2], csd_raw[3]);
> +	       ntohl(csd_raw[0]), ntohl(csd_raw[1]), ntohl(csd_raw[2]), ntohl(csd_raw[3]));

I guess it's mostly a matter of preference, but I'd tend to use be32_to_cpu for
things that aren't network-related.

>  	printf("CSD structure version:   1.%u\n", csd->csd_structure);
>  	printf("MMC System Spec version: %u\n", csd->spec_vers);
>  	printf("Card command classes:    %03x\n", csd->ccc);
> @@ -368,7 +415,7 @@ static int sd_init_card(struct mmc_cid *cid, int verbose)
>  
>  	/* Get RCA of the card that responded */
>  	ret = mmc_cmd(SD_CMD_SEND_RELATIVE_ADDR, 0, resp, R6 | NCR);
> -	if (ret)
> +  	if (ret)
>  		return ret;

Looks like a random whitespace change, it's generally best to avoid that.

>  	mmc_rca = resp[0] >> 16;
> @@ -468,6 +515,7 @@ int mmc_legacy_init(int verbose)
>  	struct mmc_cid cid;
>  	struct mmc_csd csd;
>  	unsigned int max_blksz;
> +	unsigned long resp[4];
>  	int ret;
>  
>  	/* Initialize controller */
> @@ -488,9 +536,10 @@ int mmc_legacy_init(int verbose)
>  		return ret;
>  
>  	/* Get CSD from the card */
> -	ret = mmc_cmd(MMC_CMD_SEND_CSD, mmc_rca << 16, &csd, R2 | NCR);
> +	ret = mmc_cmd(MMC_CMD_SEND_CSD, mmc_rca << 16, resp, R2 | NCR);
>  	if (ret)
>  		return ret;
> +	mmc_parse_csd(&csd, resp);
>  	if (verbose)
>  		mmc_dump_csd(&csd);
>  
> diff --git a/include/asm-arm/arch-at91/clk.h b/include/asm-arm/arch-at91/clk.h
> index f642dd9..26b537c 100644
> --- a/include/asm-arm/arch-at91/clk.h
> +++ b/include/asm-arm/arch-at91/clk.h
> @@ -54,6 +54,11 @@ static inline unsigned long get_spi_clk_rate(unsigned int dev_id)
>  	return get_mck_clk_rate();
>  }
>  
> +static inline unsigned long get_mci_clk_rate(void)
> +{
> +	return get_mck_clk_rate();
> +}
> +
>  static inline unsigned long get_twi_clk_rate(unsigned int dev_id)
>  {
>  	return get_mck_clk_rate();

Please remove this part, as it's not related to the bug you're fixing in
atmel_mci − and that's part of the AT91 MCI support patch I sent anyway :)

Other than that, I've tried it on my AT91-based boards and that works fine.
Thanks!

Tested-by: Albin Tonnerre <albin.tonnerre at free-electrons.com>

Regards,
-- 
Albin Tonnerre, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com


More information about the U-Boot mailing list