18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _FIREWIRE_OHCI_H
38c2ecf20Sopenharmony_ci#define _FIREWIRE_OHCI_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci/* OHCI register map */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#define OHCI1394_Version                      0x000
88c2ecf20Sopenharmony_ci#define OHCI1394_GUID_ROM                     0x004
98c2ecf20Sopenharmony_ci#define OHCI1394_ATRetries                    0x008
108c2ecf20Sopenharmony_ci#define OHCI1394_CSRData                      0x00C
118c2ecf20Sopenharmony_ci#define OHCI1394_CSRCompareData               0x010
128c2ecf20Sopenharmony_ci#define OHCI1394_CSRControl                   0x014
138c2ecf20Sopenharmony_ci#define OHCI1394_ConfigROMhdr                 0x018
148c2ecf20Sopenharmony_ci#define OHCI1394_BusID                        0x01C
158c2ecf20Sopenharmony_ci#define OHCI1394_BusOptions                   0x020
168c2ecf20Sopenharmony_ci#define OHCI1394_GUIDHi                       0x024
178c2ecf20Sopenharmony_ci#define OHCI1394_GUIDLo                       0x028
188c2ecf20Sopenharmony_ci#define OHCI1394_ConfigROMmap                 0x034
198c2ecf20Sopenharmony_ci#define OHCI1394_PostedWriteAddressLo         0x038
208c2ecf20Sopenharmony_ci#define OHCI1394_PostedWriteAddressHi         0x03C
218c2ecf20Sopenharmony_ci#define OHCI1394_VendorID                     0x040
228c2ecf20Sopenharmony_ci#define OHCI1394_HCControlSet                 0x050
238c2ecf20Sopenharmony_ci#define OHCI1394_HCControlClear               0x054
248c2ecf20Sopenharmony_ci#define  OHCI1394_HCControl_BIBimageValid	0x80000000
258c2ecf20Sopenharmony_ci#define  OHCI1394_HCControl_noByteSwapData	0x40000000
268c2ecf20Sopenharmony_ci#define  OHCI1394_HCControl_programPhyEnable	0x00800000
278c2ecf20Sopenharmony_ci#define  OHCI1394_HCControl_aPhyEnhanceEnable	0x00400000
288c2ecf20Sopenharmony_ci#define  OHCI1394_HCControl_LPS			0x00080000
298c2ecf20Sopenharmony_ci#define  OHCI1394_HCControl_postedWriteEnable	0x00040000
308c2ecf20Sopenharmony_ci#define  OHCI1394_HCControl_linkEnable		0x00020000
318c2ecf20Sopenharmony_ci#define  OHCI1394_HCControl_softReset		0x00010000
328c2ecf20Sopenharmony_ci#define OHCI1394_SelfIDBuffer                 0x064
338c2ecf20Sopenharmony_ci#define OHCI1394_SelfIDCount                  0x068
348c2ecf20Sopenharmony_ci#define  OHCI1394_SelfIDCount_selfIDError	0x80000000
358c2ecf20Sopenharmony_ci#define OHCI1394_IRMultiChanMaskHiSet         0x070
368c2ecf20Sopenharmony_ci#define OHCI1394_IRMultiChanMaskHiClear       0x074
378c2ecf20Sopenharmony_ci#define OHCI1394_IRMultiChanMaskLoSet         0x078
388c2ecf20Sopenharmony_ci#define OHCI1394_IRMultiChanMaskLoClear       0x07C
398c2ecf20Sopenharmony_ci#define OHCI1394_IntEventSet                  0x080
408c2ecf20Sopenharmony_ci#define OHCI1394_IntEventClear                0x084
418c2ecf20Sopenharmony_ci#define OHCI1394_IntMaskSet                   0x088
428c2ecf20Sopenharmony_ci#define OHCI1394_IntMaskClear                 0x08C
438c2ecf20Sopenharmony_ci#define OHCI1394_IsoXmitIntEventSet           0x090
448c2ecf20Sopenharmony_ci#define OHCI1394_IsoXmitIntEventClear         0x094
458c2ecf20Sopenharmony_ci#define OHCI1394_IsoXmitIntMaskSet            0x098
468c2ecf20Sopenharmony_ci#define OHCI1394_IsoXmitIntMaskClear          0x09C
478c2ecf20Sopenharmony_ci#define OHCI1394_IsoRecvIntEventSet           0x0A0
488c2ecf20Sopenharmony_ci#define OHCI1394_IsoRecvIntEventClear         0x0A4
498c2ecf20Sopenharmony_ci#define OHCI1394_IsoRecvIntMaskSet            0x0A8
508c2ecf20Sopenharmony_ci#define OHCI1394_IsoRecvIntMaskClear          0x0AC
518c2ecf20Sopenharmony_ci#define OHCI1394_InitialBandwidthAvailable    0x0B0
528c2ecf20Sopenharmony_ci#define OHCI1394_InitialChannelsAvailableHi   0x0B4
538c2ecf20Sopenharmony_ci#define OHCI1394_InitialChannelsAvailableLo   0x0B8
548c2ecf20Sopenharmony_ci#define OHCI1394_FairnessControl              0x0DC
558c2ecf20Sopenharmony_ci#define OHCI1394_LinkControlSet               0x0E0
568c2ecf20Sopenharmony_ci#define OHCI1394_LinkControlClear             0x0E4
578c2ecf20Sopenharmony_ci#define   OHCI1394_LinkControl_rcvSelfID	(1 << 9)
588c2ecf20Sopenharmony_ci#define   OHCI1394_LinkControl_rcvPhyPkt	(1 << 10)
598c2ecf20Sopenharmony_ci#define   OHCI1394_LinkControl_cycleTimerEnable	(1 << 20)
608c2ecf20Sopenharmony_ci#define   OHCI1394_LinkControl_cycleMaster	(1 << 21)
618c2ecf20Sopenharmony_ci#define   OHCI1394_LinkControl_cycleSource	(1 << 22)
628c2ecf20Sopenharmony_ci#define OHCI1394_NodeID                       0x0E8
638c2ecf20Sopenharmony_ci#define   OHCI1394_NodeID_idValid             0x80000000
648c2ecf20Sopenharmony_ci#define   OHCI1394_NodeID_root                0x40000000
658c2ecf20Sopenharmony_ci#define   OHCI1394_NodeID_nodeNumber          0x0000003f
668c2ecf20Sopenharmony_ci#define   OHCI1394_NodeID_busNumber           0x0000ffc0
678c2ecf20Sopenharmony_ci#define OHCI1394_PhyControl                   0x0EC
688c2ecf20Sopenharmony_ci#define   OHCI1394_PhyControl_Read(addr)	(((addr) << 8) | 0x00008000)
698c2ecf20Sopenharmony_ci#define   OHCI1394_PhyControl_ReadDone		0x80000000
708c2ecf20Sopenharmony_ci#define   OHCI1394_PhyControl_ReadData(r)	(((r) & 0x00ff0000) >> 16)
718c2ecf20Sopenharmony_ci#define   OHCI1394_PhyControl_Write(addr, data)	(((addr) << 8) | (data) | 0x00004000)
728c2ecf20Sopenharmony_ci#define   OHCI1394_PhyControl_WritePending	0x00004000
738c2ecf20Sopenharmony_ci#define OHCI1394_IsochronousCycleTimer        0x0F0
748c2ecf20Sopenharmony_ci#define OHCI1394_AsReqFilterHiSet             0x100
758c2ecf20Sopenharmony_ci#define OHCI1394_AsReqFilterHiClear           0x104
768c2ecf20Sopenharmony_ci#define OHCI1394_AsReqFilterLoSet             0x108
778c2ecf20Sopenharmony_ci#define OHCI1394_AsReqFilterLoClear           0x10C
788c2ecf20Sopenharmony_ci#define OHCI1394_PhyReqFilterHiSet            0x110
798c2ecf20Sopenharmony_ci#define OHCI1394_PhyReqFilterHiClear          0x114
808c2ecf20Sopenharmony_ci#define OHCI1394_PhyReqFilterLoSet            0x118
818c2ecf20Sopenharmony_ci#define OHCI1394_PhyReqFilterLoClear          0x11C
828c2ecf20Sopenharmony_ci#define OHCI1394_PhyUpperBound                0x120
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci#define OHCI1394_AsReqTrContextBase           0x180
858c2ecf20Sopenharmony_ci#define OHCI1394_AsReqTrContextControlSet     0x180
868c2ecf20Sopenharmony_ci#define OHCI1394_AsReqTrContextControlClear   0x184
878c2ecf20Sopenharmony_ci#define OHCI1394_AsReqTrCommandPtr            0x18C
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci#define OHCI1394_AsRspTrContextBase           0x1A0
908c2ecf20Sopenharmony_ci#define OHCI1394_AsRspTrContextControlSet     0x1A0
918c2ecf20Sopenharmony_ci#define OHCI1394_AsRspTrContextControlClear   0x1A4
928c2ecf20Sopenharmony_ci#define OHCI1394_AsRspTrCommandPtr            0x1AC
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci#define OHCI1394_AsReqRcvContextBase          0x1C0
958c2ecf20Sopenharmony_ci#define OHCI1394_AsReqRcvContextControlSet    0x1C0
968c2ecf20Sopenharmony_ci#define OHCI1394_AsReqRcvContextControlClear  0x1C4
978c2ecf20Sopenharmony_ci#define OHCI1394_AsReqRcvCommandPtr           0x1CC
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci#define OHCI1394_AsRspRcvContextBase          0x1E0
1008c2ecf20Sopenharmony_ci#define OHCI1394_AsRspRcvContextControlSet    0x1E0
1018c2ecf20Sopenharmony_ci#define OHCI1394_AsRspRcvContextControlClear  0x1E4
1028c2ecf20Sopenharmony_ci#define OHCI1394_AsRspRcvCommandPtr           0x1EC
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ci/* Isochronous transmit registers */
1058c2ecf20Sopenharmony_ci#define OHCI1394_IsoXmitContextBase(n)           (0x200 + 16 * (n))
1068c2ecf20Sopenharmony_ci#define OHCI1394_IsoXmitContextControlSet(n)     (0x200 + 16 * (n))
1078c2ecf20Sopenharmony_ci#define OHCI1394_IsoXmitContextControlClear(n)   (0x204 + 16 * (n))
1088c2ecf20Sopenharmony_ci#define OHCI1394_IsoXmitCommandPtr(n)            (0x20C + 16 * (n))
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci/* Isochronous receive registers */
1118c2ecf20Sopenharmony_ci#define OHCI1394_IsoRcvContextBase(n)         (0x400 + 32 * (n))
1128c2ecf20Sopenharmony_ci#define OHCI1394_IsoRcvContextControlSet(n)   (0x400 + 32 * (n))
1138c2ecf20Sopenharmony_ci#define OHCI1394_IsoRcvContextControlClear(n) (0x404 + 32 * (n))
1148c2ecf20Sopenharmony_ci#define OHCI1394_IsoRcvCommandPtr(n)          (0x40C + 32 * (n))
1158c2ecf20Sopenharmony_ci#define OHCI1394_IsoRcvContextMatch(n)        (0x410 + 32 * (n))
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci/* Interrupts Mask/Events */
1188c2ecf20Sopenharmony_ci#define OHCI1394_reqTxComplete		0x00000001
1198c2ecf20Sopenharmony_ci#define OHCI1394_respTxComplete		0x00000002
1208c2ecf20Sopenharmony_ci#define OHCI1394_ARRQ			0x00000004
1218c2ecf20Sopenharmony_ci#define OHCI1394_ARRS			0x00000008
1228c2ecf20Sopenharmony_ci#define OHCI1394_RQPkt			0x00000010
1238c2ecf20Sopenharmony_ci#define OHCI1394_RSPkt			0x00000020
1248c2ecf20Sopenharmony_ci#define OHCI1394_isochTx		0x00000040
1258c2ecf20Sopenharmony_ci#define OHCI1394_isochRx		0x00000080
1268c2ecf20Sopenharmony_ci#define OHCI1394_postedWriteErr		0x00000100
1278c2ecf20Sopenharmony_ci#define OHCI1394_lockRespErr		0x00000200
1288c2ecf20Sopenharmony_ci#define OHCI1394_selfIDComplete		0x00010000
1298c2ecf20Sopenharmony_ci#define OHCI1394_busReset		0x00020000
1308c2ecf20Sopenharmony_ci#define OHCI1394_regAccessFail		0x00040000
1318c2ecf20Sopenharmony_ci#define OHCI1394_phy			0x00080000
1328c2ecf20Sopenharmony_ci#define OHCI1394_cycleSynch		0x00100000
1338c2ecf20Sopenharmony_ci#define OHCI1394_cycle64Seconds		0x00200000
1348c2ecf20Sopenharmony_ci#define OHCI1394_cycleLost		0x00400000
1358c2ecf20Sopenharmony_ci#define OHCI1394_cycleInconsistent	0x00800000
1368c2ecf20Sopenharmony_ci#define OHCI1394_unrecoverableError	0x01000000
1378c2ecf20Sopenharmony_ci#define OHCI1394_cycleTooLong		0x02000000
1388c2ecf20Sopenharmony_ci#define OHCI1394_phyRegRcvd		0x04000000
1398c2ecf20Sopenharmony_ci#define OHCI1394_masterIntEnable	0x80000000
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci#define OHCI1394_evt_no_status		0x0
1428c2ecf20Sopenharmony_ci#define OHCI1394_evt_long_packet	0x2
1438c2ecf20Sopenharmony_ci#define OHCI1394_evt_missing_ack	0x3
1448c2ecf20Sopenharmony_ci#define OHCI1394_evt_underrun		0x4
1458c2ecf20Sopenharmony_ci#define OHCI1394_evt_overrun		0x5
1468c2ecf20Sopenharmony_ci#define OHCI1394_evt_descriptor_read	0x6
1478c2ecf20Sopenharmony_ci#define OHCI1394_evt_data_read		0x7
1488c2ecf20Sopenharmony_ci#define OHCI1394_evt_data_write		0x8
1498c2ecf20Sopenharmony_ci#define OHCI1394_evt_bus_reset		0x9
1508c2ecf20Sopenharmony_ci#define OHCI1394_evt_timeout		0xa
1518c2ecf20Sopenharmony_ci#define OHCI1394_evt_tcode_err		0xb
1528c2ecf20Sopenharmony_ci#define OHCI1394_evt_reserved_b		0xc
1538c2ecf20Sopenharmony_ci#define OHCI1394_evt_reserved_c		0xd
1548c2ecf20Sopenharmony_ci#define OHCI1394_evt_unknown		0xe
1558c2ecf20Sopenharmony_ci#define OHCI1394_evt_flushed		0xf
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci#define OHCI1394_phy_tcode		0xe
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci#endif /* _FIREWIRE_OHCI_H */
160