arch/mips/bcm63xx/dev-pcmcia.c

Source file repositories/reference/linux-study-clean/arch/mips/bcm63xx/dev-pcmcia.c

File Facts

System
Linux kernel
Corpus path
arch/mips/bcm63xx/dev-pcmcia.c
Extension
.c
Size
3041 bytes
Lines
145
Domain
Architecture Layer
Bucket
arch/mips
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.

Dependency Surface

Detected Declarations

Annotated Snippet

#include <linux/init.h>
#include <linux/kernel.h>
#include <asm/bootinfo.h>
#include <linux/platform_device.h>
#include <bcm63xx_cs.h>
#include <bcm63xx_cpu.h>
#include <bcm63xx_dev_pcmcia.h>
#include <bcm63xx_io.h>
#include <bcm63xx_regs.h>

static struct resource pcmcia_resources[] = {
	/* pcmcia registers */
	{
		/* start & end filled at runtime */
		.flags		= IORESOURCE_MEM,
	},

	/* pcmcia memory zone resources */
	{
		.start		= BCM_PCMCIA_COMMON_BASE_PA,
		.end		= BCM_PCMCIA_COMMON_END_PA,
		.flags		= IORESOURCE_MEM,
	},
	{
		.start		= BCM_PCMCIA_ATTR_BASE_PA,
		.end		= BCM_PCMCIA_ATTR_END_PA,
		.flags		= IORESOURCE_MEM,
	},
	{
		.start		= BCM_PCMCIA_IO_BASE_PA,
		.end		= BCM_PCMCIA_IO_END_PA,
		.flags		= IORESOURCE_MEM,
	},

	/* PCMCIA irq */
	{
		/* start filled at runtime */
		.flags		= IORESOURCE_IRQ,
	},

	/* declare PCMCIA IO resource also */
	{
		.start		= BCM_PCMCIA_IO_BASE_PA,
		.end		= BCM_PCMCIA_IO_END_PA,
		.flags		= IORESOURCE_IO,
	},
};

static struct bcm63xx_pcmcia_platform_data pd;

static struct platform_device bcm63xx_pcmcia_device = {
	.name		= "bcm63xx_pcmcia",
	.id		= 0,
	.num_resources	= ARRAY_SIZE(pcmcia_resources),
	.resource	= pcmcia_resources,
	.dev		= {
		.platform_data = &pd,
	},
};

static int __init config_pcmcia_cs(unsigned int cs,
				   u32 base, unsigned int size)
{
	int ret;

	ret = bcm63xx_set_cs_status(cs, 0);
	if (!ret)
		ret = bcm63xx_set_cs_base(cs, base, size);
	if (!ret)
		ret = bcm63xx_set_cs_status(cs, 1);
	return ret;
}

static const struct {
	unsigned int	cs;
	unsigned int	base;
	unsigned int	size;
} pcmcia_cs[3] __initconst = {
	{
		.cs	= MPI_CS_PCMCIA_COMMON,
		.base	= BCM_PCMCIA_COMMON_BASE_PA,
		.size	= BCM_PCMCIA_COMMON_SIZE
	},
	{
		.cs	= MPI_CS_PCMCIA_ATTR,
		.base	= BCM_PCMCIA_ATTR_BASE_PA,
		.size	= BCM_PCMCIA_ATTR_SIZE
	},
	{
		.cs	= MPI_CS_PCMCIA_IO,

Annotation

Implementation Notes