Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * Copyright (c) 2020 Yangtao Li <frank@allwinnertech.com>
0004  *
0005  * Based on:
0006  * huangshuosheng <huangshuosheng@allwinnertech.com>
0007  */
0008 
0009 #include <linux/module.h>
0010 #include <linux/of.h>
0011 #include <linux/of_device.h>
0012 #include <linux/pinctrl/pinctrl.h>
0013 #include <linux/platform_device.h>
0014 
0015 #include "pinctrl-sunxi.h"
0016 
0017 static const struct sunxi_desc_pin a100_r_pins[] = {
0018     SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 0),
0019           SUNXI_FUNCTION(0x0, "gpio_in"),
0020           SUNXI_FUNCTION(0x1, "gpio_out"),
0021           SUNXI_FUNCTION(0x2, "s_i2c0"),    /* SCK */
0022           SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 0)),
0023     SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 1),
0024           SUNXI_FUNCTION(0x0, "gpio_in"),
0025           SUNXI_FUNCTION(0x1, "gpio_out"),
0026           SUNXI_FUNCTION(0x2, "s_i2c0"),    /* SDA */
0027           SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 1)),
0028     SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 2),
0029           SUNXI_FUNCTION(0x0, "gpio_in"),
0030           SUNXI_FUNCTION(0x1, "gpio_out"),
0031           SUNXI_FUNCTION(0x2, "s_uart0"),   /* TX */
0032           SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 2)),
0033     SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 3),
0034           SUNXI_FUNCTION(0x0, "gpio_in"),
0035           SUNXI_FUNCTION(0x1, "gpio_out"),
0036           SUNXI_FUNCTION(0x2, "s_uart0"),   /* RX */
0037           SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 3)),
0038     SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 4),
0039           SUNXI_FUNCTION(0x0, "gpio_in"),
0040           SUNXI_FUNCTION(0x1, "gpio_out"),
0041           SUNXI_FUNCTION(0x2, "s_jtag"),    /* MS */
0042           SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 4)),
0043     SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 5),
0044           SUNXI_FUNCTION(0x0, "gpio_in"),
0045           SUNXI_FUNCTION(0x1, "gpio_out"),
0046           SUNXI_FUNCTION(0x2, "s_jtag"),    /* CK */
0047           SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 5)),
0048     SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 6),
0049           SUNXI_FUNCTION(0x0, "gpio_in"),
0050           SUNXI_FUNCTION(0x1, "gpio_out"),
0051           SUNXI_FUNCTION(0x2, "s_jtag"),    /* DO */
0052           SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 6)),
0053     SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 7),
0054           SUNXI_FUNCTION(0x0, "gpio_in"),
0055           SUNXI_FUNCTION(0x1, "gpio_out"),
0056           SUNXI_FUNCTION(0x2, "s_jtag"),    /* DI */
0057           SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 7)),
0058     SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 8),
0059           SUNXI_FUNCTION(0x0, "gpio_in"),
0060           SUNXI_FUNCTION(0x1, "gpio_out"),
0061           SUNXI_FUNCTION(0x2, "s_i2c1"),    /* SCK */
0062           SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 8)),
0063     SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 9),
0064           SUNXI_FUNCTION(0x0, "gpio_in"),
0065           SUNXI_FUNCTION(0x1, "gpio_out"),
0066           SUNXI_FUNCTION(0x2, "s_i2c1"),    /* SDA */
0067           SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 9)),
0068     SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 10),
0069           SUNXI_FUNCTION(0x0, "gpio_in"),
0070           SUNXI_FUNCTION(0x1, "gpio_out"),
0071           SUNXI_FUNCTION(0x2, "s_pwm"),
0072           SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 10)),
0073     SUNXI_PIN(SUNXI_PINCTRL_PIN(L, 11),
0074           SUNXI_FUNCTION(0x0, "gpio_in"),
0075           SUNXI_FUNCTION(0x1, "gpio_out"),
0076           SUNXI_FUNCTION(0x3, "s_cir"),     /* IN */
0077           SUNXI_FUNCTION_IRQ_BANK(0x6, 0, 11)),
0078 };
0079 
0080 static const struct sunxi_pinctrl_desc a100_r_pinctrl_data = {
0081     .pins = a100_r_pins,
0082     .npins = ARRAY_SIZE(a100_r_pins),
0083     .pin_base = PL_BASE,
0084     .irq_banks = 1,
0085     .io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_MODE_CTL,
0086 };
0087 
0088 static int a100_r_pinctrl_probe(struct platform_device *pdev)
0089 {
0090     return sunxi_pinctrl_init(pdev, &a100_r_pinctrl_data);
0091 }
0092 
0093 static const struct of_device_id a100_r_pinctrl_match[] = {
0094     { .compatible = "allwinner,sun50i-a100-r-pinctrl", },
0095     {}
0096 };
0097 MODULE_DEVICE_TABLE(of, a100_r_pinctrl_match);
0098 
0099 static struct platform_driver a100_r_pinctrl_driver = {
0100     .probe  = a100_r_pinctrl_probe,
0101     .driver = {
0102         .name       = "sun50i-a100-r-pinctrl",
0103         .of_match_table = a100_r_pinctrl_match,
0104     },
0105 };
0106 module_platform_driver(a100_r_pinctrl_driver);