Lines Matching +full:lpc1850 +full:- +full:dac

19 #include <linux/pinctrl/pinconf-generic.h>
22 #include "pinctrl-utils.h"
66 TYPE_ND, /* Normal-drive */
67 TYPE_HD, /* High-drive */
68 TYPE_HS, /* High-speed */
139 [FUNC_DAC] = "dac",
209 #define DAC LPC18XX_ANALOG_PIN macro
288 LPC_P(4,4, GPIO, CTOUT, LCD, R, R, LCD_ALT, UART3, SGPIO, DAC, ND);
637 {"nxp,gpio-pin-interrupt", PIN_CONFIG_GPIO_PIN_INT, 0},
658 return -EINVAL; in lpc18xx_pconf_get_usb1()
665 return -EINVAL; in lpc18xx_pconf_get_usb1()
669 return -ENOTSUPP; in lpc18xx_pconf_get_usb1()
690 return -EINVAL; in lpc18xx_pconf_get_i2c0()
709 return -EINVAL; in lpc18xx_pconf_get_i2c0()
715 return -ENOTSUPP; in lpc18xx_pconf_get_i2c0()
727 return -EINVAL; in lpc18xx_pin_to_gpio()
729 return pin - range->pin_base + range->base; in lpc18xx_pin_to_gpio()
746 return -EINVAL; in lpc18xx_get_pintsel()
768 return -ENOTSUPP; in lpc18xx_pconf_get_gpio_pin_int()
774 * PINTSEL registers. *arg indicates which interrupt number (0-7). in lpc18xx_pconf_get_gpio_pin_int()
777 ret = lpc18xx_get_pintsel(scu->base + LPC18XX_SCU_PINTSEL0, val, arg); in lpc18xx_pconf_get_gpio_pin_int()
781 return lpc18xx_get_pintsel(scu->base + LPC18XX_SCU_PINTSEL1, val, arg); in lpc18xx_pconf_get_gpio_pin_int()
793 return -EINVAL; in lpc18xx_pconf_get_pin()
798 return -EINVAL; in lpc18xx_pconf_get_pin()
807 return -EINVAL; in lpc18xx_pconf_get_pin()
814 return -EINVAL; in lpc18xx_pconf_get_pin()
818 if (pin_cap->type == TYPE_HD) in lpc18xx_pconf_get_pin()
819 return -ENOTSUPP; in lpc18xx_pconf_get_pin()
829 return -EINVAL; in lpc18xx_pconf_get_pin()
835 if (pin_cap->type != TYPE_HD) in lpc18xx_pconf_get_pin()
836 return -ENOTSUPP; in lpc18xx_pconf_get_pin()
854 return -ENOTSUPP; in lpc18xx_pconf_get_pin()
883 return -EINVAL; in lpc18xx_pconf_get()
885 reg = readl(scu->base + pin_cap->offset); in lpc18xx_pconf_get()
887 if (pin_cap->type == TYPE_I2C0) in lpc18xx_pconf_get()
889 else if (pin_cap->type == TYPE_USB1) in lpc18xx_pconf_get()
923 dev_err(pctldev->dev, "Property not supported\n"); in lpc18xx_pconf_set_usb1()
924 return -ENOTSUPP; in lpc18xx_pconf_set_usb1()
963 return -ENOTSUPP; in lpc18xx_pconf_set_i2c0()
974 dev_err(pctldev->dev, "Property not supported\n"); in lpc18xx_pconf_set_i2c0()
975 return -ENOTSUPP; in lpc18xx_pconf_set_i2c0()
989 return -EINVAL; in lpc18xx_pconf_set_gpio_pin_int()
993 return -ENOTSUPP; in lpc18xx_pconf_set_gpio_pin_int()
999 reg_val = readl(scu->base + reg_offset); in lpc18xx_pconf_set_gpio_pin_int()
1002 writel(reg_val, scu->base + reg_offset); in lpc18xx_pconf_set_gpio_pin_int()
1033 if (pin_cap->type == TYPE_HD) { in lpc18xx_pconf_set_pin()
1034 dev_err(pctldev->dev, "Slew rate unsupported on high-drive pins\n"); in lpc18xx_pconf_set_pin()
1035 return -ENOTSUPP; in lpc18xx_pconf_set_pin()
1052 if (pin_cap->type != TYPE_HD) { in lpc18xx_pconf_set_pin()
1053 dev_err(pctldev->dev, "Drive strength available only on high-drive pins\n"); in lpc18xx_pconf_set_pin()
1054 return -ENOTSUPP; in lpc18xx_pconf_set_pin()
1059 case 20: param_val -= 5; in lpc18xx_pconf_set_pin()
1061 case 14: param_val -= 5; in lpc18xx_pconf_set_pin()
1063 case 8: param_val -= 3; in lpc18xx_pconf_set_pin()
1065 case 4: param_val -= 4; in lpc18xx_pconf_set_pin()
1068 dev_err(pctldev->dev, "Drive strength %u unsupported\n", param_val); in lpc18xx_pconf_set_pin()
1069 return -ENOTSUPP; in lpc18xx_pconf_set_pin()
1078 dev_err(pctldev->dev, "Property not supported\n"); in lpc18xx_pconf_set_pin()
1079 return -ENOTSUPP; in lpc18xx_pconf_set_pin()
1098 return -EINVAL; in lpc18xx_pconf_set()
1100 reg = readl(scu->base + pin_cap->offset); in lpc18xx_pconf_set()
1106 if (pin_cap->type == TYPE_I2C0) in lpc18xx_pconf_set()
1108 else if (pin_cap->type == TYPE_USB1) in lpc18xx_pconf_set()
1117 writel(reg, scu->base + pin_cap->offset); in lpc18xx_pconf_set()
1146 *groups = scu->func[function].groups; in lpc18xx_pmx_get_func_groups()
1147 *num_groups = scu->func[function].ngroups; in lpc18xx_pmx_get_func_groups()
1161 if (pin->type == TYPE_USB1) { in lpc18xx_pmx_set()
1168 if (pin->type == TYPE_I2C0) { in lpc18xx_pmx_set()
1175 if (function == FUNC_ADC && (pin->analog & LPC18XX_ANALOG_PIN)) { in lpc18xx_pmx_set()
1178 writel(LPC18XX_SCU_ANALOG_PIN_CFG, scu->base + pin->offset); in lpc18xx_pmx_set()
1180 if (LPC18XX_ANALOG_ADC(pin->analog) == 0) in lpc18xx_pmx_set()
1185 reg = readl(scu->base + offset); in lpc18xx_pmx_set()
1186 reg |= pin->analog & LPC18XX_ANALOG_BIT_MASK; in lpc18xx_pmx_set()
1187 writel(reg, scu->base + offset); in lpc18xx_pmx_set()
1192 if (function == FUNC_DAC && (pin->analog & LPC18XX_ANALOG_PIN)) { in lpc18xx_pmx_set()
1193 writel(LPC18XX_SCU_ANALOG_PIN_CFG, scu->base + pin->offset); in lpc18xx_pmx_set()
1195 reg = readl(scu->base + LPC18XX_SCU_REG_ENAIO2); in lpc18xx_pmx_set()
1197 writel(reg, scu->base + LPC18XX_SCU_REG_ENAIO2); in lpc18xx_pmx_set()
1203 if (function == pin->functions[func]) in lpc18xx_pmx_set()
1210 reg = readl(scu->base + pin->offset); in lpc18xx_pmx_set()
1212 writel(reg | func, scu->base + pin->offset); in lpc18xx_pmx_set()
1216 dev_err(pctldev->dev, "Pin %s can't be %s\n", lpc18xx_pins[group].name, in lpc18xx_pmx_set()
1218 return -EINVAL; in lpc18xx_pmx_set()
1259 .name = "lpc18xx/43xx-scu",
1278 if (function == FUNC_DAC && p->analog == DAC) in lpc18xx_valid_pin_function()
1281 if (function == FUNC_ADC && p->analog) in lpc18xx_valid_pin_function()
1284 if (function == FUNC_I2C0 && p->type == TYPE_I2C0) in lpc18xx_valid_pin_function()
1287 if (function == FUNC_USB1 && p->type == TYPE_USB1) in lpc18xx_valid_pin_function()
1291 if (function == p->functions[i]) in lpc18xx_valid_pin_function()
1310 scu->func[func].ngroups = ngroups; in lpc18xx_create_group_func_map()
1311 scu->func[func].groups = devm_kcalloc(dev, in lpc18xx_create_group_func_map()
1314 if (!scu->func[func].groups) in lpc18xx_create_group_func_map()
1315 return -ENOMEM; in lpc18xx_create_group_func_map()
1318 scu->func[func].groups[i] = lpc18xx_pins[pins[i]].name; in lpc18xx_create_group_func_map()
1329 scu = devm_kzalloc(&pdev->dev, sizeof(*scu), GFP_KERNEL); in lpc18xx_scu_probe()
1331 return -ENOMEM; in lpc18xx_scu_probe()
1333 scu->base = devm_platform_ioremap_resource(pdev, 0); in lpc18xx_scu_probe()
1334 if (IS_ERR(scu->base)) in lpc18xx_scu_probe()
1335 return PTR_ERR(scu->base); in lpc18xx_scu_probe()
1337 scu->clk = devm_clk_get(&pdev->dev, NULL); in lpc18xx_scu_probe()
1338 if (IS_ERR(scu->clk)) { in lpc18xx_scu_probe()
1339 dev_err(&pdev->dev, "Input clock not found.\n"); in lpc18xx_scu_probe()
1340 return PTR_ERR(scu->clk); in lpc18xx_scu_probe()
1343 ret = lpc18xx_create_group_func_map(&pdev->dev, scu); in lpc18xx_scu_probe()
1345 dev_err(&pdev->dev, "Unable to create group func map.\n"); in lpc18xx_scu_probe()
1349 ret = clk_prepare_enable(scu->clk); in lpc18xx_scu_probe()
1351 dev_err(&pdev->dev, "Unable to enable clock.\n"); in lpc18xx_scu_probe()
1357 scu->pctl = devm_pinctrl_register(&pdev->dev, &lpc18xx_scu_desc, scu); in lpc18xx_scu_probe()
1358 if (IS_ERR(scu->pctl)) { in lpc18xx_scu_probe()
1359 dev_err(&pdev->dev, "Could not register pinctrl driver\n"); in lpc18xx_scu_probe()
1360 clk_disable_unprepare(scu->clk); in lpc18xx_scu_probe()
1361 return PTR_ERR(scu->pctl); in lpc18xx_scu_probe()
1368 { .compatible = "nxp,lpc1850-scu" },
1375 .name = "lpc18xx-scu",