Changeset d1e580a in mainline for uspace/drv/bus/usb/ohci/ohci_regs.h


Ignore:
Timestamp:
2012-07-29T03:07:52Z (12 years ago)
Author:
Sean Bartell <wingedtachikoma@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
10334c2e
Parents:
d7c8e39f (diff), b2ba418 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ohci/ohci_regs.h

    rd7c8e39f rd1e580a  
    3535#define DRV_OHCI_OHCI_REGS_H
    3636#include <sys/types.h>
     37#include <byteorder.h>
     38
     39#define OHCI_WR(reg, val) reg = host2uint32_t_le(val)
     40#define OHCI_RD(reg) uint32_t_le2host(reg)
     41#define OHCI_SET(reg, val) reg |= host2uint32_t_le(val)
     42#define OHCI_CLR(reg, val) reg &= host2uint32_t_le(~val)
     43
    3744
    3845#define LEGACY_REGS_OFFSET 0x100
     
    4249        const ioport32_t revision;
    4350#define R_REVISION_MASK (0x3f)
    44 #define R_REVISION_SHIFT (0)
    4551#define R_LEGACY_FLAG   (0x80)
    4652
    4753        ioport32_t control;
    48 #define C_CBSR_MASK (0x3) /* Control-bulk service ratio */
     54/* Control-bulk service ratio */
    4955#define C_CBSR_1_1  (0x0)
    5056#define C_CBSR_1_2  (0x1)
    5157#define C_CBSR_1_3  (0x2)
    5258#define C_CBSR_1_4  (0x3)
    53 #define C_CBSR_SHIFT (0)
     59#define C_CBSR_MASK (0x3)
     60#define C_CBSR_SHIFT 0
    5461
    5562#define C_PLE (1 << 2)   /* Periodic list enable */
     
    5865#define C_BLE (1 << 5)   /* Bulk list enable */
    5966
    60 #define C_HCFS_MASK        (0x3) /* Host controller functional state */
     67/* Host controller functional state */
    6168#define C_HCFS_RESET       (0x0)
    6269#define C_HCFS_RESUME      (0x1)
    6370#define C_HCFS_OPERATIONAL (0x2)
    6471#define C_HCFS_SUSPEND     (0x3)
    65 #define C_HCFS_SHIFT       (6)
    66 
    67 #define C_HCFS_GET(reg) \
    68         ((reg >> C_HCFS_SHIFT) & C_HCFS_MASK)
    69 #define C_HCFS_SET(reg, hcfs_state) \
     72#define C_HCFS_GET(reg) ((OHCI_RD(reg) >> 6) & 0x3)
     73#define C_HCFS_SET(reg, value) \
    7074do { \
    71         reg = (reg & ~(C_HCFS_MASK << C_HCFS_SHIFT)) \
    72             | ((hcfs_state & C_HCFS_MASK) << C_HCFS_SHIFT); \
     75        uint32_t r = OHCI_RD(reg); \
     76        r &= ~(0x3 << 6); \
     77        r |= (value & 0x3) << 6; \
     78        OHCI_WR(reg, r); \
    7379} while (0)
    7480
    75 
    76 #define C_IR  (1 << 8)   /* Interrupt routing, make sure it's 0 */
    77 #define C_RWC (1 << 9)   /* Remote wakeup connected, host specific */
     81#define C_IR  (1 << 8)  /* Interrupt routing, make sure it's 0 */
     82#define C_RWC (1 << 9)  /* Remote wakeup connected, host specific */
    7883#define C_RWE (1 << 10)  /* Remote wakeup enable */
    7984
     
    8388#define CS_BLF (1 << 2)   /* Bulk list filled */
    8489#define CS_OCR (1 << 3)   /* Ownership change request */
     90#if 0
    8591#define CS_SOC_MASK (0x3) /* Scheduling overrun count */
    8692#define CS_SOC_SHIFT (16)
     93#endif
    8794
    8895        /** Interupt enable/disable/status,
     
    101108#define I_RHSC (1 << 6)   /* Root hub status change */
    102109#define I_OC   (1 << 30)  /* Ownership change */
    103 #define I_MI   (1 << 31)  /* Master interrupt (all/any interrupts) */
     110#define I_MI   (1 << 31)  /* Master interrupt (any/all) */
    104111
    105112        /** HCCA pointer (see hw_struct hcca.h) */
     
    145152        /** Remaining bit time in frame to start periodic transfers */
    146153        ioport32_t periodic_start;
    147 #define PS_PS_MASK (0x3fff) /* bit time when periodic get priority (0x3e67) */
     154#define PS_MASK 0x3fff
     155#define PS_SHIFT 0
    148156
    149157        /** Threshold for starting LS transaction */
     
    153161        /** The first root hub control register */
    154162        ioport32_t rh_desc_a;
    155 #define RHDA_NDS_MASK (0xff) /* Number of downstream ports, max 15 */
    156 #define RHDA_NDS_SHIFT (0)
    157 #define RHDA_PSM_FLAG  (1 << 8)  /* Power switching mode: 0-global, 1-per port*/
    158 #define RHDA_NPS_FLAG  (1 << 9)  /* No power switch: 1-power on, 0-use PSM*/
    159 #define RHDA_DT_FLAG   (1 << 10) /* 1-Compound device, must be 0 */
    160 #define RHDA_OCPM_FLAG (1 << 11) /* Over-current mode: 0-global, 1-per port */
    161 #define RHDA_NOCP_FLAG (1 << 12) /* OC control: 0-use OCPM, 1-OC off */
    162 #define RHDA_POTPGT_MASK (0xff)  /* Power on to power good time */
    163 #define RHDA_POTPGT_SHIFT (24)
     163/** Number of downstream ports, max 15 */
     164#define RHDA_NDS_MASK  (0xff)
     165/** Power switching mode: 0-global, 1-per port*/
     166#define RHDA_PSM_FLAG  (1 << 8)
     167/** No power switch: 1-power on, 0-use PSM*/
     168#define RHDA_NPS_FLAG  (1 << 9)
     169/** 1-Compound device, must be 0 */
     170#define RHDA_DT_FLAG   (1 << 10)
     171/** Over-current mode: 0-global, 1-per port */
     172#define RHDA_OCPM_FLAG (1 << 11)
     173/** OC control: 0-use OCPM, 1-OC off */
     174#define RHDA_NOCP_FLAG (1 << 12)
     175/** Power on to power good time */
     176#define RHDA_POTPGT_SHIFT   24
    164177
    165178        /** The other root hub control register */
    166179        ioport32_t rh_desc_b;
    167 #define RHDB_DR_MASK (0xffff) /* Device removable mask */
    168 #define RHDB_DR_SHIFT (0)
    169 #define RHDB_PCC_MASK (0xffff) /* Power control mask */
    170 #define RHDB_PCC_SHIFT (16)
    171 
    172 /* Port device removable status */
    173 #define RHDB_DR_FLAG(port) (((1 << port) & RHDB_DR_MASK) << RHDB_DR_SHIFT)
    174 /* Port power control status: 1-per port power control, 0-global power switch */
    175 #define RHDB_PPC_FLAG(port) (((1 << port) & RHDB_DR_MASK) << RHDB_DR_SHIFT)
     180/** Device removable mask */
     181#define RHDB_DR_SHIFT   0
     182#define RHDB_DR_MASK    0xffff
     183/** Power control mask */
     184#define RHDB_PCC_MASK (0xffff)
     185#define RHDB_PCC_SHIFT 16
    176186
    177187        /** Root hub status register */
    178188        ioport32_t rh_status;
    179 #define RHS_LPS_FLAG  (1 <<  0)/* read: 0,
    180                                 * write: 0-no effect,
    181                                 *        1-turn off port power for ports
    182                                 *        specified in PPCM(RHDB), or all ports,
    183                                 *        if power is set globally */
     189/* read: 0,
     190 * write: 0-no effect,
     191 *        1-turn off port power for ports
     192 *        specified in PPCM(RHDB), or all ports,
     193 *        if power is set globally */
     194#define RHS_LPS_FLAG  (1 <<  0)
    184195#define RHS_CLEAR_GLOBAL_POWER RHS_LPS_FLAG /* synonym for the above */
    185 #define RHS_OCI_FLAG  (1 <<  1)/* Over-current indicator, if per-port: 0 */
    186 #define RHS_DRWE_FLAG (1 << 15)/* read: 0-connect status change does not wake HC
    187                                 *       1-connect status change wakes HC
    188                                 * write: 1-set DRWE, 0-no effect */
     196/** Over-current indicator, if per-port: 0 */
     197#define RHS_OCI_FLAG  (1 <<  1)
     198
     199/* read: 0-connect status change does not wake HC
     200 *       1-connect status change wakes HC
     201 * write: 1-set DRWE, 0-no effect */
     202#define RHS_DRWE_FLAG (1 << 15)
    189203#define RHS_SET_DRWE RHS_DRWE_FLAG
    190 #define RHS_LPSC_FLAG (1 << 16)/* read: 0,
    191                                 * write: 0-no effect
    192                                 *        1-turn on port power for ports
    193                                 *        specified in PPCM(RHDB), or all ports,
    194                                 *        if power is set globally */
     204/* read: 0,
     205 * write: 0-no effect
     206 *        1-turn on port power for ports
     207 *        specified in PPCM(RHDB), or all ports,
     208 *        if power is set globally */
     209#define RHS_LPSC_FLAG (1 << 16)
    195210#define RHS_SET_GLOBAL_POWER RHS_LPSC_FLAG /* synonym for the above */
    196 #define RHS_OCIC_FLAG (1 << 17)/* Over-current indicator change   */
     211/** Over-current change indicator*/
     212#define RHS_OCIC_FLAG (1 << 17)
    197213#define RHS_CLEAR_DRWE (1 << 31)
    198214
     
    200216        ioport32_t rh_port_status[];
    201217#define RHPS_CCS_FLAG (1 << 0) /* r: current connect status,
    202                                 * w: 1-clear port enable, 0-nothing */
     218                                               * w: 1-clear port enable, 0-N/S*/
    203219#define RHPS_CLEAR_PORT_ENABLE RHPS_CCS_FLAG
    204220#define RHPS_PES_FLAG (1 << 1) /* r: port enable status
    205                                 * w: 1-set port enable, 0-nothing */
     221                                              * w: 1-set port enable, 0-N/S */
    206222#define RHPS_SET_PORT_ENABLE RHPS_PES_FLAG
    207223#define RHPS_PSS_FLAG (1 << 2) /* r: port suspend status
    208                                 * w: 1-set port suspend, 0-nothing */
     224                                               * w: 1-set port suspend, 0-N/S */
    209225#define RHPS_SET_PORT_SUSPEND RHPS_PSS_FLAG
    210 #define RHPS_POCI_FLAG (1 << 3) /* r: port over-current (if reports are per-port
    211                                  * w: 1-clear port suspend (start resume
    212                                  *      if suspened)
    213                                  *    0-nothing */
     226#define RHPS_POCI_FLAG (1 << 3) /* r: port over-current
     227                                                * (if reports are per-port
     228                                                * w: 1-clear port suspend
     229                                                *  (start resume if suspened)
     230                                                *    0-nothing */
    214231#define RHPS_CLEAR_PORT_SUSPEND RHPS_POCI_FLAG
    215232#define RHPS_PRS_FLAG (1 << 4) /* r: port reset status
    216                                 * w: 1-set port reset, 0-nothing */
     233                                               * w: 1-set port reset, 0-N/S */
    217234#define RHPS_SET_PORT_RESET RHPS_PRS_FLAG
    218235#define RHPS_PPS_FLAG (1 << 8) /* r: port power status
    219                                 * w: 1-set port power, 0-nothing */
     236                                              * w: 1-set port power, 0-N/S */
    220237#define RHPS_SET_PORT_POWER RHPS_PPS_FLAG
    221238#define RHPS_LSDA_FLAG (1 << 9) /* r: low speed device attached
    222                                  * w: 1-clear port power, 0-nothing */
     239                                                * w: 1-clear port power, 0-N/S*/
    223240#define RHPS_CLEAR_PORT_POWER RHPS_LSDA_FLAG
    224 #define RHPS_CSC_FLAG  (1 << 16) /* connect status change Write-Clean */
     241#define RHPS_CSC_FLAG  (1 << 16) /* connect status change WC */
    225242#define RHPS_PESC_FLAG (1 << 17) /* port enable status change WC */
    226243#define RHPS_PSSC_FLAG (1 << 18) /* port suspend status change WC */
    227244#define RHPS_OCIC_FLAG (1 << 19) /* port over-current change WC */
    228245#define RHPS_PRSC_FLAG (1 << 20) /* port reset status change WC */
    229 #define RHPS_CHANGE_WC_MASK 0x1f0000
     246#define RHPS_CHANGE_WC_MASK (0x1f0000)
    230247} __attribute__((packed)) ohci_regs_t;
    231248#endif
Note: See TracChangeset for help on using the changeset viewer.