162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef _FIREWIRE_OHCI_H
362306a36Sopenharmony_ci#define _FIREWIRE_OHCI_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci/* OHCI register map */
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci#define OHCI1394_Version                      0x000
862306a36Sopenharmony_ci#define OHCI1394_GUID_ROM                     0x004
962306a36Sopenharmony_ci#define OHCI1394_ATRetries                    0x008
1062306a36Sopenharmony_ci#define OHCI1394_CSRData                      0x00C
1162306a36Sopenharmony_ci#define OHCI1394_CSRCompareData               0x010
1262306a36Sopenharmony_ci#define OHCI1394_CSRControl                   0x014
1362306a36Sopenharmony_ci#define OHCI1394_ConfigROMhdr                 0x018
1462306a36Sopenharmony_ci#define OHCI1394_BusID                        0x01C
1562306a36Sopenharmony_ci#define OHCI1394_BusOptions                   0x020
1662306a36Sopenharmony_ci#define OHCI1394_GUIDHi                       0x024
1762306a36Sopenharmony_ci#define OHCI1394_GUIDLo                       0x028
1862306a36Sopenharmony_ci#define OHCI1394_ConfigROMmap                 0x034
1962306a36Sopenharmony_ci#define OHCI1394_PostedWriteAddressLo         0x038
2062306a36Sopenharmony_ci#define OHCI1394_PostedWriteAddressHi         0x03C
2162306a36Sopenharmony_ci#define OHCI1394_VendorID                     0x040
2262306a36Sopenharmony_ci#define OHCI1394_HCControlSet                 0x050
2362306a36Sopenharmony_ci#define OHCI1394_HCControlClear               0x054
2462306a36Sopenharmony_ci#define  OHCI1394_HCControl_BIBimageValid	0x80000000
2562306a36Sopenharmony_ci#define  OHCI1394_HCControl_noByteSwapData	0x40000000
2662306a36Sopenharmony_ci#define  OHCI1394_HCControl_programPhyEnable	0x00800000
2762306a36Sopenharmony_ci#define  OHCI1394_HCControl_aPhyEnhanceEnable	0x00400000
2862306a36Sopenharmony_ci#define  OHCI1394_HCControl_LPS			0x00080000
2962306a36Sopenharmony_ci#define  OHCI1394_HCControl_postedWriteEnable	0x00040000
3062306a36Sopenharmony_ci#define  OHCI1394_HCControl_linkEnable		0x00020000
3162306a36Sopenharmony_ci#define  OHCI1394_HCControl_softReset		0x00010000
3262306a36Sopenharmony_ci#define OHCI1394_SelfIDBuffer                 0x064
3362306a36Sopenharmony_ci#define OHCI1394_SelfIDCount                  0x068
3462306a36Sopenharmony_ci#define  OHCI1394_SelfIDCount_selfIDError	0x80000000
3562306a36Sopenharmony_ci#define OHCI1394_IRMultiChanMaskHiSet         0x070
3662306a36Sopenharmony_ci#define OHCI1394_IRMultiChanMaskHiClear       0x074
3762306a36Sopenharmony_ci#define OHCI1394_IRMultiChanMaskLoSet         0x078
3862306a36Sopenharmony_ci#define OHCI1394_IRMultiChanMaskLoClear       0x07C
3962306a36Sopenharmony_ci#define OHCI1394_IntEventSet                  0x080
4062306a36Sopenharmony_ci#define OHCI1394_IntEventClear                0x084
4162306a36Sopenharmony_ci#define OHCI1394_IntMaskSet                   0x088
4262306a36Sopenharmony_ci#define OHCI1394_IntMaskClear                 0x08C
4362306a36Sopenharmony_ci#define OHCI1394_IsoXmitIntEventSet           0x090
4462306a36Sopenharmony_ci#define OHCI1394_IsoXmitIntEventClear         0x094
4562306a36Sopenharmony_ci#define OHCI1394_IsoXmitIntMaskSet            0x098
4662306a36Sopenharmony_ci#define OHCI1394_IsoXmitIntMaskClear          0x09C
4762306a36Sopenharmony_ci#define OHCI1394_IsoRecvIntEventSet           0x0A0
4862306a36Sopenharmony_ci#define OHCI1394_IsoRecvIntEventClear         0x0A4
4962306a36Sopenharmony_ci#define OHCI1394_IsoRecvIntMaskSet            0x0A8
5062306a36Sopenharmony_ci#define OHCI1394_IsoRecvIntMaskClear          0x0AC
5162306a36Sopenharmony_ci#define OHCI1394_InitialBandwidthAvailable    0x0B0
5262306a36Sopenharmony_ci#define OHCI1394_InitialChannelsAvailableHi   0x0B4
5362306a36Sopenharmony_ci#define OHCI1394_InitialChannelsAvailableLo   0x0B8
5462306a36Sopenharmony_ci#define OHCI1394_FairnessControl              0x0DC
5562306a36Sopenharmony_ci#define OHCI1394_LinkControlSet               0x0E0
5662306a36Sopenharmony_ci#define OHCI1394_LinkControlClear             0x0E4
5762306a36Sopenharmony_ci#define   OHCI1394_LinkControl_rcvSelfID	(1 << 9)
5862306a36Sopenharmony_ci#define   OHCI1394_LinkControl_rcvPhyPkt	(1 << 10)
5962306a36Sopenharmony_ci#define   OHCI1394_LinkControl_cycleTimerEnable	(1 << 20)
6062306a36Sopenharmony_ci#define   OHCI1394_LinkControl_cycleMaster	(1 << 21)
6162306a36Sopenharmony_ci#define   OHCI1394_LinkControl_cycleSource	(1 << 22)
6262306a36Sopenharmony_ci#define OHCI1394_NodeID                       0x0E8
6362306a36Sopenharmony_ci#define   OHCI1394_NodeID_idValid             0x80000000
6462306a36Sopenharmony_ci#define   OHCI1394_NodeID_root                0x40000000
6562306a36Sopenharmony_ci#define   OHCI1394_NodeID_nodeNumber          0x0000003f
6662306a36Sopenharmony_ci#define   OHCI1394_NodeID_busNumber           0x0000ffc0
6762306a36Sopenharmony_ci#define OHCI1394_PhyControl                   0x0EC
6862306a36Sopenharmony_ci#define   OHCI1394_PhyControl_Read(addr)	(((addr) << 8) | 0x00008000)
6962306a36Sopenharmony_ci#define   OHCI1394_PhyControl_ReadDone		0x80000000
7062306a36Sopenharmony_ci#define   OHCI1394_PhyControl_ReadData(r)	(((r) & 0x00ff0000) >> 16)
7162306a36Sopenharmony_ci#define   OHCI1394_PhyControl_Write(addr, data)	(((addr) << 8) | (data) | 0x00004000)
7262306a36Sopenharmony_ci#define   OHCI1394_PhyControl_WritePending	0x00004000
7362306a36Sopenharmony_ci#define OHCI1394_IsochronousCycleTimer        0x0F0
7462306a36Sopenharmony_ci#define OHCI1394_AsReqFilterHiSet             0x100
7562306a36Sopenharmony_ci#define OHCI1394_AsReqFilterHiClear           0x104
7662306a36Sopenharmony_ci#define OHCI1394_AsReqFilterLoSet             0x108
7762306a36Sopenharmony_ci#define OHCI1394_AsReqFilterLoClear           0x10C
7862306a36Sopenharmony_ci#define OHCI1394_PhyReqFilterHiSet            0x110
7962306a36Sopenharmony_ci#define OHCI1394_PhyReqFilterHiClear          0x114
8062306a36Sopenharmony_ci#define OHCI1394_PhyReqFilterLoSet            0x118
8162306a36Sopenharmony_ci#define OHCI1394_PhyReqFilterLoClear          0x11C
8262306a36Sopenharmony_ci#define OHCI1394_PhyUpperBound                0x120
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ci#define OHCI1394_AsReqTrContextBase           0x180
8562306a36Sopenharmony_ci#define OHCI1394_AsReqTrContextControlSet     0x180
8662306a36Sopenharmony_ci#define OHCI1394_AsReqTrContextControlClear   0x184
8762306a36Sopenharmony_ci#define OHCI1394_AsReqTrCommandPtr            0x18C
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci#define OHCI1394_AsRspTrContextBase           0x1A0
9062306a36Sopenharmony_ci#define OHCI1394_AsRspTrContextControlSet     0x1A0
9162306a36Sopenharmony_ci#define OHCI1394_AsRspTrContextControlClear   0x1A4
9262306a36Sopenharmony_ci#define OHCI1394_AsRspTrCommandPtr            0x1AC
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ci#define OHCI1394_AsReqRcvContextBase          0x1C0
9562306a36Sopenharmony_ci#define OHCI1394_AsReqRcvContextControlSet    0x1C0
9662306a36Sopenharmony_ci#define OHCI1394_AsReqRcvContextControlClear  0x1C4
9762306a36Sopenharmony_ci#define OHCI1394_AsReqRcvCommandPtr           0x1CC
9862306a36Sopenharmony_ci
9962306a36Sopenharmony_ci#define OHCI1394_AsRspRcvContextBase          0x1E0
10062306a36Sopenharmony_ci#define OHCI1394_AsRspRcvContextControlSet    0x1E0
10162306a36Sopenharmony_ci#define OHCI1394_AsRspRcvContextControlClear  0x1E4
10262306a36Sopenharmony_ci#define OHCI1394_AsRspRcvCommandPtr           0x1EC
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ci/* Isochronous transmit registers */
10562306a36Sopenharmony_ci#define OHCI1394_IsoXmitContextBase(n)           (0x200 + 16 * (n))
10662306a36Sopenharmony_ci#define OHCI1394_IsoXmitContextControlSet(n)     (0x200 + 16 * (n))
10762306a36Sopenharmony_ci#define OHCI1394_IsoXmitContextControlClear(n)   (0x204 + 16 * (n))
10862306a36Sopenharmony_ci#define OHCI1394_IsoXmitCommandPtr(n)            (0x20C + 16 * (n))
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_ci/* Isochronous receive registers */
11162306a36Sopenharmony_ci#define OHCI1394_IsoRcvContextBase(n)         (0x400 + 32 * (n))
11262306a36Sopenharmony_ci#define OHCI1394_IsoRcvContextControlSet(n)   (0x400 + 32 * (n))
11362306a36Sopenharmony_ci#define OHCI1394_IsoRcvContextControlClear(n) (0x404 + 32 * (n))
11462306a36Sopenharmony_ci#define OHCI1394_IsoRcvCommandPtr(n)          (0x40C + 32 * (n))
11562306a36Sopenharmony_ci#define OHCI1394_IsoRcvContextMatch(n)        (0x410 + 32 * (n))
11662306a36Sopenharmony_ci
11762306a36Sopenharmony_ci/* Interrupts Mask/Events */
11862306a36Sopenharmony_ci#define OHCI1394_reqTxComplete		0x00000001
11962306a36Sopenharmony_ci#define OHCI1394_respTxComplete		0x00000002
12062306a36Sopenharmony_ci#define OHCI1394_ARRQ			0x00000004
12162306a36Sopenharmony_ci#define OHCI1394_ARRS			0x00000008
12262306a36Sopenharmony_ci#define OHCI1394_RQPkt			0x00000010
12362306a36Sopenharmony_ci#define OHCI1394_RSPkt			0x00000020
12462306a36Sopenharmony_ci#define OHCI1394_isochTx		0x00000040
12562306a36Sopenharmony_ci#define OHCI1394_isochRx		0x00000080
12662306a36Sopenharmony_ci#define OHCI1394_postedWriteErr		0x00000100
12762306a36Sopenharmony_ci#define OHCI1394_lockRespErr		0x00000200
12862306a36Sopenharmony_ci#define OHCI1394_selfIDComplete		0x00010000
12962306a36Sopenharmony_ci#define OHCI1394_busReset		0x00020000
13062306a36Sopenharmony_ci#define OHCI1394_regAccessFail		0x00040000
13162306a36Sopenharmony_ci#define OHCI1394_phy			0x00080000
13262306a36Sopenharmony_ci#define OHCI1394_cycleSynch		0x00100000
13362306a36Sopenharmony_ci#define OHCI1394_cycle64Seconds		0x00200000
13462306a36Sopenharmony_ci#define OHCI1394_cycleLost		0x00400000
13562306a36Sopenharmony_ci#define OHCI1394_cycleInconsistent	0x00800000
13662306a36Sopenharmony_ci#define OHCI1394_unrecoverableError	0x01000000
13762306a36Sopenharmony_ci#define OHCI1394_cycleTooLong		0x02000000
13862306a36Sopenharmony_ci#define OHCI1394_phyRegRcvd		0x04000000
13962306a36Sopenharmony_ci#define OHCI1394_masterIntEnable	0x80000000
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ci#define OHCI1394_evt_no_status		0x0
14262306a36Sopenharmony_ci#define OHCI1394_evt_long_packet	0x2
14362306a36Sopenharmony_ci#define OHCI1394_evt_missing_ack	0x3
14462306a36Sopenharmony_ci#define OHCI1394_evt_underrun		0x4
14562306a36Sopenharmony_ci#define OHCI1394_evt_overrun		0x5
14662306a36Sopenharmony_ci#define OHCI1394_evt_descriptor_read	0x6
14762306a36Sopenharmony_ci#define OHCI1394_evt_data_read		0x7
14862306a36Sopenharmony_ci#define OHCI1394_evt_data_write		0x8
14962306a36Sopenharmony_ci#define OHCI1394_evt_bus_reset		0x9
15062306a36Sopenharmony_ci#define OHCI1394_evt_timeout		0xa
15162306a36Sopenharmony_ci#define OHCI1394_evt_tcode_err		0xb
15262306a36Sopenharmony_ci#define OHCI1394_evt_reserved_b		0xc
15362306a36Sopenharmony_ci#define OHCI1394_evt_reserved_c		0xd
15462306a36Sopenharmony_ci#define OHCI1394_evt_unknown		0xe
15562306a36Sopenharmony_ci#define OHCI1394_evt_flushed		0xf
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_ci#define OHCI1394_phy_tcode		0xe
15862306a36Sopenharmony_ci
15962306a36Sopenharmony_ci#endif /* _FIREWIRE_OHCI_H */
160