• Martin Blumenstingl's avatar
    ath9k: define all EEPROM fields in Little Endian format · 4bca5303
    Martin Blumenstingl authored
    The ar9300_eeprom logic is already using only 8-bit (endian neutral),
    __le16 and __le32 fields to state explicitly how the values should be
    interpreted.
    All other EEPROM implementations (4k, 9287 and def) were using u16 and
    u32 fields with additional logic to swap the values (read from the
    original EEPROM) so they match the current CPUs endianness.
    
    The EEPROM format defaults to "all values are Little Endian", indicated
    by the absence of the AR5416_EEPMISC_BIG_ENDIAN in the u8 EEPMISC
    register. If we detect that the EEPROM indicates Big Endian mode
    (AR5416_EEPMISC_BIG_ENDIAN is set in the EEPMISC register) then we'll
    swap the values to convert them into Little Endian. This is done by
    activating the EEPMISC based logic in ath9k_hw_nvram_swap_data even if
    AH_NO_EEP_SWAP is set (this makes ath9k behave like the FreeBSD driver,
    which also does not have a flag to enable swapping based on the
    AR5416_EEPMISC_BIG_ENDIAN bit). Before this logic was only used to
    enable swapping when "current CPU endianness != EEPROM endianness".
    
    After changing all relevant fields to __le16 and __le32 sparse was used
    to check that all code which reads any of these fields uses
    le{16,32}_to_cpu.
    Signed-off-by: default avatarMartin Blumenstingl <martin.blumenstingl@googlemail.com>
    Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
    4bca5303
eeprom_9287.c 30.1 KB