2 * Copyright (c) 2015 MediaTek Inc.
3 * Author: Hongzhou.Yang <hongzhou.yang@mediatek.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
15 #include <linux/module.h>
16 #include <linux/platform_device.h>
18 #include <linux/of_device.h>
19 #include <linux/pinctrl/pinctrl.h>
20 #include <linux/pinctrl/pinconf-generic.h>
21 #include <linux/mfd/mt6397/core.h>
23 #include "pinctrl-mtk-common.h"
24 #include "pinctrl-mtk-mt6397.h"
26 #define MT6397_PIN_REG_BASE 0xc000
28 static const struct mtk_pinctrl_devdata mt6397_pinctrl_data
= {
29 .pins
= mtk_pins_mt6397
,
30 .npins
= ARRAY_SIZE(mtk_pins_mt6397
),
31 .dir_offset
= (MT6397_PIN_REG_BASE
+ 0x000),
32 .ies_offset
= MTK_PINCTRL_NOT_SUPPORT
,
33 .smt_offset
= MTK_PINCTRL_NOT_SUPPORT
,
34 .pullen_offset
= (MT6397_PIN_REG_BASE
+ 0x020),
35 .pullsel_offset
= (MT6397_PIN_REG_BASE
+ 0x040),
36 .dout_offset
= (MT6397_PIN_REG_BASE
+ 0x080),
37 .din_offset
= (MT6397_PIN_REG_BASE
+ 0x0a0),
38 .pinmux_offset
= (MT6397_PIN_REG_BASE
+ 0x0c0),
46 static int mt6397_pinctrl_probe(struct platform_device
*pdev
)
48 struct mt6397_chip
*mt6397
;
50 mt6397
= dev_get_drvdata(pdev
->dev
.parent
);
51 return mtk_pctrl_init(pdev
, &mt6397_pinctrl_data
, mt6397
->regmap
);
54 static const struct of_device_id mt6397_pctrl_match
[] = {
55 { .compatible
= "mediatek,mt6397-pinctrl", },
58 MODULE_DEVICE_TABLE(of
, mt6397_pctrl_match
);
60 static struct platform_driver mtk_pinctrl_driver
= {
61 .probe
= mt6397_pinctrl_probe
,
63 .name
= "mediatek-mt6397-pinctrl",
64 .of_match_table
= mt6397_pctrl_match
,
68 static int __init
mtk_pinctrl_init(void)
70 return platform_driver_register(&mtk_pinctrl_driver
);
73 module_init(mtk_pinctrl_init
);
75 MODULE_LICENSE("GPL v2");
76 MODULE_DESCRIPTION("MediaTek MT6397 Pinctrl Driver");
77 MODULE_AUTHOR("Hongzhou Yang <hongzhou.yang@mediatek.com>");