/*
 * imx6q pinctrl driver based on imx pinmux core
 *
 * Copyright (C) 2012 Freescale Semiconductor, Inc.
 * Copyright (C) 2012 Linaro, Inc.
 *
 * Author: Dong Aisheng <dong.aisheng@linaro.org>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */

#include <linux/err.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/pinctrl/pinctrl.h>

#include "pinctrl-imx.h"

enum imx6q_pads {
	MX6Q_PAD_RESERVE0 = 0,
	MX6Q_PAD_RESERVE1 = 1,
	MX6Q_PAD_RESERVE2 = 2,
	MX6Q_PAD_RESERVE3 = 3,
	MX6Q_PAD_RESERVE4 = 4,
	MX6Q_PAD_RESERVE5 = 5,
	MX6Q_PAD_RESERVE6 = 6,
	MX6Q_PAD_RESERVE7 = 7,
	MX6Q_PAD_RESERVE8 = 8,
	MX6Q_PAD_RESERVE9 = 9,
	MX6Q_PAD_RESERVE10 = 10,
	MX6Q_PAD_RESERVE11 = 11,
	MX6Q_PAD_RESERVE12 = 12,
	MX6Q_PAD_RESERVE13 = 13,
	MX6Q_PAD_RESERVE14 = 14,
	MX6Q_PAD_RESERVE15 = 15,
	MX6Q_PAD_RESERVE16 = 16,
	MX6Q_PAD_RESERVE17 = 17,
	MX6Q_PAD_RESERVE18 = 18,
	MX6Q_PAD_SD2_DAT1 = 19,
	MX6Q_PAD_SD2_DAT2 = 20,
	MX6Q_PAD_SD2_DAT0 = 21,
	MX6Q_PAD_RGMII_TXC = 22,
	MX6Q_PAD_RGMII_TD0 = 23,
	MX6Q_PAD_RGMII_TD1 = 24,
	MX6Q_PAD_RGMII_TD2 = 25,
	MX6Q_PAD_RGMII_TD3 = 26,
	MX6Q_PAD_RGMII_RX_CTL = 27,
	MX6Q_PAD_RGMII_RD0 = 28,
	MX6Q_PAD_RGMII_TX_CTL = 29,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NANDF_D6 = 197,
	MX6Q_PAD_NANDF_D7 = 198,
	MX6Q_PAD_SD4_DAT0 = 199,
	MX6Q_PAD_SD4_DAT1 = 200,
	MX6Q_PAD_SD4_DAT2 = 201,
	MX6Q_PAD_SD4_DAT3 = 202,
	MX6Q_PAD_SD4_DAT4 = 203,
	MX6Q_PAD_SD4_DAT5 = 204,
	MX6Q_PAD_SD4_DAT6 = 205,
	MX6Q_PAD_SD4_DAT7 = 206,
	MX6Q_PAD_SD1_DAT1 = 207,
	MX6Q_PAD_SD1_DAT0 = 208,
	MX6Q_PAD_SD1_DAT3 = 209,
	MX6Q_PAD_SD1_CMD = 210,
	MX6Q_PAD_SD1_DAT2 = 211,
	MX6Q_PAD_SD1_CLK = 212,
	MX6Q_PAD_SD2_CLK = 213,
	MX6Q_PAD_SD2_CMD = 214,
	MX6Q_PAD_SD2_DAT3 = 215,
};

/* Pad names for the pinmux subsystem */
static const struct pinctrl_pin_desc imx6q_pinctrl_pads[] = {
	IMX_PINCTRL_PIN(MX6Q_PAD_RESERVE0),
	IMX_PINCTRL_PIN(MX6Q_PAD_RESERVE1),
	IMX_PINCTRL_PIN(MX6Q_PAD_RESERVE2),
	IMX_PINCTRL_PIN(MX6Q_PAD_RESERVE3),
	IMX_PINCTRL_PIN(MX6Q_PAD_RESERVE4),
	IMX_PINCTRL_PIN(MX6Q_PAD_RESERVE5),
	IMX_PINCTRL_PIN(MX6Q_PAD_RESERVE6),
	IMX_PINCTRL_PIN(MX6Q_PAD_RESERVE7),
	IMX_PINCTRL_PIN(MX6Q_PAD_RESERVE8),
	IMX_PINCTRL_PIN(MX6Q_PAD_RESERVE9),
	IMX_PINCTRL_PIN(MX6Q_PAD_RESERVE10),
	IMX_PINCTRL_PIN(MX6Q_PAD_RESERVE11),
	IMX_PINCTRL_PIN(MX6Q_PAD_RESERVE12),
	IMX_PINCTRL_PIN(MX6Q_PAD_RESERVE13),
	IMX_PINCTRL_PIN(MX6Q_PAD_RESERVE14),
	IMX_PIN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_soc_info imx6q_pinctrl_info = {
	.pins = imx6q_pinctrl_pads,
	.npins = ARRAY_SIZE(imx6q_pinctrl_pads),
};

static struct of_device_id imx6q_pinctrl_of_match[] = {
	{ .compatible = "fsl,imx6q-iomuxc", },
	{ /* sentinel */ }
};

static int imx6q_pinctrl_probe(struct platform_device *pdev)
{
	return imx_pinctrl_probe(pdev, &imx6q_pinctrl_info);
}

static struct platform_driver imx6q_pinctrl_driver = {
	.driver = {
		.name = "imx6q-pinctrl",
		.owner = THIS_MODULE,
		.of_match_table = of_match_ptr(imx6q_pinctrl_of_match),
	},
	.probe = imx6q_pinctrl_probe,
	.remove = imx_pinctrl_remove,
};

static int __init imx6q_pinctrl_init(void)
{
	return platform_driver_register(&imx6q_pinctrl_driver);
}
arch_initcall(imx6q_pinctrl_init);

static void __exit imx6q_pinctrl_exit(void)
{
	platform_driver_unregister(&imx6q_pinctrl_driver);
}
module_exit(imx6q_pinctrl_exit);
MODULE_AUTHOR("Dong Aisheng <dong.aisheng@linaro.org>");
MODULE_DESCRIPTION("Freescale IMX6Q pinctrl driver");
MODULE_LICENSE("GPL v2");