Hi Pieter,
on my BT HHV2B, my calibration data is in nand. I need it at two
points, the first to read the PCI fixup data (used before nand has
been probed) and then for the actual ath driver (after nand has been
probed).
I hardcoded only the first part of the data - the fixup data - which
should not change between different insttances of the same model, and
then read the nand partition at the time the ath driver loaded.
you should be able to do something similar to read your file?
I'm hoping when John look at my suggested mods, we'll think up some
way of bringing the PCI up after the nand, so that the whole thing can
be read from the nand, but this change of device load order impacts
which need careful consideration, e.g. what if we're booting from a
pci based device? :)
the essence of the code is here:
static pci fixup data:
+/////////////////////////////////////////////////////////////
+// this data is from the start of the eeprom image in ART
+// it's in groups of 3
+// these are values that get written to cetain pci registers to
modify the Ath9k
+// pci config to suit
+//
+static unsigned short my_pci_fixup_data[] =
+{
+0xa55a,0x0000,0x0003, 0x6000,0x168c,0x0027, 0x6008,0x0001,0x0280,
0x602c,0x168c,0x2081, 0x5000,0x168c,0x0028,
+0x5008,0x0001,0x0280, 0x502c,0x168c,0x2081, 0x5064,0x0cc0,0x0504,
0x570c,0xff01,0x2200, 0x506c,0x3c11,0x0003,
+0x4004,0x073f,0x0000, 0x4074,0x0003,0x0000, 0x4000,0x0000,0x01c2,
0x6034,0x0044,0x0000,
+0xffff,
+};
using in the main function:
+ // register our PCI fixup data - what slot?
+ ltq_pci_ath_fixup(14, my_pci_fixup_data);
+
and reading the nand partition:
+
+static struct ath9k_platform_data bt_ath9k_pdata = {
+ .led_pin = -1,
+};
+
+static void ath_platform_get_eeprom_data(void)
+{
+ struct file* filp = NULL;
+ mm_segment_t oldfs;
+ int err = 0;
+ unsigned long long offset = 0;
+ int ret;
+
+ oldfs = get_fs();
+ set_fs(get_ds());
+ filp = filp_open("/dev/mtd5", O_RDONLY, 0);
+
+ if(IS_ERR(filp)) {
+ printk("Could not open /dev/mtd5\n");
+ set_fs(oldfs);
+ err = PTR_ERR(filp);
+ return;
+ }
+
+ ret = vfs_read(filp, (unsigned char
*)bt_ath9k_pdata.eeprom_data, ATH5K_PLAT_EEP_MAX_WORDS*2 , &offset);
+
+ filp_close(filp, NULL);
+
+ set_fs(oldfs);
+
+ //bt_ath9k_pdata.check_endianness = 1;
+
+ if (bt_ath9k_pdata.eeprom_data[0] != 0xa55a) {
+ printk("eeprom data does not start a55a\n");
+ return;
+ }
+
+ printk("eeprom data read from /dev/mtd5\n");
+
+ return;
+}
+
+
+extern int (*ltqpci_plat_dev_init)(struct pci_dev *dev);
+
+static int
+bt_ath9k_pci_plat_dev_init(struct pci_dev *dev)
+{
+ ath_platform_get_eeprom_data();
+ dev->dev.platform_data = &bt_ath9k_pdata;
+ return 0;
+}
+
+
+
+static void __init
+ltq_bt_register_ath9k(u8 *macaddr)
+{
+ bt_ath9k_pdata.macaddr = macaddr;
+ ltqpci_plat_dev_init = bt_ath9k_pci_plat_dev_init;
+}
+
On Wed, Mar 28, 2012 at 9:58 AM, Pieter Voorthuijsen
<[email protected]> wrote:
> Hi Andrej,
>
>> Are you sure that /etc/ath/eeprom isn't created from some flash partition in
>> boot time, because usually every device should have it's own eeprom
>> calibration data to make wifi performance best.
>
> From manufacturers point of view it is easier to have identical
> products... The file is part of the filesystem and has the same
> time/date as the rest. However I'm not 100% sure that this eeprom data
> is actually used by the ath_pci driver, there is no reference to it in
> any logging.
>
> I found no accessible mtd under Linux that contains eeprom data, it
> could be that a calibration partition is not available via mtd.
>
> I've checked the firmware upgrade file and it looks like a raw dump of
> the entire flash (16M). I'll try to read back the flash under U-boot
> and compare it to the original firmware. The diff should show settings
> and maybe calibration data...
> _______________________________________________
> openwrt-devel mailing list
> [email protected]
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/mailman/listinfo/openwrt-devel