diff options
author | Alison Wang <b18965@freescale.com> | 2012-07-26 15:46:11 +0800 |
---|---|---|
committer | Justin Waters <justin.waters@timesys.com> | 2012-09-12 16:49:42 -0400 |
commit | 6d095ab8a4a476c4ffd686021855cfcbb6211396 (patch) | |
tree | 685c9411c3e497d49907eb286d10313b8919f089 /arch | |
parent | 096f8711d0166ad7b7ebcb6b31508c6b12940e3a (diff) |
ENGR00181358-1: fec: add platform support for FEC driver
Add platform support for FEC driver.
Signed-off-by: Jason Jin <Jason.jin@freescale.com>
Signed-off-by: Alison Wang <b18965@freescale.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-mvf/mvf_fec.c | 56 | ||||
-rw-r--r-- | arch/arm/plat-mxc/devices/platform-fec.c | 7 |
2 files changed, 62 insertions, 1 deletions
diff --git a/arch/arm/mach-mvf/mvf_fec.c b/arch/arm/mach-mvf/mvf_fec.c new file mode 100644 index 000000000000..430793105e98 --- /dev/null +++ b/arch/arm/mach-mvf/mvf_fec.c @@ -0,0 +1,56 @@ +/* + * Copyright 2012 Freescale Semiconductor, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +#include <linux/fec.h> +#include <linux/etherdevice.h> + +#include <mach/common.h> +#include <mach/hardware.h> + +#include <asm/mach-types.h> +#include <asm/mach/arch.h> +#include "devices-mvf.h" + +#define ENET_PALR 0x0e4 +#define ENET_PAUR 0x0e8 +static unsigned char default_mac[ETH_ALEN] = { + 0x00, 0xe0, 0x0c, 0xbc, 0xe5, 0x60}; +/* FEC mac registers set by bootloader */ +static int fec_get_mac_addr(unsigned char *mac) +{ + unsigned int value; + + value = readl(MVF_IO_ADDRESS(MVF_FEC_BASE_ADDR) + ENET_PALR); + mac[2] = value & 0xff; + mac[3] = (value >> 8) & 0xff; + mac[4] = (value >> 16) & 0xff; + mac[5] = (value >> 24) & 0xff; + value = readl(MVF_IO_ADDRESS(MVF_FEC_BASE_ADDR) + ENET_PAUR); + mac[0] = (value >> 16) & 0xff; + mac[1] = (value >> 24) & 0xff; + + return 0; +} + +void __init mvf_init_fec(struct fec_platform_data fec_data) +{ + fec_get_mac_addr(fec_data.mac); + if (!is_valid_ether_addr(fec_data.mac)) + memcpy(fec_data.mac, default_mac, ETH_ALEN); + + mvf_add_fec(&fec_data); +} diff --git a/arch/arm/plat-mxc/devices/platform-fec.c b/arch/arm/plat-mxc/devices/platform-fec.c index b5e98576992f..4ad06d2cfb72 100644 --- a/arch/arm/plat-mxc/devices/platform-fec.c +++ b/arch/arm/plat-mxc/devices/platform-fec.c @@ -6,7 +6,7 @@ * the terms of the GNU General Public License version 2 as published by the * Free Software Foundation. * - * Copyright (C) 2011 Freescale Semiconductor, Inc. + * Copyright (C) 2011-2012 Freescale Semiconductor, Inc. */ #include <linux/dma-mapping.h> #include <asm/sizes.h> @@ -54,6 +54,11 @@ const struct imx_fec_data imx6q_fec_data __initconst = imx_fec_data_entry_single(MX6Q); #endif +#ifdef CONFIG_SOC_MVFA5 + const struct imx_fec_data mvf_fec_data __initconst = + imx_fec_data_entry_single(MVF); +#endif + struct platform_device *__init imx_add_fec( const struct imx_fec_data *data, const struct fec_platform_data *pdata) |