[U-Boot] [PATCH] non-working dns323 config
Rogan Dawes
rogan at dawes.za.net
Mon Aug 16 23:11:05 CEST 2010
From: Rogan Dawes <rogan at dawes.za.net>
---
arch/arm/include/asm/arch-orion5x/cpu.h | 2 +-
board/D-Link/dns323_b1/Makefile | 53 +++++++++++++
board/D-Link/dns323_b1/config.mk | 27 +++++++
board/D-Link/dns323_b1/dns323_b1.c | 129 +++++++++++++++++++++++++++++++
board/D-Link/dns323_b1/dns323_b1.h | 41 ++++++++++
boards.cfg | 1 +
include/configs/dns323_b1.h | 126 ++++++++++++++++++++++++++++++
7 files changed, 378 insertions(+), 1 deletions(-)
create mode 100644 board/D-Link/dns323_b1/Makefile
create mode 100644 board/D-Link/dns323_b1/config.mk
create mode 100644 board/D-Link/dns323_b1/dns323_b1.c
create mode 100644 board/D-Link/dns323_b1/dns323_b1.h
create mode 100644 include/configs/dns323_b1.h
diff --git a/arch/arm/include/asm/arch-orion5x/cpu.h b/arch/arm/include/asm/arch-orion5x/cpu.h
index 80717f8..6ce02a9 100644
--- a/arch/arm/include/asm/arch-orion5x/cpu.h
+++ b/arch/arm/include/asm/arch-orion5x/cpu.h
@@ -76,7 +76,7 @@ enum orion5x_cpu_attrib {
/*
* Device Address MAP BAR values
-/*
+ *
* All addresses and sizes not defined by board code
* will be given default values here.
*/
diff --git a/board/D-Link/dns323_b1/Makefile b/board/D-Link/dns323_b1/Makefile
new file mode 100644
index 0000000..fae0330
--- /dev/null
+++ b/board/D-Link/dns323_b1/Makefile
@@ -0,0 +1,53 @@
+#
+# Copyright (C) 2010 Albert ARIBAUD <albert.aribaud at free.fr>
+#
+# Based on original Kirkwood support which is
+# (C) Copyright 2009
+# Marvell Semiconductor <www.marvell.com>
+# Written-by: Prafulla Wadaskar <prafulla at marvell.com>
+#
+# 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 $(TOPDIR)/config.mk
+
+LIB = $(obj)lib$(BOARD).a
+
+COBJS := dns323_b1.o
+
+SRCS := $(COBJS:.o=.c)
+OBJS := $(addprefix $(obj),$(COBJS))
+
+$(LIB): $(obj).depend $(OBJS)
+ $(AR) $(ARFLAGS) $@ $(OBJS)
+
+clean:
+ rm -f $(OBJS)
+
+distclean: clean
+ rm -f $(LIB) core *.bak .depend
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/board/D-Link/dns323_b1/config.mk b/board/D-Link/dns323_b1/config.mk
new file mode 100644
index 0000000..3dec1aa
--- /dev/null
+++ b/board/D-Link/dns323_b1/config.mk
@@ -0,0 +1,27 @@
+#
+# Copyright (C) 2010 Albert ARIBAUD <albert.aribaud at free.fr>
+#
+# (C) Copyright 2009
+# Marvell Semiconductor <www.marvell.com>
+# Written-by: Prafulla Wadaskar <prafulla at marvell.com>
+#
+# 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
+#
+
+TEXT_BASE = 0x00100000
diff --git a/board/D-Link/dns323_b1/dns323_b1.c b/board/D-Link/dns323_b1/dns323_b1.c
new file mode 100644
index 0000000..d05d63c
--- /dev/null
+++ b/board/D-Link/dns323_b1/dns323_b1.c
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2010 Albert ARIBAUD <albert.aribaud at free.fr>
+ *
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Written-by: Prafulla Wadaskar <prafulla at marvell.com>
+ *
+ * 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 <common.h>
+#include <miiphy.h>
+#include <asm/arch/orion5x.h>
+#include "dns323_b1.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/*
+ * The Dlink DNS323 B1 is equipped with a Spansion S29GL064M90TFIR4 FLASH
+ * which CFI does not properly detect, hence the LEGACY config.
+ */
+#if defined(CONFIG_FLASH_CFI_LEGACY)
+#include <flash.h>
+ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
+{
+ int sectsz[] = CONFIG_SYS_FLASH_SECTSZ;
+ int sect;
+
+ if (base != CONFIG_SYS_FLASH_BASE)
+ return 0;
+
+ info->size = 0;
+ info->sector_count = CONFIG_SYS_MAX_FLASH_SECT;
+ /* set each sector's start address and size based */
+ for (sect = 0; sect < CONFIG_SYS_MAX_FLASH_SECT; sect++) {
+ info->start[sect] = base+info->size;
+ info->size += sectsz[sect];
+ }
+ /* This flash must be accessed in 8-bits mode, no buffer. */
+ info->flash_id = FLASH_MAN_AMD;
+ info->portwidth = FLASH_CFI_8BIT;
+ info->chipwidth = FLASH_CFI_BY8;
+ info->buffer_size = 0;
+ /* timings are derived from the Spansion datasheet. */
+ info->erase_blk_tout = 4000;
+ info->write_tout = 10;
+ info->buffer_write_tout = 300;
+ /* Commands and addresses are for AMD mode 8-bit access. */
+ info->vendor = CFI_CMDSET_AMD_LEGACY;
+ info->cmd_reset = 0xF0;
+ info->interface = FLASH_CFI_X8;
+ info->legacy_unlock = 0;
+ info->ext_addr = 0;
+ info->addr_unlock1 = 0x00000aaa;
+ info->addr_unlock2 = 0x00000555;
+ /* Manufacturer Macronix, device MX29LV400CB, CFI 1.3. */
+ info->manufacturer_id = 0x01;
+ info->device_id = 0x7E;
+ info->device_id2 = 0x10;
+ info->cfi_version = 0x3133;
+ info->cfi_offset = 0x0000;
+ info->name = "S29GL064MR4";
+
+ return 1;
+}
+#endif /* CONFIG_SYS_FLASH_CFI */
+
+int board_init(void)
+{
+ /* arch number of board */
+ gd->bd->bi_arch_number = MACH_TYPE_DNS323;
+
+ /* boot parameter start at 256th byte of RAM base */
+ gd->bd->bi_boot_params = gd->bd->bi_dram[0].start + 0x100;
+
+ return 0;
+}
+
+#if defined(CONFIG_CMD_NET) && defined(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 */
+
diff --git a/board/D-Link/dns323_b1/dns323_b1.h b/board/D-Link/dns323_b1/dns323_b1.h
new file mode 100644
index 0000000..5b3c4e6
--- /dev/null
+++ b/board/D-Link/dns323_b1/dns323_b1.h
@@ -0,0 +1,41 @@
+/*
+ * (C) Copyright 2009
+ * Net Insight <www.netinsight.net>
+ * Written-by: Simon Kagstrom <simon.kagstrom at netinsight.net>
+ *
+ * Based on sheevaplug.h:
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Written-by: Prafulla Wadaskar <prafulla at marvell.com>
+ *
+ * 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
+ */
+
+#ifndef __DNS323_BASE_H
+#define __DNS323_BASE_H
+
+/* PHY related */
+#define MV88E1116_LED_FCTRL_REG 10
+#define MV88E1116_CPRSP_CR3_REG 21
+#define MV88E1116_MAC_CTRL_REG 21
+#define MV88E1116_PGADR_REG 22
+#define MV88E1116_RGMII_TXTM_CTRL (1 << 4)
+#define MV88E1116_RGMII_RXTM_CTRL (1 << 5)
+
+#endif /* __DNS323_BASE_H */
diff --git a/boards.cfg b/boards.cfg
index 69c6897..37b980a 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -253,6 +253,7 @@ sheevaplug arm arm926ejs - Marvell kirkwood
imx27lite arm arm926ejs imx27lite logicpd mx27
magnesium arm arm926ejs imx27lite logicpd mx27
omap5912osk arm arm926ejs - ti omap
+dns323_b1 arm arm926ejs - D-Link orion5x
edminiv2 arm arm926ejs - LaCie orion5x
omap3_overo arm armv7 overo - omap3
omap3_pandora arm armv7 pandora - omap3
diff --git a/include/configs/dns323_b1.h b/include/configs/dns323_b1.h
new file mode 100644
index 0000000..1da4e92
--- /dev/null
+++ b/include/configs/dns323_b1.h
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2010 Albert ARIBAUD <albert.aribaud at free.fr>
+ *
+ * Based on original Kirkwood support which is
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Written-by: Prafulla Wadaskar <prafulla at marvell.com>
+ *
+ * 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
+ */
+
+#ifndef _CONFIG_DNS323_B1_H
+#define _CONFIG_DNS323_B1_H
+
+/* Almost everything is the same, so include the edmini config */
+#include "edminiv2.h"
+
+/*
+ * Version number information
+ */
+#undef CONFIG_IDENT_STRING
+#define CONFIG_IDENT_STRING " DNS323_B1"
+
+/*
+ * High Level Configuration Options (easy to change)
+ */
+
+#undef CONFIG_MACH_EDMINIV2
+#define CONFIG_MACH_DNS323 1 /* Machine type */
+
+/* Skip lowlevel init -
+ * makes an image suitable for chaining from another u-boot loader
+ */
+#define CONFIG_SKIP_LOWLEVEL_INIT 1
+
+#define CONFIG_BOOTARGS "console=ttyS0,115200"
+
+#define CONFIG_SYS_LONGHELP
+
+/*
+ * FLASH configuration
+ */
+
+#undef CONFIG_SYS_FLASH_BASE
+#define CONFIG_SYS_FLASH_BASE 0xff800000
+#define ORION5X_ADR_BOOTROM CONFIG_SYS_FLASH_BASE
+#define ORION5X_SZ_BOOTROM (8 * 1024 * 1024)
+
+/* #undef CONFIG_FLASH_CFI_LEGACY */
+
+#undef CONFIG_SYS_MAX_FLASH_SECT
+#undef CONFIG_SYS_FLASH_SECTSZ
+
+#define CONFIG_SYS_MAX_FLASH_SECT 135
+#define CONFIG_SYS_FLASH_SECTSZ \
+ {8192, 8192, 8192, 8192, 8192, 8192, 8192, 8192, \
+ 65536, 65536, 65536, 65536, 65536, 65536, 65536, \
+ 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, \
+ 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, \
+ 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, \
+ 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, \
+ 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, \
+ 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, \
+ 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, \
+ 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, \
+ 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, \
+ 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, \
+ 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, \
+ 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, \
+ 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, \
+ 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, \
+ 65536, 65536, 65536, 65536, 65536, 65536, 65536, 65536, \
+ }
+
+
+/* auto boot */
+#undef CONFIG_BOOTDELAY
+#define CONFIG_BOOTDELAY -1 /* default disable autoboot */
+
+#undef CONFIG_SYS_PROMPT
+#define CONFIG_SYS_PROMPT "DNS323B1> " /* Command Prompt */
+
+#ifdef CONFIG_CMD_NET
+#define CONFIG_CMD_DHCP
+#endif
+
+/*
+ * IDE overrides
+ */
+#undef CONFIG_SYS_ATA_IDE0_OFFSET
+#define CONFIG_SYS_ATA_IDE0_OFFSET ORION5X_SATA_PORT0_OFFSET
+#define CONFIG_SYS_ATA_IDE1_OFFSET ORION5X_SATA_PORT1_OFFSET
+
+#undef CONFIG_SYS_IDE_MAXBUS
+#undef CONFIG_SYS_IDE_MAXDEVICE
+#define CONFIG_SYS_IDE_MAXBUS 2
+#define CONFIG_SYS_IDE_MAXDEVICE 2
+
+/*
+ * Environment variables configurations
+ */
+#undef CONFIG_ENV_OFFSET
+#define CONFIG_ENV_OFFSET 0x0000 /* env starts here */
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+ "bootargs=root=/dev/ram console=ttyS0,115200 :::DB88FXX81:egiga0:none\0" \
+ "bootcmd=bootm FF820000 FF9A0000\0" \
+ "machid=526\0"
+
+#endif /* _CONFIG_DNS323_B1_H */
--
1.7.0.4
More information about the U-Boot
mailing list