2 * Vitesse 7385 Switch Firmware Upload
4 * Author: Timur Tabi <timur@freescale.com>
6 * Copyright 2008 Freescale Semiconductor, Inc. This file is licensed
7 * under the terms of the GNU General Public License version 2. This
8 * program is licensed "as is" without any warranty of any kind, whether
11 * This module uploads proprietary firmware for the Vitesse VSC7385 5-port
18 #include <asm/errno.h>
21 * Upload a Vitesse VSC7385 firmware image to the hardware
23 * This function takes a pointer to a VSC7385 firmware image and a size, and
24 * uploads that firmware to the VSC7385.
26 * This firmware is typically located at a board-specific flash address,
27 * and the size is typically 8KB.
29 * The firmware is Vitesse proprietary.
31 * Further details on the register information can be obtained from Vitesse.
33 int vsc7385_upload_firmware(void *firmware, unsigned int size)
38 u32 *gloreset = (u32 *) (CONFIG_SYS_VSC7385_BASE + 0x1c050);
39 u32 *icpu_ctrl = (u32 *) (CONFIG_SYS_VSC7385_BASE + 0x1c040);
40 u32 *icpu_addr = (u32 *) (CONFIG_SYS_VSC7385_BASE + 0x1c044);
41 u32 *icpu_data = (u32 *) (CONFIG_SYS_VSC7385_BASE + 0x1c048);
42 u32 *icpu_rom_map = (u32 *) (CONFIG_SYS_VSC7385_BASE + 0x1c070);
44 u32 *chipid = (u32 *) (CONFIG_SYS_VSC7385_BASE + 0x1c060);
47 out_be32(gloreset, 3);
50 out_be32(icpu_ctrl, 0x8E);
53 out_be32(icpu_rom_map, 1);
56 /* Write the firmware to I-RAM */
57 out_be32(icpu_addr, 0);
60 for (i = 0; i < size; i++) {
61 out_be32(icpu_data, fw[i]);
67 /* Read back and compare */
68 out_be32(icpu_addr, 0);
71 for (i = 0; i < size; i++) {
74 value = (u8) in_be32(icpu_data);
77 debug("VSC7385: Upload mismatch: address 0x%x, "
78 "read value 0x%x, image value 0x%x\n",
87 out_be32(icpu_ctrl, 0x0B);
91 printf("VSC7385: Chip ID is %08x\n", in_be32(chipid));