0001
0002
0003
0004
0005
0006
0007 #include <linux/init.h>
0008 #include <linux/platform_device.h>
0009 #include <linux/of.h>
0010 #include <linux/of_device.h>
0011 #include <linux/pinctrl/pinctrl.h>
0012 #include <linux/pinctrl/pinconf-generic.h>
0013 #include <linux/mfd/mt6397/core.h>
0014
0015 #include "pinctrl-mtk-common.h"
0016 #include "pinctrl-mtk-mt6397.h"
0017
0018 #define MT6397_PIN_REG_BASE 0xc000
0019
0020 static const struct mtk_pinctrl_devdata mt6397_pinctrl_data = {
0021 .pins = mtk_pins_mt6397,
0022 .npins = ARRAY_SIZE(mtk_pins_mt6397),
0023 .dir_offset = (MT6397_PIN_REG_BASE + 0x000),
0024 .ies_offset = MTK_PINCTRL_NOT_SUPPORT,
0025 .smt_offset = MTK_PINCTRL_NOT_SUPPORT,
0026 .pullen_offset = (MT6397_PIN_REG_BASE + 0x020),
0027 .pullsel_offset = (MT6397_PIN_REG_BASE + 0x040),
0028 .dout_offset = (MT6397_PIN_REG_BASE + 0x080),
0029 .din_offset = (MT6397_PIN_REG_BASE + 0x0a0),
0030 .pinmux_offset = (MT6397_PIN_REG_BASE + 0x0c0),
0031 .type1_start = 41,
0032 .type1_end = 41,
0033 .port_shf = 3,
0034 .port_mask = 0x3,
0035 .port_align = 2,
0036 .mode_mask = 0xf,
0037 .mode_per_reg = 5,
0038 .mode_shf = 4,
0039 };
0040
0041 static int mt6397_pinctrl_probe(struct platform_device *pdev)
0042 {
0043 struct mt6397_chip *mt6397;
0044
0045 mt6397 = dev_get_drvdata(pdev->dev.parent);
0046 return mtk_pctrl_init(pdev, &mt6397_pinctrl_data, mt6397->regmap);
0047 }
0048
0049 static const struct of_device_id mt6397_pctrl_match[] = {
0050 { .compatible = "mediatek,mt6397-pinctrl", },
0051 { }
0052 };
0053
0054 static struct platform_driver mtk_pinctrl_driver = {
0055 .probe = mt6397_pinctrl_probe,
0056 .driver = {
0057 .name = "mediatek-mt6397-pinctrl",
0058 .of_match_table = mt6397_pctrl_match,
0059 },
0060 };
0061
0062 builtin_platform_driver(mtk_pinctrl_driver);