drivers/memory/stm32-fmc2-ebi.c
Source file repositories/reference/linux-study-clean/drivers/memory/stm32-fmc2-ebi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/memory/stm32-fmc2-ebi.c- Extension
.c- Size
- 46655 bytes
- Lines
- 1831
- Domain
- Driver Families
- Bucket
- drivers/memory
- 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.
- 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/bitfield.hlinux/clk.hlinux/mfd/syscon.hlinux/module.hlinux/of.hlinux/of_platform.hlinux/pinctrl/consumer.hlinux/platform_device.hlinux/pm_runtime.hlinux/regmap.hlinux/reset.h
Detected Declarations
struct stm32_fmc2_ebistruct stm32_fmc2_ebi_datastruct stm32_fmc2_ebistruct stm32_fmc2_propenum stm32_fmc2_ebi_bankenum stm32_fmc2_ebi_register_typeenum stm32_fmc2_ebi_transaction_typeenum stm32_fmc2_ebi_buswidthenum stm32_fmc2_ebi_cpsizeenum stm32_fmc2_ebi_cscountfunction stm32_fmc2_ebi_check_muxfunction stm32_fmc2_ebi_check_waitcfgfunction stm32_fmc2_ebi_check_sync_transfunction stm32_fmc2_ebi_mp25_check_cclkfunction stm32_fmc2_ebi_mp25_check_clk_periodfunction stm32_fmc2_ebi_check_async_transfunction stm32_fmc2_ebi_check_cpsizefunction stm32_fmc2_ebi_check_address_holdfunction stm32_fmc2_ebi_check_clk_periodfunction stm32_fmc2_ebi_check_cclkfunction stm32_fmc2_ebi_ns_to_clock_cyclesfunction stm32_fmc2_ebi_ns_to_clk_periodfunction stm32_fmc2_ebi_mp25_ns_to_clk_periodfunction stm32_fmc2_ebi_get_regfunction stm32_fmc2_ebi_set_bit_fieldfunction stm32_fmc2_ebi_set_trans_typefunction stm32_fmc2_ebi_set_buswidthfunction stm32_fmc2_ebi_set_cpsizefunction stm32_fmc2_ebi_set_bl_setupfunction stm32_fmc2_ebi_set_address_setupfunction stm32_fmc2_ebi_set_address_holdfunction stm32_fmc2_ebi_set_data_setupfunction stm32_fmc2_ebi_set_bus_turnaroundfunction stm32_fmc2_ebi_set_data_holdfunction stm32_fmc2_ebi_set_clk_periodfunction stm32_fmc2_ebi_mp25_set_clk_periodfunction stm32_fmc2_ebi_set_data_latencyfunction stm32_fmc2_ebi_set_max_low_pulsefunction stm32_fmc2_ebi_mp25_set_max_low_pulsefunction stm32_fmc2_ebi_mp25_check_riffunction stm32_fmc2_ebi_mp25_put_semsfunction stm32_fmc2_ebi_mp25_get_semsfunction stm32_fmc2_ebi_parse_propfunction stm32_fmc2_ebi_enable_bankfunction stm32_fmc2_ebi_disable_bankfunction stm32_fmc2_ebi_save_setupfunction stm32_fmc2_ebi_mp1_save_setupfunction stm32_fmc2_ebi_mp25_save_setup
Annotated Snippet
struct stm32_fmc2_ebi_data {
const struct stm32_fmc2_prop *child_props;
unsigned int nb_child_props;
u32 fmc2_enable_reg;
u32 fmc2_enable_bit;
int (*nwait_used_by_ctrls)(struct stm32_fmc2_ebi *ebi);
void (*set_setup)(struct stm32_fmc2_ebi *ebi);
int (*save_setup)(struct stm32_fmc2_ebi *ebi);
int (*check_rif)(struct stm32_fmc2_ebi *ebi, u32 resource);
void (*put_sems)(struct stm32_fmc2_ebi *ebi);
void (*get_sems)(struct stm32_fmc2_ebi *ebi);
};
struct stm32_fmc2_ebi {
struct device *dev;
struct clk *clk;
struct regmap *regmap;
const struct stm32_fmc2_ebi_data *data;
u8 bank_assigned;
u8 sem_taken;
bool access_granted;
u32 bcr[FMC2_MAX_EBI_CE];
u32 btr[FMC2_MAX_EBI_CE];
u32 bwtr[FMC2_MAX_EBI_CE];
u32 pcscntr;
u32 cfgr;
};
/*
* struct stm32_fmc2_prop - STM32 FMC2 EBI property
* @name: the device tree binding name of the property
* @bprop: indicate that it is a boolean property
* @mprop: indicate that it is a mandatory property
* @reg_type: the register that have to be modified
* @reg_mask: the bit that have to be modified in the selected register
* in case of it is a boolean property
* @reset_val: the default value that have to be set in case the property
* has not been defined in the device tree
* @check: this callback ckecks that the property is compliant with the
* transaction type selected
* @calculate: this callback is called to calculate for exemple a timing
* set in nanoseconds in the device tree in clock cycles or in
* clock period
* @set: this callback applies the values in the registers
*/
struct stm32_fmc2_prop {
const char *name;
bool bprop;
bool mprop;
int reg_type;
u32 reg_mask;
u32 reset_val;
int (*check)(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop, int cs);
u32 (*calculate)(struct stm32_fmc2_ebi *ebi, int cs, u32 setup);
int (*set)(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop,
int cs, u32 setup);
};
static int stm32_fmc2_ebi_check_mux(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop,
int cs)
{
u32 bcr;
int ret;
ret = regmap_read(ebi->regmap, FMC2_BCR(cs), &bcr);
if (ret)
return ret;
if (bcr & FMC2_BCR_MTYP)
return 0;
return -EINVAL;
}
static int stm32_fmc2_ebi_check_waitcfg(struct stm32_fmc2_ebi *ebi,
const struct stm32_fmc2_prop *prop,
int cs)
{
u32 bcr, val = FIELD_PREP(FMC2_BCR_MTYP, FMC2_BCR_MTYP_NOR);
int ret;
ret = regmap_read(ebi->regmap, FMC2_BCR(cs), &bcr);
if (ret)
return ret;
if ((bcr & FMC2_BCR_MTYP) == val && bcr & FMC2_BCR_BURSTEN)
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/clk.h`, `linux/mfd/syscon.h`, `linux/module.h`, `linux/of.h`, `linux/of_platform.h`, `linux/pinctrl/consumer.h`, `linux/platform_device.h`.
- Detected declarations: `struct stm32_fmc2_ebi`, `struct stm32_fmc2_ebi_data`, `struct stm32_fmc2_ebi`, `struct stm32_fmc2_prop`, `enum stm32_fmc2_ebi_bank`, `enum stm32_fmc2_ebi_register_type`, `enum stm32_fmc2_ebi_transaction_type`, `enum stm32_fmc2_ebi_buswidth`, `enum stm32_fmc2_ebi_cpsize`, `enum stm32_fmc2_ebi_cscount`.
- Atlas domain: Driver Families / drivers/memory.
- Implementation status: source 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.