On 10/11/2012 8:44 AM, Felix Fietkau wrote:
> On 2012-11-09 11:02 PM, Daniel Dickinson wrote:
>> There is a router that users the MAC address for wireless from the platform 
>> data
>> (which gets it from the flash ART partition) and the calibration data from a 
>> PCI-e
>> card's EEPROM.  Here we add support for this.
> At least for AR9300 the code already checks the platform data's EEPROM
> validity. If the pdata contains an empty EEPROM data section, the code
> falls back to trying OTP and Serial EEPROM access. Doesn't that make
> this patch unnecessary?

There are two things that cause this not to work.  The first is
that the platform defintion for ath9k that defines pdata, defines
it as an array, therefore it's size can never be 0.

 if (pdata && !no_eeprom_data) {
                if (off >= (ARRAY_SIZE(pdata->eeprom_data))) {
                        ath_err(common,
                                "%s: eeprom read failed, offset %08x is out of 
range\n",
                                __func__, off);
                }

                *data = pdata->eeprom_data[off];
        } else {
                struct ath_hw *ah = (struct ath_hw *) common->ah;

                common->ops->read(ah, AR5416_EEPROM_OFFSET +
                                      (off << AR5416_EEPROM_S));

                if (!ath9k_hw_wait(ah,
                                   AR_EEPROM_STATUS_DATA,
                                   AR_EEPROM_STATUS_DATA_BUSY |
                                   AR_EEPROM_STATUS_DATA_PROT_ACCESS, 0,
                                   AH_WAIT_TIMEOUT)) {
                        return false;
                }

                *data = MS(common->ops->read(ah, AR_EEPROM_STATUS_DATA),
                           AR_EEPROM_STATUS_DATA_VAL);
        }

Also, in ar9300_eeprom_restore_internal it uses flash first, then falls back
to the eeprom read function, however elsewhere the 'eeprom' read function is
flash or eeprom depending on the pdata.  If there is pdata, the eeprom read
function does not use real EEPROM data but through ath9_eeprom_read_pci
reads pdata->eeprom_data.  If there is no pdata then that funtion actually
reads from EEPROM.

I guess this could be considered a design flaw if that was not the intended
result. i.e. if what we want is supposed to work, there is a bug.

Regards,

Daniel

> 
> Also, the change contains some useless whitespace mangling and uses the
> wrong patch format (use make target/linux/refresh to clean that up).
> 
> - Felix
> 


-- 
Daniel Dickinson PowerCloud Systems, Palo Alto, CA Senior Firmware Engineer (In 
Canada: Senior Firmware Analyst)

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to