Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5ae07daa authored by Sascha Hauer's avatar Sascha Hauer
Browse files

mx1ads: setup iomux pins at once

parent 5b68421f
Loading
Loading
Loading
Loading
+18 −55
Original line number Diff line number Diff line
@@ -32,57 +32,36 @@

#include "devices.h"

/*
 * UARTs platform data
 */
static int mxc_uart1_pins[] = {
static int mx1ads_pins[] = {
	/* UART1 */
	PC9_PF_UART1_CTS,
	PC10_PF_UART1_RTS,
	PC11_PF_UART1_TXD,
	PC12_PF_UART1_RXD,
};

static int uart1_mxc_init(struct platform_device *pdev)
{
	return mxc_gpio_setup_multiple_pins(mxc_uart1_pins,
			ARRAY_SIZE(mxc_uart1_pins), "UART1");
}

static int uart1_mxc_exit(struct platform_device *pdev)
{
	mxc_gpio_release_multiple_pins(mxc_uart1_pins,
			ARRAY_SIZE(mxc_uart1_pins));
	return 0;
}

static int mxc_uart2_pins[] = {
	/* UART2 */
	PB28_PF_UART2_CTS,
	PB29_PF_UART2_RTS,
	PB30_PF_UART2_TXD,
	PB31_PF_UART2_RXD,
	/* I2C */
	PA15_PF_I2C_SDA,
	PA16_PF_I2C_SCL,
	/* SPI */
	PC13_PF_SPI1_SPI_RDY,
	PC14_PF_SPI1_SCLK,
	PC15_PF_SPI1_SS,
	PC16_PF_SPI1_MISO,
	PC17_PF_SPI1_MOSI,
};

static int uart2_mxc_init(struct platform_device *pdev)
{
	return mxc_gpio_setup_multiple_pins(mxc_uart2_pins,
			ARRAY_SIZE(mxc_uart2_pins), "UART2");
}

static int uart2_mxc_exit(struct platform_device *pdev)
{
	mxc_gpio_release_multiple_pins(mxc_uart2_pins,
			ARRAY_SIZE(mxc_uart2_pins));
	return 0;
}
/*
 * UARTs platform data
 */

static struct imxuart_platform_data uart_pdata[] = {
	{
		.init = uart1_mxc_init,
		.exit = uart1_mxc_exit,
		.flags = IMXUART_HAVE_RTSCTS,
	}, {
		.init = uart2_mxc_init,
		.exit = uart2_mxc_exit,
		.flags = IMXUART_HAVE_RTSCTS,
	},
};
@@ -111,23 +90,6 @@ static struct platform_device flash_device = {
/*
 * I2C
 */
static int i2c_pins[] = {
	PA15_PF_I2C_SDA,
	PA16_PF_I2C_SCL,
};

static int i2c_init(struct device *dev)
{
	return mxc_gpio_setup_multiple_pins(i2c_pins,
			ARRAY_SIZE(i2c_pins), "I2C");
}

static void i2c_exit(struct device *dev)
{
	mxc_gpio_release_multiple_pins(i2c_pins,
			ARRAY_SIZE(i2c_pins));
}

static struct pcf857x_platform_data pcf857x_data[] = {
	{
		.gpio_base = 4 * 32,
@@ -138,8 +100,6 @@ static struct pcf857x_platform_data pcf857x_data[] = {

static struct imxi2c_platform_data mx1ads_i2c_data = {
	.bitrate = 100000,
	.init = i2c_init,
	.exit = i2c_exit,
};

static struct i2c_board_info mx1ads_i2c_devices[] = {
@@ -159,6 +119,9 @@ static struct i2c_board_info mx1ads_i2c_devices[] = {
 */
static void __init mx1ads_init(void)
{
	mxc_gpio_setup_multiple_pins(mx1ads_pins,
		ARRAY_SIZE(mx1ads_pins), "mx1ads");

	/* UART */
	mxc_register_device(&imx_uart1_device, &uart_pdata[0]);
	mxc_register_device(&imx_uart2_device, &uart_pdata[1]);