From patchwork Mon Jan 28 20:01:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Otavio Salvador X-Patchwork-Id: 216357 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id DC28D2C00C6 for ; Tue, 29 Jan 2013 06:58:09 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3A1CE4A136; Mon, 28 Jan 2013 20:58:02 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XKNq3Z1Xci5r; Mon, 28 Jan 2013 20:58:02 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C3EDC4A162; Mon, 28 Jan 2013 20:57:48 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 760D54A12E for ; Mon, 28 Jan 2013 20:57:43 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xjdKoGWqstKZ for ; Mon, 28 Jan 2013 20:57:42 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-ye0-f169.google.com (mail-ye0-f169.google.com [209.85.213.169]) by theia.denx.de (Postfix) with ESMTPS id 7723D4A146 for ; Mon, 28 Jan 2013 20:57:36 +0100 (CET) Received: by mail-ye0-f169.google.com with SMTP id l13so473123yen.28 for ; Mon, 28 Jan 2013 11:57:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=hlcqGPxDzhLf1aiuK9nwz+S73J8Ff851IaNJ1uzripk=; b=CISUenyVDe6v4nxMjlx+1f9ioS04xcCuixzEX7lOTvalWSFsnvAZf+jAXbS1+ehxtg vv0Vh3As530nv9TV8nSTxkcui9SfZ4f4ZBBH7X1+Sn3lJKinESYY6cVncK97sw1NZJZl 85xOAOzrv/y1a2TfczsfpI8RjQvAf9kvFC7m57j7IatWNNDVo/aXt4PTCOnH1kE1+LmS DMnUZIKJsRIFy98rFbLub9YsjURc3QSsaCCtR9I+o/LhUCIrCpu+7Xzl9Z7c5ff8B4zF 5ILUlRWbk06iG/yBxJ/+FrOui4TcC3861P4/CZ0hXBG/DvIYTd+WStwb/qzHwAKlKgan cx6A== X-Received: by 10.236.173.1 with SMTP id u1mr16817957yhl.2.1359403054367; Mon, 28 Jan 2013 11:57:34 -0800 (PST) Received: from nano.lab.ossystems.com.br ([177.35.66.48]) by mx.google.com with ESMTPS id h4sm11086789yhi.18.2013.01.28.11.57.32 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 28 Jan 2013 11:57:33 -0800 (PST) From: Otavio Salvador To: u-boot@lists.denx.de Date: Mon, 28 Jan 2013 18:01:46 -0200 Message-Id: <1359403306-18389-4-git-send-email-otavio@ossystems.com.br> X-Mailer: git-send-email 1.8.1 In-Reply-To: <1359403306-18389-1-git-send-email-otavio@ossystems.com.br> References: <1359403306-18389-1-git-send-email-otavio@ossystems.com.br> Cc: Fabio Estevam , Marek Vasut , Otavio Salvador Subject: [U-Boot] [PATCH v2 4/4] mx23_olinuxino: Add ethernet support X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This adds support to the LAN9212 chip included in the board and extend the environment to easy netboot use. Signed-off-by: Otavio Salvador --- Changes in v2: - Move GPIO initialization to board_early_init_f; - Extend commitlog; board/olimex/mx23_olinuxino/mx23_olinuxino.c | 6 +++++ board/olimex/mx23_olinuxino/spl_boot.c | 4 +++ include/configs/mx23_olinuxino.h | 40 +++++++++++++++++++++++++--- 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/board/olimex/mx23_olinuxino/mx23_olinuxino.c b/board/olimex/mx23_olinuxino/mx23_olinuxino.c index 2501417..b2090b2 100644 --- a/board/olimex/mx23_olinuxino/mx23_olinuxino.c +++ b/board/olimex/mx23_olinuxino/mx23_olinuxino.c @@ -45,6 +45,11 @@ int board_early_init_f(void) /* SSP0 clock at 96MHz */ mxs_set_sspclk(MXC_SSPCLK0, 96000, 0); +#ifdef CONFIG_USB_EHCI + /* Enable LAN9512 */ + gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 1); +#endif + return 0; } @@ -53,6 +58,7 @@ int dram_init(void) return mxs_dram_init(); } + #ifdef CONFIG_CMD_MMC static int mx23_olx_mmc_cd(int id) { diff --git a/board/olimex/mx23_olinuxino/spl_boot.c b/board/olimex/mx23_olinuxino/spl_boot.c index 3bbf5ad..8f7ba0b 100644 --- a/board/olimex/mx23_olinuxino/spl_boot.c +++ b/board/olimex/mx23_olinuxino/spl_boot.c @@ -95,6 +95,10 @@ const iomux_cfg_t iomux_setup[] = { MX23_PAD_SSP1_DATA2__SSP1_DATA2 | MUX_CONFIG_SSP, MX23_PAD_SSP1_DATA3__SSP1_DATA3 | MUX_CONFIG_SSP, MX23_PAD_SSP1_SCK__SSP1_SCK | MUX_CONFIG_SSP, + + /* Ethernet */ + MX23_PAD_GPMI_ALE__GPIO_0_17 | + (MXS_PAD_12MA | MXS_PAD_3V3), }; void board_init_ll(void) diff --git a/include/configs/mx23_olinuxino.h b/include/configs/mx23_olinuxino.h index e081c49..2c81fb6 100644 --- a/include/configs/mx23_olinuxino.h +++ b/include/configs/mx23_olinuxino.h @@ -55,11 +55,13 @@ #define CONFIG_DOS_PARTITION #define CONFIG_CMD_CACHE +#define CONFIG_CMD_DHCP #define CONFIG_CMD_EXT2 #define CONFIG_CMD_FAT #define CONFIG_CMD_GPIO #define CONFIG_CMD_LED #define CONFIG_CMD_MMC +#define CONFIG_CMD_NET #define CONFIG_CMD_USB /* @@ -150,6 +152,12 @@ #define CONFIG_USB_STORAGE #endif +/* Ethernet */ +#ifdef CONFIG_CMD_NET +#define CONFIG_USB_HOST_ETHER +#define CONFIG_USB_ETHER_SMSC95XX +#endif + /* * Boot Linux */ @@ -175,6 +183,7 @@ /* * Extra Environments */ + #define CONFIG_EXTRA_ENV_SETTINGS \ "update_sd_firmware_filename=u-boot.sd\0" \ "update_sd_firmware=" /* Update the SD firmware partition */ \ @@ -191,6 +200,7 @@ "fdt_file=imx23-olinuxino.dtb\0" \ "fdt_addr=0x41000000\0" \ "boot_fdt=try\0" \ + "ip_dyn=yes\0" \ "mmcdev=0\0" \ "mmcpart=2\0" \ "mmcroot=/dev/mmcblk0p3 rw rootwait\0" \ @@ -216,6 +226,31 @@ "fi; " \ "else " \ "bootm; " \ + "fi;\0" \ + "netargs=setenv bootargs console=${console_mainline},${baudrate} " \ + "root=/dev/nfs " \ + "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \ + "netboot=echo Booting from net ...; " \ + "usb start; " \ + "run netargs; " \ + "if test ${ip_dyn} = yes; then " \ + "setenv get_cmd dhcp; " \ + "else " \ + "setenv get_cmd tftp; " \ + "fi; " \ + "${get_cmd} ${uimage}; " \ + "if test ${boot_fdt} = yes; then " \ + "if ${get_cmd} ${fdt_addr} ${fdt_file}; then " \ + "bootm ${loadaddr} - ${fdt_addr}; " \ + "else " \ + "if test ${boot_fdt} = try; then " \ + "bootm; " \ + "else " \ + "echo WARN: Cannot load the DT; " \ + "fi;" \ + "fi; " \ + "else " \ + "bootm; " \ "fi;\0" #define CONFIG_BOOTCOMMAND \ @@ -225,10 +260,9 @@ "else " \ "if run loaduimage; then " \ "run mmcboot; " \ - "else " \ - "echo ERR: Fail to boot from MMC; " \ + "else run netboot; " \ "fi; " \ "fi; " \ - "else exit; fi" + "else run netboot; fi" #endif /* __MX23_OLINUXINO_CONFIG_H__ */