// SPDX-License-Identifier: GPL-2.0-only /* * Altera SPI driver * * Copyright (C) 2008 Thomas Chou <thomas@wytron.com.tw> * * Based on spi_s3c24xx.c, which is: * Copyright (c) 2006 Ben Dooks * Copyright (c) 2006 Simtec Electronics * Ben Dooks <ben@simtec.co.uk>
*/
host = spi_alloc_host(&pdev->dev, sizeof(struct altera_spi)); if (!host) return err;
/* setup the host state. */
host->bus_num = -1;
if (pdata) { if (pdata->num_chipselect > ALTERA_SPI_MAX_CS) {
dev_err(&pdev->dev, "Invalid number of chipselect: %u\n",
pdata->num_chipselect);
err = -EINVAL; gotoexit;
}
/* irq is optional */
hw->irq = platform_get_irq(pdev, 0); if (hw->irq >= 0) {
err = devm_request_irq(&pdev->dev, hw->irq, altera_spi_irq, 0,
pdev->name, host); if (err) gotoexit;
}
err = devm_spi_register_controller(&pdev->dev, host); if (err) gotoexit;
if (pdata) { for (i = 0; i < pdata->num_devices; i++) { if (!spi_new_device(host, pdata->devices + i))
dev_warn(&pdev->dev, "unable to create SPI device: %s\n",
pdata->devices[i].modalias);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.