{"id":808581,"url":"http://patchwork.ozlabs.org/api/1.0/patches/808581/?format=json","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.0/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<20170901082618.30622-3-wenyou.yang@microchip.com>","date":"2017-09-01T08:26:17","name":"[U-Boot,v4,2/3] board: sama5d2_xplained: Replace code to set mac address","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"38d050feebf2ec45960ad9b71ec4a11628d1b163","submitter":{"id":69532,"url":"http://patchwork.ozlabs.org/api/1.0/people/69532/?format=json","name":"Wenyou Yang","email":"Wenyou.Yang@microchip.com"},"delegate":{"id":3651,"url":"http://patchwork.ozlabs.org/api/1.0/users/3651/?format=json","username":"trini","first_name":"Tom","last_name":"Rini","email":"trini@ti.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20170901082618.30622-3-wenyou.yang@microchip.com/mbox/","series":[{"id":972,"url":"http://patchwork.ozlabs.org/api/1.0/series/972/?format=json","date":"2017-09-01T08:26:15","name":"board: atmel: Set the ethernet mac address from eeprom","version":4,"mbox":"http://patchwork.ozlabs.org/series/972/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/808581/checks/","tags":{},"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xkCDC6g0Sz9sPk\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  1 Sep 2017 18:32:43 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid AC231C21EFF; Fri,  1 Sep 2017 08:31:09 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 5C70DC21EE1;\n\tFri,  1 Sep 2017 08:31:07 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid DA06EC21EB1; Fri,  1 Sep 2017 08:30:43 +0000 (UTC)","from DVREDG02.corp.atmel.com (nasmtp01.atmel.com [192.199.1.246])\n\tby lists.denx.de (Postfix) with ESMTPS id 26CF4C21ED4\n\tfor <u-boot@lists.denx.de>; Fri,  1 Sep 2017 08:30:39 +0000 (UTC)","from apsmtp01.atmel.com (10.168.254.30) by DVREDG02.corp.atmel.com\n\t(10.42.103.31) with Microsoft SMTP Server (TLS) id 14.3.235.1;\n\tFri, 1 Sep 2017 02:29:59 -0600","from shaarm01.corp.atmel.com (10.168.254.13) by\n\tapsmtp01.corp.atmel.com (10.168.254.30) with Microsoft SMTP Server id\n\t14.3.235.1; Fri, 1 Sep 2017 16:33:59 +0800"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED\n\tautolearn=unavailable autolearn_force=no version=3.4.0","From":"Wenyou Yang <wenyou.yang@microchip.com>","To":"U-Boot Mailing List <u-boot@lists.denx.de>","Date":"Fri, 1 Sep 2017 16:26:17 +0800","Message-ID":"<20170901082618.30622-3-wenyou.yang@microchip.com>","X-Mailer":"git-send-email 2.13.0","In-Reply-To":"<20170901082618.30622-1-wenyou.yang@microchip.com>","References":"<20170901082618.30622-1-wenyou.yang@microchip.com>","MIME-Version":"1.0","Cc":"Tom Rini <trini@konsulko.com>","Subject":"[U-Boot] [PATCH v4 2/3] board: sama5d2_xplained: Replace code to\n\tset mac address","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"},"content":"Replace the code to set the ethernet mac address with the code from\nthe common folder.\n\nSigned-off-by: Wenyou Yang <wenyou.yang@microchip.com>\n---\n\nChanges in v4: None\nChanges in v3: None\nChanges in v2: None\n\n arch/arm/dts/at91-sama5d2_xplained.dts          |  5 +++\n board/atmel/sama5d2_xplained/sama5d2_xplained.c | 46 +++----------------------\n configs/sama5d2_xplained_mmc_defconfig          |  1 +\n configs/sama5d2_xplained_spiflash_defconfig     |  1 +\n include/configs/sama5d2_xplained.h              |  4 ---\n 5 files changed, 11 insertions(+), 46 deletions(-)","diff":"diff --git a/arch/arm/dts/at91-sama5d2_xplained.dts b/arch/arm/dts/at91-sama5d2_xplained.dts\nindex 3e624f142c..b00aaa2c79 100644\n--- a/arch/arm/dts/at91-sama5d2_xplained.dts\n+++ b/arch/arm/dts/at91-sama5d2_xplained.dts\n@@ -102,6 +102,11 @@\n \t\t\t\tpinctrl-names = \"default\";\n \t\t\t\tpinctrl-0 = <&pinctrl_i2c1_default>;\n \t\t\t\tstatus = \"okay\";\n+\n+\t\t\t\ti2c_eeprom: i2c_eeprom@5c {\n+\t\t\t\t\tcompatible = \"atmel,24mac402\";\n+\t\t\t\t\treg = <0x5c>;\n+\t\t\t\t};\n \t\t\t};\n \n \t\t\tpioA: gpio@fc038000 {\ndiff --git a/board/atmel/sama5d2_xplained/sama5d2_xplained.c b/board/atmel/sama5d2_xplained/sama5d2_xplained.c\nindex 3f0860c555..7e0cb4228f 100644\n--- a/board/atmel/sama5d2_xplained/sama5d2_xplained.c\n+++ b/board/atmel/sama5d2_xplained/sama5d2_xplained.c\n@@ -8,8 +8,6 @@\n #include <common.h>\n #include <atmel_hlcdc.h>\n #include <debug_uart.h>\n-#include <dm.h>\n-#include <i2c.h>\n #include <lcd.h>\n #include <version.h>\n #include <asm/io.h>\n@@ -161,50 +159,14 @@ int dram_init(void)\n \treturn 0;\n }\n \n-#ifdef CONFIG_CMD_I2C\n-static int set_ethaddr_from_eeprom(void)\n-{\n-\tconst int ETH_ADDR_LEN = 6;\n-\tunsigned char ethaddr[ETH_ADDR_LEN];\n-\tconst char *ETHADDR_NAME = \"ethaddr\";\n-\tstruct udevice *bus, *dev;\n-\n-\tif (env_get(ETHADDR_NAME))\n-\t\treturn 0;\n-\n-\tif (uclass_get_device_by_seq(UCLASS_I2C, 1, &bus)) {\n-\t\tprintf(\"Cannot find I2C bus 1\\n\");\n-\t\treturn -1;\n-\t}\n-\n-\tif (dm_i2c_probe(bus, AT24MAC_ADDR, 0, &dev)) {\n-\t\tprintf(\"Failed to probe I2C chip\\n\");\n-\t\treturn -1;\n-\t}\n-\n-\tif (dm_i2c_read(dev, AT24MAC_REG, ethaddr, ETH_ADDR_LEN)) {\n-\t\tprintf(\"Failed to read ethernet address from EEPROM\\n\");\n-\t\treturn -1;\n-\t}\n-\n-\tif (!is_valid_ethaddr(ethaddr)) {\n-\t\tprintf(\"The ethernet address read from EEPROM is not valid!\\n\");\n-\t\treturn -1;\n-\t}\n-\n-\treturn eth_env_set_enetaddr(ETHADDR_NAME, ethaddr);\n-}\n-#else\n-static int set_ethaddr_from_eeprom(void)\n-{\n-\treturn 0;\n-}\n-#endif\n+#define AT24MAC_MAC_OFFSET\t0x9a\n \n #ifdef CONFIG_MISC_INIT_R\n int misc_init_r(void)\n {\n-\tset_ethaddr_from_eeprom();\n+#ifdef CONFIG_I2C_EEPROM\n+\tat91_set_ethaddr(AT24MAC_MAC_OFFSET);\n+#endif\n \n \treturn 0;\n }\ndiff --git a/configs/sama5d2_xplained_mmc_defconfig b/configs/sama5d2_xplained_mmc_defconfig\nindex d59fd8216c..fb7c242b1c 100644\n--- a/configs/sama5d2_xplained_mmc_defconfig\n+++ b/configs/sama5d2_xplained_mmc_defconfig\n@@ -51,6 +51,7 @@ CONFIG_DM_GPIO=y\n CONFIG_ATMEL_PIO4=y\n CONFIG_DM_I2C=y\n CONFIG_SYS_I2C_AT91=y\n+CONFIG_I2C_EEPROM=y\n CONFIG_DM_MMC=y\n CONFIG_MMC_SDHCI=y\n CONFIG_MMC_SDHCI_ATMEL=y\ndiff --git a/configs/sama5d2_xplained_spiflash_defconfig b/configs/sama5d2_xplained_spiflash_defconfig\nindex a997aa74bd..24698876ba 100644\n--- a/configs/sama5d2_xplained_spiflash_defconfig\n+++ b/configs/sama5d2_xplained_spiflash_defconfig\n@@ -49,6 +49,7 @@ CONFIG_DM_GPIO=y\n CONFIG_ATMEL_PIO4=y\n CONFIG_DM_I2C=y\n CONFIG_SYS_I2C_AT91=y\n+CONFIG_I2C_EEPROM=y\n CONFIG_DM_MMC=y\n CONFIG_MMC_SDHCI=y\n CONFIG_MMC_SDHCI_ATMEL=y\ndiff --git a/include/configs/sama5d2_xplained.h b/include/configs/sama5d2_xplained.h\nindex 9ceb91924d..891218d83e 100644\n--- a/include/configs/sama5d2_xplained.h\n+++ b/include/configs/sama5d2_xplained.h\n@@ -35,10 +35,6 @@\n #define CONFIG_SF_DEFAULT_SPEED\t\t30000000\n #endif\n \n-/* I2C */\n-#define AT24MAC_ADDR\t\t0x5c\n-#define AT24MAC_REG\t\t0x9a\n-\n /* LCD */\n \n #ifdef CONFIG_LCD\n","prefixes":["U-Boot","v4","2/3"]}