diff options
-rw-r--r-- | Documentation/fpga/fpga-mgr.txt | 5 | ||||
-rw-r--r-- | drivers/fpga/fpga-mgr.c | 6 | ||||
-rw-r--r-- | drivers/fpga/socfpga-a10.c | 1 | ||||
-rw-r--r-- | include/linux/fpga/fpga-mgr.h | 2 |
4 files changed, 11 insertions, 3 deletions
diff --git a/Documentation/fpga/fpga-mgr.txt b/Documentation/fpga/fpga-mgr.txt index 087924f2b20c..86ee5078fd03 100644 --- a/Documentation/fpga/fpga-mgr.txt +++ b/Documentation/fpga/fpga-mgr.txt | |||
@@ -169,7 +169,10 @@ The programming sequence is: | |||
169 | 2. .write (may be called once or multiple times) | 169 | 2. .write (may be called once or multiple times) |
170 | 3. .write_complete | 170 | 3. .write_complete |
171 | 171 | ||
172 | The .write_init function will prepare the FPGA to receive the image data. | 172 | The .write_init function will prepare the FPGA to receive the image data. The |
173 | buffer passed into .write_init will be atmost .initial_header_size bytes long, | ||
174 | if the whole bitstream is not immediately available then the core code will | ||
175 | buffer up at least this much before starting. | ||
173 | 176 | ||
174 | The .write function writes a buffer to the FPGA. The buffer may be contain the | 177 | The .write function writes a buffer to the FPGA. The buffer may be contain the |
175 | whole FPGA image or may be a smaller chunk of an FPGA image. In the latter | 178 | whole FPGA image or may be a smaller chunk of an FPGA image. In the latter |
diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c index 79ce2eea44db..f0a69d3e60a5 100644 --- a/drivers/fpga/fpga-mgr.c +++ b/drivers/fpga/fpga-mgr.c | |||
@@ -53,10 +53,12 @@ int fpga_mgr_buf_load(struct fpga_manager *mgr, struct fpga_image_info *info, | |||
53 | /* | 53 | /* |
54 | * Call the low level driver's write_init function. This will do the | 54 | * Call the low level driver's write_init function. This will do the |
55 | * device-specific things to get the FPGA into the state where it is | 55 | * device-specific things to get the FPGA into the state where it is |
56 | * ready to receive an FPGA image. | 56 | * ready to receive an FPGA image. The low level driver only gets to |
57 | * see the first initial_header_size bytes in the buffer. | ||
57 | */ | 58 | */ |
58 | mgr->state = FPGA_MGR_STATE_WRITE_INIT; | 59 | mgr->state = FPGA_MGR_STATE_WRITE_INIT; |
59 | ret = mgr->mops->write_init(mgr, info, buf, count); | 60 | ret = mgr->mops->write_init(mgr, info, buf, |
61 | min(mgr->mops->initial_header_size, count)); | ||
60 | if (ret) { | 62 | if (ret) { |
61 | dev_err(dev, "Error preparing FPGA for writing\n"); | 63 | dev_err(dev, "Error preparing FPGA for writing\n"); |
62 | mgr->state = FPGA_MGR_STATE_WRITE_INIT_ERR; | 64 | mgr->state = FPGA_MGR_STATE_WRITE_INIT_ERR; |
diff --git a/drivers/fpga/socfpga-a10.c b/drivers/fpga/socfpga-a10.c index ccd9fb23bd52..f8770af0f6b5 100644 --- a/drivers/fpga/socfpga-a10.c +++ b/drivers/fpga/socfpga-a10.c | |||
@@ -470,6 +470,7 @@ static enum fpga_mgr_states socfpga_a10_fpga_state(struct fpga_manager *mgr) | |||
470 | } | 470 | } |
471 | 471 | ||
472 | static const struct fpga_manager_ops socfpga_a10_fpga_mgr_ops = { | 472 | static const struct fpga_manager_ops socfpga_a10_fpga_mgr_ops = { |
473 | .initial_header_size = (RBF_DECOMPRESS_OFFSET + 1) * 4, | ||
473 | .state = socfpga_a10_fpga_state, | 474 | .state = socfpga_a10_fpga_state, |
474 | .write_init = socfpga_a10_fpga_write_init, | 475 | .write_init = socfpga_a10_fpga_write_init, |
475 | .write = socfpga_a10_fpga_write, | 476 | .write = socfpga_a10_fpga_write, |
diff --git a/include/linux/fpga/fpga-mgr.h b/include/linux/fpga/fpga-mgr.h index 96a1a3311649..16551d5eac36 100644 --- a/include/linux/fpga/fpga-mgr.h +++ b/include/linux/fpga/fpga-mgr.h | |||
@@ -84,6 +84,7 @@ struct fpga_image_info { | |||
84 | 84 | ||
85 | /** | 85 | /** |
86 | * struct fpga_manager_ops - ops for low level fpga manager drivers | 86 | * struct fpga_manager_ops - ops for low level fpga manager drivers |
87 | * @initial_header_size: Maximum number of bytes that should be passed into write_init | ||
87 | * @state: returns an enum value of the FPGA's state | 88 | * @state: returns an enum value of the FPGA's state |
88 | * @write_init: prepare the FPGA to receive confuration data | 89 | * @write_init: prepare the FPGA to receive confuration data |
89 | * @write: write count bytes of configuration data to the FPGA | 90 | * @write: write count bytes of configuration data to the FPGA |
@@ -95,6 +96,7 @@ struct fpga_image_info { | |||
95 | * called, so leaving them out is fine. | 96 | * called, so leaving them out is fine. |
96 | */ | 97 | */ |
97 | struct fpga_manager_ops { | 98 | struct fpga_manager_ops { |
99 | size_t initial_header_size; | ||
98 | enum fpga_mgr_states (*state)(struct fpga_manager *mgr); | 100 | enum fpga_mgr_states (*state)(struct fpga_manager *mgr); |
99 | int (*write_init)(struct fpga_manager *mgr, | 101 | int (*write_init)(struct fpga_manager *mgr, |
100 | struct fpga_image_info *info, | 102 | struct fpga_image_info *info, |