Commit f4432bc8 authored by Alessandro Rubini's avatar Alessandro Rubini

setup spec-gpio, but there's no code yet

parent 8037b7d9
...@@ -8,10 +8,12 @@ obj-m += spec.o ...@@ -8,10 +8,12 @@ obj-m += spec.o
obj-m += fmc-trivial.o obj-m += fmc-trivial.o
obj-m += wr-nic.o obj-m += wr-nic.o
spec-objs = spec-pci.o spec-y = spec-pci.o
spec-objs += spec-fmc.o spec-y += spec-fmc.o
spec-objs += spec-i2c.o spec-y += spec-i2c.o
spec-objs += loader-ll.o spec-y += loader-ll.o
spec-y += spec-gpio-no.o
spec-$(CONFIG_GPIOLIB) += spec-gpio.o
all modules: all modules:
$(MAKE) -C $(LINUX) M=$(shell /bin/pwd) modules $(MAKE) -C $(LINUX) M=$(shell /bin/pwd) modules
......
...@@ -184,6 +184,7 @@ int spec_fmc_create(struct spec_dev *spec) ...@@ -184,6 +184,7 @@ int spec_fmc_create(struct spec_dev *spec)
ret = fmc_device_register(fmc); ret = fmc_device_register(fmc);
if (ret) if (ret)
goto out_irq; goto out_irq;
spec_gpio_init(fmc); /* May fail, we don't care */
return ret; return ret;
out_irq: out_irq:
...@@ -196,6 +197,7 @@ out_free: ...@@ -196,6 +197,7 @@ out_free:
void spec_fmc_destroy(struct spec_dev *spec) void spec_fmc_destroy(struct spec_dev *spec)
{ {
spec_gpio_exit(spec->fmc);
fmc_device_unregister(spec->fmc); fmc_device_unregister(spec->fmc);
spec_irq_exit(spec->fmc); spec_irq_exit(spec->fmc);
spec_i2c_exit(spec->fmc); spec_i2c_exit(spec->fmc);
......
#include <linux/kernel.h>
#include <linux/fmc.h>
#include "spec.h"
/*
* If the host computer has no gpiolib, this default will apply
*/
int __weak spec_gpio_init(struct fmc_device *fmc)
{
printk("%s - %s\n", __FILE__, __func__);
return 0;
}
void __weak spec_gpio_exit(struct fmc_device *fmc)
{
printk("%s - %s\n", __FILE__, __func__);
}
#include <linux/kernel.h>
#include <linux/gpio.h>
#include <linux/fmc.h>
#include "spec.h"
int spec_gpio_init(struct fmc_device *fmc)
{
printk("%%s - %s\n", __FILE__, __func__);
}
void spec_gpio_exit(struct fmc_device *fmc)
{
printk("%s - %s\n", __FILE__, __func__);
}
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/firmware.h> #include <linux/firmware.h>
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/fmc.h> #include <linux/fmc.h>
#include <linux/gpio.h>
#define PCI_VENDOR_ID_CERN 0x10dc #define PCI_VENDOR_ID_CERN 0x10dc
#define PCI_DEVICE_ID_SPEC 0x018d #define PCI_DEVICE_ID_SPEC 0x018d
...@@ -35,6 +36,7 @@ struct spec_dev { ...@@ -35,6 +36,7 @@ struct spec_dev {
struct fmc_device *fmc; struct fmc_device *fmc;
int irq_count; /* for mezzanine use too */ int irq_count; /* for mezzanine use too */
struct completion compl; struct completion compl;
struct gpio_chip *gpio;
}; };
/* Registers for GN4124 access */ /* Registers for GN4124 access */
...@@ -118,9 +120,13 @@ static inline void gennum_mask_val(struct spec_dev *spec, ...@@ -118,9 +120,13 @@ static inline void gennum_mask_val(struct spec_dev *spec,
extern int spec_fmc_create(struct spec_dev *spec); extern int spec_fmc_create(struct spec_dev *spec);
extern void spec_fmc_destroy(struct spec_dev *spec); extern void spec_fmc_destroy(struct spec_dev *spec);
/* Function in spec-i2c.c, used by spec-fmc.c */ /* Functions in spec-i2c.c, used by spec-fmc.c */
extern int spec_i2c_init(struct fmc_device *fmc); extern int spec_i2c_init(struct fmc_device *fmc);
extern void spec_i2c_exit(struct fmc_device *fmc); extern void spec_i2c_exit(struct fmc_device *fmc);
/* Functions in spec-gpio.c */
extern int spec_gpio_init(struct fmc_device *fmc);
extern void spec_gpio_exit(struct fmc_device *fmc);
#endif /* __SPEC_H__ */ #endif /* __SPEC_H__ */
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