UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Visitor benjaminbuck
Visitor
5,732 Views
Registered: ‎08-26-2016

Zyqn / petalinux GPIO issue

Jump to solution

I realized I posted this in the wrong forum...moving from the 7 series FPGA forum:

 

Using a ZC702 development board, Vivado 2015.4 and Petalinux 2015.4, I'm having a ton of trouble using GPIO with the gpio-keys driver.  My very simple project is a Zynq SOC with a one bit wide EMIO GPIO pin connected to output G19 (SW5 on the ZC702).  I add an entry in my petalinux device tree to map this to the "up" keycode, build everything, boot up my board from SD card and do a "cat /dev/inputevent0 | hexdump"

 

Nothing shows up when I press the switch.  However, I noticed that when I removed the SD card I started getting events whether or not I was pressing the switch:

root@bmbSimple:~# cat /dev/input/event0 | hexdump
0000000 0698 0000 23c1 000b 0001 006c 0002 0000
0000010 0698 0000 23c1 000b 0000 0000 0001 0000
0000020 0698 0000 bfe6 000b 0001 006c 0002 0000
0000030 0698 0000 bfe6 000b 0000 0000 0001 0000
0000040 0698 0000 5c27 000c 0001 006c 0002 0000
0000050 0698 0000 5c27 000c 0000 0000 0001 0000
0000060 0698 0000 f866 000c 0001 006c 0002 0000
0000070 0698 0000 f866 000c 0000 0000 0001 0000
0000080 0698 0000 94a6 000d 0001 006c 0002 0000
0000090 0698 0000 94a6 000d 0000 0000 0001 0000
00000a0 0698 0000 30e6 000e 0001 006c 0002 0000
00000b0 0698 0000 30e6 000e 0000 0000 0001 0000
00000c0 0698 0000 cd25 000e 0001 006c 0002 0000
00000d0 0698 0000 cd25 000e 0000 0000 0001 0000
00000e0 0699 0000 2726 0000 0001 006c 0002 0000
00000f0 0699 0000 2726 0000 0000 0000 0001 0000
0000100 0699 0000 c366 0000 0001 006c 0002 0000
0000110 0699 0000 c366 0000 0000 0000 0001 0000
0000120 0699 0000 5fa5 0001 0001 006c 0002 0000

I think I'm missing something very fundamental here... this should be so simple but I cannot get it to work!  What is going on?

 

I added keys.dtsi as an include to my device tree:

&amba {
 gpio-keys {
 compatible = "gpio-keys";
 #address-cells = <1>;
 #size-cells = <0>;
 autorepeat;
 mysw {
 label = "mysw";
 gpios = <&gpio0 0 0>;
 linux,code = <108>; //down
 gpio-key,wakeup;
 autorepeat;
 };
 };
};

dmesg looks like:

Booting Linux on physical CPU 0x0
Linux version 4.0.0-xilinx (be25424@ll99-bob) (gcc version 4.9.2 (Sourcery CodeBench Lite 2015.05-17) ) #4 SMP PREEMPT Fri Aug 26 12:31:20 EDT 2016
CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: bombSimple
bootconsole [earlycon0] enabled
cma: Reserved 16 MiB at 0x3f000000
Memory policy: Data cache writealloc
On node 0 totalpages: 262144
free_area_init_node: node 0, pgdat c0983080, node_mem_map eeff7000
  Normal zone: 1520 pages used for memmap
  Normal zone: 0 pages reserved
  Normal zone: 194560 pages, LIFO batch:31
  HighMem zone: 67584 pages, LIFO batch:15
PERCPU: Embedded 11 pages/cpu @eefd4000 s12672 r8192 d24192 u45056
pcpu-alloc: s12672 r8192 d24192 u45056 alloc=11*4096
pcpu-alloc: [0] 0 [0] 1
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 260624
Kernel command line: console=ttyPS0,115200 earlyprintk
PID hash table entries: 4096 (order: 2, 16384 bytes)
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
Memory: 1013080K/1048576K available (4759K kernel code, 223K rwdata, 1708K rodata, 3020K init, 208K bss, 19112K reserved, 16384K cma-reserved, 253952K highmem)
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    vmalloc : 0xf0000000 - 0xff000000   ( 240 MB)
    lowmem  : 0xc0000000 - 0xef800000   ( 760 MB)
    pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
    modules : 0xbf000000 - 0xbfe00000   (  14 MB)
      .text : 0xc0008000 - 0xc0658efc   (6468 kB)
      .init : 0xc0659000 - 0xc094c000   (3020 kB)
      .data : 0xc094c000 - 0xc0983de0   ( 224 kB)
       .bss : 0xc0983de0 - 0xc09b80f4   ( 209 kB)
Preemptible hierarchical RCU implementation.
        Additional per-CPU info printed with stalls.
        RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
NR_IRQS:16 nr_irqs:16 16
L2C: platform modifies aux control register: 0x72360000 -> 0x72760000
L2C: DT/platform modifies aux control register: 0x72360000 -> 0x72760000
L2C-310 erratum 769419 enabled
L2C-310 enabling early BRESP for Cortex-A9
L2C-310 full line of zeros enabled for Cortex-A9
L2C-310 ID prefetch enabled, offset 1 lines
L2C-310 dynamic clock gating enabled, standby mode enabled
L2C-310 cache controller enabled, 8 ways, 512 kB
L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x76760001
slcr mapped to f0006000
zynq_clock_init: clkc starts at f0006100
Zynq clock init
sched_clock: 64 bits at 333MHz, resolution 3ns, wraps every 3298534883328ns
timer #0 at f000a000, irq=17
Console: colour dummy device 80x30
Calibrating delay loop... 1332.01 BogoMIPS (lpj=6660096)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
CPU: Testing write buffer coherency: ok
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
Setting up static identity map for 0x481788 - 0x4817e0
CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
Brought up 2 CPUs
SMP: Total of 2 processors activated (2664.03 BogoMIPS).
CPU: All CPU(s) started in SVC mode.
devtmpfs: initialized
VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
cpuidle: using governor ladder
cpuidle: using governor menu
hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
hw-breakpoint: maximum watchpoint size is 4 bytes.
zynq-ocm f800c000.ocmc: ZYNQ OCM pool: 256 KiB @ 0xf0080000
vgaarb: loaded
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
media: Linux media interface: v0.10
Linux video capture interface: v2.00
pps_core: LinuxPPS API ver. 1 registered
pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
PTP clock support registered
EDAC MC: Ver: 3.0.0
Advanced Linux Sound Architecture Driver Initialized.
Switched to clocksource arm_global_timer
NET: Registered protocol family 2
TCP established hash table entries: 8192 (order: 3, 32768 bytes)
TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
TCP: reno registered
UDP hash table entries: 512 (order: 2, 16384 bytes)
UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
PCI: CLS 0 bytes, default 64
hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7 counters available
futex hash table entries: 512 (order: 3, 32768 bytes)
jffs2: version 2.2. (NAND) (SUMMARY)  © 2001-2006 Red Hat, Inc.
bounce: pool size: 64 pages
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
zynq-pinctrl 700.pinctrl: zynq pinctrl initialized
dma-pl330 f8003000.dmac: Loaded driver for PL330 DMAC-241330
dma-pl330 f8003000.dmac:        DBUFF-128x8bytes Num_Chans-8 Num_Peri-4 Num_Events-16
e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 145, base_baud = 3125000) is a xuartps
console [ttyPS0] enabled
bootconsole [earlycon0] disabled
xdevcfg f8007000.devcfg: ioremap 0xf8007000 to f006c000
[drm] Initialized drm 1.1.0 20060810
brd: module loaded
loop: module loaded
CAN device driver interface
libphy: MACB_mii_bus: probed
macb e000b000.ethernet eth0: Cadence GEM rev 0x00020118 at 0xe000b000 irq 147 (00:0a:35:00:1e:53)
macb e000b000.ethernet eth0: attached PHY driver [Marvell 88E1116R] (mii_bus:phy_addr=e000b000.etherne:07, irq=-1)
e1000e: Intel(R) PRO/1000 Network Driver - 2.3.2-k
e1000e: Copyright(c) 1999 - 2014 Intel Corporation.
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci-pci: EHCI PCI platform driver
usbcore: registered new interface driver usb-storage
mousedev: PS/2 mouse device common for all mice
i2c /dev entries driver
cdns-i2c e0004000.i2c: 400 kHz mmio e0004000 irq 142
Xilinx Zynq CpuIdle Driver started
Driver 'mmcblk' needs updating - please use bus_type methods
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
sdhci-pltfm: SDHCI platform and OF driver helper
sdhci-arasan e0100000.sdhci: No vmmc regulator found
sdhci-arasan e0100000.sdhci: No vqmmc regulator found
mmc0: SDHCI controller on e0100000.sdhci [e0100000.sdhci] using ADMA
ledtrig-cpu: registered to indicate activity on CPUs
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
TCP: cubic registered
NET: Registered protocol family 17
can: controller area network core (rev 20120528 abi 9)
NET: Registered protocol family 29
can: raw protocol (rev 20120528)
can: broadcast manager protocol (rev 20120528 t)
can: netlink gateway (rev 20130117) max_hops=1
Registering SWP/SWPB emulation handler
input: amba:gpio-keys as /devices/soc0/amba/amba:gpio-keys/input/input0
/opt/pkg/petalinux-v2015.4-final/components/linux-kernel/xlnx-4.0/drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
ALSA device list:
  No soundcards found.
Freeing unused kernel memory: 3020K (c0659000 - c094c000)
mmc0: new high speed SDHC card at address aaaa
mmcblk0: mmc0:aaaa SS08G 7.40 GiB
 mmcblk0: p1
FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
random: dd urandom read with 1 bits of entropy available
mmc0: card aaaa removed
mmc0: new high speed SDHC card at address aaaa
mmcblk0: mmc0:aaaa SS08G 7.40 GiB
 mmcblk0: p1
mmc0: card aaaa removed
mmc0: new high speed SDHC card at address aaaa
mmcblk0: mmc0:aaaa SS08G 7.40 GiB
 mmcblk0: p1
mmc0: card aaaa removed
mmc0: new high speed SDHC card at address aaaa
mmcblk0: mmc0:aaaa SS08G 7.40 GiB
 mmcblk0: p1
random: nonblocking pool is initialized
mmc0: card aaaa removed

Checked the xcd file, pin being routed to G19 as designed:

bmbSimpleSch.png

0 Kudos
1 Solution

Accepted Solutions
Teacher muzaffer
Teacher
10,307 Views
Registered: ‎03-31-2012

Re: Zyqn / petalinux GPIO issue

Jump to solution
is it possible that the sd detect is connected to emio 0 and not your pin? make sure there is really one emio (and that's not sd detect) or make your emio the second bit.
- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.

View solution in original post

0 Kudos
4 Replies
Explorer
Explorer
5,722 Views
Registered: ‎04-05-2016

Re: Zyqn / petalinux GPIO issue

Jump to solution
Is your emio width set to 1 in the gpio dts entry?
0 Kudos
Visitor benjaminbuck
Visitor
5,718 Views
Registered: ‎08-26-2016

Re: Zyqn / petalinux GPIO issue

Jump to solution

Yep, the following is in pcw.dtsi

&gpio0 {
        emio-gpio-width = <1>;
        gpio-mask-high = <0x0>;
        gpio-mask-low = <0x5600>;
};

After I build Petalinux, I can run "./build/linux/kernel/xlnx-4.0/scripts/dtc/dtc -I dtb -O dts -o system.dts images/linux/system.dtb" and output the entire device tree, which looks as it should (I think):

/dts-v1/;

/ {
        #address-cells = <0x1>;
        #size-cells = <0x1>;
        compatible = "xlnx,zynq-7000";
        model = "bombSimple";

        chosen {
                bootargs = "console=ttyPS0,115200 earlyprintk";
        };

        aliases {
                serial0 = "/amba/serial@e0001000";
                ethernet0 = "/amba/ethernet@e000b000";
                spi0 = "/amba/spi@e000d000";
        };

        memory {
                device_type = "memory";
                reg = <0x0 0x40000000>;
        };

        cpus {
                #address-cells = <0x1>;
                #size-cells = <0x0>;

                cpu@0 {
                        compatible = "arm,cortex-a9";
                        device_type = "cpu";
                        reg = <0x0>;
                        clocks = <0x1 0x3>;
                        clock-latency = <0x3e8>;
                        cpu0-supply = <0x2>;
                        operating-points = <0xa2c2a 0xf4240 0x51615 0xf4240>;
                };

                cpu@1 {
                        compatible = "arm,cortex-a9";
                        device_type = "cpu";
                        reg = <0x1>;
                        clocks = <0x1 0x3>;
                };
        };

        pmu {
                compatible = "arm,cortex-a9-pmu";
                interrupts = <0x0 0x5 0x4 0x0 0x6 0x4>;
                interrupt-parent = <0x3>;
                reg = <0xf8891000 0x1000 0xf8893000 0x1000>;
        };

        fixedregulator@0 {
                compatible = "regulator-fixed";
                regulator-name = "VCCPINT";
                regulator-min-microvolt = <0xf4240>;
                regulator-max-microvolt = <0xf4240>;
                regulator-boot-on;
                regulator-always-on;
                linux,phandle = <0x2>;
                phandle = <0x2>;
        };

        amba {
                compatible = "simple-bus";
                #address-cells = <0x1>;
                #size-cells = <0x1>;
                interrupt-parent = <0x3>;
                ranges;

                adc@f8007100 {
                        compatible = "xlnx,zynq-xadc-1.00.a";
                        reg = <0xf8007100 0x20>;
                        interrupts = <0x0 0x7 0x4>;
                        interrupt-parent = <0x3>;
                        clocks = <0x1 0xc>;
                };

                can@e0008000 {
                        compatible = "xlnx,zynq-can-1.0";
                        status = "okay";
                        clocks = <0x1 0x13 0x1 0x24>;
                        clock-names = "can_clk", "pclk";
                        reg = <0xe0008000 0x1000>;
                        interrupts = <0x0 0x1c 0x4>;
                        interrupt-parent = <0x3>;
                        tx-fifo-depth = <0x40>;
                        rx-fifo-depth = <0x40>;
                };

                can@e0009000 {
                        compatible = "xlnx,zynq-can-1.0";
                        status = "disabled";
                        clocks = <0x1 0x14 0x1 0x25>;
                        clock-names = "can_clk", "pclk";
                        reg = <0xe0009000 0x1000>;
                        interrupts = <0x0 0x33 0x4>;
                        interrupt-parent = <0x3>;
                        tx-fifo-depth = <0x40>;
                        rx-fifo-depth = <0x40>;
                };

                gpio@e000a000 {
                        compatible = "xlnx,zynq-gpio-1.0";
                        #gpio-cells = <0x2>;
                        clocks = <0x1 0x2a>;
                        gpio-controller;
                        interrupt-parent = <0x3>;
                        interrupts = <0x0 0x14 0x4>;
                        reg = <0xe000a000 0x1000>;
                        emio-gpio-width = <0x1>;
                        gpio-mask-high = <0x0>;
                        gpio-mask-low = <0x5600>;
                        linux,phandle = <0x4>;
                        phandle = <0x4>;
                };

                i2c@e0004000 {
                        compatible = "cdns,i2c-r1p10";
                        status = "okay";
                        clocks = <0x1 0x26>;
                        interrupt-parent = <0x3>;
                        interrupts = <0x0 0x19 0x4>;
                        reg = <0xe0004000 0x1000>;
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                        clock-frequency = <0x61a80>;
                        i2c-reset = <0x4 0xd 0x0>;
                };

                i2c@e0005000 {
                        compatible = "cdns,i2c-r1p10";
                        status = "disabled";
                        clocks = <0x1 0x27>;
                        interrupt-parent = <0x3>;
                        interrupts = <0x0 0x30 0x4>;
                        reg = <0xe0005000 0x1000>;
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                };

                interrupt-controller@f8f01000 {
                        compatible = "arm,cortex-a9-gic";
                        #interrupt-cells = <0x3>;
                        interrupt-controller;
                        reg = <0xf8f01000 0x1000 0xf8f00100 0x100>;
                        num_cpus = <0x2>;
                        num_interrupts = <0x60>;
                        linux,phandle = <0x3>;
                        phandle = <0x3>;
                };

                cache-controller@f8f02000 {
                        compatible = "arm,pl310-cache";
                        reg = <0xf8f02000 0x1000>;
                        interrupts = <0x0 0x2 0x4>;
                        arm,data-latency = <0x3 0x2 0x2>;
                        arm,tag-latency = <0x2 0x2 0x2>;
                        cache-unified;
                        cache-level = <0x2>;
                };

                memory-controller@f8006000 {
                        compatible = "xlnx,zynq-ddrc-a05";
                        reg = <0xf8006000 0x1000>;
                };

                ocmc@f800c000 {
                        compatible = "xlnx,zynq-ocmc-1.0";
                        interrupt-parent = <0x3>;
                        interrupts = <0x0 0x3 0x4>;
                        reg = <0xf800c000 0x1000>;
                };

                serial@e0000000 {
                        compatible = "xlnx,xuartps", "cdns,uart-r1p8";
                        status = "disabled";
                        clocks = <0x1 0x17 0x1 0x28>;
                        clock-names = "uart_clk", "pclk";
                        reg = <0xe0000000 0x1000>;
                        interrupts = <0x0 0x1b 0x4>;
                };

                serial@e0001000 {
                        compatible = "xlnx,xuartps", "cdns,uart-r1p8";
                        status = "okay";
                        clocks = <0x1 0x18 0x1 0x29>;
                        clock-names = "uart_clk", "pclk";
                        reg = <0xe0001000 0x1000>;
                        interrupts = <0x0 0x32 0x4>;
                        current-speed = <0x1c200>;
                        device_type = "serial";
                        port-number = <0x0>;
                };

                spi@e0006000 {
                        compatible = "xlnx,zynq-spi-r1p6";
                        reg = <0xe0006000 0x1000>;
                        status = "disabled";
                        interrupt-parent = <0x3>;
                        interrupts = <0x0 0x1a 0x4>;
                        clocks = <0x1 0x19 0x1 0x22>;
                        clock-names = "ref_clk", "pclk";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                };

                spi@e0007000 {
                        compatible = "xlnx,zynq-spi-r1p6";
                        reg = <0xe0007000 0x1000>;
                        status = "disabled";
                        interrupt-parent = <0x3>;
                        interrupts = <0x0 0x31 0x4>;
                        clocks = <0x1 0x1a 0x1 0x23>;
                        clock-names = "ref_clk", "pclk";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                };

                spi@e000d000 {
                        clock-names = "ref_clk", "pclk";
                        clocks = <0x1 0xa 0x1 0x2b>;
                        compatible = "xlnx,zynq-qspi-1.0";
                        status = "okay";
                        interrupt-parent = <0x3>;
                        interrupts = <0x0 0x13 0x4>;
                        reg = <0xe000d000 0x1000>;
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                        is-dual = <0x0>;
                        num-cs = <0x1>;

                        flash@0 {
                                compatible = "micron,n25q128";
                                reg = <0x0>;
                                #address-cells = <0x1>;
                                #size-cells = <0x1>;
                                spi-max-frequency = <0x2faf080>;

                                partition@0x00000000 {
                                        label = "boot";
                                        reg = <0x0 0x500000>;
                                };

                                partition@0x00500000 {
                                        label = "bootenv";
                                        reg = <0x500000 0x20000>;
                                };

                                partition@0x00520000 {
                                        label = "kernel";
                                        reg = <0x520000 0xa80000>;
                                };

                                partition@0x00fa0000 {
                                        label = "spare";
                                        reg = <0xfa0000 0x0>;
                                };
                        };
                };

                memory-controller@e000e000 {
                        #address-cells = <0x1>;
                        #size-cells = <0x1>;
                        status = "disabled";
                        clock-names = "memclk", "aclk";
                        clocks = <0x1 0xb 0x1 0x2c>;
                        compatible = "arm,pl353-smc-r2p1";
                        interrupt-parent = <0x3>;
                        interrupts = <0x0 0x12 0x4>;
                        ranges;
                        reg = <0xe000e000 0x1000>;

                        flash@e1000000 {
                                status = "disabled";
                                compatible = "arm,pl353-nand-r2p1";
                                reg = <0xe1000000 0x1000000>;
                                #address-cells = <0x1>;
                                #size-cells = <0x1>;
                        };

                        flash@e2000000 {
                                status = "disabled";
                                compatible = "cfi-flash";
                                reg = <0xe2000000 0x2000000>;
                                #address-cells = <0x1>;
                                #size-cells = <0x1>;
                        };
                };

                ethernet@e000b000 {
                        compatible = "cdns,gem";
                        reg = <0xe000b000 0x1000>;
                        status = "okay";
                        interrupts = <0x0 0x16 0x4>;
                        clocks = <0x1 0x1e 0x1 0x1e 0x1 0xd>;
                        clock-names = "pclk", "hclk", "tx_clk";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                        enet-reset = <0x4 0xb 0x0>;
                        phy-mode = "rgmii-id";
                        xlnx,ptp-enet-clock = <0x69f6bcb>;
                        local-mac-address = [00 0a 35 00 1e 53];
                };

                ethernet@e000c000 {
                        compatible = "cdns,gem";
                        reg = <0xe000c000 0x1000>;
                        status = "disabled";
                        interrupts = <0x0 0x2d 0x4>;
                        clocks = <0x1 0x1f 0x1 0x1f 0x1 0xe>;
                        clock-names = "pclk", "hclk", "tx_clk";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                };

                sdhci@e0100000 {
                        compatible = "arasan,sdhci-8.9a";
                        status = "okay";
                        clock-names = "clk_xin", "clk_ahb";
                        clocks = <0x1 0x15 0x1 0x20>;
                        interrupt-parent = <0x3>;
                        interrupts = <0x0 0x18 0x4>;
                        reg = <0xe0100000 0x1000>;
                        xlnx,has-cd = <0x1>;
                        xlnx,has-power = <0x0>;
                        xlnx,has-wp = <0x1>;
                };

                sdhci@e0101000 {
                        compatible = "arasan,sdhci-8.9a";
                        status = "disabled";
                        clock-names = "clk_xin", "clk_ahb";
                        clocks = <0x1 0x16 0x1 0x21>;
                        interrupt-parent = <0x3>;
                        interrupts = <0x0 0x2f 0x4>;
                        reg = <0xe0101000 0x1000>;
                };

                slcr@f8000000 {
                        #address-cells = <0x1>;
                        #size-cells = <0x1>;
                        compatible = "xlnx,zynq-slcr", "syscon", "simple-bus";
                        reg = <0xf8000000 0x1000>;
                        ranges;
                        linux,phandle = <0x5>;
                        phandle = <0x5>;

                        clkc@100 {
                                #clock-cells = <0x1>;
                                compatible = "xlnx,ps7-clkc";
                                fclk-enable = <0x1>;
                                clock-output-names = "armpll", "ddrpll", "iopll", "cpu_6or4x", "cpu_3or2x", "cpu_2x", "cpu_1x", "ddr2x", "ddr3x", "dci", "lqspi", "smc", "pcap", "gem0", "gem1", "fclk0", "fclk1", "fclk2", "fclk3", "can0", "can1", "sdio0", "sdio1", "uart0", "uart1", "spi0", "spi1", "dma", "usb0_aper", "usb1_aper", "gem0_aper", "gem1_aper", "sdio0_aper", "sdio1_aper", "spi0_aper", "spi1_aper", "can0_aper", "can1_aper", "i2c0_aper", "i2c1_aper", "uart0_aper", "uart1_aper", "gpio_aper", "lqspi_aper", "smc_aper", "swdt", "dbg_trc", "dbg_apb";
                                reg = <0x100 0x100>;
                                ps-clk-frequency = <0x1fca055>;
                                linux,phandle = <0x1>;
                                phandle = <0x1>;
                        };

                        pinctrl@700 {
                                compatible = "xlnx,pinctrl-zynq";
                                reg = <0x700 0x200>;
                                syscon = <0x5>;
                        };
                };

                dmac@f8003000 {
                        compatible = "arm,pl330", "arm,primecell";
                        reg = <0xf8003000 0x1000>;
                        interrupt-parent = <0x3>;
                        interrupt-names = "abort", "dma0", "dma1", "dma2", "dma3", "dma4", "dma5", "dma6", "dma7";
                        interrupts = <0x0 0xd 0x4 0x0 0xe 0x4 0x0 0xf 0x4 0x0 0x10 0x4 0x0 0x11 0x4 0x0 0x28 0x4 0x0 0x29 0x4 0x0 0x2a 0x4 0x0 0x2b 0x4>;
                        #dma-cells = <0x1>;
                        #dma-channels = <0x8>;
                        #dma-requests = <0x4>;
                        clocks = <0x1 0x1b>;
                        clock-names = "apb_pclk";
                };

                devcfg@f8007000 {
                        clock-names = "ref_clk", "fclk0", "fclk1", "fclk2", "fclk3";
                        clocks = <0x1 0xc 0x1 0xf 0x1 0x10 0x1 0x11 0x1 0x12>;
                        compatible = "xlnx,zynq-devcfg-1.0";
                        interrupt-parent = <0x3>;
                        interrupts = <0x0 0x8 0x4>;
                        reg = <0xf8007000 0x100>;
                        syscon = <0x5>;
                };

                timer@f8f00200 {
                        compatible = "arm,cortex-a9-global-timer";
                        reg = <0xf8f00200 0x20>;
                        interrupts = <0x1 0xb 0x301>;
                        interrupt-parent = <0x3>;
                        clocks = <0x1 0x4>;
                };

                timer@f8001000 {
                        interrupt-parent = <0x3>;
                        interrupts = <0x0 0xa 0x4 0x0 0xb 0x4 0x0 0xc 0x4>;
                        compatible = "cdns,ttc";
                        clocks = <0x1 0x6>;
                        reg = <0xf8001000 0x1000>;
                };

                timer@f8002000 {
                        interrupt-parent = <0x3>;
                        interrupts = <0x0 0x25 0x4 0x0 0x26 0x4 0x0 0x27 0x4>;
                        compatible = "cdns,ttc";
                        clocks = <0x1 0x6>;
                        reg = <0xf8002000 0x1000>;
                };

                timer@f8f00600 {
                        interrupt-parent = <0x3>;
                        interrupts = <0x1 0xd 0x301>;
                        compatible = "arm,cortex-a9-twd-timer";
                        reg = <0xf8f00600 0x20>;
                        clocks = <0x1 0x4>;
                };

                usb@e0002000 {
                        compatible = "xlnx,zynq-usb-2.20a", "chipidea,usb2";
                        status = "okay";
                        clocks = <0x1 0x1c>;
                        interrupt-parent = <0x3>;
                        interrupts = <0x0 0x15 0x4>;
                        reg = <0xe0002000 0x1000>;
                        phy_type = "ulpi";
                        dr_mode = "host";
                        usb-reset = <0x4 0x7 0x0>;
                };

                usb@e0003000 {
                        compatible = "xlnx,zynq-usb-2.20a", "chipidea,usb2";
                        status = "disabled";
                        clocks = <0x1 0x1d>;
                        interrupt-parent = <0x3>;
                        interrupts = <0x0 0x2c 0x4>;
                        reg = <0xe0003000 0x1000>;
                        phy_type = "ulpi";
                };

                watchdog@f8005000 {
                        clocks = <0x1 0x2d>;
                        compatible = "cdns,wdt-r1p2";
                        interrupt-parent = <0x3>;
                        interrupts = <0x0 0x9 0x1>;
                        reg = <0xf8005000 0x1000>;
                        timeout-sec = <0xa>;
                };

                gpio-keys {
                        compatible = "gpio-keys";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                        autorepeat;

                        mysw {
                                label = "mysw";
                                gpios = <0x4 0x0 0x0>;
                                linux,code = <0x6c>;
                                gpio-key,wakeup;
                                autorepeat;
                        };
                };
        };
};
0 Kudos
Teacher muzaffer
Teacher
10,308 Views
Registered: ‎03-31-2012

Re: Zyqn / petalinux GPIO issue

Jump to solution
is it possible that the sd detect is connected to emio 0 and not your pin? make sure there is really one emio (and that's not sd detect) or make your emio the second bit.
- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.

View solution in original post

0 Kudos
Visitor benjaminbuck
Visitor
5,590 Views
Registered: ‎08-26-2016

Re: Zyqn / petalinux GPIO issue

Jump to solution

This got me going on the right path!  I had the configuration in my dts file as follows:

 

                gpio-keys {
                        compatible = "gpio-keys";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                        autorepeat;

                        mysw {
                                label = "mysw";
                                gpios = <0x4 0x0 0x0>;
                                linux,code = <0x6c>;
                                gpio-key,wakeup;
                                autorepeat;
                        };
                };

Which was assigning the key to GPIO 0, not EMIO 0.  The EMIOs come after the 54 MIO pins.  So changing the gpios line to:

gpios = <0x4 0x36 0x0>;

correctly assigned the keypress to my EMIO pin 0.

 

Thanks!

0 Kudos