1*a10e763bSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 27490b008SAlexander Aring /* 37490b008SAlexander Aring * atusb.h - Definitions shared between kernel and ATUSB firmware 47490b008SAlexander Aring * 57490b008SAlexander Aring * Written 2013 by Werner Almesberger <werner@almesberger.net> 67490b008SAlexander Aring * 77490b008SAlexander Aring * (at your option) any later version. 87490b008SAlexander Aring * 97490b008SAlexander Aring * This file should be identical for kernel and firmware. 107490b008SAlexander Aring * Kernel: drivers/net/ieee802154/atusb.h 117490b008SAlexander Aring * Firmware: ben-wpan/atusb/fw/include/atusb/atusb.h 127490b008SAlexander Aring */ 137490b008SAlexander Aring 147490b008SAlexander Aring #ifndef _ATUSB_H 157490b008SAlexander Aring #define _ATUSB_H 167490b008SAlexander Aring 177490b008SAlexander Aring #define ATUSB_VENDOR_ID 0x20b7 /* Qi Hardware*/ 187490b008SAlexander Aring #define ATUSB_PRODUCT_ID 0x1540 /* 802.15.4, device 0 */ 197490b008SAlexander Aring /* -- - - */ 207490b008SAlexander Aring 217490b008SAlexander Aring #define ATUSB_BUILD_SIZE 256 /* maximum build version/date message length */ 227490b008SAlexander Aring 237490b008SAlexander Aring /* Commands to our device. Make sure this is synced with the firmware */ 247490b008SAlexander Aring enum atusb_requests { 257490b008SAlexander Aring ATUSB_ID = 0x00, /* system status/control grp */ 267490b008SAlexander Aring ATUSB_BUILD, 277490b008SAlexander Aring ATUSB_RESET, 287490b008SAlexander Aring ATUSB_RF_RESET = 0x10, /* debug/test group */ 297490b008SAlexander Aring ATUSB_POLL_INT, 307490b008SAlexander Aring ATUSB_TEST, /* atusb-sil only */ 317490b008SAlexander Aring ATUSB_TIMER, 327490b008SAlexander Aring ATUSB_GPIO, 337490b008SAlexander Aring ATUSB_SLP_TR, 347490b008SAlexander Aring ATUSB_GPIO_CLEANUP, 357490b008SAlexander Aring ATUSB_REG_WRITE = 0x20, /* transceiver group */ 367490b008SAlexander Aring ATUSB_REG_READ, 377490b008SAlexander Aring ATUSB_BUF_WRITE, 387490b008SAlexander Aring ATUSB_BUF_READ, 397490b008SAlexander Aring ATUSB_SRAM_WRITE, 407490b008SAlexander Aring ATUSB_SRAM_READ, 417490b008SAlexander Aring ATUSB_SPI_WRITE = 0x30, /* SPI group */ 427490b008SAlexander Aring ATUSB_SPI_READ1, 437490b008SAlexander Aring ATUSB_SPI_READ2, 447490b008SAlexander Aring ATUSB_SPI_WRITE2_SYNC, 457490b008SAlexander Aring ATUSB_RX_MODE = 0x40, /* HardMAC group */ 467490b008SAlexander Aring ATUSB_TX, 47c84d59e7SStefan Schmidt ATUSB_EUI64_WRITE = 0x50, /* Parameter in EEPROM grp */ 48c84d59e7SStefan Schmidt ATUSB_EUI64_READ, 497490b008SAlexander Aring }; 507490b008SAlexander Aring 51d5dd29e4SJosef Filzmaier enum { 52d5dd29e4SJosef Filzmaier ATUSB_HW_TYPE_100813, /* 2010-08-13 */ 53d5dd29e4SJosef Filzmaier ATUSB_HW_TYPE_101216, /* 2010-12-16 */ 54d5dd29e4SJosef Filzmaier ATUSB_HW_TYPE_110131, /* 2011-01-31, ATmega32U2-based */ 55d5dd29e4SJosef Filzmaier ATUSB_HW_TYPE_RZUSB, /* Atmel Raven USB dongle with at86rf230 */ 56d5dd29e4SJosef Filzmaier ATUSB_HW_TYPE_HULUSB, /* Busware HUL USB dongle with at86rf212 */ 57d5dd29e4SJosef Filzmaier }; 58d5dd29e4SJosef Filzmaier 59c84d59e7SStefan Schmidt /* 60c84d59e7SStefan Schmidt * Direction bRequest wValue wIndex wLength 617490b008SAlexander Aring * 627490b008SAlexander Aring * ->host ATUSB_ID - - 3 637490b008SAlexander Aring * ->host ATUSB_BUILD - - #bytes 647490b008SAlexander Aring * host-> ATUSB_RESET - - 0 657490b008SAlexander Aring * 667490b008SAlexander Aring * host-> ATUSB_RF_RESET - - 0 677490b008SAlexander Aring * ->host ATUSB_POLL_INT - - 1 687490b008SAlexander Aring * host-> ATUSB_TEST - - 0 697490b008SAlexander Aring * ->host ATUSB_TIMER - - #bytes (6) 707490b008SAlexander Aring * ->host ATUSB_GPIO dir+data mask+p# 3 717490b008SAlexander Aring * host-> ATUSB_SLP_TR - - 0 727490b008SAlexander Aring * host-> ATUSB_GPIO_CLEANUP - - 0 737490b008SAlexander Aring * 747490b008SAlexander Aring * host-> ATUSB_REG_WRITE value addr 0 757490b008SAlexander Aring * ->host ATUSB_REG_READ - addr 1 767490b008SAlexander Aring * host-> ATUSB_BUF_WRITE - - #bytes 777490b008SAlexander Aring * ->host ATUSB_BUF_READ - - #bytes 787490b008SAlexander Aring * host-> ATUSB_SRAM_WRITE - addr #bytes 797490b008SAlexander Aring * ->host ATUSB_SRAM_READ - addr #bytes 807490b008SAlexander Aring * 817490b008SAlexander Aring * host-> ATUSB_SPI_WRITE byte0 byte1 #bytes 827490b008SAlexander Aring * ->host ATUSB_SPI_READ1 byte0 - #bytes 837490b008SAlexander Aring * ->host ATUSB_SPI_READ2 byte0 byte1 #bytes 847490b008SAlexander Aring * ->host ATUSB_SPI_WRITE2_SYNC byte0 byte1 0/1 857490b008SAlexander Aring * 867490b008SAlexander Aring * host-> ATUSB_RX_MODE on - 0 877490b008SAlexander Aring * host-> ATUSB_TX flags ack_seq #bytes 88c84d59e7SStefan Schmidt * host-> ATUSB_EUI64_WRITE - - #bytes (8) 89c84d59e7SStefan Schmidt * ->host ATUSB_EUI64_READ - - #bytes (8) 907490b008SAlexander Aring */ 917490b008SAlexander Aring 927490b008SAlexander Aring #define ATUSB_REQ_FROM_DEV (USB_TYPE_VENDOR | USB_DIR_IN) 937490b008SAlexander Aring #define ATUSB_REQ_TO_DEV (USB_TYPE_VENDOR | USB_DIR_OUT) 947490b008SAlexander Aring 957490b008SAlexander Aring #endif /* !_ATUSB_H */ 96