aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm63xx/patches-4.1/519_board_CPVA502plus.patch
blob: c1757dc14e53cc3fd59a6701cf5f3357bd75cd4d (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
--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
+++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
@@ -428,6 +428,27 @@ static struct board_info __initdata boar
 	},
 };
 
+static struct board_info __initdata board_CPVA502plus = {
+	.name				= "CPVA502+",
+	.expected_cpu_id		= 0x6348,
+
+	.has_uart0			= 1,
+	.has_enet0			= 1,
+	.has_enet1			= 1,
+	.has_pci			= 1,
+
+	.enet0 = {
+		.has_phy		= 1,
+		.use_internal_phy	= 1,
+	},
+	.enet1 = {
+		.has_phy		= 1,
+		.phy_id			= 0,
+	},
+
+	.ephy_reset_gpio		= 4,
+	.ephy_reset_gpio_flags		= GPIO_ACTIVE_LOW,
+};
 
 static struct board_info __initdata board_ct536_ct5621 = {
 	.name				= "CT536_CT5621",
@@ -1148,6 +1169,7 @@ static const struct board_info __initcon
 	&board_V2110,
 	&board_ct536_ct5621,
 	&board_96348A_122,
+	&board_CPVA502plus,
 #endif
 
 #ifdef CONFIG_BCM63XX_CPU_6358
@@ -1200,6 +1222,7 @@ static struct of_device_id const bcm963x
 	{ .compatible = "t-com,spw500v", .data = &board_spw500v, },
 	{ .compatible = "tecom,gw6000", .data = &board_gw6000, },
 	{ .compatible = "tecom,gw6200", .data = &board_gw6200, },
+	{ .compatible = "telsey,cpva502+", .data = &board_CPVA502plus, },
 	{ .compatible = "telsey,magic", .data = &board_96348sv, },
 	{ .compatible = "tp-link,td-w8900gb", .data = &board_96348gw_11, },
 	{ .compatible = "usr,9108", .data = &board_96348gw_a, },
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/*
 * Copyright (C) 2008 Felix Fietkau <nbd@openwrt.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2
 * as published by the Free Software Foundation
 *
 * 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.
 */

#ifndef __EAD_H
#define __EAD_H

#define EAD_DEBUGLEVEL	1

#include <stdint.h>
#include <stddef.h>

#ifndef MAXSALTLEN
#define MAXSALTLEN 32
#endif

#define EAD_PORT	56026UL
#define EAD_MAGIC	3671771902UL
#define EAD_CMD_TIMEOUT	10

#define EAD_MAX_IV_INCR	128

/* request/response types */
/* response id == request id + 1 */
enum ead_type {
	EAD_TYPE_PING,
	EAD_TYPE_PONG,

	EAD_TYPE_SET_USERNAME,
	EAD_TYPE_ACK_USERNAME,

	EAD_TYPE_GET_PRIME,
	EAD_TYPE_PRIME,

	EAD_TYPE_SEND_A,
	EAD_TYPE_SEND_B,

	EAD_TYPE_SEND_AUTH,
	EAD_TYPE_DONE_AUTH,

	EAD_TYPE_SEND_CMD,
	EAD_TYPE_RESULT_CMD,

	EAD_TYPE_LAST
};

enum ead_auth_type {
	EAD_AUTH_DEFAULT,
	EAD_AUTH_MD5
};

enum ead_cmd_type {
	EAD_CMD_NORMAL,
	EAD_CMD_BACKGROUND,
	EAD_CMD_LAST
};

struct ead_msg_pong {
	uint16_t auth_type;
	char name[];
} __attribute__((packed));

struct ead_msg_number {
	uint8_t id;
	unsigned char data[];
} __attribute__((packed));

struct ead_msg_salt {
	uint8_t prime;
	uint8_t len;
	unsigned char salt[MAXSALTLEN];
	unsigned char ext_salt[MAXSALTLEN];
} __attribute__((packed));

struct ead_msg_user {
	char username[32];
} __attribute__((packed));

struct ead_msg_auth {
	unsigned char data[20];
} __attribute__((packed));

struct ead_msg_cmd {
	uint8_t type;
	uint16_t timeout;
	unsigned char data[];
} __attribute__((packed));

struct ead_msg_cmd_data {
	uint8_t done;
	unsigned char data[];
} __attribute__((packed));

struct ead_msg_encrypted {
	uint32_t hash[5];
	uint32_t iv;
	uint8_t pad;
	union {
		struct ead_msg_cmd cmd;
		struct ead_msg_cmd_data cmd_data;
	} data[];
} __attribute__((packed));


#define EAD_DATA(_msg, _type) (&((_msg)->data[0]._type))
#define EAD_ENC_DATA(_msg, _type) (&((_msg)->data[0].enc.data[0]._type))

/* for ead_msg::sid */
#define EAD_INSTANCE_MASK	0xf000
#define EAD_INSTANCE_SHIFT	12

struct ead_msg {
	uint32_t magic;
	uint32_t len;
	uint32_t type;
	uint16_t nid; /* node id */
	uint16_t sid; /* session id */
	uint32_t ip; /* source ip for responses from the server */
	union {
		struct ead_msg_pong pong;
		struct ead_msg_user user;
		struct ead_msg_number number;
		struct ead_msg_auth auth;
		struct ead_msg_salt salt;
		struct ead_msg_encrypted enc;
	} data[];
} __attribute__((packed));


#endif