<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: GPIO driver in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/GPIO-driver/m-p/913151#M137541</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am using NXP I.MX8MMINI EVK board&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have found the SAI5_RXD1 from datasheet but im unable to locate the reg address in the header file in kernel source code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have learnt that there is no direct fsl write to address in the latest linux kernel, instead the devicetree source is included in a fsl-imx8mm.dts or .dtsi file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so I have written platform device driver and assigned the .compatible = "fsl,imx8mm-gpio" and trying the prob the physical address and map to virtual address but its unable probe the address&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have got invalid address when &amp;nbsp;r_mem =&amp;nbsp; platform_get_resource(pdev, IORESOURCE_MEM, 0); is called in probe&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;below is the source code for quick review&lt;/P&gt;&lt;P&gt;/***************************************************************************************/&lt;/P&gt;&lt;P&gt;#include &amp;lt;linux/init.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/module.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/kernel.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/slab.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/io.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/interrupt.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/of_address.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/bitops.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/err.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/gpio.h&amp;gt;&lt;/P&gt;&lt;P&gt;#include &amp;lt;linux/irqdomain.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/of.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/of_device.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/platform_device.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/pm_qos.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/rpmsg.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/virtio.h&amp;gt;&lt;BR /&gt;#define DRIVER_NAME "GPIO_DRIVER"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;struct simpmod_local {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;int irq;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;unsigned long mem_start;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;unsigned long mem_end;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;void __iomem *base_addr;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;};&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;static int gpiodriver_probe(struct platform_device *pdev)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;struct resource *r_mem; /*IO Mem Resource */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;struct device *dev = &amp;amp;pdev-&amp;gt;dev;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;struct simpmod_local *lp = NULL;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;int rc=0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;printk(KERN_ALERT "\n&amp;nbsp; Device Tree address.... \n");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;r_mem =&amp;nbsp; platform_get_resource(pdev, IORESOURCE_MEM, 0);&lt;BR /&gt;#if 1&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if(!r_mem)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;dev_err(dev, "Invalid Address\n");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;return ENODEV;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;#endif&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;lp = (struct simpmod_local *) kmalloc(sizeof(struct simpmod_local),GFP_KERNEL);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if(!lp){&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;printk(KERN_ALERT "\ncould not allocate Memory \n");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;printk(KERN_ALERT "\n&amp;nbsp; Save data on local structure \n");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;dev_set_drvdata(dev,lp);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;//Save data on local structure&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;lp-&amp;gt;mem_start = r_mem-&amp;gt;start;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;lp-&amp;gt;mem_end = r_mem-&amp;gt;end;&lt;BR /&gt;#if 0&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;//Ask kernel the memory region defined on the device tree and prevent other drivers to overlap on this region&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;//this is needed before ioremap&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if(!request_mem_region(lp-&amp;gt;mem_start,lp-&amp;gt;mem_end - lp-&amp;gt;mem_start+1,DRIVER_NAME)){&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;dev_err(dev,"Couldn't lock memory at %p\n",(void *)lp-&amp;gt;mem_start);&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;rc=EBUSY;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;//goto error1:&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;#endif&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;printk("lp-&amp;gt;mem_start:0x%X\t mapped to 0x%X",(unsigned int __force)lp-&amp;gt;mem_start,(unsigned int __force)lp-&amp;gt;base_addr);&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static int gpiodriver_remove(struct platform_device *pdev)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static void gpio_device_release(struct device *pdev)&lt;BR /&gt;{&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static const struct of_device_id imx_gpio_ctrl[] = {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{ .compatible = "fsl,imx8mm-gpio" ,},&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{ /* sentinel */ }&lt;BR /&gt;};&lt;BR /&gt;static struct platform_driver gpio_driver = {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.driver = {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;.name = DRIVER_NAME,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;.owner = THIS_MODULE,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;.of_match_table = imx_gpio_ctrl&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;},&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.probe = gpiodriver_probe,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.remove = gpiodriver_remove,&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static struct platform_device gpio_device = {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.name = DRIVER_NAME,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.id = 0,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.dev = {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;.release = gpio_device_release,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;},&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static int __init gpio_device_init(void)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;printk(KERN_ALERT "\nDriver test init\n");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;platform_device_register(&amp;amp;gpio_device);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;platform_driver_register(&amp;amp;gpio_driver);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static void __exit gpio_device_exit(void)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;printk(KERN_ALERT "\nDriver test exit\n");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;platform_driver_unregister(&amp;amp;gpio_driver);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;platform_device_unregister(&amp;amp;gpio_device);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;module_init(gpio_device_init);&lt;BR /&gt;module_exit(gpio_device_exit);&lt;BR /&gt;MODULE_LICENSE("GPL");&lt;BR /&gt;MODULE_AUTHOR("Santhosh");&lt;BR /&gt;MODULE_DESCRIPTION("IMX8MM GPIO Driver");&lt;/P&gt;&lt;P&gt;/***************************************************************************************/&lt;/P&gt;&lt;P&gt;need your help to resolve&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Santhosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Aug 2019 03:37:17 GMT</pubDate>
    <dc:creator>santhosh2</dc:creator>
    <dc:date>2019-08-14T03:37:17Z</dc:date>
    <item>
      <title>GPIO driver</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/GPIO-driver/m-p/913149#M137539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to write a GPIO driver, for On and Off a peripheral, Im unable to find the register address definition IOMUXC_SW_MUX_CTL_PAD_SAI5_RXD1 to configure as GPIO and set the direction as output and set and clear the pin.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;help me with example for writing the driver&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Contents in /sys/class/gpio&lt;/P&gt;&lt;P&gt;root@imx8mmevk:/sys/class/gpio# ls&lt;BR /&gt;export&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gpiochip128&amp;nbsp; gpiochip496&amp;nbsp; gpiochip96&lt;BR /&gt;gpiochip0&amp;nbsp; gpiochip32&amp;nbsp;&amp;nbsp; gpiochip64&amp;nbsp;&amp;nbsp; unexport&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also i tried to use sys/class/gpio that also didnt work for me&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For GPIO3_IO22 would get the kernel GPIO number&lt;BR /&gt;* N = (BANK – 1) * 32 + IO&lt;BR /&gt;* N = (3 – 1) * 32 + 22 = 86&lt;BR /&gt;* echo 86 &amp;gt; /sys/class/gpio/export&amp;nbsp;&amp;nbsp; -- Command to Export GPIO44&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* To set the value of output GPIOs by first setting the direction&lt;BR /&gt;*&amp;nbsp; echo out &amp;gt; /sys/class/gpio/gpio86/direction&lt;BR /&gt;* and then set the value low by&lt;BR /&gt;* echo 0 &amp;gt; /sys/class/gpio/gpio86/value&lt;BR /&gt;* or to high&lt;BR /&gt;* echo 1 &amp;gt; /sys/class/gpio/gpio86/value&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Aug 2019 11:30:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/GPIO-driver/m-p/913149#M137539</guid>
      <dc:creator>santhosh2</dc:creator>
      <dc:date>2019-08-12T11:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: GPIO driver</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/GPIO-driver/m-p/913150#M137540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Santhosh Kumar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Which processor you are using? You can find the register address on the Reference Manual of the processor you are using.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, for the i.MX8MM the Pad Mux Register IOMUXC_SW_MUX_CTL_PAD_SAI5_RXD1 has an absolute address of 3033_014C (hex) as shown on the IOMUXC Memory Map in section 8.2.5 of the Reference Manual.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this helps!&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Aug 2019 16:36:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/GPIO-driver/m-p/913150#M137540</guid>
      <dc:creator>gusarambula</dc:creator>
      <dc:date>2019-08-13T16:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: GPIO driver</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/GPIO-driver/m-p/913151#M137541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am using NXP I.MX8MMINI EVK board&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have found the SAI5_RXD1 from datasheet but im unable to locate the reg address in the header file in kernel source code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have learnt that there is no direct fsl write to address in the latest linux kernel, instead the devicetree source is included in a fsl-imx8mm.dts or .dtsi file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so I have written platform device driver and assigned the .compatible = "fsl,imx8mm-gpio" and trying the prob the physical address and map to virtual address but its unable probe the address&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have got invalid address when &amp;nbsp;r_mem =&amp;nbsp; platform_get_resource(pdev, IORESOURCE_MEM, 0); is called in probe&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;below is the source code for quick review&lt;/P&gt;&lt;P&gt;/***************************************************************************************/&lt;/P&gt;&lt;P&gt;#include &amp;lt;linux/init.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/module.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/kernel.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/slab.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/io.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/interrupt.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/of_address.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/bitops.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/err.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/gpio.h&amp;gt;&lt;/P&gt;&lt;P&gt;#include &amp;lt;linux/irqdomain.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/of.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/of_device.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/platform_device.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/pm_qos.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/rpmsg.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/virtio.h&amp;gt;&lt;BR /&gt;#define DRIVER_NAME "GPIO_DRIVER"&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;struct simpmod_local {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;int irq;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;unsigned long mem_start;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;unsigned long mem_end;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;void __iomem *base_addr;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;};&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;static int gpiodriver_probe(struct platform_device *pdev)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;struct resource *r_mem; /*IO Mem Resource */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;struct device *dev = &amp;amp;pdev-&amp;gt;dev;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;struct simpmod_local *lp = NULL;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;int rc=0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;printk(KERN_ALERT "\n&amp;nbsp; Device Tree address.... \n");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;r_mem =&amp;nbsp; platform_get_resource(pdev, IORESOURCE_MEM, 0);&lt;BR /&gt;#if 1&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if(!r_mem)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;dev_err(dev, "Invalid Address\n");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;return ENODEV;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;#endif&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;lp = (struct simpmod_local *) kmalloc(sizeof(struct simpmod_local),GFP_KERNEL);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if(!lp){&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;printk(KERN_ALERT "\ncould not allocate Memory \n");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;printk(KERN_ALERT "\n&amp;nbsp; Save data on local structure \n");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;dev_set_drvdata(dev,lp);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;//Save data on local structure&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;lp-&amp;gt;mem_start = r_mem-&amp;gt;start;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;lp-&amp;gt;mem_end = r_mem-&amp;gt;end;&lt;BR /&gt;#if 0&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;//Ask kernel the memory region defined on the device tree and prevent other drivers to overlap on this region&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;//this is needed before ioremap&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if(!request_mem_region(lp-&amp;gt;mem_start,lp-&amp;gt;mem_end - lp-&amp;gt;mem_start+1,DRIVER_NAME)){&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;dev_err(dev,"Couldn't lock memory at %p\n",(void *)lp-&amp;gt;mem_start);&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;rc=EBUSY;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;//goto error1:&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;#endif&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;printk("lp-&amp;gt;mem_start:0x%X\t mapped to 0x%X",(unsigned int __force)lp-&amp;gt;mem_start,(unsigned int __force)lp-&amp;gt;base_addr);&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static int gpiodriver_remove(struct platform_device *pdev)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static void gpio_device_release(struct device *pdev)&lt;BR /&gt;{&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static const struct of_device_id imx_gpio_ctrl[] = {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{ .compatible = "fsl,imx8mm-gpio" ,},&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{ /* sentinel */ }&lt;BR /&gt;};&lt;BR /&gt;static struct platform_driver gpio_driver = {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.driver = {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;.name = DRIVER_NAME,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;.owner = THIS_MODULE,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;.of_match_table = imx_gpio_ctrl&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;},&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.probe = gpiodriver_probe,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.remove = gpiodriver_remove,&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static struct platform_device gpio_device = {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.name = DRIVER_NAME,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.id = 0,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.dev = {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;.release = gpio_device_release,&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;},&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static int __init gpio_device_init(void)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;printk(KERN_ALERT "\nDriver test init\n");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;platform_device_register(&amp;amp;gpio_device);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;platform_driver_register(&amp;amp;gpio_driver);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;return 0;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static void __exit gpio_device_exit(void)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;printk(KERN_ALERT "\nDriver test exit\n");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;platform_driver_unregister(&amp;amp;gpio_driver);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;platform_device_unregister(&amp;amp;gpio_device);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;module_init(gpio_device_init);&lt;BR /&gt;module_exit(gpio_device_exit);&lt;BR /&gt;MODULE_LICENSE("GPL");&lt;BR /&gt;MODULE_AUTHOR("Santhosh");&lt;BR /&gt;MODULE_DESCRIPTION("IMX8MM GPIO Driver");&lt;/P&gt;&lt;P&gt;/***************************************************************************************/&lt;/P&gt;&lt;P&gt;need your help to resolve&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Santhosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 Aug 2019 03:37:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/GPIO-driver/m-p/913151#M137541</guid>
      <dc:creator>santhosh2</dc:creator>
      <dc:date>2019-08-14T03:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: GPIO driver</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/GPIO-driver/m-p/913152#M137542</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Santhosh Kumar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you still experiencing problems with the GPIO driver?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Sep 2019 18:39:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/GPIO-driver/m-p/913152#M137542</guid>
      <dc:creator>gusarambula</dc:creator>
      <dc:date>2019-09-02T18:39:42Z</dc:date>
    </item>
  </channel>
</rss>

