Re: [PATCH RFC] spi: add flow controll support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Oleksij,

On Mon, Feb 29, 2016 at 1:04 PM, Oleksij Rempel <linux@xxxxxxxxxxxxxxxx> wrote:
> Different HW implement different variants of SPI based flow control (FC).

Thanks for your patch!

> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c

> +/* spi_fc_probe should be called by spi_device driver. */
> +int spi_fc_probe(struct spi_device *spi)
> +{
> +       struct device_node *np = spi->dev.of_node;
> +       int ret;
> +
> +       if (!np)
> +               return 0;
> +
> +       if (!(spi->mode & SPI_FC_MASK) || spi->mode & SPI_FC_HW_ONLY)
> +               return 0;
> +
> +       spi->fc_gpio = devm_gpiod_get(&spi->dev, "fc", GPIOD_IN);
> +       if (IS_ERR(spi->fc_gpio)) {
> +               ret = PTR_ERR(spi->fc_gpio);
> +               dev_err(&spi->dev, "Failed to request FC GPIO: %d\n", ret);
> +               return ret;
> +       }
> +
> +       init_completion(&spi->fc_complete);
> +       snprintf(spi->fc_irq_name, sizeof(spi->fc_irq_name), "spi-fc-%s",
> +                dev_name(&spi->dev));
> +       ret = devm_request_irq(&spi->dev, gpiod_to_irq(spi->fc_gpio),

gpiod_to_irq() will return -ENXIO if the GPIO doesn't support interrupts.
Granted, devm_request_irq() will fail in that case, but you may want to support
polling.

> +                              spi_fc_rq,
> +                              IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
> +                              spi->fc_irq_name, spi);

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux