Path: blob/master/arch/sh/include/mach-sdk7786/mach/fpga.h
26513 views
/* SPDX-License-Identifier: GPL-2.0 */1#ifndef __MACH_SDK7786_FPGA_H2#define __MACH_SDK7786_FPGA_H34#include <linux/io.h>5#include <linux/types.h>6#include <linux/bitops.h>78#define SRSTR 0x0009#define SRSTR_MAGIC 0x1971 /* Fixed magical read value */1011#define INTASR 0x01012#define INTAMR 0x02013#define MODSWR 0x03014#define INTTESTR 0x04015#define SYSSR 0x05016#define NRGPR 0x0601718#define NMISR 0x07019#define NMISR_MAN_NMI BIT(0)20#define NMISR_AUX_NMI BIT(1)21#define NMISR_MASK (NMISR_MAN_NMI | NMISR_AUX_NMI)2223#define NMIMR 0x08024#define NMIMR_MAN_NMIM BIT(0) /* Manual NMI mask */25#define NMIMR_AUX_NMIM BIT(1) /* Auxiliary NMI mask */26#define NMIMR_MASK (NMIMR_MAN_NMIM | NMIMR_AUX_NMIM)2728#define INTBSR 0x09029#define INTBMR 0x0a030#define USRLEDR 0x0b031#define MAPSWR 0x0c032#define FPGAVR 0x0d033#define FPGADR 0x0e034#define PCBRR 0x0f035#define RSR 0x10036#define EXTASR 0x11037#define SPCAR 0x12038#define INTMSR 0x1303940#define PCIECR 0x14041#define PCIECR_PCIEMUX1 BIT(15)42#define PCIECR_PCIEMUX0 BIT(14)43#define PCIECR_PRST4 BIT(12) /* slot 4 card present */44#define PCIECR_PRST3 BIT(11) /* slot 3 card present */45#define PCIECR_PRST2 BIT(10) /* slot 2 card present */46#define PCIECR_PRST1 BIT(9) /* slot 1 card present */47#define PCIECR_CLKEN BIT(4) /* oscillator enable */4849#define FAER 0x15050#define USRGPIR 0x1605152/* 0x170 reserved */5354#define LCLASR 0x18055#define LCLASR_FRAMEN BIT(15)5657#define LCLASR_FPGA_SEL_SHIFT 1258#define LCLASR_NAND_SEL_SHIFT 859#define LCLASR_NORB_SEL_SHIFT 460#define LCLASR_NORA_SEL_SHIFT 06162#define LCLASR_AREA_MASK 0x76364#define LCLASR_FPGA_SEL_MASK (LCLASR_AREA_MASK << LCLASR_FPGA_SEL_SHIFT)65#define LCLASR_NAND_SEL_MASK (LCLASR_AREA_MASK << LCLASR_NAND_SEL_SHIFT)66#define LCLASR_NORB_SEL_MASK (LCLASR_AREA_MASK << LCLASR_NORB_SEL_SHIFT)67#define LCLASR_NORA_SEL_MASK (LCLASR_AREA_MASK << LCLASR_NORA_SEL_SHIFT)6869#define SBCR 0x19070#define SCBR_I2CMEN BIT(0) /* FPGA I2C master enable */71#define SCBR_I2CCEN BIT(1) /* CPU I2C master enable */7273#define PWRCR 0x1a074#define PWRCR_SCISEL0 BIT(0)75#define PWRCR_SCISEL1 BIT(1)76#define PWRCR_SCIEN BIT(2) /* Serial port enable */77#define PWRCR_PDWNACK BIT(5) /* Power down acknowledge */78#define PWRCR_PDWNREQ BIT(7) /* Power down request */79#define PWRCR_INT2 BIT(11) /* INT2 connection to power manager */80#define PWRCR_BUPINIT BIT(13) /* DDR backup initialize */81#define PWRCR_BKPRST BIT(15) /* Backup power reset */8283#define SPCBR 0x1b084#define SPICR 0x1c085#define SPIDR 0x1d086#define I2CCR 0x1e087#define I2CDR 0x1f088#define FPGACR 0x20089#define IASELR1 0x21090#define IASELR2 0x22091#define IASELR3 0x23092#define IASELR4 0x24093#define IASELR5 0x25094#define IASELR6 0x26095#define IASELR7 0x27096#define IASELR8 0x28097#define IASELR9 0x29098#define IASELR10 0x2a099#define IASELR11 0x2b0100#define IASELR12 0x2c0101#define IASELR13 0x2d0102#define IASELR14 0x2e0103#define IASELR15 0x2f0104/* 0x300 reserved */105#define IBSELR1 0x310106#define IBSELR2 0x320107#define IBSELR3 0x330108#define IBSELR4 0x340109#define IBSELR5 0x350110#define IBSELR6 0x360111#define IBSELR7 0x370112#define IBSELR8 0x380113#define IBSELR9 0x390114#define IBSELR10 0x3a0115#define IBSELR11 0x3b0116#define IBSELR12 0x3c0117#define IBSELR13 0x3d0118#define IBSELR14 0x3e0119#define IBSELR15 0x3f0120#define USRACR 0x400121#define BEEPR 0x410122#define USRLCDR 0x420123#define SMBCR 0x430124#define SMBDR 0x440125#define USBCR 0x450126#define AMSR 0x460127#define ACCR 0x470128#define SDIFCR 0x480129130/* arch/sh/boards/mach-sdk7786/fpga.c */131extern void __iomem *sdk7786_fpga_base;132extern void sdk7786_fpga_init(void);133134/* arch/sh/boards/mach-sdk7786/nmi.c */135extern void sdk7786_nmi_init(void);136137#define SDK7786_FPGA_REGADDR(reg) (sdk7786_fpga_base + (reg))138139/*140* A convenience wrapper from register offset to internal I2C address,141* when the FPGA is in I2C slave mode.142*/143#define SDK7786_FPGA_I2CADDR(reg) ((reg) >> 3)144145static inline u16 fpga_read_reg(unsigned int reg)146{147return ioread16(sdk7786_fpga_base + reg);148}149150static inline void fpga_write_reg(u16 val, unsigned int reg)151{152iowrite16(val, sdk7786_fpga_base + reg);153}154155#endif /* __MACH_SDK7786_FPGA_H */156157158