Lines Matching refs:tp
723 static void rtl_clear_bp(struct r8152 *tp) in rtl_clear_bp() argument
725 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_0, 0); in rtl_clear_bp()
726 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_2, 0); in rtl_clear_bp()
727 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_4, 0); in rtl_clear_bp()
728 ocp_write_dword(tp, MCU_TYPE_PLA, PLA_BP_6, 0); in rtl_clear_bp()
729 ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_0, 0); in rtl_clear_bp()
730 ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_2, 0); in rtl_clear_bp()
731 ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_4, 0); in rtl_clear_bp()
732 ocp_write_dword(tp, MCU_TYPE_USB, USB_BP_6, 0); in rtl_clear_bp()
736 ocp_write_word(tp, MCU_TYPE_PLA, PLA_BP_BA, 0); in rtl_clear_bp()
737 ocp_write_word(tp, MCU_TYPE_USB, USB_BP_BA, 0); in rtl_clear_bp()
740 static void r8153_clear_bp(struct r8152 *tp) in r8153_clear_bp() argument
742 ocp_write_byte(tp, MCU_TYPE_PLA, PLA_BP_EN, 0); in r8153_clear_bp()
743 ocp_write_byte(tp, MCU_TYPE_USB, USB_BP_EN, 0); in r8153_clear_bp()
744 rtl_clear_bp(tp); in r8153_clear_bp()
747 static void r8152b_set_dq_desc(struct r8152 *tp) in r8152b_set_dq_desc() argument
751 data = ocp_read_byte(tp, MCU_TYPE_USB, 0xd429); in r8152b_set_dq_desc()
753 ocp_write_byte(tp, MCU_TYPE_USB, 0xd429, data); in r8152b_set_dq_desc()
754 ocp_write_word(tp, MCU_TYPE_USB, 0xc0ce, 0x0210); in r8152b_set_dq_desc()
755 data = ocp_read_byte(tp, MCU_TYPE_USB, 0xd429); in r8152b_set_dq_desc()
757 ocp_write_byte(tp, MCU_TYPE_USB, 0xd429, data); in r8152b_set_dq_desc()
760 static int r8153_pre_ram_code(struct r8152 *tp, u16 patch_key) in r8153_pre_ram_code() argument
765 data = ocp_reg_read(tp, 0xb820); in r8153_pre_ram_code()
767 ocp_reg_write(tp, 0xb820, data); in r8153_pre_ram_code()
771 data = ocp_reg_read(tp, 0xb800) & 0x0040; in r8153_pre_ram_code()
774 sram_write(tp, 0x8146, patch_key); in r8153_pre_ram_code()
775 sram_write(tp, 0xb82e, 0x0001); in r8153_pre_ram_code()
780 static int r8153_post_ram_code(struct r8152 *tp) in r8153_post_ram_code() argument
784 sram_write(tp, 0x0000, 0x0000); in r8153_post_ram_code()
786 data = ocp_reg_read(tp, 0xb82e); in r8153_post_ram_code()
788 ocp_reg_write(tp, 0xb82e, data); in r8153_post_ram_code()
790 sram_write(tp, 0x8146, 0x0000); in r8153_post_ram_code()
792 data = ocp_reg_read(tp, 0xb820); in r8153_post_ram_code()
794 ocp_reg_write(tp, 0xb820, data); in r8153_post_ram_code()
796 ocp_write_word(tp, MCU_TYPE_PLA, PLA_OCP_GPHY_BASE, tp->ocp_base); in r8153_post_ram_code()
801 static void r8153_wdt1_end(struct r8152 *tp) in r8153_wdt1_end() argument
806 if (!(ocp_read_byte(tp, MCU_TYPE_USB, 0xe404) & 1)) in r8153_wdt1_end()
812 void r8152b_firmware(struct r8152 *tp) in r8152b_firmware() argument
816 if (tp->version == RTL_VER_01) { in r8152b_firmware()
819 r8152b_set_dq_desc(tp); in r8152b_firmware()
820 rtl_clear_bp(tp); in r8152b_firmware()
822 generic_ocp_write(tp, 0xf800, 0x3f, in r8152b_firmware()
827 ocp_write_word(tp, MCU_TYPE_PLA, in r8152b_firmware()
831 ocp_write_word(tp, MCU_TYPE_PLA, PLA_OCP_GPHY_BASE, 0x2000); in r8152b_firmware()
832 ocp_write_word(tp, MCU_TYPE_PLA, 0xb092, 0x7070); in r8152b_firmware()
833 ocp_write_word(tp, MCU_TYPE_PLA, 0xb098, 0x0600); in r8152b_firmware()
835 ocp_write_word(tp, MCU_TYPE_PLA, 0xb09a, in r8152b_firmware()
838 ocp_write_word(tp, MCU_TYPE_PLA, 0xb098, 0x0200); in r8152b_firmware()
839 ocp_write_word(tp, MCU_TYPE_PLA, 0xb092, 0x7030); in r8152b_firmware()
840 } else if (tp->version == RTL_VER_02) { in r8152b_firmware()
841 rtl_clear_bp(tp); in r8152b_firmware()
843 generic_ocp_write(tp, 0xf800, 0xff, in r8152b_firmware()
849 ocp_write_word(tp, MCU_TYPE_PLA, in r8152b_firmware()
855 void r8153_firmware(struct r8152 *tp) in r8153_firmware() argument
859 if (tp->version == RTL_VER_03) { in r8153_firmware()
860 r8153_clear_bp(tp); in r8153_firmware()
862 r8153_pre_ram_code(tp, 0x7000); in r8153_firmware()
865 ocp_write_word(tp, MCU_TYPE_PLA, in r8153_firmware()
869 r8153_post_ram_code(tp); in r8153_firmware()
870 } else if (tp->version == RTL_VER_04) { in r8153_firmware()
871 r8153_pre_ram_code(tp, 0x7001); in r8153_firmware()
874 ocp_write_word(tp, MCU_TYPE_PLA, in r8153_firmware()
878 r8153_post_ram_code(tp); in r8153_firmware()
880 r8153_wdt1_end(tp); in r8153_firmware()
881 r8153_clear_bp(tp); in r8153_firmware()
883 ocp_write_word(tp, MCU_TYPE_USB, USB_BP_EN, 0x0000); in r8153_firmware()
884 generic_ocp_write(tp, 0xf800, 0xff, in r8153_firmware()
889 ocp_write_word(tp, MCU_TYPE_USB, in r8153_firmware()
893 if (!(ocp_read_word(tp, MCU_TYPE_PLA, 0xd38e) & BIT(0))) { in r8153_firmware()
894 ocp_write_word(tp, MCU_TYPE_PLA, 0xd38c, 0x0082); in r8153_firmware()
895 ocp_write_word(tp, MCU_TYPE_PLA, 0xd38e, 0x0082); in r8153_firmware()
898 ocp_write_word(tp, MCU_TYPE_PLA, PLA_BP_EN, 0x0000); in r8153_firmware()
899 generic_ocp_write(tp, 0xf800, 0xff, in r8153_firmware()
904 ocp_write_word(tp, MCU_TYPE_PLA, in r8153_firmware()
908 ocp_write_word(tp, MCU_TYPE_PLA, 0xd388, 0x08ca); in r8153_firmware()
909 } else if (tp->version == RTL_VER_05) { in r8153_firmware()
912 ocp_data = ocp_read_word(tp, MCU_TYPE_USB, 0xcfca); in r8153_firmware()
914 ocp_write_word(tp, MCU_TYPE_USB, 0xcfca, ocp_data); in r8153_firmware()
916 r8153_pre_ram_code(tp, 0x7001); in r8153_firmware()
919 ocp_write_word(tp, MCU_TYPE_PLA, in r8153_firmware()
923 r8153_post_ram_code(tp); in r8153_firmware()
925 r8153_wdt1_end(tp); in r8153_firmware()
926 r8153_clear_bp(tp); in r8153_firmware()
928 ocp_write_word(tp, MCU_TYPE_USB, USB_BP_EN, 0x0000); in r8153_firmware()
929 generic_ocp_write(tp, 0xf800, 0xff, in r8153_firmware()
934 ocp_write_word(tp, MCU_TYPE_USB, in r8153_firmware()
938 if (ocp_read_byte(tp, MCU_TYPE_USB, 0xcfef) & 1) { in r8153_firmware()
939 ocp_write_word(tp, MCU_TYPE_USB, 0xfc30, 0x1578); in r8153_firmware()
940 ocp_write_word(tp, MCU_TYPE_USB, USB_BP_EN, 0x00ff); in r8153_firmware()
942 ocp_write_word(tp, MCU_TYPE_USB, USB_BP_EN, 0x00ef); in r8153_firmware()
945 ocp_write_word(tp, MCU_TYPE_PLA, PLA_BP_EN, 0x0000); in r8153_firmware()
946 generic_ocp_write(tp, 0xf800, 0xff, in r8153_firmware()
951 ocp_write_word(tp, MCU_TYPE_PLA, in r8153_firmware()
955 ocp_write_word(tp, MCU_TYPE_PLA, 0xd388, 0x08ca); in r8153_firmware()
957 ocp_data = ocp_read_word(tp, MCU_TYPE_USB, 0xcfca); in r8153_firmware()
959 ocp_write_word(tp, MCU_TYPE_USB, 0xcfca, ocp_data); in r8153_firmware()
960 } else if (tp->version == RTL_VER_06) { in r8153_firmware()
961 r8153_pre_ram_code(tp, 0x7002); in r8153_firmware()
964 ocp_write_word(tp, MCU_TYPE_PLA, in r8153_firmware()
968 r8153_post_ram_code(tp); in r8153_firmware()
970 r8153_clear_bp(tp); in r8153_firmware()
972 ocp_write_word(tp, MCU_TYPE_USB, USB_BP_EN, 0x0000); in r8153_firmware()
973 generic_ocp_write(tp, 0xf800, 0xff, sizeof(usb_patch_d), in r8153_firmware()
977 ocp_write_word(tp, MCU_TYPE_USB, in r8153_firmware()