drivers/fpga/lattice-sysconfig.c
Source file repositories/reference/linux-study-clean/drivers/fpga/lattice-sysconfig.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/fpga/lattice-sysconfig.c- Extension
.c- Size
- 8920 bytes
- Lines
- 398
- Domain
- Driver Families
- Bucket
- drivers/fpga
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/delay.hlinux/fpga/fpga-mgr.hlinux/gpio/consumer.hlinux/iopoll.hlattice-sysconfig.h
Detected Declarations
function sysconfig_cmd_writefunction sysconfig_cmd_readfunction sysconfig_read_busyfunction sysconfig_poll_busyfunction sysconfig_read_statusfunction sysconfig_poll_statusfunction sysconfig_poll_gpiofunction sysconfig_gpio_refreshfunction sysconfig_lsc_refreshfunction sysconfig_refreshfunction sysconfig_isc_enablefunction sysconfig_isc_erasefunction sysconfig_isc_initfunction sysconfig_lsc_init_addrfunction sysconfig_burst_write_initfunction sysconfig_burst_write_completefunction sysconfig_bitstream_burst_writefunction sysconfig_isc_disablefunction sysconfig_cleanupfunction sysconfig_isc_finishfunction sysconfig_ops_statefunction sysconfig_ops_write_initfunction sysconfig_ops_writefunction sysconfig_ops_write_completefunction sysconfig_probeexport sysconfig_probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Lattice FPGA sysCONFIG interface functions independent of port type.
*/
#include <linux/delay.h>
#include <linux/fpga/fpga-mgr.h>
#include <linux/gpio/consumer.h>
#include <linux/iopoll.h>
#include "lattice-sysconfig.h"
static int sysconfig_cmd_write(struct sysconfig_priv *priv, const void *buf,
size_t buf_len)
{
return priv->command_transfer(priv, buf, buf_len, NULL, 0);
}
static int sysconfig_cmd_read(struct sysconfig_priv *priv, const void *tx_buf,
size_t tx_len, void *rx_buf, size_t rx_len)
{
return priv->command_transfer(priv, tx_buf, tx_len, rx_buf, rx_len);
}
static int sysconfig_read_busy(struct sysconfig_priv *priv)
{
const u8 lsc_check_busy[] = SYSCONFIG_LSC_CHECK_BUSY;
u8 busy;
int ret;
ret = sysconfig_cmd_read(priv, lsc_check_busy, sizeof(lsc_check_busy),
&busy, sizeof(busy));
return ret ? : busy;
}
static int sysconfig_poll_busy(struct sysconfig_priv *priv)
{
int ret, busy;
ret = read_poll_timeout(sysconfig_read_busy, busy, busy <= 0,
SYSCONFIG_POLL_INTERVAL_US,
SYSCONFIG_POLL_BUSY_TIMEOUT_US, false, priv);
return ret ? : busy;
}
static int sysconfig_read_status(struct sysconfig_priv *priv, u32 *status)
{
const u8 lsc_read_status[] = SYSCONFIG_LSC_READ_STATUS;
__be32 device_status;
int ret;
ret = sysconfig_cmd_read(priv, lsc_read_status, sizeof(lsc_read_status),
&device_status, sizeof(device_status));
if (ret)
return ret;
*status = be32_to_cpu(device_status);
return 0;
}
static int sysconfig_poll_status(struct sysconfig_priv *priv, u32 *status)
{
int ret = sysconfig_poll_busy(priv);
if (ret)
return ret;
return sysconfig_read_status(priv, status);
}
static int sysconfig_poll_gpio(struct gpio_desc *gpio, bool is_active)
{
int ret, val;
ret = read_poll_timeout(gpiod_get_value, val,
val < 0 || !!val == is_active,
SYSCONFIG_POLL_INTERVAL_US,
SYSCONFIG_POLL_GPIO_TIMEOUT_US, false, gpio);
if (val < 0)
return val;
return ret;
}
static int sysconfig_gpio_refresh(struct sysconfig_priv *priv)
{
Annotation
- Immediate include surface: `linux/delay.h`, `linux/fpga/fpga-mgr.h`, `linux/gpio/consumer.h`, `linux/iopoll.h`, `lattice-sysconfig.h`.
- Detected declarations: `function sysconfig_cmd_write`, `function sysconfig_cmd_read`, `function sysconfig_read_busy`, `function sysconfig_poll_busy`, `function sysconfig_read_status`, `function sysconfig_poll_status`, `function sysconfig_poll_gpio`, `function sysconfig_gpio_refresh`, `function sysconfig_lsc_refresh`, `function sysconfig_refresh`.
- Atlas domain: Driver Families / drivers/fpga.
- Implementation status: integration implementation candidate.
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.