arch/sh/boards/mach-highlander/setup.c

Source file repositories/reference/linux-study-clean/arch/sh/boards/mach-highlander/setup.c

File Facts

System
Linux kernel
Corpus path
arch/sh/boards/mach-highlander/setup.c
Extension
.c
Size
9151 bytes
Lines
417
Domain
Architecture Layer
Bucket
arch/sh
Inferred role
Architecture Layer: exported/initcall integration point
Status
integration 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

device_initcall(r7780rp_devices_setup);

/*
 * Platform specific clocks
 */
static int ivdr_clk_enable(struct clk *clk)
{
	__raw_writew(__raw_readw(PA_IVDRCTL) | (1 << IVDR_CK_ON), PA_IVDRCTL);
	return 0;
}

static void ivdr_clk_disable(struct clk *clk)
{
	__raw_writew(__raw_readw(PA_IVDRCTL) & ~(1 << IVDR_CK_ON), PA_IVDRCTL);
}

static struct sh_clk_ops ivdr_clk_ops = {
	.enable		= ivdr_clk_enable,
	.disable	= ivdr_clk_disable,
};

static struct clk ivdr_clk = {
	.ops		= &ivdr_clk_ops,
};

static struct clk *r7780rp_clocks[] = {
	&ivdr_clk,
};

static struct clk_lookup lookups[] = {
	/* main clocks */
	CLKDEV_CON_ID("ivdr_clk", &ivdr_clk),
};

static void r7780rp_power_off(void)
{
	if (mach_is_r7780mp() || mach_is_r7785rp())
		__raw_writew(0x0001, PA_POFF);
}

/*
 * Initialize the board
 */
static void __init highlander_setup(char **cmdline_p)
{
	u16 ver = __raw_readw(PA_VERREG);
	int i;

	printk(KERN_INFO "Renesas Solutions Highlander %s support.\n",
			 mach_is_r7780rp() ? "R7780RP-1" :
			 mach_is_r7780mp() ? "R7780MP"	 :
					     "R7785RP");

	printk(KERN_INFO "Board version: %d (revision %d), "
			 "FPGA version: %d (revision %d)\n",
			 (ver >> 12) & 0xf, (ver >> 8) & 0xf,
			 (ver >>  4) & 0xf, ver & 0xf);

	highlander_plat_pinmux_setup();

	/*
	 * Enable the important clocks right away..
	 */
	for (i = 0; i < ARRAY_SIZE(r7780rp_clocks); i++) {
		struct clk *clk = r7780rp_clocks[i];

		clk_register(clk);
		clk_enable(clk);
	}

	clkdev_add_table(lookups, ARRAY_SIZE(lookups));

	__raw_writew(0x0000, PA_OBLED);	/* Clear LED. */

	if (mach_is_r7780rp())
		__raw_writew(0x0001, PA_SDPOW);	/* SD Power ON */

	__raw_writew(__raw_readw(PA_IVDRCTL) | 0x01, PA_IVDRCTL);	/* Si13112 */

	pm_power_off = r7780rp_power_off;
}

static unsigned char irl2irq[HL_NR_IRL];

static int highlander_irq_demux(int irq)
{
	if (irq >= HL_NR_IRL + 16 || irq < 16 || !irl2irq[irq - 16])
		return irq;

	return irl2irq[irq - 16];

Annotation

Implementation Notes