drivers/mfd/vexpress-sysreg.c

Source file repositories/reference/linux-study-clean/drivers/mfd/vexpress-sysreg.c

File Facts

System
Linux kernel
Corpus path
drivers/mfd/vexpress-sysreg.c
Extension
.c
Size
4208 bytes
Lines
161
Domain
Driver Families
Bucket
drivers/mfd
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.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0-only
/*
 *
 * Copyright (C) 2012 ARM Limited
 */

#include <linux/gpio/driver.h>
#include <linux/gpio/generic.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/mfd/core.h>
#include <linux/module.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/slab.h>
#include <linux/stat.h>

#define SYS_ID			0x000
#define SYS_SW			0x004
#define SYS_LED			0x008
#define SYS_100HZ		0x024
#define SYS_FLAGSSET		0x030
#define SYS_FLAGSCLR		0x034
#define SYS_NVFLAGS		0x038
#define SYS_NVFLAGSSET		0x038
#define SYS_NVFLAGSCLR		0x03c
#define SYS_MCI			0x048
#define SYS_FLASH		0x04c
#define SYS_CFGSW		0x058
#define SYS_24MHZ		0x05c
#define SYS_MISC		0x060
#define SYS_DMA			0x064
#define SYS_PROCID0		0x084
#define SYS_PROCID1		0x088
#define SYS_CFGDATA		0x0a0
#define SYS_CFGCTRL		0x0a4
#define SYS_CFGSTAT		0x0a8

/* The sysreg block is just a random collection of various functions... */

static const struct property_entry vexpress_sysreg_sys_led_props[] = {
	PROPERTY_ENTRY_STRING("label", "sys_led"),
	PROPERTY_ENTRY_U32("ngpios", 8),
	{ }
};

static const struct software_node vexpress_sysreg_sys_led_swnode = {
	.properties = vexpress_sysreg_sys_led_props,
};

static const struct property_entry vexpress_sysreg_sys_mci_props[] = {
	PROPERTY_ENTRY_STRING("label", "sys_mci"),
	PROPERTY_ENTRY_U32("ngpios", 2),
	{ }
};

static const struct software_node vexpress_sysreg_sys_mci_swnode = {
	.properties = vexpress_sysreg_sys_mci_props,
};

static const struct property_entry vexpress_sysreg_sys_flash_props[] = {
	PROPERTY_ENTRY_STRING("label", "sys_flash"),
	PROPERTY_ENTRY_U32("ngpios", 1),
	{ }
};

static const struct software_node vexpress_sysreg_sys_flash_swnode = {
	.properties = vexpress_sysreg_sys_flash_props,
};

static struct mfd_cell vexpress_sysreg_cells[] = {
	{
		.name = "basic-mmio-gpio",
		.of_compatible = "arm,vexpress-sysreg,sys_led",
		.num_resources = 1,
		.resources = &DEFINE_RES_MEM_NAMED(SYS_LED, 0x4, "dat"),
		.swnode = &vexpress_sysreg_sys_led_swnode,
	}, {
		.name = "basic-mmio-gpio",
		.of_compatible = "arm,vexpress-sysreg,sys_mci",
		.num_resources = 1,
		.resources = &DEFINE_RES_MEM_NAMED(SYS_MCI, 0x4, "dat"),
		.swnode = &vexpress_sysreg_sys_mci_swnode,
	}, {
		.name = "basic-mmio-gpio",
		.of_compatible = "arm,vexpress-sysreg,sys_flash",
		.num_resources = 1,
		.resources = &DEFINE_RES_MEM_NAMED(SYS_FLASH, 0x4, "dat"),
		.swnode = &vexpress_sysreg_sys_flash_swnode,

Annotation

Implementation Notes