Resync with broadcom drivers 5.100.138.20 and utilities.
[tomato.git] / release / src-rt / include / bcmotp.h
bloba147eeb129c8d3c7d727b826bd2c1baad117d83f
1 /*
2 * OTP support.
4 * Copyright (C) 2010, Broadcom Corporation. All Rights Reserved.
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
13 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
15 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 * $Id: bcmotp.h,v 13.32.18.4 2011-01-17 10:33:12 Exp $
21 #ifndef _bcmotp_h_
22 #define _bcmotp_h_
24 /* OTP regions */
25 #define OTP_HW_RGN 1
26 #define OTP_SW_RGN 2
27 #define OTP_CI_RGN 4
28 #define OTP_FUSE_RGN 8
29 #define OTP_ALL_RGN 0xf /* From h/w region to end of OTP including checksum */
31 /* OTP Size */
32 #define OTP_SZ_MAX (6144/8) /* maximum bytes in one CIS */
34 /* Fixed size subregions sizes in words */
35 #define OTPGU_CI_SZ 2
37 /* OTP usage */
38 #define OTP4325_FM_DISABLED_OFFSET 188
41 /* Exported functions */
42 extern int otp_status(void *oh);
43 extern int otp_size(void *oh);
44 extern uint16 otp_read_bit(void *oh, uint offset);
45 extern void* otp_init(si_t *sih);
46 extern int otp_read_region(si_t *sih, int region, uint16 *data, uint *wlen);
47 extern int otp_read_word(si_t *sih, uint wn, uint16 *data);
48 extern int otp_nvread(void *oh, char *data, uint *len);
49 #ifdef BCMNVRAMW
50 extern int otp_write_region(si_t *sih, int region, uint16 *data, uint wlen);
51 extern int otp_write_word(si_t *sih, uint wn, uint16 data);
52 extern int otp_cis_append_region(si_t *sih, int region, char *vars, int count);
53 extern int otp_lock(si_t *sih);
54 extern int otp_nvwrite(void *oh, uint16 *data, uint wlen);
55 #endif /* BCMNVRAMW */
57 #if defined(WLTEST)
58 extern int otp_dump(void *oh, int arg, char *buf, uint size);
59 extern int otp_dumpstats(void *oh, int arg, char *buf, uint size);
60 #endif
62 #if defined(BCMNVRAMW)
63 #define otp_write_rde(oh, rde, bit, val) ipxotp_write_rde(oh, rde, bit, val)
64 extern int ipxotp_write_rde(void *oh, int rde, uint bit, uint val);
65 #endif
67 #endif /* _bcmotp_h_ */