goodix driver not loaded from arm device - linux

I have nanopi2-fire. I want to use GT911 touch panel, and I change this goodix header file like this : (Line 230 -233)
// STEP_2(REQUIRED): Customize your I/O ports & I/O operations
#define GTP_RST_PORT 16 //16 //S5PV210_GPJ3(6)
#define GTP_INT_PORT 17 //17 //S5PV210_GPH1(3)
and this is s5p4418-nanopi2-common.dtsi about gt9xx tp driver said it connect to I2C0:(Line 466-473)
goodix_ts#5d {
compatible = "goodix,gt9xx";
reg = <0x5d>;
interrupt-parent = <&gpio_c>;
interrupts = <16 IRQ_TYPE_EDGE_FALLING>;
goodix,irq-gpio = <&gpio_c 16 0>;
};
and this this is defconfig for nanopi2:
# CONFIG_INPUT_MOUSE is not set
CONFIG_INPUT_TOUCHSCREEN=y
CONFIG_TOUCHSCREEN_EDT_FT5X06=y
CONFIG_TOUCHSCREEN_FE_PANELS=y
CONFIG_TOUCHSCREEN_1WIRE=y
CONFIG_TOUCHSCREEN_GT9XX=y
CONFIG_TOUCHSCREEN_IT7260=y
CONFIG_TOUCHSCREEN_HIMAX=y
CONFIG_TOUCHSCREEN_ST1572=y
cause of this I think goodix is enabled as default.
when I crosscompile the kernel the kernel after change the gt9xx.h file and copy zImage and DTB files (as tutorials ) and put SD with run the Linux nothing changed.
I test i2c it shows me this result:
i2cdetect -y 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- UU
30: -- -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- 5d -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- --
I think my device connect to i2c correctly, but touch does not work. also this command return nothing:
dmesg | grep goodix
this is dmesg log :
[ 2.764000] ehci-exynos: EHCI EXYNOS driver
[ 2.769000] exynos-ehci c0030000.ehci: EHCI Host Controller​
[ 2.775000] exynos-ehci c0030000.ehci: new USB bus registered, assigned bus number 2​
[ 2.783000] exynos-ehci c0030000.ehci: irq 66, io mem 0xc0030000​
[ 2.795000] exynos-ehci c0030000.ehci: USB 2.0 started, EHCI 1.00​
[ 2.801000] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002​
[ 2.808000] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1​
[ 2.815000] usb usb2: Product: EHCI Host Controller​
[ 2.820000] usb usb2: Manufacturer: Linux 4.4.49-s5p4418 ehci_hcd​
[ 2.826000] usb usb2: SerialNumber: c0030000.ehci​
[ 2.832000] hub 2-0:1.0: USB hub found​
[ 2.836000] hub 2-0:1.0: 3 ports detected​
[ 2.841000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver​
[ 2.847000] ohci-exynos: OHCI EXYNOS driver​
[ 2.851000] exynos-ohci c0020000.ohci: USB Host Controller​
[ 2.857000] exynos-ohci c0020000.ohci: new USB bus registered, assigned bus number 3​
[ 2.865000] exynos-ohci c0020000.ohci: irq 66, io mem 0xc0020000​
[ 2.926000] usb usb3: New USB device found, idVendor=1d6b, idProduct=0001​
[ 2.933000] usb usb3: New USB device strings: Mfr=3, Product=2, SerialNumber=1​
[ 2.940000] usb usb3: Product: USB Host Controller​
[ 2.945000] usb usb3: Manufacturer: Linux 4.4.49-s5p4418 ohci_hcd​
[ 2.951000] usb usb3: SerialNumber: c0020000.ohci​
[ 2.956000] hub 3-0:1.0: USB hub found​
[ 2.960000] hub 3-0:1.0: 3 ports detected​
[ 2.965000] usbcore: registered new interface driver uas​
[ 2.971000] usbcore: registered new interface driver usb-storage​
[ 2.977000] usbcore: registered new interface driver usbserial​
[ 2.983000] usbcore: registered new interface driver usbserial_generic​
[ 2.990000] usbserial: USB Serial support registered for generic​
[ 2.997000] mousedev: PS/2 mouse device common for all mice​
[ 3.013000] input: EP0790M09 as /devices/platform/c0000000.soc/c00a6000.i2c/i2c-2/2-0038/input/input0​
[ 3.023000] <<-GTP-INFO->> GTP driver installing​
[ 3.034000] himax_ts 2-0048: Unable to get DevId​
[ 3.039000] touchscreen-1wire initialized​
[ 3.044000] backlight-1wire initialized​
[ 3.050000] onewire: REQ 0x60: i2c read error -11​
[ 3.056000] input: fa_ts_input as /devices/virtual/input/input1​
[ 3.063000] ts-if initialized​
[ 3.066000] nx-rtc c0010c00.rtc: [RTC] day=2009.09.01 time=00:00:00​
[ 3.073000] nx-rtc c0010c00.rtc: rtc core: registered nx as rtc0​
[ 3.079000] i2c /dev entries driver​
[ 3.084000] nx-v4l2 nx-v4l2: nx_v4l2_probe success​
[ 3.090000] nx-vpu c0080000.video-codec: encoder registered as /dev/video14​
[ 3.097000] nx-vpu c0080000.video-codec: decoder registered as /dev/video15​
[ 3.113000] device-mapper: uevent: version 1.0.3​
[ 3.118000] device-mapper: ioctl: 4.34.0-ioctl (2015-10-28) initialised: dm-devel#redhat.com​
[ 3.127000] Bluetooth: HCI UART driver ver 2.3​
[ 3.131000] Bluetooth: HCI UART protocol H4 registered​
[ 3.136000] Bluetooth: HCI UART protocol BCM registered​
[ 3.142000] voltage supply : vdd_arm_spu​
[ 3.146000] DVFS: ASV[0] IDS(10mA, 7) Ro(110, 82)​
[ 3.151000] ASV 0 = 1400000khz, 1200000 uV​
[ 3.155000] ASV 1 = 1300000khz, 1160000 uV​
[ 3.159000] ASV 2 = 1200000khz, 1120000 uV​
[ 3.164000] ASV 3 = 1100000khz, 1080000 uV​
[ 3.168000] ASV 4 = 1000000khz, 1080000 uV​
[ 3.172000] ASV 5 = 900000khz, 1040000 uV​
[ 3.177000] ASV 6 = 800000khz, 1040000 uV​
[ 3.181000] ASV 7 = 700000khz, 1000000 uV​
[ 3.186000] ASV 8 = 600000khz, 1000000 uV​
[ 3.190000] ASV 9 = 500000khz, 960000 uV​
[ 3.194000] ASV 10 = 400000khz, 960000 uV​
[ 3.199000] c00bb000.dynamic-freq supply vdd_arm_dummy not found, using dummy regulator​
[ 3.207000] DVFS: regulator vdd_arm_dummy​
[ 3.211000] DVFS: cpu DVFS with PLL.1 [tables=11]​
[ 3.217000] Synopsys Designware Multimedia Card Interface Driver​
[ 3.224000] dwmmc_nexell c0062000.dw_mmc: fifo-depth property not found, using value of FIFOTH register as default​
[ 3.234000] dwmmc_nexell c0062000.dw_mmc: IDMAC supports 32-bit address mode.​
[ 3.242000] dwmmc_nexell c0062000.dw_mmc: Using internal DMA controller.​
[ 3.249000] dwmmc_nexell c0062000.dw_mmc: Version ID is 250a​
[ 3.254000] dwmmc_nexell c0062000.dw_mmc: DW MMC controller at irq 59,32 bit host data width,16 deep fifo​
[ 3.264000] dwmmc_nexell c0062000.dw_mmc: No vmmc regulator found​
[ 3.270000] dwmmc_nexell c0062000.dw_mmc: No vqmmc regulator found​
[ 3.276000] dwmmc_nexell c0062000.dw_mmc: Got CD GPIO​
[ 3.304000] mmc0: run _mmc_detect_change()​
[ 3.308000] dwmmc_nexell c0062000.dw_mmc: 1 slots initialized​
[ 3.314000] usbcore: registered new interface driver usbhid​
[ 3.320000] usbhid: USB HID core driver​
[ 3.324000] ashmem: initialized​
[ 3.329000] nexell-adc c0053000.adc: CHs 8, 200000(1000000 ~ 130208) sample rate, scale=166(bit 6)​
[ 3.342000] nexell-pcm nexell-pcm: snd pcm: register sound platform 'nexell-pcm'​
[ 3.351000] nexell-i2s c0055000.i2s: snd i2s: ch 0, master, iis mode, 48000(47999)hz, 32 FBITs,​
[ 3.360000] nexell-i2s c0055000.i2s: MCLK=12287880hz, RFS=256​
[ 3.367000] nexell-spdif-tx c0059000.spdiftx: spdif-tx: 48000(47999)Hz, MCLK=12287880hz​
[ 3.378000] nx-simple-card sound: snd-null-voice <-> c0055000.i2s mapping ok​
[ 3.386000] nx-simple-card sound: dit-hifi <-> c0059000.spdiftx mapping ok​
[ 3.394000] u32 classifier​
[ 3.397000] Actions configured​
[ 3.400000] Netfilter messages via NETLINK v0.30.​
[ 3.403000] mmc_host mmc0: Bus speed (slot 0) = 50000000Hz (slot req 50000000Hz, actual 50000000HZ div = 0)​
[ 3.403000] mmc0: new high speed SDHC card at address aaaa​
[ 3.405000] mmcblk0: mmc0:aaaa SC16G 14.8 GiB​
[ 3.420000] mmcblk0: p1 p2​
[ 3.428000] nf_conntrack version 0.5.0 (15731 buckets, 62924 max)​
[ 3.435000] ctnetlink v0.93: registering with nfnetlink.​
[ 3.441000] xt_time: kernel timezone is -0000​
[ 3.446000] ip_tables: (C) 2000-2006 Netfilter Core Team​
[ 3.451000] arp_tables: (C) 2002 David S. Miller​
[ 3.456000] Initializing XFRM netlink socket​
[ 3.461000] NET: Registered protocol family 10​
[ 3.469000] mip6: Mobile IPv6​
[ 3.472000] ip6_tables: (C) 2000-2006 Netfilter Core Team​
[ 3.478000] NET: Registered protocol family 17​
[ 3.482000] NET: Registered protocol family 15​
[ 3.487000] Bluetooth: RFCOMM TTY layer initialized​
[ 3.492000] Bluetooth: RFCOMM socket layer initialized​
[ 3.497000] Bluetooth: RFCOMM ver 1.11​
[ 3.501000] Bluetooth: BNEP (Ethernet Emulation) ver 1.3​
[ 3.506000] Bluetooth: BNEP filters: protocol multicast​
[ 3.511000] Bluetooth: BNEP socket layer initialized​
[ 3.516000] Bluetooth: HIDP (Human Interface Emulation) ver 1.2​
[ 3.522000] Bluetooth: HIDP socket layer initialized​
[ 3.528000] Key type dns_resolver registered​
[ 3.532000] ThumbEE CPU extension supported.​
[ 3.536000] Registering SWP/SWPB emulation handler​
[ 3.543000] Loading compiled-in X.509 certificates​
[ 3.550000] ntc-thermistor thermal: Thermistor type: b57330v2103 successfully probed.​
[ 3.559000] input: gpio_keys as /devices/platform/gpio_keys/input/input2​
[ 3.566000] nx-rtc c0010c00.rtc: setting system clock to 2009-09-01 00:00:00 UTC (1251763200)​
[ 3.580000] axp22_rtcldo: disabling​
[ 3.590000] axp22_dc5ldo: disabling​
[ 3.600000] dhd_module_init in​
[ 3.603000] dhd_wlan_init: START.......​
[ 3.608000] failed to get device node of bcmdhd​
[ 3.613000] dhd_wlan_init: failed to initiate GPIO, ret=-19​
[ 3.618000] dhd_module_init: failed in dhd_wlan_init.​
[ 3.623000] ALSA device list:​
[ 3.626000] #0: nanopi2-audio​
[ 3.735000] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)​
[ 3.752000] EXT4-fs (mmcblk0p2): re-mounted. Opts: data=ordered​
[ 4.137000] systemd[1]: System time before build time, advancing clock.​
[ 4.243000] systemd[1]: systemd 229 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN)​
[ 4.262000] systemd[1]: Detected architecture arm.​
[ 4.286000] systemd[1]: Set hostname to <NanoPi2-Fire>.​
[ 4.536000] systemd[1]: Reached target Encrypted Volumes.​
[ 4.549000] systemd[1]: Started Forward Password Requests to Wall Directory Watch.​
[ 4.565000] systemd[1]: Listening on /dev/initctl Compatibility Named Pipe.​
[ 4.579000] systemd[1]: Listening on Journal Audit Socket.​
[ 4.592000] systemd[1]: Listening on udev Control Socket.​
[ 4.603000] systemd[1]: Listening on Journal Socket.​
[ 4.614000] systemd[1]: Started Dispatch Password Requests to Console Directory Watch.​
[ 4.631000] systemd[1]: Reached target Paths.​
[ 4.641000] systemd[1]: Created slice System Slice.​
[ 4.653000] systemd[1]: Created slice system-serial\x2dgetty.slice.​
[ 4.671000] systemd[1]: Starting Set console keymap...​
[ 4.686000] systemd[1]: Mounting Debug File System...​
[ 4.714000] systemd[1]: Starting Load Kernel Modules...​
[ 4.728000] systemd[1]: Listening on udev Kernel Socket.​
[ 4.745000] systemd[1]: Starting Create list of required static device nodes for the current kernel...​
[ 4.766000] systemd[1]: Created slice User and Session Slice.​
[ 4.780000] systemd[1]: Reached target Slices.​
[ 4.795000] systemd[1]: Mounting POSIX Message Queue File System...​
[ 4.809000] systemd[1]: Listening on Journal Socket (/dev/log).​
[ 4.826000] systemd[1]: Starting Journal Service...​
[ 4.836000] systemd[1]: Reached target Remote File Systems (Pre).​
[ 4.849000] systemd[1]: Reached target Remote File Systems.​
[ 4.878000] systemd[1]: Starting Remount Root and Kernel File Systems...​
[ 4.909000] systemd[1]: Mounted Debug File System.​
[ 4.922000] systemd[1]: Mounted POSIX Message Queue File System.​
[ 4.937000] systemd[1]: Started Set console keymap.​
[ 4.949000] systemd[1]: systemd-modules-load.service: Main process exited, code=exited, status=1/FAILURE​
[ 4.960000] systemd[1]: Failed to start Load Kernel Modules.​
[ 4.981000] systemd[1]: systemd-modules-load.service: Unit entered failed state.​
[ 4.988000] systemd[1]: systemd-modules-load.service: Failed with result 'exit-code'.​
[ 4.997000] systemd[1]: Started Create list of required static device nodes for the current kernel.​
[ 5.018000] systemd[1]: Started Remount Root and Kernel File Systems.​
[ 5.032000] systemd[1]: Started Journal Service.​
[ 5.458000] systemd-journald[390]: Received request to flush runtime journal from PID 1​
[ 5.580000] Adding 2097148k swap on /swapfile. Priority:-1 extents:18 across:3842044k SS​
[ 7.755000] cfg80211: World regulatory domain updated:​
[ 7.755000] cfg80211: DFS Master region: unset​
[ 7.755000] cfg80211: (start_freq - end_freq # bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)​
[ 7.755000] cfg80211: (2402000 KHz - 2472000 KHz # 40000 KHz), (N/A, 2000 mBm), (N/A)​
[ 7.755000] cfg80211: (2457000 KHz - 2482000 KHz # 40000 KHz), (N/A, 2000 mBm), (N/A)​
[ 7.755000] cfg80211: (2474000 KHz - 2494000 KHz # 20000 KHz), (N/A, 2000 mBm), (N/A)​
[ 7.755000] cfg80211: (5170000 KHz - 5250000 KHz # 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (N/A)​
[ 7.755000] cfg80211: (5250000 KHz - 5330000 KHz # 80000 KHz, 160000 KHz AUTO), (N/A, 2000 mBm), (0 s)​
[ 7.755000] cfg80211: (5490000 KHz - 5730000 KHz # 160000 KHz), (N/A, 2000 mBm), (0 s)​
[ 7.755000] cfg80211: (5735000 KHz - 5835000 KHz # 80000 KHz), (N/A, 2000 mBm), (N/A)​
[ 7.756000] cfg80211: (57240000 KHz - 63720000 KHz # 2160000 KHz), (N/A, 0 mBm), (N/A)​
[ 7.932000] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready​
[ 8.313000] random: nonblocking pool is initialized​
[ 12.942000] nexell-dwmac c0060000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx​
[ 13.627000] NOHZ: local_softirq_pending 08​
[ 14.015000] NOHZ: local_softirq_pending 08​
[ 15.971000] NOHZ: local_softirq_pending 08​
[ 18.637000] NOHZ: local_softirq_pending 08​
[ 23.648000] NOHZ: local_softirq_pending 08​
[ 28.630000] NOHZ: local_softirq_pending 08​
[ 28.641000] NOHZ: local_softirq_pending 08​
[ 28.658000] NOHZ: local_softirq_pending 08​
[ 33.668000] NOHZ: local_softirq_pending 08​
[ 36.292000] NOHZ: local_softirq_pending 08​
[ 314.806000] nf_conntrack: automatic helper assignment is deprecated and it will be removed soon. Use the iptables CT target to attach helpers instead.​

Did you enable goodix_ts driver in kernel? There seems to be no trace of such driver in your dmesg (also | grep goodix either didn't work or you have sent the wrong output)... Anyway, check that drivers/input/touchscreen/gt9xx.c gets compiled.

Related

Diolan DLN-2 SPI controller on x86_64 platform

I am attempting to utilize the DLN-2 in an x86_64 Linux environment (kernel version 4.18) to provide SPI and I2C bus controllers to the userspace, in a similar manner you would using an ARM platform with DTS/DTB file modifications. I am having trouble identifying the proper method to attach a SPI slave device or mount the device to userspace with the spidev driver.
The kernel modules are loading successfully and the SPI bus is mounted as a spi_master. I am certain the chip itself is working because the I2C (/dev/i2c-#) and GPIO (/dev/gpiochip#) interfaces can be successfully manipulated. For reference, here is a list of all references in the Linux system tree for "dln":
# find /sys -name *dln*
/sys/devices/pci0000:00/0000:00:15.0/usb1/1-2/1-2:1.0/dln2-i2c.1.auto
/sys/devices/pci0000:00/0000:00:15.0/usb1/1-2/1-2:1.0/dln2-spi.2.auto
/sys/devices/pci0000:00/0000:00:15.0/usb1/1-2/1-2:1.0/dln2-gpio.0.auto
/sys/fs/selinux/booleans/minidlna_read_generic_user_content
/sys/bus/platform/devices/dln2-i2c.1.auto
/sys/bus/platform/devices/dln2-spi.2.auto
/sys/bus/platform/devices/dln2-gpio.0.auto
/sys/bus/platform/drivers/dln2-gpio
/sys/bus/platform/drivers/dln2-gpio/dln2-gpio.0.auto
/sys/bus/platform/drivers/dln2-adc
/sys/bus/platform/drivers/dln2-spi
/sys/bus/platform/drivers/dln2-spi/dln2-spi.2.auto
/sys/bus/platform/drivers/dln2-i2c
/sys/bus/platform/drivers/dln2-i2c/dln2-i2c.1.auto
/sys/bus/usb/drivers/dln2
/sys/module/i2c_dln2
/sys/module/i2c_dln2/drivers/platform:dln2-i2c
/sys/module/industrialio_triggered_buffer/holders/dln2_adc
/sys/module/spi_dln2
/sys/module/spi_dln2/drivers/platform:dln2-spi
/sys/module/industrialio/holders/dln2_adc
/sys/module/dln2_adc
/sys/module/dln2_adc/drivers/platform:dln2-adc
/sys/module/gpio_dln2
/sys/module/gpio_dln2/drivers/platform:dln2-gpio
/sys/module/dln2
/sys/module/dln2/holders/i2c_dln2
/sys/module/dln2/holders/spi_dln2
/sys/module/dln2/holders/dln2_adc
/sys/module/dln2/holders/gpio_dln2
/sys/module/dln2/drivers/usb:dln2
Here is the matching portion of the boot log:
[ 1.578110] usb 1-2: new full-speed USB device number 2 using xhci_hcd
[ 1.705306] usb 1-2: New USB device found, idVendor=a257, idProduct=2013, bcdDevice= 1.00
[ 1.705310] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1.705312] usb 1-2: Product: Diolan DLN2
[ 1.705314] usb 1-2: Manufacturer: Diolan
[ 10.485997] dln2 1-2:1.0: Diolan DLN2 serial 33632920
[ 10.486182] usbcore: registered new interface driver dln2
And the relevant portion of the usb device tree:
Bus 001 Device 002: ID a257:2013
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 255 Vendor Specific Class
bDeviceSubClass 255 Vendor Specific Subclass
bDeviceProtocol 255 Vendor Specific Protocol
bMaxPacketSize0 64
idVendor 0xa257
idProduct 0x2013
bcdDevice 1.00
iManufacturer 1 Diolan
iProduct 2 Diolan DLN2
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0020
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 2
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 255 Vendor Specific Subclass
bInterfaceProtocol 255 Vendor Specific Protocol
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x03 EP 3 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x83 EP 3 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
can't get device qualifier: Resource temporarily unavailable
can't get debug descriptor: Resource temporarily unavailable
Device Status: 0x0000
(Bus Powered)
At this point, I am assuming that an ACPI patch is the correct method. however, the device does not appear in the ACPI device tree, or I am not searching with the correct string. I am assuming it will be similar to the following, which I pulled from a kernel patch (https://lore.kernel.org/patchwork/patch/527210/) that appears to have since been removed from the current kernel.
DefinitionBlock ("dln2.aml", "SSDT", 1, "INTEL", "CpuDptf", 3)
{
Device (DLN0)
{
Name (_ADR, Zero)
Name (_HID, "DLN2000")
Device (TP40) {
Name (_HID, "SPT0001")
Name (_DDN, "SPI4-CS0")
Name (_CRS, ResourceTemplate () {
SpiSerialBus (
1, // Chip select
PolarityLow, // Chip select is active low
FourWireMode, // Full duplex
8, // Bits per word is 8 (byte)
ControllerInitiated, // Don't care
1000000, // 1 MHz
ClockPolarityLow, // SPI mode 0
ClockPhaseFirst, // SPI mode 0
"\\DLN0.SPI0", // SPI host controller
0 // Must be 0
)
})
}
}
}
I have also tried udev rules, but my knowledge of udev is slim so they are likely incorrect. None of these appeared to have done the trick:
DEVPATH=="/devices/pci0000:00/0000:00:15.0/usb1/1-2/1-2:1.0/dln2-spi.2.auto/spi_master/spi0", DRIVER="spidev"
DEVPATH=="/devices/pci0000:00/0000:00:15.0/usb1/1-2/1-2:1.0/dln2-spi.2.auto/spi_master/spi0", KERNEL="spi-SPT0001:02", SUBSYSTEM="spi", DRIVER="spidev", ATTRS{driver_override}==""
DEVPATH=="/devices/pci0000:00/0000:00:15.0/usb1/1-2/1-2:1.0/dln2-spi.2.auto/spi_master/spi0/spi-SPT0001:02", KERNEL="spidev2.0", SUBSYSTEM="spidev", DRIVER=""
Okay, now I'm able to answer to the question.
First of all, assume that DSDT on the host machine, i.e. USB host controller excerpt, looks like this (some names maybe different, some methods may or may not be provided, just interesting us part):
Device (XHC)
{
Name (_ADR, 0x00110000)
...
Device (RHUB)
{
Name (_ADR, Zero)
// GPLD: Generate Port Location Data (PLD)
Method (GPLD, 1, Serialized) {
Name (PCKG, Package () {
Buffer (0x10) {}
})
// REV: Revision 0x02 for ACPI 5.0
CreateField (DerefOf (Index (PCKG, Zero)), Zero, 0x07, REV)
Store (0x02, REV)
// VISI: Port visibility to user per port
CreateField (DerefOf (Index (PCKG, Zero)), 0x40, One, VISI)
Store (Arg0, VISI)
Return (PCKG)
}
Device (HS01) { Name (_ADR, 1) }
Device (HS02) { Name (_ADR, 2) }
Device (SS01) { Name (_ADR, 3) }
Device (SS02) { Name (_ADR, 4) }
...
}
}
Important thing above is that port devices (HS01, SS01, etc) does not have _UPC() or _PLD() methods. If they are, you will need to override complete DSDT or upgrade it and ACPI SSDT overlays won't work.
Assume that Diolan device is connected to HS02 USB port. In this case we have to provide the following ACPI excerpt, either in DSDT or as SSDT overlay (Note, method GPLD(), if not present, should be copied from above excerpt):
External (\_SB.PCI0.XHC.RHUB.HS02, DeviceObj)
External (\_SB.PCI0.XHC.RHUB.GPLD, MethodObj)
/*
* We set the port to hard wired state to get the connected device
* enumerated properly. See more details here:
* https://learn.microsoft.com/en-us/windows-hardware/drivers/bringup/other-acpi-namespace-objects#acpi-namespace-hierarchy-and-_adr-for-embedded-usb-devices
*/
Scope (\_SB.PCI0.XHC.RHUB.HS02)
{
Name (_UPC, Package ()
{
0xFF,
0xFF,
Zero,
Zero,
})
Method (_PLD, 0, NotSerialized)
{
Return (GPLD (Zero))
}
Device (GPIO)
{
Name (_ADR, Zero)
Name (_STA, 0x0F)
}
Device (I2C)
{
Name (_ADR, One)
Name (_STA, 0x0F)
}
Device (SPI)
{
Name (_ADR, 0x02)
Name (_STA, 0x0F)
}
}
Note, this example now is a part of meta-acpi project.
After loading these tables we will get everything enumerated like:
$ grep -H HS02 /sys/bus/acpi/devices/device\:*/path
/sys/bus/acpi/devices/device:09/path:\_SB_.PCI0.XHC.RHUB.HS02
/sys/bus/acpi/devices/device:0e/path:\_SB_.PCI0.XHC.RHUB.HS02.GPIO
/sys/bus/acpi/devices/device:0f/path:\_SB_.PCI0.XHC.RHUB.HS02.I2C_
/sys/bus/acpi/devices/device:10/path:\_SB_.PCI0.XHC.RHUB.HS02.SPI_
$ ls -l /sys/bus/platform/devices/dln2-*/firmware_node
lrwxrwxrwx 1 root root 0 Jan 1 00:04 /sys/bus/platform/devices/dln2-gpio.2.auto/firmware_node -> ../../../../../../../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:07/device:08/device:09/device:0e
lrwxrwxrwx 1 root root 0 Jan 1 00:04 /sys/bus/platform/devices/dln2-i2c.3.auto/firmware_node -> ../../../../../../../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:07/device:08/device:09/device:0f
lrwxrwxrwx 1 root root 0 Jan 1 00:04 /sys/bus/platform/devices/dln2-spi.4.auto/firmware_node -> ../../../../../../../../LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:07/device:08/device:09/device:10
This gets us the device object we can attach our slave devices to. So, more detailed this part has been answered in the following SO posts:
adding i2c client devices on x86_64
Building a i2c device controller
spidev Linux driver on Intel Atom board
Note, there are two patches to make it possible in Linux.
One is a599a0fb629a ("Add ACPI support for USB interface devices") and one is pending e3fadb35bc1b ("Allow to be enumerated via ACPI"). Both will be in v5.7-rc1.

How to configure unknown usb device as ethernet on Linux host?

When my USB device was connected, I got the following:
$ dmesg | tail
[ 79.612133] usb 2-2: new full-speed USB device number 3 using ohci-pci
[ 79.937340] usb 2-2: New USB device found, idVendor=238b, idProduct=0a21
[ 79.937343] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 79.937344] usb 2-2: Product: DMR Radio
[ 79.937346] usb 2-2: Manufacturer: Hytera Communications
[ 80.282770] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 80.286007] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[ 80.399206] usbcore: registered new interface driver cdc_ether
[ 80.404402] usbcore: registered new interface driver rndis_host
[ 80.421516] usbcore: registered new interface driver rndis_wlan
There is no message like "cdc_subset 1-4.4.2:1.1: usb0: register 'cdc_subset' at usb-0000:00:02.1-4.4.2, Linux Device".
So there is no ethernet named as usb0.
$ uname -a
Linux VB1804 4.15.0-36-generic #39-Ubuntu SMP Mon Sep 24 16:19:09 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
It is shown as unknown device.
$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 003: ID 238b:0a21
Bus 002 Device 002: ID 80ee:0021 VirtualBox USB Tablet
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
$ lsmod | grep usbnet
usbnet 45056 3 rndis_host,cdc_ether,rndis_wlan
mii 16384 1 usbnet
I got the same on physical Linux.
And,
$ usb-devices
--------- other usb devices ----
T: Bus=02 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#= 3 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=ff(vend.) Sub=fe Prot=fe MxPS= 8 #Cfgs= 1
P: Vendor=238b ProdID=0a21 Rev=00.00
S: Manufacturer=Hytera Communications
S: Product=DMR Radio
C: #Ifs= 3 Cfg#= 1 Atr=c0 MxPwr=4mA
I: If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=02 Prot=ff Driver=(none)
I: If#= 1 Alt= 0 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=(none)
I: If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
I add the idVendor and idProduct to the white list of structure array prodocts[] in file rndis_host.c.
static const struct usb_device_id products [] = {
{ /* DMR Radio*/
USB_DEVICE_AND_INTERFACE_INFO(0x238b, 0x0a21,
USB_CLASS_COMM, 2 /* ACM */, 0x0ff),
.driver_info = (unsigned long) &rndis_info,
}, {
And, It works.

Managing interrupts from custom hardware

I am working on a driver for a custom piece of hardware (Xilinx FPGA based) and am having difficulty picking up the interrupt it is sending. The old system ran uCOS-II and just registered the interrupt ID 94. When I register that interrupt in Linux, it never triggers even though I know the hardware is sending the signal.
Is there something besides calling register_irqthat I need to do?
Is there a way for me to see all interrupt signals sent to the CPU even if nothing has registered for them?
/proc/interrupts:
CPU0 CPU1
16: 0 0 GIC-0 43 Level ttc_clockevent
17: 9383808 10190941 GIC-0 29 Edge twd
20: 68 0 GIC-0 82 Level xuartps
21: 0 0 GIC-0 45 Level f8003000.ps7-dma
22: 0 0 GIC-0 46 Level f8003000.ps7-dma
23: 0 0 GIC-0 47 Level f8003000.ps7-dma
24: 0 0 GIC-0 48 Level f8003000.ps7-dma
25: 0 0 GIC-0 49 Level f8003000.ps7-dma
26: 0 0 GIC-0 72 Level f8003000.ps7-dma
27: 0 0 GIC-0 73 Level f8003000.ps7-dma
28: 0 0 GIC-0 74 Level f8003000.ps7-dma
29: 0 0 GIC-0 75 Level f8003000.ps7-dma
33: 33759 0 GIC-0 54 Level eth0
35: 16184 0 GIC-0 56 Level mmc0
36: 0 0 GIC-0 57 Level cdns-i2c
37: 15117 0 GIC-0 58 Level e0006000.spi
38: 9 0 GIC-0 81 Level e0007000.spi
39: 204 0 GIC-0 40 Level f8007000.devcfg
40: 43 0 GIC-0 39 Level f8007100.xadc
41: 0 0 GIC-0 89 Edge 7c400000.dma
42: 0 0 GIC-0 88 Edge 7c420000.dma
94: 0 0 zynq-gpio 48 Level my_int_handle
IPI1: 0 0 Timer broadcast interrupts
IPI2: 25906 23777 Rescheduling interrupts
IPI3: 37 17 Function call interrupts
IPI4: 0 0 CPU stop interrupts
IPI5: 0 0 IRQ work interrupts
IPI6: 0 0 completion interrupts
Err: 0
Boot Log:
EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
* Will now restart
þeboot: Restarting system
U-Boot 2015.07-03600-g7bcb6ed (Dec 22 2015 - 12:24:30 +0200)
Model: Zynq PicoZed SDR2 Board
I2C: ready
DRAM: ECC disabled 1 GiB
MMC: zynq_sdhci: 0
Invalid bus 0 (err=-1)
*** Warning - spi_flash_probe() failed, using default environment
In: serial
Out: serial
Err: serial
Model: Zynq PicoZed SDR2 Board
Net: Gem.e000b000
Hit any key to stop autoboot: 0
Device: zynq_sdhci
Manufacturer ID: 3
OEM: 5344
Name: SS08G
Tran Speed: 50000000
Rd Block Len: 512
SD version 3.0
High Capacity: Yes
Capacity: 7.4 GiB
Bus Width: 4-bit
Erase Group Size: 512 Bytes
reading uEnv.txt
679 bytes read in 10 ms (65.4 KiB/s)
Loaded environment from uEnv.txt
Importing environment from SD ...
Running uenvcmd ...
Setting clocks
Copying Linux from SD to RAM...
reading uImage
3946384 bytes read in 380 ms (9.9 MiB/s)
reading devicetree.dtb
8768 bytes read in 46 ms (185.5 KiB/s)
reading uramdisk.image.gz
** Unable to read file uramdisk.image.gz **
## Booting kernel from Legacy Image at 03000000 ...
Image Name: Linux-4.9.0
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 3946320 Bytes = 3.8 MiB
Load Address: 00008000
Entry Point: 00008000
Verifying Checksum ... OK
## Flattened Device Tree blob at 02a00000
Booting using the fdt blob at 0x2a00000
Loading Kernel Image ... OK
Loading Device Tree to 1fffa000, end 1ffff23f ... OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Linux version 4.9.0 (root#analog) (gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-12ubuntu1) ) #2 SMP PREEMPT Tue Feb 27 22:37:50 UTC 2018
CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
OF: fdt:Machine model: ags,FMC
bootconsole [earlycon0] enabled
cma: Reserved 128 MiB at 0x38000000
Memory policy: Data cache writealloc
percpu: Embedded 13 pages/cpu #ef7d5000 s23744 r8192 d21312 u53248
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 260608
Kernel command line: console=ttyPS0,115200 root=/dev/mmcblk0p2 rw earlyprintk rootfstype=ext4 rootwait
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: 900532K/1048576K available (5249K kernel code, 231K rwdata, 1696K rodata, 260K init, 154K bss, 16972K reserved, 131072K cma-reserved, 131072K highmem)
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
vmalloc : 0xf0800000 - 0xff800000 ( 240 MB)
lowmem : 0xc0000000 - 0xf0000000 ( 768 MB)
pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
.text : 0xc0008000 - 0xc0528a24 (5251 kB)
.init : 0xc0701000 - 0xc0742000 ( 260 kB)
.data : 0xc0742000 - 0xc077bd80 ( 232 kB)
.bss : 0xc077bd80 - 0xc07a27b4 ( 155 kB)
Preemptible hierarchical RCU implementation.
Build-time adjustment of leaf fanout to 32.
RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
RCU: Adjusting geometry for rcu_fanout_leaf=32, nr_cpu_ids=2
NR_IRQS:16 nr_irqs:16 16
efuse mapped to f0802000
slcr mapped to f0804000
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
zynq_clock_init: clkc starts at f0804100
Zynq clock init
clocksource: ttc_clocksource: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 537538477 ns
sched_clock: 16 bits at 54kHz, resolution 18432ns, wraps every 603975816ns
timer #0 at f080c000, irq=16
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 0x82c0 - 0x8318
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
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
cpuidle: using governor ladder
hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
hw-breakpoint: maximum watchpoint size is 4 bytes.
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.
clocksource: Switched to clocksource ttc_clocksource
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)
UDP hash table entries: 512 (order: 2, 16384 bytes)
UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
NET: Registered protocol family 1
hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7 counters available
futex hash table entries: 512 (order: 3, 32768 bytes)
workingset: timestamp_bits=30 max_order=18 bucket_order=0
jitterentropy: Initialization failed with host not compliant with requirements: 2
bounce: pool size: 64 pages
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
dma-pl330 f8003000.ps7-dma: Loaded driver for PL330 DMAC-241330
dma-pl330 f8003000.ps7-dma: DBUFF-128x8bytes Num_Chans-8 Num_Peri-4 Num_Events-16
e0001000.uart: ttyPS0 at MMIO 0xe0001000 (irq = 20, base_baud = 6249999) is a xuartps
àconsole [ttyPS0] enabled
console [ttyPS0] enabled
bootconsole [earlycon0] disabled
bootconsole [earlycon0] disabled
xdevcfg f8007000.devcfg: ioremap 0xf8007000 to f0871000
[drm] Initialized
brd: module loaded
loop: module loaded
spidev spi32766.0: buggy DT: spidev listed directly in DT
------------[ cut here ]------------
WARNING: CPU: 1 PID: 1 at drivers/spi/spidev.c:757 spidev_probe+0x178/0x1b4
Modules linked in:
CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.9.0 #2
Hardware name: Xilinx Zynq Platform
[<c0015f30>] (unwind_backtrace) from [<c0012914>] (show_stack+0x10/0x14)
[<c0012914>] (show_stack) from [<c01e60b8>] (dump_stack+0x84/0xa4)
[<c01e60b8>] (dump_stack) from [<c0023e48>] (__warn+0xd4/0x100)
[<c0023e48>] (__warn) from [<c0023e94>] (warn_slowpath_null+0x20/0x28)
[<c0023e94>] (warn_slowpath_null) from [<c02f2d44>] (spidev_probe+0x178/0x1b4)
[<c02f2d44>] (spidev_probe) from [<c02f0dfc>] (spi_drv_probe+0x7c/0xa8)
[<c02f0dfc>] (spi_drv_probe) from [<c0299b94>] (driver_probe_device+0x1f0/0x2a8)
[<c0299b94>] (driver_probe_device) from [<c0298184>] (bus_for_each_drv+0x44/0x8c)
[<c0298184>] (bus_for_each_drv) from [<c029991c>] (__device_attach+0x9c/0x100)
[<c029991c>] (__device_attach) from [<c029900c>] (bus_probe_device+0x84/0x8c)
[<c029900c>] (bus_probe_device) from [<c0297578>] (device_add+0x380/0x528)
[<c0297578>] (device_add) from [<c02f0c54>] (spi_add_device+0x8c/0x130)
[<c02f0c54>] (spi_add_device) from [<c02f25bc>] (spi_register_master+0x438/0x778)
[<c02f25bc>] (spi_register_master) from [<c02f5250>] (cdns_spi_probe+0x2bc/0x384)
[<c02f5250>] (cdns_spi_probe) from [<c029b15c>] (platform_drv_probe+0x50/0xb0)
[<c029b15c>] (platform_drv_probe) from [<c0299b94>] (driver_probe_device+0x1f0/0x2a8)
[<c0299b94>] (driver_probe_device) from [<c0299cf8>] (__driver_attach+0xac/0xb0)
[<c0299cf8>] (__driver_attach) from [<c0298220>] (bus_for_each_dev+0x54/0x88)
[<c0298220>] (bus_for_each_dev) from [<c02991f0>] (bus_add_driver+0xe8/0x1f4)
[<c02991f0>] (bus_add_driver) from [<c029a4f4>] (driver_register+0x78/0xf4)
[<c029a4f4>] (driver_register) from [<c00097ac>] (do_one_initcall+0x3c/0x16c)
[<c00097ac>] (do_one_initcall) from [<c0701d80>] (kernel_init_freeable+0x11c/0x1e8)
[<c0701d80>] (kernel_init_freeable) from [<c05233a8>] (kernel_init+0x8/0xfc)
[<c05233a8>] (kernel_init) from [<c000f938>] (ret_from_fork+0x14/0x3c)
---[ end trace dd90ee247f61645e ]---
spidev spi32765.0: buggy DT: spidev listed directly in DT
------------[ cut here ]------------
WARNING: CPU: 1 PID: 1 at drivers/spi/spidev.c:757 spidev_probe+0x178/0x1b4
Modules linked in:
CPU: 1 PID: 1 Comm: swapper/0 Tainted: G W 4.9.0 #2
Hardware name: Xilinx Zynq Platform
[<c0015f30>] (unwind_backtrace) from [<c0012914>] (show_stack+0x10/0x14)
[<c0012914>] (show_stack) from [<c01e60b8>] (dump_stack+0x84/0xa4)
[<c01e60b8>] (dump_stack) from [<c0023e48>] (__warn+0xd4/0x100)
[<c0023e48>] (__warn) from [<c0023e94>] (warn_slowpath_null+0x20/0x28)
[<c0023e94>] (warn_slowpath_null) from [<c02f2d44>] (spidev_probe+0x178/0x1b4)
[<c02f2d44>] (spidev_probe) from [<c02f0dfc>] (spi_drv_probe+0x7c/0xa8)
[<c02f0dfc>] (spi_drv_probe) from [<c0299b94>] (driver_probe_device+0x1f0/0x2a8)
[<c0299b94>] (driver_probe_device) from [<c0298184>] (bus_for_each_drv+0x44/0x8c)
[<c0298184>] (bus_for_each_drv) from [<c029991c>] (__device_attach+0x9c/0x100)
[<c029991c>] (__device_attach) from [<c029900c>] (bus_probe_device+0x84/0x8c)
[<c029900c>] (bus_probe_device) from [<c0297578>] (device_add+0x380/0x528)
[<c0297578>] (device_add) from [<c02f0c54>] (spi_add_device+0x8c/0x130)
[<c02f0c54>] (spi_add_device) from [<c02f25bc>] (spi_register_master+0x438/0x778)
[<c02f25bc>] (spi_register_master) from [<c02f5250>] (cdns_spi_probe+0x2bc/0x384)
[<c02f5250>] (cdns_spi_probe) from [<c029b15c>] (platform_drv_probe+0x50/0xb0)
[<c029b15c>] (platform_drv_probe) from [<c0299b94>] (driver_probe_device+0x1f0/0x2a8)
[<c0299b94>] (driver_probe_device) from [<c0299cf8>] (__driver_attach+0xac/0xb0)
[<c0299cf8>] (__driver_attach) from [<c0298220>] (bus_for_each_dev+0x54/0x88)
[<c0298220>] (bus_for_each_dev) from [<c02991f0>] (bus_add_driver+0xe8/0x1f4)
[<c02991f0>] (bus_add_driver) from [<c029a4f4>] (driver_register+0x78/0xf4)
[<c029a4f4>] (driver_register) from [<c00097ac>] (do_one_initcall+0x3c/0x16c)
[<c00097ac>] (do_one_initcall) from [<c0701d80>] (kernel_init_freeable+0x11c/0x1e8)
[<c0701d80>] (kernel_init_freeable) from [<c05233a8>] (kernel_init+0x8/0xfc)
[<c05233a8>] (kernel_init) from [<c000f938>] (ret_from_fork+0x14/0x3c)
---[ end trace dd90ee247f61645f ]---
spidev spi32765.1: buggy DT: spidev listed directly in DT
------------[ cut here ]------------
WARNING: CPU: 1 PID: 1 at drivers/spi/spidev.c:757 spidev_probe+0x178/0x1b4
Modules linked in:
CPU: 1 PID: 1 Comm: swapper/0 Tainted: G W 4.9.0 #2
Hardware name: Xilinx Zynq Platform
[<c0015f30>] (unwind_backtrace) from [<c0012914>] (show_stack+0x10/0x14)
[<c0012914>] (show_stack) from [<c01e60b8>] (dump_stack+0x84/0xa4)
[<c01e60b8>] (dump_stack) from [<c0023e48>] (__warn+0xd4/0x100)
[<c0023e48>] (__warn) from [<c0023e94>] (warn_slowpath_null+0x20/0x28)
[<c0023e94>] (warn_slowpath_null) from [<c02f2d44>] (spidev_probe+0x178/0x1b4)
[<c02f2d44>] (spidev_probe) from [<c02f0dfc>] (spi_drv_probe+0x7c/0xa8)
[<c02f0dfc>] (spi_drv_probe) from [<c0299b94>] (driver_probe_device+0x1f0/0x2a8)
[<c0299b94>] (driver_probe_device) from [<c0298184>] (bus_for_each_drv+0x44/0x8c)
[<c0298184>] (bus_for_each_drv) from [<c029991c>] (__device_attach+0x9c/0x100)
[<c029991c>] (__device_attach) from [<c029900c>] (bus_probe_device+0x84/0x8c)
[<c029900c>] (bus_probe_device) from [<c0297578>] (device_add+0x380/0x528)
[<c0297578>] (device_add) from [<c02f0c54>] (spi_add_device+0x8c/0x130)
[<c02f0c54>] (spi_add_device) from [<c02f25bc>] (spi_register_master+0x438/0x778)
[<c02f25bc>] (spi_register_master) from [<c02f5250>] (cdns_spi_probe+0x2bc/0x384)
[<c02f5250>] (cdns_spi_probe) from [<c029b15c>] (platform_drv_probe+0x50/0xb0)
[<c029b15c>] (platform_drv_probe) from [<c0299b94>] (driver_probe_device+0x1f0/0x2a8)
[<c0299b94>] (driver_probe_device) from [<c0299cf8>] (__driver_attach+0xac/0xb0)
[<c0299cf8>] (__driver_attach) from [<c0298220>] (bus_for_each_dev+0x54/0x88)
[<c0298220>] (bus_for_each_dev) from [<c02991f0>] (bus_add_driver+0xe8/0x1f4)
[<c02991f0>] (bus_add_driver) from [<c029a4f4>] (driver_register+0x78/0xf4)
[<c029a4f4>] (driver_register) from [<c00097ac>] (do_one_initcall+0x3c/0x16c)
[<c00097ac>] (do_one_initcall) from [<c0701d80>] (kernel_init_freeable+0x11c/0x1e8)
[<c0701d80>] (kernel_init_freeable) from [<c05233a8>] (kernel_init+0x8/0xfc)
[<c05233a8>] (kernel_init) from [<c000f938>] (ret_from_fork+0x14/0x3c)
---[ end trace dd90ee247f616460 ]---
spidev spi32765.2: buggy DT: spidev listed directly in DT
------------[ cut here ]------------
WARNING: CPU: 1 PID: 1 at drivers/spi/spidev.c:757 spidev_probe+0x178/0x1b4
Modules linked in:
CPU: 1 PID: 1 Comm: swapper/0 Tainted: G W 4.9.0 #2
Hardware name: Xilinx Zynq Platform
[<c0015f30>] (unwind_backtrace) from [<c0012914>] (show_stack+0x10/0x14)
[<c0012914>] (show_stack) from [<c01e60b8>] (dump_stack+0x84/0xa4)
[<c01e60b8>] (dump_stack) from [<c0023e48>] (__warn+0xd4/0x100)
[<c0023e48>] (__warn) from [<c0023e94>] (warn_slowpath_null+0x20/0x28)
[<c0023e94>] (warn_slowpath_null) from [<c02f2d44>] (spidev_probe+0x178/0x1b4)
[<c02f2d44>] (spidev_probe) from [<c02f0dfc>] (spi_drv_probe+0x7c/0xa8)
[<c02f0dfc>] (spi_drv_probe) from [<c0299b94>] (driver_probe_device+0x1f0/0x2a8)
[<c0299b94>] (driver_probe_device) from [<c0298184>] (bus_for_each_drv+0x44/0x8c)
[<c0298184>] (bus_for_each_drv) from [<c029991c>] (__device_attach+0x9c/0x100)
[<c029991c>] (__device_attach) from [<c029900c>] (bus_probe_device+0x84/0x8c)
[<c029900c>] (bus_probe_device) from [<c0297578>] (device_add+0x380/0x528)
[<c0297578>] (device_add) from [<c02f0c54>] (spi_add_device+0x8c/0x130)
[<c02f0c54>] (spi_add_device) from [<c02f25bc>] (spi_register_master+0x438/0x778)
[<c02f25bc>] (spi_register_master) from [<c02f5250>] (cdns_spi_probe+0x2bc/0x384)
[<c02f5250>] (cdns_spi_probe) from [<c029b15c>] (platform_drv_probe+0x50/0xb0)
[<c029b15c>] (platform_drv_probe) from [<c0299b94>] (driver_probe_device+0x1f0/0x2a8)
[<c0299b94>] (driver_probe_device) from [<c0299cf8>] (__driver_attach+0xac/0xb0)
[<c0299cf8>] (__driver_attach) from [<c0298220>] (bus_for_each_dev+0x54/0x88)
[<c0298220>] (bus_for_each_dev) from [<c02991f0>] (bus_add_driver+0xe8/0x1f4)
[<c02991f0>] (bus_add_driver) from [<c029a4f4>] (driver_register+0x78/0xf4)
[<c029a4f4>] (driver_register) from [<c00097ac>] (do_one_initcall+0x3c/0x16c)
[<c00097ac>] (do_one_initcall) from [<c0701d80>] (kernel_init_freeable+0x11c/0x1e8)
[<c0701d80>] (kernel_init_freeable) from [<c05233a8>] (kernel_init+0x8/0xfc)
[<c05233a8>] (kernel_init) from [<c000f938>] (ret_from_fork+0x14/0x3c)
---[ end trace dd90ee247f616461 ]---
MACsec IEEE 802.1AE
libphy: Fixed MDIO Bus: probed
libphy: mdio_driver_register: xgmiitorgmii
tun: Universal TUN/TAP device driver, 1.6
tun: (C) 1999-2004 Max Krasnyansky <maxk#qualcomm.com>
libphy: XEMACPS mii bus: probed
[Firmware Warn]: /amba#0/eth#e000b000/phy#0: Whitelisted compatible string. Please remove
xemacps e000b000.eth: pdev->id -1, baseaddr 0xe000b000, irq 33
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
usbcore: registered new interface driver usb-storage
usbcore: registered new interface driver usbserial
usbcore: registered new interface driver usbserial_generic
usbserial: USB Serial support registered for generic
usbcore: registered new interface driver ftdi_sio
usbserial: USB Serial support registered for FTDI USB Serial Device
mousedev: PS/2 mouse device common for all mice
i2c /dev entries driver
cdns-i2c e0004000.i2c: 400 kHz mmio e0004000 irq 36
usbcore: registered new interface driver uvcvideo
USB Video Class driver (1.1.1)
gspca_main: v2.14.0 registered
Xilinx Zynq CpuIdle Driver started
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
sdhci-pltfm: SDHCI platform and OF driver helper
mmc0: SDHCI controller on e0100000.sdhci [e0100000.sdhci] using ADMA
ledtrig-cpu: registered to indicate activity on CPUs
hidraw: raw HID events driver (C) Jiri Kosina
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
cf_axi_adc 79020000.cf-ad9361-lpc: could not find spi node
OF: /fpga-axi#0/cf-ad9361-dds-core-lpc#79024000: could not find phandle
ERROR: could not get clock /fpga-axi#0/cf-ad9361-dds-core-lpc#79024000:sampl_clk(0)
cf_axi_dds: probe of 79024000.cf-ad9361-dds-core-lpc failed with error -2
NET: Registered protocol family 17
zynq_pm_remap_ocm: no compatible node found for 'xlnx,zynq-ocmc-1.0'
zynq_pm_suspend_init: Unable to map OCM.
Registering SWP/SWPB emulation handler
hctosys: unable to open rtc device (rtc0)
ALSA device list:
No soundcards found.
Waiting for root device /dev/mmcblk0p2...
mmc0: new high speed SDHC card at address aaaa
mmcblk0: mmc0:aaaa SS08G 7.40 GiB
mmcblk0: p1 p2 p3
EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
VFS: Mounted root (ext4 filesystem) on device 179:2.
devtmpfs: mounted
Freeing unused kernel memory: 260K (c0701000 - c0742000)
This architecture does not have kernel memory protection.
random: fast init done
Mount failed for selinuxfs on /sys/fs/selinux: No such file or directory
init: hwclock main process (799) terminated with status 1
Adding 511996k swap on /swapfile. Priority:-1 extents:1 across:511996k SS
* Setting up X socket directories... [ OK ]
Setting default sampling frequency to 2.1 MSPS
/etc/rcS.d/S99default-sdr: line 3: /sys/bus/iio/devices/iio:device1/in_voltage_sampling_frequency: No such file or directory
Loading default filter
/etc/rcS.d/S99default-sdr: line 7: /sys/bus/iio/devices/iio:device1/filter_fir_config: No such file or directory
* STARTDISTCC is set to false in /etc/default/distcc
* /usr/bin/distccd not starting
* Starting NTP server ntpd [ OK ]
* Starting web server apache2 AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
*
* Starting IIO Daemon iiod [ OK ]
Last login: Thu Jan 1 21:40:23 UTC 1970 from 169.254.212.36 on pts/1
Welcome to Linaro 14.04 (GNU/Linux 4.9.0 armv7l)
Which driver are you using, your custom driver or Xilinx GPIO?
As I understand you hardcoded Linux IRQ number 94 in register irq?
94: 0 0 zynq-gpio 48 Level my_int_handle
I would say that you have to declare your GPIO node as interrupt controller in the device tree with appropiate interrupt property, because driver uses that information for interrupt:
gpio->irq = platform_get_irq(pdev, 0);
I'm not sure of the exact IRQ number mapping.
Device tree node for GPIO controller on Zynq looks like this:
gpio#e000a000 {
#gpio-cells = <2>;
#interrupt-cells = <2>;
compatible = "xlnx,zynq-gpio-1.0";
clocks = <&&clkc 42>;
gpio-controller;
interrupt-controller;
interrupt-parent = <&&intc>;
interrupts = <0 20 4>;
interrupt-controller;
#interrupt-cells = <2>;
reg = <0xe000a000 0x1000>;
};
If you use hardcoded Linux IRQ number instead of device tree, you can try to find it with probe_irq_on/off();

ioremap returns NULL

I'm trying to create a customised UART driver for Raspberry PI.
I try to ioremap the MMIO. But ioremap returns always NULL.
#define UART_REG_BASE_ADDR 0x7E20100
pUart = ioremap(UART_REG_BASE_ADDR, 1024);
if (pUart==NULL)
{
printk("Couldn't remap UART MMIO\n");
return -EIO;
}
dmesg dumps following:
[ 2906.579848] CPU: 0 PID: 4983 Comm: insmod Tainted: G D W O 3.18.5+ #1
[ 2906.590783] [<c0014b64>] (unwind_backtrace) from [<c00120ec>] (show_stack+0x20/0x24)
[ 2906.614046] [<c00120ec>] (show_stack) from [<c0549008>] (dump_stack+0x20/0x28)
[ 2906.624803] [<c0549008>] (dump_stack) from [<c0022620>] (warn_slowpath_common+0x7c/0x9c)
[ 2906.647925] [<c0022620>] (warn_slowpath_common) from [<c002266c>] (warn_slowpath_null+0x2c/0x34)
[ 2906.668656] [<c002266c>] (warn_slowpath_null) from [<c001a888>] (__arm_ioremap_pfn_caller+0x240/0x25c)
[ 2906.691936] [<c001a888>] (__arm_ioremap_pfn_caller) from [<c001a934>] (__arm_ioremap_caller+0x68/0x70)
[ 2906.713171] [<c001a934>] (__arm_ioremap_caller) from [<c001a3d0>] (__arm_ioremap+0x24/0x2c)
[ 2906.735043] [<c001a3d0>] (__arm_ioremap) from [<bf19c028>] (hello_init+0x28/0x88 [domotx])
[ 2906.755780] [<bf19c028>] (hello_init [domotx]) from [<c000873c>] (do_one_initcall+0x94/0x1e4)
[ 2906.778165] [<c000873c>] (do_one_initcall) from [<c0087e70>] (load_module+0x1848/0x1e38)
[ 2906.799410] [<c0087e70>] (load_module) from [<c008854c>] (SyS_init_module+0xec/0xf0)
[ 2906.822660] [<c008854c>] (SyS_init_module) from [<c000e980>] (ret_fast_syscall+0x0/0x48)
[ 2906.844558] ---[ end trace c7cdd8b3d5007a1b ]---
[ 2906.856382] Couldn't remap UART MMIO
What do I do wrong?
I found the solution for the problem reported above. Actually the solution is two-fold:
The BCM2835 datasheet does not advertise physical addresses in their datasheet:
Physical addresses range from 0x20000000 to 0x20FFFFFF for peripherals. The bus addresses for peripherals are set up to map onto the peripheral bus address range starting at 0x7E000000. Thus a peripheral advertised here at bus address 0x7Ennnnnn is available at physical address 0x20nnnnnn.
There is a typo in the datasheet:
The PL011 USRT is mapped on base adderss 0x7E20100. which must be The PL011 USRT is mapped on base adderss 0x7E201000.

cannot transfer packet via serial COM

I have a Linux Ubuntu installed on an Intel Panel PC. My code did not run so, I checked out packet transfer using cutecom. It does OPEN THE PORT successfully, but no data is transfered. I plugged the serial port to my own PC, it works.
One thing crossed my mind that the error could have error come from was checking the BIOS, how ttyS0-3 are allocated. Bios shows S0 to 11 or upper. All in AVAILABLE mode, I set S3 to RESERVED and checked via cutecom again. NO TRANSFER!.
On the other hand, I DO NOT THINK that a driver should be installed for distinguishing the PC COMs, it SHOULD identify them automatically.
/input0
[ 0.416691] ACPI: Power Button [PWRB]
[ 0.416846] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input1
[ 0.416859] ACPI: Power Button [PWRF]
[ 0.443708] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[ 0.557357] serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
[ 0.708888] serial8250: ttyS2 at I/O 0x3e8 (irq = 4) is a 16550A
[ 0.872588] serial8250: ttyS3 at I/O 0x2e8 (irq = 3) is a 16550A
[ 1.015669] 00:06: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[ 1.036607] 00:07: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
[ 1.060599] 00:08: ttyS2 at I/O 0x3e8 (irq = 11) is a 16550A
[ 1.084589] 00:09: ttyS3 at I/O 0x2e8 (irq = 10) is a 16550A
[ 1.085551] agpgart-intel 0000:00:00.0: detected gtt size: 262144K total, 262144K
[ 14.956323] serio: Serial port ttyS1
[ 14.994250] serio: Serial port ttyS1
[ 15.032073] input: Elo Serial TouchScreen as /devices/pnp0/00:07/tty/ttyS1/serio2/input
is there anything wrong with what dmesg shows? shall i change irqs using setirq?
if yes, please write me an example of the details please.

Resources