summaryrefslogtreecommitdiffstats
path: root/include/dni_common.h
blob: 64d9b6afbda3ef2a2d9bad4143614a0ab14cff0a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
 * (C) Copyright 2000-2004
 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 *
 * See file CREDITS for list of people who contributed to this
 * project.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 * MA 02111-1307 USA
 */

#ifndef __DNI_COMMON_H_
#define __DNI_COMMON_H_	1

#define CONFIG_SYS_FLASH_SECTOR_SIZE 0x20000
#define BOARD_MODEL_ID_LENGTH                    18
#define CONFIG_SYS_IMAGE_BASE_ADDR  0xb80000
#define CONFIG_SYS_IMAGE_ADDR_BEGIN (CONFIG_SYS_IMAGE_BASE_ADDR)
#define CONFIG_SYS_IMAGE_LEN   0x4000000
#define CONFIG_SYS_STRING_TABLE_LEN  0x40000  /* Each string table takes 256KB to save.  */
#define CONFIG_SYS_STRING_TABLE_NUMBER 7
#define CONFIG_SYS_STRING_TABLE_TOTAL_LEN  0x100000  /* Totally allocate 3584KB to save all string tables. */
#define CONFIG_SYS_STRING_TABLE_BASE_ADDR  0x5680000
#define CONFIG_SYS_STRING_TABLE_ADDR_BEGIN (CONFIG_SYS_STRING_TABLE_BASE_ADDR)
#define CONFIG_SYS_STRING_TABLE_ADDR_END   (CONFIG_SYS_STRING_TABLE_ADDR_BEGIN + CONFIG_SYS_STRING_TABLE_TOTAL_LEN)

#ifdef DNI_NAND
#include <nand.h>

void update_data(ulong, int, ulong, size_t, int, int);
//size_t get_len_incl_bad (nand_info_t *, loff_t, const size_t);
#endif

void get_board_data(int offset, int len, u8* buf);
int set_board_data(int offset, int len, u8 *buf);

#ifdef NETGEAR_BOARD_ID_SUPPORT
int board_match_image_hw_id(ulong);
int board_match_image_model_id(ulong);
void board_update_image_model_id(ulong);
#endif

#if defined(NETGEAR_BOARD_ID_SUPPORT) && \
    defined(OPEN_SOURCE_ROUTER_SUPPORT) && defined(OPEN_SOURCE_ROUTER_ID)
extern int board_model_id_match_open_source_id(void);
extern int image_match_open_source_fw_id(ulong);
extern int board_image_reserved_length(void);
#else
static inline int board_model_id_match_open_source_id(void)
{
	return 0;
}
static inline int image_match_open_source_fw_id(ulong fw_image_addr)
{
	return 0;
}
static inline int board_image_reserved_length(void)
{
	return 0;
}
#endif  /* NETGEAR_BOARD_ID_SUPPORT && OPEN_SOURCE_ROUTER */

#if defined(WORKAROUND_QCA8337_GMAC_NMRP_HANG)
#define workaround_qca8337_gmac_nmrp_hang_action()  do {  \
	DECLARE_GLOBAL_DATA_PTR;  \
	eth_halt();  \
	eth_init(gd->bd);  \
} while (0)
#else
#define workaround_qca8337_gmac_nmrp_hang_action()  do {} while (0)
#endif

#if defined(WORKAROUND_DUPLICATE_TFTP_DATA_PACKET_BUG_OF_NMRP_SERVER)
#define workaround_duplicate_tftp_data_packet_bug_of_nmrp_server()  do {  \
	timeout = 1000UL;  \
} while (0)
#else
#define workaround_duplicate_tftp_data_packet_bug_of_nmrp_server()  do {  \
} while (0)
#endif

#if defined(WORKAROUND_IPQ40XX_GMAC_NMRP_HANG)
#define workaround_ipq40xx_gmac_nmrp_hang_action()  do {  \
	DECLARE_GLOBAL_DATA_PTR;  \
	eth_halt();  \
	eth_init(gd->bd);  \
} while (0)
#else
#define workaround_ipq40xx_gmac_nmrp_hang_action()  do {} while (0)
#endif

#endif	/* __DNI_COMMON_H_ */