This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

K2HK: GPIO pin as interrupt source

Expert 1800 points
Other Parts Discussed in Thread: OMAPL138, SYSBIOS

Hi,

Linux kernel version: K2_LINUX_03.10.10_14.07

We want to configure Keystone 2 GPIO pin 16 as interrupt source in our custom board based on K2HK.  

GPIO 16 is connected to FPGA and FPGA sends 1PPS.  We are able to capture  1PPS signal on GPIO pin 16.

I am referring Keystone GPIO documentation and linux kernel keystone GPIO documentation.

http://processors.wiki.ti.com/index.php/MCSDK_UG_Chapter_Exploring#Keystone_GPIO_Driver

I am not receiving PPS interrupt.

In our custom driver, we do the following

1. Mapping GPIO to IRQ

irq_num = gpio_to_irq(16)

2. Request IRQ

request_irq(irq_num, handler, 0, "gpio_16_pps, NULL);

3. Setting IRQ type

set_irq_type(irq_num, IRQF_TRIGGER_FALLING);

I am manually configuring BINTEN EN bit to enable interrupts and SET_FAL_TRIG bit SETFAL15 using devmem2 tool.  But I could not see any interrupts.

Are there any steps missing? 

/dev/shm # cat /proc/interrupts
CPU0 CPU1
29: 0 0 GIC arch_timer
30: 13952244 4039370 GIC arch_timer
56: 0 0 GIC a15-l1l2-ecc-err-irq
70: 0 0 GIC pcie-error-irq
80: 1116314 0 GIC hwqueue-8704
88: 0 0 GIC hwqueue-8712
89: 0 0 GIC hwqueue-8713
92: 329690 0 GIC hwqueue-8716
94: 0 0 GIC hwqueue-8718
142: 0 0 GIC timer64-event
248: 1030576 0 GIC hwqueue-acc-37
309: 3860 0 GIC serial
315: 23853 0 GIC 2530000.i2c0
318: 41 0 GIC 2530400.i2c1
324: 4217400 0 GIC 21000400.spi
328: 0 0 GIC 21000600.spi
480: 0 0 GIC ddr3-ecc-err-irq
512: 0 0 keystone-ipc-irq 2620040.dsp0
513: 0 0 keystone-ipc-irq 2620044.dsp1
514: 0 0 keystone-ipc-irq 2620048.dsp2
515: 0 0 keystone-ipc-irq 262004c.dsp3
520: 0 0 keystone-ipc-irq 2620040.dsp0
521: 0 0 keystone-ipc-irq 2620044.dsp1
522: 0 0 keystone-ipc-irq 2620048.dsp2
523: 0 0 keystone-ipc-irq 262004c.dsp3
556: 0 0 gpio-keystone gpio_16_pps

Please clarify the steps for GPIO to IRQ for keystone 2.  

Thanks

Rams



  • Hi Rams,

    1. Have you set the direction of the GPIO as in?

    2. Could you please share the user space driver source?

    Thank you.

  • Hi Rajasekaran,

    Thanks for your response.  We are setting the GPIO direction.  Please find the attached driver source.  

    Thanks

    Rams

    /*
     * Based on the pps-ktimer.c from:
     * Copyright (C) 2005-2006   Rodolfo Giometti <giometti@linux.it>
     *
     * pps-atvtimer.c -- atv irq kernel timer client
     *
     * Copyright (C) 2010        AppearTV AS
     *
     *   This program is free software; you can redistribute it and/or modify
     *   it under the terms of the GNU General Public License as published by
     *   the Free Software Foundation; either version 2 of the License, or
     *   (at your option) any later version.
     *
     *   This program is distributed in the hope that it will be useful,
     *   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., 675 Mass Ave, Cambridge, MA 02139, USA.
     */
    
    
    #include <linux/kernel.h>
    #include <linux/module.h>
    #include <linux/init.h>
    #include <linux/io.h>
    #include <linux/time.h>
    #include <linux/timer.h>
    #include <linux/pps_kernel.h>
    #include <linux/irq.h>
    #include <linux/interrupt.h>
    #include <linux/gpio.h>
    
    /*
     * Global variables
     */
    
    
    #define PPS_TIMER_DEFAULT       16
    static unsigned int pps_atvirq = PPS_TIMER_DEFAULT;
    
    static unsigned int pps_virq;
    static struct pps_device *pps;
    
    /*
     * irq routine
     */
    
    static irqreturn_t pps_atvirq_handler(int irq, void *parm)
    {
            struct pps_event_time ts;
    
    	/* First of all we get the time stamp... */
    	ktime_get_ts(&ts);
    
    	pps_event(pps, &ts, PPS_CAPTUREASSERT, NULL);
    
    	printk("PPS event at %lu\n", jiffies);
    
    	return IRQ_HANDLED;
    }
    
    /*
     * The echo function
     */
    
    static void pps_atvtimer_echo(struct pps_device *pps, int event, void *data)
    {
            dev_info(pps->dev, "echo %s %s\n",
    		event & PPS_CAPTUREASSERT ? "assert" : "",
    		event & PPS_CAPTURECLEAR ? "clear" : "");
    }
    
    /*
     * The PPS info struct
     */
    
    static struct pps_source_info keystone_pps_timer_info = {
    	.name		= "ppstimer",
    	.path		= "",
    	.mode		= PPS_CAPTUREASSERT | PPS_OFFSETASSERT |
    			  PPS_ECHOASSERT |
    			  PPS_CANWAIT | PPS_TSFMT_TSPEC,
    	.echo		= pps_atvtimer_echo,
    	.owner		= THIS_MODULE,
    };
    
    /*
     * Module staff
     */
    
    static void __exit pps_atvtimer_exit(void)
    {
    	pps_unregister_source(pps);
        free_irq(pps_virq, NULL);
        gpio_free(pps_atvirq);
    	dev_info(pps->dev, "atvtimer PPS source unregistered\n");
    }
    
    static int __init pps_atvtimer_init(void)
    {
    	int ret;
    #if 1
    	ret = gpio_request(pps_atvirq, "pps_atvtimer");
    	if (ret) {
    		pr_warning("pps_atvtimer: failed to request GPIO %u\n", pps_atvirq);
    		return -EINVAL;
    	}
    
    	ret = gpio_direction_input(pps_atvirq);
    	if (ret) {
    		pr_warning("failed to set pin direction\n");
    		return -EINVAL;
    	}
    #endif
    	/*	pps_virq = irq_create_mapping(NULL, pps_atvirq);*/
    	pps_virq = gpio_to_irq(pps_atvirq);
    	if (pps_virq == NO_IRQ) {
    	        printk(KERN_ERR "cannot create irq mapping for hw irq: %d\n", pps_atvirq);
    		return -EINVAL;
    	}
    
        ret = request_irq(pps_virq, pps_atvirq_handler, IRQF_TRIGGER_FALLING, 
    			  "gpio_16_pps_atvtimer", NULL);
    	if (ret) {
    		printk(KERN_ERR "failed to register handler for virq: %d\n", pps_virq);
    		return ret;
    	}
        
    	pps = pps_register_source(&keystone_pps_timer_info,
    				PPS_CAPTUREASSERT | PPS_OFFSETASSERT);
    	if (pps == NULL) {
    		printk(KERN_ERR "cannot register atvtimer source\n");
    		return -ENOMEM;
    	}
    
    	dev_info(pps->dev, "atvtimer PPS source registered\n");
    
    	return 0;
    }
    
    module_init(pps_atvtimer_init);
    module_exit(pps_atvtimer_exit);
    
    MODULE_AUTHOR("AppearTV AS");
    MODULE_DESCRIPTION("PPS source by using IRQ pin 16 on Keystone2");
    MODULE_LICENSE("GPL");
    

    Note:

    We could not use pps-gpio.c as we have problems in DTS  parsing and keystone GPIO does not seem to work correctly.

     

  • Hi Rams,

    I have looked your source code and I'm not able to see "irq_set_irq_type" API for interrupt generation.

        ret = request_irq(pps_virq, pps_atvirq_handler, IRQF_TRIGGER_FALLING, 
    			  "gpio_16_pps_atvtimer", NULL);
    	if (ret) {
    		printk(KERN_ERR "failed to register handler for virq: %d\n", pps_virq);
    		return ret;
    	}
    

    TO

    	    ret = request_irq(pps_virq, pps_atvirq_handler, 0, 
    			  "gpio_16_pps_atvtimer", NULL);
    
    	if (ret) {
    		printk(KERN_ERR "failed to register handler for virq: %d\n", pps_virq);
    		return ret;
    	}
    
    	irq_set_irq_type(irq_num,IRQ_TYPE_EDGE_FALLING);

    I have worked out GPIO interrupt on OMAPL138 LCDK board and try to modify as per your requirement.

    /*
     * Sample driver for making GPIO to interrupt
     *
     * This file is subject to the terms and conditions of the GNU General Public
     * License.
     *
     * AUTHOR : Titusrathinaraj Stalin
     * EMAIL  : x0213399@ti.com
     *	
     */
    
    
    
    /* Include linux kernel header files */
    #include <linux/kernel.h>
    #include <linux/module.h>
    #include <linux/fs.h>
    #include <linux/cdev.h>
    #include <asm/uaccess.h>
    #include <linux/device.h>
    #include <asm/gpio.h>
    #include <linux/interrupt.h>
    #include <asm/irq.h>
    #include <linux/sched.h>
    #include <linux/irq.h>
    #include <linux/delay.h>
    
    MODULE_LICENSE("GPL");
    MODULE_AUTHOR("Titus S");
    MODULE_DESCRIPTION("GPIO interrupt sample driver");
    
    /* OMAPL138_LCDK : S3 switch */
    
    #define GPIO_INT 37
    
    /* GPIO No 141 -> GPIO8[12] : OMAPL138_LCDK : J15[16] */
    
    //#define GPIO_INT 165 //input key for SDI OMAPL138
    //#define GPIO_INT1 166 //output led1 for SDI OMAPL138
    //#define GPIO_INT2 167 //output led2 for SDI OMAPL138
    
    #define gpio_int "gpio_int"
    
    /* local functions */
    static int gpio_irq_open (struct inode *inode, struct file *filp);
    static int gpio_irq_release (struct inode *inode, struct file *filp);
    static int gpio_irq_fasync(int fd, struct file *filp, int on);
    
    static int major;
    static struct class *class_gpio_int;
    static struct device *dev_gpio_int;
    
    
    static struct fasync_struct *gpio_irq_async_queue;
    
    /* declare file operation structure */
    static struct file_operations gpio_irq_fops = {
    	.owner = THIS_MODULE,
    	.open  = gpio_irq_open,
    	.release = gpio_irq_release,
    	.fasync	= gpio_irq_fasync,
    };
    
    /*Interrupt Handler */
    static irqreturn_t gpio_interrupt(int irq, void *dev_id, struct pt_regs *regs)
    {
    	printk("\n GPIO interrupt raised; IRQ No : %d\n",irq);
    	kill_fasync(&gpio_irq_async_queue, SIGIO, POLL_IN);
    	return IRQ_HANDLED;
    }
    
    /***************************************************************************
     * Function             - gpio_request_irq
     * Functionality        - Registers Handlers to the IRQ's of GPIO's by request_irq
     * Input Params - 
     * Return Value - None
     * Note                 - None
     ****************************************************************************/
    void gpio_request_irq(int irq_num)
    {
    	int status = 0;
    
    //	irq_set_irq_type(irq_num,IRQ_TYPE_EDGE_BOTH);
    
    	status = request_irq(irq_num, gpio_interrupt,0,"gpio_int", NULL);
    
    /* Need to use 'IRQ_TYPE_EDGE_FALLING' since the switch S3 is pulled high and it should raise interrupt when we pressed switch (ie falling edge) */
    
    	irq_set_irq_type(irq_num,IRQ_TYPE_EDGE_FALLING);
    
    	printk(KERN_WARNING "gpio_request_irq %d status %d\n",
    			   irq_num, status);
    
    	if (status == -EINVAL) {
    		printk("<1> EINVAL \n");
    		} 
    	else if (status == -ENOMEM) {
    		printk("<1> ENOMEM ");
    		} 		
    		
    	if (status < 0) {
    		printk("<1> gpio_request_irq : Failed to Register IRQ %d  \n",
    		       irq_num);
    		printk("<1> gpio_request_irq : return status is %d  \n",
    		       status);
    	}
    
    }
    
    /***************************************************************************
     * Function             - gpio_unrequest_irq
     * Functionality        - Free Handlers o the IRQ's of GPIO's
     * Input Params - 
     * Return Value - None
     * Note                 - None
     ****************************************************************************/
    void gpio_unrequest_irq(int irq_num)
    {
    	free_irq(irq_num, NULL);
    //	gpio_free(GPIO_INT1);
    //	gpio_free(GPIO_INT2);
    	printk("<1> gpio_unrequest_irq :  Freeing IRQ %d  \n", irq_num);
    
    }
    /****************************************************************************/
    
    
    static int gpio_irq_fasync(int fd, struct file *filp, int on)
    {
    	int temp;
    	temp = fasync_helper(fd, filp, on, &gpio_irq_async_queue);
    	if (fd != -1)
    		kill_fasync(&gpio_irq_async_queue, SIGIO, POLL_IN);
    	return(temp);
    }
    
    void gpio_init(void)
    {
    	unsigned int status,tmp;
    
    	status = gpio_request(GPIO_INT, "gpio_ctrl");
    	printk(KERN_ALERT "gpio_ctrl : GPIO NO: %d Status %d\n",GPIO_INT,status);
    //	status = gpio_request(GPIO_INT1, "gpio_ctrl");
    //	printk(KERN_ALERT "gpio_ctrl : GPIO NO: %d Status %d\n",GPIO_INT1,status);
    //	status = gpio_request(GPIO_INT2, "gpio_ctrl");
    //	printk(KERN_ALERT "gpio_ctrl : GPIO NO: %d Status %d\n",GPIO_INT2,status);
    
    //	gpio_direction_output(GPIO_INT1, 0);
    //	gpio_direction_output(GPIO_INT2, 0);
    	gpio_direction_input(GPIO_INT);
    
    
    	tmp = gpio_to_irq(GPIO_INT);
    	printk(KERN_ALERT "IRQ is %d\n",tmp);
    	gpio_request_irq(tmp);
    }
    
    /******************************************************************************
     * gpio_irq_open - do nothing 
     *****************************************************************************/
    static int gpio_irq_open (struct inode *inode, struct file *filp)
    {
        return 0;
    }    
    
    /******************************************************************************
     * gpio_irq_release - do nothing 
     *****************************************************************************/
    static int gpio_irq_release (struct inode *inode, struct file *filp)
    {
    	if (filp->f_flags & FASYNC) {
    		gpio_irq_fasync (-1, filp, 0);
    	}
    	return 0;
    } 
    
    /*****************************************************************************
     * initialise user gpio module
     ****************************************************************************/
    static int gpio_irq_init(void)
    {
    	static int status;
    
    	void *ptr_err;
    	if ((major = register_chrdev(0, gpio_int, &gpio_irq_fops)) < 0)
    		return major;
    
    	class_gpio_int = class_create(THIS_MODULE, gpio_int);
    	if (IS_ERR(ptr_err = class_gpio_int))
    		goto err2;
    
    	dev_gpio_int = device_create(class_gpio_int, NULL, MKDEV(major, 0), NULL, gpio_int);
    	if (IS_ERR(ptr_err = dev_gpio_int))
    		goto err;
    
        	gpio_init();
    
    	printk(KERN_ALERT "GPIO IRQ device is inserted sucessfully\n");
    
        	return 0;
    
    err:
    	class_destroy(class_gpio_int);
    err2:
    	unregister_chrdev(major, gpio_int);
    	return PTR_ERR(ptr_err);
    
    }
    
    /*****************************************************************************
     * cleanup user gpio module
     ****************************************************************************/
    static void gpio_irq_exit(void)
    {
    
    //	gpio_direction_output(GPIO_INT1,0);
    //	gpio_direction_output(GPIO_INT2,0);
    
    mdelay(500);
    //printk("Im done...\n");
    //	gpio_direction_output(GPIO_INT1,1);
    //	gpio_direction_output(GPIO_INT2,1);
    
    //mdelay(1000);
    //printk("Im down...\n");
    
    	gpio_unrequest_irq(gpio_to_irq(GPIO_INT));
    
    	device_destroy(class_gpio_int, MKDEV(major, 0));
    	class_destroy(class_gpio_int);
    	printk(KERN_ALERT "GPIO IRQ device is ejected sucessfully\n");
    }
    
    module_init(gpio_irq_init);
    module_exit(gpio_irq_exit);
    

  • Hi Titus,

    Thanks for your support.  I tested the changes recommended by you, it is still the same behaviour.  

    The PPS pulse width is 45ns.  Hope it is within the spec?

    Regards

    Rams

  • Hi 

    I have also tested your driver for GPIO 16.

    /dev/shm # insmod gpio-irq.ko
    [462315.338165] gpio_ctrl : GPIO NO: 16 Status 0
    [462315.342552] IRQ is 556
    [462315.345019] gpio_request_irq 556 status 0
    [462315.349146] GPIO IRQ device is inserted sucessfully

    I still dont get the interrupt.

    CPU0 CPU1
    29: 0 0 GIC arch_timer
    30: 122993296 33185895 GIC arch_timer
    56: 0 0 GIC a15-l1l2-ecc-err-irq
    70: 0 0 GIC pcie-error-irq
    80: 8324700 0 GIC hwqueue-8704
    88: 0 0 GIC hwqueue-8712
    89: 0 0 GIC hwqueue-8713
    92: 2860970 0 GIC hwqueue-8716
    94: 0 0 GIC hwqueue-8718
    142: 0 0 GIC timer64-event
    248: 8959964 0 GIC hwqueue-acc-37
    309: 5660 0 GIC serial
    315: 207222 0 GIC 2530000.i2c0
    318: 41 0 GIC 2530400.i2c1
    324: 4217400 0 GIC 21000400.spi
    328: 0 0 GIC 21000600.spi
    480: 0 0 GIC ddr3-ecc-err-irq
    512: 0 0 keystone-ipc-irq 2620040.dsp0
    513: 0 0 keystone-ipc-irq 2620044.dsp1
    514: 0 0 keystone-ipc-irq 2620048.dsp2
    515: 0 0 keystone-ipc-irq 262004c.dsp3
    520: 0 0 keystone-ipc-irq 2620040.dsp0
    521: 0 0 keystone-ipc-irq 2620044.dsp1
    522: 0 0 keystone-ipc-irq 2620048.dsp2
    523: 0 0 keystone-ipc-irq 262004c.dsp3
    556: 0 0 gpio-keystone gpio_int
    IPI0: 0 0 CPU wakeup interrupts
    IPI1: 0 0 Timer broadcast interrupts
    IPI2: 538327 6005631 Rescheduling interrupts
    IPI3: 0 0 Function call interrupts
    IPI4: 488 4831 Single function call interrupts
    IPI5: 0 0 CPU stop interrupts
    Err: 0

    Regards

    Rams

  • Hi,

    As per the memory map [sprs866e.pdf], page no. 88, GPIO Config address range 0x260BF00 to 0x260BFFF.

    Section 10.22.1, page no 328 describeds the GPIO registers for configuration.  

    Referring to Keystone GPIO user guide http://www.ti.com/lit/ug/sprugv1/sprugv1.pdf,  the DIR, OUT_DATA and all other registers only support GPIO pins from 0 to 15.  What about rest of the GPIO pins?  How do we configure rest of the GPIO pins?

    We are trying to configure GPIO 16 in our application as interrupt source?  But I see that we are not configuring GPIO 16 correctly because we do not have access to the second bank.  Please provide us the information to configure the second GPIO bank.

    Thanks

    Rams

  • Hi,

    We tried to strap the PPS signal to GPIO 4 as the GPIO configuration is available for GPIO 0 to GPIO 15.  Even then, we cannot get GPIO interrupt.

    Is GPIO interrupt tested on Keystone 2?  

    Can you please provide us with updated documentation?

    Can you please provide a working example on keystone 2?

    Regards

    Rams

  • Rams,

    - On the GPIO side:
    For GPIO (only GPIO, no interrupt so far) as a sanity check are you able to read the correct value on a GPIO pin when an external signal is applied?

    - For the ARM side Interrupts:
    a) It seems that it is possible to trigger an SPI (Shared peripheral Interrupt) interrupt by SW.
    Some high level information are provided in the below post (it is CSL and SYSBIOS related but the methodology used should apply to all K2H device I think):
    http://e2e.ti.com/support/dsp/c6000_multi-core_dsps/f/639/p/312327/1088598.aspx#1088598

    Are you able to write to the according GICD_ISPENDR bit? do you see the ARM CPU executing the ISR?
    Try this for the different GPIOs like GPIO4 and GPIO16.

    This would validate that the AINTC GIC-400 is correctly setup and that the interrupt vector of a given SPI is being called when an events is detected.

    b) Are ARM side interrupts working for peripherals like UART, SPI, ..etc?

    Anthony

  • Hi Rams,

    root@keystone-evm:~# cd /
    root@keystone-evm:/# insmod pps-atvtimer.ko
    [   39.913882] pps pps1: new PPS source ppstimer
    [   39.917460] pps pps1: atvtimer PPS source registered
    root@keystone-evm:/# [   40.248300] PPS event at 4294940167
    [   40.311112] PPS event at 4294940175
    [   40.619584] PPS event at 4294940213
    [   41.247926] PPS event at 4294940289
    [   42.277498] PPS event at 4294940415

    root@keystone-evm:/#
    root@keystone-evm:/# [   43.306223] PPS event at 4294940540
    [   43.370033] PPS event at 4294940548
    [   43.490289] PPS event at 4294940563
    [   43.947543] PPS event at 4294940619

    I have tried your attached code (0753.pps-atvtimer.c) but I just I used GPIO no is 4 and now I'm able to receive interrupts continuously.

    Still I'm in investigating on GPIO interrupts on keystone 2 and let me update.

  • Hi Sams,

    Have you tried to configure the GPIO as input through SYSFS while you change the GPIO value from FPGA ?

    Are able to see the GPIO toggling in CRO while you change the GPIO value from FPGA ?

    The PPS pulse width is 45ns.  Hope it is within the spec?

    Also, just try to increase the width of pulse which is coming from FPGA around ~1ms.

    Ex:

    root@keystone-evm:/sys/class/gpio# echo 10 > export
    root@keystone-evm:/sys/class/gpio# cd gpio10/
    root@keystone-evm:/sys/class/gpio/gpio10# echo "in" > direction
    root@keystone-evm:/sys/class/gpio/gpio10#
    root@keystone-evm:/sys/class/gpio/gpio10# cat value
    0
    root@keystone-evm:/sys/class/gpio/gpio10#

  • Hi,

    Thanks a lot for your support.  We have increased the pulse width to 1ms and we are able to measure the pulse at the GPIO pin with Oscilloscope.

    Do you have a working DTS file together with keystone GPIO driver with K2_LINUX_03.10.10_14.07 version?  

    I cannot see Keystone GPIO interface initialized with the DTS and GPIO driver for keystone 2.  I can only see sys/class interface for ipcgpio.

    The keystone documentation provides information for configuring 16 GPIO pins.  Can you please clarify on the configuration registers for rest of the 16 GPIO pins?

    Thanks

    Rams

  • Hi Anthony,

    ARM side interrupts are working fine for UART, SPI.  I see that the Keystone 2 GPIO driver is not working.  Can you please help us to get working GPIO driver for Keystone 2?

    Thanks

    Rams

  • Hi Rams,

    We would recommend you to use the MCSDK 3.1 .

    Do you have a working DTS file together with keystone GPIO driver with K2_LINUX_03.10.10_14.07 version?  

    I cannot see Keystone GPIO interface initialized with the DTS and GPIO driver for keystone 2.  I can only see sys/class interface for ipcgpio.

    Please find the gpio definition in dts file below. 

    file: arch/arm/boot/dts/keystone.dtsi

     gpio0: gpio@260bf00 {
                            compatible = "ti,keystone-gpio";
                            reg = <0x0260bf00 0x38>;
                            gpio-controller;
                            #gpio-cells = <2>;
                            /* HW Interrupts mapped to GPIO pins */
                            interrupts = <0 120 0xf01>,
                                    <0 121 0xf01>,
                                    <0 122 0xf01>,
                                    <0 123 0xf01>,
                                    <0 124 0xf01>,
                                    <0 125 0xf01>,
                                    <0 126 0xf01>,
                                    <0 127 0xf01>,
                                    <0 128 0xf01>,
                                    <0 129 0xf01>,
                                    <0 130 0xf01>,
                                    <0 131 0xf01>,
                                    <0 132 0xf01>,
                                    <0 133 0xf01>,
                                    <0 134 0xf01>,
                                    <0 135 0xf01>,
                                    <0 136 0xf01>,
                                    <0 137 0xf01>,
                                    <0 138 0xf01>,
                                    <0 139 0xf01>,
                                    <0 140 0xf01>,
                                    <0 141 0xf01>,
                                    <0 142 0xf01>,
                                    <0 143 0xf01>,
                                    <0 144 0xf01>,
                                    <0 145 0xf01>,
                                    <0 146 0xf01>,
                                    <0 147 0xf01>,
                                    <0 148 0xf01>,
                                    <0 149 0xf01>,
                                    <0 150 0xf01>,
                                    <0 151 0xf01>;
                            interrupt-controller;
                            #interrupt-cells = <2>;
                            clocks = <&clkgpio>;
                            clock-names = "gpio";
                    };
    

    We changed only the interrupt number in your driver to 10. When we load the .ko file we are receiving continues events. Please check whether this is re-producible at your end.

    We are working with factory to team to get more information.

    Thank you.

  • Hi Rams,

    Are you getting any single ISR event from kernel ?

    Do you have a working DTS file together with keystone GPIO driver with K2_LINUX_03.10.10_14.07 version

    Earlier I've worked with "K2_LINUX_03.10.10_14.03".

    Also, you can try the older versions if you wish "git reset" on your linux kernel source.

    git reset --hard K2_LINUX_03.10.10_14.03


    I have tried pre-built binaries to test the GPIO interrupt code  from the latest MCSDK release mcsdk_3_01

    I'm getting interrupt event for the both the releases.

    Please note that I've used the latest release to test your GPIO interrupt code.

    HW - > K2HK

    Please find the attached logs.

    U-Boot SPL 2013.01 (Jul 01 2014 - 16:19:36)
    SF: Detected N25Q128A with page size 64 KiB, total 16 MiB
    
    
    U-Boot 2013.01 (Jul 01 2014 - 16:19:36)
    
    I2C:   ready
    Detected SO-DIMM [SQR-SD3T-2G1333SED]
    DRAM:  2 GiB
    NAND:  512 MiB
    Net:   TCI6638_EMAC, TCI6638_EMAC1
    Hit any key to stop autoboot:  0 
    TCI6638 EVM # 
    TCI6638 EVM # 
    TCI6638 EVM # 
    TCI6638 EVM # boot
    Using TCI6638_EMAC device
    TFTP from server 172.29.75.21; our IP address is 10.100.1.102; sending through gateway 10.100.1.1
    Filename 'k2h_mcsdk_3_01/uImage-k2hk-evm.dtb'.
    Load address: 0x87000000
    Loading: ##########
             1.2 MiB/s
    done
    Bytes transferred = 50892 (c6cc hex)
    Using TCI6638_EMAC device
    TFTP from server 172.29.75.21; our IP address is 10.100.1.102; sending through gateway 10.100.1.1
    Filename 'k2h_mcsdk_3_01/uImage-keystone-evm.bin'.
    Load address: 0x88000000
    Loading: #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #################################################################
             #########################################
             1.3 MiB/s
    done
    Bytes transferred = 3866448 (3aff50 hex)
    Using TCI6638_EMAC device
    TFTP from server 172.29.75.21; our IP address is 10.100.1.102; sending through gateway 10.100.1.1
    Filename 'k2h_mcsdk_3_01/skern-k2hk-evm.bin'.
    Load address: 0xc5f0000
    Loading: #########
             1.3 MiB/s
    done
    Bytes transferred = 45056 (b000 hex)
    ## installed monitor, freq [204800000], status 0
    ## Booting kernel from Legacy Image at 88000000 ...
       Image Name:   Linux-3.10.10
       Created:      2014-08-05  17:01:10 UTC
       Image Type:   ARM Linux Kernel Image (uncompressed)
       Data Size:    3866384 Bytes = 3.7 MiB
       Load Address: 80008000
       Entry Point:  80008000
       Verifying Checksum ... OK
    ## Flattened Device Tree blob at 87000000
       Booting using the fdt blob at 0x87000000
       Loading Kernel Image ... OK
    OK
       Using Device Tree in place at 87000000, end 8700f6cb
    
    Starting kernel ...
    
    [    0.000000] Booting Linux on physical CPU 0x0
    [    0.000000] Linux version 3.10.10 (gtbldadm@ubuntu-12) (gcc version 4.7.3 20130226 (prerelease) (crosstool-NG linaro-1.13.1-4.
    7-2013.03-20130313 - Linaro GCC 2013.03) ) #1 SMP Tue Aug 5 13:00:56 EDT 2014
    [    0.000000] CPU: ARMv7 Processor [412fc0f4] revision 4 (ARMv7), cr=30c7387d
    [    0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
    [    0.000000] Machine: KeyStone2, model: Texas Instruments Keystone 2 SoC
    [    0.000000] cma: CMA: reserved 16 MiB at ae800000
    [    0.000000] Memory policy: ECC disabled, Data cache writealloc
    [    0.000000] On node 0 totalpages: 524288
    [    0.000000] free_area_init_node: node 0, pgdat c0766100, node_mem_map c079c000
    [    0.000000]   DMA zone: 1520 pages used for memmap
    [    0.000000]   DMA zone: 0 pages reserved
    [    0.000000]   DMA zone: 194560 pages, LIFO batch:31
    [    0.000000]   HighMem zone: 2576 pages used for memmap
    [    0.000000]   HighMem zone: 329728 pages, LIFO batch:31
    [    0.000000] PERCPU: Embedded 8 pages/cpu @c17bf000 s11840 r8192 d12736 u32768
    [    0.000000] pcpu-alloc: s11840 r8192 d12736 u32768 alloc=8*4096
    [    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 
    [    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 522768
    [    0.000000] Kernel command line: earlyprintk debug console=ttyS0,115200n8 ip=dhcp mem=2G rootwait=1 rootfstype=       root=/de
    v/nfs nfsroot=172.29.75.21:/usr/local/ks2_fs,v3,tcp rw
    [    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
    [    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
    [    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
    [    0.000000] Memory: 2048MB = 2048MB total
    [    0.000000] Memory: 2055428k/2055428k available, 41724k reserved, 1318912K highmem
    [    0.000000] Virtual kernel memory layout:
    [    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    [    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    [    0.000000]     vmalloc : 0xf0000000 - 0xff000000   ( 240 MB)
    [    0.000000]     lowmem  : 0xc0000000 - 0xef800000   ( 760 MB)
    [    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
    [    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
    [    0.000000]       .text : 0xc0008000 - 0xc06d6b40   (6971 kB)
    [    0.000000]       .init : 0xc06d7000 - 0xc0727e40   ( 324 kB)
    [    0.000000]       .data : 0xc0728000 - 0xc076cb88   ( 275 kB)
    [    0.000000]        .bss : 0xc076cb88 - 0xc079b674   ( 187 kB)
    [    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
    [    0.000000] Hierarchical RCU implementation.
    [    0.000000] NR_IRQS:16 nr_irqs:16 16
    [    0.000000] ipc irq: irqchip registered, range 512-539
    [    0.000000] Main PLL clk (1228800000 Hz), parent (122880000 Hz),postdiv = 2, mult = 19, prediv = 0
    [    0.000000] Generic PLL clk (1200000000 Hz), parent (125000000 Hz),postdiv = 1, mult = 47, prediv = 4
    [    0.000000] Generic PLL clk (983040000 Hz), parent (122880000 Hz),postdiv = 2, mult = 15, prediv = 0
    [    0.000000] Generic PLL clk (333333333 Hz), parent (100000000 Hz),postdiv = 6, mult = 19, prediv = 0
    [    0.000000] Generic PLL clk (333333333 Hz), parent (100000000 Hz),postdiv = 6, mult = 19, prediv = 0
    [    0.000000] Architected local timer running at 204.80MHz (phys).
    [    0.000000] Switching to timer-based delay loop
    [    0.000000] sched_clock: ARM arch timer >56 bits at 204800kHz, resolution 625/128ns
    [    0.000000] keystone timer clock @204800000 MHz
    [    0.000000] sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 4294967286ms
    [    0.000000] Console: colour dummy device 80x30
    [    7.721373] Calibrating delay loop (skipped), value calculated using timer frequency.. 409.60 BogoMIPS (lpj=2048000)
    [    7.721382] pid_max: default: 4096 minimum: 301
    [    7.721500] Mount-cache hash table entries: 512
    [    7.729988] CPU: Testing write buffer coherency: ok
    [    7.730168] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
    [    7.730179] Setting up static identity map for 0xc04d85d8 - 0xc04d860c
    [    7.777587] CPU1: Booted secondary processor
    [    7.777614] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
    [    7.824802] CPU2: Booted secondary processor
    [    7.824828] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
    [    7.872011] CPU3: Booted secondary processor
    [    7.872037] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
    [    7.872153] Brought up 4 CPUs
    [    7.872170] SMP: Total of 4 processors activated (1638.40 BogoMIPS).
    [    7.872175] CPU: All CPU(s) started in SVC mode.
    [    7.872619] devtmpfs: initialized
    [    7.885268] NET: Registered protocol family 16
    [    7.886225] DMA: preallocated 256 KiB pool for atomic coherent allocations
    [    7.895181] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
    [    7.895188] hw-breakpoint: maximum watchpoint size is 8 bytes.
    [    7.903425] bio: create slab <bio-0> at 0
    [    7.903716] keystone-pcie: keystone_pcie_rc_init - start
    [    7.903781] keystone2_pcie_serdes_setup
    [    7.905854] keystone2_pcie_serdes_setup done, en_link_train = 1
    [    7.905883] keystone-pcie: MEM 0x0000000050000000..0x000000005fffffff -> 0x0000000050000000 
    [    7.905892] keystone-pcie: IO 0x0000000024000000..0x0000000024003fff -> 0x0000000000000000
    [    7.905924] keystone-pcie: pcie - number of legacy irqs = 4
    [    7.905968] keystone-pcie: pcie - number of MSI host irqs = 8, msi_irqs = 32
    [    8.011360] keystone-pcie: Doing PCI Setup...Done
    [    8.011365] keystone-pcie: Starting PCI scan...
    [    8.011479] PCI host bridge to bus 0000:00
    [    8.011490] pci_bus 0000:00: root bus resource [mem 0x50000000-0x5fffffff]
    [    8.011497] pci_bus 0000:00: root bus resource [io  0x0000-0x3fff]
    [    8.011505] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
    [    8.011548] PCI: bus0: Fast back to back transfers enabled
    [    8.011556] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 00
    [    8.011563] keystone-pcie: Ending PCI scan...
    [    8.011570] keystone-pcie: keystone_pcie_rc_init - end
    [    8.011754] vgaarb: loaded
    [    8.012060] SCSI subsystem initialized
    [    8.012401] usbcore: registered new interface driver usbfs
    [    8.012479] usbcore: registered new interface driver hub
    [    8.012569] usbcore: registered new device driver usb
    [    8.012625] nop_usb_xceiv ssusb3_phy.8: Can't get phy clock: -2
    [    8.013626] pps_core: LinuxPPS API ver. 1 registered
    [    8.013632] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
    [    8.013691] PTP clock support registered
    [    8.013799] keystone-hwqueue hwqueue.6: qmgr start queue 0, number of queues 8192
    [    8.013875] keystone-hwqueue hwqueue.6: added qmgr start queue 0, num of queues 8192, reg_peek f0040000, reg_status f0006000, 
    reg_config f0008000, reg_region f000a000, reg_push f0080000, reg_pop f00c0000
    [    8.013884] keystone-hwqueue hwqueue.6: qmgr start queue 8192, number of queues 8192
    [    8.013956] keystone-hwqueue hwqueue.6: added qmgr start queue 8192, num of queues 8192, reg_peek f0100000, reg_status f000c40
    0, reg_config f000e000, reg_region f001a000, reg_push f0140000, reg_pop f0180000
    [    8.014749] keystone-hwqueue hwqueue.6: qos: sched port @8096, drop sched @8000
    [    8.015741] keystone-hwqueue hwqueue.6: qos: sched port @6496, drop sched @6400
    [    8.016712] keystone-hwqueue hwqueue.6: added pool pool-rio: 128 descriptors of size 256
    [    8.016722] keystone-hwqueue hwqueue.6: added pool pool-xge: 1024 descriptors of size 128
    [    8.016731] keystone-hwqueue hwqueue.6: added pool pool-crypto: 1024 descriptors of size 128
    [    8.016740] keystone-hwqueue hwqueue.6: added pool pool-net: 11264 descriptors of size 128
    [    8.016748] keystone-hwqueue hwqueue.6: added pool pool-udma: 1920 descriptors of size 256
    [    8.019617] keystone-hwqueue hwqueue.6: registered queues 0-16383
    [    8.019944] keystone-hwqueue hwqueue.6: qos version 0x2000107, magic valid
    [    8.020426] keystone-hwqueue hwqueue.6: qos version 0x2000107, magic valid
    [    8.031281] keystone-pktdma 2a08000.pktdma: registered 32 logical channels, flows 32, tx chans: 32, rx chans: 32, loopback
    [    8.034886] keystone-pktdma 2004000.pktdma: registered 33 logical channels, flows 32, tx chans: 9, rx chans: 24
    [    8.035397] keystone-pktdma 2fa1000.pktdma: registered 4 logical channels, flows 32, tx chans: 16, rx chans: 16
    [    8.035538] Switching to clocksource arch_sys_counter
    [    8.053702] NET: Registered protocol family 2
    [    8.054062] TCP established hash table entries: 8192 (order: 4, 65536 bytes)
    [    8.054175] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
    [    8.054283] TCP: Hash tables configured (established 8192 bind 8192)
    [    8.054329] TCP: reno registered
    [    8.054338] UDP hash table entries: 512 (order: 2, 16384 bytes)
    [    8.054362] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
    [    8.054541] NET: Registered protocol family 1
    [    8.054691] RPC: Registered named UNIX socket transport module.
    [    8.054697] RPC: Registered udp transport module.
    [    8.054702] RPC: Registered tcp transport module.
    [    8.054706] RPC: Registered tcp NFSv4.1 backchannel transport module.
    [    8.054713] PCI: CLS 0 bytes, default 64
    [    8.055061] hw perfevents: enabled with ARMv7 Cortex-A15 PMU driver, 7 counters available
    [    8.126132] bounce pool size: 64 pages
    [    8.133323] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
    [    8.133485] NTFS driver 2.1.30 [Flags: R/O].
    [    8.133708] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
    [    8.133996] msgmni has been set to 1470
    [    8.134868] NET: Registered protocol family 38
    [    8.135047] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
    [    8.135054] io scheduler noop registered
    [    8.135059] io scheduler deadline registered
    [    8.135172] io scheduler cfq registered (default)
    [    8.137827] keystone-udma udma0.7: registered udma device udma0
    [    8.189666] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
    [    8.191078] 2530c00.serial: ttyS0 at MMIO 0x2530c00 (irq = 309) is a 16550A
    [    9.081351] console [ttyS0] enabled
    [    9.085409] 2531000.serial: ttyS1 at MMIO 0x2531000 (irq = 312) is a 16550A
    [    9.095209] loop: module loaded
    [    9.098484] at24 0-0050: 131072 byte 24c1024 EEPROM, writable, 1 bytes/write
    [    9.106230] Generic platform RAM MTD, (c) 2004 Simtec Electronics
    [    9.113369] ONFI param page 0 valid
    [    9.116855] ONFI flash detected
    [    9.119986] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xac (Micron MT29F4G08ABBDAHC), 512MiB, page size: 2048, OOB size: 64
    [    9.131597] Bad block table found at page 262080, version 0x01
    [    9.137811] Bad block table found at page 262016, version 0x01
    [    9.143885] 3 ofpart partitions found on MTD device 30000000.nand
    [    9.149969] Creating 3 MTD partitions on "30000000.nand":
    [    9.155355] 0x000000000000-0x000000100000 : "u-boot"
    [    9.160932] 0x000000100000-0x000000180000 : "params"
    [    9.166455] 0x000000180000-0x000020000000 : "ubifs"
    [    9.172043] davinci_nand 30000000.nand: controller rev. 2.5
    [    9.178196] spi_davinci 21000400.spi: master is unqueued, this is deprecated
    [    9.185488] m25p80 spi32766.0: found n25q128a11, expected n25q128
    [    9.191577] m25p80 spi32766.0: n25q128a11 (16384 Kbytes)
    [    9.196888] 2 ofpart partitions found on MTD device spi32766.0
    [    9.202705] Creating 2 MTD partitions on "spi32766.0":
    [    9.207836] 0x000000000000-0x000000080000 : "u-boot-spl"
    [    9.213719] 0x000000080000-0x000001000000 : "test"
    [    9.219394] spi_davinci 21000400.spi: Controller at 0xf007a400
    [    9.225509] spi_davinci 21000600.spi: master is unqueued, this is deprecated
    [    9.232552] spi_davinci 21000600.spi: Controller at 0xf007c600
    [    9.238666] spi_davinci 21000800.spi: master is unqueued, this is deprecated
    [    9.245708] spi_davinci 21000800.spi: Controller at 0xf007e800
    [    9.252398] tun: Universal TUN/TAP device driver, 1.6
    [    9.257441] tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
    [    9.264025] keystone-netcp 2090000.netcp: missing num_serdes parameter
    [    9.270548] keystone-netcp 2090000.netcp: missing serdes_lanes parameter
    [    9.277240] keystone-netcp 2090000.netcp: missing serdes_ref_clk parameter
    [    9.284100] keystone-netcp 2090000.netcp: missing serdes_baud_rate parameter
    [    9.291139] keystone-netcp 2090000.netcp: missing serdes_rate_mode parameter
    [    9.298177] keystone-netcp 2090000.netcp: missing serdes_phy_intf parameter
    [    9.305123] keystone-netcp 2090000.netcp: missing serdes_loopback parameter
    [    9.312087] keystone-netcp 2090000.netcp: Missing cpts_clock_mult property in the DT.
    [    9.319906] keystone-netcp 2090000.netcp: Missing cpts_clock_shift property in the DT.
    [    9.327811] keystone-netcp 2090000.netcp: Missing cpts_clock_div property in the DT.
    [    9.336382] keystone-netcp 2090000.netcp: Created interface "eth0"
    [    9.342553] keystone-netcp 2090000.netcp: dma_chan_name nettx0
    [    9.349141] keystone-netcp 2090000.netcp: Created interface "eth1"
    [    9.355311] keystone-netcp 2090000.netcp: dma_chan_name nettx1
    [    9.361894] keystone-netcp 2090000.netcp: Created interface "eth2"
    [    9.368072] keystone-netcp 2090000.netcp: dma_chan_name nettx2
    [    9.374650] keystone-netcp 2090000.netcp: Created interface "eth3"
    [    9.380829] keystone-netcp 2090000.netcp: dma_chan_name nettx3
    [    9.386833] keystone-netcp 2090000.netcp: could not find interface 2 node in device tree
    [    9.394908] keystone-netcp 2090000.netcp: Attach of module keystone-qos declined with -19
    [    9.403077] keystone-netcp 2090000.netcp: could not find interface 3 node in device tree
    [    9.411157] keystone-netcp 2090000.netcp: Attach of module keystone-qos declined with -19
    [    9.419335] keystone-netcp 2090000.netcp: Attach of module keystone-sa declined with -19
    [    9.427415] keystone-netcp 2090000.netcp: Attach of module keystone-sa declined with -19
    [    9.436195] nop_usb_xceiv nop_usb_xceiv.0: Can't get phy clock: -2
    [    9.442462] nop_usb_xceiv nop_usb_xceiv.1: Can't get phy clock: -2
    [    9.448666] keystone-dwc3 2690000.dwc: usbss revision 47914300
    [    9.454506] keystone-dwc3 2690000.dwc: mapped irq 425 to virq 608
    [    9.662223] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
    [    9.667712] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
    [    9.675994] xhci-hcd xhci-hcd.0.auto: irq 608, io mem 0x02690000
    [    9.682025] usb usb1: default language 0x0409
    [    9.686420] usb usb1: udev 1, busnum 1, minor = 0
    [    9.691113] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
    [    9.697898] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [    9.705105] usb usb1: Product: xHCI Host Controller
    [    9.709979] usb usb1: Manufacturer: Linux 3.10.10 xhci-hcd
    [    9.715450] usb usb1: SerialNumber: xhci-hcd.0.auto
    [    9.720572] usb usb1: usb_probe_device
    [    9.724311] usb usb1: configuration #1 chosen from 1 choice
    [    9.729889] xHCI xhci_add_endpoint called for root hub
    [    9.735014] xHCI xhci_check_bandwidth called for root hub
    [    9.740427] usb usb1: adding 1-0:1.0 (config #1, interface 0)
    [    9.746287] hub 1-0:1.0: usb_probe_interface
    [    9.750547] hub 1-0:1.0: usb_probe_interface - got id
    [    9.755600] hub 1-0:1.0: USB hub found
    [    9.759346] hub 1-0:1.0: 1 port detected
    [    9.763257] hub 1-0:1.0: standalone hub
    [    9.767086] hub 1-0:1.0: individual port power switching
    [    9.772384] hub 1-0:1.0: individual port over-current protection
    [    9.778380] hub 1-0:1.0: Single TT
    [    9.781770] hub 1-0:1.0: TT requires at most 8 FS bit times (666 ns)
    [    9.788114] hub 1-0:1.0: power on to power good time: 20ms
    [    9.793594] hub 1-0:1.0: local power source is good
    [    9.798496] hub 1-0:1.0: enabling power on all ports
    [    9.803537] xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
    [    9.809017] xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2
    [    9.816693] usb usb2: skipped 1 descriptor after endpoint
    [    9.822082] usb usb2: default language 0x0409
    [    9.826446] usb usb2: udev 1, busnum 2, minor = 128
    [    9.831311] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003
    [    9.838089] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [    9.845296] usb usb2: Product: xHCI Host Controller
    [    9.850164] usb usb2: Manufacturer: Linux 3.10.10 xhci-hcd
    [    9.855640] usb usb2: SerialNumber: xhci-hcd.0.auto
    [    9.860735] usb usb2: usb_probe_device
    [    9.864473] usb usb2: configuration #1 chosen from 1 choice
    [    9.870049] xHCI xhci_add_endpoint called for root hub
    [    9.875173] xHCI xhci_check_bandwidth called for root hub
    [    9.880582] usb usb2: adding 2-0:1.0 (config #1, interface 0)
    [    9.886431] hub 2-0:1.0: usb_probe_interface
    [    9.890690] hub 2-0:1.0: usb_probe_interface - got id
    [    9.895743] hub 2-0:1.0: USB hub found
    [    9.899487] hub 2-0:1.0: 1 port detected
    [    9.903398] hub 2-0:1.0: standalone hub
    [    9.907238] hub 2-0:1.0: individual port power switching
    [    9.912536] hub 2-0:1.0: individual port over-current protection
    [    9.918544] hub 2-0:1.0: TT requires at most 8 FS bit times (666 ns)
    [    9.924882] hub 2-0:1.0: power on to power good time: 20ms
    [    9.930374] hub 2-0:1.0: local power source is good
    [    9.935269] hub 2-0:1.0: enabling power on all ports
    [    9.940361] hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0000
    [    9.945862] hub 1-0:1.0: hub_suspend
    [    9.945971] usbcore: registered new interface driver usb-storage
    [    9.955422] usb usb1: bus auto-suspend, wakeup 1
    [    9.955809] mousedev: PS/2 mouse device common for all mice
    [    9.956010] i2c /dev entries driver
    [    9.956613] watchdog 22f0080.wdt: heartbeat 60 sec
    [    9.968802] keystone-crypto 20c0000.crypto: crypto accelerator enabled
    [    9.969117] usbcore: registered new interface driver usbhid
    [    9.969118] usbhid: USB HID core driver
    [    9.969440]  remoteproc0: 2620040.dsp0 is available
    [    9.969443]  remoteproc0: Note: remoteproc is still under development and considered experimental.
    [    9.969445]  remoteproc0: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.
    [    9.969470]  remoteproc0: no firmware found
    [    9.969585] rproc-user 2620040.dsp0: registered misc device dsp0
    [    9.969808]  remoteproc1: 2620044.dsp1 is available
    [    9.969810]  remoteproc1: Note: remoteproc is still under development and considered experimental.
    [    9.969812]  remoteproc1: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.
    [    9.969834]  remoteproc1: no firmware found
    [    9.969957] rproc-user 2620044.dsp1: registered misc device dsp1
    [    9.970170]  remoteproc2: 2620048.dsp2 is available
    [    9.970172]  remoteproc2: Note: remoteproc is still under development and considered experimental.
    [    9.970174]  remoteproc2: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.
    [    9.970205]  remoteproc2: no firmware found
    [    9.970321] rproc-user 2620048.dsp2: registered misc device dsp2
    [    9.970536]  remoteproc3: 262004c.dsp3 is available
    [    9.970538]  remoteproc3: Note: remoteproc is still under development and considered experimental.
    [    9.970540]  remoteproc3: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.
    [    9.970561]  remoteproc3: no firmware found
    [    9.970676] rproc-user 262004c.dsp3: registered misc device dsp3
    [    9.970888]  remoteproc4: 2620050.dsp4 is available
    [    9.970890]  remoteproc4: Note: remoteproc is still under development and considered experimental.
    [    9.970892]  remoteproc4: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.
    [    9.970914]  remoteproc4: no firmware found
    [    9.971032] rproc-user 2620050.dsp4: registered misc device dsp4
    [    9.971249]  remoteproc5: 2620054.dsp5 is available
    [    9.971251]  remoteproc5: Note: remoteproc is still under development and considered experimental.
    [    9.971253]  remoteproc5: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.
    [    9.971274]  remoteproc5: no firmware found
    [    9.971394] rproc-user 2620054.dsp5: registered misc device dsp5
    [    9.971608]  remoteproc6: 2620058.dsp6 is available
    [    9.971610]  remoteproc6: Note: remoteproc is still under development and considered experimental.
    [    9.971612]  remoteproc6: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.
    [    9.971634]  remoteproc6: no firmware found
    [    9.971757] rproc-user 2620058.dsp6: registered misc device dsp6
    [    9.971971]  remoteproc7: 262005c.dsp7 is available
    [    9.971974]  remoteproc7: Note: remoteproc is still under development and considered experimental.
    [    9.971976]  remoteproc7: THE BINARY FORMAT IS NOT YET FINALIZED, and backward compatibility isn't yet guaranteed.
    [    9.971997]  remoteproc7: no firmware found
    [    9.972117] rproc-user 262005c.dsp7: registered misc device dsp7
    [    9.972139] rproc-user dspmem.9: kick gpio
    [    9.972256] rproc-user dspmem.9: registered misc device dspmem
    [    9.972550] oprofile: using arm/armv7-ca15
    [    9.972666] ipip: IPv4 over IPv4 tunneling driver
    [    9.973046] gre: GRE over IPv4 demultiplexor driver
    [    9.973049] ip_gre: GRE over IPv4 tunneling driver
    [    9.973810] TCP: cubic registered
    [    9.973812] Initializing XFRM netlink socket
    [    9.974256] NET: Registered protocol family 10
    [    9.975338] NET: Registered protocol family 17
    [    9.975352] NET: Registered protocol family 15
    [    9.975403] Bridge firewalling registered
    [    9.975410] 8021q: 802.1Q VLAN Support v1.8
    [    9.977166] sctp: Hash tables configured (established 65536 bind 65536)
    [    9.977297] NET: Registered protocol family 41
    [   10.332181] VFP support v0.3: [   10.332231] hub 2-0:1.0: state 7 ports 1 chg 0000 evt 0000
    [   10.332252] hub 2-0:1.0: hub_suspend
    [   10.332260] usb usb2: bus auto-suspend, wakeup 1
    implementor 41 architecture 4 part 30 variant f rev 0
    [   10.353472] Registering SWP/SWPB emulation handler
    [   10.362777] keystone-netcp 2090000.netcp: initializing cpsw version 1.3 (1) SGMII identification value 0x4ed1
    [   10.372826] keystone-netcp 2090000.netcp: Created a cpsw ale engine
    [   10.465891] pps pps0: new PPS source ptp0
    [   10.469903] cpts rftclk rate(614400000 HZ),mult(5000),shift(10),div(3)
    [   10.510823] keystone-netcp 2090000.netcp: Using Packet Accelerator Firmware version 0x03000009
    [   10.519430] keystone-netcp 2090000.netcp: pa_clk_rate(163840000 HZ),mult(25000),shift(12)
    [   10.806279] net eth0: netcp device eth0 opened
    [   10.813004] 8021q: adding VLAN 0 to HW filter on device eth0
    [   10.818690] net eth0: adding rx vlan id: 0
    [   10.823365] keystone-netcp 2090000.netcp: initializing cpsw version 1.3 (1) SGMII identification value 0x4ed1
    [   11.256251] net eth1: netcp device eth1 opened
    [   11.261937] 8021q: adding VLAN 0 to HW filter on device eth1
    [   11.267611] net eth1: adding rx vlan id: 0
    [   11.272291] keystone-netcp 2090000.netcp: initializing cpsw version 1.3 (1) SGMII identification value 0x4ed1
    [   11.516237] net eth2: netcp device eth2 opened
    [   11.521295] IPv6: ADDRCONF(NETDEV_UP): eth2: link is not ready
    [   11.527173] 8021q: adding VLAN 0 to HW filter on device eth2
    [   11.532819] net eth2: adding rx vlan id: 0
    [   11.537531] keystone-netcp 2090000.netcp: initializing cpsw version 1.3 (1) SGMII identification value 0x4ed1
    [   11.786237] net eth3: netcp device eth3 opened
    [   11.791296] IPv6: ADDRCONF(NETDEV_UP): eth3: link is not ready
    [   11.797176] 8021q: adding VLAN 0 to HW filter on device eth3
    [   11.802823] net eth3: adding rx vlan id: 0
    [   11.806968] IP-Config: Failed to open gretap0
    [   11.825575] Sending DHCP requests ., OK
    [   11.905576] IP-Config: Got DHCP answer from 10.100.1.1, my address is 10.100.1.102
    [   14.335725] net eth1: removing rx vlan id: 0
    [   15.165640] net eth2: removing rx vlan id: 0
    [   16.005636] net eth3: removing rx vlan id: 0
    [   16.010618] IP-Config: Complete:
    [   16.013839]      device=eth0, hwaddr=c4:ed:ba:a9:a3:6b, ipaddr=10.100.1.102, mask=255.255.255.0, gw=10.100.1.1
    [   16.023830]      host=10.100.1.102, domain=chennaiodc.lntinfotech.com, nis-domain=(none)
    [   16.031915]      bootserver=0.0.0.0, rootserver=172.29.75.21, rootpath=
    [   16.038349]      nameserver0=172.29.16.38, nameserver1=172.25.8.25
    [   16.051350] VFS: Mounted root (nfs filesystem) on device 0:12.
    [   16.057596] devtmpfs: mounted
    [   16.060712] Freeing unused kernel memory: 320K (c06d7000 - c0727000)
    INIT: version 2.88 booting
    Starting udev
    [   16.652368] udev[1294]: starting version 164
    Starting Bootlog daemon: bootlogd.
    NOT configuring network interfaces: / is an NFS mount
    net.ipv4.conf.default.rp_filter = 1
    net.ipv4.conf.all.rp_filter = 1
    Sun Nov 24 22:39:00 UTC 2013
    INIT: Entering runlevel: 5
    Starting system message bus: dbus.
    Starting Dropbear SSH server: dropbear.
    Starting mpmsrv daemon.
    Starting telnet daemon.
    #>>>>> LCD 12
    IP Address:
    10.100.1.102
    Starting tiipclad daemon.
    Starting network benchmark server: netserver.
    Starting syslog-ng:.
    Starting thttpd.
    Starting Lighttpd Web Server: lighttpd.
    2013-11-24 22:39:01: (log.c.166) server started 
    * starting FTP Server: vsftpd... done.
    ***************************************************************
    ***************************************************************
    NOTICE: This file system contains the followin GPLv3 packages:
            binutils-symlinks
            binutils
            gdb
            gdbserver
    
    If you do not wish to distribute GPLv3 components please remove
    the above packages prior to distribution.  This can be done using
    the opkg remove command.  i.e.:
        opkg remove <package>
    Where <package> is the name printed in the list above
    
    NOTE: If the package is a dependency of another package you
          will be notified of the dependent packages.  You should
          use the --force-removal-of-dependent-packages option to
          also remove the dependent packages as well
    ***************************************************************
    ***************************************************************
    Stopping Bootlog daemon: bootlogd.
    
     _____                    _____           _         _   
    |  _  |___ ___ ___ ___   |  _  |___ ___  |_|___ ___| |_ 
    |     |  _| .'| . | . |  |   __|  _| . | | | -_|  _|  _|
    |__|__|_| |__,|_  |___|  |__|  |_| |___|_| |___|___|_|  
                  |___|                    |___|            
    
    Arago Project http://arago-project.org keystone-evm ttyS0
    
    Arago 2013.04 keystone-evm ttyS0
    
    keystone-evm login: root
    root@keystone-evm:~# cd /
    root@keystone-evm:/# 
    root@keystone-evm:/# insmod gpio_irq_ks2.ko 
    [   26.399272] BINTEN = 00000003
    [   26.399272] DIR = ffffffff
    [   26.399272] OUTDATA =   (null)
    [   26.399272] SETDATA =   (null)
    [   26.399272] CLRDATA =   (null)
    [   26.399272] INDATA = 00000001
    [   26.399272] SETRISTRIG =   (null)
    [   26.399272] CLRRISTRIG =   (null)
    [   26.399272] SETFALTRIG =   (null)
    [   26.399272] CLRFALTRIG =   (null)
    [   26.430186] gpio_ctrl : GPIO NO: 10 Status 0
    [   26.434447] IRQ is 550
    [   26.436926] gpio_request_irq 550 status 0
    [   26.436928] GPIO IRQ device is inserted sucessfully
    root@keystone-evm:/# 2013 Nov 24 22:39:08 keystone-evm [   26.430186] gpio_ctrl : GPIO NO: 10 Status 0
    2013 Nov 24 22:39:08 keystone-evm [   26.434447] IRQ is 550
    2013 Nov 24 22:39:08 keystone-evm [   26.436928] GPIO IRQ device is inserted sucessfully
    
    root@keystone-evm:/# 
    root@keystone-evm:/# 
    root@keystone-evm:/# 
    root@keystone-evm:/# insmod pps-atvtimer.ko 
    [   67.537984] pps pps1: new PPS source ppstimer
    [   67.542333] pps pps1: atvtimer PPS source registered
    root@keystone-evm:/# 
    root@keystone-evm:/# 
    root@keystone-evm:/# 
    root@keystone-evm:/# [   85.955573] PPS event at 4294945120
    [   86.431852] PPS event at 4294945167
    
    

  • Hi Titus, Rajashekaran

    Thanks a lot for your support.  I finally got it working now. There are some issues which requires clarification and changes.

    1. With K2_LINUX_03.10.10_14.07 release, DTS entry for GPIO, I could not see GPIO entry in /sys/class/gpio

    Unfortunately, I could not switch back to older version.  I am was unable  to get GPIO driver working with the DTS entry with K2_LINUX_03.10.10_14.07 release.  However, the below entry was used in your earlier releases and this initializes the Keystone GPIO. I used the below entry for getting GPIO driver.

    gpio0: gpio@260bf00 {
                           compatible = "ti,keystone-gpio";
                           reg = <0x0260bf00 0x10
                                   0x0260bf10 0x28>;
                          gpio-controller;
                           #gpio-cells = <2>;
                           /* HW Interrupts mapped to GPIO pins */
                           interrupts = <0 120 0xf01 0 121 0xf01 0 122 0xf01 0 123 0xf01 0 124 0xf01
                                           0 125 0xf01 0 126 0xf01 0 127 0xf01 0 128 0xf01 0 129 0xf01
                                           0 130 0xf01 0 131 0xf01 0 132 0xf01 0 133 0xf01 0 134 0xf01
                                           0 135 0xf01 0 136 0xf01 0 137 0xf01 0 138 0xf01 0 139 0xf01
                                           0 140 0xf01 0 141 0xf01 0 142 0xf01 0 143 0xf01 0 144 0xf01
                                           0 145 0xf01 0 146 0xf01 0 147 0xf01 0 148 0xf01 0 149 0xf01
                                           0 150 0xf01 0 151 0xf01>;
                           interrupt-controller;
                           #interrupt-cells = <2>;
                           clocks = <&clkgpio>;
                           clock-names = "gpio";
                   };
    2.  Even though IRQ_TYPE_EDGE_FALLING is configured in the kernel module, it had no effect.  I had to explicitly configure from user space.
    echo 16 > /sys/class/gpio/export
    echo falling >  /sys/class/gpio/gpio16/edge
     echo 16 > /sys/class/gpio/unexport
    3. The PPS signal from FPGA to CPU is connected through level-shifter buffer whose output enable is controlled by GPIO line 0.  GPIO line 0 was configured as Output in u-boot. Keystone2 GPIO driver in linux configures all GPIO lines as input and overrides U-boot setting which is very unusual.  So we lost the PPS signal when Keystone GPIO driver was initialized.
    With the above fixes, we now have working PPS driver.
    Thanks
    Rams
       
  • Hi,

    You have still not clarified how do we configure bank 1 16 GPIO lines, the Keystone GPIO user guide only has information for configuring first 16 GPIO lines.

    Could you please provide us with updated GPIO user guide for Keystone 2?

    Thnaks

    Rams

  • Hi Rams,

    2.  Even though IRQ_TYPE_EDGE_FALLING is configured in the kernel module, it had no effect.  I had to explicitly configure from user space.
    echo 16 > /sys/class/gpio/export
    echo falling >  /sys/class/gpio/gpio16/edge
     echo 16 > /sys/class/gpio/unexport

    As I said earlier, we were able to get the events (ISR called) without changing anything in the driver.

    You have still not clarified how do we configure bank 1 16 GPIO lines, the Keystone GPIO user guide only has information for configuring first 16 GPIO lines.

    I think GPIO16 is from BANK 1 right ?
    From the dts file, the GPIO driver was initialized for all the GPIOs (32), Have you tried to access the other GPIOs from BANK1 ?
    Any issues?
  • Hi Rams,

    2.  Even though IRQ_TYPE_EDGE_FALLING is configured in the kernel module, it had no effect.  I had to explicitly configure from user space.
    echo 16 > /sys/class/gpio/export
    echo falling >  /sys/class/gpio/gpio16/edge
     echo 16 > /sys/class/gpio/unexport

    It could be your module driver issue and have you tried this time my "gpio_irq.c" which is attached in my previous reply.
    Instead of doing this user space configuration, you can follow second step to work or get a event.
    I curious about this behavior.
    I suspect that you've missed the "IRQ_TYPE' while you registering the IRQ.
    Could you please change your driver like below or check your driver.
    1)
        ret = request_irq(pps_virq, pps_atvirq_handler, 0,
                  "gpio_16_pps_atvtimer", NULL);

    CHANGE TO
        ret = request_irq(pps_virq, pps_atvirq_handler, IRQF_TRIGGER_FALLING,
                  "gpio_16_pps_atvtimer", NULL);

    2) Else,
    You have to insert the driver in two times to get a event.
    insmod gpio.ko
    rmmod gpio.ko
    insmod gpio.ko
    Now you may get event.
    Please confirm this experiments on your end.
    I'm able to reproduce this behavior when I registering the IRQ (request_irq) with out IRQ type mentioning.
    Please double check your interrupt module driver.
    I would like to suggest to use the attached binaries an let us know the results.
  • Hi Rams,

    You have still not clarified how do we configure bank 1 16 GPIO lines, the Keystone GPIO user guide only has information for configuring first 16 GPIO lines.

    Could you please provide us with updated GPIO user guide for Keystone 2?

    GPIO user guide needs to be updated for BINTEN register that bit 0 is for Bank 0 (GPIO pins 15:0) and bit 1 is for Bank 1 (GPIO pins 31-16).

    GPIO_BITEN = 0x1 ; //Bank 0 Enable

    GPIO_BITEN = 0x2 ; //Bank 1 Enable

    GPIO_BITEN = 0x3 ; //Bank 0 & 1 Enable

    http://e2e.ti.com/support/dsp/c6000_multi-core_dsps/f/639/p/311851/1085153.aspx#1085153

    There is no reserve fields in set and clear registers, they are used for GPIO16-31.

    I hope this answers your query.

    Thank you.

  • Hello Rajashekaran, Titus,

    Thanks a lot for your support.

    Thanks

    Rams

  • Hi Titus,

    I havent verified this, will check and let you know.

    Thanks

    Rams

  • Hi Titus,

    Now I have changed the IRQ_TYPE while registering the IRQ.  This works and I dont have to do the user space configuration.

    ret = request_irq(pps_virq, pps_atvirq_handler, IRQF_TRIGGER_FALLING
                  "gpio_16_pps_atvtimer", NULL);

     

    Thanks

    Rams

  • Hi Rams,

    Glad to hear from you. Thank you for the update. 

  • Hi Rams,

    Sounds good.