Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Staging/cxt1e1/comet.c:Modifying comment style and intentation

This patch modifies the commenting style by placing comments above the
line of code commented upone.

Signed-off-by: Dulshani Gunawardhana <dulshani.gunawardhana89@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Dulshani Gunawardhana and committed by
Greg Kroah-Hartman
cd1ccce1 4a9fbb27

+333 -312
+333 -312
drivers/staging/cxt1e1/comet.c
··· 42 42 43 43 void *TWV_table[12] = { 44 44 TWVLongHaul0DB, TWVLongHaul7_5DB, TWVLongHaul15DB, TWVLongHaul22_5DB, 45 - TWVShortHaul0, TWVShortHaul1, TWVShortHaul2, TWVShortHaul3, TWVShortHaul4, 46 - TWVShortHaul5, 47 - TWV_E1_75Ohm, /** PORT POINT - 75 Ohm not supported **/ 45 + TWVShortHaul0, TWVShortHaul1, TWVShortHaul2, TWVShortHaul3, 46 + TWVShortHaul4, TWVShortHaul5, 47 + /** PORT POINT - 75 Ohm not supported **/ 48 + TWV_E1_75Ohm, 48 49 TWV_E1_120Ohm 49 50 }; 50 51 51 52 52 53 static int 53 - lbo_tbl_lkup(int t1, int lbo) 54 - { 55 - if ((lbo < CFG_LBO_LH0) || (lbo > CFG_LBO_E120)) /* error switches to 56 - * default */ 57 - { 54 + lbo_tbl_lkup(int t1, int lbo) { 55 + /* error switches to default */ 56 + if ((lbo < CFG_LBO_LH0) || (lbo > CFG_LBO_E120)) { 58 57 if (t1) 59 - lbo = CFG_LBO_LH0; /* default T1 waveform table */ 58 + /* default T1 waveform table */ 59 + lbo = CFG_LBO_LH0; 60 60 else 61 - lbo = CFG_LBO_E120; /* default E1 waveform table */ 61 + /* default E1 waveform table */ 62 + lbo = CFG_LBO_E120; 62 63 } 63 - return (lbo - 1); /* make index ZERO relative */ 64 + /* make index ZERO relative */ 65 + return (lbo - 1); 64 66 } 65 67 66 - 67 - void 68 - init_comet(void *ci, comet_t * comet, u_int32_t port_mode, int clockmaster, 69 - u_int8_t moreParams) 68 + void init_comet(void *ci, comet_t * comet, u_int32_t port_mode, int clockmaster, 69 + u_int8_t moreParams) 70 70 { 71 71 u_int8_t isT1mode; 72 - u_int8_t tix = CFG_LBO_LH0; /* T1 default */ 73 - 74 - isT1mode = IS_FRAME_ANY_T1 (port_mode); 75 - /* T1 or E1 */ 76 - if (isT1mode) 77 - { 78 - pci_write_32 ((u_int32_t *) &comet->gbl_cfg, 0xa0); /* Select T1 Mode & PIO 79 - * output enabled */ 80 - tix = lbo_tbl_lkup (isT1mode, CFG_LBO_LH0); /* default T1 waveform 81 - * table */ 82 - } else 83 - { 84 - pci_write_32((u_int32_t *) &comet->gbl_cfg, 0x81); /* Select E1 Mode & PIO 85 - * output enabled */ 86 - tix = lbo_tbl_lkup (isT1mode, CFG_LBO_E120); /* default E1 waveform 87 - * table */ 72 + /* T1 default */ 73 + u_int8_t tix = CFG_LBO_LH0; 74 + isT1mode = IS_FRAME_ANY_T1(port_mode); 75 + /* T1 or E1 */ 76 + if (isT1mode) { 77 + /* Select T1 Mode & PIO output enabled */ 78 + pci_write_32((u_int32_t *) &comet->gbl_cfg, 0xa0); 79 + /* default T1 waveform table */ 80 + tix = lbo_tbl_lkup(isT1mode, CFG_LBO_LH0); 81 + } else { 82 + /* Select E1 Mode & PIO output enabled */ 83 + pci_write_32((u_int32_t *) &comet->gbl_cfg, 0x81); 84 + /* default E1 waveform table */ 85 + tix = lbo_tbl_lkup(isT1mode, CFG_LBO_E120); 88 86 } 89 87 90 88 if (moreParams & CFG_LBO_MASK) 91 - tix = lbo_tbl_lkup (isT1mode, moreParams & CFG_LBO_MASK); /* dial-in requested 92 - * waveform table */ 93 - 94 - /* Tx line Intfc cfg ** Set for analog & no special patterns */ 95 - pci_write_32((u_int32_t *) &comet->tx_line_cfg, 0x00); /* Transmit Line 96 - * Interface Config. */ 97 - 98 - /* master test ** Ignore Test settings for now */ 99 - pci_write_32((u_int32_t *) &comet->mtest, 0x00); /* making sure it's 100 - * Default value */ 101 - 102 - /* Turn on Center (CENT) and everything else off */ 103 - pci_write_32((u_int32_t *) &comet->rjat_cfg, 0x10); /* RJAT cfg */ 104 - /* Set Jitter Attenuation to recommend T1 values */ 105 - if (isT1mode) 106 - { 107 - pci_write_32((u_int32_t *) &comet->rjat_n1clk, 0x2F); /* RJAT Divider N1 108 - * Control */ 109 - pci_write_32((u_int32_t *) &comet->rjat_n2clk, 0x2F); /* RJAT Divider N2 110 - * Control */ 111 - } else 112 - { 113 - pci_write_32((u_int32_t *) &comet->rjat_n1clk, 0xFF); /* RJAT Divider N1 114 - * Control */ 115 - pci_write_32((u_int32_t *) &comet->rjat_n2clk, 0xFF); /* RJAT Divider N2 116 - * Control */ 89 + /* dial-in requested waveform table */ 90 + tix = lbo_tbl_lkup(isT1mode, moreParams & CFG_LBO_MASK); 91 + /* Tx line Intfc cfg Set for analog & no special patterns */ 92 + /* Transmit Line Interface Config. */ 93 + pci_write_32((u_int32_t *) &comet->tx_line_cfg, 0x00); 94 + /* master test Ignore Test settings for now */ 95 + /* making sure it's Default value */ 96 + pci_write_32((u_int32_t *) &comet->mtest, 0x00); 97 + /* Turn on Center (CENT) and everything else off */ 98 + /* RJAT cfg */ 99 + pci_write_32((u_int32_t *) &comet->rjat_cfg, 0x10); 100 + /* Set Jitter Attenuation to recommend T1 values */ 101 + if (isT1mode) { 102 + /* RJAT Divider N1 Control */ 103 + pci_write_32((u_int32_t *) &comet->rjat_n1clk, 0x2F); 104 + /* RJAT Divider N2 Control */ 105 + pci_write_32((u_int32_t *) &comet->rjat_n2clk, 0x2F); 106 + } else { 107 + /* RJAT Divider N1 Control */ 108 + pci_write_32((u_int32_t *) &comet->rjat_n1clk, 0xFF); 109 + /* RJAT Divider N2 Control */ 110 + pci_write_32((u_int32_t *) &comet->rjat_n2clk, 0xFF); 117 111 } 118 112 119 - /* Turn on Center (CENT) and everything else off */ 120 - pci_write_32((u_int32_t *) &comet->tjat_cfg, 0x10); /* TJAT Config. */ 113 + /* Turn on Center (CENT) and everything else off */ 114 + /* TJAT Config. */ 115 + pci_write_32((u_int32_t *) &comet->tjat_cfg, 0x10); 121 116 122 - /* Do not bypass jitter attenuation and bypass elastic store */ 123 - pci_write_32((u_int32_t *) &comet->rx_opt, 0x00); /* rx opts */ 117 + /* Do not bypass jitter attenuation and bypass elastic store */ 118 + /* rx opts */ 119 + pci_write_32((u_int32_t *) &comet->rx_opt, 0x00); 124 120 125 - /* TJAT ctrl & TJAT divider ctrl */ 126 - /* Set Jitter Attenuation to recommended T1 values */ 127 - if (isT1mode) 128 - { 129 - pci_write_32((u_int32_t *) &comet->tjat_n1clk, 0x2F); /* TJAT Divider N1 130 - * Control */ 131 - pci_write_32((u_int32_t *) &comet->tjat_n2clk, 0x2F); /* TJAT Divider N2 132 - * Control */ 133 - } else 134 - { 135 - pci_write_32((u_int32_t *) &comet->tjat_n1clk, 0xFF); /* TJAT Divider N1 136 - * Control */ 137 - pci_write_32((u_int32_t *) &comet->tjat_n2clk, 0xFF); /* TJAT Divider N2 138 - * Control */ 121 + /* TJAT ctrl & TJAT divider ctrl */ 122 + /* Set Jitter Attenuation to recommended T1 values */ 123 + if (isT1mode) { 124 + /* TJAT Divider N1 Control */ 125 + pci_write_32((u_int32_t *) &comet->tjat_n1clk, 0x2F); 126 + /* TJAT Divider N2 Control */ 127 + pci_write_32((u_int32_t *) &comet->tjat_n2clk, 0x2F); 128 + } else { 129 + /* TJAT Divider N1 Control */ 130 + pci_write_32((u_int32_t *) &comet->tjat_n1clk, 0xFF); 131 + /* TJAT Divider N2 Control */ 132 + pci_write_32((u_int32_t *) &comet->tjat_n2clk, 0xFF); 139 133 } 140 134 141 - /* 1c: rx ELST cfg 20: tx ELST cfg 28&38: rx&tx data link ctrl */ 142 - if (isT1mode) 143 - { /* Select 193-bit frame format */ 135 + /* 1c: rx ELST cfg 20: tx ELST cfg 28&38: rx&tx data link ctrl */ 136 + 137 + /* Select 193-bit frame format */ 138 + if (isT1mode) { 144 139 pci_write_32((u_int32_t *) &comet->rx_elst_cfg, 0x00); 145 140 pci_write_32((u_int32_t *) &comet->tx_elst_cfg, 0x00); 146 - } else 147 - { /* Select 256-bit frame format */ 141 + } else { 142 + /* Select 256-bit frame format */ 148 143 pci_write_32((u_int32_t *) &comet->rx_elst_cfg, 0x03); 149 144 pci_write_32((u_int32_t *) &comet->tx_elst_cfg, 0x03); 150 - pci_write_32((u_int32_t *) &comet->rxce1_ctl, 0x00); /* disable T1 data link 151 - * receive */ 152 - pci_write_32((u_int32_t *) &comet->txci1_ctl, 0x00); /* disable T1 data link 153 - * transmit */ 145 + /* disable T1 data link receive */ 146 + pci_write_32((u_int32_t *) &comet->rxce1_ctl, 0x00); 147 + /* disable T1 data link transmit */ 148 + pci_write_32((u_int32_t *) &comet->txci1_ctl, 0x00); 154 149 } 155 150 156 151 /* the following is a default value */ 157 152 /* Enable 8 out of 10 validation */ 158 - pci_write_32((u_int32_t *) &comet->t1_rboc_ena, 0x00); /* t1RBOC 159 - * enable(BOC:BitOriented 160 - * Code) */ 153 + /* t1RBOC enable(BOC:BitOriented Code) */ 154 + pci_write_32((u_int32_t *) &comet->t1_rboc_ena, 0x00); 161 155 if (isT1mode) 162 156 { 163 157 164 - /* IBCD cfg: aka Inband Code Detection ** loopback code length set to */ 165 - pci_write_32((u_int32_t *) &comet->ibcd_cfg, 0x04); /* 6 bit down, 5 bit up 166 - * (assert) */ 167 - pci_write_32((u_int32_t *) &comet->ibcd_act, 0x08); /* line loopback 168 - * activate pattern */ 169 - pci_write_32((u_int32_t *) &comet->ibcd_deact, 0x24); /* deactivate code 170 - * pattern (i.e.001) */ 158 + /* IBCD cfg: aka Inband Code Detection ** loopback code length set to */ 159 + /* 6 bit down, 5 bit up (assert) */ 160 + pci_write_32((u_int32_t *) &comet->ibcd_cfg, 0x04); 161 + /* line loopback activate pattern */ 162 + pci_write_32((u_int32_t *) &comet->ibcd_act, 0x08); 163 + /* deactivate code pattern (i.e.001) */ 164 + pci_write_32((u_int32_t *) &comet->ibcd_deact, 0x24); 171 165 } 172 166 /* 10: CDRC cfg 28&38: rx&tx data link 1 ctrl 48: t1 frmr cfg */ 173 167 /* 50: SIGX cfg, COSS (change of signaling state) 54: XBAS cfg */ ··· 170 176 171 177 switch (port_mode) 172 178 { 173 - case CFG_FRAME_SF: /* 1 - T1 B8ZS */ 174 - pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0); 175 - pci_write_32((u_int32_t *) &comet->t1_frmr_cfg, 0); 176 - pci_write_32((u_int32_t *) &comet->sigx_cfg, 0); 177 - pci_write_32((u_int32_t *) &comet->t1_xbas_cfg, 0x20); /* 5:B8ZS */ 178 - pci_write_32((u_int32_t *) &comet->t1_almi_cfg, 0); 179 - break; 180 - case CFG_FRAME_ESF: /* 2 - T1 B8ZS */ 181 - pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0); 182 - pci_write_32((u_int32_t *) &comet->rxce1_ctl, 0x20); /* Bit 5: T1 DataLink 183 - * Enable */ 184 - pci_write_32((u_int32_t *) &comet->txci1_ctl, 0x20); /* 5: T1 DataLink Enable */ 185 - pci_write_32((u_int32_t *) &comet->t1_frmr_cfg, 0x30); /* 4:ESF 5:ESFFA */ 186 - pci_write_32((u_int32_t *) &comet->sigx_cfg, 0x04); /* 2:ESF */ 187 - pci_write_32((u_int32_t *) &comet->t1_xbas_cfg, 0x30); /* 4:ESF 5:B8ZS */ 188 - pci_write_32((u_int32_t *) &comet->t1_almi_cfg, 0x10); /* 4:ESF */ 189 - break; 190 - case CFG_FRAME_E1PLAIN: /* 3 - HDB3 */ 191 - pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0); 192 - pci_write_32((u_int32_t *) &comet->sigx_cfg, 0); 193 - pci_write_32((u_int32_t *) &comet->e1_tran_cfg, 0); 194 - pci_write_32((u_int32_t *) &comet->e1_frmr_aopts, 0x40); 195 - break; 196 - case CFG_FRAME_E1CAS: /* 4 - HDB3 */ 197 - pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0); 198 - pci_write_32((u_int32_t *) &comet->sigx_cfg, 0); 199 - pci_write_32((u_int32_t *) &comet->e1_tran_cfg, 0x60); 200 - pci_write_32((u_int32_t *) &comet->e1_frmr_aopts, 0); 201 - break; 202 - case CFG_FRAME_E1CRC: /* 5 - HDB3 */ 203 - pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0); 204 - pci_write_32((u_int32_t *) &comet->sigx_cfg, 0); 205 - pci_write_32((u_int32_t *) &comet->e1_tran_cfg, 0x10); 206 - pci_write_32((u_int32_t *) &comet->e1_frmr_aopts, 0xc2); 207 - break; 208 - case CFG_FRAME_E1CRC_CAS: /* 6 - HDB3 */ 209 - pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0); 210 - pci_write_32((u_int32_t *) &comet->sigx_cfg, 0); 211 - pci_write_32((u_int32_t *) &comet->e1_tran_cfg, 0x70); 212 - pci_write_32((u_int32_t *) &comet->e1_frmr_aopts, 0x82); 213 - break; 214 - case CFG_FRAME_SF_AMI: /* 7 - T1 AMI */ 215 - pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0x80); /* Enable AMI Line 216 - * Decoding */ 217 - pci_write_32((u_int32_t *) &comet->t1_frmr_cfg, 0); 218 - pci_write_32((u_int32_t *) &comet->t1_xbas_cfg, 0); 219 - pci_write_32((u_int32_t *) &comet->t1_almi_cfg, 0); 220 - pci_write_32((u_int32_t *) &comet->sigx_cfg, 0); 221 - break; 222 - case CFG_FRAME_ESF_AMI: /* 8 - T1 AMI */ 223 - pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0x80); /* Enable AMI Line 224 - * Decoding */ 225 - pci_write_32((u_int32_t *) &comet->rxce1_ctl, 0x20); /* 5: T1 DataLink Enable */ 226 - pci_write_32((u_int32_t *) &comet->txci1_ctl, 0x20); /* 5: T1 DataLink Enable */ 227 - pci_write_32((u_int32_t *) &comet->t1_frmr_cfg, 0x30); /* Bit 4:ESF 5:ESFFA */ 228 - pci_write_32((u_int32_t *) &comet->sigx_cfg, 0x04); /* 2:ESF */ 229 - pci_write_32((u_int32_t *) &comet->t1_xbas_cfg, 0x10); /* 4:ESF */ 230 - pci_write_32((u_int32_t *) &comet->t1_almi_cfg, 0x10); /* 4:ESF */ 231 - break; 232 - case CFG_FRAME_E1PLAIN_AMI: /* 9 - AMI */ 233 - pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0x80); /* Enable AMI Line 234 - * Decoding */ 235 - pci_write_32((u_int32_t *) &comet->sigx_cfg, 0); 236 - pci_write_32((u_int32_t *) &comet->e1_tran_cfg, 0x80); 237 - pci_write_32((u_int32_t *) &comet->e1_frmr_aopts, 0x40); 238 - break; 239 - case CFG_FRAME_E1CAS_AMI: /* 10 - AMI */ 240 - pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0x80); /* Enable AMI Line 241 - * Decoding */ 242 - pci_write_32((u_int32_t *) &comet->sigx_cfg, 0); 243 - pci_write_32((u_int32_t *) &comet->e1_tran_cfg, 0xe0); 244 - pci_write_32((u_int32_t *) &comet->e1_frmr_aopts, 0); 245 - break; 246 - case CFG_FRAME_E1CRC_AMI: /* 11 - AMI */ 247 - pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0x80); /* Enable AMI Line 248 - * Decoding */ 249 - pci_write_32((u_int32_t *) &comet->sigx_cfg, 0); 250 - pci_write_32((u_int32_t *) &comet->e1_tran_cfg, 0x90); 251 - pci_write_32((u_int32_t *) &comet->e1_frmr_aopts, 0xc2); 252 - break; 253 - case CFG_FRAME_E1CRC_CAS_AMI: /* 12 - AMI */ 254 - pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0x80); /* Enable AMI Line 255 - * Decoding */ 179 + /* 1 - T1 B8ZS */ 180 + case CFG_FRAME_SF: 181 + pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0); 182 + pci_write_32((u_int32_t *) &comet->t1_frmr_cfg, 0); 256 183 pci_write_32((u_int32_t *) &comet->sigx_cfg, 0); 257 - pci_write_32((u_int32_t *) &comet->e1_tran_cfg, 0xf0); 258 - pci_write_32((u_int32_t *) &comet->e1_frmr_aopts, 0x82); 259 - break; 260 - } /* end switch */ 184 + /* 5:B8ZS */ 185 + pci_write_32((u_int32_t *) &comet->t1_xbas_cfg, 0x20); 186 + pci_write_32((u_int32_t *) &comet->t1_almi_cfg, 0); 187 + break; 188 + /* 2 - T1 B8ZS */ 189 + case CFG_FRAME_ESF: 190 + pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0); 191 + /* Bit 5: T1 DataLink Enable */ 192 + pci_write_32((u_int32_t *) &comet->rxce1_ctl, 0x20); 193 + /* 5: T1 DataLink Enable */ 194 + pci_write_32((u_int32_t *) &comet->txci1_ctl, 0x20); 195 + /* 4:ESF 5:ESFFA */ 196 + pci_write_32((u_int32_t *) &comet->t1_frmr_cfg, 0x30); 197 + /* 2:ESF */ 198 + pci_write_32((u_int32_t *) &comet->sigx_cfg, 0x04); 199 + /* 4:ESF 5:B8ZS */ 200 + pci_write_32((u_int32_t *) &comet->t1_xbas_cfg, 0x30); 201 + /* 4:ESF */ 202 + pci_write_32((u_int32_t *) &comet->t1_almi_cfg, 0x10); 203 + break; 204 + /* 3 - HDB3 */ 205 + case CFG_FRAME_E1PLAIN: 206 + pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0); 207 + pci_write_32((u_int32_t *) &comet->sigx_cfg, 0); 208 + pci_write_32((u_int32_t *) &comet->e1_tran_cfg, 0); 209 + pci_write_32((u_int32_t *) &comet->e1_frmr_aopts, 0x40); 210 + break; 211 + /* 4 - HDB3 */ 212 + case CFG_FRAME_E1CAS: 213 + pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0); 214 + pci_write_32((u_int32_t *) &comet->sigx_cfg, 0); 215 + pci_write_32((u_int32_t *) &comet->e1_tran_cfg, 0x60); 216 + pci_write_32((u_int32_t *) &comet->e1_frmr_aopts, 0); 217 + break; 218 + /* 5 - HDB3 */ 219 + case CFG_FRAME_E1CRC: 220 + pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0); 221 + pci_write_32((u_int32_t *) &comet->sigx_cfg, 0); 222 + pci_write_32((u_int32_t *) &comet->e1_tran_cfg, 0x10); 223 + pci_write_32((u_int32_t *) &comet->e1_frmr_aopts, 0xc2); 224 + break; 225 + /* 6 - HDB3 */ 226 + case CFG_FRAME_E1CRC_CAS: 227 + pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0); 228 + pci_write_32((u_int32_t *) &comet->sigx_cfg, 0); 229 + pci_write_32((u_int32_t *) &comet->e1_tran_cfg, 0x70); 230 + pci_write_32((u_int32_t *) &comet->e1_frmr_aopts, 0x82); 231 + break; 232 + /* 7 - T1 AMI */ 233 + case CFG_FRAME_SF_AMI: 234 + /* Enable AMI Line Decoding */ 235 + pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0x80); 236 + pci_write_32((u_int32_t *) &comet->t1_frmr_cfg, 0); 237 + pci_write_32((u_int32_t *) &comet->t1_xbas_cfg, 0); 238 + pci_write_32((u_int32_t *) &comet->t1_almi_cfg, 0); 239 + pci_write_32((u_int32_t *) &comet->sigx_cfg, 0); 240 + break; 241 + /* 8 - T1 AMI */ 242 + case CFG_FRAME_ESF_AMI: 243 + /* Enable AMI Line Decoding */ 244 + pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0x80); 245 + /* 5: T1 DataLink Enable */ 246 + pci_write_32((u_int32_t *) &comet->rxce1_ctl, 0x20); 247 + /* 5: T1 DataLink Enable */ 248 + pci_write_32((u_int32_t *) &comet->txci1_ctl, 0x20); 249 + /* Bit 4:ESF 5:ESFFA */ 250 + pci_write_32((u_int32_t *) &comet->t1_frmr_cfg, 0x30); 251 + /* 2:ESF */ 252 + pci_write_32((u_int32_t *) &comet->sigx_cfg, 0x04); 253 + /* 4:ESF */ 254 + pci_write_32((u_int32_t *) &comet->t1_xbas_cfg, 0x10); 255 + /* 4:ESF */ 256 + pci_write_32((u_int32_t *) &comet->t1_almi_cfg, 0x10); 257 + break; 258 + /* 9 - AMI */ 259 + case CFG_FRAME_E1PLAIN_AMI: 260 + /* Enable AMI Line Decoding */ 261 + pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0x80); 262 + pci_write_32((u_int32_t *) &comet->sigx_cfg, 0); 263 + pci_write_32((u_int32_t *) &comet->e1_tran_cfg, 0x80); 264 + pci_write_32((u_int32_t *) &comet->e1_frmr_aopts, 0x40); 265 + break; 266 + /* 10 - AMI */ 267 + case CFG_FRAME_E1CAS_AMI: 268 + /* Enable AMI Line Decoding */ 269 + pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0x80); 270 + pci_write_32((u_int32_t *) &comet->sigx_cfg, 0); 271 + pci_write_32((u_int32_t *) &comet->e1_tran_cfg, 0xe0); 272 + pci_write_32((u_int32_t *) &comet->e1_frmr_aopts, 0); 273 + break; 274 + /* 11 - AMI */ 275 + case CFG_FRAME_E1CRC_AMI: 276 + /* Enable AMI Line Decoding */ 277 + pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0x80); 278 + pci_write_32((u_int32_t *) &comet->sigx_cfg, 0); 279 + pci_write_32((u_int32_t *) &comet->e1_tran_cfg, 0x90); 280 + pci_write_32((u_int32_t *) &comet->e1_frmr_aopts, 0xc2); 281 + break; 282 + /* 12 - AMI */ 283 + case CFG_FRAME_E1CRC_CAS_AMI: 284 + /* Enable AMI Line Decoding */ 285 + pci_write_32((u_int32_t *) &comet->cdrc_cfg, 0x80); 286 + pci_write_32((u_int32_t *) &comet->sigx_cfg, 0); 287 + pci_write_32((u_int32_t *) &comet->e1_tran_cfg, 0xf0); 288 + pci_write_32((u_int32_t *) &comet->e1_frmr_aopts, 0x82); 289 + break; 290 + } /* end switch */ 261 291 262 292 /*** 263 293 * Set Full Frame mode (NXDSO[1] = 0, NXDSO[0] = 0) ··· 296 278 /* 0x30: "BRIF cfg"; 0x20 is 'CMODE', 0x03 is (bit) rate */ 297 279 /* note "rate bits can only be set once after reset" */ 298 280 if (clockmaster) 299 - { /* CMODE == clockMode, 0=clock master (so 300 - * all 3 others should be slave) */ 301 - if (isT1mode) /* rate = 1.544 Mb/s */ 302 - pci_write_32((u_int32_t *) &comet->brif_cfg, 0x00); /* Comet 0 Master 303 - * Mode(CMODE=0) */ 304 - else /* rate = 2.048 Mb/s */ 305 - pci_write_32((u_int32_t *) &comet->brif_cfg, 0x01); /* Comet 0 Master 306 - * Mode(CMODE=0) */ 307 - 308 - /* 31: BRIF frame pulse cfg 06: tx timing options */ 309 - pci_write_32((u_int32_t *) &comet->brif_fpcfg, 0x00); /* Master Mode 310 - * i.e.FPMODE=0 (@0x20) */ 311 - if ((moreParams & CFG_CLK_PORT_MASK) == CFG_CLK_PORT_INTERNAL) 312 281 { 282 + /* CMODE == clockMode, 0=clock master (so all 3 others should be slave) */ 283 + /* rate = 1.544 Mb/s */ 284 + if (isT1mode) 285 + /* Comet 0 Master Mode(CMODE=0) */ 286 + pci_write_32((u_int32_t *) &comet->brif_cfg, 0x00); 287 + /* rate = 2.048 Mb/s */ 288 + else 289 + /* Comet 0 Master Mode(CMODE=0) */ 290 + pci_write_32((u_int32_t *) &comet->brif_cfg, 0x01); 291 + 292 + /* 31: BRIF frame pulse cfg 06: tx timing options */ 293 + 294 + /* Master Mode i.e.FPMODE=0 (@0x20) */ 295 + pci_write_32((u_int32_t *) &comet->brif_fpcfg, 0x00); 296 + if ((moreParams & CFG_CLK_PORT_MASK) == CFG_CLK_PORT_INTERNAL) 297 + { 313 298 if (cxt1e1_log_level >= LOG_SBEBUG12) 314 299 pr_info(">> %s: clockmaster internal clock\n", __func__); 315 - pci_write_32((u_int32_t *) &comet->tx_time, 0x0d); /* internal oscillator */ 316 - } else /* external clock source */ 317 - { 300 + /* internal oscillator */ 301 + pci_write_32((u_int32_t *) &comet->tx_time, 0x0d); 302 + } else { 303 + /* external clock source */ 318 304 if (cxt1e1_log_level >= LOG_SBEBUG12) 319 305 pr_info(">> %s: clockmaster external clock\n", __func__); 320 - pci_write_32((u_int32_t *) &comet->tx_time, 0x09); /* loop timing 321 - * (external) */ 306 + /* loop timing(external) */ 307 + pci_write_32((u_int32_t *) &comet->tx_time, 0x09); 322 308 } 323 309 324 - } else /* slave */ 325 - { 310 + } else { 311 + /* slave */ 326 312 if (isT1mode) 327 - pci_write_32((u_int32_t *) &comet->brif_cfg, 0x20); /* Slave Mode(CMODE=1, 328 - * see above) */ 313 + /* Slave Mode(CMODE=1, see above) */ 314 + pci_write_32((u_int32_t *) &comet->brif_cfg, 0x20); 329 315 else 330 - pci_write_32((u_int32_t *) &comet->brif_cfg, 0x21); /* Slave Mode (CMODE=1) */ 331 - pci_write_32((u_int32_t *) &comet->brif_fpcfg, 0x20); /* Slave Mode i.e. 332 - * FPMODE=1 (@0x20) */ 333 - if (cxt1e1_log_level >= LOG_SBEBUG12) 334 - pr_info(">> %s: clockslave internal clock\n", __func__); 335 - pci_write_32((u_int32_t *) &comet->tx_time, 0x0d); /* oscillator timing */ 316 + /* Slave Mode(CMODE=1)*/ 317 + pci_write_32((u_int32_t *) &comet->brif_cfg, 0x21); 318 + /* Slave Mode i.e. FPMODE=1 (@0x20) */ 319 + pci_write_32((u_int32_t *) &comet->brif_fpcfg, 0x20); 320 + if (cxt1e1_log_level >= LOG_SBEBUG12) 321 + pr_info(">> %s: clockslave internal clock\n", __func__); 322 + /* oscillator timing */ 323 + pci_write_32((u_int32_t *) &comet->tx_time, 0x0d); 336 324 } 337 325 338 - /* 32: BRIF parity F-bit cfg */ 339 - /* Totem-pole operation */ 340 - pci_write_32((u_int32_t *) &comet->brif_pfcfg, 0x01); /* Receive Backplane 341 - * Parity/F-bit */ 326 + /* 32: BRIF parity F-bit cfg */ 327 + /* Totem-pole operation */ 328 + /* Receive Backplane Parity/F-bit */ 329 + pci_write_32((u_int32_t *) &comet->brif_pfcfg, 0x01); 342 330 343 331 /* dc: RLPS equalizer V ref */ 344 332 /* Configuration */ 345 333 if (isT1mode) 346 - pci_write_32((u_int32_t *) &comet->rlps_eqvr, 0x2c); /* RLPS Equalizer 347 - * Voltage */ 334 + /* RLPS Equalizer Voltage */ 335 + pci_write_32((u_int32_t *) &comet->rlps_eqvr, 0x2c); 348 336 else 349 - pci_write_32((u_int32_t *) &comet->rlps_eqvr, 0x34); /* RLPS Equalizer 350 - * Voltage */ 337 + /* RLPS Equalizer Voltage */ 338 + pci_write_32((u_int32_t *) &comet->rlps_eqvr, 0x34); 351 339 352 340 /* Reserved bit set and SQUELCH enabled */ 353 341 /* f8: RLPS cfg & status f9: RLPS ALOS detect/clear threshold */ 354 - pci_write_32((u_int32_t *) &comet->rlps_cfgsts, 0x11); /* RLPS Configuration 355 - * Status */ 342 + /* RLPS Configuration Status */ 343 + pci_write_32((u_int32_t *) &comet->rlps_cfgsts, 0x11); 356 344 if (isT1mode) 357 - pci_write_32((u_int32_t *) &comet->rlps_alos_thresh, 0x55); /* ? */ 345 + /* ? */ 346 + pci_write_32((u_int32_t *) &comet->rlps_alos_thresh, 0x55); 358 347 else 359 - pci_write_32((u_int32_t *) &comet->rlps_alos_thresh, 0x22); /* ? */ 348 + /* ? */ 349 + pci_write_32((u_int32_t *) &comet->rlps_alos_thresh, 0x22); 360 350 361 351 362 352 /* Set Full Frame mode (NXDSO[1] = 0, NXDSO[0] = 0) */ 363 353 /* CMODE=0: Clock slave mode with BTCLK as an input, DE=1: Use rising */ 364 354 /* edge of BTCLK for data, FE=1: Use rising edge of BTCLK for frame, */ 365 355 /* CMS=0: Use backplane freq, RATE[1:0]=0,0: T1 */ 366 - /*** Transmit side is always an Input, Slave Clock*/ 367 - /* 40: BTIF cfg 41: BTIF frame pulse cfg */ 356 + /*** Transmit side is always an Input, Slave Clock*/ 357 + /* 40: BTIF cfg 41: loop timing(external) */ 358 + /*BTIF frame pulse cfg */ 368 359 if (isT1mode) 369 - pci_write_32((u_int32_t *) &comet->btif_cfg, 0x38); /* BTIF Configuration 370 - * Reg. */ 360 + /* BTIF Configuration Reg. */ 361 + pci_write_32((u_int32_t *) &comet->btif_cfg, 0x38); 371 362 else 372 - pci_write_32((u_int32_t *) &comet->btif_cfg, 0x39); /* BTIF Configuration 373 - * Reg. */ 374 - 375 - pci_write_32((u_int32_t *) &comet->btif_fpcfg, 0x01); /* BTIF Frame Pulse 376 - * Config. */ 363 + /* BTIF Configuration Reg. */ 364 + pci_write_32((u_int32_t *) &comet->btif_cfg, 0x39); 365 + /* BTIF Frame Pulse Config. */ 366 + pci_write_32((u_int32_t *) &comet->btif_fpcfg, 0x01); 377 367 378 368 /* 0a: master diag 06: tx timing options */ 379 369 /* if set Comet to loop back */ ··· 393 367 /* Store is enabled. */ 394 368 395 369 WrtXmtWaveformTbl(ci, comet, TWV_table[tix]); 396 - if (isT1mode) 397 - WrtRcvEqualizerTbl((ci_t *) ci, comet, &T1_Equalizer[0]); 398 - else 399 - WrtRcvEqualizerTbl((ci_t *) ci, comet, &E1_Equalizer[0]); 400 - SetPwrLevel (comet); 401 - } 370 + if (isT1mode) 371 + WrtRcvEqualizerTbl((ci_t *) ci, comet, &T1_Equalizer[0]); 372 + else 373 + WrtRcvEqualizerTbl((ci_t *) ci, comet, &E1_Equalizer[0]); 374 + SetPwrLevel(comet); 375 + } 402 376 403 377 /* 404 378 ** Name: WrtXmtWaveform ··· 410 384 STATIC void 411 385 WrtXmtWaveform(ci_t * ci, comet_t * comet, u_int32_t sample, u_int32_t unit, u_int8_t data) 412 386 { 413 - u_int8_t WaveformAddr; 387 + WaveformAddr; 414 388 415 389 WaveformAddr = (sample << 3) + (unit & 7); 416 390 pci_write_32((u_int32_t *) &comet->xlpg_pwave_addr, WaveformAddr); 417 - pci_flush_write (ci); /* for write order preservation when 418 - * Optimizing driver */ 391 + /* for write order preservation when Optimizing driver */ 392 + pci_flush_write(ci); 419 393 pci_write_32((u_int32_t *) &comet->xlpg_pwave_data, 0x7F & data); 420 394 } 421 395 ··· 427 401 */ 428 402 STATIC void 429 403 WrtXmtWaveformTbl(ci_t * ci, comet_t * comet, 430 - u_int8_t table[COMET_NUM_SAMPLES][COMET_NUM_UNITS]) 404 + u_int8_t table[COMET_NUM_SAMPLES][COMET_NUM_UNITS]) 431 405 { 432 406 u_int32_t sample, unit; 433 407 434 408 for (sample = 0; sample < COMET_NUM_SAMPLES; sample++) 435 - { 436 - for (unit = 0; unit < COMET_NUM_UNITS; unit++) 437 - WrtXmtWaveform(ci, comet, sample, unit, table[sample][unit]); 438 - } 409 + { 410 + for (unit = 0; unit < COMET_NUM_UNITS; unit++) 411 + WrtXmtWaveform(ci, comet, sample, unit, table[sample][unit]); 412 + } 439 413 440 414 /* Enable transmitter and set output amplitude */ 441 415 pci_write_32((u_int32_t *) &comet->xlpg_cfg, table[COMET_NUM_SAMPLES][0]); ··· 458 432 u_int32_t ramaddr; 459 433 volatile u_int32_t value; 460 434 461 - for (ramaddr = 0; ramaddr < 256; ramaddr++) 462 - { 463 - /*** the following lines are per Errata 7, 2.5 ***/ 464 - { 465 - pci_write_32((u_int32_t *) &comet->rlps_eq_rwsel, 0x80); /* Set up for a read 466 - * operation */ 467 - pci_flush_write(ci); /* for write order preservation when 468 - * Optimizing driver */ 469 - pci_write_32((u_int32_t *) &comet->rlps_eq_iaddr, (u_int8_t) ramaddr); /* write the addr, 470 - * initiate a read */ 471 - pci_flush_write (ci); /* for write order preservation when 472 - * Optimizing driver */ 473 - /* 474 - * wait 3 line rate clock cycles to ensure address bits are 475 - * captured by T1/E1 clock 476 - */ 477 - OS_uwait(4, "wret"); /* 683ns * 3 = 1366 ns, approx 2us (but 478 - * use 4us) */ 435 + for (ramaddr = 0; ramaddr < 256; ramaddr++) { 436 + /*** the following lines are per Errata 7, 2.5 ***/ 437 + { 438 + /* Set up for a read operation */ 439 + pci_write_32((u_int32_t *) &comet->rlps_eq_rwsel, 0x80); 440 + /* for write order preservation when Optimizing driver */ 441 + pci_flush_write(ci); 442 + /* write the addr, initiate a read */ 443 + pci_write_32((u_int32_t *) &comet->rlps_eq_iaddr, (u_int8_t) ramaddr); 444 + /* for write order preservation when Optimizing driver */ 445 + pci_flush_write(ci); 446 + /* 447 + * wait 3 line rate clock cycles to ensure address bits are 448 + * captured by T1/E1 clock 449 + */ 450 + 451 + /* 683ns * 3 = 1366 ns, approx 2us (but use 4us) */ 452 + OS_uwait(4, "wret"); 479 453 } 480 454 481 455 value = *table++; 482 - pci_write_32((u_int32_t *) &comet->rlps_idata3, (u_int8_t) (value >> 24)); 483 - pci_write_32((u_int32_t *) &comet->rlps_idata2, (u_int8_t) (value >> 16)); 484 - pci_write_32((u_int32_t *) &comet->rlps_idata1, (u_int8_t) (value >> 8)); 485 - pci_write_32((u_int32_t *) &comet->rlps_idata0, (u_int8_t) value); 486 - pci_flush_write(ci); /* for write order preservation when 487 - * Optimizing driver */ 456 + pci_write_32((u_int32_t *) &comet->rlps_idata3, (u_int8_t) (value >> 24)); 457 + pci_write_32((u_int32_t *) &comet->rlps_idata2, (u_int8_t) (value >> 16)); 458 + pci_write_32((u_int32_t *) &comet->rlps_idata1, (u_int8_t) (value >> 8)); 459 + pci_write_32((u_int32_t *) &comet->rlps_idata0, (u_int8_t) value); 460 + /* for write order preservation when Optimizing driver */ 461 + pci_flush_write(ci); 488 462 489 - /* Storing RAM address, causes RAM to be updated */ 463 + /* Storing RAM address, causes RAM to be updated */ 490 464 491 - pci_write_32((u_int32_t *) &comet->rlps_eq_rwsel, 0); /* Set up for a write 492 - * operation */ 493 - pci_flush_write(ci); /* for write order preservation when 494 - * Optimizing driver */ 495 - pci_write_32((u_int32_t *) &comet->rlps_eq_iaddr, (u_int8_t) ramaddr); /* write the addr, 496 - * initiate a read */ 497 - pci_flush_write(ci); /* for write order preservation when 498 - * Optimizing driver */ 499 - /* 500 - * wait 3 line rate clock cycles to ensure address bits are captured 501 - * by T1/E1 clock 502 - */ 503 - OS_uwait(4, "wret"); /* 683ns * 3 = 1366 ns, approx 2us (but 504 - * use 4us) */ 465 + /* Set up for a write operation */ 466 + pci_write_32((u_int32_t *) &comet->rlps_eq_rwsel, 0); 467 + /* for write order preservation when optimizing driver */ 468 + pci_flush_write(ci); 469 + /* write the addr, initiate a read */ 470 + pci_write_32((u_int32_t *) &comet->rlps_eq_iaddr, (u_int8_t) ramaddr); 471 + /* for write order preservation when optimizing driver */ 472 + pci_flush_write(ci); 473 + 474 + /* 475 + * wait 3 line rate clock cycles to ensure address bits are captured 476 + * by T1/E1 clock 477 + */ 478 + /* 683ns * 3 = 1366 ns, approx 2us (but use 4us) */ 479 + OS_uwait(4, "wret") 505 480 } 506 481 507 - pci_write_32((u_int32_t *) &comet->rlps_eq_cfg, 0xCB); /* Enable Equalizer & 508 - * set it to use 256 509 - * periods */ 482 + /* Enable Equalizer & set it to use 256 periods */ 483 + pci_write_32((u_int32_t *) &comet->rlps_eq_cfg, 0xCB); 510 484 } 511 485 512 486 ··· 533 507 ** Repeat these steps for register F5 534 508 ** Write 0x01 to register F6 535 509 */ 536 - pci_write_32((u_int32_t *) &comet->xlpg_fdata_sel, 0x00); /* XLPG Fuse Data Select */ 537 - 538 - pci_write_32((u_int32_t *) &comet->xlpg_atest_pctl, 0x01); /* XLPG Analog Test 539 - * Positive control */ 510 + /* XLPG Fuse Data Select */ 511 + pci_write_32((u_int32_t *) &comet->xlpg_fdata_sel, 0x00); 512 + /* XLPG Analog Test Positive control */ 540 513 pci_write_32((u_int32_t *) &comet->xlpg_atest_pctl, 0x01); 541 - 514 + pci_write_32((u_int32_t *) &comet->xlpg_atest_pctl, 0x01); 542 515 temp = pci_read_32((u_int32_t *) &comet->xlpg_atest_pctl) & 0xfe; 543 516 pci_write_32((u_int32_t *) &comet->xlpg_atest_pctl, temp); 544 - 545 - pci_write_32((u_int32_t *) &comet->xlpg_atest_nctl, 0x01); /* XLPG Analog Test 546 - * Negative control */ 547 517 pci_write_32((u_int32_t *) &comet->xlpg_atest_nctl, 0x01); 548 - 518 + pci_write_32((u_int32_t *) &comet->xlpg_atest_nctl, 0x01); 519 + /* XLPG Analog Test Negative control */ 549 520 temp = pci_read_32((u_int32_t *) &comet->xlpg_atest_nctl) & 0xfe; 550 521 pci_write_32((u_int32_t *) &comet->xlpg_atest_nctl, temp); 551 - pci_write_32((u_int32_t *) &comet->xlpg_fdata_sel, 0x01); /* XLPG */ 522 + /* XLPG */ 523 + pci_write_32((u_int32_t *) &comet->xlpg_fdata_sel, 0x01); 552 524 } 553 525 554 526 ··· 565 541 566 542 if (comet == mConfig.C4Func1Base + (COMET0_OFFSET >> 2)) 567 543 { 568 - rd_value = (u_int8_t) pci_read_32((u_int32_t *) &comet->brif_cfg); /* read the BRIF 569 - * Configuration */ 544 + /* read the BRIF Configuration */ 545 + rd_value = (u_int8_t) pci_read_32((u_int32_t *) &comet->brif_cfg); 570 546 rd_value &= ~0x20; 571 547 pci_write_32((u_int32_t *) &comet->brif_cfg, (u_int32_t) rd_value); 572 - 573 - rd_value = (u_int8_t) pci_read_32((u_int32_t *) &comet->brif_fpcfg); /* read the BRIF Frame 574 - * Pulse Configuration */ 548 + /* read the BRIF Frame Pulse Configuration */ 549 + rd_value = (u_int8_t) pci_read_32((u_int32_t *) &comet->brif_fpcfg); 575 550 rd_value &= ~0x20; 576 551 pci_write_32((u_int32_t *) &comet->brif_fpcfg, (u_int8_t) rd_value); 577 - } else 578 - { 579 - rd_value = (u_int8_t) pci_read_32((u_int32_t *) &comet->brif_cfg); /* read the BRIF 580 - * Configuration */ 581 - rd_value |= 0x20; 582 - pci_write_32((u_int32_t *) &comet->brif_cfg, (u_int32_t) rd_value); 583 - 584 - rd_value = (u_int8_t) pci_read_32((u_int32_t *) &comet->brif_fpcfg); /* read the BRIF Frame 585 - * Pulse Configuration */ 586 - rd_value |= 0x20; 587 - pci_write_32((u_int32_t *) &comet->brif_fpcfg, (u_int8_t) rd_value); 552 + } else { 553 + /* read the BRIF Configuration */ 554 + rd_value = (u_int8_t) pci_read_32((u_int32_t *) &comet->brif_cfg); 555 + rd_value |= 0x20; 556 + pci_write_32((u_int32_t *) &comet->brif_cfg, (u_int32_t) rd_value); 557 + /* read the BRIF Frame Pulse Configuration */ 558 + rd_value = (u_int8_t) pci_read_32((u_int32_t *) &comet->brif_fpcfg); 559 + rd_value |= 0x20; 560 + pci_write_32(u_int32_t *) & comet->brif_fpcfg, (u_int8_t) rd_value); 588 561 } 589 562 } 590 563 #endif