1 /*
2  * Copyright (c) 2014 Travis Geiselbrecht
3  *
4  * Use of this source code is governed by a MIT-style
5  * license that can be found in the LICENSE file or at
6  * https://opensource.org/licenses/MIT
7  */
8 #pragma once
9 
10 #include <stdint.h>
11 #include <stdbool.h>
12 
13 /* a highly Zynq specific qspi interface */
14 
15 struct qspi_ctxt {
16     uint32_t cfg;
17     uint32_t khz;
18     bool linear_mode;
19 };
20 
21 int qspi_set_speed(struct qspi_ctxt *qspi, uint32_t khz);
22 int qspi_init(struct qspi_ctxt *qspi, uint32_t khz);
23 int qspi_enable_linear(struct qspi_ctxt *qspi);
24 int qspi_disable_linear(struct qspi_ctxt *qspi);
25 void qspi_rd(struct qspi_ctxt *qspi, uint32_t cmd, uint32_t asize, uint32_t *data, uint32_t count);
26 void qspi_wr(struct qspi_ctxt *qspi, uint32_t cmd, uint32_t asize, uint32_t *data, uint32_t count);
27 void qspi_wr1(struct qspi_ctxt *qspi, uint32_t cmd);
28 void qspi_wr2(struct qspi_ctxt *qspi, uint32_t cmd);
29 void qspi_wr3(struct qspi_ctxt *qspi, uint32_t cmd);
30 uint32_t qspi_rd1(struct qspi_ctxt *qspi, uint32_t cmd);
31 
32 /* set 0 for chip select */
33 void qspi_cs(struct qspi_ctxt *qspi, unsigned int cs);
34 
35