xref: /openbmc/linux/drivers/net/ieee802154/atusb.h (revision f3539c12)
1 /*
2  * atusb.h - Definitions shared between kernel and ATUSB firmware
3  *
4  * Written 2013 by Werner Almesberger <werner@almesberger.net>
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation, version 2, or
9  * (at your option) any later version.
10  *
11  * This file should be identical for kernel and firmware.
12  * Kernel: drivers/net/ieee802154/atusb.h
13  * Firmware: ben-wpan/atusb/fw/include/atusb/atusb.h
14  */
15 
16 #ifndef _ATUSB_H
17 #define _ATUSB_H
18 
19 #define ATUSB_VENDOR_ID	0x20b7	/* Qi Hardware*/
20 #define ATUSB_PRODUCT_ID 0x1540	/* 802.15.4, device 0 */
21 				/*     -- -         - */
22 
23 #define ATUSB_BUILD_SIZE 256	/* maximum build version/date message length */
24 
25 /* Commands to our device. Make sure this is synced with the firmware */
26 enum atusb_requests {
27 	ATUSB_ID			= 0x00,	/* system status/control grp */
28 	ATUSB_BUILD,
29 	ATUSB_RESET,
30 	ATUSB_RF_RESET			= 0x10,	/* debug/test group */
31 	ATUSB_POLL_INT,
32 	ATUSB_TEST,			/* atusb-sil only */
33 	ATUSB_TIMER,
34 	ATUSB_GPIO,
35 	ATUSB_SLP_TR,
36 	ATUSB_GPIO_CLEANUP,
37 	ATUSB_REG_WRITE			= 0x20,	/* transceiver group */
38 	ATUSB_REG_READ,
39 	ATUSB_BUF_WRITE,
40 	ATUSB_BUF_READ,
41 	ATUSB_SRAM_WRITE,
42 	ATUSB_SRAM_READ,
43 	ATUSB_SPI_WRITE			= 0x30,	/* SPI group */
44 	ATUSB_SPI_READ1,
45 	ATUSB_SPI_READ2,
46 	ATUSB_SPI_WRITE2_SYNC,
47 	ATUSB_RX_MODE			= 0x40, /* HardMAC group */
48 	ATUSB_TX,
49 };
50 
51 /* Direction	bRequest		wValue		wIndex	wLength
52  *
53  * ->host	ATUSB_ID		-		-	3
54  * ->host	ATUSB_BUILD		-		-	#bytes
55  * host->	ATUSB_RESET		-		-	0
56  *
57  * host->	ATUSB_RF_RESET		-		-	0
58  * ->host	ATUSB_POLL_INT		-		-	1
59  * host->	ATUSB_TEST		-		-	0
60  * ->host	ATUSB_TIMER		-		-	#bytes (6)
61  * ->host	ATUSB_GPIO		dir+data	mask+p#	3
62  * host->	ATUSB_SLP_TR		-		-	0
63  * host->	ATUSB_GPIO_CLEANUP	-		-	0
64  *
65  * host->	ATUSB_REG_WRITE		value		addr	0
66  * ->host	ATUSB_REG_READ		-		addr	1
67  * host->	ATUSB_BUF_WRITE		-		-	#bytes
68  * ->host	ATUSB_BUF_READ		-		-	#bytes
69  * host->	ATUSB_SRAM_WRITE	-		addr	#bytes
70  * ->host	ATUSB_SRAM_READ		-		addr	#bytes
71  *
72  * host->	ATUSB_SPI_WRITE		byte0		byte1	#bytes
73  * ->host	ATUSB_SPI_READ1		byte0		-	#bytes
74  * ->host	ATUSB_SPI_READ2		byte0		byte1	#bytes
75  * ->host	ATUSB_SPI_WRITE2_SYNC	byte0		byte1	0/1
76  *
77  * host->	ATUSB_RX_MODE		on		-	0
78  * host->	ATUSB_TX		flags		ack_seq	#bytes
79  */
80 
81 #define ATUSB_REQ_FROM_DEV	(USB_TYPE_VENDOR | USB_DIR_IN)
82 #define ATUSB_REQ_TO_DEV	(USB_TYPE_VENDOR | USB_DIR_OUT)
83 
84 #endif /* !_ATUSB_H */
85