spi: orion: cosmetics - alias long direct_access variables
This change increases the source code readability. Instead of using `spi->child[cs].direct_access.XXX` use `dir_acc->XXX`. Instead of using `orion_spi->child[cs].direct_access.vaddr` use `vaddr`. Signed-off-by: Kosta Zertsekel <zertsekel@gmail.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Stefan Roese <sr@denx.de> Reviewed-by: Jan Kundrát <jan.kundrat@cesnet.cz> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
c1d8b0825d
commit
c7ba473628
@ -431,6 +431,7 @@ orion_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer)
|
|||||||
int word_len;
|
int word_len;
|
||||||
struct orion_spi *orion_spi;
|
struct orion_spi *orion_spi;
|
||||||
int cs = spi->chip_select;
|
int cs = spi->chip_select;
|
||||||
|
void __iomem *vaddr;
|
||||||
|
|
||||||
word_len = spi->bits_per_word;
|
word_len = spi->bits_per_word;
|
||||||
count = xfer->len;
|
count = xfer->len;
|
||||||
@ -441,8 +442,9 @@ orion_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer)
|
|||||||
* Use SPI direct write mode if base address is available. Otherwise
|
* Use SPI direct write mode if base address is available. Otherwise
|
||||||
* fall back to PIO mode for this transfer.
|
* fall back to PIO mode for this transfer.
|
||||||
*/
|
*/
|
||||||
if ((orion_spi->child[cs].direct_access.vaddr) && (xfer->tx_buf) &&
|
vaddr = orion_spi->child[cs].direct_access.vaddr;
|
||||||
(word_len == 8)) {
|
|
||||||
|
if (vaddr && xfer->tx_buf && word_len == 8) {
|
||||||
unsigned int cnt = count / 4;
|
unsigned int cnt = count / 4;
|
||||||
unsigned int rem = count % 4;
|
unsigned int rem = count % 4;
|
||||||
|
|
||||||
@ -450,13 +452,11 @@ orion_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer)
|
|||||||
* Send the TX-data to the SPI device via the direct
|
* Send the TX-data to the SPI device via the direct
|
||||||
* mapped address window
|
* mapped address window
|
||||||
*/
|
*/
|
||||||
iowrite32_rep(orion_spi->child[cs].direct_access.vaddr,
|
iowrite32_rep(vaddr, xfer->tx_buf, cnt);
|
||||||
xfer->tx_buf, cnt);
|
|
||||||
if (rem) {
|
if (rem) {
|
||||||
u32 *buf = (u32 *)xfer->tx_buf;
|
u32 *buf = (u32 *)xfer->tx_buf;
|
||||||
|
|
||||||
iowrite8_rep(orion_spi->child[cs].direct_access.vaddr,
|
iowrite8_rep(vaddr, &buf[cnt], rem);
|
||||||
&buf[cnt], rem);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
@ -683,6 +683,7 @@ static int orion_spi_probe(struct platform_device *pdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for_each_available_child_of_node(pdev->dev.of_node, np) {
|
for_each_available_child_of_node(pdev->dev.of_node, np) {
|
||||||
|
struct orion_direct_acc *dir_acc;
|
||||||
u32 cs;
|
u32 cs;
|
||||||
int cs_gpio;
|
int cs_gpio;
|
||||||
|
|
||||||
@ -750,14 +751,13 @@ static int orion_spi_probe(struct platform_device *pdev)
|
|||||||
* This needs to get extended for the direct SPI-NOR / SPI-NAND
|
* This needs to get extended for the direct SPI-NOR / SPI-NAND
|
||||||
* support, once this gets implemented.
|
* support, once this gets implemented.
|
||||||
*/
|
*/
|
||||||
spi->child[cs].direct_access.vaddr = devm_ioremap(&pdev->dev,
|
dir_acc = &spi->child[cs].direct_access;
|
||||||
r->start,
|
dir_acc->vaddr = devm_ioremap(&pdev->dev, r->start, PAGE_SIZE);
|
||||||
PAGE_SIZE);
|
if (!dir_acc->vaddr) {
|
||||||
if (!spi->child[cs].direct_access.vaddr) {
|
|
||||||
status = -ENOMEM;
|
status = -ENOMEM;
|
||||||
goto out_rel_axi_clk;
|
goto out_rel_axi_clk;
|
||||||
}
|
}
|
||||||
spi->child[cs].direct_access.size = PAGE_SIZE;
|
dir_acc->size = PAGE_SIZE;
|
||||||
|
|
||||||
dev_info(&pdev->dev, "CS%d configured for direct access\n", cs);
|
dev_info(&pdev->dev, "CS%d configured for direct access\n", cs);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user