Commit 8ba6b1be authored by Alessandro Rubini's avatar Alessandro Rubini

reprogram is complete and cast in stone

parent f0ea7350
......@@ -5,9 +5,6 @@
#include <linux/fmc.h>
#include "spec.h"
static char *t_filename;
module_param_named(file, t_filename, charp, 0444);
static struct fmc_driver t_drv; /* initialized later */
irqreturn_t t_handler(int irq, void *dev_id)
......@@ -32,8 +29,10 @@ int t_probe(struct fmc_device *fmc)
if (ret < 0)
return ret;
/* Reprogram, but only if specified in the arguments */
ret = fmc->op->reprogram(fmc, "");
/* Reprogram, if asked to. ESRCH == no filename specified */
ret = fmc->op->reprogram(fmc, &t_drv,"");
if (ret == -ESRCH)
ret = 0;
if (ret < 0)
fmc->op->irq_free(fmc);
......@@ -54,7 +53,9 @@ static struct fmc_driver t_drv = {
/* no table, as the current match just matches everything */
};
FMC_MODULE_PARAMS(t_drv); /* We accept the generic parameters */
/* We accept the generic parameters */
FMC_PARAM_BUSID(t_drv);
FMC_PARAM_GATEWARE(t_drv);
static int t_init(void)
{
......
......@@ -40,16 +40,17 @@ struct fmc_driver {
#define to_fmc_driver(x) container_of((x), struct fmc_driver, driver)
/* These are the generic parameters, that drivers may instantiate */
#define FMC_MODULE_PARAMS(_d) \
module_param_array_named(busid, _d.busid_val, int, &_d.busid_n, 0400); \
module_param_array_named(gateware, _d.gw_val, charp, &_d.gw_n, 0400)
#define FMC_PARAM_BUSID(_d) \
module_param_array_named(busid, _d.busid_val, int, &_d.busid_n, 0444)
#define FMC_PARAM_GATEWARE(_d) \
module_param_array_named(gateware, _d.gw_val, charp, &_d.gw_n, 0444)
/* To be carrier-independent, we need to abstract hardware access */
struct fmc_operations {
uint32_t (*readl)(struct fmc_device *fmc, int offset);
void (*writel)(struct fmc_device *fmc, uint32_t value, int offset);
int (*validate)(struct fmc_device *fmc, struct fmc_driver *drv);
int (*reprogram)(struct fmc_device *fmc, char *gateware);
int (*reprogram)(struct fmc_device *f, struct fmc_driver *d, char *gw);
int (*irq_request)(struct fmc_device *fmc, irq_handler_t h,
char *name, int flags);
void (*irq_ack)(struct fmc_device *fmc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment