Vitesse VSC7385 firmware patches
cover Vitesse VSC7385 firmware patches
These two patches add the ability to upload firmware to the Vitesse VSC7385 and update some Freescale 83xx board files to use them.
These patches are for U-Boot 1.3.3.
PATCH 1/2 NET: Add Vitesse VSC7385 firmware uploading
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.
---
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
drivers/net/Makefile +1 -0
@@ -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)
drivers/net/vsc7385.c new file +101 -0
101 lines not on this page · raw message
include/vsc7385.h new file +13 -0
@@ -0,0 +1,13 @@ +/* +* Header file for vsc7385.c +* +* Author: Timur Tabi <[email protected]> +* +* 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); +
Signature · 1 line
1.5.2.4
PATCH 2/2 83xx: Add Vitesse VSC7385 firmware uploading
Update the MPC8349E-mITX, MPC8313E-RDB, and MPC837XE-RDB board files to upload the Vitesse VSC7385 firmware. Changed CONFIG_VSC7385 to CONFIG_VSC7385_ENET. Cleaned up the board header files to make selecting the VSC7385 easier to control.
---
This patch is for U-Boot 1.3.3
board/freescale/mpc8313erdb/mpc8313erdb.c | 21 +++++++ board/freescale/mpc8349itx/mpc8349itx.c | 15 +++++- board/freescale/mpc837xerdb/mpc837xerdb.c | 27 +++++++-- include/configs/MPC8313ERDB.h | 88 +++++++++++++++++++---------- include/configs/MPC8349ITX.h | 33 ++++++++--- include/configs/MPC837XERDB.h | 83 +++++++++++++++++++--------- 6 files changed, 196 insertions(+), 71 deletions(-)
board/freescale/mpc8313erdb/mpc8313erdb.c +21 -0
@@ -28,6 +28,7 @@#endif #include <pci.h> #include <mpc83xx.h> +#include <vsc7385.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -98,6 +99,26 @@ void pci_init_board(void)mpc83xx_pci_init (1 , reg, warmboot); } +/* +* Miscellaneous late-boot configurations +* +* If a VSC7385 microcode image is present, then upload it. +*/ +int misc_init_r (void ) +{ +int rc =0 ; + +#ifdef CONFIG_VSC7385_IMAGE +if (vsc7385_upload_firmware ((void *)CONFIG_VSC7385_IMAGE , +CONFIG_VSC7385_IMAGE_SIZE )) { +puts ("Failure uploading VSC7385 microcode.\n" ); + rc =1 ; + } +#endif + +return rc; +} +#if defined(CONFIG_OF_BOARD_SETUP )void ft_board_setup (void *blob,bd_t *bd) {
board/freescale/mpc8349itx/mpc8349itx.c +14 -1
@@ -26,6 +26,7 @@#include <i2c.h> #include <spd.h> #include <miiphy.h> +#include <vsc7385.h> #ifdef CONFIG_PCI #include <asm/mpc8349_pci.h>
@@ -183,7 +184,7 @@ int checkboard(void)*/ int misc_init_f (void ) { -#ifdef CONFIG_VSC7385 +#ifdef CONFIG_VSC7385_ENET volatile u32 *vsc7385_cpuctrl;/* 0x1c0c0 is the VSC7385 CPU Control (CPUCTRL) Register. The power up
@@ -245,6 +246,8 @@ int misc_init_f(void) }/* +* Miscellaneous late-boot configurations +* * Make sure the EEPROM has the HRCW correctly programmed. * Make sure the RTC is correctly programmed. *
@@ -256,6 +259,8 @@ int misc_init_f(void)* * This function makes sure that the I2C EEPROM is programmed * correctly. +* +* If a VSC7385 microcode image is present, then upload it. */ int misc_init_r (void ) {
@@ -381,6 +386,14 @@ int misc_init_r(void)i2c_set_bus_num (orig_bus);#endif +#ifdef CONFIG_VSC7385_IMAGE +if (vsc7385_upload_firmware ((void *)CONFIG_VSC7385_IMAGE , +CONFIG_VSC7385_IMAGE_SIZE )) { +puts ("Failure uploading VSC7385 microcode.\n" ); + rc =1 ; + } +#endif +return rc; }
board/freescale/mpc837xerdb/mpc837xerdb.c +22 -5
@@ -16,6 +16,8 @@#include <i2c.h> #include <spd.h> #include <asm/io.h> +#include <vsc7385.h> +#if defined(CONFIG_SPD_EEPROM )#include <spd_sdram.h> #endif
@@ -59,11 +61,6 @@ testdram(void) }#endif -int board_early_init_f (void ) -{ -return 0 ; -} -#if defined(CONFIG_DDR_ECC ) && !defined(CONFIG_ECC_INIT_VIA_DDRC )void ddr_enable_ecc (unsigned int dram_size);#endif
@@ -138,6 +135,26 @@ int checkboard(void)return 0 ; } +/* +* Miscellaneous late-boot configurations +* +* If a VSC7385 microcode image is present, then upload it. +*/ +int misc_init_r (void ) +{ +int rc =0 ; + +#ifdef CONFIG_VSC7385_IMAGE +if (vsc7385_upload_firmware ((void *)CONFIG_VSC7385_IMAGE , +CONFIG_VSC7385_IMAGE_SIZE )) { +puts ("Failure uploading VSC7385 microcode.\n" ); + rc =1 ; + } +#endif + +return rc; +} +#if defined(CONFIG_OF_BOARD_SETUP )void ft_board_setup (void *blob,bd_t *bd)
include/configs/MPC8313ERDB.h +59 -29
139 lines not on this page · raw message
include/configs/MPC8349ITX.h +23 -10
@@ -68,12 +68,16 @@#define CFG_IMMR 0xE0000000/* The IMMR is relocated to here */ +#define CONFIG_MISC_INIT_F +#define CONFIG_MISC_INIT_R -/* On-board devices */ +/* +* On-board devices +*/ #ifdef CONFIG_MPC8349ITX #define CONFIG_COMPACT_FLASH /* The CF card interface on the back of the board */ -#define CONFIG_VSC7385 /* The Vitesse 7385 5-port switch */ +#define CONFIG_VSC7385_ENET /* VSC7385 ethernet support */ #endif #define CONFIG_PCI
@@ -88,9 +92,6 @@/* I2C */ #ifdef CONFIG_HARD_I2C -#define CONFIG_MISC_INIT_F -#define CONFIG_MISC_INIT_R -#define CONFIG_FSL_I2C #define CONFIG_I2C_MULTI_BUS #define CONFIG_I2C_CMD_TREE
@@ -190,6 +191,18 @@ boards, we say we have two, but don't display a message if we find only one. */#define CFG_FLASH_SIZE 16/* FLASH size in MB */ #define CFG_FLASH_SIZE_SHIFT 4/* log2 of the above value */ +/* Vitesse 7385 */ + +#ifdef CONFIG_VSC7385_ENET + +#define CONFIG_TSEC2 + +/* The flash address and size of the VSC7385 firmware image */ +#define CONFIG_VSC7385_IMAGE 0xFEFFE000 +#define CONFIG_VSC7385_IMAGE_SIZE 8192 + +#endif +/* * BRx, ORx, LBLAWBARx, and LBLAWARx */
@@ -205,10 +218,10 @@ boards, we say we have two, but don't display a message if we find only one. *//* Vitesse 7385 */ -#ifdef CONFIG_VSC7385 -#define CFG_VSC7385_BASE 0xF8000000 +#ifdef CONFIG_VSC7385_ENET +#define CFG_BR1_PRELIM (CFG_VSC7385_BASE | BR_PS_8 | BR_V)#define CFG_OR1_PRELIM (OR_AM_128KB | OR_GPCM_CSNT | OR_GPCM_XACS | \ OR_GPCM_SCY_15 | OR_GPCM_SETA | OR_GPCM_TRLX | \
@@ -384,7 +397,7 @@ boards, we say we have two, but don't display a message if we find only one. */#define CONFIG_HAS_ETH1 #define CONFIG_TSEC2_NAME "TSEC1"#define CFG_TSEC2_OFFSET 0x25000 -#define CONFIG_UNKNOWN_TSEC /* TSEC2 is proprietary */ +#define TSEC2_PHY_ADDR 4#define TSEC2_PHYIDX 0#define TSEC2_FLAGS TSEC_GIGABIT
@@ -619,11 +632,11 @@ boards, we say we have two, but don't display a message if we find only one. */*/ #define CONFIG_ENV_OVERWRITE -#ifdef CONFIG_TSEC1 +#ifdef CONFIG_HAS_ETH0 #define CONFIG_ETHADDR 00:E0:0C:00:8C:01#endif -#ifdef CONFIG_TSEC2 +#ifdef CONFIG_HAS_ETH1 #define CONFIG_ETH1ADDR 00:E0:0C:00:8C:02#endif
include/configs/MPC837XERDB.h +57 -26
137 lines not on this page · raw message
Signature · 1 line
1.5.2.4
Kim Phillips
AppliedPATCH 2/2 83xx: Add Vitesse VSC7385 firmware uploading
Quoted 10 lines · On Fri, 8 Feb 2008 13:15:55 -0600 Timur Tabi <[email protected]> wrote:
Update the MPC8349E-mITX, MPC8313E-RDB, and MPC837XE-RDB board files to upload the Vitesse VSC7385 firmware. Changed
CONFIG_VSC7385toCONFIG_VSC7385_ENET. Cleaned up the board header files to make selecting the VSC7385 easier to control.Signed-off-by Timur Tabi <[email protected]>---
This patch is for U-Boot 1.3.3
Quoted 7 lines
board/freescale/mpc8313erdb/mpc8313erdb.c | 21 +++++++ board/freescale/mpc8349itx/mpc8349itx.c | 15 +++++- board/freescale/mpc837xerdb/mpc837xerdb.c | 27 +++++++-- include/configs/MPC8313ERDB.h | 88 +++++++++++++++++++---------- include/configs/MPC8349ITX.h | 33 ++++++++--- include/configs/MPC837XERDB.h | 83 +++++++++++++++++++--------- 6 files changed, 196 insertions(+), 71 deletions(-)
applied.
Kim
PATCH 1/2 NET: Add Vitesse VSC7385 firmware uploading
In reply to Timur TabiKim - would you mind pulling this into your tree? Best to keep it with part 2.
thanks,
Ben
Quoted 161 lines · Timur Tabi
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 <[email protected]>---
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.hdrivers/net/Makefile +1
-0@@ -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)drivers/net/vsc7385.c new file +101
-0@@ -0,0 +1,101 @@ +/* +* Vitesse 7385 Switch Firmware Upload +* +* Author: Timur Tabi <[email protected]> +* +* 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 include/vsc7385.h new file +13
-0@@ -0,0 +1,13 @@ +/* +* Header file for vsc7385.c +* +* Author: Timur Tabi <[email protected]> +* +* 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); +
PATCH 1/2 NET: Add Vitesse VSC7385 firmware uploading
Quoted 4 lines · Ben Warren
Acked-by Ben Warren <[email protected]>Kim - would you mind pulling this into your tree? Best to keep it with part 2.
FYI, if the 83xx part is applied without the NET part, all 83xx platforms with the 7385 will fail to compile.
Signature · 2 lines
Timur Tabi Linux kernel developer at Freescale
PATCH 1/2 NET: Add Vitesse VSC7385 firmware uploading
In reply to Ben WarrenQuoted 4 lines · Ben Warren
Acked-by Ben Warren <[email protected]>Kim - would you mind pulling this into your tree? Best to keep it with part 2.
Kim, just a reminder, please pick up both of these patches for 1.3.3 now that the window is open. Thanks.
Signature · 2 lines
Timur Tabi Linux kernel developer at Freescale
PATCH 1/2 NET: Add Vitesse VSC7385 firmware uploading
In reply to Ben WarrenQuoted 4 lines · On Mon, 18 Feb 2008 22:06:53 -0500 Ben Warren <[email protected]> wrote:
Acked-by Ben Warren <[email protected]>Kim - would you mind pulling this into your tree? Best to keep it with part 2.
done.
Kim
PATCH 1/2 NET: Add Vitesse VSC7385 firmware uploading
In reply to Timur TabiQuoted 27 lines · Timur Tabi
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 <[email protected]>---
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.hdrivers/net/Makefile +0
-0
drivers/net/Makefile COBJS-y += tigon3.o · line 63
Quoted 7 lines
drivers/net/Makefile +1
-0@@ -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)
^
Please remove the whitespace
Quoted 13 lines
drivers/net/vsc7385.c new file +7
-0@@ -0,0 +1,101 @@ +/* +* Vitesse 7385 Switch Firmware Upload +* +* Author: Timur Tabi <[email protected]> +* +* Copyright 2008 Freescale Semiconductor, Inc. This file is licensed +* under the terms of the GNU General Public License version 2. This
drivers/net/vsc7385.c line 17
Quoted 10 lines
drivers/net/vsc7385.c new file +10
-0+* 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
Please move this to the Makefile
Quoted 19 lines
drivers/net/vsc7385.c new file +19
-0+ +#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)
drivers/net/vsc7385.c line 46
Quoted 10 lines
drivers/net/vsc7385.c new file +10
-0+{ +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
It will be good to start to create a debug define for each driver
drivers/net/vsc7385.c line 63
Quoted 7 lines
drivers/net/vsc7385.c new file +7
-0+u32 *chipid = (u32 *) (CFG_VSC7385_BASE +0x1c060 ); +#endif + +out_be32 (gloreset,3 ); +udelay (200 ); + +for (i =0 ; i < size; i++) {
Best Regards,
J.
PATCH 1/2 NET: Add Vitesse VSC7385 firmware uploading
Quoted 3 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 1 line
SRCS := $(COBJS:.o=.c)
^Please remove the whitespace
Couldn't you have reviewed my patch when I posted it last month, instead of 5 minutes after the 83xx maintainer applied it to his tree??????
Signature · 2 lines
Timur Tabi Linux kernel developer at Freescale
PATCH 1/2 NET: Add Vitesse VSC7385 firmware uploading
Quoted 8 lines · Timur Tabi
Quoted 3 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 1 line
SRCS := $(COBJS:.o=.c)
^Please remove the whitespace
Couldn't you have reviewed my patch when I posted it last month, instead of 5 minutes after the 83xx maintainer applied it to his tree??????
Sorry, I've found it just now.
but you could send a to fix the codying because the whitespace is not introduced by your patch
Best Regards,
J.