コード例 #1
0
void __init mx28_cpx2_pins_init(void)
{

	mx28_cpx2_init_pin_group(mx28_cpx2_fixed_pins,
						ARRAY_SIZE(mx28_cpx2_fixed_pins));

	if (enable_ssp1) {
		pr_info("Initializing SSP1 pins\n");
		mx28_cpx2_init_pin_group(mx28_cpx2_ssp1_pins,
						ARRAY_SIZE(mx28_cpx2_ssp1_pins));
	} else if (enable_gpmi) {
		pr_info("Initializing GPMI pins\n");
		mx28_cpx2_init_pin_group(mx28_cpx2_gpmi_pins,
						ARRAY_SIZE(mx28_cpx2_gpmi_pins));
	}

#if (defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)) \
	&& (defined (CONFIG_LEDS_GPIO_PLATFORM) || defined (CONFIG_LEDS_GPIO_PLATFORM_MODULE) )
	/*
	 * The CPX2 platform uses GPIO 122 & 123 (aka 3_26 & 3_27) as network green &
	 * yellow LEDs. These need at least 8mA drive strength. With this config
	 * option, these pins are registered in mx28_cpx2.c with the leds-gpio
	 * driver; however, neither the leds-gpio nor gpio drivers support setting the
	 * drive strength of the GPIO pins; this is only supported in the MXS pinctrl
	 * code, but if we try to initialize them here with init_pin_group(), this
	 * routine calls gpio_request() to claim the pins, which then causes the
	 * leds-gpio driver to fail with EBUSY when it tries to register them also.
	 *
	 * Therefore, we manually set the drive strength of these pins here, and
	 * let the leds-gpio driver call gpio_request(). Note that we must supply
	 * sysfs = 1 to prevent testing the gpio_request() lock.
	 */

	mxs_set_strength(PINID_SAIF1_SDATA0, PAD_8MA, 1, NULL);	// GPIO 122 / 3_26
	mxs_set_strength(PINID_SPDIF,        PAD_8MA, 1, NULL);	// GPIO 123 / 3_27
#endif

#if defined(CONFIG_SPI_MXS) || defined(CONFIG_SPI_MXS_MODULE)
	mx28_cpx2_init_pin_group(mx28_cpx2_spi_pins,
					ARRAY_SIZE(mx28_cpx2_spi_pins));
#endif

#if defined(CONFIG_FEC) || defined(CONFIG_FEC_MODULE)\
	|| defined(CONFIG_FEC_L2SWITCH)
		mx28_cpx2_init_pin_group(mx28_cpx2_eth_pins,
						ARRAY_SIZE(mx28_cpx2_eth_pins));

	// Take the PHY out of reset
	gpio_request(MXS_PIN_TO_GPIO(PINID_PWM4) , "ENET0_RST#");
	gpio_direction_output( MXS_PIN_TO_GPIO(PINID_PWM4) , 1 );
#endif
}
コード例 #2
0
ファイル: mx23evk_pins.c プロジェクト: vasubabu/kernel
static void mxs_request_pins(struct pin_desc *pins, int nr)
{
	int i;
	struct pin_desc *pin;

	/* configure the pins */
	for (i = 0; i < nr; i++) {
		pin = &pins[i];
		if (pin->fun == PIN_GPIO)
			gpio_request(MXS_PIN_TO_GPIO(pin->id), pin->name);
		else
			mxs_request_pin(pin->id, pin->fun, pin->name);
		if (pin->drive) {
			mxs_set_strength(pin->id, pin->strength, pin->name);
			mxs_set_voltage(pin->id, pin->voltage, pin->name);
		}
		if (pin->pull)
			mxs_set_pullup(pin->id, pin->pullup, pin->name);
		if (pin->fun == PIN_GPIO) {
			if (pin->output)
				gpio_direction_output(MXS_PIN_TO_GPIO(pin->id),
						      pin->data);
			else
				gpio_direction_input(MXS_PIN_TO_GPIO(pin->id));
		}
	}
}
コード例 #3
0
void __init mx28evk_init_pin_group(struct pin_desc *pins, unsigned count)
{
	int i;
	struct pin_desc *pin;
	for (i = 0; i < count; i++) {
		pin = pins + i;
		if (pin->fun == PIN_GPIO)
			gpio_request(MXS_PIN_TO_GPIO(pin->id), pin->name);
		else
			mxs_request_pin(pin->id, pin->fun, pin->name);
		if (pin->drive) {
			mxs_set_strength(pin->id, pin->strength, pin->name);
			mxs_set_voltage(pin->id, pin->voltage, pin->name);
		}
		if (pin->pull)
			mxs_set_pullup(pin->id, pin->pullup, pin->name);
		if (pin->fun == PIN_GPIO) {
			if (pin->output)
				gpio_direction_output(MXS_PIN_TO_GPIO(pin->id),
							pin->data);
			else
				gpio_direction_input(MXS_PIN_TO_GPIO(pin->id));
		}
	}
}