162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci 362306a36Sopenharmony_ci#define FDOMAIN_REGION_SIZE 0x10 462306a36Sopenharmony_ci#define FDOMAIN_BIOS_SIZE 0x2000 562306a36Sopenharmony_ci 662306a36Sopenharmony_cienum { 762306a36Sopenharmony_ci in_arbitration = 0x02, 862306a36Sopenharmony_ci in_selection = 0x04, 962306a36Sopenharmony_ci in_other = 0x08, 1062306a36Sopenharmony_ci disconnect = 0x10, 1162306a36Sopenharmony_ci aborted = 0x20, 1262306a36Sopenharmony_ci sent_ident = 0x40, 1362306a36Sopenharmony_ci}; 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci/* (@) = not present on TMC1800, (#) = not present on TMC1800 and TMC18C50 */ 1662306a36Sopenharmony_ci#define REG_SCSI_DATA 0 /* R/W: SCSI Data (with ACK) */ 1762306a36Sopenharmony_ci#define REG_BSTAT 1 /* R: SCSI Bus Status */ 1862306a36Sopenharmony_ci#define BSTAT_BSY BIT(0) /* Busy */ 1962306a36Sopenharmony_ci#define BSTAT_MSG BIT(1) /* Message */ 2062306a36Sopenharmony_ci#define BSTAT_IO BIT(2) /* Input/Output */ 2162306a36Sopenharmony_ci#define BSTAT_CMD BIT(3) /* Command/Data */ 2262306a36Sopenharmony_ci#define BSTAT_REQ BIT(4) /* Request and Not Ack */ 2362306a36Sopenharmony_ci#define BSTAT_SEL BIT(5) /* Select */ 2462306a36Sopenharmony_ci#define BSTAT_ACK BIT(6) /* Acknowledge and Request */ 2562306a36Sopenharmony_ci#define BSTAT_ATN BIT(7) /* Attention */ 2662306a36Sopenharmony_ci#define REG_BCTL 1 /* W: SCSI Bus Control */ 2762306a36Sopenharmony_ci#define BCTL_RST BIT(0) /* Bus Reset */ 2862306a36Sopenharmony_ci#define BCTL_SEL BIT(1) /* Select */ 2962306a36Sopenharmony_ci#define BCTL_BSY BIT(2) /* Busy */ 3062306a36Sopenharmony_ci#define BCTL_ATN BIT(3) /* Attention */ 3162306a36Sopenharmony_ci#define BCTL_IO BIT(4) /* Input/Output */ 3262306a36Sopenharmony_ci#define BCTL_CMD BIT(5) /* Command/Data */ 3362306a36Sopenharmony_ci#define BCTL_MSG BIT(6) /* Message */ 3462306a36Sopenharmony_ci#define BCTL_BUSEN BIT(7) /* Enable bus drivers */ 3562306a36Sopenharmony_ci#define REG_ASTAT 2 /* R: Adapter Status 1 */ 3662306a36Sopenharmony_ci#define ASTAT_IRQ BIT(0) /* Interrupt active */ 3762306a36Sopenharmony_ci#define ASTAT_ARB BIT(1) /* Arbitration complete */ 3862306a36Sopenharmony_ci#define ASTAT_PARERR BIT(2) /* Parity error */ 3962306a36Sopenharmony_ci#define ASTAT_RST BIT(3) /* SCSI reset occurred */ 4062306a36Sopenharmony_ci#define ASTAT_FIFODIR BIT(4) /* FIFO direction */ 4162306a36Sopenharmony_ci#define ASTAT_FIFOEN BIT(5) /* FIFO enabled */ 4262306a36Sopenharmony_ci#define ASTAT_PAREN BIT(6) /* Parity enabled */ 4362306a36Sopenharmony_ci#define ASTAT_BUSEN BIT(7) /* Bus drivers enabled */ 4462306a36Sopenharmony_ci#define REG_ICTL 2 /* W: Interrupt Control */ 4562306a36Sopenharmony_ci#define ICTL_FIFO_MASK 0x0f /* FIFO threshold, 1/16 FIFO size */ 4662306a36Sopenharmony_ci#define ICTL_FIFO BIT(4) /* Int. on FIFO count */ 4762306a36Sopenharmony_ci#define ICTL_ARB BIT(5) /* Int. on Arbitration complete */ 4862306a36Sopenharmony_ci#define ICTL_SEL BIT(6) /* Int. on SCSI Select */ 4962306a36Sopenharmony_ci#define ICTL_REQ BIT(7) /* Int. on SCSI Request */ 5062306a36Sopenharmony_ci#define REG_FSTAT 3 /* R: Adapter Status 2 (FIFO) - (@) */ 5162306a36Sopenharmony_ci#define FSTAT_ONOTEMPTY BIT(0) /* Output FIFO not empty */ 5262306a36Sopenharmony_ci#define FSTAT_INOTEMPTY BIT(1) /* Input FIFO not empty */ 5362306a36Sopenharmony_ci#define FSTAT_NOTEMPTY BIT(2) /* Main FIFO not empty */ 5462306a36Sopenharmony_ci#define FSTAT_NOTFULL BIT(3) /* Main FIFO not full */ 5562306a36Sopenharmony_ci#define REG_MCTL 3 /* W: SCSI Data Mode Control */ 5662306a36Sopenharmony_ci#define MCTL_ACK_MASK 0x0f /* Acknowledge period */ 5762306a36Sopenharmony_ci#define MCTL_ACTDEASS BIT(4) /* Active deassert of REQ and ACK */ 5862306a36Sopenharmony_ci#define MCTL_TARGET BIT(5) /* Enable target mode */ 5962306a36Sopenharmony_ci#define MCTL_FASTSYNC BIT(6) /* Enable Fast Synchronous */ 6062306a36Sopenharmony_ci#define MCTL_SYNC BIT(7) /* Enable Synchronous */ 6162306a36Sopenharmony_ci#define REG_INTCOND 4 /* R: Interrupt Condition - (@) */ 6262306a36Sopenharmony_ci#define IRQ_FIFO BIT(1) /* FIFO interrupt */ 6362306a36Sopenharmony_ci#define IRQ_REQ BIT(2) /* SCSI Request interrupt */ 6462306a36Sopenharmony_ci#define IRQ_SEL BIT(3) /* SCSI Select interrupt */ 6562306a36Sopenharmony_ci#define IRQ_ARB BIT(4) /* SCSI Arbitration interrupt */ 6662306a36Sopenharmony_ci#define IRQ_RST BIT(5) /* SCSI Reset interrupt */ 6762306a36Sopenharmony_ci#define IRQ_FORCED BIT(6) /* Forced interrupt */ 6862306a36Sopenharmony_ci#define IRQ_TIMEOUT BIT(7) /* Bus timeout */ 6962306a36Sopenharmony_ci#define REG_ACTL 4 /* W: Adapter Control 1 */ 7062306a36Sopenharmony_ci#define ACTL_RESET BIT(0) /* Reset FIFO, parity, reset int. */ 7162306a36Sopenharmony_ci#define ACTL_FIRQ BIT(1) /* Set Forced interrupt */ 7262306a36Sopenharmony_ci#define ACTL_ARB BIT(2) /* Initiate Bus Arbitration */ 7362306a36Sopenharmony_ci#define ACTL_PAREN BIT(3) /* Enable SCSI Parity */ 7462306a36Sopenharmony_ci#define ACTL_IRQEN BIT(4) /* Enable interrupts */ 7562306a36Sopenharmony_ci#define ACTL_CLRFIRQ BIT(5) /* Clear Forced interrupt */ 7662306a36Sopenharmony_ci#define ACTL_FIFOWR BIT(6) /* FIFO Direction (1=write) */ 7762306a36Sopenharmony_ci#define ACTL_FIFOEN BIT(7) /* Enable FIFO */ 7862306a36Sopenharmony_ci#define REG_ID_LSB 5 /* R: ID Code (LSB) */ 7962306a36Sopenharmony_ci#define REG_ACTL2 5 /* Adapter Control 2 - (@) */ 8062306a36Sopenharmony_ci#define ACTL2_RAMOVRLY BIT(0) /* Enable RAM overlay */ 8162306a36Sopenharmony_ci#define ACTL2_SLEEP BIT(7) /* Sleep mode */ 8262306a36Sopenharmony_ci#define REG_ID_MSB 6 /* R: ID Code (MSB) */ 8362306a36Sopenharmony_ci#define REG_LOOPBACK 7 /* R/W: Loopback */ 8462306a36Sopenharmony_ci#define REG_SCSI_DATA_NOACK 8 /* R/W: SCSI Data (no ACK) */ 8562306a36Sopenharmony_ci#define REG_ASTAT3 9 /* R: Adapter Status 3 */ 8662306a36Sopenharmony_ci#define ASTAT3_ACTDEASS BIT(0) /* Active deassert enabled */ 8762306a36Sopenharmony_ci#define ASTAT3_RAMOVRLY BIT(1) /* RAM overlay enabled */ 8862306a36Sopenharmony_ci#define ASTAT3_TARGERR BIT(2) /* Target error */ 8962306a36Sopenharmony_ci#define ASTAT3_IRQEN BIT(3) /* Interrupts enabled */ 9062306a36Sopenharmony_ci#define ASTAT3_IRQMASK 0xf0 /* Enabled interrupts mask */ 9162306a36Sopenharmony_ci#define REG_CFG1 10 /* R: Configuration Register 1 */ 9262306a36Sopenharmony_ci#define CFG1_BUS BIT(0) /* 0 = ISA */ 9362306a36Sopenharmony_ci#define CFG1_IRQ_MASK 0x0e /* IRQ jumpers */ 9462306a36Sopenharmony_ci#define CFG1_IO_MASK 0x30 /* I/O base jumpers */ 9562306a36Sopenharmony_ci#define CFG1_BIOS_MASK 0xc0 /* BIOS base jumpers */ 9662306a36Sopenharmony_ci#define REG_CFG2 11 /* R/W: Configuration Register 2 (@) */ 9762306a36Sopenharmony_ci#define CFG2_ROMDIS BIT(0) /* ROM disabled */ 9862306a36Sopenharmony_ci#define CFG2_RAMDIS BIT(1) /* RAM disabled */ 9962306a36Sopenharmony_ci#define CFG2_IRQEDGE BIT(2) /* Edge-triggered interrupts */ 10062306a36Sopenharmony_ci#define CFG2_NOWS BIT(3) /* No wait states */ 10162306a36Sopenharmony_ci#define CFG2_32BIT BIT(7) /* 32-bit mode */ 10262306a36Sopenharmony_ci#define REG_FIFO 12 /* R/W: FIFO */ 10362306a36Sopenharmony_ci#define REG_FIFO_COUNT 14 /* R: FIFO Data Count */ 10462306a36Sopenharmony_ci 10562306a36Sopenharmony_ci#ifdef CONFIG_PM_SLEEP 10662306a36Sopenharmony_cistatic const struct dev_pm_ops __maybe_unused fdomain_pm_ops; 10762306a36Sopenharmony_ci#define FDOMAIN_PM_OPS (&fdomain_pm_ops) 10862306a36Sopenharmony_ci#else 10962306a36Sopenharmony_ci#define FDOMAIN_PM_OPS NULL 11062306a36Sopenharmony_ci#endif /* CONFIG_PM_SLEEP */ 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_cistruct Scsi_Host *fdomain_create(int base, int irq, int this_id, 11362306a36Sopenharmony_ci struct device *dev); 11462306a36Sopenharmony_ciint fdomain_destroy(struct Scsi_Host *sh); 115