xref: /openbmc/linux/drivers/net/ieee802154/atusb.h (revision c4f7ac64)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * atusb.h - Definitions shared between kernel and ATUSB firmware
4  *
5  * Written 2013 by Werner Almesberger <werner@almesberger.net>
6  *
7  * (at your option) any later version.
8  *
9  * This file should be identical for kernel and firmware.
10  * Kernel: drivers/net/ieee802154/atusb.h
11  * Firmware: ben-wpan/atusb/fw/include/atusb/atusb.h
12  */
13 
14 #ifndef	_ATUSB_H
15 #define	_ATUSB_H
16 
17 #define ATUSB_VENDOR_ID	0x20b7	/* Qi Hardware*/
18 #define ATUSB_PRODUCT_ID 0x1540	/* 802.15.4, device 0 */
19 				/*     -- -         - */
20 
21 #define ATUSB_BUILD_SIZE 256	/* maximum build version/date message length */
22 
23 /* Commands to our device. Make sure this is synced with the firmware */
24 enum atusb_requests {
25 	ATUSB_ID			= 0x00,	/* system status/control grp */
26 	ATUSB_BUILD,
27 	ATUSB_RESET,
28 	ATUSB_RF_RESET			= 0x10,	/* debug/test group */
29 	ATUSB_POLL_INT,
30 	ATUSB_TEST,			/* atusb-sil only */
31 	ATUSB_TIMER,
32 	ATUSB_GPIO,
33 	ATUSB_SLP_TR,
34 	ATUSB_GPIO_CLEANUP,
35 	ATUSB_REG_WRITE			= 0x20,	/* transceiver group */
36 	ATUSB_REG_READ,
37 	ATUSB_BUF_WRITE,
38 	ATUSB_BUF_READ,
39 	ATUSB_SRAM_WRITE,
40 	ATUSB_SRAM_READ,
41 	ATUSB_SPI_WRITE			= 0x30,	/* SPI group */
42 	ATUSB_SPI_READ1,
43 	ATUSB_SPI_READ2,
44 	ATUSB_SPI_WRITE2_SYNC,
45 	ATUSB_RX_MODE			= 0x40, /* HardMAC group */
46 	ATUSB_TX,
47 	ATUSB_EUI64_WRITE		= 0x50, /* Parameter in EEPROM grp */
48 	ATUSB_EUI64_READ,
49 };
50 
51 enum {
52 	ATUSB_HW_TYPE_100813,	/* 2010-08-13 */
53 	ATUSB_HW_TYPE_101216,	/* 2010-12-16 */
54 	ATUSB_HW_TYPE_110131,	/* 2011-01-31, ATmega32U2-based */
55 	ATUSB_HW_TYPE_RZUSB,	/* Atmel Raven USB dongle with at86rf230 */
56 	ATUSB_HW_TYPE_HULUSB,	/* Busware HUL USB dongle with at86rf212 */
57 };
58 
59 /*
60  * Direction	bRequest		wValue		wIndex	wLength
61  *
62  * ->host	ATUSB_ID		-		-	3
63  * ->host	ATUSB_BUILD		-		-	#bytes
64  * host->	ATUSB_RESET		-		-	0
65  *
66  * host->	ATUSB_RF_RESET		-		-	0
67  * ->host	ATUSB_POLL_INT		-		-	1
68  * host->	ATUSB_TEST		-		-	0
69  * ->host	ATUSB_TIMER		-		-	#bytes (6)
70  * ->host	ATUSB_GPIO		dir+data	mask+p#	3
71  * host->	ATUSB_SLP_TR		-		-	0
72  * host->	ATUSB_GPIO_CLEANUP	-		-	0
73  *
74  * host->	ATUSB_REG_WRITE		value		addr	0
75  * ->host	ATUSB_REG_READ		-		addr	1
76  * host->	ATUSB_BUF_WRITE		-		-	#bytes
77  * ->host	ATUSB_BUF_READ		-		-	#bytes
78  * host->	ATUSB_SRAM_WRITE	-		addr	#bytes
79  * ->host	ATUSB_SRAM_READ		-		addr	#bytes
80  *
81  * host->	ATUSB_SPI_WRITE		byte0		byte1	#bytes
82  * ->host	ATUSB_SPI_READ1		byte0		-	#bytes
83  * ->host	ATUSB_SPI_READ2		byte0		byte1	#bytes
84  * ->host	ATUSB_SPI_WRITE2_SYNC	byte0		byte1	0/1
85  *
86  * host->	ATUSB_RX_MODE		on		-	0
87  * host->	ATUSB_TX		flags		ack_seq	#bytes
88  * host->	ATUSB_EUI64_WRITE	-		-	#bytes (8)
89  * ->host	ATUSB_EUI64_READ	-		-	#bytes (8)
90  */
91 
92 #define ATUSB_REQ_FROM_DEV	(USB_TYPE_VENDOR | USB_DIR_IN)
93 #define ATUSB_REQ_TO_DEV	(USB_TYPE_VENDOR | USB_DIR_OUT)
94 
95 #endif /* !_ATUSB_H */
96