Lines Matching +full:spi +full:- +full:clk
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Cavium ThunderX SPI driver.
11 #include <linux/spi/spi.h>
13 #include "spi-cavium.h"
15 #define DRV_NAME "spi-thunderx"
22 struct device *dev = &pdev->dev; in thunderx_spi_probe()
29 return -ENOMEM; in thunderx_spi_probe()
41 p->register_base = pcim_iomap(pdev, 0, pci_resource_len(pdev, 0)); in thunderx_spi_probe()
42 if (!p->register_base) { in thunderx_spi_probe()
43 ret = -EINVAL; in thunderx_spi_probe()
47 p->regs.config = 0x1000; in thunderx_spi_probe()
48 p->regs.status = 0x1008; in thunderx_spi_probe()
49 p->regs.tx = 0x1010; in thunderx_spi_probe()
50 p->regs.data = 0x1080; in thunderx_spi_probe()
52 p->clk = devm_clk_get_enabled(dev, NULL); in thunderx_spi_probe()
53 if (IS_ERR(p->clk)) { in thunderx_spi_probe()
54 ret = PTR_ERR(p->clk); in thunderx_spi_probe()
58 p->sys_freq = clk_get_rate(p->clk); in thunderx_spi_probe()
59 if (!p->sys_freq) in thunderx_spi_probe()
60 p->sys_freq = SYS_FREQ_DEFAULT; in thunderx_spi_probe()
61 dev_info(dev, "Set system clock to %u\n", p->sys_freq); in thunderx_spi_probe()
63 host->flags = SPI_CONTROLLER_HALF_DUPLEX; in thunderx_spi_probe()
64 host->num_chipselect = 4; in thunderx_spi_probe()
65 host->mode_bits = SPI_CPHA | SPI_CPOL | SPI_CS_HIGH | in thunderx_spi_probe()
67 host->transfer_one_message = octeon_spi_transfer_one_message; in thunderx_spi_probe()
68 host->bits_per_word_mask = SPI_BPW_MASK(8); in thunderx_spi_probe()
69 host->max_speed_hz = OCTEON_SPI_MAX_CLOCK_HZ; in thunderx_spi_probe()
70 host->dev.of_node = pdev->dev.of_node; in thunderx_spi_probe()
95 writeq(0, p->register_base + OCTEON_SPI_CFG(p)); in thunderx_spi_remove()
114 MODULE_DESCRIPTION("Cavium, Inc. ThunderX SPI bus driver");