On Sat, Jan 11, 2014 at 1:05 PM, Greg KH <[email protected]> wrote:
> On Sat, Jan 11, 2014 at 12:51:28PM -0800, Greg KH wrote:
>> On Thu, Jan 09, 2014 at 11:48:04AM -0800, Insop Song wrote:
>> > This driver downloads Xilinx FPGA firmware using gpio pins.
>> > It loads Xilinx FPGA bitstream format firmware image and
>> > program the Xilinx FPGA using SelectMAP (parallel) mode.
>> >
>> > Signed-off-by: Insop Song <[email protected]>
>>
>> This patch breaks the build on my machine, please be more careful:
>>
>> drivers/staging/gs_fpgaboot/gs_fpgaboot.c:30:28: fatal error:
>> include/asm/io.h: No such file or directory
>> #include <include/asm/io.h>
>>
>> Please fix this up, test it, and resend.
>
> Also, while you are fixing things up, please just remove the character
> device node from the driver, you aren't doing anything with it, so it's
> not needed.
>
Thank you for the suggestion, makes a lot of sense and code cleaner.
Could you take a quick look?
If it is good, will send out a new patch, v5, shortly.
Main change is
+/* fake device for request_firmware */
+static struct platform_device *firmware_pdev;
+ firmware_pdev = platform_device_register_simple("fpgaboot", -1,
+ NULL, 0);
Thank you,
ISS
-------------------------
diff --git a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
index 746af9b..eacc128 100644
--- a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
+++ b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c
@@ -27,7 +27,10 @@
#include <linux/of.h>
#include <linux/delay.h>
+#if defined(CONFIG_PPC64)
#include <include/asm/io.h>
+#endif
+
#include <linux/firmware.h>
#include "gs_fpgaboot.h"
@@ -39,16 +42,13 @@
static uint8_t bits_magic[] = {
0x0, 0x9, 0xf, 0xf0, 0xf, 0xf0,
0xf, 0xf0, 0xf, 0xf0, 0x0, 0x0, 0x1};
-/*
- * Device variables
- */
-static int fpga_major;
-static struct class *fpga_class;
-static struct device *fpga_device;
-static char *file = "xlinx_fpga_top_bitstream.bit";
+/* fake device for request_firmware */
+static struct platform_device *firmware_pdev;
+
+static char *file = "xlinx_fpga_firmware.bit";
module_param(file, charp, S_IRUGO);
-MODULE_PARM_DESC(file, "FPGA image file name.");
+MODULE_PARM_DESC(file, "Xilinx FPGA firmware file.");
#ifdef DEBUG_FPGA
static void datadump(char *msg, void *m, int n)
@@ -205,7 +205,7 @@ static int gs_load_image(struct fpgaimage *fimage,
char *file)
pr_info("load fpgaimage %s\n", file);
- err = request_firmware(&fimage->fw_entry, file, fpga_device);
+ err = request_firmware(&fimage->fw_entry, file, &firmware_pdev->dev);
if (err != 0) {
pr_err("firmware %s is missing, cannot continue.\n", file);
return err;
@@ -302,93 +302,19 @@ static int gs_set_download_method(struct
fpgaimage *fimage)
return 0;
}
-static int gs_fpgaboot_release(struct inode *inode, struct file *file)
-{
- pr_info("gs_fpgaboot_release\n");
- return 0;
-}
-
-static int gs_fpgaboot_open(struct inode *inode, struct file *file)
-{
- pr_info("gs_fpgaboot_open\n");
- return 0;
-}
-
-static ssize_t gs_fpgaboot_write(struct file *f,
- const char *c, size_t s, loff_t *lo)
-{
- pr_info("gs_fpgaboot_write\n");
- return 0;
-}
-
-const struct file_operations fpga_fops = {
- .owner = THIS_MODULE,
- .open = gs_fpgaboot_open,
- .write = gs_fpgaboot_write,
- .release = gs_fpgaboot_release,
-};
-
static int init_driver(void)
{
- int retval;
-
- /*
- * First, see if we can dynamically allocate
- * a major for our device
- */
- fpga_major = register_chrdev(0, DEVICE_NAME, &fpga_fops);
- if (fpga_major < 0) {
- pr_err("failed to register device: error %d\n",
- fpga_major);
- retval = fpga_major;
- goto failed_chrdevreg;
- }
-
- /*
- * We can either tie our device to
- * a bus (existing, or one that we create)
- * or use a "virtual" device class.
- * For this example, we choose the latter
- */
- fpga_class = class_create(THIS_MODULE, CLASS_NAME);
- if (IS_ERR(fpga_class)) {
- pr_err("failed to register device class '%s'\n",
- CLASS_NAME);
- retval = PTR_ERR(fpga_class);
- goto failed_classreg;
- }
-
- /*
- * With a class, the easiest way to instantiate
- * a device is to call device_create()
- */
- fpga_device = device_create(fpga_class, NULL,
- MKDEV(fpga_major, 0), NULL,
- CLASS_NAME "_" DEVICE_NAME);
- if (IS_ERR(fpga_device)) {
- pr_err("failed to create device '%s_%s'\n",
- CLASS_NAME, DEVICE_NAME);
- retval = PTR_ERR(fpga_device);
- goto failed_devreg;
- }
+ firmware_pdev = platform_device_register_simple("fpgaboot", -1,
+ NULL, 0);
+ if (IS_ERR(firmware_pdev))
+ return PTR_ERR(firmware_pdev);
return 0;
-
-failed_devreg:
- class_unregister(fpga_class);
- class_destroy(fpga_class);
-failed_classreg:
- unregister_chrdev(fpga_major, DEVICE_NAME);
-failed_chrdevreg:
- return -1;
}
static void finish_driver(void)
{
- device_destroy(fpga_class, MKDEV(fpga_major, 0));
- class_unregister(fpga_class);
- class_destroy(fpga_class);
- unregister_chrdev(fpga_major, DEVICE_NAME);
+ platform_device_unregister(firmware_pdev);
}
static int gs_fpgaboot(void)
@@ -499,5 +425,5 @@ module_init(gs_fpgaboot_init);
module_exit(gs_fpgaboot_exit);
MODULE_AUTHOR("Insop Song");
-MODULE_DESCRIPTION("Xlinix FPGA bitstream image download");
+MODULE_DESCRIPTION("Xlinix FPGA firmware download");
MODULE_LICENSE("GPL");
diff --git a/drivers/staging/gs_fpgaboot/io.c b/drivers/staging/gs_fpgaboot/io.c
index ce0e248..2d33ff6 100644
--- a/drivers/staging/gs_fpgaboot/io.c
+++ b/drivers/staging/gs_fpgaboot/io.c
@@ -27,15 +27,14 @@
#include <linux/of.h>
#include <linux/of_address.h>
-#include <include/asm/io.h>
#include <linux/firmware.h>
#include "io.h"
-/*
- * this should come from board specific configuration
- */
-#define CONFIG_B4860G100
+#if defined(CONFIG_PPC64)
+#include <include/asm/io.h>
+#define CONFIG_B4860G100 /* board specific configuration */
+#endif
#ifdef CONFIG_B4860G100
static struct gpiobus gbus;
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel