api_platform-powerpc.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * (C) Copyright 2007 Semihalf
  3. *
  4. * Written by: Rafal Jaworowski <raj@semihalf.com>
  5. *
  6. * SPDX-License-Identifier: GPL-2.0+
  7. *
  8. * This file contains routines that fetch data from PowerPC-dependent sources
  9. * (bd_info etc.)
  10. */
  11. #include <config.h>
  12. #include <linux/types.h>
  13. #include <api_public.h>
  14. #include <asm/u-boot.h>
  15. #include <asm/global_data.h>
  16. #include "api_private.h"
  17. DECLARE_GLOBAL_DATA_PTR;
  18. /*
  19. * Important notice: handling of individual fields MUST be kept in sync with
  20. * include/asm-ppc/u-boot.h and include/asm-ppc/global_data.h, so any changes
  21. * need to reflect their current state and layout of structures involved!
  22. */
  23. int platform_sys_info(struct sys_info *si)
  24. {
  25. si->clk_bus = gd->bus_clk;
  26. si->clk_cpu = gd->cpu_clk;
  27. #if defined(CONFIG_5xx) || defined(CONFIG_MPC8260) || \
  28. defined(CONFIG_E500) || defined(CONFIG_MPC86xx)
  29. #define bi_bar bi_immr_base
  30. #elif defined(CONFIG_MPC5xxx)
  31. #define bi_bar bi_mbar_base
  32. #elif defined(CONFIG_MPC83xx)
  33. #define bi_bar bi_immrbar
  34. #endif
  35. #if defined(bi_bar)
  36. si->bar = gd->bd->bi_bar;
  37. #undef bi_bar
  38. #else
  39. si->bar = 0;
  40. #endif
  41. platform_set_mr(si, gd->bd->bi_memstart, gd->bd->bi_memsize, MR_ATTR_DRAM);
  42. platform_set_mr(si, gd->bd->bi_flashstart, gd->bd->bi_flashsize, MR_ATTR_FLASH);
  43. platform_set_mr(si, gd->bd->bi_sramstart, gd->bd->bi_sramsize, MR_ATTR_SRAM);
  44. return 1;
  45. }