qe: add ability to upload QE firmware
PATCH v2 1/1 qe: add ability to upload QE firmware
Define the layout of a binary blob that contains a QE firmware and instructions on how to upload it. Add function qe_upload_firmware() to parse the blob and perform the actual upload. Add command-line command "qe fw" to take a firmware blob in memory and upload it. Update ft_cpu_setup() on 83xx to create the 'firmware' device tree node if U-Boot has uploaded a firmware. Fully define 'struct rsp' in immap_qe.h to include the actual RISC Special Registers.
--- cpu/mpc83xx/cpu.c | 53 +++++++++++ drivers/qe/qe.c | 219 ++++++++++++++++++++++++++++++++++++++++++++ drivers/qe/qe.h | 56 +++++++++++ include/asm-ppc/immap_qe.h | 35 +++++++- 4 files changed, 360 insertions(+), 3 deletions(-)
cpu/mpc83xx/cpu.c +53 -0
@@ -36,6 +36,9 @@#elif defined(CONFIG_OF_LIBFDT )#include <libfdt.h> #endif +#ifdef CONFIG_QE +#include "../../drivers/qe/qe.h" +#endif DECLARE_GLOBAL_DATA_PTR ;
@@ -412,6 +415,38 @@ static int fdt_set_qe_brgfreq(void *blob, int nodeoffset, const char *name, bd_t tmp =cpu_to_be32 (gd->brg_clk); return fdt_setprop(blob, nodeoffset, name, &tmp, sizeof(tmp)); } + +/* +* If a QE firmware has been uploaded, then add the 'firmware' node under +* the 'qe' node. +*/ +static int fdt_set_qe_firmware (void *blob,int nodeoffset,const char *name,bd_t *bd) +{ +struct qe_firmware_info *qe_fw_info; +int ret; + + qe_fw_info =qe_get_firmware_info (); + +if (qe_fw_info) { +/* We assume the node doesn't exist yet */ + nodeoffset =fdt_add_subnode (blob, nodeoffset, name); +if (nodeoffset <0 ) +return nodeoffset; + ret =fdt_setprop_typed (blob, nodeoffset,"extended_modes" , + qe_fw_info->extended_modes); +if (ret <0 ) +return ret; + + ret =fdt_setprop_string (blob, nodeoffset,"id" , qe_fw_info->id); +if (ret <0 ) +return ret; + +return fdt_setprop (blob, nodeoffset,"virtual_traps" , + qe_fw_info->vtraps,sizeof (qe_fw_info->vtraps)); + } + +return 0 ; +}#endif /*
@@ -558,6 +593,24 @@ ft_cpu_setup(void *blob, bd_t *bd) tmp[1 ] =cpu_to_be32 (bd->bi_memsize); fdt_setprop(blob, nodeoffset, "reg", tmp, sizeof(tmp)); } + +/* We can't call fdt_set_qe_firmware() from the fixup_props[] table +* because the relocation bug causes fdt_setprop() to return +* FDT_ERR_NOSPACE if called with the return value of fdt_add_subnode(). +* So we need to call it directly here. This problem should go away +* when the 83xx relocation code is changed to match 85xx. +*/ +#ifdef CONFIG_QE + nodeoffset =fdt_find_node_by_path (blob,"/" OF_QE ); +if (nodeoffset >=0 ) { + err =fdt_set_qe_firmware (blob, nodeoffset,"firmware" ,NULL ); +if (err <0 ) { +debug ("Could not add qe/firmware node: %s\n" , +fdt_strerror (err)); +fdt_del_node (blob, nodeoffset); + } + } +#endif }#elif defined(CONFIG_OF_FLAT_TREE)void
drivers/qe/qe.c +219 -0
229 lines not on this page · raw message
drivers/qe/qe.h +56 -0
67 lines not on this page · raw message
include/asm-ppc/immap_qe.h +32 -3
@@ -513,10 +513,39 @@ typedef struct dbg {u8 res2[0x48 ]; } __attribute__ ((packed)) dbg_t; -/* RISC Special Registers (Trap and Breakpoint) -*/ +/* +* RISC Special Registers (Trap and Breakpoint). These are described in +* the QE Developer's Handbook. +*/ typedef struct rsp { -u8 fixme[0x100 ]; +u32 tibcr[16 ];/* Trap/instruction breakpoint control regs */ +u8 res0[64 ]; +u32 ibcr0; +u32 ibs0; +u32 ibcnr0; +u8 res1[4 ]; +u32 ibcr1; +u32 ibs1; +u32 ibcnr1; +u32 npcr; +u32 dbcr; +u32 dbar; +u32 dbamr; +u32 dbsr; +u32 dbcnr; +u8 res2[12 ]; +u32 dbdr_h; +u32 dbdr_l; +u32 dbdmr_h; +u32 dbdmr_l; +u32 bsr; +u32 bor; +u32 bior; +u8 res3[4 ]; +u32 iatr[4 ]; +u32 eccr;/* Exception control configuration register */ +u32 eicr; +u8 res4[0x100 -0xf8 ]; } __attribute__ ((packed))rsp_t ; typedef struct qe_immap {
Signature · 1 line
1.5.2.4
PATCH v2 1/1 qe: add ability to upload QE firmware
Quoted 6 lines · Timur Tabi
Define the layout of a binary blob that contains a QE firmware and instructions on how to upload it. Add function
qe_upload_firmware()to parse the blob and perform the actual upload. Add command-line command "qe fw" to take a firmware blob in memory and upload it. Updateft_cpu_setup()on 83xx to create the 'firmware' device tree node if U-Boot has uploaded a firmware. Fully define 'struct rsp' inimmap_qe.hto include the actual RISC Special Registers.
If there are no objections, I'd like this patch to be included in the next 83xx merge. Thanks.
Signature · 2 lines
Timur Tabi Linux kernel developer at Freescale
PATCH v2 1/1 qe: add ability to upload QE firmware
Quoted 10 lines · On Wed, 12 Dec 2007 09:16:45 -0600 Timur Tabi <[email protected]> wrote:
Quoted 6 lines · Timur Tabi
Define the layout of a binary blob that contains a QE firmware and instructions on how to upload it. Add function
qe_upload_firmware()to parse the blob and perform the actual upload. Add command-line command "qe fw" to take a firmware blob in memory and upload it. Updateft_cpu_setup()on 83xx to create the 'firmware' device tree node if U-Boot has uploaded a firmware. Fully define 'struct rsp' inimmap_qe.hto include the actual RISC Special Registers.If there are no objections, I'd like this patch to be included in the next 83xx merge. Thanks.
I'd like to see the freescale QE firmware team distribute firmware in the format this patch utilizes before I sign off on this one.
Thanks,
Kim