Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 79b6422f authored by bozhilin's avatar bozhilin
Browse files

ARFP3-77: Expose main memory hardware revision

Change-Id: I2e5e356c3792f34f29e4def69f7f8d43dd403f61
parent b2c68848
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -84,6 +84,10 @@ extern char qpnp_poff_reason_extern[256];
/*[Arima_8901][bozhi_lin] 20190221 end*/
extern unsigned int cold_boot;

/*[Arima_8901][bozhi_lin] ARFP3-77: Expose main memory hardware revision 20190225 begin*/
extern char ddr_vendor[32];
/*[Arima_8901][bozhi_lin] 20190225 end*/

struct debug_info {
	/* Have we suspended stepping by a debugger? */
	int			suspended_step;

drivers/soc/qcom/socinfo.c

100644 → 100755
+67 −0
Original line number Diff line number Diff line
@@ -1983,6 +1983,67 @@ static void socinfo_select_format(void)
	}
}

/*[Arima_8901][bozhi_lin] ARFP3-77: Expose main memory hardware revision 20190225 begin*/
char ddr_vendor[32] = "";
//BOOT.BF.3.3.2\boot_images\core\api\boot\ddr_common.h
typedef enum
{
  RESERVED_0,                        /**< Reserved for future use. */
  SAMSUNG,                           /**< Samsung. */
  QIMONDA,                           /**< Qimonda. */
  ELPIDA,                            /**< Elpida Memory, Inc. */
  ETRON,                             /**< Etron Technology, Inc. */
  NANYA,                             /**< Nanya Technology Corporation. */
  HYNIX,                             /**< Hynix Semiconductor Inc. */
  MOSEL,                             /**< Mosel Vitelic Corporation. */
  WINBOND,                           /**< Winbond Electronics Corp. */
  ESMT,                              /**< Elite Semiconductor Memory Technology Inc. */
  RESERVED_1,                        /**< Reserved for future use. */
  SPANSION,                          /**< Spansion Inc. */
  SST,                               /**< Silicon Storage Technology, Inc. */
  ZMOS,                              /**< ZMOS Technology, Inc. */
  INTEL,                             /**< Intel Corporation. */
  NUMONYX = 254,                     /**< Numonyx, acquired by Micron Technology, Inc. */
  MICRON = 255,                      /**< Micron Technology, Inc. */
  DDR_MANUFACTURES_MAX = 0x7FFFFFFF  /**< Forces the enumerator to 32 bits. */
} DDR_MANUFACTURES;

//uint32_t smem_get_ddr_manufacturer_id()
void smem_get_ddr_manufacturer_id(unsigned char *buf)
{
	unsigned int *manufacturer_id;
	unsigned int manufacturer_id_len = sizeof(manufacturer_id);

	manufacturer_id = smem_get_entry(SMEM_ID_VENDOR2, &manufacturer_id_len, 0,
							SMEM_ANY_HOST_FLAG);
	if (manufacturer_id == NULL)
	{
		pr_err("[B]%s(%d): Failed to read SMEM_ID_VENDOR2\n", __func__, __LINE__);
	}

	switch(*manufacturer_id)
	{
		case SAMSUNG:
			snprintf((char *)buf, 64, "SAMSUNG");
			break;
		case ELPIDA:
			snprintf((char *)buf, 64, "ELPIDA");
			break;
		case HYNIX:
			snprintf((char *)buf, 64, "HYNIX");
			break;
		case MICRON:
			snprintf((char *)buf, 64, "MICRON");
			break;
		default:
			snprintf((char *)buf, 64, "OTHERS");
			break;
	}

	pr_err("[B]%s(%d): manufacturer_id=%d, %s\n", __func__, __LINE__, *manufacturer_id, buf);
}
/*[Arima_8901][bozhi_lin] 20190225 end*/

int __init socinfo_init(void)
{
	static bool socinfo_init_done;
@@ -2012,6 +2073,12 @@ int __init socinfo_init(void)
	arch_read_hardware_id = msm_read_hardware_id;
	socinfo_init_done = true;

/*[Arima_8901][bozhi_lin] ARFP3-77: Expose main memory hardware revision 20190225 begin*/
	memset(ddr_vendor, 0, sizeof(ddr_vendor));
	smem_get_ddr_manufacturer_id((unsigned char *) ddr_vendor);
	pr_err("[B]%s(%d): ddr_vendor=%s\n", __func__, __LINE__, ddr_vendor);
/*[Arima_8901][bozhi_lin] 20190225 end*/

	return 0;
}
subsys_initcall(socinfo_init);
+36 −0
Original line number Diff line number Diff line
@@ -66,6 +66,9 @@
#include <linux/kexec.h>
#include <linux/bpf.h>
#include <linux/mount.h>
/*[Arima_8901][bozhi_lin] ARFP3-77: Expose main memory hardware revision 20190225 begin*/
#include <soc/qcom/smem.h>
/*[Arima_8901][bozhi_lin] 20190225 end*/

#include <asm/uaccess.h>
#include <asm/processor.h>
@@ -231,6 +234,9 @@ static struct ctl_table dev_table[];
/*[Arima_8901][bozhi_lin] ARFP3-91: Expose power up and power down reason 20190221 begin*/
static struct ctl_table qpnp_power_on_table[];
/*[Arima_8901][bozhi_lin] 20190221 end*/
/*[Arima_8901][bozhi_lin] ARFP3-77: Expose main memory hardware revision 20190225 begin*/
static struct ctl_table ddr_table[];
/*[Arima_8901][bozhi_lin] 20190225 end*/
extern struct ctl_table random_table[];
#ifdef CONFIG_EPOLL
extern struct ctl_table epoll_table[];
@@ -2070,6 +2076,13 @@ static struct ctl_table debug_table[] = {
};

static struct ctl_table dev_table[] = {
/*[Arima_8901][bozhi_lin] ARFP3-77: Expose main memory hardware revision 20190225 begin*/
	{
		.procname	= "ddr",
		.mode		= 0555,
		.child		= ddr_table,
	},
/*[Arima_8901][bozhi_lin] 20190225 end*/
	{ }
};

@@ -2110,6 +2123,29 @@ static struct ctl_table qpnp_power_on_table[] = {
};
/*[Arima_8901][bozhi_lin] 20190221 end*/

/*[Arima_8901][bozhi_lin] ARFP3-77: Expose main memory hardware revision 20190225 begin*/
static struct ctl_table ddr_table[] = {
#if 1
	{
		.procname	= "vendor",
		.data		= &ddr_vendor,
		.maxlen		= 32,
		.mode		= 0444,
		.proc_handler	= proc_dostring,
	},
#else
	{
		.procname	= "vendor",
		.data		= &qpnp_pon_reason_extern,
		.maxlen		= sizeof(int),
		.mode		= 0444,
		.proc_handler	= proc_dointvec,
	},
#endif
	{ }
};
/*[Arima_8901][bozhi_lin] 20190225 end*/

int __init sysctl_init(void)
{
	struct ctl_table_header *hdr;