Commit 5bb90055 authored by Alessandro Rubini's avatar Alessandro Rubini

spec-core: use lm32= parameter, don't load by default

parent a87bd1b1
...@@ -142,7 +142,7 @@ turn perform the following actions: ...@@ -142,7 +142,7 @@ turn perform the following actions:
@itemize @bullet @itemize @bullet
@item Program a @i{firmware} (or @i{gateware}) file in the FPGA @item Program a @i{firmware} (or @i{gateware}) file in the FPGA
@item Load program code for the internal CPU (if any) @item Load program code for the internal CPU (if any and if requested)
@item Load a sub-module for driving the FMC card (if any). @item Load a sub-module for driving the FMC card (if any).
@end itemize @end itemize
...@@ -152,6 +152,13 @@ may have its program already included in the @i{gateware} file); ...@@ -152,6 +152,13 @@ may have its program already included in the @i{gateware} file);
similarly you may not need a sub-driver, because the card is similarly you may not need a sub-driver, because the card is
stand-alone and needs no Linux driver. stand-alone and needs no Linux driver.
Please note that the CPU program file is not loaded by default any
more: you must explicitely request it to be loaded with a module
parameter. If you pass ``lm32=1'' as a parameter, it will try to load
at the default address (0x80000). IF you you pass a different value
than 1, it will be used as the load address (for example:
``@code{insmod lm32=0xc0000}'').
The three files being looked for are named like this, assuming here The three files being looked for are named like this, assuming here
the card is seen under PCIe bus number 2: the card is seen under PCIe bus number 2:
......
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
static char *spec_name = "%b"; static char *spec_name = "%b";
module_param_named(name, spec_name, charp, 0444); module_param_named(name, spec_name, charp, 0444);
static int spec_lm32_addr = -1;
module_param_named(lm32, spec_lm32_addr, int, 0444);
/* /*
* A procedure to build the names associated with the device. This * A procedure to build the names associated with the device. This
* copies the spec_name. With "spec-" prefix, expanding %P * copies the spec_name. With "spec-" prefix, expanding %P
...@@ -142,6 +145,15 @@ int spec_load_lm32(struct spec_dev *dev) ...@@ -142,6 +145,15 @@ int spec_load_lm32(struct spec_dev *dev)
const struct firmware *fw; const struct firmware *fw;
int err, off; int err, off;
if (spec_lm32_addr < 0) {
/* Not loading lm32 code unless we get the parameter */
return 0;
}
if (spec_lm32_addr == 1) {
/* "insmod lm32=1" loads at the default address */
spec_lm32_addr = SPEC_DEFAULT_LM32_ADDR;
}
err = request_firmware(&fw, dev->names[SPEC_NAME_PROG], err = request_firmware(&fw, dev->names[SPEC_NAME_PROG],
&dev->pdev->dev); &dev->pdev->dev);
if (err < 0) if (err < 0)
...@@ -157,7 +169,7 @@ int spec_load_lm32(struct spec_dev *dev) ...@@ -157,7 +169,7 @@ int spec_load_lm32(struct spec_dev *dev)
uint32_t datum; uint32_t datum;
datum = get_unaligned_be32(fw->data + off); datum = get_unaligned_be32(fw->data + off);
writel(datum, dev->remap[0] + 0x80000 + off); writel(datum, dev->remap[0] + spec_lm32_addr + off);
} }
/* Unreset the LM32 */ /* Unreset the LM32 */
writel(0xdeadbee, dev->remap[0] + 0xA0400); writel(0xdeadbee, dev->remap[0] + 0xA0400);
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#define PCI_VENDOR_ID_GENNUM 0x1a39 #define PCI_VENDOR_ID_GENNUM 0x1a39
#define PCI_DEVICE_ID_GN4124 0x0004 #define PCI_DEVICE_ID_GN4124 0x0004
#define SPEC_DEFAULT_LM32_ADDR 0x80000 /* used if "1" is passed */
#define SPEC_MAX_BOARDS 8 #define SPEC_MAX_BOARDS 8
enum spec_names { enum spec_names {
......
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