Re: [OpenWrt-Devel] [PATCH] lantiq: add ath9k support to netgear dgn3500 platform

2012-03-31 Thread Andrej Vlašić
Hi Pieter,

I found an eeprom signature in the "DPF" partition, offset 0x2f000.
> The data in here contains the same PCI header, but other sections
> differ from the file. The data in the eeprom contains a lot more 0xff
> sections than the file...
>

Maybe it is only pci fixup data without the eeprom.

Where can I find information on the contents of the file? Only then I
> can tell which one is the right one to use. Maybe the file is just a
> template from atheros, I don't know which one is used eventually, both
> work...
>

You can also search google for: "AR5006 EEPROM Guide", but dunno if that
applies for ath9k eeprom.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] lantiq: add ath9k support to netgear dgn3500 platform

2012-03-31 Thread simon h
Pieter,

the structure of the data is defined in the Ath5k/9k directories of
compat_wireless.

s


On Sat, Mar 31, 2012 at 11:41 AM, Pieter Voorthuijsen
 wrote:
> Hello 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
>
> I found an eeprom signature in the "DPF" partition, offset 0x2f000.
> The data in here contains the same PCI header, but other sections
> differ from the file. The data in the eeprom contains a lot more 0xff
> sections than the file...
>
> Where can I find information on the contents of the file? Only then I
> can tell which one is the right one to use. Maybe the file is just a
> template from atheros, I don't know which one is used eventually, both
> work...
>
> When using the one from flash a working spi implementation to read it,
> let's wait for that..
>
> Kind regards,
> Pieter
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] lantiq: add ath9k support to netgear dgn3500 platform

2012-03-31 Thread Pieter Voorthuijsen
Hello 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

I found an eeprom signature in the "DPF" partition, offset 0x2f000.
The data in here contains the same PCI header, but other sections
differ from the file. The data in the eeprom contains a lot more 0xff
sections than the file...

Where can I find information on the contents of the file? Only then I
can tell which one is the right one to use. Maybe the file is just a
template from atheros, I don't know which one is used eventually, both
work...

When using the one from flash a working spi implementation to read it,
let's wait for that..

Kind regards,
Pieter
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] lantiq: add ath9k support to netgear dgn3500 platform

2012-03-29 Thread Pieter Voorthuijsen
Hi Simon,

> 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?

My eeprom file will be gone once openwrt is in flash :)
Your method will save at least at lot of nasty header data, but still
a little left. It does not completely detach the kernel from the
eeprom data.

If you want no eeprom data at all in the kernel, I think the eeprom
should be handled like any other firmware:
http://www.makelinux.net/ldd3/chp-14-sect-8. After loading the eeprom
from userspace (dd from flash or file), force a pci rescan and load
the ath driver...

Kind regards,
Pieter
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] lantiq: add ath9k support to netgear dgn3500 platform

2012-03-29 Thread simon h
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,0x,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,0x, 0x4074,0x0003,0x, 0x4000,0x,0x01c2,
0x6034,0x0044,0x,
+0x,
+};

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
 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
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] lantiq: add ath9k support to netgear dgn3500 platform

2012-03-28 Thread Pieter Voorthuijsen
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
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] lantiq: add ath9k support to netgear dgn3500 platform

2012-03-27 Thread Andrej Vlašić
On 27 March 2012 22:53, Pieter Voorthuijsen wrote:

>  The eeprom data is extracted from the original firmware located in
> /etc/ath/eeprom.
>

Hi

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.
Gigaset sx763 has one eeprom for all devices, and i think some device had
wireless problems.


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


Re: [OpenWrt-Devel] [PATCH] lantiq: add ath9k support to netgear dgn3500 platform

2012-03-27 Thread John Crispin
On 27/03/12 22:53, Pieter Voorthuijsen wrote:
> This patch adds support for the AR9223 wifi chip on the Netgear DGN3500 ADSL2 
> router. Originally the chip was identified with PCI product ID 0xff1d. This 
> was fixed by using ltq_pci_ath_fixup similair to other implementations with 
> the AR9223. The eeprom data is extracted from the original firmware located 
> in /etc/ath/eeprom.
> 
> I've tested this by manually scanning other networks and creating a simple 
> access-point.
> 
> Signed-off-by: Pieter Voorthuijsen 
> ---

Thank you, i will go over it tomorrow.

i was told today that there is a spi driver coming up that makes irq
work on ar9. so dont invest too much time on that one please

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


[OpenWrt-Devel] [PATCH] lantiq: add ath9k support to netgear dgn3500 platform

2012-03-27 Thread Pieter Voorthuijsen
This patch adds support for the AR9223 wifi chip on the Netgear DGN3500 ADSL2 
router. Originally the chip was identified with PCI product ID 0xff1d. This was 
fixed by using ltq_pci_ath_fixup similair to other implementations with the 
AR9223. The eeprom data is extracted from the original firmware located in 
/etc/ath/eeprom.

I've tested this by manually scanning other networks and creating a simple 
access-point.

Signed-off-by: Pieter Voorthuijsen 
---

Index: target/linux/lantiq/files-3.2/arch/mips/lantiq/xway/mach-netgear.h
===
--- target/linux/lantiq/files-3.2/arch/mips/lantiq/xway/mach-netgear.h  
(revision 0)
+++ target/linux/lantiq/files-3.2/arch/mips/lantiq/xway/mach-netgear.h  
(revision 0)
@@ -0,0 +1,271 @@
+/*
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ *
+ *  Copyright (C) 2012 Pieter Voorthuijsen
+ *
+ */
+
+#ifndef _MACH_NETGEAR_H__
+#define _MACH_NETGEAR_H__
+
+static u16 dgn3500_eeprom_data[] = {
+   0xa55a, 0x, 0x0003, 0x6000, 0x168c, 0x0029, 0x6008, 0x0001,
+   0x0280, 0x602c, 0x168c, 0x2093, 0x5000, 0x168c, 0x002a, 0x5008,
+   0x0001, 0x0280, 0x502c, 0x168c, 0x2093, 0x5064, 0x0cc0, 0x0504,
+   0x506c, 0x3811, 0x0003, 0x4004, 0x073b, 0x0040, 0x4074, 0x0003,
+   0x, 0x4000, 0x, 0x01c2, 0x6034, 0x0044, 0x, 0x,
+   0xc01a, 0x1aac, 0x612a, 0x9e3c, 0xf29a, 0x0ebc, 0x5fbd, 0x46c3,
+   0xc1fe, 0x8b93, 0x9ed8, 0xd4c8, 0xcfbb, 0x99f6, 0xb094, 0x7cbf,
+   0x52a2, 0x5a3b, 0xedde, 0x97cf, 0x5928, 0xe314, 0xb947, 0xb4c1,
+   0x5ac8, 0x80d5, 0x892b, 0x6053, 0xc9b5, 0xb4e5, 0xf242, 0x0ef1,
+   0xb947, 0xc159, 0x22d1, 0x0cd9, 0xf77d, 0x2845, 0x6f35, 0x05a2,
+   0x0d74, 0x0d1f, 0x7ee6, 0x1002, 0xc682, 0xe94d, 0x0f2e, 0x4d8e,
+   0x869b, 0x74df, 0x1240, 0x2c9f, 0xd680, 0x62d6, 0xea70, 0xfa50,
+   0xa53e, 0xebb0, 0xc96a, 0xfaac, 0x13f9, 0x45f7, 0xe6a4, 0xada6,
+   0x114e, 0x2c8e, 0x305e, 0x76ba, 0xd2d5, 0xd6ad, 0x69f0, 0x03a0,
+   0xd6bb, 0x8063, 0x7c8d, 0x7fee, 0x83d4, 0x3888, 0x1460, 0xbd4c,
+   0x7104, 0xad78, 0xe57f, 0xddb6, 0x5910, 0x87a0, 0xb725, 0x29be,
+   0x81b5, 0x2ffe, 0x269e, 0x55f4, 0xb5f1, 0xc447, 0x23aa, 0x5f1a,
+   0x7eda, 0x091b, 0x7c76, 0xd018, 0xd69e, 0xb521, 0x1975, 0x5910,
+   0xd162, 0xb75c, 0xeba0, 0x7a0a, 0x1973, 0x28aa, 0x6721, 0x20cb,
+   0x8415, 0xcde5, 0x0fe9, 0x6e66, 0x8600, 0x9aff, 0xc370, 0x33eb,
+   0x3ba8, 0x5e64, 0x6d6c, 0xe0d8, 0x98e5, 0xff91, 0x17db, 0xa722,
+   0xfbe5, 0x251c, 0x7a2b, 0x4d84, 0xaf8d, 0x2ef7, 0x714e, 0xe055,
+   0xe90d, 0xbcc4, 0x81eb, 0xfe75, 0xc386, 0xe836, 0x5cb0, 0x9748,
+   0x6a9c, 0x5df2, 0xbe32, 0x9320, 0xe5e2, 0x345b, 0x11e2, 0x5165,
+   0x452d, 0x1500, 0x2cd1, 0x6e60, 0xfffe, 0x7ab4, 0xb3fa, 0x9a07,
+   0xeb13, 0x65ae, 0x6cfd, 0x8ec6, 0x81c8, 0x6fd5, 0x2025, 0x022f,
+   0x783e, 0x01ea, 0x55d3, 0x1163, 0xfa51, 0x7eb9, 0xdbd2, 0xdc45,
+   0x28bf, 0x226d, 0x9535, 0x4340, 0x9267, 0x86e5, 0xb20b, 0x692c,
+   0xb6a5, 0xf6ee, 0x101b, 0xb882, 0x428f, 0xe4b4, 0x0f1d, 0x2bd6,
+   0x29f4, 0xdb1f, 0x0618, 0xe5d3, 0x211f, 0xbef0, 0x3207, 0x8271,
+   0xee38, 0x328c, 0x1766, 0xe3b0, 0x5612, 0x5c36, 0x54dd, 0xb685,
+   0x15f0, 0x15be, 0xac6a, 0x6b38, 0x0944, 0xde4a, 0x85e0, 0xbce3,
+   0x0cb8, 0xd437, 0xe015, 0x0002, 0x, 0x001f, 0x0300, 0xbe7f,
+   0x3cf1, 0x0303, 0x, 0x, 0x, 0x1b00, 0x0007, 0x0003,
+   0x, 0x0002, 0x0100, 0x, 0x, 0x, 0x, 0x,
+   0x, 0x, 0x, 0x, 0x, 0x, 0x, 0x,
+   0x, 0x, 0x, 0x, 0x, 0x, 0x, 0x,
+   0x, 0x, 0x, 0x, 0x, 0x, 0x, 0x,
+   0x, 0x, 0x, 0x, 0x, 0x, 0x, 0x,
+   0x, 0x, 0x, 0x, 0x, 0x, 0x, 0x,
+   0x, 0x, 0x, 0x, 0x, 0x, 0x, 0x,
+   0x, 0x2d00, 0x0b0b, 0x0b0b, 0x0b0b, 0x00e0, 0x0e0e, 0x000e,
+   0x0e02, 0xca00, 0xcaca, 0x0109, 0x, 0x, 0x, 0x0206,
+   0x0002, 0x, 0x0e0e, 0x0002, 0x, 0x, 0x2c00, 0x,
+   0x, 0x, 0x0202, 0x098d, 0x, 0x, 0x, 0x,
+   0x, 0x, 0x8000, 0x, 0x, 0x, 0x, 0x,
+   0x, 0x, 0x, 0x, 0x0010, 0x, 0x0010, 0x,
+   0x, 0x, 0x05a0, 0x0960, 0x, 0x2d00, 0x2020, 0x000b,
+   0x1000, 0x00e2, 0x0d0d, 0x000d, 0x0e02, 0xff1c, 0x, 0x0106,
+   0x, 0x, 0x, 0x0306, 0x0303, 0x, 0x0e0e, 0x1b00,
+   0x001b, 0x1919, 0x2d00, 0x, 0x, 0x, 0x0303, 0x098d,
+   0x, 0x, 0x, 0x0092, 0x9200, 0x, 0x8000, 0x,
+   0x, 0x, 0x, 0x, 0x, 0x, 0x, 0x,
+   0x, 0x, 0x, 0x