mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 5/7] net mii: Add mii_open/mii_close functions
Date: Fri, 13 Apr 2012 15:54:31 +0200	[thread overview]
Message-ID: <1334325273-1701-6-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1334325273-1701-1-git-send-email-s.hauer@pengutronix.de>

Some phys need board specific fixups. To be able to do this
from board code add mii_open/mii_close functions so that the
board can use the regular mii_read/mii_write functions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/net/miidev.c |   20 ++++++++++++++++++++
 include/miidev.h     |    5 +++++
 2 files changed, 25 insertions(+)

diff --git a/drivers/net/miidev.c b/drivers/net/miidev.c
index 3b73133..cc84e63 100644
--- a/drivers/net/miidev.c
+++ b/drivers/net/miidev.c
@@ -28,6 +28,8 @@
 #include <net.h>
 #include <malloc.h>
 
+static LIST_HEAD(miidev_list);
+
 int miidev_restart_aneg(struct mii_device *mdev)
 {
 	int status, timeout;
@@ -226,6 +228,7 @@ static int miidev_probe(struct device_d *dev)
 	mdev->cdev.priv = mdev;
 	mdev->cdev.dev = dev;
 	devfs_create(&mdev->cdev);
+	list_add_tail(&mdev->list, &miidev_list);
 	return 0;
 }
 
@@ -233,10 +236,27 @@ static void miidev_remove(struct device_d *dev)
 {
 	struct mii_device *mdev = dev->priv;
 
+	list_del(&mdev->list);
+
 	free(mdev->cdev.name);
 	devfs_remove(&mdev->cdev);
 }
 
+struct mii_device *mii_open(const char *name)
+{
+	struct mii_device *mdev;
+
+	list_for_each_entry(mdev, &miidev_list, list) {
+		if (!strcmp(name, mdev->cdev.name))
+			return mdev;
+	}
+	return NULL;
+}
+
+void mii_close(struct mii_device *mdev)
+{
+}
+
 static struct driver_d miidev_drv = {
         .name  = "miidev",
         .probe = miidev_probe,
diff --git a/include/miidev.h b/include/miidev.h
index 8cd4c45..622784f 100644
--- a/include/miidev.h
+++ b/include/miidev.h
@@ -43,6 +43,7 @@ struct mii_device {
 
 	struct eth_device *edev;
 	struct cdev cdev;
+	struct list_head list;
 };
 
 int mii_register(struct mii_device *dev);
@@ -65,4 +66,8 @@ static int inline mii_read(struct mii_device *dev, int addr, int reg)
 {
 	return dev->read(dev, addr, reg);
 }
+
+struct mii_device *mii_open(const char *name);
+void mii_close(struct mii_device *mdev);
+
 #endif /* __MIIDEV_H__ */
-- 
1.7.10


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2012-04-13 13:54 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-13 13:54 initial i.MX6 support Sascha Hauer
2012-04-13 13:54 ` [PATCH 1/7] ARM: add " Sascha Hauer
2012-04-14 11:41   ` Jean-Christophe PLAGNIOL-VILLARD
2012-04-14 13:19     ` Sascha Hauer
     [not found]   ` <20120414161123.GB30672@game.jcrosoft.org>
2012-04-14 20:13     ` Sascha Hauer
2012-04-15  1:31       ` Jean-Christophe PLAGNIOL-VILLARD
2012-04-15  9:53         ` Sascha Hauer
2012-04-15 11:47           ` Jean-Christophe PLAGNIOL-VILLARD
2012-04-15 13:49             ` Sascha Hauer
2012-04-15 13:51               ` Jean-Christophe PLAGNIOL-VILLARD
2012-04-13 13:54 ` [PATCH 2/7] serial i.MX: " Sascha Hauer
2012-04-14 11:34   ` Jean-Christophe PLAGNIOL-VILLARD
2012-04-14 13:25     ` Sascha Hauer
2012-04-13 13:54 ` [PATCH 3/7] net fec: Add " Sascha Hauer
2012-04-13 13:54 ` [PATCH 4/7] mmc i.MX esdhc: " Sascha Hauer
2012-04-13 13:54 ` Sascha Hauer [this message]
2012-04-14 10:46   ` [PATCH 5/7] net mii: Add mii_open/mii_close functions Jean-Christophe PLAGNIOL-VILLARD
2012-04-14 13:27     ` Sascha Hauer
2012-04-15  4:12       ` Jean-Christophe PLAGNIOL-VILLARD
2012-04-15 10:01         ` Sascha Hauer
2012-04-13 13:54 ` [PATCH 6/7] ARM: initial Freescale i.MX6q Armadillo2 support Sascha Hauer
2012-04-14 10:53   ` Jean-Christophe PLAGNIOL-VILLARD
2012-04-14 12:57     ` Sascha Hauer
2012-04-15  4:09       ` Jean-Christophe PLAGNIOL-VILLARD
2012-04-15  9:53         ` Sascha Hauer
2012-04-15 11:46           ` Jean-Christophe PLAGNIOL-VILLARD
2012-04-14 13:17   ` Eric Bénard
2012-04-14 13:20     ` Sascha Hauer
2012-04-13 13:54 ` [PATCH 7/7] ARM Freescale i.MX6 Armadillo2: Add defconfig Sascha Hauer

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=1334325273-1701-6-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.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