[PATCH 19/19] drivers: net: add driver for TI CPSW

Sascha Hauer s.hauer at pengutronix.de
Wed Dec 19 16:11:56 EST 2012


On Tue, Dec 18, 2012 at 03:22:41PM +0100, Jan Luebbe wrote:
> Signed-off-by: Jan Luebbe <jlu at pengutronix.de>
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> ---
>  arch/arm/boards/beaglebone/board.c     |   80 +++
>  arch/arm/mach-omap/include/mach/cpsw.h |   49 ++
>  drivers/net/Kconfig                    |    4 +
>  drivers/net/Makefile                   |    1 +
>  drivers/net/cpsw.c                     | 1021 ++++++++++++++++++++++++++++++++
>  5 files changed, 1155 insertions(+)
>  create mode 100644 arch/arm/mach-omap/include/mach/cpsw.h
>  create mode 100644 drivers/net/cpsw.c
> 
> diff --git a/arch/arm/boards/beaglebone/board.c b/arch/arm/boards/beaglebone/board.c
> index d139e94..20b4bdd 100644
> --- a/arch/arm/boards/beaglebone/board.c
> +++ b/arch/arm/boards/beaglebone/board.c
> @@ -31,6 +31,7 @@
>  #include <sizes.h>
>  #include <io.h>
>  #include <ns16550.h>
> +#include <net.h>
>  #include <asm/armlinux.h>
>  #include <generated/mach-types.h>
>  #include <mach/am33xx-silicon.h>
> @@ -42,6 +43,7 @@
>  #include <mach/ehci.h>
>  #include <i2c/i2c.h>
>  #include <linux/err.h>
> +#include <linux/phy.h>
>  #include <usb/ehci.h>
>  #include <mach/xload.h>
>  #include <mach/am33xx-devices.h>
> @@ -306,6 +308,84 @@ static int beaglebone_console_init(void)
>  console_initcall(beaglebone_console_init);
>  #endif /* CONFIG_DRIVER_SERIAL_NS16550 */
>  
> +#ifdef CONFIG_DRIVER_NET_CPSW
> +static void cpsw_control(int enabled)
> +{
> +	return;
> +}
> +
> +static struct cpsw_slave_data cpsw_slaves[] = {
> +	{
> +		.slave_reg_ofs	= 0x208,
> +		.sliver_reg_ofs	= 0xd80,
> +		.phy_id		= 0,
> +		.phy_if		= PHY_INTERFACE_MODE_MII,
> +	},
> +	{
> +		.slave_reg_ofs	= 0x308,
> +		.sliver_reg_ofs	= 0xdc0,
> +		.phy_id		= 1,
> +		.phy_if		= PHY_INTERFACE_MODE_MII,
> +	},
> +};
> +
> +static struct cpsw_platform_data cpsw_data = {
> +	.mdio_base		= AM335X_CPSW_MDIO_BASE,
> +	.cpsw_base		= AM335X_CPSW_BASE,
> +	.mdio_div		= 0xff,
> +	.channels		= 8,
> +	.cpdma_reg_ofs		= 0x800,
> +	.slaves			= 2,
> +	.slave_data		= cpsw_slaves,
> +	.ale_reg_ofs		= 0xd00,
> +	.ale_entries		= 1024,
> +	.host_port_reg_ofs	= 0x108,
> +	.hw_stats_reg_ofs	= 0x900,
> +	.mac_control		= (1 << 5) /* MIIEN */,
> +	.control		= cpsw_control,
> +	.host_port_num		= 0,
> +	.version		= CPSW_CTRL_VERSION_2,
> +};

Most of this looks SoC specific, not board specific. You should use the
platform_device_id mechanism for this.

Sascha

-- 
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 |



More information about the barebox mailing list