pinctrl-mvebu.c (0337966d121ebebf73a1c346123e8112796e684e) | pinctrl-mvebu.c (ef088187e1ca16d9b986cab63643b0a2ac2d7b94) |
---|---|
1/* 2 * Marvell MVEBU pinctrl core driver 3 * 4 * Authors: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> 5 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by --- 796 unchanged lines hidden (view full) --- 805 unsigned off = (pid / MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; 806 unsigned shift = (pid % MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; 807 808 return regmap_update_bits(data->regmap.map, data->regmap.offset + off, 809 MVEBU_MPP_MASK << shift, config << shift); 810} 811 812int mvebu_pinctrl_simple_regmap_probe(struct platform_device *pdev, | 1/* 2 * Marvell MVEBU pinctrl core driver 3 * 4 * Authors: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> 5 * Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by --- 796 unchanged lines hidden (view full) --- 805 unsigned off = (pid / MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; 806 unsigned shift = (pid % MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; 807 808 return regmap_update_bits(data->regmap.map, data->regmap.offset + off, 809 MVEBU_MPP_MASK << shift, config << shift); 810} 811 812int mvebu_pinctrl_simple_regmap_probe(struct platform_device *pdev, |
813 struct device *syscon_dev) | 813 struct device *syscon_dev, u32 offset) |
814{ 815 struct mvebu_pinctrl_soc_info *soc = dev_get_platdata(&pdev->dev); 816 struct mvebu_mpp_ctrl_data *mpp_data; 817 struct regmap *regmap; | 814{ 815 struct mvebu_pinctrl_soc_info *soc = dev_get_platdata(&pdev->dev); 816 struct mvebu_mpp_ctrl_data *mpp_data; 817 struct regmap *regmap; |
818 u32 offset; | |
819 int i; 820 821 regmap = syscon_node_to_regmap(syscon_dev->of_node); 822 if (IS_ERR(regmap)) 823 return PTR_ERR(regmap); 824 | 818 int i; 819 820 regmap = syscon_node_to_regmap(syscon_dev->of_node); 821 if (IS_ERR(regmap)) 822 return PTR_ERR(regmap); 823 |
825 if (of_property_read_u32(pdev->dev.of_node, "offset", &offset)) 826 return -EINVAL; 827 | |
828 mpp_data = devm_kcalloc(&pdev->dev, soc->ncontrols, sizeof(*mpp_data), 829 GFP_KERNEL); 830 if (!mpp_data) 831 return -ENOMEM; 832 833 for (i = 0; i < soc->ncontrols; i++) { 834 mpp_data[i].regmap.map = regmap; 835 mpp_data[i].regmap.offset = offset; 836 } 837 838 soc->control_data = mpp_data; 839 840 return mvebu_pinctrl_probe(pdev); 841} | 824 mpp_data = devm_kcalloc(&pdev->dev, soc->ncontrols, sizeof(*mpp_data), 825 GFP_KERNEL); 826 if (!mpp_data) 827 return -ENOMEM; 828 829 for (i = 0; i < soc->ncontrols; i++) { 830 mpp_data[i].regmap.map = regmap; 831 mpp_data[i].regmap.offset = offset; 832 } 833 834 soc->control_data = mpp_data; 835 836 return mvebu_pinctrl_probe(pdev); 837} |