Commit 57f22cd2 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'spi/topic/ti-qspi' and 'spi/topic/topcliff-pch' into spi-next

...@@ -652,7 +652,8 @@ static int ti_qspi_probe(struct platform_device *pdev) ...@@ -652,7 +652,8 @@ static int ti_qspi_probe(struct platform_device *pdev)
r = platform_get_resource(pdev, IORESOURCE_MEM, 0); r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (r == NULL) { if (r == NULL) {
dev_err(&pdev->dev, "missing platform data\n"); dev_err(&pdev->dev, "missing platform data\n");
return -ENODEV; ret = -ENODEV;
goto free_master;
} }
} }
...@@ -669,7 +670,8 @@ static int ti_qspi_probe(struct platform_device *pdev) ...@@ -669,7 +670,8 @@ static int ti_qspi_probe(struct platform_device *pdev)
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) { if (irq < 0) {
dev_err(&pdev->dev, "no irq resource?\n"); dev_err(&pdev->dev, "no irq resource?\n");
return irq; ret = irq;
goto free_master;
} }
mutex_init(&qspi->list_lock); mutex_init(&qspi->list_lock);
...@@ -685,15 +687,17 @@ static int ti_qspi_probe(struct platform_device *pdev) ...@@ -685,15 +687,17 @@ static int ti_qspi_probe(struct platform_device *pdev)
qspi->ctrl_base = qspi->ctrl_base =
syscon_regmap_lookup_by_phandle(np, syscon_regmap_lookup_by_phandle(np,
"syscon-chipselects"); "syscon-chipselects");
if (IS_ERR(qspi->ctrl_base)) if (IS_ERR(qspi->ctrl_base)) {
return PTR_ERR(qspi->ctrl_base); ret = PTR_ERR(qspi->ctrl_base);
goto free_master;
}
ret = of_property_read_u32_index(np, ret = of_property_read_u32_index(np,
"syscon-chipselects", "syscon-chipselects",
1, &qspi->ctrl_reg); 1, &qspi->ctrl_reg);
if (ret) { if (ret) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"couldn't get ctrl_mod reg index\n"); "couldn't get ctrl_mod reg index\n");
return ret; goto free_master;
} }
} }
...@@ -743,6 +747,7 @@ static int ti_qspi_probe(struct platform_device *pdev) ...@@ -743,6 +747,7 @@ static int ti_qspi_probe(struct platform_device *pdev)
if (!ret) if (!ret)
return 0; return 0;
pm_runtime_disable(&pdev->dev);
free_master: free_master:
spi_master_put(master); spi_master_put(master);
return ret; return ret;
......
...@@ -591,7 +591,6 @@ static void pch_spi_set_tx(struct pch_spi_data *data, int *bpw) ...@@ -591,7 +591,6 @@ static void pch_spi_set_tx(struct pch_spi_data *data, int *bpw)
if (!data->pkt_rx_buff) { if (!data->pkt_rx_buff) {
/* flush queue and set status of all transfers to -ENOMEM */ /* flush queue and set status of all transfers to -ENOMEM */
dev_err(&data->master->dev, "%s :kzalloc failed\n", __func__);
list_for_each_entry_safe(pmsg, tmp, data->queue.next, queue) { list_for_each_entry_safe(pmsg, tmp, data->queue.next, queue) {
pmsg->status = -ENOMEM; pmsg->status = -ENOMEM;
...@@ -622,8 +621,9 @@ static void pch_spi_set_tx(struct pch_spi_data *data, int *bpw) ...@@ -622,8 +621,9 @@ static void pch_spi_set_tx(struct pch_spi_data *data, int *bpw)
if (n_writes > PCH_MAX_FIFO_DEPTH) if (n_writes > PCH_MAX_FIFO_DEPTH)
n_writes = PCH_MAX_FIFO_DEPTH; n_writes = PCH_MAX_FIFO_DEPTH;
dev_dbg(&data->master->dev, "\n%s:Pulling down SSN low - writing " dev_dbg(&data->master->dev,
"0x2 to SSNXCR\n", __func__); "\n%s:Pulling down SSN low - writing 0x2 to SSNXCR\n",
__func__);
pch_spi_writereg(data->master, PCH_SSNXCR, SSN_LOW); pch_spi_writereg(data->master, PCH_SSNXCR, SSN_LOW);
for (j = 0; j < n_writes; j++) for (j = 0; j < n_writes; j++)
...@@ -915,7 +915,6 @@ static void pch_spi_release_dma(struct pch_spi_data *data) ...@@ -915,7 +915,6 @@ static void pch_spi_release_dma(struct pch_spi_data *data)
dma_release_channel(dma->chan_rx); dma_release_channel(dma->chan_rx);
dma->chan_rx = NULL; dma->chan_rx = NULL;
} }
return;
} }
static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw) static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw)
...@@ -1008,7 +1007,7 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw) ...@@ -1008,7 +1007,7 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw)
spin_unlock_irqrestore(&data->lock, flags); spin_unlock_irqrestore(&data->lock, flags);
/* RX */ /* RX */
dma->sg_rx_p = kzalloc(sizeof(struct scatterlist)*num, GFP_ATOMIC); dma->sg_rx_p = kcalloc(num, sizeof(*dma->sg_rx_p), GFP_ATOMIC);
sg_init_table(dma->sg_rx_p, num); /* Initialize SG table */ sg_init_table(dma->sg_rx_p, num); /* Initialize SG table */
/* offset, length setting */ /* offset, length setting */
sg = dma->sg_rx_p; sg = dma->sg_rx_p;
...@@ -1068,7 +1067,7 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw) ...@@ -1068,7 +1067,7 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw)
head = 0; head = 0;
} }
dma->sg_tx_p = kzalloc(sizeof(struct scatterlist)*num, GFP_ATOMIC); dma->sg_tx_p = kcalloc(num, sizeof(*dma->sg_tx_p), GFP_ATOMIC);
sg_init_table(dma->sg_tx_p, num); /* Initialize SG table */ sg_init_table(dma->sg_tx_p, num); /* Initialize SG table */
/* offset, length setting */ /* offset, length setting */
sg = dma->sg_tx_p; sg = dma->sg_tx_p;
...@@ -1181,14 +1180,16 @@ static void pch_spi_process_messages(struct work_struct *pwork) ...@@ -1181,14 +1180,16 @@ static void pch_spi_process_messages(struct work_struct *pwork)
data->cur_trans = data->cur_trans =
list_entry(data->current_msg->transfers.next, list_entry(data->current_msg->transfers.next,
struct spi_transfer, transfer_list); struct spi_transfer, transfer_list);
dev_dbg(&data->master->dev, "%s " dev_dbg(&data->master->dev,
":Getting 1st transfer message\n", __func__); "%s :Getting 1st transfer message\n",
__func__);
} else { } else {
data->cur_trans = data->cur_trans =
list_entry(data->cur_trans->transfer_list.next, list_entry(data->cur_trans->transfer_list.next,
struct spi_transfer, transfer_list); struct spi_transfer, transfer_list);
dev_dbg(&data->master->dev, "%s " dev_dbg(&data->master->dev,
":Getting next transfer message\n", __func__); "%s :Getting next transfer message\n",
__func__);
} }
spin_unlock(&data->lock); spin_unlock(&data->lock);
...@@ -1233,9 +1234,8 @@ static void pch_spi_process_messages(struct work_struct *pwork) ...@@ -1233,9 +1234,8 @@ static void pch_spi_process_messages(struct work_struct *pwork)
/* check for delay */ /* check for delay */
if (data->cur_trans->delay_usecs) { if (data->cur_trans->delay_usecs) {
dev_dbg(&data->master->dev, "%s:" dev_dbg(&data->master->dev, "%s:delay in usec=%d\n",
"delay in usec=%d\n", __func__, __func__, data->cur_trans->delay_usecs);
data->cur_trans->delay_usecs);
udelay(data->cur_trans->delay_usecs); udelay(data->cur_trans->delay_usecs);
} }
...@@ -1292,7 +1292,6 @@ static void pch_free_dma_buf(struct pch_spi_board_data *board_dat, ...@@ -1292,7 +1292,6 @@ static void pch_free_dma_buf(struct pch_spi_board_data *board_dat,
if (dma->rx_buf_dma) if (dma->rx_buf_dma)
dma_free_coherent(&board_dat->pdev->dev, PCH_BUF_SIZE, dma_free_coherent(&board_dat->pdev->dev, PCH_BUF_SIZE,
dma->rx_buf_virt, dma->rx_buf_dma); dma->rx_buf_virt, dma->rx_buf_dma);
return;
} }
static void pch_alloc_dma_buf(struct pch_spi_board_data *board_dat, static void pch_alloc_dma_buf(struct pch_spi_board_data *board_dat,
...@@ -1541,11 +1540,11 @@ static int pch_spi_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1541,11 +1540,11 @@ static int pch_spi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
int i; int i;
struct pch_pd_dev_save *pd_dev_save; struct pch_pd_dev_save *pd_dev_save;
pd_dev_save = kzalloc(sizeof(struct pch_pd_dev_save), GFP_KERNEL); pd_dev_save = kzalloc(sizeof(*pd_dev_save), GFP_KERNEL);
if (!pd_dev_save) if (!pd_dev_save)
return -ENOMEM; return -ENOMEM;
board_dat = kzalloc(sizeof(struct pch_spi_board_data), GFP_KERNEL); board_dat = kzalloc(sizeof(*board_dat), GFP_KERNEL);
if (!board_dat) { if (!board_dat) {
retval = -ENOMEM; retval = -ENOMEM;
goto err_no_mem; goto err_no_mem;
......
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