From patchwork Thu Sep 8 10:42:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Bhargav X-Patchwork-Id: 113885 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 4F52AB6F77 for ; Thu, 8 Sep 2011 20:43:33 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 44FBA28195; Thu, 8 Sep 2011 12:43:28 +0200 (CEST) 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 lUsJYymJ-bYJ; Thu, 8 Sep 2011 12:43:27 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C03FD2819A; Thu, 8 Sep 2011 12:43:23 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 09019281AD for ; Thu, 8 Sep 2011 12:43:22 +0200 (CEST) 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 kLAFt5mUmCGP for ; Thu, 8 Sep 2011 12:43:15 +0200 (CEST) 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 ahm.einfochips.com (ahm.einfochips.com [203.76.128.206]) by theia.denx.de (Postfix) with ESMTP id D6B7F28195 for ; Thu, 8 Sep 2011 12:43:11 +0200 (CEST) Received: from localhost (localhost.localdomain [127.0.0.1]) by ahm.einfochips.com (Postfix) with ESMTP id 4303DA60804E; Thu, 8 Sep 2011 16:02:01 +0530 (IST) X-Virus-Scanned: amavisd-new at einfochips.com Received: from ahm.einfochips.com ([127.0.0.1]) by localhost (ahm.einfochips.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8GBWdmnVfB8H; Thu, 8 Sep 2011 16:02:01 +0530 (IST) Received: from localhost.localdomain (unknown [192.168.9.182]) by ahm.einfochips.com (Postfix) with ESMTPA id 1FA3DA608029; Thu, 8 Sep 2011 16:02:01 +0530 (IST) From: Ajay Bhargav To: prafulla@marvell.com Date: Thu, 8 Sep 2011 16:12:57 +0530 Message-Id: <1315478577-8696-3-git-send-email-ajay.bhargav@einfochips.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: References: Cc: u-boot@lists.denx.de, Ajay Bhargav Subject: [U-Boot] [PATCH v6 3/3] Armada100: Enable 88E3015 PHY support for GplugD X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 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 patch adds support for 88E3015 PHY for Marvell GplugD board. This patch depends on series of patch which adds support for Marvell GuruPlug-Display. Signed-off-by: Ajay Bhargav --- Changes for v2: - Not changed Changes for v3: - code cleanup; removed unwated cast Changes for v4: - Not changed Changes for v5: - Coding style cleanup Changes for v6: - Not changed board/Marvell/gplugd/gplugd.c | 33 +++++++++++++++++++++++++++++++++ include/configs/gplugd.h | 14 ++++++++++++++ 2 files changed, 47 insertions(+), 0 deletions(-) diff --git a/board/Marvell/gplugd/gplugd.c b/board/Marvell/gplugd/gplugd.c index 8560b3f..b4f7f81 100644 --- a/board/Marvell/gplugd/gplugd.c +++ b/board/Marvell/gplugd/gplugd.c @@ -32,6 +32,8 @@ #include #include #include +#include +#include #ifdef CONFIG_ARMADA100_FEC #include @@ -83,6 +85,11 @@ int board_init(void) gd->bd->bi_arch_number = MACH_TYPE_SHEEVAD; /* adress of boot parameters */ gd->bd->bi_boot_params = armd1_sdram_base(0) + 0x100; + /* Assert PHY_RST# */ + gpio_direction_output(CONFIG_SYS_GPIO_PHY_RST, GPIO_LOW); + udelay(10); + /* Deassert PHY_RST# */ + gpio_set_value(CONFIG_SYS_GPIO_PHY_RST, GPIO_HIGH); return 0; } @@ -97,4 +104,30 @@ int board_eth_init(bd_t *bis) return armada100_fec_register(ARMD1_FEC_BASE); } + +#ifdef CONFIG_RESET_PHY_R +/* Configure and initialize PHY chip 88E3015 */ +void reset_phy(void) +{ + u16 phy_adr; + const char *name = "armd-fec0"; + + if (miiphy_set_current_dev(name)) + return; + + /* command to read PHY dev address */ + if (miiphy_read(name, 0xff, 0xff, &phy_adr)) { + printf("Err..%s could not read PHY dev address\n", __func__); + return; + } + + /* Set Ethernet LED in TX blink mode */ + miiphy_write(name, phy_adr, PHY_LED_MAN_REG, 0x00); + miiphy_write(name, phy_adr, PHY_LED_PAR_SEL_REG, PHY_LED_VAL); + + /* reset the phy */ + miiphy_reset(name, phy_adr); + debug("88E3015 Initialized on %s\n", name); +} +#endif /* CONFIG_RESET_PHY_R */ #endif /* CONFIG_ARMADA100_FEC */ diff --git a/include/configs/gplugd.h b/include/configs/gplugd.h index 3ad2de5..5f72163 100644 --- a/include/configs/gplugd.h +++ b/include/configs/gplugd.h @@ -77,6 +77,20 @@ #define CONFIG_BOOTP_DHCP_REQUEST_DELAY 50000 #endif /* CONFIG_CMD_NET */ +/* GPIO Support */ +#define CONFIG_MARVELL_GPIO + +/* PHY configuration */ +#define CONFIG_MII +#define CONFIG_CMD_MII +#define CONFIG_RESET_PHY_R +/* 88E3015 register definition */ +#define PHY_LED_PAR_SEL_REG 22 +#define PHY_LED_MAN_REG 25 +#define PHY_LED_VAL 0x5b /* LINK LED1, ACT LED2 */ +/* GPIO Configuration for PHY */ +#define CONFIG_SYS_GPIO_PHY_RST 104 /* GPIO104 */ + /* * mv-common.h should be defined after CMD configs since it used them * to enable certain macros