arch/arm/mach-orion5x/net2big-setup.c

Source file repositories/reference/linux-study-clean/arch/arm/mach-orion5x/net2big-setup.c

File Facts

System
Linux kernel
Corpus path
arch/arm/mach-orion5x/net2big-setup.c
Extension
.c
Size
12059 bytes
Lines
445
Domain
Architecture Layer
Bucket
arch/arm
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

gpio_get_value(NET2BIG_GPIO_SATA1_POWER)) {
		return;
	}

	/*
	 * SATA power up on both disk is done by pulling high the CPLD power
	 * request line. The 300ms delay is related to the CPLD clock and is
	 * needed to be sure that the CPLD has take into account the low line
	 * status.
	 */
	msleep(300);
	gpio_set_value(NET2BIG_GPIO_SATA_POWER_REQ, 1);
	pr_info("net2big: power up SATA hard disks\n");

	return;

err_free_2:
	gpio_free(NET2BIG_GPIO_SATA1_POWER);
err_free_1:
	gpio_free(NET2BIG_GPIO_SATA0_POWER);

	return;
}

/*****************************************************************************
 * GPIO LEDs
 ****************************************************************************/

/*
 * The power front LEDs (blue and red) and SATA red LEDs are controlled via a
 * single GPIO line and are compatible with the leds-gpio driver.
 *
 * The SATA blue LEDs have some hardware blink capabilities which are detailed
 * in the following array:
 *
 * SATAx blue LED | SATAx activity | LED state
 *                |                |
 *       0        |       0        |  blink (rate 300ms)
 *       1        |       0        |  off
 *       ?        |       1        |  on
 *
 * Notes: The blue and the red front LED's can't be on at the same time.
 *        Blue LED have priority.
 */

#define NET2BIG_GPIO_PWR_RED_LED	6
#define NET2BIG_GPIO_PWR_BLUE_LED	16
#define NET2BIG_GPIO_PWR_LED_BLINK_STOP	7

#define NET2BIG_GPIO_SATA0_RED_LED	11
#define NET2BIG_GPIO_SATA1_RED_LED	10

#define NET2BIG_GPIO_SATA0_BLUE_LED	17
#define NET2BIG_GPIO_SATA1_BLUE_LED	13

static struct gpio_led net2big_leds[] = {
	{
		.name = "net2big:red:power",
	},
	{
		.name = "net2big:blue:power",
	},
	{
		.name = "net2big:red:sata0",
	},
	{
		.name = "net2big:red:sata1",
	},
};

static struct gpiod_lookup_table net2big_leds_gpio_table = {
	.dev_id = "leds-gpio",
	.table = {
		GPIO_LOOKUP_IDX("orion_gpio0", NET2BIG_GPIO_PWR_RED_LED, NULL,
				0, GPIO_ACTIVE_HIGH),
		GPIO_LOOKUP_IDX("orion_gpio0", NET2BIG_GPIO_PWR_BLUE_LED, NULL,
				1, GPIO_ACTIVE_HIGH),
		GPIO_LOOKUP_IDX("orion_gpio0", NET2BIG_GPIO_SATA0_RED_LED, NULL,
				2, GPIO_ACTIVE_HIGH),
		GPIO_LOOKUP_IDX("orion_gpio0", NET2BIG_GPIO_SATA1_RED_LED, NULL,
				3, GPIO_ACTIVE_HIGH),
		{ },
	},
};

static struct gpio_led_platform_data net2big_led_data = {
	.num_leds = ARRAY_SIZE(net2big_leds),
	.leds = net2big_leds,
};

Annotation

Implementation Notes