Path: blob/master/arch/sh/include/mach-sdk7786/mach/fpga.h
15160 views
#ifndef __MACH_SDK7786_FPGA_H1#define __MACH_SDK7786_FPGA_H23#include <linux/io.h>4#include <linux/types.h>5#include <linux/bitops.h>67#define SRSTR 0x0008#define SRSTR_MAGIC 0x1971 /* Fixed magical read value */910#define INTASR 0x01011#define INTAMR 0x02012#define MODSWR 0x03013#define INTTESTR 0x04014#define SYSSR 0x05015#define NRGPR 0x0601617#define NMISR 0x07018#define NMISR_MAN_NMI BIT(0)19#define NMISR_AUX_NMI BIT(1)20#define NMISR_MASK (NMISR_MAN_NMI | NMISR_AUX_NMI)2122#define NMIMR 0x08023#define NMIMR_MAN_NMIM BIT(0) /* Manual NMI mask */24#define NMIMR_AUX_NMIM BIT(1) /* Auxiliary NMI mask */25#define NMIMR_MASK (NMIMR_MAN_NMIM | NMIMR_AUX_NMIM)2627#define INTBSR 0x09028#define INTBMR 0x0a029#define USRLEDR 0x0b030#define MAPSWR 0x0c031#define FPGAVR 0x0d032#define FPGADR 0x0e033#define PCBRR 0x0f034#define RSR 0x10035#define EXTASR 0x11036#define SPCAR 0x12037#define INTMSR 0x1303839#define PCIECR 0x14040#define PCIECR_PCIEMUX1 BIT(15)41#define PCIECR_PCIEMUX0 BIT(14)42#define PCIECR_PRST4 BIT(12) /* slot 4 card present */43#define PCIECR_PRST3 BIT(11) /* slot 3 card present */44#define PCIECR_PRST2 BIT(10) /* slot 2 card present */45#define PCIECR_PRST1 BIT(9) /* slot 1 card present */46#define PCIECR_CLKEN BIT(4) /* oscillator enable */4748#define FAER 0x15049#define USRGPIR 0x1605051/* 0x170 reserved */5253#define LCLASR 0x18054#define LCLASR_FRAMEN BIT(15)5556#define LCLASR_FPGA_SEL_SHIFT 1257#define LCLASR_NAND_SEL_SHIFT 858#define LCLASR_NORB_SEL_SHIFT 459#define LCLASR_NORA_SEL_SHIFT 06061#define LCLASR_AREA_MASK 0x76263#define LCLASR_FPGA_SEL_MASK (LCLASR_AREA_MASK << LCLASR_FPGA_SEL_SHIFT)64#define LCLASR_NAND_SEL_MASK (LCLASR_AREA_MASK << LCLASR_NAND_SEL_SHIFT)65#define LCLASR_NORB_SEL_MASK (LCLASR_AREA_MASK << LCLASR_NORB_SEL_SHIFT)66#define LCLASR_NORA_SEL_MASK (LCLASR_AREA_MASK << LCLASR_NORA_SEL_SHIFT)6768#define SBCR 0x19069#define SCBR_I2CMEN BIT(0) /* FPGA I2C master enable */70#define SCBR_I2CCEN BIT(1) /* CPU I2C master enable */7172#define PWRCR 0x1a073#define PWRCR_SCISEL0 BIT(0)74#define PWRCR_SCISEL1 BIT(1)75#define PWRCR_SCIEN BIT(2) /* Serial port enable */76#define PWRCR_PDWNACK BIT(5) /* Power down acknowledge */77#define PWRCR_PDWNREQ BIT(7) /* Power down request */78#define PWRCR_INT2 BIT(11) /* INT2 connection to power manager */79#define PWRCR_BUPINIT BIT(13) /* DDR backup initialize */80#define PWRCR_BKPRST BIT(15) /* Backup power reset */8182#define SPCBR 0x1b083#define SPICR 0x1c084#define SPIDR 0x1d085#define I2CCR 0x1e086#define I2CDR 0x1f087#define FPGACR 0x20088#define IASELR1 0x21089#define IASELR2 0x22090#define IASELR3 0x23091#define IASELR4 0x24092#define IASELR5 0x25093#define IASELR6 0x26094#define IASELR7 0x27095#define IASELR8 0x28096#define IASELR9 0x29097#define IASELR10 0x2a098#define IASELR11 0x2b099#define IASELR12 0x2c0100#define IASELR13 0x2d0101#define IASELR14 0x2e0102#define IASELR15 0x2f0103/* 0x300 reserved */104#define IBSELR1 0x310105#define IBSELR2 0x320106#define IBSELR3 0x330107#define IBSELR4 0x340108#define IBSELR5 0x350109#define IBSELR6 0x360110#define IBSELR7 0x370111#define IBSELR8 0x380112#define IBSELR9 0x390113#define IBSELR10 0x3a0114#define IBSELR11 0x3b0115#define IBSELR12 0x3c0116#define IBSELR13 0x3d0117#define IBSELR14 0x3e0118#define IBSELR15 0x3f0119#define USRACR 0x400120#define BEEPR 0x410121#define USRLCDR 0x420122#define SMBCR 0x430123#define SMBDR 0x440124#define USBCR 0x450125#define AMSR 0x460126#define ACCR 0x470127#define SDIFCR 0x480128129/* arch/sh/boards/mach-sdk7786/fpga.c */130extern void __iomem *sdk7786_fpga_base;131extern void sdk7786_fpga_init(void);132133/* arch/sh/boards/mach-sdk7786/nmi.c */134extern void sdk7786_nmi_init(void);135136#define SDK7786_FPGA_REGADDR(reg) (sdk7786_fpga_base + (reg))137138/*139* A convenience wrapper from register offset to internal I2C address,140* when the FPGA is in I2C slave mode.141*/142#define SDK7786_FPGA_I2CADDR(reg) ((reg) >> 3)143144static inline u16 fpga_read_reg(unsigned int reg)145{146return ioread16(sdk7786_fpga_base + reg);147}148149static inline void fpga_write_reg(u16 val, unsigned int reg)150{151iowrite16(val, sdk7786_fpga_base + reg);152}153154#endif /* __MACH_SDK7786_FPGA_H */155156157