blob: 87d4d012417d59ed0dbd014ec94e65af6a8e8520 [file] [log] [blame]
Alexandru Gagniuc0581a672016-02-24 15:08:23 -08001/*
2 * This file is part of the coreboot project.
3 *
Furquan Shaikhd6c55592016-11-21 12:41:20 -08004 * Copyright 2016 Google Inc.
Alexandru Gagniuc0581a672016-02-24 15:08:23 -08005 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
Martin Rothebabfad2016-04-10 11:09:16 -060010 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
Alexandru Gagniuc0581a672016-02-24 15:08:23 -080015 */
16
Furquan Shaikhc28984d2016-11-20 21:04:00 -080017#include <console/console.h>
Furquan Shaikhc28984d2016-11-20 21:04:00 -080018#include <spi-generic.h>
Alexandru Gagniuc0581a672016-02-24 15:08:23 -080019
Furquan Shaikhd6c55592016-11-21 12:41:20 -080020/* SPI controller managing the fast SPI. */
21static int fast_spi_ctrlr_setup(const struct spi_slave *dev)
22{
23 if ((dev->bus != 0) && (dev->cs != 0)) {
24 printk(BIOS_ERR, "%s: Unsupported device "
25 "bus=0x%x,cs=0x%x!\n", __func__, dev->bus, dev->cs);
26 return -1;
27 }
Alexandru Gagniuc0581a672016-02-24 15:08:23 -080028
Furquan Shaikhd6c55592016-11-21 12:41:20 -080029 printk(BIOS_INFO, "%s: Found controller for device "
30 "(bus=0x%x,cs=0x%x)!!\n", __func__, dev->bus, dev->cs);
31 return 0;
32}
33
34static const struct spi_ctrlr fast_spi_ctrlr = {
35 .setup = fast_spi_ctrlr_setup,
Alexandru Gagniuc0581a672016-02-24 15:08:23 -080036};
37
Furquan Shaikhd6c55592016-11-21 12:41:20 -080038const struct spi_ctrlr_buses spi_ctrlr_bus_map[] = {
39 { .ctrlr = &fast_spi_ctrlr, .bus_start = 0, .bus_end = 0 },
Alexandru Gagniuc0581a672016-02-24 15:08:23 -080040};
41
Furquan Shaikhd6c55592016-11-21 12:41:20 -080042const size_t spi_ctrlr_bus_map_count = ARRAY_SIZE(spi_ctrlr_bus_map);