lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <C59CB72C-E949-470A-A6F3-82AC4004AD16@marvell.com>
Date:	Mon, 14 May 2012 07:08:35 -0700
From:	Philip Rakity <prakity@...vell.com>
To:	Yong Ding <yongd@...vell.com>
CC:	"cjb@...top.org" <cjb@...top.org>,
	"linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
	"ohad@...ery.com" <ohad@...ery.com>,
	"linus.walleij@...aro.org" <linus.walleij@...aro.org>,
	"ulf.hansson@...ricsson.com" <ulf.hansson@...ricsson.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mmc:sdio:guarantee setting card data bus width as 4-bit


ACK

but see below for printk change


On May 14, 2012, at 1:35 AM, yongd wrote:

>  SDIO_CCCR_IF[1:0] in SDIO card is used for card data bus width
> setting as below,
>     00b: 1-bit bus
>     01b: Reserved
>     10b: 4-bit bus
>     11b: 8-bit bus(only for embedded SDIO)
>  And sdio_enable_wide is for setting data bus width as 4-bit. But
> currently, it 1stly read the register, 2ndly OR' 1b with SDIO_CCCR_IF[1],
> and then write it back.
>  As we can see, such way is based on such assumption that the
> SDIO_CCCR_IF[0] is always 0. Apparently, this is not right.
> 
> Signed-off-by: yongd <yongd@...vell.com>
> ---
> drivers/mmc/core/sdio.c  |    6 ++++++
> include/linux/mmc/sdio.h |    2 ++
> 2 files changed, 8 insertions(+)
> 
> diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
> index 13d0e95..6b6f902 100644
> --- a/drivers/mmc/core/sdio.c
> +++ b/drivers/mmc/core/sdio.c
> @@ -218,6 +218,12 @@ static int sdio_enable_wide(struct mmc_card *card)
> 	if (ret)
> 		return ret;
> 
> +	if ((ctrl & SDIO_BUS_WIDTH_MASK)
> +				== SDIO_BUS_WIDTH_RESERVED)
> +		printk(KERN_WARNING"SDIO_CCCR_IF is invalid: %d\n", ctrl);
printk(KERN_WARNING("%s: SDIO_CCCR_IF is invalid: %02X\n", mmc_hostname(card->host), ctrl);

please double check mmc_hostname argument.

> +
> +	/* set as 4-bit bus width */
> +	ctrl &= ~SDIO_BUS_WIDTH_MASK;
> 	ctrl |= SDIO_BUS_WIDTH_4BIT;
> 
> 	ret = mmc_io_rw_direct(card, 1, 0, SDIO_CCCR_IF, ctrl, NULL);
> diff --git a/include/linux/mmc/sdio.h b/include/linux/mmc/sdio.h
> index c9fe66c..17446d3 100644
> --- a/include/linux/mmc/sdio.h
> +++ b/include/linux/mmc/sdio.h
> @@ -98,7 +98,9 @@
> 
> #define SDIO_CCCR_IF		0x07	/* bus interface controls */
> 
> +#define  SDIO_BUS_WIDTH_MASK	0x03	/* data bus width setting */
> #define  SDIO_BUS_WIDTH_1BIT	0x00
> +#define  SDIO_BUS_WIDTH_RESERVED 0x01
> #define  SDIO_BUS_WIDTH_4BIT	0x02
> #define  SDIO_BUS_ECSI		0x20	/* Enable continuous SPI interrupt */
> #define  SDIO_BUS_SCSI		0x40	/* Support continuous SPI interrupt */
> -- 
> 1.7.9.5
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ