public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Max Filippov <jcmvbkbc@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/7] net/ethoc: support device tree
Date: Tue,  2 Aug 2016 14:31:07 +0300	[thread overview]
Message-ID: <1470137470-6051-5-git-send-email-jcmvbkbc@gmail.com> (raw)
In-Reply-To: <1470137470-6051-1-git-send-email-jcmvbkbc@gmail.com>

Add .of_match table and .ofdata_to_platdata callback to allow for ethoc
device configuration from the device tree.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 drivers/net/ethoc.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c
index 0225595..8cb15c7 100644
--- a/drivers/net/ethoc.c
+++ b/drivers/net/ethoc.c
@@ -600,6 +600,14 @@ static void ethoc_stop(struct udevice *dev)
 	ethoc_disable_rx_and_tx(priv);
 }
 
+static int ethoc_ofdata_to_platdata(struct udevice *dev)
+{
+	struct ethoc_eth_pdata *pdata = dev_get_platdata(dev);
+
+	pdata->eth_pdata.iobase = dev_get_addr(dev);
+	return 0;
+}
+
 static int ethoc_probe(struct udevice *dev)
 {
 	struct ethoc_eth_pdata *pdata = dev_get_platdata(dev);
@@ -626,9 +634,16 @@ static const struct eth_ops ethoc_ops = {
 	.write_hwaddr	= ethoc_write_hwaddr,
 };
 
+static const struct udevice_id ethoc_ids[] = {
+	{ .compatible = "opencores,ethoc" },
+	{ }
+};
+
 U_BOOT_DRIVER(ethoc) = {
 	.name				= "ethoc",
 	.id				= UCLASS_ETH,
+	.of_match			= ethoc_ids,
+	.ofdata_to_platdata		= ethoc_ofdata_to_platdata,
 	.probe				= ethoc_probe,
 	.remove				= ethoc_remove,
 	.ops				= &ethoc_ops,
-- 
2.1.4

  parent reply	other threads:[~2016-08-02 11:31 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-02 11:31 [U-Boot] [PATCH 0/7] net/ethoc improvements Max Filippov
2016-08-02 11:31 ` [U-Boot] [PATCH 1/7] net/ethoc: add Kconfig entry for the driver Max Filippov
2016-08-04 17:11   ` Joe Hershberger
2016-08-02 11:31 ` [U-Boot] [PATCH 2/7] net/ethoc: use priv instead of dev internally Max Filippov
2016-08-04 17:16   ` Joe Hershberger
2016-08-02 11:31 ` [U-Boot] [PATCH 3/7] net/ethoc: add CONFIG_DM_ETH support Max Filippov
2016-08-04  1:16   ` Simon Glass
2016-08-04 17:51   ` Joe Hershberger
2016-08-05 14:06     ` Max Filippov
2016-08-02 11:31 ` Max Filippov [this message]
2016-08-04 18:01   ` [U-Boot] [PATCH 4/7] net/ethoc: support device tree Joe Hershberger
2016-08-02 11:31 ` [U-Boot] [PATCH 5/7] net/ethoc: don't mix virtual and physical addresses Max Filippov
2016-08-04 18:08   ` Joe Hershberger
2016-08-02 11:31 ` [U-Boot] [PATCH 6/7] net/ethoc: support private memory configurations Max Filippov
2016-08-04 19:43   ` Joe Hershberger
2016-08-02 11:31 ` [U-Boot] [PATCH 7/7] net/ethoc: implement MDIO bus and support phylib Max Filippov
2016-08-04 20:48   ` Joe Hershberger
2016-08-05 14:36     ` Max Filippov
2016-08-04 17:10 ` [U-Boot] [PATCH 0/7] net/ethoc improvements Joe Hershberger
2016-08-04 17:26   ` Tom Rini

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=1470137470-6051-5-git-send-email-jcmvbkbc@gmail.com \
    --to=jcmvbkbc@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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