Commit a1236565 authored by Alessandro Rubini's avatar Alessandro Rubini

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: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent a498451d
......@@ -40,6 +40,7 @@ static int spec_reprogram(struct fmc_device *fmc, struct fmc_driver *drv,
const struct firmware *fw;
struct spec_dev *spec = fmc->carrier_data;
struct device *dev = fmc->hwdev;
uint32_t reg;
int ret;
if (!gw)
......@@ -73,7 +74,15 @@ static int spec_reprogram(struct fmc_device *fmc, struct fmc_driver *drv,
else
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:
release_firmware(fw);
return ret;
......
......@@ -47,6 +47,8 @@ enum {
GNPPCI_MSI_ADDRESS_HIGH = 0x50,
GNPPCI_MSI_DATA = 0x54,
GNPCI_SYS_CFG_SYSTEM = 0x800,
/* page 130 ff */
GNINT_CTRL = 0x810,
GNINT_STAT = 0x814,
......
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