This adds a module parameter to get the program bus width as an
input rather than hardcoding it, and checks off a TODO item.

Signed-off-by: Rahul Gottipati <rahul.bl...@gmail.com>
---
 drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c 
b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
index 3e154562c64d..3d79e046c060 100644
--- a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
+++ b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
@@ -32,6 +32,10 @@ static char  *file = "xlinx_fpga_firmware.bit";
 module_param(file, charp, 0444);
 MODULE_PARM_DESC(file, "Xilinx FPGA firmware file.");
 
+static unsigned int bus_width_bytes = 2;
+module_param(bus_width_bytes, uint, 0444);
+MODULE_PARM_DESC(bus_width_bytes, "Program bus width in bytes.");
+
 static void read_bitstream(u8 *bitdata, u8 *buf, int *offset, int rdsize)
 {
        memcpy(buf, bitdata + *offset, rdsize);
@@ -319,7 +323,15 @@ static int gs_fpgaboot(void)
                goto err_out2;
        }
 
-       err = gs_download_image(fimage, bus_2byte);
+       if (bus_width_bytes == 2) {
+               err = gs_download_image(fimage, bus_2byte);
+       } else if (bus_width_bytes == 1) {
+               err = gs_download_image(fimage, bus_1byte);
+       } else {
+               pr_err("unsupported program bus width\n");
+               goto err_out2;
+       }
+
        if (err) {
                pr_err("gs_download_image error\n");
                goto err_out2;
-- 
2.25.1

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to