Lines Matching defs:host
167 struct spi_controller *host;
169 host = container_of(hs->dev, struct spi_controller, dev);
170 snprintf(name, 32, "hisi_spi%d", host->bus_num);
294 static u32 hisi_calc_effective_speed(struct spi_controller *host,
300 chip->clk_div = DIV_ROUND_UP(host->max_speed_hz, speed_hz) + 1;
305 effective_speed = host->max_speed_hz / chip->clk_div;
339 struct spi_controller *host = dev_id;
340 struct hisi_spi *hs = spi_controller_get_devdata(host);
346 if (!host->cur_msg)
352 host->cur_msg->status = -EIO;
372 spi_finalize_current_transfer(host);
376 static int hisi_spi_transfer_one(struct spi_controller *host,
379 struct hisi_spi *hs = spi_controller_get_devdata(host);
385 hisi_calc_effective_speed(host, chip, transfer->speed_hz);
412 static void hisi_spi_handle_err(struct spi_controller *host,
415 struct hisi_spi *hs = spi_controller_get_devdata(host);
455 struct spi_controller *host;
463 host = devm_spi_alloc_host(dev, sizeof(*hs));
464 if (!host)
467 platform_set_drvdata(pdev, host);
469 hs = spi_controller_get_devdata(host);
477 /* Specify maximum SPI clocking speed (host only) by firmware */
479 &host->max_speed_hz);
487 &host->num_chipselect);
489 host->num_chipselect = DEFAULT_NUM_CS;
491 host->use_gpio_descriptors = true;
492 host->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP;
493 host->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
494 host->bus_num = pdev->id;
495 host->setup = hisi_spi_setup;
496 host->cleanup = hisi_spi_cleanup;
497 host->transfer_one = hisi_spi_transfer_one;
498 host->handle_err = hisi_spi_handle_err;
499 host->dev.fwnode = dev->fwnode;
504 host);
510 ret = spi_register_controller(host);
512 dev_err(dev, "failed to register spi host, ret=%d\n", ret);
521 host->max_speed_hz / 1000);
528 struct spi_controller *host = platform_get_drvdata(pdev);
529 struct hisi_spi *hs = spi_controller_get_devdata(host);
532 spi_unregister_controller(host);