summaryrefslogtreecommitdiff
path: root/board/compulab
diff options
context:
space:
mode:
authorNikita Kiryanov <nikita@compulab.co.il>2014-08-20 15:09:05 +0300
committerStefano Babic <sbabic@denx.de>2014-09-09 15:37:08 +0200
commitf66113c0ef8108cb4b14d54d1b805c776e91cd21 (patch)
treeedb44cc9b5ac6e9ff3e2a705814e3a948c2e2dec /board/compulab
parentf42b2f606161d0051c14ccaccdc7fdef4bb2fc96 (diff)
downloadu-boot-imx-f66113c0ef8108cb4b14d54d1b805c776e91cd21.zip
u-boot-imx-f66113c0ef8108cb4b14d54d1b805c776e91cd21.tar.gz
u-boot-imx-f66113c0ef8108cb4b14d54d1b805c776e91cd21.tar.bz2
arm: mx6: cm_fx6: use eeprom
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>
Diffstat (limited to 'board/compulab')
-rw-r--r--board/compulab/cm_fx6/cm_fx6.c30
1 files changed, 30 insertions, 0 deletions
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();
+}
+