blob: 710fefb1bf5a4b2f494d9c99df2cd9884222ae81 [file] [log] [blame]
Julius Werner4783db22018-03-27 16:28:52 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2018 Google LLC
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15#ifndef _SPI_BITBANG_H_
16#define _SPI_BITBANG_H_
17
18#include <types.h>
19
20struct spi_bitbang_ops {
21 int (*get_miso)(const struct spi_bitbang_ops *ops);
22 void (*set_mosi)(const struct spi_bitbang_ops *ops, int value);
23 void (*set_clk)(const struct spi_bitbang_ops *ops, int value);
24 void (*set_cs)(const struct spi_bitbang_ops *ops, int value);
25};
26
27int spi_bitbang_claim_bus(const struct spi_bitbang_ops *ops);
28void spi_bitbang_release_bus(const struct spi_bitbang_ops *ops);
29int spi_bitbang_xfer(const struct spi_bitbang_ops *ops, const void *dout,
30 size_t bytes_out, void *din, size_t bytes_in);
31
32#endif /* _SPI_BITBANG_H_ */