Commit 71d631a7 authored by Federico Vaga's avatar Federico Vaga

sw:drv:spi: add devices to pdata

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 74a67271
......@@ -7,9 +7,16 @@
#ifndef __SPI_OCORES_PDATA_H__
#define __SPI_OCORES_PDATA_H__
#include <linux/spi/spi.h>
/**
* struct spi_ocores_platform_data - OpenCores SPI data
*/
struct spi_ocores_platform_data {
unsigned int big_endian;
unsigned int clock_hz;
unsigned int num_devices;
struct spi_board_info *devices;
};
#endif
......@@ -135,6 +135,8 @@ static struct resource spec_fpga_spi_res[] = {
static struct spi_ocores_platform_data spec_fpga_spi_pdata = {
.big_endian = 0,
.clock_hz = 65200000,
.num_devices = 0,
.devices = NULL,
};
......
......@@ -598,6 +598,7 @@ static int spi_ocores_probe(struct platform_device *pdev)
struct resource *r;
int err;
int irq;
int i;
pr_info("%s:%d\n", __func__, __LINE__);
master = spi_alloc_master(&pdev->dev, sizeof(*sp));
......@@ -664,6 +665,16 @@ static int spi_ocores_probe(struct platform_device *pdev)
if (err)
goto err_reg_spi;
for (i = 0; i < pdata->num_devices; ++i) {
struct spi_device *sdev;
sdev = spi_new_device(master, &pdata->devices[i]);
if (!sdev)
dev_err(&pdev->dev,
"Cannot register SPI device '%s'\n",
pdata->devices[i].modalias);
}
return 0;
err_reg_spi:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment