507-MIPS-ath79-prom-add-myloader-support.patch 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. --- a/arch/mips/ath79/prom.c
  2. +++ b/arch/mips/ath79/prom.c
  3. @@ -19,6 +19,7 @@
  4. #include <asm/bootinfo.h>
  5. #include <asm/addrspace.h>
  6. #include <asm/fw/fw.h>
  7. +#include <asm/fw/myloader/myloader.h>
  8. #include "common.h"
  9. @@ -32,10 +33,44 @@ static void __init ath79_prom_append_cmd
  10. strlcat(arcs_cmdline, ath79_cmdline_buf, sizeof(arcs_cmdline));
  11. }
  12. +static int __init ath79_prom_init_myloader(void)
  13. +{
  14. + struct myloader_info *mylo;
  15. + char mac_buf[32];
  16. + unsigned char *mac;
  17. +
  18. + mylo = myloader_get_info();
  19. + if (!mylo)
  20. + return 0;
  21. +
  22. + switch (mylo->did) {
  23. + case DEVID_COMPEX_WP543:
  24. + ath79_prom_append_cmdline("board", "WP543");
  25. + break;
  26. + case DEVID_COMPEX_WPE72:
  27. + ath79_prom_append_cmdline("board", "WPE72");
  28. + break;
  29. + default:
  30. + pr_warn("prom: unknown device id: %x\n", mylo->did);
  31. + return 0;
  32. + }
  33. +
  34. + mac = mylo->macs[0];
  35. + snprintf(mac_buf, sizeof(mac_buf), "%02x:%02x:%02x:%02x:%02x:%02x",
  36. + mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
  37. +
  38. + ath79_prom_append_cmdline("ethaddr", mac_buf);
  39. +
  40. + return 1;
  41. +}
  42. +
  43. void __init prom_init(void)
  44. {
  45. const char *env;
  46. + if (ath79_prom_init_myloader())
  47. + return;
  48. +
  49. fw_init_cmdline();
  50. env = fw_getenv("ethaddr");