Resync with broadcom drivers 5.100.138.20 and utilities.
[tomato.git] / release / src-rt / include / usbrdl.h
blob78a3076e51ad1fcbdb6f64c46676b8c47f5924eb
1 /*
2 * Broadcom USB remote download definitions
4 * Copyright (C) 2010, Broadcom Corporation
5 * All Rights Reserved.
6 *
7 * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
8 * the contents of this file may not be disclosed to third parties, copied
9 * or duplicated in any form, in whole or in part, without the prior
10 * written permission of Broadcom Corporation.
12 * $Id: usbrdl.h,v 13.22.14.2 2010-09-07 19:23:08 Exp $
15 #ifndef _USB_RDL_H
16 #define _USB_RDL_H
18 /* Control messages: bRequest values */
19 #define DL_GETSTATE 0 /* returns the rdl_state_t struct */
20 #define DL_CHECK_CRC 1 /* currently unused */
21 #define DL_GO 2 /* execute downloaded image */
22 #define DL_START 3 /* initialize dl state */
23 #define DL_REBOOT 4 /* reboot the device in 2 seconds */
24 #define DL_GETVER 5 /* returns the bootrom_id_t struct */
25 #define DL_GO_PROTECTED 6 /* execute the downloaded code and set reset event
26 * to occur in 2 seconds. It is the responsibility
27 * of the downloaded code to clear this event
29 #define DL_EXEC 7 /* jump to a supplied address */
30 #define DL_RESETCFG 8 /* To support single enum on dongle
31 * - Not used by bootloader
33 #define DL_DEFER_RESP_OK 9 /* Potentially defer the response to setup
34 * if resp unavailable
37 #define DL_HWCMD_MASK 0xfc /* Mask for hardware read commands: */
38 #define DL_RDHW 0x10 /* Read a hardware address (Ctl-in) */
39 #define DL_RDHW32 0x10 /* Read a 32 bit word */
40 #define DL_RDHW16 0x11 /* Read 16 bits */
41 #define DL_RDHW8 0x12 /* Read an 8 bit byte */
42 #define DL_WRHW 0x14 /* Write a hardware address (Ctl-out) */
44 #define DL_JTCONF 0x15 /* Get JTAG configuration (Ctl_in)
45 * Set JTAG configuration (Ctl-out)
47 #define DL_JTON 0x16 /* Turn on jtag master (Ctl-in) */
48 #define DL_JTOFF 0x17 /* Turn on jtag master (Ctl-in) */
49 #define DL_RDRJT 0x18 /* Read a JTAG register (Ctl-in) */
50 #define DL_WRJT 0x19 /* Write a hardware address over JTAG (Ctl/Bulk-out) */
51 #define DL_WRRJT 0x1a /* Write a JTAG register (Ctl/Bulk-out) */
52 #define DL_JTRST 0x1b /* Reset jtag fsm on jtag DUT (Ctl-in) */
54 #define DL_RDJT 0x1c /* Read a hardware address over JTAG (Ctl-in) */
55 #define DL_RDJT32 0x1c /* Read 32 bits */
56 #define DL_RDJT16 0x1e /* Read 16 bits (sz = 4 - low bits) */
57 #define DL_RDJT8 0x1f /* Read 8 bits */
59 #define DL_DBGTRIG 0xFF /* Trigger bRequest type to aid debug */
61 #define DL_JTERROR 0x80000000
64 /* states */
65 #define DL_WAITING 0 /* waiting to rx first pkt that includes the hdr info */
66 #define DL_READY 1 /* hdr was good, waiting for more of the compressed image */
67 #define DL_BAD_HDR 2 /* hdr was corrupted */
68 #define DL_BAD_CRC 3 /* compressed image was corrupted */
69 #define DL_RUNNABLE 4 /* download was successful, waiting for go cmd */
70 #define DL_START_FAIL 5 /* failed to initialize correctly */
71 #define DL_NVRAM_TOOBIG 6 /* host specified nvram data exceeds DL_NVRAM value */
72 #define DL_IMAGE_TOOBIG 7 /* download image too big (exceeds DATA_START for rdl) */
74 #define TIMEOUT 5000 /* Timeout for usb commands */
76 struct bcm_device_id {
77 char *name;
78 uint32 vend;
79 uint32 prod;
82 typedef struct {
83 uint32 state;
84 uint32 bytes;
85 } rdl_state_t;
87 typedef struct {
88 uint32 chip; /* Chip id */
89 uint32 chiprev; /* Chip rev */
90 } bootrom_id_t;
92 typedef struct {
93 uint32 chip; /* Chip id */
94 uint32 chiprev; /* Chip rev */
95 uint32 ccrev; /* Chipcommon core rev */
96 uint32 siclock; /* Backplane clock */
97 } jtagd_id_t;
99 /* struct for backplane & jtag accesses */
100 typedef struct {
101 uint32 cmd; /* tag to identify the cmd */
102 uint32 addr; /* backplane address for write */
103 uint32 len; /* length of data: 1, 2, 4 bytes */
104 uint32 data; /* data to write */
105 } hwacc_t;
107 /* Jtag configuration structure */
108 typedef struct {
109 uint32 cmd; /* tag to identify the cmd */
110 uint8 clkd; /* Jtag clock divisor */
111 uint8 disgpio; /* Gpio to disable external driver */
112 uint8 irsz; /* IR size for readreg/writereg */
113 uint8 drsz; /* DR size for readreg/writereg */
115 uint8 bigend; /* Big endian */
116 uint8 mode; /* Current mode */
117 uint16 delay; /* Delay between jtagm "simple commands" */
119 uint32 retries; /* Number of retries for jtagm operations */
120 uint32 ctrl; /* Jtag control reg copy */
121 } jtagconf_t;
123 typedef void (*exec_fn_t)(void *sih);
125 #define USB_CTRL_IN (USB_TYPE_VENDOR | 0x80 | USB_RECIP_INTERFACE)
126 #define USB_CTRL_OUT (USB_TYPE_VENDOR | 0 | USB_RECIP_INTERFACE)
128 #define RDL_CHUNK 1500 /* size of each dl transfer */
130 /* bootloader makes special use of trx header "offsets" array */
131 #define TRX_OFFSETS_DLFWLEN_IDX 0 /* Size of the fw; used in uncompressed case */
132 #define TRX_OFFSETS_JUMPTO_IDX 1 /* RAM address for jumpto after download */
133 #define TRX_OFFSETS_NVM_LEN_IDX 2 /* Length of appended NVRAM data */
135 #define TRX_OFFSETS_DLBASE_IDX 0 /* RAM start address for download */
137 #endif /* _USB_RDL_H */