drivers/fsi/fsi-master-ast-cf.c
Source file repositories/reference/linux-study-clean/drivers/fsi/fsi-master-ast-cf.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/fsi/fsi-master-ast-cf.c- Extension
.c- Size
- 37872 bytes
- Lines
- 1437
- Domain
- Driver Families
- Bucket
- drivers/fsi
- 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/crc4.hlinux/delay.hlinux/device.hlinux/fsi.hlinux/gpio/consumer.hlinux/io.hlinux/irqflags.hlinux/module.hlinux/of.hlinux/of_reserved_mem.hlinux/platform_device.hlinux/slab.hlinux/regmap.hlinux/firmware.hlinux/gpio/aspeed.hlinux/mfd/syscon.hlinux/genalloc.hfsi-master.hcf-fsi-fw.htrace/events/fsi_master_ast_cf.h
Detected Declarations
struct fsi_master_acfstruct fsi_msgfunction msg_push_bitsfunction msg_push_crcfunction msg_finish_cmdfunction check_same_addressfunction check_relative_addressfunction last_address_updatefunction build_ar_commandfunction build_dpoll_commandfunction build_epoll_commandfunction build_term_commandfunction do_copro_commandfunction clock_zerosfunction send_requestfunction read_copro_responsefunction send_termfunction dump_ucode_tracefunction handle_responsefunction fsi_master_acf_xferfunction fsi_master_acf_readfunction fsi_master_acf_writefunction fsi_master_acf_termfunction fsi_master_acf_breakfunction reset_cffunction start_cffunction setup_ast2500_cf_mapsfunction setup_ast2400_cf_mapsfunction setup_common_fw_configfunction setup_ast2500_fw_configfunction setup_ast2400_fw_configfunction setup_gpios_for_coprofunction release_copro_gpiosfunction load_copro_firmwarefunction check_firmware_imagefunction copro_enable_sw_irqfunction fsi_master_acf_setupfunction fsi_master_acf_terminatefunction fsi_master_acf_setup_externalfunction fsi_master_acf_link_enablefunction fsi_master_acf_link_configfunction external_mode_showfunction external_mode_storefunction fsi_master_acf_gpio_requestfunction racefunction fsi_master_acf_gpio_releasefunction fsi_master_acf_releasefunction fsi_master_acf_probe
Annotated Snippet
struct fsi_master_acf {
struct fsi_master master;
struct device *dev;
struct regmap *scu;
struct mutex lock; /* mutex for command ordering */
struct gpio_desc *gpio_clk;
struct gpio_desc *gpio_data;
struct gpio_desc *gpio_trans; /* Voltage translator */
struct gpio_desc *gpio_enable; /* FSI enable */
struct gpio_desc *gpio_mux; /* Mux control */
uint16_t gpio_clk_vreg;
uint16_t gpio_clk_dreg;
uint16_t gpio_dat_vreg;
uint16_t gpio_dat_dreg;
uint16_t gpio_tra_vreg;
uint16_t gpio_tra_dreg;
uint8_t gpio_clk_bit;
uint8_t gpio_dat_bit;
uint8_t gpio_tra_bit;
uint32_t cf_mem_addr;
size_t cf_mem_size;
void __iomem *cf_mem;
void __iomem *cvic;
struct gen_pool *sram_pool;
void __iomem *sram;
bool is_ast2500;
bool external_mode;
bool trace_enabled;
uint32_t last_addr;
uint8_t t_send_delay;
uint8_t t_echo_delay;
uint32_t cvic_sw_irq;
};
#define to_fsi_master_acf(m) container_of(m, struct fsi_master_acf, master)
struct fsi_msg {
uint64_t msg;
uint8_t bits;
};
#define CREATE_TRACE_POINTS
#include <trace/events/fsi_master_ast_cf.h>
static void msg_push_bits(struct fsi_msg *msg, uint64_t data, int bits)
{
msg->msg <<= bits;
msg->msg |= data & ((1ull << bits) - 1);
msg->bits += bits;
}
static void msg_push_crc(struct fsi_msg *msg)
{
uint8_t crc;
int top;
top = msg->bits & 0x3;
/* start bit, and any non-aligned top bits */
crc = crc4(0, 1 << top | msg->msg >> (msg->bits - top), top + 1);
/* aligned bits */
crc = crc4(crc, msg->msg, msg->bits - top);
msg_push_bits(msg, crc, 4);
}
static void msg_finish_cmd(struct fsi_msg *cmd)
{
/* Left align message */
cmd->msg <<= (64 - cmd->bits);
}
static bool check_same_address(struct fsi_master_acf *master, int id,
uint32_t addr)
{
/* this will also handle LAST_ADDR_INVALID */
return master->last_addr == (((id & 0x3) << 21) | (addr & ~0x3));
}
static bool check_relative_address(struct fsi_master_acf *master, int id,
uint32_t addr, uint32_t *rel_addrp)
{
uint32_t last_addr = master->last_addr;
int32_t rel_addr;
if (last_addr == LAST_ADDR_INVALID)
return false;
/* We may be in 23-bit addressing mode, which uses the id as the
* top two address bits. So, if we're referencing a different ID,
Annotation
- Immediate include surface: `linux/crc4.h`, `linux/delay.h`, `linux/device.h`, `linux/fsi.h`, `linux/gpio/consumer.h`, `linux/io.h`, `linux/irqflags.h`, `linux/module.h`.
- Detected declarations: `struct fsi_master_acf`, `struct fsi_msg`, `function msg_push_bits`, `function msg_push_crc`, `function msg_finish_cmd`, `function check_same_address`, `function check_relative_address`, `function last_address_update`, `function build_ar_command`, `function build_dpoll_command`.
- Atlas domain: Driver Families / drivers/fsi.
- 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.