1 /* Generic Philips CL RC632 Routines
3 * (C) Harald Welte <laforge@gnumonks.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include <sys/types.h>
27 #include <rfid/rfid.h>
28 #include <rfid/rfid_asic.h>
29 #include <rfid/rfid_asic_rc632.h>
30 #include <rfid/rfid_reader_cm5121.h>
31 #include <rfid/rfid_layer2_iso14443a.h>
33 #include "rfid_iso14443_common.h"
35 //#include "rc632_14443a.h"
38 #define ENTER() DEBUGP("entering\n")
39 struct rfid_asic rc632;
41 /* Register and FIFO Access functions */
43 rc632_reg_write(struct rfid_asic_handle *handle,
47 return handle->rath->rat->priv.rc632.fn.reg_write(handle->rath, reg, val);
51 rc632_reg_read(struct rfid_asic_handle *handle,
55 return handle->rath->rat->priv.rc632.fn.reg_read(handle->rath, reg, val);
59 rc632_fifo_write(struct rfid_asic_handle *handle,
61 const unsigned char *buf,
64 return handle->rath->rat->priv.rc632.fn.fifo_write(handle->rath,
69 rc632_fifo_read(struct rfid_asic_handle *handle,
73 return handle->rath->rat->priv.rc632.fn.fifo_read(handle->rath, len, buf);
78 rc632_set_bits(struct rfid_asic_handle *handle,
85 ret = rc632_reg_read(handle, reg, &tmp);
89 /* if bits are already set, no need to set them again */
90 if ((tmp & val) == val)
93 return rc632_reg_write(handle, reg, (tmp|val)&0xff);
97 rc632_clear_bits(struct rfid_asic_handle *handle,
104 ret = rc632_reg_read(handle, reg, &tmp);
106 DEBUGP("error during reg_read(%p, %d):%d\n",
110 /* if bits are already cleared, no need to clear them again */
111 if ((tmp & val) == 0)
114 return rc632_reg_write(handle, reg, (tmp & ~val)&0xff);
120 rc632_turn_on_rf(struct rfid_asic_handle *handle)
123 return rc632_set_bits(handle, RC632_REG_TX_CONTROL, 0x03);
127 rc632_turn_off_rf(struct rfid_asic_handle *handle)
130 return rc632_clear_bits(handle, RC632_REG_TX_CONTROL, 0x03);
134 rc632_power_up(struct rfid_asic_handle *handle)
137 return rc632_clear_bits(handle, RC632_REG_CONTROL,
138 RC632_CONTROL_POWERDOWN);
142 rc632_power_down(struct rfid_asic_handle *handle)
144 return rc632_set_bits(handle, RC632_REG_CONTROL,
145 RC632_CONTROL_POWERDOWN);
148 /* Stupid RC623 implementations don't evaluate interrupts but poll the
149 * command register for "status idle" */
151 rc632_wait_idle(struct rfid_asic_handle *handle, unsigned int time)
153 unsigned char cmd = 0xff;
157 ret = rc632_reg_read(handle, RC632_REG_COMMAND, &cmd);
162 /* FIXME: read second time ?? */
168 rc632_reg_read(handle, RC632_REG_PRIMARY_STATUS, &foo);
170 rc632_reg_read(handle, RC632_REG_ERROR_FLAG, &foo);
175 /* Fixme: Abort after some timeout */
182 rc632_transmit(struct rfid_asic_handle *handle,
183 const unsigned char *buf,
185 unsigned int timeout)
189 ret = rc632_fifo_write(handle, len, buf, 0x03);
193 ret = rc632_reg_write(handle, RC632_REG_COMMAND, RC632_CMD_TRANSMIT);
197 return rc632_wait_idle(handle, timeout);
201 tcl_toggle_pcb(struct rfid_asic_handle *handle)
203 // FIXME: toggle something between 0x0a and 0x0b
208 rc632_transcieve(struct rfid_asic_handle *handle,
209 const unsigned char *tx_buf,
210 unsigned char tx_len,
211 unsigned char *rx_buf,
212 unsigned char *rx_len,
218 ret = rc632_fifo_write(handle, tx_len, tx_buf, 0x03);
222 ret = rc632_reg_write(handle, RC632_REG_COMMAND, RC632_CMD_TRANSCIEVE);
227 tcl_toggle_pcb(handle);
229 ret = rc632_wait_idle(handle, timer);
233 ret = rc632_reg_read(handle, RC632_REG_FIFO_LENGTH, rx_len);
240 DEBUGP("rx_len == 0\n");
242 rc632_reg_read(handle, RC632_REG_ERROR_FLAG, &tmp);
243 rc632_reg_read(handle, RC632_REG_CHANNEL_REDUNDANCY, &tmp);
248 return rc632_fifo_read(handle, *rx_len, rx_buf);
252 rc632_read_eeprom(struct rfid_asic_handle *handle)
254 unsigned char recvbuf[60];
255 unsigned char sndbuf[3];
262 ret = rc632_fifo_write(handle, 3, sndbuf, 0x03);
266 ret = rc632_reg_write(handle, RC632_REG_COMMAND, RC632_CMD_READ_E2);
272 ret = rc632_fifo_read(handle, sizeof(recvbuf), recvbuf);
276 // FIXME: do something with eeprom contents
281 rc632_calc_crc16_from(struct rfid_asic_handle *handle)
283 unsigned char sndbuf[2] = { 0x01, 0x02 };
284 unsigned char crc_lsb = 0x00 , crc_msb = 0x00;
287 ret = rc632_reg_write(handle, RC632_REG_CRC_PRESET_LSB, 0x12);
291 ret = rc632_reg_write(handle, RC632_REG_CRC_PRESET_MSB, 0xe0);
295 ret = rc632_fifo_write(handle, sizeof(sndbuf), sndbuf, 3);
299 ret = rc632_reg_write(handle, RC632_REG_COMMAND, RC632_CMD_CALC_CRC);
303 usleep(10000); // FIXME: no checking for cmd completion?
305 ret = rc632_reg_read(handle, RC632_REG_CRC_RESULT_LSB, &crc_lsb);
309 ret = rc632_reg_read(handle, RC632_REG_CRC_RESULT_MSB, &crc_msb);
313 // FIXME: what to do with crc result?
319 rc632_register_dump(struct rfid_asic_handle *handle, unsigned char *buf)
324 for (i = 0; i <= 0x3f; i++) {
325 ret = rc632_reg_read(handle, i, &buf[i]);
326 // do we want error checks?
333 /* generic FIFO access functions (if no more efficient ones provided by
334 * transport driver) */
339 // FIXME: implementation (not needed for CM 5121)
346 // FIXME: implementation (not neded for CM 5121)
351 rc632_init(struct rfid_asic_handle *ah)
355 /* switch off rf (make sure PICCs are reset at init time) */
356 ret = rc632_power_down(ah);
363 ret = rc632_power_up(ah);
367 /* disable register paging */
368 ret = rc632_reg_write(ah, 0x00, 0x00);
372 /* set some sane default values */
373 ret = rc632_reg_write(ah, 0x11, 0x5b);
378 ret = rc632_turn_on_rf(ah);
386 rc632_fini(struct rfid_asic_handle *ah)
391 ret = rc632_turn_off_rf(ah);
395 ret = rc632_power_down(ah);
402 struct rfid_asic_handle *
403 rc632_open(struct rfid_asic_transport_handle *th)
405 struct rfid_asic_handle *h;
407 h = malloc(sizeof(*h));
410 memset(h, 0, sizeof(*h));
415 h->mtu = h->mru = 40; /* FIXME */
417 if (rc632_init(h) < 0) {
426 rc632_close(struct rfid_asic_handle *h)
434 * Philips CL RC632 primitives for ISO 14443-A compliant PICC's
436 * (C) 2005 by Harald Welte <laforge@gnumonks.org>
441 rc632_iso14443a_init(struct rfid_asic_handle *handle)
445 // FIXME: some fifo work (drain fifo?)
447 /* flush fifo (our way) */
448 ret = rc632_reg_write(handle, RC632_REG_CONTROL, 0x01);
450 ret = rc632_reg_write(handle, RC632_REG_TX_CONTROL,
451 (RC632_TXCTRL_TX1_RF_EN |
452 RC632_TXCTRL_TX2_RF_EN |
453 RC632_TXCTRL_TX2_INV |
454 RC632_TXCTRL_FORCE_100_ASK |
455 RC632_TXCTRL_MOD_SRC_INT));
459 ret = rc632_reg_write(handle, RC632_REG_CW_CONDUCTANCE,
460 CM5121_CW_CONDUCTANCE);
464 ret = rc632_reg_write(handle, RC632_REG_MOD_CONDUCTANCE,
465 CM5121_MOD_CONDUCTANCE);
469 ret = rc632_reg_write(handle, RC632_REG_CODER_CONTROL,
470 (RC632_CDRCTRL_TXCD_14443A |
471 RC632_CDRCTRL_RATE_106K));
475 ret = rc632_reg_write(handle, RC632_REG_MOD_WIDTH, 0x13);
479 ret = rc632_reg_write(handle, RC632_REG_MOD_WIDTH_SOF, 0x3f);
483 ret = rc632_reg_write(handle, RC632_REG_TYPE_B_FRAMING, 0x00);
487 ret = rc632_reg_write(handle, RC632_REG_RX_CONTROL1,
488 (RC632_RXCTRL1_GAIN_35DB |
489 RC632_RXCTRL1_ISO14443 |
490 RC632_RXCTRL1_SUBCP_8));
494 ret = rc632_reg_write(handle, RC632_REG_DECODER_CONTROL,
495 (RC632_DECCTRL_MANCHESTER |
496 RC632_DECCTRL_RXFR_14443A));
500 ret = rc632_reg_write(handle, RC632_REG_BIT_PHASE,
501 CM5121_14443A_BITPHASE);
505 ret = rc632_reg_write(handle, RC632_REG_RX_THRESHOLD,
506 CM5121_14443A_THRESHOLD);
510 ret = rc632_reg_write(handle, RC632_REG_BPSK_DEM_CONTROL, 0x00);
514 ret = rc632_reg_write(handle, RC632_REG_RX_CONTROL2,
515 (RC632_RXCTRL2_DECSRC_INT |
516 RC632_RXCTRL2_CLK_Q));
520 ret = rc632_reg_write(handle, RC632_REG_RX_WAIT, 0x03);
524 ret = rc632_reg_write(handle, RC632_REG_CHANNEL_REDUNDANCY,
525 (RC632_CR_PARITY_ENABLE |
526 RC632_CR_PARITY_ODD));
530 ret = rc632_reg_write(handle, RC632_REG_CRC_PRESET_LSB, 0x63);
534 ret = rc632_reg_write(handle, RC632_REG_CRC_PRESET_MSB, 0x63);
542 rc632_iso14443a_fini(struct iso14443a_handle *handle_14443)
546 ret = rc632_turn_off_rf(handle);
556 /* issue a 14443-3 A PCD -> PICC command in a short frame, such as REQA, WUPA */
558 rc632_iso14443a_transcieve_sf(struct rfid_asic_handle *handle,
560 struct iso14443a_atqa *atqa)
563 unsigned char tx_buf[1];
564 unsigned char rx_len = 2;
566 memset(atqa, 0, sizeof(atqa));
570 /* transfer only 7 bits of last byte in frame */
571 ret = rc632_reg_write(handle, RC632_REG_BIT_FRAMING, 0x07);
576 ret = rc632_clear_bits(handle, RC632_REG_CONTROL,
577 RC632_CONTROL_CRYPTO1_ON);
582 ret = rc632_reg_write(handle, RC632_REG_CHANNEL_REDUNDANCY,
583 (RC632_CR_PARITY_ENABLE |
584 RC632_CR_PARITY_ODD));
586 ret = rc632_clear_bits(handle, RC632_REG_CHANNEL_REDUNDANCY,
587 RC632_CR_TX_CRC_ENABLE|RC632_CR_TX_CRC_ENABLE);
593 ret = rc632_transcieve(handle, tx_buf, sizeof(tx_buf),
594 (unsigned char *)atqa, &rx_len, 0x32, 0);
596 DEBUGP("error during rc632_transcieve()\n");
600 /* switch back to normal 8bit last byte */
601 ret = rc632_reg_write(handle, RC632_REG_BIT_FRAMING, 0x00);
606 DEBUGP("rx_len(%d) != 2\n", rx_len);
613 /* trasncieve regular frame */
615 rc632_iso14443a_transcieve(struct rfid_asic_handle *handle,
616 const unsigned char *tx_buf, unsigned int tx_len,
617 unsigned char *rx_buf, unsigned int *rx_len,
618 unsigned int timeout, unsigned int flags)
621 unsigned char rxl = *rx_len & 0xff;
623 memset(rx_buf, 0, *rx_len);
626 ret = rc632_reg_write(handle, RC632_REG_CHANNEL_REDUNDANCY,
627 (RC632_CR_PARITY_ENABLE |
628 RC632_CR_PARITY_ODD |
629 RC632_CR_TX_CRC_ENABLE |
630 RC632_CR_RX_CRC_ENABLE));
632 ret = rc632_set_bits(handle, RC632_REG_CHANNEL_REDUNDANCY,
633 RC632_CR_TX_CRC_ENABLE|RC632_CR_TX_CRC_ENABLE);
637 ret = rc632_transcieve(handle, tx_buf, tx_len, rx_buf, &rxl, 0x32, 0);
646 /* transcieve anti collission bitframe */
648 rc632_iso14443a_transcieve_acf(struct rfid_asic_handle *handle,
649 struct iso14443a_anticol_cmd *acf,
650 unsigned int *bit_of_col)
653 unsigned char rx_buf[64];
654 unsigned char rx_len = sizeof(rx_buf);
655 unsigned char rx_align = 0, tx_last_bits, tx_bytes;
657 unsigned char error_flag;
658 *bit_of_col = ISO14443A_BITOFCOL_NONE;
659 memset(rx_buf, 0, sizeof(rx_buf));
661 /* disable mifare cryto */
662 ret = rc632_clear_bits(handle, RC632_REG_CONTROL,
663 RC632_CONTROL_CRYPTO1_ON);
667 /* disable CRC summing */
669 ret = rc632_reg_write(handle, RC632_REG_CHANNEL_REDUNDANCY,
670 (RC632_CR_PARITY_ENABLE |
671 RC632_CR_PARITY_ODD));
673 ret = rc632_clear_bits(handle, RC632_REG_CHANNEL_REDUNDANCY,
674 RC632_CR_TX_CRC_ENABLE|RC632_CR_TX_CRC_ENABLE);
679 tx_last_bits = acf->nvb & 0x0f; /* lower nibble indicates bits */
680 tx_bytes = acf->nvb >> 4;
683 rx_align = (tx_last_bits+1) % 8;/* rx frame complements tx */
686 //rx_align = 8 - tx_last_bits;/* rx frame complements tx */
688 /* set RxAlign and TxLastBits*/
689 ret = rc632_reg_write(handle, RC632_REG_BIT_FRAMING,
690 (rx_align << 4) | (tx_last_bits));
694 ret = rc632_transcieve(handle, (unsigned char *)acf, tx_bytes,
695 rx_buf, &rx_len, 0x32, 0);
699 /* bitwise-OR the two halves of the split byte */
700 acf->uid_bits[tx_bytes-2] = (
701 (acf->uid_bits[tx_bytes-2] & (0xff >> (8-tx_last_bits)))
704 memcpy(&acf->uid_bits[tx_bytes+1-2], &rx_buf[1], rx_len-1);
706 /* determine whether there was a collission */
707 ret = rc632_reg_read(handle, RC632_REG_ERROR_FLAG, &error_flag);
711 if (error_flag & RC632_ERR_FLAG_COL_ERR) {
712 /* retrieve bit of collission */
713 ret = rc632_reg_read(handle, RC632_REG_COLL_POS, &boc);
717 /* bit of collission relative to start of part 1 of
718 * anticollision frame (!) */
719 *bit_of_col = 2*8 + boc;
725 static int rc632_iso14443b_init(struct rfid_asic_handle *handle)
729 // FIXME: some FIFO work
731 /* flush fifo (our way) */
732 ret = rc632_reg_write(handle, RC632_REG_CONTROL, 0x01);
736 ret = rc632_reg_write(handle, RC632_REG_TX_CONTROL,
737 (RC632_TXCTRL_TX1_RF_EN |
738 RC632_TXCTRL_TX2_RF_EN |
739 RC632_TXCTRL_TX2_INV |
740 RC632_TXCTRL_MOD_SRC_INT));
744 ret = rc632_reg_write(handle, RC632_REG_CW_CONDUCTANCE, 0x3f);
748 ret = rc632_reg_write(handle, RC632_REG_MOD_CONDUCTANCE, 0x04);
752 ret = rc632_reg_write(handle, RC632_REG_CODER_CONTROL,
753 (RC632_CDRCTRL_TXCD_NRZ |
754 RC632_CDRCTRL_RATE_14443B));
758 ret = rc632_reg_write(handle, RC632_REG_MOD_WIDTH, 0x13);
762 ret = rc632_reg_write(handle, RC632_REG_MOD_WIDTH_SOF, 0x3f);
766 ret = rc632_reg_write(handle, RC632_REG_TYPE_B_FRAMING,
767 (RC632_TBFRAMING_SOF_11L_3H |
768 (6 << RC632_TBFRAMING_SPACE_SHIFT) |
769 RC632_TBFRAMING_EOF_11));
773 ret = rc632_reg_write(handle, RC632_REG_RX_CONTROL1,
774 (RC632_RXCTRL1_GAIN_35DB |
775 RC632_RXCTRL1_ISO14443 |
776 RC632_RXCTRL1_SUBCP_8));
780 ret = rc632_reg_write(handle, RC632_REG_DECODER_CONTROL,
781 (RC632_DECCTRL_BPSK |
782 RC632_DECCTRL_RXFR_14443B));
786 ret = rc632_reg_write(handle, RC632_REG_BIT_PHASE,
787 CM5121_14443B_BITPHASE);
791 ret = rc632_reg_write(handle, RC632_REG_RX_THRESHOLD,
792 CM5121_14443B_THRESHOLD);
796 ret = rc632_reg_write(handle, RC632_REG_BPSK_DEM_CONTROL,
797 ((0x2 & RC632_BPSKD_TAUB_MASK)<<RC632_BPSKD_TAUB_SHIFT |
798 (0x3 & RC632_BPSKD_TAUD_MASK)<<RC632_BPSKD_TAUD_SHIFT |
799 RC632_BPSKD_FILTER_AMP_DETECT |
800 RC632_BPSKD_NO_RX_EOF |
801 RC632_BPSKD_NO_RX_EGT));
805 ret = rc632_reg_write(handle, RC632_REG_RX_CONTROL2,
806 (RC632_RXCTRL2_AUTO_PD |
807 RC632_RXCTRL2_DECSRC_INT));
811 ret = rc632_reg_write(handle, RC632_REG_RX_WAIT, 0x03);
815 ret = rc632_reg_write(handle, RC632_REG_CHANNEL_REDUNDANCY,
816 (RC632_CR_TX_CRC_ENABLE |
817 RC632_CR_RX_CRC_ENABLE |
822 ret = rc632_reg_write(handle, RC632_REG_CRC_PRESET_LSB, 0xff);
826 ret = rc632_reg_write(handle, RC632_REG_CRC_PRESET_MSB, 0xff);
834 rc632_iso15693_init(struct rfid_asic_handle *h)
838 ret = rc632_reg_write(h, RC632_REG_TX_CONTROL,
839 (RC632_TXCTRL_MOD_SRC_INT |
840 RC632_TXCTRL_TX2_INV |
841 RC632_TXCTRL_TX2_RF_EN |
842 RC632_TXCTRL_TX1_RF_EN));
846 ret = rc632_reg_write(h, RC632_REG_CW_CONDUCTANCE, 0x3f);
850 ret = rc632_reg_write(h, RC632_REG_MOD_CONDUCTANCE, 0x03);
854 ret = rc632_reg_write(h, RC632_REG_CODER_CONTROL,
855 (RC632_CDRCTRL_RATE_15693 |
860 ret = rc632_reg_write(h, RC632_REG_MOD_WIDTH, 0x3f);
864 ret = rc632_reg_write(h, RC632_REG_MOD_WIDTH_SOF, 0x3f);
868 ret = rc632_reg_write(h, RC632_REG_TYPE_B_FRAMING, 0x00);
872 ret = rc632_reg_write(h, RC632_REG_RX_CONTROL1,
873 (RC632_RXCTRL1_SUBCP_16 |
874 RC632_RXCTRL1_ISO15693 |
875 RC632_RXCTRL1_GAIN_35DB));
879 ret = rc632_reg_write(h, RC632_REG_DECODER_CONTROL,
880 (RC632_DECCTRL_RXFR_15693 |
881 RC632_DECCTRL_RX_INVERT));
885 ret = rc632_reg_write(h, RC632_REG_BIT_PHASE, 0xe0);
889 ret = rc632_reg_write(h, RC632_REG_RX_THRESHOLD, 0xff);
893 ret = rc632_reg_write(h, RC632_REG_BPSK_DEM_CONTROL, 0x00);
897 ret = rc632_reg_write(h, RC632_REG_RX_CONTROL2,
898 (RC632_RXCTRL2_AUTO_PD |
899 RC632_RXCTRL2_DECSRC_INT));
903 ret = rc632_reg_write(h, RC632_REG_CHANNEL_REDUNDANCY,
905 RC632_CR_RX_CRC_ENABLE |
906 RC632_CR_TX_CRC_ENABLE));
910 ret = rc632_reg_write(h, RC632_REG_CRC_PRESET_LSB, 0xff);
914 ret = rc632_reg_write(h, RC632_REG_CRC_PRESET_MSB, 0xff);
922 rc632_iso15693_icode_init(struct rfid_asic_handle *h)
926 ret = rc632_reg_write(h, RC632_REG_TX_CONTROL,
927 (RC632_TXCTRL_MOD_SRC_INT |
928 RC632_TXCTRL_TX2_INV |
929 RC632_TXCTRL_TX2_RF_EN |
930 RC632_TXCTRL_TX1_RF_EN));
934 ret = rc632_reg_write(h, RC632_REG_CW_CONDUCTANCE, 0x3f);
938 ret = rc632_reg_write(h, RC632_REG_MOD_CONDUCTANCE, 0x02);
942 ret = rc632_reg_write(h, RC632_REG_CODER_CONTROL, 0x2c);
946 ret = rc632_reg_write(h, RC632_REG_MOD_WIDTH, 0x3f);
950 ret = rc632_reg_write(h, RC632_REG_MOD_WIDTH_SOF, 0x3f);
954 ret = rc632_reg_write(h, RC632_REG_MOD_WIDTH_SOF, 0x3f);
958 ret = rc632_reg_write(h, RC632_REG_TYPE_B_FRAMING, 0x00);
962 ret = rc632_reg_write(h, RC632_REG_RX_CONTROL1, 0x8b); /* FIXME */
966 ret = rc632_reg_write(h, RC632_REG_DECODER_CONTROL, 0x00);
970 ret = rc632_reg_write(h, RC632_REG_BIT_PHASE, 0x52);
974 ret = rc632_reg_write(h, RC632_REG_RX_THRESHOLD, 0x66);
978 ret = rc632_reg_write(h, RC632_REG_BPSK_DEM_CONTROL, 0x00);
982 ret = rc632_reg_write(h, RC632_REG_RX_CONTROL2,
983 RC632_RXCTRL2_DECSRC_INT);
987 ret = rc632_reg_write(h, RC632_REG_CHANNEL_REDUNDANCY,
988 (RC632_CR_RX_CRC_ENABLE |
989 RC632_CR_TX_CRC_ENABLE));
990 ret = rc632_reg_write(h, RC632_REG_CRC_PRESET_LSB, 0xfe);
994 ret = rc632_reg_write(h, RC632_REG_CRC_PRESET_MSB, 0xff);
1002 rc632_iso15693_icl_init(struct rfid_asic_handle *h)
1008 ret = rc632_reg_write(h, RC632_REG_TX_CONTROL,
1009 (RC632_TXCTRL_MOD_SRC_INT |
1010 RC632_TXCTRL_TX2_INV |
1011 RC632_TXCTRL_TX2_RF_EN |
1012 RC632_TXCTRL_TX1_RF_EN));
1016 ret = rc632_reg_write(h, RC632_REG_CW_CONDUCTANCE, 0x3f);
1020 ret = rc632_reg_write(h, RC632_REG_MOD_CONDUCTANCE, 0x11);
1024 ret = rc632_reg_write(h, RC632_REG_CODER_CONTROL,
1025 (RC632_CDRCTRL_RATE_15693 |
1026 RC632_CDRCTRL_TXCD_ICODE_STD |
1031 ret = rc632_reg_write(h, RC632_REG_MOD_WIDTH, 0x3f);
1035 ret = rc632_reg_write(h, RC632_REG_MOD_WIDTH_SOF, 0x3f);
1038 ret = rc632_reg_write(h, RC632_REG_RX_CONTROL1,
1039 (RC632_RXCTRL1_SUBCP_16|
1040 RC632_RXCTRL1_ISO15693|
1041 RC632_RXCTRL1_GAIN_35DB));
1044 ret = rc632_reg_write(h, RC632_REG_DECODER_CONTROL,
1045 (RC632_DECCTRL_RX_INVERT|
1046 RC632_DECCTRL_RXFR_15693));
1050 ret = rc632_reg_write(h, RC632_REG_BIT_PHASE, 0xbd);
1054 ret = rc632_reg_write(h, RC632_REG_RX_THRESHOLD, 0xff);
1058 ret = rc632_reg_write(h, RC632_REG_BPSK_DEM_CONTROL, 0x00);
1062 ret = rc632_reg_write(h, RC632_REG_RX_CONTROL2,
1063 RC632_RXCTRL2_DECSRC_INT);
1067 ret = rc632_reg_write(h, RC632_REG_CHANNEL_REDUNDANCY, 0x00);
1071 ret = rc632_reg_write(h, RC632_REG_CRC_PRESET_LSB, 0x12);
1075 ret = rc632_reg_write(h, RC632_REG_CRC_PRESET_MSB, 0xe0);
1083 struct rfid_asic rc632 = {
1084 .name = "Philips CL RC632",
1085 .fc = ISO14443_FREQ_CARRIER,
1087 .fn.power_up = &rc632_power_up,
1088 .fn.power_down = &rc632_power_down,
1089 .fn.turn_on_rf = &rc632_turn_on_rf,
1090 .fn.turn_off_rf = &rc632_turn_off_rf,
1091 .fn.transcieve = &rc632_iso14443a_transcieve,
1093 .init = &rc632_iso14443a_init,
1094 .transcieve_sf = &rc632_iso14443a_transcieve_sf,
1095 .transcieve_acf = &rc632_iso14443a_transcieve_acf,
1098 .init = &rc632_iso14443b_init,
1101 .init = &rc632_iso15693_init,