From: Ben Warren <biggerbadderben@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH 1/2] NET: Add Vitesse VSC7385 firmware uploading
Date: Mon, 18 Feb 2008 22:06:53 -0500 [thread overview]
Message-ID: <47BA47CD.4040105@gmail.com> (raw)
In-Reply-To: <1202498161585-git-send-email-timur@freescale.com>
Acked-by: Ben Warren <biggerbadderben@gmail.com>
Kim - would you mind pulling this into your tree? Best to keep it with
part 2.
thanks,
Ben
Timur Tabi wrote:
> The Vitesse VSC7385 is a 5-port switch found on the Freescale MPC8349E-mITX
> and other boards. A small firwmare must be uploaded to its on-board memory
> before it can be enabled. This patch adds the code which uploads firmware
> (but not the firmware itself).
>
> Previously, this feature was provided by a U-Boot application that was
> made available only on Freescale BSPs. The VSC7385 firmware must still
> be obtained separately, but at least there is no longer a need for a separate
> application.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---
>
> This patch is for U-Boot 1.3.3.
>
> drivers/net/Makefile | 1 +
> drivers/net/vsc7385.c | 101 +++++++++++++++++++++++++++++++++++++++++++++++++
> include/vsc7385.h | 13 ++++++
> 3 files changed, 115 insertions(+), 0 deletions(-)
> create mode 100644 drivers/net/vsc7385.c
> create mode 100644 include/vsc7385.h
>
> diff --git a/drivers/net/Makefile b/drivers/net/Makefile
> index b9723fa..5ae7cb7 100644
> --- a/drivers/net/Makefile
> +++ b/drivers/net/Makefile
> @@ -57,6 +57,7 @@ COBJS-y += tigon3.o
> COBJS-y += tsec.o
> COBJS-y += tsi108_eth.o
> COBJS-y += uli526x.o
> +COBJS-y += vsc7385.o
>
> COBJS := $(COBJS-y)
> SRCS := $(COBJS:.o=.c)
> diff --git a/drivers/net/vsc7385.c b/drivers/net/vsc7385.c
> new file mode 100644
> index 0000000..f440ce0
> --- /dev/null
> +++ b/drivers/net/vsc7385.c
> @@ -0,0 +1,101 @@
> +/*
> + * Vitesse 7385 Switch Firmware Upload
> + *
> + * Author: Timur Tabi <timur@freescale.com>
> + *
> + * Copyright 2008 Freescale Semiconductor, Inc. This file is licensed
> + * under the terms of the GNU General Public License version 2. This
> + * program is licensed "as is" without any warranty of any kind, whether
> + * express or implied.
> + *
> + * This module uploads proprietary firmware for the Vitesse VSC7385 5-port
> + * switch.
> + */
> +
> +#include <config.h>
> +
> +#ifdef CONFIG_VSC7385_ENET
> +
> +#include <common.h>
> +#include <asm/io.h>
> +#include <asm/errno.h>
> +
> +/*
> + * Upload a Vitesse VSC7385 firmware image to the hardware
> + *
> + * This function takes a pointer to a VSC7385 firmware image and a size, and
> + * uploads that firmware to the VSC7385.
> + *
> + * This firmware is typically located at a board-specific flash address,
> + * and the size is typically 8KB.
> + *
> + * The firmware is Vitesse proprietary.
> + *
> + * Further details on the register information can be obtained from Vitesse.
> + */
> +int vsc7385_upload_firmware(void *firmware, unsigned int size)
> +{
> + u8 *fw = firmware;
> + unsigned int i;
> +
> + u32 *gloreset = (u32 *) (CFG_VSC7385_BASE + 0x1c050);
> + u32 *icpu_ctrl = (u32 *) (CFG_VSC7385_BASE + 0x1c040);
> + u32 *icpu_addr = (u32 *) (CFG_VSC7385_BASE + 0x1c044);
> + u32 *icpu_data = (u32 *) (CFG_VSC7385_BASE + 0x1c048);
> + u32 *icpu_rom_map = (u32 *) (CFG_VSC7385_BASE + 0x1c070);
> +#ifdef DEBUG
> + u32 *chipid = (u32 *) (CFG_VSC7385_BASE + 0x1c060);
> +#endif
> +
> + out_be32(gloreset, 3);
> + udelay(200);
> +
> + out_be32(icpu_ctrl, 0x8E);
> + udelay(20);
> +
> + out_be32(icpu_rom_map, 1);
> + udelay(20);
> +
> + /* Write the firmware to I-RAM */
> + out_be32(icpu_addr, 0);
> + udelay(20);
> +
> + for (i = 0; i < size; i++) {
> + out_be32(icpu_data, fw[i]);
> + udelay(20);
> + if (ctrlc())
> + return -EINTR;
> + }
> +
> + /* Read back and compare */
> + out_be32(icpu_addr, 0);
> + udelay(20);
> +
> + for (i = 0; i < size; i++) {
> + u8 value;
> +
> + value = (u8) in_be32(icpu_data);
> + udelay(20);
> + if (value != fw[i]) {
> + debug("VSC7385: Upload mismatch: address 0x%x, "
> + "read value 0x%x, image value 0x%x\n",
> + i, value, fw[i]);
> +
> + return -EIO;
> + }
> + if (ctrlc())
> + break;
> + }
> +
> + out_be32(icpu_ctrl, 0x0B);
> + udelay(20);
> +
> +#ifdef DEBUG
> + printf("VSC7385: Chip ID is %08x\n", in_be32(chipid));
> + udelay(20);
> +#endif
> +
> + return 0;
> +}
> +
> +#endif
> diff --git a/include/vsc7385.h b/include/vsc7385.h
> new file mode 100644
> index 0000000..0432499
> --- /dev/null
> +++ b/include/vsc7385.h
> @@ -0,0 +1,13 @@
> +/*
> + * Header file for vsc7385.c
> + *
> + * Author: Timur Tabi <timur@freescale.com>
> + *
> + * Copyright 2008 Freescale Semiconductor, Inc. This file is licensed
> + * under the terms of the GNU General Public License version 2. This
> + * program is licensed "as is" without any warranty of any kind, whether
> + * express or implied.
> + */
> +
> +int vsc7385_upload_firmware(void *firmware, unsigned int size);
> +
>
next prev parent reply other threads:[~2008-02-19 3:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-08 19:15 [U-Boot-Users] [PATCH 0/2] Vitesse VSC7385 firmware patches Timur Tabi
2008-02-08 19:15 ` [U-Boot-Users] [PATCH 1/2] NET: Add Vitesse VSC7385 firmware uploading Timur Tabi
2008-02-08 19:15 ` [U-Boot-Users] [PATCH 2/2] 83xx: " Timur Tabi
2008-03-12 22:17 ` Kim Phillips
2008-02-19 3:06 ` Ben Warren [this message]
2008-02-19 15:31 ` [U-Boot-Users] [PATCH 1/2] NET: " Timur Tabi
2008-03-11 20:41 ` Timur Tabi
2008-03-12 22:17 ` Kim Phillips
2008-03-12 22:04 ` Jean-Christophe PLAGNIOL-VILLARD
2008-03-12 22:27 ` Timur Tabi
2008-03-12 22:20 ` Jean-Christophe PLAGNIOL-VILLARD
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47BA47CD.4040105@gmail.com \
--to=biggerbadderben@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox