blob: 09c803ccd4e90838ed8ffdebec3e8e5df37c2188 [file] [log] [blame]
Michael Schwingenbc243452008-01-16 19:51:55 +01001/*
2 * (C) Copyright 2007
3 * Michael Schwingen, michael@schwingen.org
4 *
5 * (C) Copyright 2006
6 * Stefan Roese, DENX Software Engineering, sr@denx.de.
7 *
8 * (C) Copyright 2002
9 * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net
10 *
11 * (C) Copyright 2002
12 * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
13 * Marius Groeger <mgroeger@sysgo.de>
14 *
Wolfgang Denk1a459662013-07-08 09:37:19 +020015 * SPDX-License-Identifier: GPL-2.0+
Michael Schwingenbc243452008-01-16 19:51:55 +010016 */
17
18#include <common.h>
19#include <command.h>
20#include <malloc.h>
21#include <asm/arch/ixp425.h>
22#include <asm/io.h>
Michael Schwingenbc243452008-01-16 19:51:55 +010023#include <miiphy.h>
Michael Schwingenbc243452008-01-16 19:51:55 +010024#include "actux3_hw.h"
25
26DECLARE_GLOBAL_DATA_PTR;
27
Michael Schwingen8b5ab4c2011-05-23 00:00:06 +020028int board_early_init_f(void)
29{
30 /* CS1: IPAC-X */
31 writel(0x94d10013, IXP425_EXP_CS1);
32 /* CS5: Debug port */
33 writel(0x9d520003, IXP425_EXP_CS5);
34 /* CS6: Release/Option register */
35 writel(0x81860001, IXP425_EXP_CS6);
36 /* CS7: LEDs */
37 writel(0x80900003, IXP425_EXP_CS7);
38
39 return 0;
40}
41
42int board_init(void)
Michael Schwingenbc243452008-01-16 19:51:55 +010043{
Michael Schwingenbc243452008-01-16 19:51:55 +010044 /* adress of boot parameters */
45 gd->bd->bi_boot_params = 0x00000100;
46
Michael Schwingen8b5ab4c2011-05-23 00:00:06 +020047 GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_IORST);
48 GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_ETHRST);
49 GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_DSR);
50 GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_DCD);
51 GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_LED5_GN);
52 GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_LED6_RT);
53 GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_LED6_GN);
Michael Schwingenbc243452008-01-16 19:51:55 +010054
Michael Schwingen8b5ab4c2011-05-23 00:00:06 +020055 GPIO_OUTPUT_CLEAR(CONFIG_SYS_GPIO_IORST);
56 GPIO_OUTPUT_CLEAR(CONFIG_SYS_GPIO_ETHRST);
Michael Schwingenbc243452008-01-16 19:51:55 +010057
Michael Schwingen8b5ab4c2011-05-23 00:00:06 +020058 GPIO_OUTPUT_CLEAR(CONFIG_SYS_GPIO_DSR);
59 GPIO_OUTPUT_SET(CONFIG_SYS_GPIO_DCD);
Michael Schwingenbc243452008-01-16 19:51:55 +010060
Michael Schwingen8b5ab4c2011-05-23 00:00:06 +020061 GPIO_OUTPUT_CLEAR(CONFIG_SYS_GPIO_LED5_GN);
62 GPIO_OUTPUT_CLEAR(CONFIG_SYS_GPIO_LED6_RT);
63 GPIO_OUTPUT_CLEAR(CONFIG_SYS_GPIO_LED6_GN);
Michael Schwingenbc243452008-01-16 19:51:55 +010064
65 /*
66 * Setup GPIO's for Interrupt inputs
67 */
Michael Schwingen8b5ab4c2011-05-23 00:00:06 +020068 GPIO_OUTPUT_DISABLE(CONFIG_SYS_GPIO_DBGINT);
69 GPIO_OUTPUT_DISABLE(CONFIG_SYS_GPIO_ETHINT);
Michael Schwingenbc243452008-01-16 19:51:55 +010070
71 /*
72 * Setup GPIO's for 33MHz clock output
73 */
Michael Schwingen8b5ab4c2011-05-23 00:00:06 +020074 GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_PCI_CLK);
75 GPIO_OUTPUT_ENABLE(CONFIG_SYS_GPIO_EXTBUS_CLK);
76 writel(0x011001FF, IXP425_GPIO_GPCLKR);
Michael Schwingenbc243452008-01-16 19:51:55 +010077
Michael Schwingen8b5ab4c2011-05-23 00:00:06 +020078 /* we need a minimum PCI reset pulse width after enabling the clock */
79 udelay(533);
80 GPIO_OUTPUT_SET(CONFIG_SYS_GPIO_IORST);
81 GPIO_OUTPUT_SET(CONFIG_SYS_GPIO_ETHRST);
Michael Schwingenbc243452008-01-16 19:51:55 +010082
Michael Schwingen8b5ab4c2011-05-23 00:00:06 +020083 ACTUX3_LED1_RT(1);
84 ACTUX3_LED1_GN(0);
85 ACTUX3_LED2_RT(0);
86 ACTUX3_LED2_GN(0);
87 ACTUX3_LED3_RT(0);
88 ACTUX3_LED3_GN(0);
89 ACTUX3_LED4_GN(0);
90 ACTUX3_LED5_RT(0);
Michael Schwingenbc243452008-01-16 19:51:55 +010091
92 return 0;
93}
94
95/*
96 * Check Board Identity
97 */
Michael Schwingen8b5ab4c2011-05-23 00:00:06 +020098int checkboard(void)
Michael Schwingenbc243452008-01-16 19:51:55 +010099{
Wolfgang Denkf0c0b3a2011-05-04 10:32:28 +0000100 char buf[64];
101 int i = getenv_f("serial#", buf, sizeof(buf));
Michael Schwingenbc243452008-01-16 19:51:55 +0100102
Michael Schwingen8b5ab4c2011-05-23 00:00:06 +0200103 puts("Board: AcTux-3 rev.");
104 putc(ACTUX3_BOARDREL + 'A' - 1);
Michael Schwingenbc243452008-01-16 19:51:55 +0100105
Wolfgang Denkf0c0b3a2011-05-04 10:32:28 +0000106 if (i > 0) {
Michael Schwingenbc243452008-01-16 19:51:55 +0100107 puts (", serial# ");
Wolfgang Denkf0c0b3a2011-05-04 10:32:28 +0000108 puts (buf);
Michael Schwingenbc243452008-01-16 19:51:55 +0100109 }
Michael Schwingen8b5ab4c2011-05-23 00:00:06 +0200110 putc('\n');
Michael Schwingenbc243452008-01-16 19:51:55 +0100111
Michael Schwingen8b5ab4c2011-05-23 00:00:06 +0200112 return 0;
Michael Schwingenbc243452008-01-16 19:51:55 +0100113}
114
115/*************************************************************************
116 * get_board_rev() - setup to pass kernel board revision information
117 * 0 = reserved
118 * 1 = Rev. A
119 * 2 = Rev. B
120 *************************************************************************/
Michael Schwingen8b5ab4c2011-05-23 00:00:06 +0200121u32 get_board_rev(void)
Michael Schwingenbc243452008-01-16 19:51:55 +0100122{
123 return ACTUX3_BOARDREL;
124}
125
Michael Schwingen8b5ab4c2011-05-23 00:00:06 +0200126int dram_init(void)
Michael Schwingenbc243452008-01-16 19:51:55 +0100127{
Michael Schwingen8b5ab4c2011-05-23 00:00:06 +0200128 gd->ram_size = get_ram_size(CONFIG_SYS_SDRAM_BASE, 128<<20);
129 return 0;
Michael Schwingenbc243452008-01-16 19:51:55 +0100130}
131
Michael Schwingen8b5ab4c2011-05-23 00:00:06 +0200132void reset_phy(void)
Michael Schwingenbc243452008-01-16 19:51:55 +0100133{
134 int i;
135
136 /* initialize the PHY */
Michael Schwingen8b5ab4c2011-05-23 00:00:06 +0200137 miiphy_reset("NPE0", CONFIG_PHY_ADDR);
Michael Schwingenbc243452008-01-16 19:51:55 +0100138
139 /* all LED outputs = Link/Act */
Michael Schwingen8b5ab4c2011-05-23 00:00:06 +0200140 miiphy_write("NPE0", CONFIG_PHY_ADDR, 0x16, 0x0AAA);
Michael Schwingenbc243452008-01-16 19:51:55 +0100141
142 /*
143 * The Marvell 88E6060 switch comes up with all ports disabled.
144 * set all ethernet switch ports to forwarding state
145 */
146 for (i = 1; i <= 5; i++)
Michael Schwingen8b5ab4c2011-05-23 00:00:06 +0200147 miiphy_write("NPE0", CONFIG_PHY_ADDR + 8 + i, 0x04, 0x03);
Michael Schwingenbc243452008-01-16 19:51:55 +0100148
149}