diff mbox

[OpenWrt-Devel] ramips:Fix mt7612 support for Xiaomi Mini.

Message ID 1423050284-7013-1-git-send-email-gch981213@gmail.com
State Superseded, archived
Headers show

Commit Message

Chuanhong Guo Feb. 4, 2015, 11:44 a.m. UTC
From: 郭传鈜 <gch981213@gmail.com>

2ghz should be disabled on this router.
And I think 'mediatek,mtd-eeprom' should be defined as<&factory 32768> instead of <&factory 0x8000> according to WHR-1166D.dts
Actually I didn't have this router.But I think this is the reason that the MT7612E radio always gets a random MAC address on this router.

BTW,Roger,could you please test if this patch can fix the MAC address problem you told in your mail? 

Signed-off-by: 郭传鈜 <gch981213@gmail.com>
---
 target/linux/ramips/dts/XIAOMI-MIWIFI-MINI.dts | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Gioacchino Mazzurco Feb. 4, 2015, 11:53 a.m. UTC | #1
On Wednesday, February 04, 2015 06:44:44 AM Chuanhong Guo wrote:
> 2ghz should be disabled on this router.

It doesn't have 2ghz wireless interface, or it is that we are not capable of 
supporting it at moment?
Chuanhong Guo Feb. 4, 2015, 12:21 p.m. UTC | #2
This is a router with mt7620a soc for 2.4GHz wireless and mt7612e for
5.8GHz wireless.

2015-02-04 19:53 GMT+08:00 Gioacchino Mazzurco <gio@eigenlab.org>:

> On Wednesday, February 04, 2015 06:44:44 AM Chuanhong Guo wrote:
> > 2ghz should be disabled on this router.
>
> It doesn't have 2ghz wireless interface, or it is that we are not capable
> of
> supporting it at moment?
>
Chuanhong Guo Feb. 4, 2015, 12:36 p.m. UTC | #3
Ah.Sorry,I mean 2.4GHz support for MT7612E should be disabled.

2015-02-04 19:53 GMT+08:00 Gioacchino Mazzurco <gio@eigenlab.org>:

> On Wednesday, February 04, 2015 06:44:44 AM Chuanhong Guo wrote:
> > 2ghz should be disabled on this router.
>
> It doesn't have 2ghz wireless interface, or it is that we are not capable
> of
> supporting it at moment?
>
Roger Pueyo Centelles Feb. 4, 2015, 4:08 p.m. UTC | #4
Hi,



2015-02-04 12:44 GMT+01:00 Chuanhong Guo <gch981213@gmail.com>:

> From: 郭传鈜 <gch981213@gmail.com>
>
> 2ghz should be disabled on this router.
>

You're right. This should be patched.


> And I think 'mediatek,mtd-eeprom' should be defined as<&factory 32768>
> instead of <&factory 0x8000> according to WHR-1166D.dts
> Actually I didn't have this router.But I think this is the reason that the
> MT7612E radio always gets a random MAC address on this router.
>

Both definitions are the same, since 0x8000 hex == 32768 dec.


>
> BTW,Roger,could you please test if this patch can fix the MAC address
> problem you told in your mail?
>

I tried both, with equal results.
John Crispin Feb. 4, 2015, 4:56 p.m. UTC | #5
On 04/02/2015 17:08, Roger Pueyo Centelles wrote:
> Hi,
> 
> 
> 
> 2015-02-04 12:44 GMT+01:00 Chuanhong Guo <gch981213@gmail.com
> <mailto:gch981213@gmail.com>>:
> 
>     From: 郭传鈜 <gch981213@gmail.com <mailto:gch981213@gmail.com>>
> 
>     2ghz should be disabled on this router.
> 
> 
> You're right. This should be patched.
>  
> 
>     And I think 'mediatek,mtd-eeprom' should be defined as<&factory
>     32768> instead of <&factory 0x8000> according to WHR-1166D.dts
>     Actually I didn't have this router.But I think this is the reason
>     that the MT7612E radio always gets a random MAC address on this router.
> 
> 
> Both definitions are the same, since 0x8000 hex == 32768 dec.
>  

try 0x8004 as 0x8000 holds the chip id and right after that is where the
mac is located




> 
> 
>     BTW,Roger,could you please test if this patch can fix the MAC
>     address problem you told in your mail?
> 
> 
> I tried both, with equal results.
>  
> 
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>
Roger Pueyo Centelles Feb. 4, 2015, 7:18 p.m. UTC | #6
Hi,

I tried with 0x8004 and I also got a random IP address. Actually, I changed
this block in in eeprom.c (line 571) [1]:

if (!is_valid_ether_addr(dev->macaddr)) {
    eth_random_addr(dev->macaddr);
    dev_printk(KERN_INFO, dev->dev,
        "Invalid MAC address, using random address %pM\n",
    dev->macaddr);
}

to:

if (!is_valid_ether_addr(dev->macaddr)) {
    dev_printk(KERN_INFO, dev->dev,
        "Invalid MAC address %pM\n",
        dev->macaddr);
    eth_random_addr(dev->macaddr);
    dev_printk(KERN_INFO, dev->dev,
        "Using random address %pM\n",
        dev->macaddr);
}

and I see this message:

[   15.000000] ASIC revision: 76120044
[   15.000000] mt76pci 0000:01:00.0: Invalid MAC address ff:ff:ff:ff:ff:ff
[   15.000000] mt76pci 0000:01:00.0: Using random address ca:a8:87:d8:65:45
[   15.320000] ROM patch already applied
[   15.330000] Firmware Version: 0.0.00
[   15.330000] Build: 1
[   15.330000] Build Time: 201406241830____
[   15.360000] Firmware running!
[   15.370000] pci device driver attached


[1] https://github.com/openwrt/mt76/blob/master/eeprom.c

2015-02-04 17:56 GMT+01:00 John Crispin <blogic@openwrt.org>:

>
>
> On 04/02/2015 17:08, Roger Pueyo Centelles wrote:
> > Hi,
> >
> >
> >
> > 2015-02-04 12:44 GMT+01:00 Chuanhong Guo <gch981213@gmail.com
> > <mailto:gch981213@gmail.com>>:
> >
> >     From: 郭传鈜 <gch981213@gmail.com <mailto:gch981213@gmail.com>>
> >
> >     2ghz should be disabled on this router.
> >
> >
> > You're right. This should be patched.
> >
> >
> >     And I think 'mediatek,mtd-eeprom' should be defined as<&factory
> >     32768> instead of <&factory 0x8000> according to WHR-1166D.dts
> >     Actually I didn't have this router.But I think this is the reason
> >     that the MT7612E radio always gets a random MAC address on this
> router.
> >
> >
> > Both definitions are the same, since 0x8000 hex == 32768 dec.
> >
>
> try 0x8004 as 0x8000 holds the chip id and right after that is where the
> mac is located
>
>
>
>
> >
> >
> >     BTW,Roger,could you please test if this patch can fix the MAC
> >     address problem you told in your mail?
> >
> >
> > I tried both, with equal results.
> >
> >
> >
> >
> > _______________________________________________
> > openwrt-devel mailing list
> > openwrt-devel@lists.openwrt.org
> > https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
> >
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>
John Crispin Feb. 4, 2015, 7:29 p.m. UTC | #7
On 04/02/2015 20:18, Roger Pueyo Centelles wrote:
> Hi,
> 
> I tried with 0x8004 and I also got a random IP address. Actually,
> I changed this block in in eeprom.c (line 571) [1]:

can you do a "hexdump -C /dev/mtd2" and paste the output please ?
Roger Pueyo Centelles Feb. 4, 2015, 9:11 p.m. UTC | #8
root@OpenWrt:/# hexdump -C /dev/mtd2
00000000  20 76 05 01 64 09 80 01  66 5d ff ff ff ff ff ff  |
v..d...f]......|
00000010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
|................|
00000020  ff ff ff ff ff ff ff ff  64 09 80 01 66 5c 00 d0
|........d...f\..|
00000030  59 60 00 04 22 0c 04 04  ff ff 15 01 55 77 a8 aa
|Y`..".......Uw..|
00000040  8c 88 ff ff 0d 00 00 00  00 00 00 00 00 00 ff ff
|................|
00000050  ff ff 10 10 10 10 10 10  11 11 11 11 11 11 12 12
|................|
00000060  12 12 12 12 12 12 13 13  13 14 14 14 15 15 80 ff
|................|
00000070  ff ff 80 ff ff ff 00 f4  ff ff ff ff ff ff ff ff
|................|
00000080  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
|................|
*
000000d0  1e 00 ff ff ff ff ff ff  ff ff ff ff ff ff 08 08
|................|
000000e0  06 06 04 00 06 06 04 00  06 06 04 00 06 06 04 00
|................|
000000f0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
|................|
*
00008000  62 76 00 00 64 09 80 01  66 5e 62 76 c3 14 00 00
|bv..d...f^bv....|
00008010  00 00 62 76 c3 14 00 00  00 00 ff ff ff ff ff ff
|..bv............|
00008020  ff ff 37 d8 9d 00 60 7f  fd 9b ff ff ff ff ff ff
|..7...`.........|
00008030  ff ff ff ff 22 ff 00 20  ff ff 9b 01 00 00 00 00  |...."..
........|
00008040  00 00 ff df 00 82 00 00  00 81 00 00 00 00 e0 01
|................|
00008050  00 00 00 00 00 00 84 0a  1a 00 00 00 83 0b 1a 00
|................|
00008060  00 00 7a 06 22 82 82 7a  06 22 82 82 78 08 22 82
|..z."..z."..x.".|
00008070  82 7e 02 22 82 82 76 16  22 82 82 75 1c 22 82 82
|.~."..v."..u."..|
00008080  79 0a 22 82 82 79 0a 22  82 82 7b 06 22 82 82 77
|y."..y."..{."..w|
00008090  14 22 82 82 7e 05 22 82  82 79 11 22 82 82 00 1b
|."..~."..y."....|
000080a0  c3 c3 c3 c3 00 00 c4 c4  c2 82 c4 c4 c2 82 00 00
|................|
000080b0  00 00 c4 c4 c2 00 00 00  00 00 c2 c2 82 82 86 00
|................|
000080c0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
|................|
*
000080f0  ff ff ff ff ff ff ff ff  22 ff ff ff ff ff ff ff
|........".......|
00008100  0f ca 74 c5 e8 07 30 3d  01 b0 08 26 00 0e 04 15
|..t...0=...&....|
00008110  00 8a 00 40 00 00 00 08  00 9d 08 00 12 c0 00 00
|...@............|
00008120  08 20 04 2a 90 00 00 24  01 04 54 08 d0 a0 28 20  |.
.*...$..T...( |
00008130  ff ff ff ff ff ff ff 08  ff ff ff ff ff ff 00 00
|................|
00008140  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
|................|
*
000081e0  c0 81 82 c3 04 45 46 07  08 09 ff ff ff ff ff ff
|.....EF.........|
000081f0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
|................|
*
00010000

The MACs are there, at 0x4, 0x28 and 0x8004.

2015-02-04 20:29 GMT+01:00 John Crispin <blogic@openwrt.org>:

>
>
> On 04/02/2015 20:18, Roger Pueyo Centelles wrote:
> > Hi,
> >
> > I tried with 0x8004 and I also got a random IP address. Actually,
> > I changed this block in in eeprom.c (line 571) [1]:
>
> can you do a "hexdump -C /dev/mtd2" and paste the output please ?
>
John Crispin Feb. 4, 2015, 10:13 p.m. UTC | #9
On 04/02/2015 22:11, Roger Pueyo Centelles wrote:
> root@OpenWrt:/# hexdump -C /dev/mtd2
> 00000000  20 76 05 01 64 09 80 01  66 5d ff ff ff ff ff ff  |
> v..d...f]......|
> 00000010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
> |................|
> 00000020  ff ff ff ff ff ff ff ff  64 09 80 01 66 5c 00 d0 
> |........d...f\..|
> 00000030  59 60 00 04 22 0c 04 04  ff ff 15 01 55 77 a8 aa 
> |Y`..".......Uw..|
> 00000040  8c 88 ff ff 0d 00 00 00  00 00 00 00 00 00 ff ff 
> |................|
> 00000050  ff ff 10 10 10 10 10 10  11 11 11 11 11 11 12 12 
> |................|
> 00000060  12 12 12 12 12 12 13 13  13 14 14 14 15 15 80 ff 
> |................|
> 00000070  ff ff 80 ff ff ff 00 f4  ff ff ff ff ff ff ff ff 
> |................|
> 00000080  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
> |................|
> *
> 000000d0  1e 00 ff ff ff ff ff ff  ff ff ff ff ff ff 08 08 
> |................|
> 000000e0  06 06 04 00 06 06 04 00  06 06 04 00 06 06 04 00 
> |................|
> 000000f0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
> |................|
> *
> 00008000  62 76 00 00 64 09 80 01  66 5e 62 76 c3 14 00 00 

                         ^^ that is the mac at 0x8004





> |bv..d...f^bv....|
> 00008010  00 00 62 76 c3 14 00 00  00 00 ff ff ff ff ff ff 
> |..bv............|
> 00008020  ff ff 37 d8 9d 00 60 7f  fd 9b ff ff ff ff ff ff 
> |..7...`.........|
> 00008030  ff ff ff ff 22 ff 00 20  ff ff 9b 01 00 00 00 00  |...."..
> ........|
> 00008040  00 00 ff df 00 82 00 00  00 81 00 00 00 00 e0 01 
> |................|
> 00008050  00 00 00 00 00 00 84 0a  1a 00 00 00 83 0b 1a 00 
> |................|
> 00008060  00 00 7a 06 22 82 82 7a  06 22 82 82 78 08 22 82 
> |..z."..z."..x.".|
> 00008070  82 7e 02 22 82 82 76 16  22 82 82 75 1c 22 82 82 
> |.~."..v."..u."..|
> 00008080  79 0a 22 82 82 79 0a 22  82 82 7b 06 22 82 82 77 
> |y."..y."..{."..w|
> 00008090  14 22 82 82 7e 05 22 82  82 79 11 22 82 82 00 1b 
> |."..~."..y."....|
> 000080a0  c3 c3 c3 c3 00 00 c4 c4  c2 82 c4 c4 c2 82 00 00 
> |................|
> 000080b0  00 00 c4 c4 c2 00 00 00  00 00 c2 c2 82 82 86 00 
> |................|
> 000080c0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
> |................|
> *
> 000080f0  ff ff ff ff ff ff ff ff  22 ff ff ff ff ff ff ff 
> |........".......|
> 00008100  0f ca 74 c5 e8 07 30 3d  01 b0 08 26 00 0e 04 15 
> |..t...0=...&....|
> 00008110  00 8a 00 40 00 00 00 08  00 9d 08 00 12 c0 00 00 
> |...@............|
> 00008120  08 20 04 2a 90 00 00 24  01 04 54 08 d0 a0 28 20  |.
> .*...$..T...( |
> 00008130  ff ff ff ff ff ff ff 08  ff ff ff ff ff ff 00 00 
> |................|
> 00008140  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
> |................|
> *
> 000081e0  c0 81 82 c3 04 45 46 07  08 09 ff ff ff ff ff ff 
> |.....EF.........|
> 000081f0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff 
> |................|
> *
> 00010000
> 
> The MACs are there, at 0x4, 0x28 and 0x8004.
> 
> 2015-02-04 20:29 GMT+01:00 John Crispin <blogic@openwrt.org
> <mailto:blogic@openwrt.org>>:
> 
> 
> 
>     On 04/02/2015 20:18, Roger Pueyo Centelles wrote:
>     > Hi,
>     >
>     > I tried with 0x8004 and I also got a random IP address. Actually,
>     > I changed this block in in eeprom.c (line 571) [1]:
> 
>     can you do a "hexdump -C /dev/mtd2" and paste the output please ?
> 
>
Roger Pueyo Centelles Feb. 4, 2015, 11:34 p.m. UTC | #10
Yes, the MAC is where expected. I've tried unloading and reloading the
mt76pci module; the second line of the log passed unnoticed for me before.

root@OpenWrt:/# rmmod mt76pci && modprobe mt76pci && dmesg
[...]
[   73.620000] pci device driver detached
[   73.630000] mt76pci 0000:01:00.0: no of_node; not parsing pinctrl DT
[   73.630000] ASIC revision: 76120044
[   73.640000] mt76pci 0000:01:00.0: Invalid MAC address ff:ff:ff:ff:ff:ff
[   73.640000] mt76pci 0000:01:00.0: Using random address f6:27:92:58:3a:fd
[   73.680000] ROM patch already applied
[   73.680000] Firmware Version: 0.0.00
[   73.680000] Build: 1
[   73.680000] Build Time: 201406241830____
[   73.710000] Firmware running!
[   73.720000] ieee80211 phy2: Selected rate control algorithm 'minstrel_ht'
[   73.740000] pci device driver attached

Does "no of_node" have something to do with the issue?



> |................|
> > 000000f0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
> > |................|
> > *
> > 00008000  62 76 00 00 64 09 80 01  66 5e 62 76 c3 14 00 00
>
>                          ^^ that is the mac at 0x8004
>
>
>
>
>
> > |bv..d...f^bv....|
> > 00008010  00 00 62 76 c3 14 00 00  00 00 ff ff ff ff ff ff
> > |..bv............|
>
Chuanhong Guo Feb. 5, 2015, 2:43 p.m. UTC | #11
Actually, you only need to run "make target/linux/clean" :D

2015-02-05 22:40 GMT+08:00 Roger Pueyo Centelles <rogerpueyo@rogerpueyo.com>
:

> Hi 郭传鈜,
>
> I did a make clean and then recompiled. Let me try with a completely new
> build, I will tell you in an hour or so.
>
> Thanks!
>
> 2015-02-05 13:56 GMT+01:00 郭传鈜 <gch981213@gmail.com>:
>
>> I've asked someone to test this patch and he told me that the mt7612 got
>> a correct MAC address.......
>>
>> Why not try to print the EEPROM partition name and offest in eeprom.c?
>> Line 72:   part = of_get_property(np, "label", NULL);
>> Line 83:   offset = be32_to_cpup(list);
>> I'm not sure if 0x8000 could be passed correctly here.
>> BTW, have you recompiled the dts file after modifying it?
>>
>> 2015-02-05 3:18 GMT+08:00 Roger Pueyo Centelles <
>> rogerpueyo@rogerpueyo.com>:
>>
>>> Hi,
>>>
>>> I tried with 0x8004 and I also got a random IP address. Actually, I
>>> changed this block in in eeprom.c (line 571) [1]:
>>>
>>> if (!is_valid_ether_addr(dev->macaddr)) {
>>>     eth_random_addr(dev->macaddr);
>>>     dev_printk(KERN_INFO, dev->dev,
>>>         "Invalid MAC address, using random address %pM\n",
>>>     dev->macaddr);
>>> }
>>>
>>> to:
>>>
>>> if (!is_valid_ether_addr(dev->macaddr)) {
>>>     dev_printk(KERN_INFO, dev->dev,
>>>         "Invalid MAC address %pM\n",
>>>         dev->macaddr);
>>>     eth_random_addr(dev->macaddr);
>>>     dev_printk(KERN_INFO, dev->dev,
>>>         "Using random address %pM\n",
>>>         dev->macaddr);
>>> }
>>>
>>> and I see this message:
>>>
>>> [   15.000000] ASIC revision: 76120044
>>> [   15.000000] mt76pci 0000:01:00.0: Invalid MAC address
>>> ff:ff:ff:ff:ff:ff
>>> [   15.000000] mt76pci 0000:01:00.0: Using random address
>>> ca:a8:87:d8:65:45
>>> [   15.320000] ROM patch already applied
>>> [   15.330000] Firmware Version: 0.0.00
>>> [   15.330000] Build: 1
>>> [   15.330000] Build Time: 201406241830____
>>> [   15.360000] Firmware running!
>>> [   15.370000] pci device driver attached
>>>
>>>
>>> [1] https://github.com/openwrt/mt76/blob/master/eeprom.c
>>>
>>> 2015-02-04 17:56 GMT+01:00 John Crispin <blogic@openwrt.org>:
>>>
>>>>
>>>>
>>>> On 04/02/2015 17:08, Roger Pueyo Centelles wrote:
>>>> > Hi,
>>>> >
>>>> >
>>>> >
>>>> > 2015-02-04 12:44 GMT+01:00 Chuanhong Guo <gch981213@gmail.com
>>>> > <mailto:gch981213@gmail.com>>:
>>>> >
>>>> >     From: 郭传鈜 <gch981213@gmail.com <mailto:gch981213@gmail.com>>
>>>> >
>>>> >     2ghz should be disabled on this router.
>>>> >
>>>> >
>>>> > You're right. This should be patched.
>>>> >
>>>> >
>>>> >     And I think 'mediatek,mtd-eeprom' should be defined as<&factory
>>>> >     32768> instead of <&factory 0x8000> according to WHR-1166D.dts
>>>> >     Actually I didn't have this router.But I think this is the reason
>>>> >     that the MT7612E radio always gets a random MAC address on this
>>>> router.
>>>> >
>>>> >
>>>> > Both definitions are the same, since 0x8000 hex == 32768 dec.
>>>> >
>>>>
>>>> try 0x8004 as 0x8000 holds the chip id and right after that is where the
>>>> mac is located
>>>>
>>>>
>>>>
>>>>
>>>> >
>>>> >
>>>> >     BTW,Roger,could you please test if this patch can fix the MAC
>>>> >     address problem you told in your mail?
>>>> >
>>>> >
>>>> > I tried both, with equal results.
>>>> >
>>>> >
>>>> >
>>>> >
>>>> > _______________________________________________
>>>> > openwrt-devel mailing list
>>>> > openwrt-devel@lists.openwrt.org
>>>> > https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>>>> >
>>>> _______________________________________________
>>>> openwrt-devel mailing list
>>>> openwrt-devel@lists.openwrt.org
>>>> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>>>>
>>>
>>>
>>> _______________________________________________
>>> openwrt-devel mailing list
>>> openwrt-devel@lists.openwrt.org
>>> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>>>
>>>
>>
>
Roger Pueyo Centelles Feb. 6, 2015, 12:22 p.m. UTC | #12
Hi,

I added some prints to the eeprom.c file and saw that in function:

static int mt76_get_of_eeprom(struct mt76_dev *dev, int len)
{
    int ret = -ENOENT;
#ifdef CONFIG_OF
    struct device_node *np = dev->dev->of_node;
    struct mtd_info *mtd;
    const __be32 *list;
    const char *part;
    phandle phandle;
    int offset = 0;
    int size;
    size_t retlen;

    dev_printk(KERN_INFO, dev->dev, "mt76_get_of_eeprom. Step 0 (before
!np)");

    if (!np)
        return -ENOENT;

    dev_printk(KERN_INFO, dev->dev, "mt76_get_of_eeprom. Step 0 (after
!np)");
[...]

if does not go further than (   if (!np)   ).

Any ideas?



2015-02-04 23:13 GMT+01:00 John Crispin <blogic@openwrt.org>:

>
>
> On 04/02/2015 22:11, Roger Pueyo Centelles wrote:
> > root@OpenWrt:/# hexdump -C /dev/mtd2
> > 00000000  20 76 05 01 64 09 80 01  66 5d ff ff ff ff ff ff  |
> > v..d...f]......|
> > 00000010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
> > |................|
> > 00000020  ff ff ff ff ff ff ff ff  64 09 80 01 66 5c 00 d0
> > |........d...f\..|
> > 00000030  59 60 00 04 22 0c 04 04  ff ff 15 01 55 77 a8 aa
> > |Y`..".......Uw..|
> > 00000040  8c 88 ff ff 0d 00 00 00  00 00 00 00 00 00 ff ff
> > |................|
> > 00000050  ff ff 10 10 10 10 10 10  11 11 11 11 11 11 12 12
> > |................|
> > 00000060  12 12 12 12 12 12 13 13  13 14 14 14 15 15 80 ff
> > |................|
> > 00000070  ff ff 80 ff ff ff 00 f4  ff ff ff ff ff ff ff ff
> > |................|
> > 00000080  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
> > |................|
> > *
> > 000000d0  1e 00 ff ff ff ff ff ff  ff ff ff ff ff ff 08 08
> > |................|
> > 000000e0  06 06 04 00 06 06 04 00  06 06 04 00 06 06 04 00
> > |................|
> > 000000f0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
> > |................|
> > *
> > 00008000  62 76 00 00 64 09 80 01  66 5e 62 76 c3 14 00 00
>
>                          ^^ that is the mac at 0x8004
>
>
>
>
>
> > |bv..d...f^bv....|
> > 00008010  00 00 62 76 c3 14 00 00  00 00 ff ff ff ff ff ff
> > |..bv............|
> > 00008020  ff ff 37 d8 9d 00 60 7f  fd 9b ff ff ff ff ff ff
> > |..7...`.........|
> > 00008030  ff ff ff ff 22 ff 00 20  ff ff 9b 01 00 00 00 00  |...."..
> > ........|
> > 00008040  00 00 ff df 00 82 00 00  00 81 00 00 00 00 e0 01
> > |................|
> > 00008050  00 00 00 00 00 00 84 0a  1a 00 00 00 83 0b 1a 00
> > |................|
> > 00008060  00 00 7a 06 22 82 82 7a  06 22 82 82 78 08 22 82
> > |..z."..z."..x.".|
> > 00008070  82 7e 02 22 82 82 76 16  22 82 82 75 1c 22 82 82
> > |.~."..v."..u."..|
> > 00008080  79 0a 22 82 82 79 0a 22  82 82 7b 06 22 82 82 77
> > |y."..y."..{."..w|
> > 00008090  14 22 82 82 7e 05 22 82  82 79 11 22 82 82 00 1b
> > |."..~."..y."....|
> > 000080a0  c3 c3 c3 c3 00 00 c4 c4  c2 82 c4 c4 c2 82 00 00
> > |................|
> > 000080b0  00 00 c4 c4 c2 00 00 00  00 00 c2 c2 82 82 86 00
> > |................|
> > 000080c0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
> > |................|
> > *
> > 000080f0  ff ff ff ff ff ff ff ff  22 ff ff ff ff ff ff ff
> > |........".......|
> > 00008100  0f ca 74 c5 e8 07 30 3d  01 b0 08 26 00 0e 04 15
> > |..t...0=...&....|
> > 00008110  00 8a 00 40 00 00 00 08  00 9d 08 00 12 c0 00 00
> > |...@............|
> > 00008120  08 20 04 2a 90 00 00 24  01 04 54 08 d0 a0 28 20  |.
> > .*...$..T...( |
> > 00008130  ff ff ff ff ff ff ff 08  ff ff ff ff ff ff 00 00
> > |................|
> > 00008140  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
> > |................|
> > *
> > 000081e0  c0 81 82 c3 04 45 46 07  08 09 ff ff ff ff ff ff
> > |.....EF.........|
> > 000081f0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
> > |................|
> > *
> > 00010000
> >
> > The MACs are there, at 0x4, 0x28 and 0x8004.
> >
> > 2015-02-04 20:29 GMT+01:00 John Crispin <blogic@openwrt.org
> > <mailto:blogic@openwrt.org>>:
> >
> >
> >
> >     On 04/02/2015 20:18, Roger Pueyo Centelles wrote:
> >     > Hi,
> >     >
> >     > I tried with 0x8004 and I also got a random IP address. Actually,
> >     > I changed this block in in eeprom.c (line 571) [1]:
> >
> >     can you do a "hexdump -C /dev/mtd2" and paste the output please ?
> >
> >
>
Chuanhong Guo Feb. 6, 2015, 1:06 p.m. UTC | #13
Sorry I forget another thing.....
It should be :
  pcie-bridge {
        mt76@0,0 {

instead of:
     pcie0 {
        mt76@0,0 {

I'll send another patch later....................

2015-02-06 20:22 GMT+08:00 Roger Pueyo Centelles <rogerpueyo@rogerpueyo.com>
:

> Hi,
>
> I added some prints to the eeprom.c file and saw that in function:
>
> static int mt76_get_of_eeprom(struct mt76_dev *dev, int len)
> {
>     int ret = -ENOENT;
> #ifdef CONFIG_OF
>     struct device_node *np = dev->dev->of_node;
>     struct mtd_info *mtd;
>     const __be32 *list;
>     const char *part;
>     phandle phandle;
>     int offset = 0;
>     int size;
>     size_t retlen;
>
>     dev_printk(KERN_INFO, dev->dev, "mt76_get_of_eeprom. Step 0 (before
> !np)");
>
>     if (!np)
>         return -ENOENT;
>
>     dev_printk(KERN_INFO, dev->dev, "mt76_get_of_eeprom. Step 0 (after
> !np)");
> [...]
>
> if does not go further than (   if (!np)   ).
>
> Any ideas?
>
>
>
> 2015-02-04 23:13 GMT+01:00 John Crispin <blogic@openwrt.org>:
>
>>
>>
>> On 04/02/2015 22:11, Roger Pueyo Centelles wrote:
>> > root@OpenWrt:/# hexdump -C /dev/mtd2
>> > 00000000  20 76 05 01 64 09 80 01  66 5d ff ff ff ff ff ff  |
>> > v..d...f]......|
>> > 00000010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
>> > |................|
>> > 00000020  ff ff ff ff ff ff ff ff  64 09 80 01 66 5c 00 d0
>> > |........d...f\..|
>> > 00000030  59 60 00 04 22 0c 04 04  ff ff 15 01 55 77 a8 aa
>> > |Y`..".......Uw..|
>> > 00000040  8c 88 ff ff 0d 00 00 00  00 00 00 00 00 00 ff ff
>> > |................|
>> > 00000050  ff ff 10 10 10 10 10 10  11 11 11 11 11 11 12 12
>> > |................|
>> > 00000060  12 12 12 12 12 12 13 13  13 14 14 14 15 15 80 ff
>> > |................|
>> > 00000070  ff ff 80 ff ff ff 00 f4  ff ff ff ff ff ff ff ff
>> > |................|
>> > 00000080  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
>> > |................|
>> > *
>> > 000000d0  1e 00 ff ff ff ff ff ff  ff ff ff ff ff ff 08 08
>> > |................|
>> > 000000e0  06 06 04 00 06 06 04 00  06 06 04 00 06 06 04 00
>> > |................|
>> > 000000f0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
>> > |................|
>> > *
>> > 00008000  62 76 00 00 64 09 80 01  66 5e 62 76 c3 14 00 00
>>
>>                          ^^ that is the mac at 0x8004
>>
>>
>>
>>
>>
>> > |bv..d...f^bv....|
>> > 00008010  00 00 62 76 c3 14 00 00  00 00 ff ff ff ff ff ff
>> > |..bv............|
>> > 00008020  ff ff 37 d8 9d 00 60 7f  fd 9b ff ff ff ff ff ff
>> > |..7...`.........|
>> > 00008030  ff ff ff ff 22 ff 00 20  ff ff 9b 01 00 00 00 00  |...."..
>> > ........|
>> > 00008040  00 00 ff df 00 82 00 00  00 81 00 00 00 00 e0 01
>> > |................|
>> > 00008050  00 00 00 00 00 00 84 0a  1a 00 00 00 83 0b 1a 00
>> > |................|
>> > 00008060  00 00 7a 06 22 82 82 7a  06 22 82 82 78 08 22 82
>> > |..z."..z."..x.".|
>> > 00008070  82 7e 02 22 82 82 76 16  22 82 82 75 1c 22 82 82
>> > |.~."..v."..u."..|
>> > 00008080  79 0a 22 82 82 79 0a 22  82 82 7b 06 22 82 82 77
>> > |y."..y."..{."..w|
>> > 00008090  14 22 82 82 7e 05 22 82  82 79 11 22 82 82 00 1b
>> > |."..~."..y."....|
>> > 000080a0  c3 c3 c3 c3 00 00 c4 c4  c2 82 c4 c4 c2 82 00 00
>> > |................|
>> > 000080b0  00 00 c4 c4 c2 00 00 00  00 00 c2 c2 82 82 86 00
>> > |................|
>> > 000080c0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
>> > |................|
>> > *
>> > 000080f0  ff ff ff ff ff ff ff ff  22 ff ff ff ff ff ff ff
>> > |........".......|
>> > 00008100  0f ca 74 c5 e8 07 30 3d  01 b0 08 26 00 0e 04 15
>> > |..t...0=...&....|
>> > 00008110  00 8a 00 40 00 00 00 08  00 9d 08 00 12 c0 00 00
>> > |...@............|
>> > 00008120  08 20 04 2a 90 00 00 24  01 04 54 08 d0 a0 28 20  |.
>> > .*...$..T...( |
>> > 00008130  ff ff ff ff ff ff ff 08  ff ff ff ff ff ff 00 00
>> > |................|
>> > 00008140  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
>> > |................|
>> > *
>> > 000081e0  c0 81 82 c3 04 45 46 07  08 09 ff ff ff ff ff ff
>> > |.....EF.........|
>> > 000081f0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
>> > |................|
>> > *
>> > 00010000
>> >
>> > The MACs are there, at 0x4, 0x28 and 0x8004.
>> >
>> > 2015-02-04 20:29 GMT+01:00 John Crispin <blogic@openwrt.org
>> > <mailto:blogic@openwrt.org>>:
>> >
>> >
>> >
>> >     On 04/02/2015 20:18, Roger Pueyo Centelles wrote:
>> >     > Hi,
>> >     >
>> >     > I tried with 0x8004 and I also got a random IP address. Actually,
>> >     > I changed this block in in eeprom.c (line 571) [1]:
>> >
>> >     can you do a "hexdump -C /dev/mtd2" and paste the output please ?
>> >
>> >
>>
>
>
Roger Pueyo Centelles Feb. 6, 2015, 1:22 p.m. UTC | #14
It works! I'm sending the patch right now! :)

2015-02-06 14:06 GMT+01:00 郭传鈜 <gch981213@gmail.com>:

> Sorry I forget another thing.....
> It should be :
>   pcie-bridge {
>         mt76@0,0 {
>
> instead of:
>      pcie0 {
>         mt76@0,0 {
>
> I'll send another patch later....................
>
> 2015-02-06 20:22 GMT+08:00 Roger Pueyo Centelles <
> rogerpueyo@rogerpueyo.com>:
>
>> Hi,
>>
>> I added some prints to the eeprom.c file and saw that in function:
>>
>> static int mt76_get_of_eeprom(struct mt76_dev *dev, int len)
>> {
>>     int ret = -ENOENT;
>> #ifdef CONFIG_OF
>>     struct device_node *np = dev->dev->of_node;
>>     struct mtd_info *mtd;
>>     const __be32 *list;
>>     const char *part;
>>     phandle phandle;
>>     int offset = 0;
>>     int size;
>>     size_t retlen;
>>
>>     dev_printk(KERN_INFO, dev->dev, "mt76_get_of_eeprom. Step 0 (before
>> !np)");
>>
>>     if (!np)
>>         return -ENOENT;
>>
>>     dev_printk(KERN_INFO, dev->dev, "mt76_get_of_eeprom. Step 0 (after
>> !np)");
>> [...]
>>
>> if does not go further than (   if (!np)   ).
>>
>> Any ideas?
>>
>>
>>
>> 2015-02-04 23:13 GMT+01:00 John Crispin <blogic@openwrt.org>:
>>
>>>
>>>
>>> On 04/02/2015 22:11, Roger Pueyo Centelles wrote:
>>> > root@OpenWrt:/# hexdump -C /dev/mtd2
>>> > 00000000  20 76 05 01 64 09 80 01  66 5d ff ff ff ff ff ff  |
>>> > v..d...f]......|
>>> > 00000010  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
>>> > |................|
>>> > 00000020  ff ff ff ff ff ff ff ff  64 09 80 01 66 5c 00 d0
>>> > |........d...f\..|
>>> > 00000030  59 60 00 04 22 0c 04 04  ff ff 15 01 55 77 a8 aa
>>> > |Y`..".......Uw..|
>>> > 00000040  8c 88 ff ff 0d 00 00 00  00 00 00 00 00 00 ff ff
>>> > |................|
>>> > 00000050  ff ff 10 10 10 10 10 10  11 11 11 11 11 11 12 12
>>> > |................|
>>> > 00000060  12 12 12 12 12 12 13 13  13 14 14 14 15 15 80 ff
>>> > |................|
>>> > 00000070  ff ff 80 ff ff ff 00 f4  ff ff ff ff ff ff ff ff
>>> > |................|
>>> > 00000080  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
>>> > |................|
>>> > *
>>> > 000000d0  1e 00 ff ff ff ff ff ff  ff ff ff ff ff ff 08 08
>>> > |................|
>>> > 000000e0  06 06 04 00 06 06 04 00  06 06 04 00 06 06 04 00
>>> > |................|
>>> > 000000f0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
>>> > |................|
>>> > *
>>> > 00008000  62 76 00 00 64 09 80 01  66 5e 62 76 c3 14 00 00
>>>
>>>                          ^^ that is the mac at 0x8004
>>>
>>>
>>>
>>>
>>>
>>> > |bv..d...f^bv....|
>>> > 00008010  00 00 62 76 c3 14 00 00  00 00 ff ff ff ff ff ff
>>> > |..bv............|
>>> > 00008020  ff ff 37 d8 9d 00 60 7f  fd 9b ff ff ff ff ff ff
>>> > |..7...`.........|
>>> > 00008030  ff ff ff ff 22 ff 00 20  ff ff 9b 01 00 00 00 00  |...."..
>>> > ........|
>>> > 00008040  00 00 ff df 00 82 00 00  00 81 00 00 00 00 e0 01
>>> > |................|
>>> > 00008050  00 00 00 00 00 00 84 0a  1a 00 00 00 83 0b 1a 00
>>> > |................|
>>> > 00008060  00 00 7a 06 22 82 82 7a  06 22 82 82 78 08 22 82
>>> > |..z."..z."..x.".|
>>> > 00008070  82 7e 02 22 82 82 76 16  22 82 82 75 1c 22 82 82
>>> > |.~."..v."..u."..|
>>> > 00008080  79 0a 22 82 82 79 0a 22  82 82 7b 06 22 82 82 77
>>> > |y."..y."..{."..w|
>>> > 00008090  14 22 82 82 7e 05 22 82  82 79 11 22 82 82 00 1b
>>> > |."..~."..y."....|
>>> > 000080a0  c3 c3 c3 c3 00 00 c4 c4  c2 82 c4 c4 c2 82 00 00
>>> > |................|
>>> > 000080b0  00 00 c4 c4 c2 00 00 00  00 00 c2 c2 82 82 86 00
>>> > |................|
>>> > 000080c0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
>>> > |................|
>>> > *
>>> > 000080f0  ff ff ff ff ff ff ff ff  22 ff ff ff ff ff ff ff
>>> > |........".......|
>>> > 00008100  0f ca 74 c5 e8 07 30 3d  01 b0 08 26 00 0e 04 15
>>> > |..t...0=...&....|
>>> > 00008110  00 8a 00 40 00 00 00 08  00 9d 08 00 12 c0 00 00
>>> > |...@............|
>>> > 00008120  08 20 04 2a 90 00 00 24  01 04 54 08 d0 a0 28 20  |.
>>> > .*...$..T...( |
>>> > 00008130  ff ff ff ff ff ff ff 08  ff ff ff ff ff ff 00 00
>>> > |................|
>>> > 00008140  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
>>> > |................|
>>> > *
>>> > 000081e0  c0 81 82 c3 04 45 46 07  08 09 ff ff ff ff ff ff
>>> > |.....EF.........|
>>> > 000081f0  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff
>>> > |................|
>>> > *
>>> > 00010000
>>> >
>>> > The MACs are there, at 0x4, 0x28 and 0x8004.
>>> >
>>> > 2015-02-04 20:29 GMT+01:00 John Crispin <blogic@openwrt.org
>>> > <mailto:blogic@openwrt.org>>:
>>> >
>>> >
>>> >
>>> >     On 04/02/2015 20:18, Roger Pueyo Centelles wrote:
>>> >     > Hi,
>>> >     >
>>> >     > I tried with 0x8004 and I also got a random IP address. Actually,
>>> >     > I changed this block in in eeprom.c (line 571) [1]:
>>> >
>>> >     can you do a "hexdump -C /dev/mtd2" and paste the output please ?
>>> >
>>> >
>>>
>>
>>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
>
>
diff mbox

Patch

diff --git a/target/linux/ramips/dts/XIAOMI-MIWIFI-MINI.dts b/target/linux/ramips/dts/XIAOMI-MIWIFI-MINI.dts
index fda3325..647ecad 100644
--- a/target/linux/ramips/dts/XIAOMI-MIWIFI-MINI.dts
+++ b/target/linux/ramips/dts/XIAOMI-MIWIFI-MINI.dts
@@ -101,7 +101,8 @@ 
 			mt76@0,0 {
 				reg = <0x0000 0 0 0 0>;
 				device_type = "pci";
-				mediatek,mtd-eeprom = <&factory 0x8000>;
+				mediatek,mtd-eeprom = <&factory 32768>;
+				mediatek,2ghz = <0>;
 			};
 		};
 	};