From: Sascha Hauer <s.hauer@pengutronix.de>
To: netdev@vger.kernel.org
Cc: Greg Ungerer <gerg@snapgear.com>,
frederic rodo <fred.rodo@gmail.com>,
Sascha Hauer <s.hauer@pengutronix.de>
Subject: [PATCH] fec: Add support for Freescale MX27
Date: Tue, 27 Jan 2009 11:40:03 +0100 [thread overview]
Message-ID: <1233052804-31228-9-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1233052804-31228-8-git-send-email-s.hauer@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/net/Kconfig | 6 +++---
drivers/net/fec.c | 15 +++++++++++++--
drivers/net/fec.h | 11 +++++++++--
3 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index 9fe8cb7..fcdab51 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -1828,11 +1828,11 @@ config 68360_ENET
the Motorola 68360 processor.
config FEC
- bool "FEC ethernet controller (of ColdFire CPUs)"
- depends on M523x || M527x || M5272 || M528x || M520x
+ bool "FEC ethernet controller (of ColdFire and some i.MX CPUs)"
+ depends on M523x || M527x || M5272 || M528x || M520x || ARCH_MXC
help
Say Y here if you want to use the built-in 10/100 Fast ethernet
- controller on some Motorola ColdFire processors.
+ controller on some Motorola ColdFire and Freescale i.MX processors.
config FEC2
bool "Second FEC ethernet controller (on some ColdFire CPUs)"
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 6a54d1f..2c8783a 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -38,10 +38,14 @@
#include <linux/bitops.h>
#include <linux/io.h>
#include <linux/irq.h>
+#include <linux/clk.h>
#include <asm/cacheflush.h>
+
+#ifndef CONFIG_ARCH_MXC
#include <asm/coldfire.h>
#include <asm/mcfsim.h>
+#endif
#include "fec.h"
@@ -51,6 +55,13 @@
#define FEC_MAX_PORTS 1
#endif
+#ifdef CONFIG_ARCH_MXC
+#include <mach/hardware.h>
+#define FEC_ALIGNMENT 0xf
+#else
+#define FEC_ALIGNMENT 0x3
+#endif
+
#if defined(CONFIG_M5272)
#define HAVE_mii_link_interrupt
#endif
@@ -158,7 +169,7 @@ typedef struct {
* account when setting it.
*/
#if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
- defined(CONFIG_M520x) || defined(CONFIG_M532x)
+ defined(CONFIG_M520x) || defined(CONFIG_M532x) || defined(CONFIG_ARCH_MXC)
#define OPT_FRAME_SIZE (PKT_MAXBUF_SIZE << 16)
#else
#define OPT_FRAME_SIZE 0
@@ -339,7 +350,7 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
* 4-byte boundaries. Use bounce buffers to copy data
* and get it aligned. Ugh.
*/
- if (bdp->cbd_bufaddr & 0x3) {
+ if (bdp->cbd_bufaddr & FEC_ALIGNMENT) {
unsigned int index;
index = bdp - fep->tx_bd_base;
memcpy(fep->tx_bounce[index], (void *)skb->data, skb->len);
diff --git a/drivers/net/fec.h b/drivers/net/fec.h
index 292719d..76c64c9 100644
--- a/drivers/net/fec.h
+++ b/drivers/net/fec.h
@@ -14,7 +14,7 @@
/****************************************************************************/
#if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
- defined(CONFIG_M520x) || defined(CONFIG_M532x)
+ defined(CONFIG_M520x) || defined(CONFIG_M532x) || defined(CONFIG_ARCH_MXC)
/*
* Just figures, Motorola would have to change the offsets for
* registers in the same peripheral device on different models
@@ -103,12 +103,19 @@ typedef struct fec {
/*
* Define the buffer descriptor structure.
*/
+#ifdef CONFIG_ARCH_MXC
+typedef struct bufdesc {
+ unsigned short cbd_datlen; /* Data length */
+ unsigned short cbd_sc; /* Control and status info */
+ unsigned long cbd_bufaddr; /* Buffer address */
+} cbd_t;
+#else
typedef struct bufdesc {
unsigned short cbd_sc; /* Control and status info */
unsigned short cbd_datlen; /* Data length */
unsigned long cbd_bufaddr; /* Buffer address */
} cbd_t;
-
+#endif
/*
* The following definitions courtesy of commproc.h, which where
--
1.5.6.5
next prev parent reply other threads:[~2009-01-27 10:41 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-27 10:39 FEC Patches Sascha Hauer
2009-01-27 10:39 ` [PATCH] fec: remove unused #else branches Sascha Hauer
2009-01-27 10:39 ` [PATCH] fec: remove empty functions Sascha Hauer
2009-01-27 10:39 ` [PATCH] fec: use linux/*.h instead of asm/*.h Sascha Hauer
2009-01-27 10:39 ` [PATCH] fec: do not use memcpy on physical addresses Sascha Hauer
2009-01-27 10:40 ` [PATCH] fec: use dma_alloc_coherent for descriptor ring Sascha Hauer
2009-01-27 10:40 ` [PATCH] fec: Fix KS8721BL_ICSR phy register offset Sascha Hauer
2009-01-27 10:40 ` [PATCH] fec: replace flush_dcache_range with dma_sync_single Sascha Hauer
2009-01-27 10:40 ` Sascha Hauer [this message]
2009-01-27 10:40 ` [PATCH] FEC: Turn FEC driver into platform device driver Sascha Hauer
2009-01-28 7:36 ` Greg Ungerer
2009-01-28 7:37 ` FEC Patches Greg Ungerer
2009-01-28 18:53 ` Sascha Hauer
2009-01-28 20:31 ` David Miller
2009-01-29 9:03 ` Sascha Hauer
2009-01-28 23:46 ` Greg Ungerer
-- strict thread matches above, loose matches on Subject: below --
2009-01-29 9:03 FEC patches Sascha Hauer
2009-01-29 9:03 ` [PATCH] fec: remove unused #else branches Sascha Hauer
2009-01-29 9:03 ` [PATCH] fec: remove empty functions Sascha Hauer
2009-01-29 9:03 ` [PATCH] fec: use linux/*.h instead of asm/*.h Sascha Hauer
2009-01-29 9:03 ` [PATCH] fec: do not use memcpy on physical addresses Sascha Hauer
2009-01-29 9:03 ` [PATCH] fec: use dma_alloc_coherent for descriptor ring Sascha Hauer
2009-01-29 9:03 ` [PATCH] fec: Fix KS8721BL_ICSR phy register offset Sascha Hauer
2009-01-29 9:03 ` [PATCH] fec: replace flush_dcache_range with dma_sync_single Sascha Hauer
2009-01-29 9:03 ` [PATCH] fec: Add support for Freescale MX27 Sascha Hauer
[not found] <1233051848-5994-1-git-send-email-y>
[not found] ` <1233051848-5994-2-git-send-email-y>
[not found] ` <1233051848-5994-3-git-send-email-y>
[not found] ` <1233051848-5994-4-git-send-email-y>
[not found] ` <1233051848-5994-5-git-send-email-y>
[not found] ` <1233051848-5994-6-git-send-email-y>
[not found] ` <1233051848-5994-7-git-send-email-y>
[not found] ` <1233051848-5994-8-git-send-email-y>
2009-01-27 10:24 ` y
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1233052804-31228-9-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=fred.rodo@gmail.com \
--cc=gerg@snapgear.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).