sharpsl_param.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Hardware parameter area specific to Sharp SL series devices
  4. *
  5. * Copyright (c) 2005 Richard Purdie
  6. *
  7. * Based on Sharp's 2.4 kernel patches
  8. */
  9. #include <linux/kernel.h>
  10. #include <linux/module.h>
  11. #include <linux/string.h>
  12. #include <asm/mach/sharpsl_param.h>
  13. #include <asm/memory.h>
  14. /*
  15. * Certain hardware parameters determined at the time of device manufacture,
  16. * typically including LCD parameters are loaded by the bootloader at the
  17. * address PARAM_BASE. As the kernel will overwrite them, we need to store
  18. * them early in the boot process, then pass them to the appropriate drivers.
  19. * Not all devices use all parameters but the format is common to all.
  20. */
  21. #ifdef CONFIG_ARCH_SA1100
  22. #define PARAM_BASE 0xe8ffc000
  23. #define param_start(x) (void *)(x)
  24. #else
  25. #define PARAM_BASE 0xa0000a00
  26. #define param_start(x) __va(x)
  27. #endif
  28. #define MAGIC_CHG(a,b,c,d) ( ( d << 24 ) | ( c << 16 ) | ( b << 8 ) | a )
  29. #define COMADJ_MAGIC MAGIC_CHG('C','M','A','D')
  30. #define UUID_MAGIC MAGIC_CHG('U','U','I','D')
  31. #define TOUCH_MAGIC MAGIC_CHG('T','U','C','H')
  32. #define AD_MAGIC MAGIC_CHG('B','V','A','D')
  33. #define PHAD_MAGIC MAGIC_CHG('P','H','A','D')
  34. struct sharpsl_param_info sharpsl_param;
  35. EXPORT_SYMBOL(sharpsl_param);
  36. void sharpsl_save_param(void)
  37. {
  38. struct sharpsl_param_info *params = param_start(PARAM_BASE);
  39. memcpy(&sharpsl_param, params, sizeof(*params));
  40. if (sharpsl_param.comadj_keyword != COMADJ_MAGIC)
  41. sharpsl_param.comadj=-1;
  42. if (sharpsl_param.phad_keyword != PHAD_MAGIC)
  43. sharpsl_param.phadadj=-1;
  44. if (sharpsl_param.uuid_keyword != UUID_MAGIC)
  45. sharpsl_param.uuid[0]=-1;
  46. if (sharpsl_param.touch_keyword != TOUCH_MAGIC)
  47. sharpsl_param.touch_xp=-1;
  48. if (sharpsl_param.adadj_keyword != AD_MAGIC)
  49. sharpsl_param.adadj=-1;
  50. }