equal
deleted
inserted
replaced
930 EC_ERR("Writing EEPROMs only allowed in idle mode!\n"); |
930 EC_ERR("Writing EEPROMs only allowed in idle mode!\n"); |
931 return -EBUSY; |
931 return -EBUSY; |
932 } |
932 } |
933 |
933 |
934 if (size % 2) { |
934 if (size % 2) { |
935 EC_ERR("EEPROM data size is odd! Dropping.\n"); |
935 EC_ERR("EEPROM data size is odd (%u bytes)! SII data must be" |
|
936 " word-aligned. Dropping.\n", size); |
936 return -EINVAL; |
937 return -EINVAL; |
937 } |
938 } |
938 |
939 |
939 // init EEPROM write request |
940 // init EEPROM write request |
940 INIT_LIST_HEAD(&request.list); |
941 INIT_LIST_HEAD(&request.list); |
942 request.data = data; |
943 request.data = data; |
943 request.word_offset = 0; |
944 request.word_offset = 0; |
944 request.word_size = size / 2; |
945 request.word_size = size / 2; |
945 |
946 |
946 if (request.word_size < 0x0041) { |
947 if (request.word_size < 0x0041) { |
947 EC_ERR("EEPROM data too short! Dropping.\n"); |
948 EC_ERR("EEPROM data too short (%u words)! Mimimum is" |
|
949 " 40 fixed words + 1 delimiter. Dropping.\n", |
|
950 request.word_size); |
948 return -EINVAL; |
951 return -EINVAL; |
949 } |
952 } |
950 |
953 |
951 // calculate checksum |
954 // calculate checksum |
952 crc = ec_slave_eeprom_crc(data, 14); // CRC over words 0 to 6 |
955 crc = ec_slave_eeprom_crc(data, 14); // CRC over words 0 to 6 |