diff mbox series

[V2] gpio: mxc: add clock operation

Message ID 1526951717-12347-1-git-send-email-Anson.Huang@nxp.com
State New
Headers show
Series [V2] gpio: mxc: add clock operation | expand

Commit Message

Anson Huang May 22, 2018, 1:15 a.m. UTC
Some i.MX SoCs have GPIO clock gates in CCM CCGR, such as
i.MX6SLL, need to enable clocks before accessing GPIO
registers, add optional clock operation for GPIO driver.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
changes since V1:
	add missing clk header;
	remove FSF addresses in copyright to avoid check patch ERROR.
 drivers/gpio/gpio-mxc.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

Comments

Fabio Estevam May 22, 2018, 2:27 a.m. UTC | #1
Hi Anson,

On Mon, May 21, 2018 at 10:15 PM, Anson Huang <Anson.Huang@nxp.com> wrote:
> Some i.MX SoCs have GPIO clock gates in CCM CCGR, such as
> i.MX6SLL, need to enable clocks before accessing GPIO
> registers, add optional clock operation for GPIO driver.
>
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> ---
> changes since V1:
>         add missing clk header;
>         remove FSF addresses in copyright to avoid check patch ERROR.
>  drivers/gpio/gpio-mxc.c | 18 ++++++++++++++----
>  1 file changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
> index 11ec722..2026f94 100644
> --- a/drivers/gpio/gpio-mxc.c
> +++ b/drivers/gpio/gpio-mxc.c
> @@ -14,12 +14,9 @@
>   * but WITHOUT ANY WARRANTY; without even the implied warranty of
>   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>   * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
>   */

This is an unrelated change and should be part of a different patch.

A patch that converts this driver to use SPDX would get rid of the FSF address.
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Anson Huang May 22, 2018, 2:29 a.m. UTC | #2
Hi, Fabio

Anson Huang
Best Regards!


> -----Original Message-----
> From: Fabio Estevam [mailto:festevam@gmail.com]
> Sent: Tuesday, May 22, 2018 10:28 AM
> To: Anson Huang <anson.huang@nxp.com>
> Cc: Linus Walleij <linus.walleij@linaro.org>; dl-linux-imx <linux-imx@nxp.com>;
> linux-gpio@vger.kernel.org; linux-kernel <linux-kernel@vger.kernel.org>
> Subject: Re: [PATCH V2] gpio: mxc: add clock operation
> 
> Hi Anson,
> 
> On Mon, May 21, 2018 at 10:15 PM, Anson Huang <Anson.Huang@nxp.com>
> wrote:
> > Some i.MX SoCs have GPIO clock gates in CCM CCGR, such as i.MX6SLL,
> > need to enable clocks before accessing GPIO registers, add optional
> > clock operation for GPIO driver.
> >
> > Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
> > ---
> > changes since V1:
> >         add missing clk header;
> >         remove FSF addresses in copyright to avoid check patch ERROR.
> >  drivers/gpio/gpio-mxc.c | 18 ++++++++++++++----
> >  1 file changed, 14 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c index
> > 11ec722..2026f94 100644
> > --- a/drivers/gpio/gpio-mxc.c
> > +++ b/drivers/gpio/gpio-mxc.c
> > @@ -14,12 +14,9 @@
> >   * but WITHOUT ANY WARRANTY; without even the implied warranty of
> >   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> >   * GNU General Public License for more details.
> > - *
> > - * You should have received a copy of the GNU General Public License
> > - * along with this program; if not, write to the Free Software
> > - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
> USA.
> >   */
> 
> This is an unrelated change and should be part of a different patch.
> 
> A patch that converts this driver to use SPDX would get rid of the FSF address.

Thanks, I will rework it into 2 patches, using SPDX.

Anson.
Fabio Estevam May 22, 2018, 2:34 a.m. UTC | #3
Hi Anson,

On Mon, May 21, 2018 at 11:29 PM, Anson Huang <anson.huang@nxp.com> wrote:

> Thanks, I will rework it into 2 patches, using SPDX.

I have just sent a series that converts gpio-mxc and gpio-mxs to use
SPDX identifier and put you on Cc.

You can base your change on top of mine.

Thanks
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Anson Huang May 22, 2018, 2:35 a.m. UTC | #4
DQoNCkFuc29uIEh1YW5nDQpCZXN0IFJlZ2FyZHMhDQoNCg0KPiAtLS0tLU9yaWdpbmFsIE1lc3Nh
Z2UtLS0tLQ0KPiBGcm9tOiBGYWJpbyBFc3RldmFtIFttYWlsdG86ZmVzdGV2YW1AZ21haWwuY29t
XQ0KPiBTZW50OiBUdWVzZGF5LCBNYXkgMjIsIDIwMTggMTA6MzQgQU0NCj4gVG86IEFuc29uIEh1
YW5nIDxhbnNvbi5odWFuZ0BueHAuY29tPg0KPiBDYzogTGludXMgV2FsbGVpaiA8bGludXMud2Fs
bGVpakBsaW5hcm8ub3JnPjsgZGwtbGludXgtaW14IDxsaW51eC1pbXhAbnhwLmNvbT47DQo+IGxp
bnV4LWdwaW9Admdlci5rZXJuZWwub3JnOyBsaW51eC1rZXJuZWwgPGxpbnV4LWtlcm5lbEB2Z2Vy
Lmtlcm5lbC5vcmc+DQo+IFN1YmplY3Q6IFJlOiBbUEFUQ0ggVjJdIGdwaW86IG14YzogYWRkIGNs
b2NrIG9wZXJhdGlvbg0KPiANCj4gSGkgQW5zb24sDQo+IA0KPiBPbiBNb24sIE1heSAyMSwgMjAx
OCBhdCAxMToyOSBQTSwgQW5zb24gSHVhbmcgPGFuc29uLmh1YW5nQG54cC5jb20+DQo+IHdyb3Rl
Og0KPiANCj4gPiBUaGFua3MsIEkgd2lsbCByZXdvcmsgaXQgaW50byAyIHBhdGNoZXMsIHVzaW5n
IFNQRFguDQo+IA0KPiBJIGhhdmUganVzdCBzZW50IGEgc2VyaWVzIHRoYXQgY29udmVydHMgZ3Bp
by1teGMgYW5kIGdwaW8tbXhzIHRvIHVzZSBTUERYDQo+IGlkZW50aWZpZXIgYW5kIHB1dCB5b3Ug
b24gQ2MuDQo+IA0KPiBZb3UgY2FuIGJhc2UgeW91ciBjaGFuZ2Ugb24gdG9wIG9mIG1pbmUuDQo+
IA0KPiBUaGFua3MNCiANCk9LLCB0aGFua3MuDQoNCg0K
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index 11ec722..2026f94 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -14,12 +14,9 @@ 
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 
+#include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
@@ -60,6 +57,7 @@  struct mxc_gpio_hwdata {
 struct mxc_gpio_port {
 	struct list_head node;
 	void __iomem *base;
+	struct clk *clk;
 	int irq;
 	int irq_high;
 	struct irq_domain *domain;
@@ -434,6 +432,17 @@  static int mxc_gpio_probe(struct platform_device *pdev)
 	if (port->irq < 0)
 		return port->irq;
 
+	/* the controller clock is optional */
+	port->clk = devm_clk_get(&pdev->dev, NULL);
+	if (IS_ERR(port->clk))
+		port->clk = NULL;
+
+	err = clk_prepare_enable(port->clk);
+	if (err) {
+		dev_err(&pdev->dev, "Unable to enable clock.\n");
+		return err;
+	}
+
 	/* disable the interrupt and clear the status */
 	writel(0, port->base + GPIO_IMR);
 	writel(~0, port->base + GPIO_ISR);
@@ -502,6 +511,7 @@  static int mxc_gpio_probe(struct platform_device *pdev)
 out_irqdomain_remove:
 	irq_domain_remove(port->domain);
 out_bgio:
+	clk_disable_unprepare(port->clk);
 	dev_info(&pdev->dev, "%s failed with errno %d\n", __func__, err);
 	return err;
 }