drivers/greybus/gb-beagleplay.c
Source file repositories/reference/linux-study-clean/drivers/greybus/gb-beagleplay.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/greybus/gb-beagleplay.c- Extension
.c- Size
- 33017 bytes
- Lines
- 1266
- Domain
- Driver Families
- Bucket
- drivers/greybus
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/unaligned.hlinux/crc32.hlinux/gpio/consumer.hlinux/firmware.hlinux/greybus.hlinux/serdev.hlinux/crc-ccitt.hlinux/circ_buf.h
Detected Declarations
struct gb_beagleplaystruct hdlc_payloadstruct hdlc_greybus_framestruct cc1352_bootloader_packetstruct cc1352_bootloader_download_cmd_datastruct cc1352_bootloader_crc32_cmd_dataenum cc1352_bootloader_cmdenum cc1352_bootloader_statusfunction hdlc_rx_greybus_framefunction hdlc_rx_dbg_framefunction hdlc_writefunction hdlc_appendfunction hdlc_append_escapedfunction hdlc_append_tx_framefunction hdlc_append_tx_u8function hdlc_append_tx_buffunction hdlc_append_tx_crcfunction hdlc_transmitfunction hdlc_encoded_lengthfunction hdlc_tx_framesfunction hdlc_tx_s_frame_ackfunction hdlc_rx_framefunction hdlc_rxfunction hdlc_initfunction hdlc_deinitfunction csum8function cc1352_bootloader_send_ackfunction cc1352_bootloader_send_nackfunction cc1352_bootloader_pkt_rxfunction cc1352_bootloader_rxfunction gb_tty_receivefunction gb_tty_wakeupfunction gb_message_sendfunction gb_message_cancelfunction gb_beagleplay_start_svcfunction gb_beagleplay_stop_svcfunction cc1352_bootloader_wait_for_ackfunction cc1352_bootloader_syncfunction cc1352_bootloader_get_statusfunction cc1352_bootloader_erasefunction cc1352_bootloader_resetfunction cc1352_bootloader_empty_pktfunction cc1352_bootloader_crc32function cc1352_bootloader_downloadfunction cc1352_bootloader_send_datafunction gb_greybus_deinitfunction gb_greybus_initfunction cc1352_prepare
Annotated Snippet
struct gb_beagleplay {
struct serdev_device *sd;
struct gb_host_device *gb_hd;
struct work_struct tx_work;
spinlock_t tx_producer_lock;
spinlock_t tx_consumer_lock;
struct circ_buf tx_circ_buf;
u16 tx_crc;
u16 rx_buffer_len;
bool rx_in_esc;
u8 rx_buffer[MAX_RX_HDLC];
struct fw_upload *fwl;
struct gpio_desc *bootloader_backdoor_gpio;
struct gpio_desc *rst_gpio;
bool flashing_mode;
struct completion fwl_ack_com;
u8 fwl_ack;
struct completion fwl_cmd_response_com;
u32 fwl_cmd_response;
u32 fwl_crc32;
bool fwl_reset_addr;
};
/**
* struct hdlc_payload - Structure to represent part of HDCL frame payload data.
*
* @len: buffer length in bytes
* @buf: payload buffer
*/
struct hdlc_payload {
u16 len;
void *buf;
};
/**
* struct hdlc_greybus_frame - Structure to represent greybus HDLC frame payload
*
* @cport: cport id
* @hdr: greybus operation header
* @payload: greybus message payload
*
* The HDLC payload sent over UART for greybus address has cport preappended to greybus message
*/
struct hdlc_greybus_frame {
__le16 cport;
struct gb_operation_msg_hdr hdr;
u8 payload[];
} __packed;
/**
* enum cc1352_bootloader_cmd: CC1352 Bootloader Commands
*
* @COMMAND_DOWNLOAD: Prepares flash programming
* @COMMAND_GET_STATUS: Returns the status of the last command that was issued
* @COMMAND_SEND_DATA: Transfers data and programs flash
* @COMMAND_RESET: Performs a system reset
* @COMMAND_CRC32: Calculates CRC32 over a specified memory area
* @COMMAND_BANK_ERASE: Performs an erase of all of the customer-accessible
* flash sectors not protected by FCFG1 and CCFG
* writeprotect bits.
*
* CC1352 Bootloader serial bus commands
*/
enum cc1352_bootloader_cmd {
COMMAND_DOWNLOAD = 0x21,
COMMAND_GET_STATUS = 0x23,
COMMAND_SEND_DATA = 0x24,
COMMAND_RESET = 0x25,
COMMAND_CRC32 = 0x27,
COMMAND_BANK_ERASE = 0x2c,
};
/**
* enum cc1352_bootloader_status: CC1352 Bootloader COMMAND_GET_STATUS response
*
* @COMMAND_RET_SUCCESS: Status for successful command
* @COMMAND_RET_UNKNOWN_CMD: Status for unknown command
* @COMMAND_RET_INVALID_CMD: Status for invalid command (in other words,
* incorrect packet size)
* @COMMAND_RET_INVALID_ADR: Status for invalid input address
* @COMMAND_RET_FLASH_FAIL: Status for failing flash erase or program operation
*/
enum cc1352_bootloader_status {
COMMAND_RET_SUCCESS = 0x40,
COMMAND_RET_UNKNOWN_CMD = 0x41,
COMMAND_RET_INVALID_CMD = 0x42,
Annotation
- Immediate include surface: `linux/unaligned.h`, `linux/crc32.h`, `linux/gpio/consumer.h`, `linux/firmware.h`, `linux/greybus.h`, `linux/serdev.h`, `linux/crc-ccitt.h`, `linux/circ_buf.h`.
- Detected declarations: `struct gb_beagleplay`, `struct hdlc_payload`, `struct hdlc_greybus_frame`, `struct cc1352_bootloader_packet`, `struct cc1352_bootloader_download_cmd_data`, `struct cc1352_bootloader_crc32_cmd_data`, `enum cc1352_bootloader_cmd`, `enum cc1352_bootloader_status`, `function hdlc_rx_greybus_frame`, `function hdlc_rx_dbg_frame`.
- Atlas domain: Driver Families / drivers/greybus.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.