735 ret_val = hw->nvm.ops.read(hw, NVM_ID_LED_SETTINGS, 1, data);
736 if (ret_val) {
737 DEBUGOUT("NVM Read Error\n");
738 goto out;
739 }
740
741 if (*data == ID_LED_RESERVED_0000 || *data == ID_LED_RESERVED_FFFF) {
742 switch (hw->phy.media_type) {
743 case e1000_media_type_internal_serdes:
744 *data = ID_LED_DEFAULT_I210_SERDES;
745 break;
746 case e1000_media_type_copper:
747 default:
748 *data = ID_LED_DEFAULT_I210;
749 break;
750 }
751 }
752 out:
753 return ret_val;
754 }
|
735 ret_val = hw->nvm.ops.read(hw, NVM_ID_LED_SETTINGS, 1, data);
736 if (ret_val) {
737 DEBUGOUT("NVM Read Error\n");
738 goto out;
739 }
740
741 if (*data == ID_LED_RESERVED_0000 || *data == ID_LED_RESERVED_FFFF) {
742 switch (hw->phy.media_type) {
743 case e1000_media_type_internal_serdes:
744 *data = ID_LED_DEFAULT_I210_SERDES;
745 break;
746 case e1000_media_type_copper:
747 default:
748 *data = ID_LED_DEFAULT_I210;
749 break;
750 }
751 }
752 out:
753 return ret_val;
754 }
755
756 /**
757 * __e1000_access_xmdio_reg - Read/write XMDIO register
758 * @hw: pointer to the HW structure
759 * @address: XMDIO address to program
760 * @dev_addr: device address to program
761 * @data: pointer to value to read/write from/to the XMDIO address
762 * @read: boolean flag to indicate read or write
763 **/
764 static s32 __e1000_access_xmdio_reg(struct e1000_hw *hw, u16 address,
765 u8 dev_addr, u16 *data, bool read)
766 {
767 s32 ret_val = E1000_SUCCESS;
768
769 DEBUGFUNC("__e1000_access_xmdio_reg");
770
771 ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, dev_addr);
772 if (ret_val)
773 return ret_val;
774
775 ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAAD, address);
776 if (ret_val)
777 return ret_val;
778
779 ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, E1000_MMDAC_FUNC_DATA |
780 dev_addr);
781 if (ret_val)
782 return ret_val;
783
784 if (read)
785 ret_val = hw->phy.ops.read_reg(hw, E1000_MMDAAD, data);
786 else
787 ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAAD, *data);
788 if (ret_val)
789 return ret_val;
790
791 /* Recalibrate the device back to 0 */
792 ret_val = hw->phy.ops.write_reg(hw, E1000_MMDAC, 0);
793 if (ret_val)
794 return ret_val;
795
796 return ret_val;
797 }
798
799 /**
800 * e1000_read_xmdio_reg - Read XMDIO register
801 * @hw: pointer to the HW structure
802 * @addr: XMDIO address to program
803 * @dev_addr: device address to program
804 * @data: value to be read from the EMI address
805 **/
806 s32 e1000_read_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 *data)
807 {
808 DEBUGFUNC("e1000_read_xmdio_reg");
809
810 return __e1000_access_xmdio_reg(hw, addr, dev_addr, data, TRUE);
811 }
812
813 /**
814 * e1000_write_xmdio_reg - Write XMDIO register
815 * @hw: pointer to the HW structure
816 * @addr: XMDIO address to program
817 * @dev_addr: device address to program
818 * @data: value to be written to the XMDIO address
819 **/
820 s32 e1000_write_xmdio_reg(struct e1000_hw *hw, u16 addr, u8 dev_addr, u16 data)
821 {
822 DEBUGFUNC("e1000_read_xmdio_reg");
823
824 return __e1000_access_xmdio_reg(hw, addr, dev_addr, &data, FALSE);
825 }
826
827
|