Re: [PATCH v2 09/21] pinctrl: mvebu: dove: provide generic mpp callbacks
On 01/31/14 11:13, Linus Walleij wrote: On Tue, Jan 28, 2014 at 1:39 AM, Sebastian Hesselbarth wrote: We want to get rid of passing register addresses to common pinctrl driver, so provide set/get callbacks for generic mpp pins. Signed-off-by: Sebastian Hesselbarth [...] @@ -374,7 +398,7 @@ static struct mvebu_mpp_ctrl dove_mpp_controls[] = { MPP_FUNC_CTRL(13, 13, "mpp13", dove_pmu_mpp_ctrl), MPP_FUNC_CTRL(14, 14, "mpp14", dove_pmu_mpp_ctrl), MPP_FUNC_CTRL(15, 15, "mpp15", dove_pmu_mpp_ctrl), - MPP_REG_CTRL(16, 23), + MPP_FUNC_CTRL(16, 23, NULL, dove_mpp_ctrl), What does this have to do with the rest of the patch? (Maybe I'm stupid, beware I'm just glancing over this stuff as I see the patch set is still in development.) Not really, the driver is slightly misdesigned and this patches try to clean this up a bit. I have prepared a v3 branch for the MVEBU guys to have a look at first. Short version: Thanks for trying to review this, but I guess your time would be better spent on a soon to be posted v3. Long version: Not having a callback identifies each control as "generic mpp pins", so by passing a callback we make them "SoC specific" as a preparation to remove the common "generic mpp" set/get function. Sebastian -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 09/21] pinctrl: mvebu: dove: provide generic mpp callbacks
On Tue, Jan 28, 2014 at 1:39 AM, Sebastian Hesselbarth wrote: > We want to get rid of passing register addresses to common pinctrl > driver, so provide set/get callbacks for generic mpp pins. > > Signed-off-by: Sebastian Hesselbarth OK... > +static int dove_mpp_ctrl_get(struct mvebu_mpp_ctrl *ctrl, > +unsigned long *config) > +{ (...) This is fine. > @@ -374,7 +398,7 @@ static struct mvebu_mpp_ctrl dove_mpp_controls[] = { > MPP_FUNC_CTRL(13, 13, "mpp13", dove_pmu_mpp_ctrl), > MPP_FUNC_CTRL(14, 14, "mpp14", dove_pmu_mpp_ctrl), > MPP_FUNC_CTRL(15, 15, "mpp15", dove_pmu_mpp_ctrl), > - MPP_REG_CTRL(16, 23), > + MPP_FUNC_CTRL(16, 23, NULL, dove_mpp_ctrl), What does this have to do with the rest of the patch? (Maybe I'm stupid, beware I'm just glancing over this stuff as I see the patch set is still in development.) Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 09/21] pinctrl: mvebu: dove: provide generic mpp callbacks
On Tue, Jan 28, 2014 at 1:39 AM, Sebastian Hesselbarth sebastian.hesselba...@gmail.com wrote: We want to get rid of passing register addresses to common pinctrl driver, so provide set/get callbacks for generic mpp pins. Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com OK... +static int dove_mpp_ctrl_get(struct mvebu_mpp_ctrl *ctrl, +unsigned long *config) +{ (...) This is fine. @@ -374,7 +398,7 @@ static struct mvebu_mpp_ctrl dove_mpp_controls[] = { MPP_FUNC_CTRL(13, 13, mpp13, dove_pmu_mpp_ctrl), MPP_FUNC_CTRL(14, 14, mpp14, dove_pmu_mpp_ctrl), MPP_FUNC_CTRL(15, 15, mpp15, dove_pmu_mpp_ctrl), - MPP_REG_CTRL(16, 23), + MPP_FUNC_CTRL(16, 23, NULL, dove_mpp_ctrl), What does this have to do with the rest of the patch? (Maybe I'm stupid, beware I'm just glancing over this stuff as I see the patch set is still in development.) Yours, Linus Walleij -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 09/21] pinctrl: mvebu: dove: provide generic mpp callbacks
On 01/31/14 11:13, Linus Walleij wrote: On Tue, Jan 28, 2014 at 1:39 AM, Sebastian Hesselbarth sebastian.hesselba...@gmail.com wrote: We want to get rid of passing register addresses to common pinctrl driver, so provide set/get callbacks for generic mpp pins. Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com [...] @@ -374,7 +398,7 @@ static struct mvebu_mpp_ctrl dove_mpp_controls[] = { MPP_FUNC_CTRL(13, 13, mpp13, dove_pmu_mpp_ctrl), MPP_FUNC_CTRL(14, 14, mpp14, dove_pmu_mpp_ctrl), MPP_FUNC_CTRL(15, 15, mpp15, dove_pmu_mpp_ctrl), - MPP_REG_CTRL(16, 23), + MPP_FUNC_CTRL(16, 23, NULL, dove_mpp_ctrl), What does this have to do with the rest of the patch? (Maybe I'm stupid, beware I'm just glancing over this stuff as I see the patch set is still in development.) Not really, the driver is slightly misdesigned and this patches try to clean this up a bit. I have prepared a v3 branch for the MVEBU guys to have a look at first. Short version: Thanks for trying to review this, but I guess your time would be better spent on a soon to be posted v3. Long version: Not having a callback identifies each control as generic mpp pins, so by passing a callback we make them SoC specific as a preparation to remove the common generic mpp set/get function. Sebastian -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 09/21] pinctrl: mvebu: dove: provide generic mpp callbacks
We want to get rid of passing register addresses to common pinctrl driver, so provide set/get callbacks for generic mpp pins. Signed-off-by: Sebastian Hesselbarth --- Cc: Jason Cooper Cc: Andrew Lunn Cc: Gregory Clement Cc: Thomas Petazzoni Cc: Linus Walleij Cc: linux-arm-ker...@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- drivers/pinctrl/mvebu/pinctrl-dove.c | 26 +- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/mvebu/pinctrl-dove.c b/drivers/pinctrl/mvebu/pinctrl-dove.c index 4d051ba17fee..cd55f2ca4e8a 100644 --- a/drivers/pinctrl/mvebu/pinctrl-dove.c +++ b/drivers/pinctrl/mvebu/pinctrl-dove.c @@ -57,6 +57,30 @@ static void __iomem *mpp_base; +static int dove_mpp_ctrl_get(struct mvebu_mpp_ctrl *ctrl, +unsigned long *config) +{ + unsigned off = (ctrl->pid / MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; + unsigned shift = (ctrl->pid % MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; + + *config = (readl(mpp_base + off) >> shift) & MVEBU_MPP_MASK; + + return 0; +} + +static int dove_mpp_ctrl_set(struct mvebu_mpp_ctrl *ctrl, +unsigned long config) +{ + unsigned off = (ctrl->pid / MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; + unsigned shift = (ctrl->pid % MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; + unsigned long reg; + + reg = readl(mpp_base + off) & ~(MVEBU_MPP_MASK << shift); + writel(reg | (config << shift), mpp_base + off); + + return 0; +} + static int dove_pmu_mpp_ctrl_get(struct mvebu_mpp_ctrl *ctrl, unsigned long *config) { @@ -374,7 +398,7 @@ static struct mvebu_mpp_ctrl dove_mpp_controls[] = { MPP_FUNC_CTRL(13, 13, "mpp13", dove_pmu_mpp_ctrl), MPP_FUNC_CTRL(14, 14, "mpp14", dove_pmu_mpp_ctrl), MPP_FUNC_CTRL(15, 15, "mpp15", dove_pmu_mpp_ctrl), - MPP_REG_CTRL(16, 23), + MPP_FUNC_CTRL(16, 23, NULL, dove_mpp_ctrl), MPP_FUNC_CTRL(24, 39, "mpp_camera", dove_mpp4_ctrl), MPP_FUNC_CTRL(40, 45, "mpp_sdio0", dove_mpp4_ctrl), MPP_FUNC_CTRL(46, 51, "mpp_sdio1", dove_mpp4_ctrl), -- 1.8.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2 09/21] pinctrl: mvebu: dove: provide generic mpp callbacks
We want to get rid of passing register addresses to common pinctrl driver, so provide set/get callbacks for generic mpp pins. Signed-off-by: Sebastian Hesselbarth sebastian.hesselba...@gmail.com --- Cc: Jason Cooper ja...@lakedaemon.net Cc: Andrew Lunn and...@lunn.ch Cc: Gregory Clement gregory.clem...@free-electrons.com Cc: Thomas Petazzoni thomas.petazz...@free-electrons.com Cc: Linus Walleij linus.wall...@linaro.org Cc: linux-arm-ker...@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- drivers/pinctrl/mvebu/pinctrl-dove.c | 26 +- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/mvebu/pinctrl-dove.c b/drivers/pinctrl/mvebu/pinctrl-dove.c index 4d051ba17fee..cd55f2ca4e8a 100644 --- a/drivers/pinctrl/mvebu/pinctrl-dove.c +++ b/drivers/pinctrl/mvebu/pinctrl-dove.c @@ -57,6 +57,30 @@ static void __iomem *mpp_base; +static int dove_mpp_ctrl_get(struct mvebu_mpp_ctrl *ctrl, +unsigned long *config) +{ + unsigned off = (ctrl-pid / MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; + unsigned shift = (ctrl-pid % MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; + + *config = (readl(mpp_base + off) shift) MVEBU_MPP_MASK; + + return 0; +} + +static int dove_mpp_ctrl_set(struct mvebu_mpp_ctrl *ctrl, +unsigned long config) +{ + unsigned off = (ctrl-pid / MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; + unsigned shift = (ctrl-pid % MVEBU_MPPS_PER_REG) * MVEBU_MPP_BITS; + unsigned long reg; + + reg = readl(mpp_base + off) ~(MVEBU_MPP_MASK shift); + writel(reg | (config shift), mpp_base + off); + + return 0; +} + static int dove_pmu_mpp_ctrl_get(struct mvebu_mpp_ctrl *ctrl, unsigned long *config) { @@ -374,7 +398,7 @@ static struct mvebu_mpp_ctrl dove_mpp_controls[] = { MPP_FUNC_CTRL(13, 13, mpp13, dove_pmu_mpp_ctrl), MPP_FUNC_CTRL(14, 14, mpp14, dove_pmu_mpp_ctrl), MPP_FUNC_CTRL(15, 15, mpp15, dove_pmu_mpp_ctrl), - MPP_REG_CTRL(16, 23), + MPP_FUNC_CTRL(16, 23, NULL, dove_mpp_ctrl), MPP_FUNC_CTRL(24, 39, mpp_camera, dove_mpp4_ctrl), MPP_FUNC_CTRL(40, 45, mpp_sdio0, dove_mpp4_ctrl), MPP_FUNC_CTRL(46, 51, mpp_sdio1, dove_mpp4_ctrl), -- 1.8.5.2 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/