int mx28evk_enet_gpio_init(void)
{
	/* pwr */
	//gpio_request(MXS_PIN_TO_GPIO(PINID_SSP1_DATA3), "ENET_PWR");
	//gpio_direction_output(MXS_PIN_TO_GPIO(PINID_SSP1_DATA3), 0);

	 for (i = 0; i < ARRAY_SIZE(mx28evk_eth_mode_pins); i++) {
		mxs_release_pin(mx28evk_eth_mode_pins[i].id,
			mx28evk_eth_mode_pins[i].name);
   }

	mx28evk_init_pin_group(mx28evk_eth_mode_pins,
						ARRAY_SIZE(mx28evk_eth_mode_pins));
	/* reset phy */
	gpio_request(MXS_PIN_TO_GPIO(PINID_SSP0_DETECT), "PHY_RESET");
	gpio_direction_output(MXS_PIN_TO_GPIO(PINID_SSP0_DETECT), 0);

	mdelay(1);
	gpio_direction_output(MXS_PIN_TO_GPIO(PINID_SSP0_DETECT), 1);
	/* Most a reset should last from switch chip is 14ms */
	mdelay(20);

	for (i = 0; i < ARRAY_SIZE(mx28evk_eth_mode_pins); i++) {
		mxs_release_pin(mx28evk_eth_mode_pins[i].id,
			mx28evk_eth_mode_pins[i].name);
   }

	mx28evk_init_pin_group(mx28evk_eth_pins,
						ARRAY_SIZE(mx28evk_eth_pins));

	return 0;
}
int mx28evk_enet_gpio_init(void)
{
   int i;

   printk("Configure external PHY pins...\n");

   for (i = 0; i < ARRAY_SIZE(mx28evk_eth_mode_pins); i++) {
		mxs_release_pin(mx28evk_eth_mode_pins[i].id,
			mx28evk_eth_mode_pins[i].name);
   }

	mx28evk_init_pin_group(mx28evk_eth_mode_pins,
						ARRAY_SIZE(mx28evk_eth_mode_pins));

	/* pwr */
	if (mxs_get_type(PINID_GPMI_RDY1) == PIN_GPIO) {
		gpio_request(MXS_PIN_TO_GPIO(PINID_GPMI_RDY1), "ENET_PWR");
		gpio_direction_output(MXS_PIN_TO_GPIO(PINID_GPMI_RDY1), 0);
	} else if (mxs_get_type(PINID_LCD_D10) == PIN_GPIO) {
		gpio_request(MXS_PIN_TO_GPIO(PINID_LCD_D10), "ENET_PWR");
		gpio_direction_output(MXS_PIN_TO_GPIO(PINID_LCD_D10), 0);
	} else {
		printk(KERN_ERR "Unable to determine correct EN_ENET_3.3V pin\n");
	}

	/* reset phy */
//	gpio_request(MXS_PIN_TO_GPIO(PINID_SSP0_DETECT), "PHY_RESET");
//	gpio_direction_output(MXS_PIN_TO_GPIO(PINID_SSP0_DETECT), 0);

//	mdelay(1);

   printk("Release external PHY reset...\n");
	gpio_direction_output(MXS_PIN_TO_GPIO(PINID_SSP0_DETECT), 1);
	mdelay(20);

	for (i = 0; i < ARRAY_SIZE(mx28evk_eth_mode_pins); i++) {
		mxs_release_pin(mx28evk_eth_mode_pins[i].id,
			mx28evk_eth_mode_pins[i].name);
   }

	mx28evk_init_pin_group(mx28evk_eth_pins,
						ARRAY_SIZE(mx28evk_eth_pins));

	return 0;
}
Beispiel #3
0
static void mxs_release_pins(struct pin_desc *pins, int nr)
{
	int i;
	struct pin_desc *pin;

	/* release the pins */
	for (i = 0; i < nr; i++) {
		pin = &pins[i];
		if (pin->fun == PIN_GPIO)
			gpio_free(MXS_PIN_TO_GPIO(pin->id));
		else
			mxs_release_pin(pin->id, pin->name);
	}
}
void mx28evk_enet_io_lowerpower_enter(void)
{
	int i;
	gpio_direction_output(MXS_PIN_TO_GPIO(PINID_SSP1_DATA3), 1);
	gpio_direction_output(MXS_PIN_TO_GPIO(PINID_ENET0_RX_CLK), 0);
	gpio_request(MXS_PIN_TO_GPIO(PINID_ENET0_TX_CLK), "ETH_INT");
	gpio_direction_output(MXS_PIN_TO_GPIO(PINID_ENET0_TX_CLK), 0);

	for (i = 0; i < ARRAY_SIZE(mx28evk_eth_pins); i++) {
		mxs_release_pin(mx28evk_eth_pins[i].id,
			mx28evk_eth_pins[i].name);
		gpio_request(MXS_PIN_TO_GPIO(mx28evk_eth_pins[i].id),
			mx28evk_eth_pins[i].name);
		gpio_direction_output(
			MXS_PIN_TO_GPIO(mx28evk_eth_pins[i].id), 0);
	}

}
void mx28evk_enet_io_lowerpower_enter(void)
{
	int i;
	if (mxs_get_type(PINID_GPMI_RDY1) == PIN_GPIO) {
		gpio_direction_output(MXS_PIN_TO_GPIO(PINID_GPMI_RDY1), 1);
	} else if (mxs_get_type(PINID_LCD_D10) == PIN_GPIO) {
		gpio_direction_output(MXS_PIN_TO_GPIO(PINID_LCD_D10), 1);
	} else {
		printk(KERN_ERR "Unable to determine correct EN_ENET_3.3V pin\n");
	}
	//gpio_direction_output(MXS_PIN_TO_GPIO(PINID_ENET0_RX_CLK), 0);
	//gpio_request(MXS_PIN_TO_GPIO(PINID_ENET0_TX_CLK), "ETH_INT");
	//gpio_direction_output(MXS_PIN_TO_GPIO(PINID_ENET0_TX_CLK), 0);

	for (i = 0; i < ARRAY_SIZE(mx28evk_eth_pins); i++) {
		mxs_release_pin(mx28evk_eth_pins[i].id,
			mx28evk_eth_pins[i].name);
		gpio_request(MXS_PIN_TO_GPIO(mx28evk_eth_pins[i].id),
			mx28evk_eth_pins[i].name);
		gpio_direction_output(
			MXS_PIN_TO_GPIO(mx28evk_eth_pins[i].id), 0);
	}

}
static void mxs_gpio_free(struct gpio_chip *chip, unsigned int pin)
{
	struct mxs_gpio_port *port;
	port = container_of(chip, struct mxs_gpio_port, port);
	return mxs_release_pin(MXS_PIN_ENCODE(port->id, pin), GPIO_ID_NAME);
}