{"id":808582,"url":"http://patchwork.ozlabs.org/api/1.0/patches/808582/?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-2-wenyou.yang@microchip.com>","date":"2017-09-01T08:26:16","name":"[U-Boot,v4,1/3] board: atmel: Create board/$(VENDOR)/common folder","commit_ref":"d9b23e26f0b663752e915763d6e2da2fd12fe4b2","pull_url":null,"state":"accepted","archived":false,"hash":"69ab7d3fc89a9b237d1864fb80dd8312b44464e2","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-2-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/808582/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 3xkCDl4sf8z9sPk\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  1 Sep 2017 18:33:11 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 5F303C21DC5; Fri,  1 Sep 2017 08:31:45 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id C9D12C21F00;\n\tFri,  1 Sep 2017 08:31:30 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid A57E5C21EE1; Fri,  1 Sep 2017 08:30:27 +0000 (UTC)","from DVREDG01.corp.atmel.com (nasmtp01.atmel.com [192.199.1.245])\n\tby lists.denx.de (Postfix) with ESMTPS id 88F6FC21EB4\n\tfor <u-boot@lists.denx.de>; Fri,  1 Sep 2017 08:30:24 +0000 (UTC)","from apsmtp01.atmel.com (10.168.254.30) by DVREDG01.corp.atmel.com\n\t(10.42.103.30) with Microsoft SMTP Server (TLS) id 14.3.235.1;\n\tFri, 1 Sep 2017 02:29:44 -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:46 +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:16 +0800","Message-ID":"<20170901082618.30622-2-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 1/3] board: atmel: Create board/$(VENDOR)/common\n\tfolder","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":"Create board/$(VENDOR)/common folder to accommodate the common code\nshared by other atmel boards, now put the code to set ethernet mac\naddress from eeprom, which uses the i2c eeprom driver.\n\nSigned-off-by: Wenyou Yang <wenyou.yang@microchip.com>\n---\n\nChanges in v4:\n - Follow up the env function renaming.\n\nChanges in v3: None\nChanges in v2: None\n\n arch/arm/mach-at91/include/mach/at91_common.h |  2 ++\n board/atmel/common/Makefile                   | 11 ++++++++\n board/atmel/common/board.c                    | 12 +++++++++\n board/atmel/common/mac_eeprom.c               | 36 +++++++++++++++++++++++++++\n 4 files changed, 61 insertions(+)\n create mode 100644 board/atmel/common/Makefile\n create mode 100644 board/atmel/common/board.c\n create mode 100644 board/atmel/common/mac_eeprom.c","diff":"diff --git a/arch/arm/mach-at91/include/mach/at91_common.h b/arch/arm/mach-at91/include/mach/at91_common.h\nindex 0742ffc56f..a95fe41610 100644\n--- a/arch/arm/mach-at91/include/mach/at91_common.h\n+++ b/arch/arm/mach-at91/include/mach/at91_common.h\n@@ -36,4 +36,6 @@ void matrix_init(void);\n void redirect_int_from_saic_to_aic(void);\n void configure_2nd_sram_as_l2_cache(void);\n \n+int at91_set_ethaddr(int offset);\n+\n #endif /* AT91_COMMON_H */\ndiff --git a/board/atmel/common/Makefile b/board/atmel/common/Makefile\nnew file mode 100644\nindex 0000000000..6d9c6850b5\n--- /dev/null\n+++ b/board/atmel/common/Makefile\n@@ -0,0 +1,11 @@\n+#\n+# Copyright (C) 2017 Microchip\n+#\t\t      Wenyou Yang <wenyou.yang@microchip.com>\n+#\n+# SPDX-License-Identifier:\tGPL-2.0+\n+#\n+\n+obj-y += board.o\n+ifndef CONFIG_SPL_BUILD\n+obj-$(CONFIG_I2C_EEPROM) += mac_eeprom.o\n+endif\ndiff --git a/board/atmel/common/board.c b/board/atmel/common/board.c\nnew file mode 100644\nindex 0000000000..7e326d925b\n--- /dev/null\n+++ b/board/atmel/common/board.c\n@@ -0,0 +1,12 @@\n+/*\n+ * Copyright (C) 2017 Microchip\n+ *\t\t      Wenyou Yang <wenyou.yang@microchip.com>\n+ *\n+ * SPDX-License-Identifier:\tGPL-2.0+\n+ */\n+\n+#include <common.h>\n+\n+void dummy(void)\n+{\n+}\ndiff --git a/board/atmel/common/mac_eeprom.c b/board/atmel/common/mac_eeprom.c\nnew file mode 100644\nindex 0000000000..60ddf00d45\n--- /dev/null\n+++ b/board/atmel/common/mac_eeprom.c\n@@ -0,0 +1,36 @@\n+/*\n+ * Copyright (C) 2017 Microchip\n+ *\t\t      Wenyou Yang <wenyou.yang@microchip.com>\n+ *\n+ * SPDX-License-Identifier:\tGPL-2.0+\n+ */\n+\n+#include <common.h>\n+#include <dm.h>\n+#include <i2c_eeprom.h>\n+#include <netdev.h>\n+\n+int at91_set_ethaddr(int offset)\n+{\n+\tconst int ETH_ADDR_LEN = 6;\n+\tunsigned char ethaddr[ETH_ADDR_LEN];\n+\tconst char *ETHADDR_NAME = \"ethaddr\";\n+\tstruct udevice *dev;\n+\tint ret;\n+\n+\tif (env_get(ETHADDR_NAME))\n+\t\treturn 0;\n+\n+\tret = uclass_first_device_err(UCLASS_I2C_EEPROM, &dev);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tret = i2c_eeprom_read(dev, offset, ethaddr, 6);\n+\tif (ret)\n+\t\treturn ret;\n+\n+\tif (is_valid_ethaddr(ethaddr))\n+\t\teth_env_set_enetaddr(ETHADDR_NAME, ethaddr);\n+\n+\treturn 0;\n+}\n","prefixes":["U-Boot","v4","1/3"]}