Commit 35c436eb authored by Alessandro Rubini's avatar Alessandro Rubini

kernel: a few fixes

- an (empty) spec-wr-nic modules is built
- the loader now resets and unresets at the proper address
- the the list of spec devices is exported to sub-modules
parent 337ef710
......@@ -2,6 +2,7 @@
LINUX ?= /lib/modules/$(shell uname -r)/build
obj-m = spec.o
obj-m += spec-wr-nic.o
obj-m += spec-fine-delay.o
spec-objs = spec-core.o loader-ll.o
......
......@@ -150,7 +150,7 @@ int spec_load_lm32(struct spec_dev *dev)
dev->names[SPEC_NAME_PROG], fw->size, fw->size);
/* Reset the LM32 */
writel(1, dev->remap[0] + 0xE2000);
writel(0x1deadbee, dev->remap[0] + 0xA0400);
/* Copy stuff over */
for (off = 0; off < fw->size; off += 4) {
......@@ -160,7 +160,7 @@ int spec_load_lm32(struct spec_dev *dev)
writel(datum, dev->remap[0] + 0x80000 + off);
}
/* Unreset the LM32 */
writel(0, dev->remap[0] + 0xE2000);
writel(0xdeadbee, dev->remap[0] + 0xA0400);
/* MSC */
pr_info("LM32 has been restarted\n");
......@@ -197,7 +197,8 @@ static int spec_load_files(struct spec_dev *dev)
return 0;
}
static struct list_head spec_list;
struct list_head spec_list;
EXPORT_SYMBOL(spec_list);
/* The probe can be called in atomic context, so all loading is delayed */
static int spec_probe(struct pci_dev *pdev, const struct pci_device_id *id)
......@@ -231,12 +232,14 @@ static int spec_probe(struct pci_dev *pdev, const struct pci_device_id *id)
/* go on anyways */
}
/* Register the device in out list, so the submodule will find it */
pci_set_drvdata(pdev, dev);
list_add(&dev->list, &spec_list);
/* The probe function can sleep, so load firmware directly */
spec_load_files(dev);
/* Done */
pci_set_drvdata(pdev, dev);
list_add(&dev->list, &spec_list);
return 0;
}
......
/*
* Copyright (C) 2010-2012 CERN (www.cern.ch)
* Author: Alessandro Rubini <rubini@gnudd.com>
*
* Released according to the GNU GPL, version 2 or any later version.
*
* This work is part of the White Rabbit project, a research effort led
* by CERN, the European Institute for Nuclear Research.
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/device.h>
#include <linux/init.h>
#include <linux/list.h>
#include <linux/sched.h>
#include <linux/pci.h>
#include <linux/io.h>
#include <linux/atomic.h>
#include <asm/unaligned.h>
#include "spec.h"
static int wrn_init(void)
{
}
static void wrn_exit(void)
{
}
module_init(wrn_init);
module_exit(wrn_exit);
MODULE_LICENSE("GPL");
......@@ -12,6 +12,7 @@
#include <linux/pci.h>
#include <linux/workqueue.h>
#include <linux/firmware.h>
#include <linux/atomic.h>
#include <linux/list.h>
#define PCI_VENDOR_ID_CERN 0x10dc
......@@ -39,8 +40,13 @@ struct spec_dev {
const struct firmware *fw;
struct list_head list;
unsigned long irqcount;
atomic_t has_submod;
};
/* Used by sub-modules */
extern struct list_head spec_list;
/* Registers from the gennum header files */
enum {
GNGPIO_BASE = 0xA00,
......
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