All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikita Kiryanov <nikita@compulab.co.il>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V4 18/19] arm: mx6: cm_fx6: use eeprom
Date: Wed, 20 Aug 2014 15:09:05 +0300	[thread overview]
Message-ID: <1408536546-15785-19-git-send-email-nikita@compulab.co.il> (raw)
In-Reply-To: <1408536546-15785-1-git-send-email-nikita@compulab.co.il>

Use Compulab eeprom module to obtain revision number, serial number, and
mac address from the EEPROM.

Cc: Igor Grinberg <grinberg@compulab.co.il>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
---
Changes in V4:
	- Introduce get_board_rev() here.

Changes in V3:
	- No changes

Changes in V2:
	- No changes

 board/compulab/cm_fx6/cm_fx6.c | 30 ++++++++++++++++++++++++++++++
 include/configs/cm_fx6.h       |  2 ++
 2 files changed, 32 insertions(+)

diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c
index d21c561..1664fe8 100644
--- a/board/compulab/cm_fx6/cm_fx6.c
+++ b/board/compulab/cm_fx6/cm_fx6.c
@@ -20,6 +20,7 @@
 #include <asm/io.h>
 #include <asm/gpio.h>
 #include "common.h"
+#include "../common/eeprom.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -209,8 +210,31 @@ static iomux_v3_cfg_t const enet_pads[] = {
 						MUX_PAD_CTRL(ENET_PAD_CTRL)),
 };
 
+static int handle_mac_address(void)
+{
+	unsigned char enetaddr[6];
+	int rc;
+
+	rc = eth_getenv_enetaddr("ethaddr", enetaddr);
+	if (rc)
+		return 0;
+
+	rc = cl_eeprom_read_mac_addr(enetaddr);
+	if (rc)
+		return rc;
+
+	if (!is_valid_ether_addr(enetaddr))
+		return -1;
+
+	return eth_setenv_enetaddr("ethaddr", enetaddr);
+}
+
 int board_eth_init(bd_t *bis)
 {
+	int res = handle_mac_address();
+	if (res)
+		puts("No MAC address found\n");
+
 	SETUP_IOMUX_PADS(enet_pads);
 	/* phy reset */
 	gpio_direction_output(CM_FX6_ENET_NRST, 0);
@@ -364,3 +388,9 @@ int dram_init(void)
 
 	return 0;
 }
+
+u32 get_board_rev(void)
+{
+	return cl_eeprom_get_board_rev();
+}
+
diff --git a/include/configs/cm_fx6.h b/include/configs/cm_fx6.h
index e70259e..cccc989 100644
--- a/include/configs/cm_fx6.h
+++ b/include/configs/cm_fx6.h
@@ -232,6 +232,8 @@
 #define CONFIG_SYS_BOOTMAPSZ	        (8 << 20)
 #define CONFIG_SETUP_MEMORY_TAGS
 #define CONFIG_INITRD_TAG
+#define CONFIG_REVISION_TAG
+#define CONFIG_SERIAL_TAG
 
 /* misc */
 #define CONFIG_SYS_GENERIC_BOARD
-- 
1.9.1

  parent reply	other threads:[~2014-08-20 12:09 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-20 12:08 [U-Boot] [PATCH V4 00/19] Introduce cm-fx6 board Nikita Kiryanov
2014-08-20 12:08 ` [U-Boot] [PATCH V4 01/19] spl: replace CONFIG_SPL_SPI_* with CONFIG_SF_DEFAULT_* Nikita Kiryanov
2014-08-21  5:31   ` Jagan Teki
2014-08-23  7:23     ` Jagan Teki
2014-08-20 12:08 ` [U-Boot] [PATCH V4 02/19] mx6: add clock enabling functions Nikita Kiryanov
2014-08-20 12:08 ` [U-Boot] [PATCH V4 03/19] spi: mxc: fix sf probe when using mxc_spi Nikita Kiryanov
2014-08-23  7:24   ` Jagan Teki
2014-08-20 12:08 ` [U-Boot] [PATCH V4 04/19] mtd: spi: add support for M25PE16 and M25PX16 Nikita Kiryanov
2014-08-21  5:32   ` Jagan Teki
2014-08-23  7:23     ` Jagan Teki
2014-08-20 12:08 ` [U-Boot] [PATCH V4 05/19] compulab: eeprom: add support for defining eeprom i2c bus Nikita Kiryanov
2014-08-20 12:08 ` [U-Boot] [PATCH V4 06/19] sata: dwc_ahsata: implement sata_port_status Nikita Kiryanov
2014-08-20 12:08 ` [U-Boot] [PATCH V4 07/19] i2c: imx: add macros to setup pads for multiple SoC types Nikita Kiryanov
2014-08-20 12:08 ` [U-Boot] [PATCH V4 08/19] arm: mx6: ddr: cleanup Nikita Kiryanov
2014-09-07 15:58   ` [U-Boot] [PATCH V5 " Nikita Kiryanov
2014-08-20 12:08 ` [U-Boot] [PATCH V4 09/19] arm: mx6: ddr: do not write into reserved bit Nikita Kiryanov
2014-08-20 12:08 ` [U-Boot] [PATCH V4 10/19] arm: mx6: ddr: configure MMDC for slow_pd Nikita Kiryanov
2014-08-25 15:36   ` Nikita Kiryanov
2014-08-25 17:05     ` Tim Harvey
2014-08-20 12:08 ` [U-Boot] [PATCH V4 11/19] arm: mx6: ddr: fix cs0_end calculation Nikita Kiryanov
2014-08-20 12:08 ` [U-Boot] [PATCH V4 12/19] arm: mx6: add get_cpu_type() Nikita Kiryanov
2014-08-20 12:09 ` [U-Boot] [PATCH V4 13/19] arm: mx6: add support for Compulab cm-fx6 CoM Nikita Kiryanov
2014-09-07 15:59   ` [U-Boot] [PATCH V5 " Nikita Kiryanov
2014-09-07 22:32     ` Marek Vasut
2014-08-20 12:09 ` [U-Boot] [PATCH V4 14/19] arm: mx6: cm_fx6: add nand support Nikita Kiryanov
2014-08-20 12:09 ` [U-Boot] [PATCH V4 15/19] arm: mx6: cm_fx6: add ethernet support Nikita Kiryanov
2014-08-20 12:09 ` [U-Boot] [PATCH V4 16/19] arm: mx6: cm_fx6: add usb support Nikita Kiryanov
2014-08-20 12:09 ` [U-Boot] [PATCH V4 17/19] arm: mx6: cm_fx6: add i2c support Nikita Kiryanov
2014-08-20 12:09 ` Nikita Kiryanov [this message]
2014-08-20 12:09 ` [U-Boot] [PATCH V4 19/19] arm: mx6: cm_fx6: add sata support Nikita Kiryanov
2014-08-31  8:09 ` [U-Boot] [PATCH V4 00/19] Introduce cm-fx6 board Nikita Kiryanov
2014-09-06 10:50   ` Tom Rini
2014-09-09 13:45   ` Stefano Babic
2014-09-09 15:00     ` Nikita Kiryanov
2014-09-09 15:08       ` Stefano Babic

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=1408536546-15785-19-git-send-email-nikita@compulab.co.il \
    --to=nikita@compulab.co.il \
    --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 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.