[U-Boot] [RFC] ks8851_mll: add ethernet support

Wolfgang Denk wd at denx.de
Mon Apr 25 01:41:55 CEST 2011


Dear Raffaele Recalcati,

In message <1300267039-3607-1-git-send-email-lamiaposta71 at gmail.com> you wrote:
> From: Roberto Cerati <roberto.cerati at bticino.it>
> 
> The device interface is 16 bits wide.
> All the available packets are read from the incoming fifo.
> 
> Signed-off-by: Roberto Cerati <roberto.cerati at bticino.it
> Signed-off-by: Raffaele Recalcati <raffaele.recalcati at bticino.it>
> ---
> This driver has been adapted to u-boot starting from ks8851_mll linux driver.
> The smsc911x u-boot has been used as reference.
> 
> TODO: smsc911x reads only one packet from incoming fifo, ks8851_mll reads all packets
> in the incoming fifo, but it is not checked if upper driver level (net/eth.c ?) manages more than
> one packet.
> 
> This driver has been tested against u-boot-2009.11-psp03.00.01.06
> u-boot version present in ti-dvsdk_dm3730-evm_4_01_00_09 DVSDK.
> The board name is baia and is based on dm3730 soc adapted from
> evm-dm3730 Ti board.

We only add code to mainline that has users in mainline.  Please
resubmit with the patches that add support for this board.  Thanks.

> +/*
> + * Micrel KS8851_MLL 16bit Network driver
> + * Copyright (c) 2011 Roberto Cerati <roberto.cerati at bticino.it>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.

Also, U-Boot requires the v2 or later clause, please see bullet # 3 at
http://www.denx.de/wiki/view/U-Boot/Patches#Attributing_Code_Copyrights_Sign

> +static u8 ks_rdreg8(struct eth_device *dev, u16 offset)
> +{
> +	volatile u16 *hw_addr = (u16 *)(dev->iobase);
> +	volatile u16 *hw_addr_cmd = (u16 *)(dev->iobase + 2);
> +
> +	u16 data;
> +
> +	u8 shift_bit = offset & 0x03;
> +	u8 shift_data = (offset & 1) << 3;
> +
> +	*hw_addr_cmd = offset | (u16)(BE0 << shift_bit);
> +
> +	data  = *hw_addr;

And please get rid of all these volatile declarations and use proper
I/O accessors instead.

Before resubmitting, make sure to run checkpatch.

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
"There's only one way to have a happy marriage and as soon as I learn
what it is I'll get married again."                  - Clint Eastwood


More information about the U-Boot mailing list