From patchwork Wed Apr 10 13:12:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suriyan Ramasami X-Patchwork-Id: 235391 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 657762C00BF for ; Wed, 10 Apr 2013 23:15:00 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9FF394A0B8; Wed, 10 Apr 2013 15:14:41 +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 dKEjSCmetmmg; Wed, 10 Apr 2013 15:14:41 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C82514A039; Wed, 10 Apr 2013 15:14:11 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BDA6B4A04C for ; Wed, 10 Apr 2013 15:14:06 +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 rWI6xVOsbQve for ; Wed, 10 Apr 2013 15:14:04 +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 mail-ie0-f177.google.com (mail-ie0-f177.google.com [209.85.223.177]) by theia.denx.de (Postfix) with ESMTPS id 338844A044 for ; Wed, 10 Apr 2013 15:13:49 +0200 (CEST) Received: by mail-ie0-f177.google.com with SMTP id 9so160340iec.22 for ; Wed, 10 Apr 2013 06:13:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=Fkc456yXt2IJcwYnwS46/f3me8ToOOlAbkxB8fRAJWo=; b=PhU10O4M885eDh/od5C00tEbEVu1SLzAQ18mmhCR+Bw4XpX2o6tfxQND69u78UKon6 4MBVVer0kD7avi51wwV7Wcf0NATcHhTfIlYJ4UvwG2LwwfZ/shI/w59+iP71SAZQiT+j z2ti8ofCGjVkmMQF57V4/oOEjQclNueeq64RLIImI740k33adEs27tqumxitdclzMqmQ 6B6el5X0H7HZETNWa3kCw65QsmRD3tzWQUw1FG7Zws+9h1zmooZA+o3ibXPilckIpTLB xIhnMa+XFKk3u/8Wutzc3Q1ae3KTKjMNRJ195CLnjQ0Qdh17nXgJ9epZlVHPSUjLyAnn fZXQ== X-Received: by 10.50.114.194 with SMTP id ji2mr12762871igb.40.1365599628359; Wed, 10 Apr 2013 06:13:48 -0700 (PDT) Received: from localhost.localdomain (75-101-50-252.dsl.static.sonic.net. [75.101.50.252]) by mx.google.com with ESMTPS id xf4sm27152406igb.8.2013.04.10.06.13.47 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 10 Apr 2013 06:13:47 -0700 (PDT) From: Suriyan Ramasami To: u-boot@lists.denx.de Date: Wed, 10 Apr 2013 06:12:16 -0700 Message-Id: <1365599537-14138-8-git-send-email-suriyan.r@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1365599537-14138-1-git-send-email-suriyan.r@gmail.com> References: <1365599537-14138-1-git-send-email-suriyan.r@gmail.com> Cc: ecc@cmu.edu Subject: [U-Boot] [PATCH v2 7/8] ARM: Add Seagate GoFlexHome 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 Start with the dockstar file. Include goflexhome.h instead of dockstar.h Change #define DOCKSTAR_* to #define GOFLEXHOME_* Change the MACH_TYPE_DOCKSTAR to MACH_TYPE_GOFLEXHOME to reflect that its a GoFlexHome. Signed-off-by: Suriyan Ramasami --- Changes in v2: Coding style changes board/Seagate/goflexhome/goflexhome.c | 187 +++++++++++++++++++++++++++++++++ 1 files changed, 187 insertions(+), 0 deletions(-) create mode 100644 board/Seagate/goflexhome/goflexhome.c diff --git a/board/Seagate/goflexhome/goflexhome.c b/board/Seagate/goflexhome/goflexhome.c new file mode 100644 index 0000000..c1314fb --- /dev/null +++ b/board/Seagate/goflexhome/goflexhome.c @@ -0,0 +1,187 @@ +/* + * Copyright (C) 2013 Suriyan Ramasami + * + * Based on dockstar.c originally written by + * Copyright (C) 2010 Eric C. Cooper + * + * Based on sheevaplug.c originally written by + * Prafulla Wadaskar + * (C) Copyright 2009 + * Marvell Semiconductor + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#include +#include +#include +#include +#include +#include +#include "goflexhome.h" + + +DECLARE_GLOBAL_DATA_PTR; + +int board_early_init_f(void) +{ + /* + * default gpio configuration + * There are maximum 64 gpios controlled through 2 sets of registers + * the below configuration configures mainly initial LED status + */ + kw_config_gpio(GOFLEXHOME_OE_VAL_LOW, + GOFLEXHOME_OE_VAL_HIGH, + GOFLEXHOME_OE_LOW, GOFLEXHOME_OE_HIGH); + + /* Multi-Purpose Pins Functionality configuration */ + static const u32 kwmpp_config[] = { + MPP0_NF_IO2, + MPP1_NF_IO3, + MPP2_NF_IO4, + MPP3_NF_IO5, + MPP4_NF_IO6, + MPP5_NF_IO7, + MPP6_SYSRST_OUTn, + MPP7_GPO, + MPP8_UART0_RTS, + MPP9_UART0_CTS, + MPP10_UART0_TXD, + MPP11_UART0_RXD, + MPP12_SD_CLK, + MPP13_SD_CMD, + MPP14_SD_D0, + MPP15_SD_D1, + MPP16_SD_D2, + MPP17_SD_D3, + MPP18_NF_IO0, + MPP19_NF_IO1, + MPP20_GPIO, + MPP21_GPIO, + MPP22_GPIO, + MPP23_GPIO, + MPP24_GPIO, + MPP25_GPIO, + MPP26_GPIO, + MPP27_GPIO, + MPP28_GPIO, + MPP29_TSMP9, + MPP30_GPIO, + MPP31_GPIO, + MPP32_GPIO, + MPP33_GPIO, + MPP34_GPIO, + MPP35_GPIO, + MPP36_GPIO, + MPP37_GPIO, + MPP38_GPIO, + MPP39_GPIO, + MPP40_GPIO, + MPP41_GPIO, + MPP42_GPIO, + MPP43_GPIO, + MPP44_GPIO, + MPP45_GPIO, + MPP46_GPIO, + MPP47_GPIO, + MPP48_GPIO, + MPP49_GPIO, + 0 + }; + kirkwood_mpp_conf(kwmpp_config, NULL); + return 0; +} + +int board_init(void) +{ + /* + * arch number of board + */ + gd->bd->bi_arch_number = MACH_TYPE_GOFLEXHOME; + + /* address of boot parameters */ + gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100; + + return 0; +} + +#ifdef CONFIG_RESET_PHY_R +/* Configure and enable MV88E1116 PHY */ +void reset_phy(void) +{ + u16 reg; + u16 devadr; + char *name = "egiga0"; + + if (miiphy_set_current_dev(name)) + return; + + /* command to read PHY dev address */ + if (miiphy_read(name, 0xEE, 0xEE, (u16 *)&devadr)) { + printf("Err..%s could not read PHY dev address\n", + __func__); + return; + } + + /* + * Enable RGMII delay on Tx and Rx for CPU port + * Ref: sec 4.7.2 of chip datasheet + */ + miiphy_write(name, devadr, MV88E1116_PGADR_REG, 2); + miiphy_read(name, devadr, MV88E1116_MAC_CTRL_REG, ®); + reg |= (MV88E1116_RGMII_RXTM_CTRL | MV88E1116_RGMII_TXTM_CTRL); + miiphy_write(name, devadr, MV88E1116_MAC_CTRL_REG, reg); + miiphy_write(name, devadr, MV88E1116_PGADR_REG, 0); + + /* reset the phy */ + miiphy_reset(name, devadr); + + printf("88E1116 Initialized on %s\n", name); +} +#endif /* CONFIG_RESET_PHY_R */ + +#define GREEN_LED (1 << 14) +#define ORANGE_LED (1 << 15) +#define BOTH_LEDS (GREEN_LED | ORANGE_LED) +#define NEITHER_LED 0 + +static void set_leds(u32 leds, u32 blinking) +{ + struct kwgpio_registers *r = (struct kwgpio_registers *)KW_GPIO1_BASE; + u32 oe = readl(&r->oe) | BOTH_LEDS; + writel(oe & ~leds, &r->oe); /* active low */ + u32 bl = readl(&r->blink_en) & ~BOTH_LEDS; + writel(bl | blinking, &r->blink_en); +} + +void show_boot_progress(int val) +{ + switch (val) { + case BOOTSTAGE_ID_RUN_OS: /* booting Linux */ + set_leds(BOTH_LEDS, NEITHER_LED); + break; + case BOOTSTAGE_ID_NET_ETH_START: /* Ethernet initialization */ + set_leds(GREEN_LED, GREEN_LED); + break; + default: + if (val < 0) /* error */ + set_leds(ORANGE_LED, ORANGE_LED); + break; + } +}