[U-Boot] [PATCH 1/1] SMC911x driver fixed for NFS boot

Wolfgang Denk wd at denx.de
Wed Jun 10 00:08:54 CEST 2009


Dear Manikandan Pillai,

In message <1239162275-13087-1-git-send-email-mani.pillai at ti.com> you wrote:
> eth_halt() function in the smc911x drivers used to call the
> smc911x_reset() function. eth_halt() used to be called after
> tftp transfers. This used to put the ethernet chip in reset
> while the linux boots up resulting in the ethernet driver
> not coming up. NFS boot used to fail as a result.
> 
> This patch calls smc911x_shutdown() instead of smc911x_reset().
> Some comments received has also been fixed.

This patch (commit ID ca9c8a1e in the master branch) causes compile
warnings on all systems that use this driver, for example:

+ ./MAKEALL imx31_litekit
Configuring for imx31_litekit board...
smc911x.c: In function 'smc911x_shutdown':
smc911x.c:130: warning: large integer implicitly truncated to unsigned type
smc911x.c:132: warning: large integer implicitly truncated to unsigned type
smc911x.c:134: warning: large integer implicitly truncated to unsigned type
smc911x.c:136: warning: large integer implicitly truncated to unsigned type
   text    data     bss     dec     hex filename
 114556    5228   24584  144368   233f0 /work/wd/tmp-arm/u-boot


The problem seems to come from this part of the code:

> +static void smc911x_shutdown(void)
> +{
> +	unsigned int cr;
> +
> +	/* Turn of Rx and TX */
> +	cr = smc911x_get_mac_csr(MAC_CR);
> +	cr &= ~(MAC_CR_TXEN | MAC_CR_RXEN | MAC_CR_HBDIS);
> +	smc911x_set_mac_csr(MAC_CR, cr);
> +
> +	/* Stop Transmission */
> +	cr = smc911x_get_mac_csr(TX_CFG);
> +	cr &= ~(TX_CFG_STOP_TX);
> +	smc911x_set_mac_csr(TX_CFG, cr);
> +	/* Stop receiving packets */
> +	cr = smc911x_get_mac_csr(RX_CFG);
> +	cr &= ~(RX_CFG_RXDOFF);
> +	smc911x_set_mac_csr(RX_CFG, cr);

wher eyou ar epssing long constants (TX_CFG, RX_CFG) into
smc911x_set_mac_csr(), but smc911x_set_mac_csr() is declared
in "drivers/net/smc911x.h" to take an "unsigned character" argument
only:

	static u32 smc911x_get_mac_csr(u8 reg)

Please check what's wrong.

Please either provide a fix, or I will have to consider to revert this
patch for the upcoming release.


Thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"He was so narrow minded he could see through  a  keyhole  with  both
eyes ..."


More information about the U-Boot mailing list