root/drivers/staging/greybus/greybus_firmware.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
   2 /*
   3  * Greybus Firmware Management User Header
   4  *
   5  * Copyright(c) 2016 Google Inc. All rights reserved.
   6  * Copyright(c) 2016 Linaro Ltd. All rights reserved.
   7  */
   8 
   9 #ifndef __GREYBUS_FIRMWARE_USER_H
  10 #define __GREYBUS_FIRMWARE_USER_H
  11 
  12 #include <linux/ioctl.h>
  13 #include <linux/types.h>
  14 
  15 #define GB_FIRMWARE_U_TAG_MAX_SIZE              10
  16 
  17 #define GB_FW_U_LOAD_METHOD_UNIPRO              0x01
  18 #define GB_FW_U_LOAD_METHOD_INTERNAL            0x02
  19 
  20 #define GB_FW_U_LOAD_STATUS_FAILED              0x00
  21 #define GB_FW_U_LOAD_STATUS_UNVALIDATED         0x01
  22 #define GB_FW_U_LOAD_STATUS_VALIDATED           0x02
  23 #define GB_FW_U_LOAD_STATUS_VALIDATION_FAILED   0x03
  24 
  25 #define GB_FW_U_BACKEND_FW_STATUS_SUCCESS       0x01
  26 #define GB_FW_U_BACKEND_FW_STATUS_FAIL_FIND     0x02
  27 #define GB_FW_U_BACKEND_FW_STATUS_FAIL_FETCH    0x03
  28 #define GB_FW_U_BACKEND_FW_STATUS_FAIL_WRITE    0x04
  29 #define GB_FW_U_BACKEND_FW_STATUS_INT           0x05
  30 #define GB_FW_U_BACKEND_FW_STATUS_RETRY         0x06
  31 #define GB_FW_U_BACKEND_FW_STATUS_NOT_SUPPORTED 0x07
  32 
  33 #define GB_FW_U_BACKEND_VERSION_STATUS_SUCCESS          0x01
  34 #define GB_FW_U_BACKEND_VERSION_STATUS_NOT_AVAILABLE    0x02
  35 #define GB_FW_U_BACKEND_VERSION_STATUS_NOT_SUPPORTED    0x03
  36 #define GB_FW_U_BACKEND_VERSION_STATUS_RETRY            0x04
  37 #define GB_FW_U_BACKEND_VERSION_STATUS_FAIL_INT         0x05
  38 
  39 /* IOCTL support */
  40 struct fw_mgmt_ioc_get_intf_version {
  41         __u8 firmware_tag[GB_FIRMWARE_U_TAG_MAX_SIZE];
  42         __u16 major;
  43         __u16 minor;
  44 } __attribute__ ((__packed__));
  45 
  46 struct fw_mgmt_ioc_get_backend_version {
  47         __u8 firmware_tag[GB_FIRMWARE_U_TAG_MAX_SIZE];
  48         __u16 major;
  49         __u16 minor;
  50         __u8 status;
  51 } __attribute__ ((__packed__));
  52 
  53 struct fw_mgmt_ioc_intf_load_and_validate {
  54         __u8 firmware_tag[GB_FIRMWARE_U_TAG_MAX_SIZE];
  55         __u8 load_method;
  56         __u8 status;
  57         __u16 major;
  58         __u16 minor;
  59 } __attribute__ ((__packed__));
  60 
  61 struct fw_mgmt_ioc_backend_fw_update {
  62         __u8 firmware_tag[GB_FIRMWARE_U_TAG_MAX_SIZE];
  63         __u8 status;
  64 } __attribute__ ((__packed__));
  65 
  66 #define FW_MGMT_IOCTL_BASE                      'F'
  67 #define FW_MGMT_IOC_GET_INTF_FW                 _IOR(FW_MGMT_IOCTL_BASE, 0, struct fw_mgmt_ioc_get_intf_version)
  68 #define FW_MGMT_IOC_GET_BACKEND_FW              _IOWR(FW_MGMT_IOCTL_BASE, 1, struct fw_mgmt_ioc_get_backend_version)
  69 #define FW_MGMT_IOC_INTF_LOAD_AND_VALIDATE      _IOWR(FW_MGMT_IOCTL_BASE, 2, struct fw_mgmt_ioc_intf_load_and_validate)
  70 #define FW_MGMT_IOC_INTF_BACKEND_FW_UPDATE      _IOWR(FW_MGMT_IOCTL_BASE, 3, struct fw_mgmt_ioc_backend_fw_update)
  71 #define FW_MGMT_IOC_SET_TIMEOUT_MS              _IOW(FW_MGMT_IOCTL_BASE, 4, unsigned int)
  72 #define FW_MGMT_IOC_MODE_SWITCH                 _IO(FW_MGMT_IOCTL_BASE, 5)
  73 
  74 #endif /* __GREYBUS_FIRMWARE_USER_H */
  75 

/* [<][>][^][v][top][bottom][index][help] */