All of lore.kernel.org
 help / color / mirror / Atom feed
From: michal.simek@xilinx.com (Michal Simek)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v1 02/24] net: gem: Add OF initialization support
Date: Fri,  3 Jan 2014 11:10:47 +0100	[thread overview]
Message-ID: <3033ad4cfeb6d552e5b1b7fc55599efff3e816d2.1388743861.git.michal.simek@xilinx.com> (raw)
In-Reply-To: <cover.1388743861.git.michal.simek@xilinx.com>

Gem can be directly initialized from DTB.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

Changes in v1: None

 drivers/net/zynq_gem.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 include/netdev.h       |  1 +
 2 files changed, 43 insertions(+)

diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
index 6a017a8..a673fa7 100644
--- a/drivers/net/zynq_gem.c
+++ b/drivers/net/zynq_gem.c
@@ -12,6 +12,8 @@
 #include <common.h>
 #include <net.h>
 #include <config.h>
+#include <fdtdec.h>
+#include <libfdt.h>
 #include <malloc.h>
 #include <asm/io.h>
 #include <phy.h>
@@ -527,3 +529,43 @@ int zynq_gem_initialize(bd_t *bis, int base_addr, int phy_addr, u32 emio)

 	return 1;
 }
+
+#ifdef CONFIG_OF_CONTROL
+int zynq_gem_of_init(const void *blob)
+{
+	int offset = 0;
+	u32 ret = 0;
+	u32 reg, phy_reg;
+
+	debug("ZYNQ GEM: Initialization\n");
+
+	do {
+		offset = fdt_node_offset_by_compatible(blob, offset,
+					"xlnx,ps7-ethernet-1.00.a");
+		if (offset != -1) {
+			reg = fdtdec_get_addr(blob, offset, "reg");
+			if (reg != FDT_ADDR_T_NONE) {
+				offset = fdtdec_lookup_phandle(blob, offset,
+							       "phy-handle");
+				if (offset != -1)
+					phy_reg = fdtdec_get_addr(blob, offset,
+								  "reg");
+				else
+					phy_reg = 0;
+
+				debug("ZYNQ GEM: addr %x, phyaddr %x\n",
+				      reg, phy_reg);
+
+				ret |= zynq_gem_initialize(NULL, reg,
+							   phy_reg, 0);
+
+			} else {
+				debug("ZYNQ GEM: Can't get base address\n");
+				return -1;
+			}
+		}
+	} while (offset != -1);
+
+	return ret;
+}
+#endif
diff --git a/include/netdev.h b/include/netdev.h
index 25d1e46..b9eab0e 100644
--- a/include/netdev.h
+++ b/include/netdev.h
@@ -91,6 +91,7 @@ int xilinx_emaclite_initialize(bd_t *bis, unsigned long base_addr,
 							int txpp, int rxpp);
 int xilinx_ll_temac_eth_init(bd_t *bis, unsigned long base_addr, int flags,
 						unsigned long ctrl_addr);
+int zynq_gem_of_init(const void *blob);
 int zynq_gem_initialize(bd_t *bis, int base_addr, int phy_addr, u32 emio);
 /*
  * As long as the Xilinx xps_ll_temac ethernet driver has not its own interface
--
1.8.2.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140103/4b6b0366/attachment.sig>

WARNING: multiple messages have this Message-ID (diff)
From: Michal Simek <michal.simek@xilinx.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 02/24] net: gem: Add OF initialization support
Date: Fri,  3 Jan 2014 11:10:47 +0100	[thread overview]
Message-ID: <3033ad4cfeb6d552e5b1b7fc55599efff3e816d2.1388743861.git.michal.simek@xilinx.com> (raw)
In-Reply-To: <cover.1388743861.git.michal.simek@xilinx.com>

Gem can be directly initialized from DTB.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

Changes in v1: None

 drivers/net/zynq_gem.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 include/netdev.h       |  1 +
 2 files changed, 43 insertions(+)

diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
index 6a017a8..a673fa7 100644
--- a/drivers/net/zynq_gem.c
+++ b/drivers/net/zynq_gem.c
@@ -12,6 +12,8 @@
 #include <common.h>
 #include <net.h>
 #include <config.h>
+#include <fdtdec.h>
+#include <libfdt.h>
 #include <malloc.h>
 #include <asm/io.h>
 #include <phy.h>
@@ -527,3 +529,43 @@ int zynq_gem_initialize(bd_t *bis, int base_addr, int phy_addr, u32 emio)

 	return 1;
 }
+
+#ifdef CONFIG_OF_CONTROL
+int zynq_gem_of_init(const void *blob)
+{
+	int offset = 0;
+	u32 ret = 0;
+	u32 reg, phy_reg;
+
+	debug("ZYNQ GEM: Initialization\n");
+
+	do {
+		offset = fdt_node_offset_by_compatible(blob, offset,
+					"xlnx,ps7-ethernet-1.00.a");
+		if (offset != -1) {
+			reg = fdtdec_get_addr(blob, offset, "reg");
+			if (reg != FDT_ADDR_T_NONE) {
+				offset = fdtdec_lookup_phandle(blob, offset,
+							       "phy-handle");
+				if (offset != -1)
+					phy_reg = fdtdec_get_addr(blob, offset,
+								  "reg");
+				else
+					phy_reg = 0;
+
+				debug("ZYNQ GEM: addr %x, phyaddr %x\n",
+				      reg, phy_reg);
+
+				ret |= zynq_gem_initialize(NULL, reg,
+							   phy_reg, 0);
+
+			} else {
+				debug("ZYNQ GEM: Can't get base address\n");
+				return -1;
+			}
+		}
+	} while (offset != -1);
+
+	return ret;
+}
+#endif
diff --git a/include/netdev.h b/include/netdev.h
index 25d1e46..b9eab0e 100644
--- a/include/netdev.h
+++ b/include/netdev.h
@@ -91,6 +91,7 @@ int xilinx_emaclite_initialize(bd_t *bis, unsigned long base_addr,
 							int txpp, int rxpp);
 int xilinx_ll_temac_eth_init(bd_t *bis, unsigned long base_addr, int flags,
 						unsigned long ctrl_addr);
+int zynq_gem_of_init(const void *blob);
 int zynq_gem_initialize(bd_t *bis, int base_addr, int phy_addr, u32 emio);
 /*
  * As long as the Xilinx xps_ll_temac ethernet driver has not its own interface
--
1.8.2.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140103/4b6b0366/attachment.pgp>

  parent reply	other threads:[~2014-01-03 10:10 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-03 10:10 [PATCH v1 0/24] Zynq DT changes Michal Simek
2014-01-03 10:10 ` [U-Boot] " Michal Simek
2014-01-03 10:10 ` [PATCH v1 01/24] net: emaclite: Fix OF initialization Michal Simek
2014-01-03 10:10   ` [U-Boot] " Michal Simek
2014-01-03 10:10 ` Michal Simek [this message]
2014-01-03 10:10   ` [U-Boot] [PATCH v1 02/24] net: gem: Add OF initialization support Michal Simek
2014-01-03 10:10 ` [PATCH v1 03/24] mmc: zynq: " Michal Simek
2014-01-03 10:10   ` [U-Boot] " Michal Simek
2014-01-03 10:10 ` [PATCH v1 04/24] zynq: Add OF ram " Michal Simek
2014-01-03 10:10   ` [U-Boot] " Michal Simek
2014-01-03 10:10 ` [PATCH v1 05/24] gpio: zynq: Add dummy gpio routines Michal Simek
2014-01-03 10:10   ` [U-Boot] " Michal Simek
2014-01-03 10:10 ` [PATCH v1 06/24] zynq: Enable CONFIG_FIT_VERBOSE Michal Simek
2014-01-03 10:10   ` [U-Boot] " Michal Simek
2014-01-03 10:10 ` [PATCH v1 07/24] zynq: Enable Boot FreeBSD/vxWorks Michal Simek
2014-01-03 10:10   ` [U-Boot] " Michal Simek
2014-01-03 10:10 ` [PATCH v1 08/24] zynq: Cleanup on miscellaneous configs Michal Simek
2014-01-03 10:10   ` [U-Boot] " Michal Simek
2014-01-03 10:10 ` [PATCH v1 09/24] zynq: Cleanup on memory configs Michal Simek
2014-01-03 10:10   ` [U-Boot] " Michal Simek
2014-01-03 10:10 ` [PATCH v1 10/24] zynq: Minor config cleanup Michal Simek
2014-01-03 10:10   ` [U-Boot] " Michal Simek
2014-01-03 10:10 ` [PATCH v1 11/24] zynq: Enable cache options Michal Simek
2014-01-03 10:10   ` [U-Boot] " Michal Simek
2014-01-03 10:10 ` [PATCH v1 12/24] zynq: serial: Simplify serial driver initialization Michal Simek
2014-01-03 10:10   ` [U-Boot] " Michal Simek
2014-01-03 10:10 ` [PATCH v1 13/24] serial: zynq: Add OF initialization support Michal Simek
2014-01-03 10:10   ` [U-Boot] " Michal Simek
2014-01-03 10:10 ` [PATCH v1 14/24] zynq: Add GEM0, GEM1 configs support Michal Simek
2014-01-03 10:10   ` [U-Boot] " Michal Simek
2014-01-03 10:11 ` [PATCH v1 15/24] zynq-common: Define exact TEXT_BASE Michal Simek
2014-01-03 10:11   ` [U-Boot] " Michal Simek
2014-01-03 10:11 ` [PATCH v1 16/24] zynq: Add Catalyst 24WC08 EEPROM config support Michal Simek
2014-01-03 10:11   ` [U-Boot] " Michal Simek
2014-01-03 10:11 ` [PATCH v1 17/24] zynq-common: Define default environment Michal Simek
2014-01-03 10:11   ` [U-Boot] " Michal Simek
2014-01-03 10:11 ` [PATCH v1 18/24] zynq-common: Change Env. Sector size to 128Kb Michal Simek
2014-01-03 10:11   ` [U-Boot] " Michal Simek
2014-01-03 10:11 ` [PATCH v1 19/24] zynq-common: Define flash env. partition Michal Simek
2014-01-03 10:11   ` [U-Boot] " Michal Simek
2014-01-03 10:11 ` [PATCH v1 20/24] zynq-common: Define CONFIG_ENV_OVERWRITE Michal Simek
2014-01-03 10:11   ` [U-Boot] " Michal Simek
2014-01-03 10:11 ` [PATCH v1 21/24] zynq: Add support to find bootmode Michal Simek
2014-01-03 10:11   ` [U-Boot] " Michal Simek
2014-01-03 10:11 ` [PATCH v1 22/24] dts: zynq: Add fdt support Michal Simek
2014-01-03 10:11   ` [U-Boot] " Michal Simek
2014-01-03 10:11 ` [PATCH v1 23/24] zynq-common: Enable verified boot(RSA) Michal Simek
2014-01-03 10:11   ` [U-Boot] " Michal Simek
2014-01-03 10:11 ` [PATCH v1 24/24] doc: zynq: Add information on zynq u-boot Michal Simek
2014-01-03 10:11   ` [U-Boot] " Michal Simek
2014-01-03 11:39 ` [PATCH v1 0/24] Zynq DT changes Russell King - ARM Linux
2014-01-03 11:39   ` [U-Boot] " Russell King - ARM Linux
2014-01-14 12:08 ` Albert ARIBAUD
2014-01-14 12:08   ` [U-Boot] " Albert ARIBAUD
2014-01-14 12:48   ` Michal Simek
2014-01-14 12:48     ` [U-Boot] " Michal Simek

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=3033ad4cfeb6d552e5b1b7fc55599efff3e816d2.1388743861.git.michal.simek@xilinx.com \
    --to=michal.simek@xilinx.com \
    --cc=linux-arm-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.