u-boot_mod icon indicating copy to clipboard operation
u-boot_mod copied to clipboard

Add support for D-Link DAP-1533 (AR7370 aka AR9344 w/o WiFi)

Open Tarask1n opened this issue 8 years ago • 4 comments

  • Add support for MAC address string type 01:02:03:04:05:06
  • Minor bug fix
***************************************
*     U-Boot 1.1.4-59d12316-dirty     *
*          Build: 2017-07-25          *
***************************************

** Warning: bad env CRC, using default,
   use 'saveenv' to save it in FLASH

  BOARD: D-Link DAP-1533
    SOC: AR9344 rev. 2
    CPU: MIPS 74Kc
    RAM: 128 MB DDR2 32-bit CL3-4-4-10
  FLASH: 16 MB Winbond W25Q128
   PCIe: 168C:0030
    MAC: 28:10:72:31:77:15
 CLOCKS: CPU/RAM/AHB/SPI/REF
         550/400/200/ 25/ 40 MHz

Hit any key to stop booting:  0

u-boot> printmac
Current MAC addresses stored in FLASH:
MAC1 at 0x9FFFFFA0: 28:10:72:31:77:15
MAC2 at 0x9FFFFFB4: 28:10:72:31:77:16

u-boot> setmac 28:10:72:31:77:33
** Notice:
   you should always make a backup of your device
           entire FLASH content before making any changes

Executing: erase 0x9FFF0000 +0x10000; cp.b 0x80800000 0x9FFF0000 0x10000

Erase FLASH from 0x9FFF0000 to 0x9FFFFFFF in bank #1
Erasing: #

Erased sectors: 1

Copying to FLASH...
Writing at address: 0x9FFF0000

Done!

u-boot> printmac
Current MAC addresses stored in FLASH:
MAC1 at 0x9FFFFFA0: 28:10:72:31:77:33
MAC2 at 0x9FFFFFB4: 28:10:72:31:77:16

u-boot> setmac 28:10:72:31:77:15
** Notice:
   you should always make a backup of your device
           entire FLASH content before making any changes

Executing: erase 0x9FFF0000 +0x10000; cp.b 0x80800000 0x9FFF0000 0x10000

Erase FLASH from 0x9FFF0000 to 0x9FFFFFFF in bank #1
Erasing: #

Erased sectors: 1

Copying to FLASH...
Writing at address: 0x9FFF0000

Done!

u-boot> printmac
Current MAC addresses stored in FLASH:
MAC1 at 0x9FFFFFA0: 28:10:72:31:77:15
MAC2 at 0x9FFFFFB4: 28:10:72:31:77:16

u-boot>

Tarask1n avatar Jul 26 '17 10:07 Tarask1n

Hello @Tarask1n,

Please, split your changes into device support and string MAC type support. Also, don't introduce other, unrelated changes like the one in README.

Cheers, Piotr

pepe2k avatar Aug 03 '17 13:08 pepe2k

Hi Piotr,

Sorry for delay. Commits split. Readme changes removed. Please check and approve.

Best regards, Taras.

Tarask1n avatar Sep 13 '17 18:09 Tarask1n

The patch for MAC as string support breaks when parsing hex digits A-F. I made it work by adding this kludge which detects ascii bytes larger than '9' (0x39):

(u-boot/board/ar7240/common/common.c line 249) buffer[i] = ((ptr[i*3] << 4 & 0xF0) + (((ptr[i*3] > 0x40) ? 1 : 0) * 0x90)) | (((ptr[i*3 + 1] & 0x0F) + ((ptr[i*3 +1] > 0x40) ? 1 : 0) * 0x09))

and similar for u-boot/common/cmd_custom.c line 38, 39, & 57

e-f-p avatar Sep 26 '17 07:09 e-f-p

Hi e-f-p, Thank you for your remarks. I've fixed them.

***************************************
*     U-Boot 1.1.4-899e7905-dirty     *
*          Build: 2017-10-09          *
***************************************

** Warning: bad env CRC, using default,
   use 'saveenv' to save it in FLASH

  BOARD: D-Link DAP-1533
    SOC: AR9344 rev. 2
    CPU: MIPS 74Kc
    RAM: 128 MB DDR2 32-bit CL3-4-4-10
  FLASH: 8 MB Macronix MX25L64
   PCIe: 168C:0030
    MAC: 28:10:7B:CA:77:15
 CLOCKS: CPU/RAM/AHB/SPI/REF
         550/400/200/ 25/ 40 MHz

Hit any key to stop booting:  0

u-boot> printmac
Current MAC addresses stored in FLASH:
MAC1 at 0x9F7FFFA0: 28:10:7B:CA:77:15
MAC2 at 0x9F7FFFB4: 28:10:7B:CA:77:16

u-boot> setmac 28:10:7B:CA:77:17
** Notice:
   you should always make a backup of your device
           entire FLASH content before making any changes

Executing: erase 0x9F7F0000 +0x10000; cp.b 0x80800000 0x9F7F0000 0x10000

Erase FLASH from 0x9F7F0000 to 0x9F7FFFFF in bank #1
Erasing: #

Erased sectors: 1

Copying to FLASH...
Writing at address: 0x9F7F0000

Done!

u-boot> printmac
Current MAC addresses stored in FLASH:
MAC1 at 0x9F7FFFA0: 28:10:7B:CA:77:17
MAC2 at 0x9F7FFFB4: 28:10:7B:CA:77:16

Tarask1n avatar Oct 09 '17 09:10 Tarask1n

Sorry but this project is no longer maintained.

pepe2k avatar Oct 13 '22 10:10 pepe2k