summaryrefslogtreecommitdiff
path: root/src/drivers/spi
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@chromium.org>2017-04-07 07:13:24 -0700
committerFurquan Shaikh <furquan@google.com>2017-04-09 21:35:53 +0200
commit5bda642bcb0fc6004f08d8acdfe0e71d5b3c5012 (patch)
tree3fa8c5bb5384ec5adc98d9dcd4195be4a7c063a1 /src/drivers/spi
parentbc17cdef0d3370f10f43ef45272399e3103eb01b (diff)
drivers/spi: Get rid of spi_get_config
There is only one user for spi_get_config i.e. SPI ACPI. Also, the values provided by spi_get_config are constant for now. Thus, get rid of the spi_get_config call and fill in these constant values in SPI ACPI code itself. If there is a need in the future to change these, appropriate device-tree configs can be added. BUG=b:36873582 Change-Id: Ied38e2670784ee3317bb12e542666c224bd9e819 Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://review.coreboot.org/19203 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/drivers/spi')
-rw-r--r--src/drivers/spi/acpi/acpi.c32
-rw-r--r--src/drivers/spi/spi-generic.c10
2 files changed, 8 insertions, 34 deletions
diff --git a/src/drivers/spi/acpi/acpi.c b/src/drivers/spi/acpi/acpi.c
index 028a37c20d..102780f65d 100644
--- a/src/drivers/spi/acpi/acpi.c
+++ b/src/drivers/spi/acpi/acpi.c
@@ -76,13 +76,15 @@ static void spi_acpi_fill_ssdt_generator(struct device *dev)
struct drivers_spi_acpi_config *config = dev->chip_info;
const char *scope = acpi_device_scope(dev);
const char *path = acpi_device_path(dev);
- struct spi_cfg spi_cfg;
- struct spi_slave slave;
- int bus = -1, cs = dev->path.spi.cs;
struct acpi_spi spi = {
- .device_select = cs,
+ .device_select = dev->path.spi.cs,
.speed = config->speed ? : 1 * MHz,
.resource = scope,
+ .device_select_polarity = SPI_POLARITY_LOW,
+ .wire_mode = SPI_4_WIRE_MODE,
+ .data_bit_length = 8,
+ .clock_phase = SPI_CLOCK_PHASE_FIRST,
+ .clock_polarity = SPI_POLARITY_LOW,
};
int curr_index = 0;
int irq_gpio_index = -1;
@@ -92,10 +94,9 @@ static void spi_acpi_fill_ssdt_generator(struct device *dev)
if (!dev->enabled || !scope)
return;
- bus = spi_acpi_get_bus(dev);
- if (bus == -1) {
+ if (spi_acpi_get_bus(dev) == -1) {
printk(BIOS_ERR, "%s: ERROR: Cannot get bus for device.\n",
- dev_path(dev));
+ dev_path(dev));
return;
}
@@ -104,23 +105,6 @@ static void spi_acpi_fill_ssdt_generator(struct device *dev)
return;
}
- if (spi_setup_slave(bus, cs, &slave)) {
- printk(BIOS_ERR, "%s: ERROR: SPI setup failed.\n",
- dev_path(dev));
- return;
- }
-
- if (spi_get_config(&slave, &spi_cfg)) {
- printk(BIOS_ERR, "%s: ERROR: SPI get config failed.\n",
- dev_path(dev));
- return;
- }
-
- spi.device_select_polarity = spi_cfg.cs_polarity;
- spi.wire_mode = spi_cfg.wire_mode;
- spi.data_bit_length = spi_cfg.data_bit_length;
- spi.clock_phase = spi_cfg.clk_phase;
-
/* Device */
acpigen_write_scope(scope);
acpigen_write_device(acpi_device_name(dev));
diff --git a/src/drivers/spi/spi-generic.c b/src/drivers/spi/spi-generic.c
index 3ef437c4a7..805e17af5a 100644
--- a/src/drivers/spi/spi-generic.c
+++ b/src/drivers/spi/spi-generic.c
@@ -88,16 +88,6 @@ int spi_xfer(const struct spi_slave *slave, const void *dout, size_t bytesout,
return -1;
}
-int spi_get_config(const struct spi_slave *slave, struct spi_cfg *cfg)
-{
- const struct spi_ctrlr *ctrlr = slave->ctrlr;
-
- if (ctrlr && ctrlr->get_config)
- return ctrlr->get_config(slave, cfg);
-
- return -1;
-}
-
void __attribute__((weak)) spi_init(void)
{
/* Default weak implementation - do nothing. */