Skip to content
Snippets Groups Projects
Commit a1236565 authored by Alessandro Rubini's avatar Alessandro Rubini
Browse files

kernel/spec: reset FPGA after reprogramming


Actually, Tom suggsted the fix and he's the author, but the swearing
is mine and I'd better get authorship for my complaints.

Signed-off-by: default avatarAlessandro Rubini <rubini@gnudd.com>
parent a498451d
...@@ -40,6 +40,7 @@ static int spec_reprogram(struct fmc_device *fmc, struct fmc_driver *drv, ...@@ -40,6 +40,7 @@ static int spec_reprogram(struct fmc_device *fmc, struct fmc_driver *drv,
const struct firmware *fw; const struct firmware *fw;
struct spec_dev *spec = fmc->carrier_data; struct spec_dev *spec = fmc->carrier_data;
struct device *dev = fmc->hwdev; struct device *dev = fmc->hwdev;
uint32_t reg;
int ret; int ret;
if (!gw) if (!gw)
...@@ -73,7 +74,15 @@ static int spec_reprogram(struct fmc_device *fmc, struct fmc_driver *drv, ...@@ -73,7 +74,15 @@ static int spec_reprogram(struct fmc_device *fmc, struct fmc_driver *drv,
else else
fmc->flags |= FMC_DEVICE_HAS_CUSTOM; fmc->flags |= FMC_DEVICE_HAS_CUSTOM;
/* FIXME: load lm32 */ /* After reprogramming, reset the FPGA using the gennum register */
reg = gennum_readl(spec, GNPCI_SYS_CFG_SYSTEM);
/*
* This _fucking_ register must be written with extreme care,
* becase some fields are "protected" and some are not. *hate*
*/
gennum_writel(spec, (reg & ~0xffff) | 0x3fff, GNPCI_SYS_CFG_SYSTEM);
gennum_writel(spec, (reg & ~0xffff) | 0x7fff, GNPCI_SYS_CFG_SYSTEM);
out: out:
release_firmware(fw); release_firmware(fw);
return ret; return ret;
......
...@@ -47,6 +47,8 @@ enum { ...@@ -47,6 +47,8 @@ enum {
GNPPCI_MSI_ADDRESS_HIGH = 0x50, GNPPCI_MSI_ADDRESS_HIGH = 0x50,
GNPPCI_MSI_DATA = 0x54, GNPPCI_MSI_DATA = 0x54,
GNPCI_SYS_CFG_SYSTEM = 0x800,
/* page 130 ff */ /* page 130 ff */
GNINT_CTRL = 0x810, GNINT_CTRL = 0x810,
GNINT_STAT = 0x814, GNINT_STAT = 0x814,
......
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