api_platform-powerpc.c 1.2 KB

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