Alexandru Gagniuc | 0581a67 | 2016-02-24 15:08:23 -0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
Furquan Shaikh | d6c5559 | 2016-11-21 12:41:20 -0800 | [diff] [blame] | 4 | * Copyright 2016 Google Inc. |
Alexandru Gagniuc | 0581a67 | 2016-02-24 15:08:23 -0800 | [diff] [blame] | 5 | * |
| 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 Roth | ebabfad | 2016-04-10 11:09:16 -0600 | [diff] [blame] | 10 | * |
| 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 Gagniuc | 0581a67 | 2016-02-24 15:08:23 -0800 | [diff] [blame] | 15 | */ |
| 16 | |
Furquan Shaikh | c28984d | 2016-11-20 21:04:00 -0800 | [diff] [blame] | 17 | #include <console/console.h> |
Furquan Shaikh | c28984d | 2016-11-20 21:04:00 -0800 | [diff] [blame] | 18 | #include <spi-generic.h> |
Alexandru Gagniuc | 0581a67 | 2016-02-24 15:08:23 -0800 | [diff] [blame] | 19 | |
Furquan Shaikh | d6c5559 | 2016-11-21 12:41:20 -0800 | [diff] [blame] | 20 | /* SPI controller managing the fast SPI. */ |
| 21 | static 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 Gagniuc | 0581a67 | 2016-02-24 15:08:23 -0800 | [diff] [blame] | 28 | |
Furquan Shaikh | d6c5559 | 2016-11-21 12:41:20 -0800 | [diff] [blame] | 29 | 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 | |
| 34 | static const struct spi_ctrlr fast_spi_ctrlr = { |
| 35 | .setup = fast_spi_ctrlr_setup, |
Alexandru Gagniuc | 0581a67 | 2016-02-24 15:08:23 -0800 | [diff] [blame] | 36 | }; |
| 37 | |
Furquan Shaikh | d6c5559 | 2016-11-21 12:41:20 -0800 | [diff] [blame] | 38 | const struct spi_ctrlr_buses spi_ctrlr_bus_map[] = { |
| 39 | { .ctrlr = &fast_spi_ctrlr, .bus_start = 0, .bus_end = 0 }, |
Alexandru Gagniuc | 0581a67 | 2016-02-24 15:08:23 -0800 | [diff] [blame] | 40 | }; |
| 41 | |
Furquan Shaikh | d6c5559 | 2016-11-21 12:41:20 -0800 | [diff] [blame] | 42 | const size_t spi_ctrlr_bus_map_count = ARRAY_SIZE(spi_ctrlr_bus_map); |