arch/powerpc/sysdev/cpm_gpio.c
Source file repositories/reference/linux-study-clean/arch/powerpc/sysdev/cpm_gpio.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/sysdev/cpm_gpio.c- Extension
.c- Size
- 1661 bytes
- Lines
- 81
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/of.hlinux/platform_device.hasm/cpm.hasm/cpm1.h
Detected Declarations
function cpm_gpio_probefunction cpm_gpio_init
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Common CPM GPIO wrapper for the CPM GPIO ports
*
* Author: Christophe Leroy <christophe.leroy@c-s.fr>
*
* Copyright 2017 CS Systemes d'Information.
*
*/
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <asm/cpm.h>
#ifdef CONFIG_8xx_GPIO
#include <asm/cpm1.h>
#endif
static int cpm_gpio_probe(struct platform_device *ofdev)
{
struct device *dev = &ofdev->dev;
int (*gp_add)(struct device *dev) = of_device_get_match_data(dev);
if (!gp_add)
return -ENODEV;
return gp_add(dev);
}
static const struct of_device_id cpm_gpio_match[] = {
#ifdef CONFIG_8xx_GPIO
{
.compatible = "fsl,cpm1-pario-bank-a",
.data = cpm1_gpiochip_add16,
},
{
.compatible = "fsl,cpm1-pario-bank-b",
.data = cpm1_gpiochip_add32,
},
{
.compatible = "fsl,cpm1-pario-bank-c",
.data = cpm1_gpiochip_add16,
},
{
.compatible = "fsl,cpm1-pario-bank-d",
.data = cpm1_gpiochip_add16,
},
/* Port E uses CPM2 layout */
{
.compatible = "fsl,cpm1-pario-bank-e",
.data = cpm2_gpiochip_add32,
},
#endif
{
.compatible = "fsl,cpm2-pario-bank",
.data = cpm2_gpiochip_add32,
},
{},
};
MODULE_DEVICE_TABLE(of, cpm_gpio_match);
static struct platform_driver cpm_gpio_driver = {
.probe = cpm_gpio_probe,
.driver = {
.name = "cpm-gpio",
.of_match_table = cpm_gpio_match,
},
};
static int __init cpm_gpio_init(void)
{
return platform_driver_register(&cpm_gpio_driver);
}
arch_initcall(cpm_gpio_init);
MODULE_AUTHOR("Christophe Leroy <christophe.leroy@c-s.fr>");
MODULE_DESCRIPTION("Driver for CPM GPIO");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:cpm-gpio");
Annotation
- Immediate include surface: `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `asm/cpm.h`, `asm/cpm1.h`.
- Detected declarations: `function cpm_gpio_probe`, `function cpm_gpio_init`.
- Atlas domain: Architecture Layer / arch/powerpc.
- 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.