drivers/bus/qcom-ssc-block-bus.c
Source file repositories/reference/linux-study-clean/drivers/bus/qcom-ssc-block-bus.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/bus/qcom-ssc-block-bus.c- Extension
.c- Size
- 10642 bytes
- Lines
- 391
- Domain
- Driver Families
- Bucket
- drivers/bus
- 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/clk.hlinux/delay.hlinux/io.hlinux/mfd/syscon.hlinux/module.hlinux/of_platform.hlinux/platform_device.hlinux/pm_clock.hlinux/pm_domain.hlinux/pm_runtime.hlinux/regmap.hlinux/reset.h
Detected Declarations
struct qcom_ssc_block_bus_datafunction reg32_set_bitsfunction reg32_clear_bitsfunction qcom_ssc_block_bus_initfunction qcom_ssc_block_bus_deinitfunction qcom_ssc_block_bus_pds_attachfunction qcom_ssc_block_bus_pds_detachfunction qcom_ssc_block_bus_pds_enablefunction qcom_ssc_block_bus_pds_disablefunction qcom_ssc_block_bus_probefunction qcom_ssc_block_bus_remove
Annotated Snippet
struct qcom_ssc_block_bus_data {
const char *const *pd_names;
struct device *pds[ARRAY_SIZE(qcom_ssc_block_pd_names)];
char __iomem *reg_mpm_sscaon_config0;
char __iomem *reg_mpm_sscaon_config1;
struct regmap *halt_map;
struct clk *xo_clk;
struct clk *aggre2_clk;
struct clk *gcc_im_sleep_clk;
struct clk *aggre2_north_clk;
struct clk *ssc_xo_clk;
struct clk *ssc_ahbs_clk;
struct reset_control *ssc_bcr;
struct reset_control *ssc_reset;
u32 ssc_axi_halt;
int num_pds;
};
static void reg32_set_bits(char __iomem *reg, u32 value)
{
u32 tmp = ioread32(reg);
iowrite32(tmp | value, reg);
}
static void reg32_clear_bits(char __iomem *reg, u32 value)
{
u32 tmp = ioread32(reg);
iowrite32(tmp & (~value), reg);
}
static int qcom_ssc_block_bus_init(struct device *dev)
{
int ret;
struct qcom_ssc_block_bus_data *data = dev_get_drvdata(dev);
ret = clk_prepare_enable(data->xo_clk);
if (ret) {
dev_err(dev, "error enabling xo_clk: %d\n", ret);
goto err_xo_clk;
}
ret = clk_prepare_enable(data->aggre2_clk);
if (ret) {
dev_err(dev, "error enabling aggre2_clk: %d\n", ret);
goto err_aggre2_clk;
}
ret = clk_prepare_enable(data->gcc_im_sleep_clk);
if (ret) {
dev_err(dev, "error enabling gcc_im_sleep_clk: %d\n", ret);
goto err_gcc_im_sleep_clk;
}
/*
* We need to intervene here because the HW logic driving these signals cannot handle
* initialization after power collapse by itself.
*/
reg32_clear_bits(data->reg_mpm_sscaon_config0,
SSCAON_CONFIG0_CLAMP_EN_OVRD | SSCAON_CONFIG0_CLAMP_EN_OVRD_VAL);
/* override few_ack/rest_ack */
reg32_clear_bits(data->reg_mpm_sscaon_config1, BIT(31));
ret = clk_prepare_enable(data->aggre2_north_clk);
if (ret) {
dev_err(dev, "error enabling aggre2_north_clk: %d\n", ret);
goto err_aggre2_north_clk;
}
ret = reset_control_deassert(data->ssc_reset);
if (ret) {
dev_err(dev, "error deasserting ssc_reset: %d\n", ret);
goto err_ssc_reset;
}
ret = reset_control_deassert(data->ssc_bcr);
if (ret) {
dev_err(dev, "error deasserting ssc_bcr: %d\n", ret);
goto err_ssc_bcr;
}
regmap_write(data->halt_map, data->ssc_axi_halt + AXI_HALTREQ_REG, 0);
ret = clk_prepare_enable(data->ssc_xo_clk);
if (ret) {
dev_err(dev, "error deasserting ssc_xo_clk: %d\n", ret);
goto err_ssc_xo_clk;
}
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/io.h`, `linux/mfd/syscon.h`, `linux/module.h`, `linux/of_platform.h`, `linux/platform_device.h`, `linux/pm_clock.h`.
- Detected declarations: `struct qcom_ssc_block_bus_data`, `function reg32_set_bits`, `function reg32_clear_bits`, `function qcom_ssc_block_bus_init`, `function qcom_ssc_block_bus_deinit`, `function qcom_ssc_block_bus_pds_attach`, `function qcom_ssc_block_bus_pds_detach`, `function qcom_ssc_block_bus_pds_enable`, `function qcom_ssc_block_bus_pds_disable`, `function qcom_ssc_block_bus_probe`.
- Atlas domain: Driver Families / drivers/bus.
- 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.