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

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