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/init.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", },
59 static struct platform_driver mtk_pinctrl_driver
= {
60 .probe
= mt6397_pinctrl_probe
,
62 .name
= "mediatek-mt6397-pinctrl",
63 .of_match_table
= mt6397_pctrl_match
,
67 builtin_platform_driver(mtk_pinctrl_driver
);