mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] MCI/MXS: fix signed/unsigned mismatch
@ 2013-05-08 12:21 Juergen Beisert
  2013-05-08 21:25 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Juergen Beisert @ 2013-05-08 12:21 UTC (permalink / raw)
  To: barebox

Using the MXS MCI driver with an eight bit capable eMMC results into the
'devinfo' message the interface uses '0' bits for data transfer:
    
 barebox:/ devinfo mxs_mci0
 resources:
 num   : 0
 start : 0x80034000
 size  : 0x00002000
 driver: mxs_mci
 bus: platform
    
  Interface
   Min. bus clock: 1476 Hz
   Max. bus clock: 48000000 Hz
   Current bus clock: 24000000 Hz
   Bus width: 0 bit
    
The eight bit interface width is stored internally as value '2'. And a two bit
'2' ends up into 0xfffffffe when used as an array index. Using an unsigned
field instead fixes this issue:
    
 barebox:/ devinfo mxs_mci0
 resources:
 num   : 0
 start : 0x80034000
 size  : 0x00002000
 driver: mxs_mci
 bus: platform
    
  Interface
   Min. bus clock: 1476 Hz
   Max. bus clock: 48000000 Hz
   Current bus clock: 24000000 Hz
   Bus width: 8 bit

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>

diff --git a/drivers/mci/mxs.c b/drivers/mci/mxs.c
index c15461c..9dee863 100644
--- a/drivers/mci/mxs.c
+++ b/drivers/mci/mxs.c
@@ -55,7 +55,7 @@ struct mxs_mci_host {
 	unsigned	f_min;
 	unsigned	f_max;
 #endif
-	int		bus_width:2; /* 0 = 1 bit, 1 = 4 bit, 2 = 8 bit */
+	unsigned	bus_width:2; /* 0 = 1 bit, 1 = 4 bit, 2 = 8 bit */
 };
 
 #define to_mxs_mci(mxs) container_of(mxs, struct mxs_mci_host, host)

-- 
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] MCI/MXS: fix signed/unsigned mismatch
  2013-05-08 12:21 [PATCH] MCI/MXS: fix signed/unsigned mismatch Juergen Beisert
@ 2013-05-08 21:25 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2013-05-08 21:25 UTC (permalink / raw)
  To: Juergen Beisert; +Cc: barebox

On Wed, May 08, 2013 at 02:21:11PM +0200, Juergen Beisert wrote:
> 
> Signed-off-by: Juergen Beisert <jbe@pengutronix.de>

Applied, thanks

Sascha

> 
> diff --git a/drivers/mci/mxs.c b/drivers/mci/mxs.c
> index c15461c..9dee863 100644
> --- a/drivers/mci/mxs.c
> +++ b/drivers/mci/mxs.c
> @@ -55,7 +55,7 @@ struct mxs_mci_host {
>  	unsigned	f_min;
>  	unsigned	f_max;
>  #endif
> -	int		bus_width:2; /* 0 = 1 bit, 1 = 4 bit, 2 = 8 bit */
> +	unsigned	bus_width:2; /* 0 = 1 bit, 1 = 4 bit, 2 = 8 bit */
>  };
>  
>  #define to_mxs_mci(mxs) container_of(mxs, struct mxs_mci_host, host)
> 
> -- 
> Pengutronix e.K.                              | Juergen Beisert             |
> Linux Solutions for Science and Industry      | http://www.pengutronix.de/  |
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-08 21:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-08 12:21 [PATCH] MCI/MXS: fix signed/unsigned mismatch Juergen Beisert
2013-05-08 21:25 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox