Index: cifx_m2/ax99100-pci-gpio.c =================================================================== --- cifx_m2/ax99100-pci-gpio.c (revision 14650) +++ cifx_m2/ax99100-pci-gpio.c (working copy) @@ -427,6 +427,17 @@ return ngpio; } +static int ax99100_pci_gpio_irq_init_hw(struct gpio_chip *gc) +{ + struct priv_data *pd = gpiochip_get_data(gc); + + /* Confirm / Enable global GPIO IRQ */ + iowrite32(sGIxR(1), &pd->reg.global_irq->gicr); + iomod32(0, sGIxR(1), &pd->reg.global_irq->gier); + + return 0; +} + /** * ax99100_pci_gpio_probe: * @@ -441,6 +452,9 @@ struct priv_data *pd; struct gpio_chip *gc; struct irq_chip *ic; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0) + struct gpio_irq_chip *girq; +#endif int err; pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); @@ -498,11 +512,13 @@ spin_lock_init(&pd->lock); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0) err = gpiochip_add_data(gc, pd); if (err) { dev_err(dev, "Register GPIO-Chip failed!\n"); goto err5; } +#endif if (pci->irq > 0) { ic = &pd->irq_chip; @@ -511,16 +527,37 @@ ic->irq_unmask = ax99100_pci_gpio_irq_unmask; ic->irq_set_type = ax99100_pci_gpio_irq_set_type; +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0) err = gpiochip_irqchip_add(gc, ic, 0, handle_simple_irq, IRQ_TYPE_NONE); - if (err) { + if (err < 0) { dev_err(dev, "Register IRQ-Chip failed!\n"); goto err6; } gpiochip_set_chained_irqchip(gc, ic, pci->irq, ax99100_pci_gpio_isr); + ax99100_pci_gpio_irq_init_hw(gc); +#else + girq = &gc->irq; + girq->chip = ic; + girq->parent_handler = ax99100_pci_gpio_isr; + girq->num_parents = 1; + girq->parents = devm_kcalloc(dev, girq->num_parents, + sizeof(*girq->parents), + GFP_KERNEL); + if (!girq->parents) + return -ENOMEM; - /* Confirm / Enable global GPIO IRQ */ - iowrite32(sGIxR(1), &pd->reg.global_irq->gicr); - iomod32(0, sGIxR(1), &pd->reg.global_irq->gier); + girq->parents[0] = pci->irq; + girq->default_type = IRQ_TYPE_NONE; + girq->handler = handle_bad_irq; + girq->init_hw = ax99100_pci_gpio_irq_init_hw; + + err = devm_gpiochip_add_data(dev, gc, pd); + if (err < 0) { + dev_err(dev, "Register IRQ-Chip failed!\n"); + goto err6; + } +#endif + } dev_info(dev, "gpiochip%d with %d GPIOs successfully probed!\n", gc->base, gc->ngpio); @@ -530,7 +567,9 @@ err6: gpiochip_remove(gc); ax99100_pci_gpio_chip_deinit(pd); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0) err5: +#endif pci_iounmap(pci, pd->reg.gpio); err4: pci_iounmap(pci, pd->reg.global_irq); Index: cifx_m2/ax99100-pci-spi.c =================================================================== --- cifx_m2/ax99100-pci-spi.c (revision 14650) +++ cifx_m2/ax99100-pci-spi.c (working copy) @@ -35,6 +35,8 @@ #include #include +#include + /* -------------------------------------------------------------------------- */ /* ------ Global chip settings ---------------------------------------------- */ /* -------------------------------------------------------------------------- */ @@ -493,16 +495,23 @@ struct spi_board_info spi_slave_devices[NUM_CHIPSELECT] = {0}; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 3, 0) + module_param_named(mode0, spi_slave_devices[0].mode, uint, 0644); + module_param_named(mode1, spi_slave_devices[1].mode, uint, 0644); + module_param_named(mode2, spi_slave_devices[2].mode, uint, 0644); +#else + module_param_named(mode0, spi_slave_devices[0].mode, ushort, 0644); + module_param_named(mode1, spi_slave_devices[1].mode, ushort, 0644); + module_param_named(mode2, spi_slave_devices[2].mode, ushort, 0644); +#endif + module_param_string(modalias0, spi_slave_devices[0].modalias, sizeof(spi_slave_devices[0].modalias), 0644); -module_param_named(mode0, spi_slave_devices[0].mode, ushort, 0644); module_param_named(max_speed_hz0, spi_slave_devices[0].max_speed_hz, uint, 0644); module_param_string(modalias1, spi_slave_devices[1].modalias, sizeof(spi_slave_devices[0].modalias), 0644); -module_param_named(mode1, spi_slave_devices[1].mode, ushort, 0644); module_param_named(max_speed_hz1, spi_slave_devices[1].max_speed_hz, uint, 0644); module_param_string(modalias2, spi_slave_devices[2].modalias, sizeof(spi_slave_devices[0].modalias), 0644); -module_param_named(mode2, spi_slave_devices[2].mode, ushort, 0644); module_param_named(max_speed_hz2, spi_slave_devices[2].max_speed_hz, uint, 0644); /** Index: cifx_m2/readme =================================================================== --- cifx_m2/readme (revision 14650) +++ cifx_m2/readme (working copy) @@ -57,6 +57,10 @@ In common Linux environment choose "spidev" as the driver which handles the SPI acccess. The device will appear than as /dev/spidev[x].0 + NOTE: Starting with kernel 5.x "spidev" was removed. You will need to use one of the following list + https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/spi/spidev.c?h=v5.15.90#n687 + (e.g. spi-petra) + - mode[0..2]=[0..3] Optional, if not specified mode 3 is choosen.