Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * Hardware parameter area specific to Sharp SL series devices
0004  *
0005  * Copyright (c) 2005 Richard Purdie
0006  *
0007  * Based on Sharp's 2.4 kernel patches
0008  */
0009 
0010 #include <linux/kernel.h>
0011 #include <linux/module.h>
0012 #include <linux/string.h>
0013 #include <asm/mach/sharpsl_param.h>
0014 #include <asm/memory.h>
0015 
0016 /*
0017  * Certain hardware parameters determined at the time of device manufacture,
0018  * typically including LCD parameters are loaded by the bootloader at the
0019  * address PARAM_BASE. As the kernel will overwrite them, we need to store
0020  * them early in the boot process, then pass them to the appropriate drivers.
0021  * Not all devices use all parameters but the format is common to all.
0022  */
0023 #ifdef CONFIG_ARCH_SA1100
0024 #define PARAM_BASE  0xe8ffc000
0025 #define param_start(x)  (void *)(x)
0026 #else
0027 #define PARAM_BASE  0xa0000a00
0028 #define param_start(x)  __va(x)
0029 #endif
0030 #define MAGIC_CHG(a,b,c,d) ( ( d << 24 ) | ( c << 16 )  | ( b << 8 ) | a )
0031 
0032 #define COMADJ_MAGIC    MAGIC_CHG('C','M','A','D')
0033 #define UUID_MAGIC  MAGIC_CHG('U','U','I','D')
0034 #define TOUCH_MAGIC MAGIC_CHG('T','U','C','H')
0035 #define AD_MAGIC    MAGIC_CHG('B','V','A','D')
0036 #define PHAD_MAGIC  MAGIC_CHG('P','H','A','D')
0037 
0038 struct sharpsl_param_info sharpsl_param;
0039 EXPORT_SYMBOL(sharpsl_param);
0040 
0041 void sharpsl_save_param(void)
0042 {
0043     struct sharpsl_param_info *params = param_start(PARAM_BASE);
0044 
0045     memcpy(&sharpsl_param, params, sizeof(*params));
0046 
0047     if (sharpsl_param.comadj_keyword != COMADJ_MAGIC)
0048         sharpsl_param.comadj=-1;
0049 
0050     if (sharpsl_param.phad_keyword != PHAD_MAGIC)
0051         sharpsl_param.phadadj=-1;
0052 
0053     if (sharpsl_param.uuid_keyword != UUID_MAGIC)
0054         sharpsl_param.uuid[0]=-1;
0055 
0056     if (sharpsl_param.touch_keyword != TOUCH_MAGIC)
0057         sharpsl_param.touch_xp=-1;
0058 
0059     if (sharpsl_param.adadj_keyword != AD_MAGIC)
0060         sharpsl_param.adadj=-1;
0061 }
0062 
0063