Merge "[Feature][ZXW-237]merge 4Gb DDR patch"
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
index afc3bd8..f2e0216 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
+++ b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
@@ -432,6 +432,9 @@
#OEMAPP_CFG value:"PLATFORM","GSW"
MOBILETEK_OEMAPP_CFG = "PLATFORM"
+#cz.li@20240221 add for choosing GNSS's chip: "HD","HX"
+MOBILETEK_GNSS_TYPE = "HD"
+
LYNQ_CONFIG_COMMITID = "e2a3410390ff0ad762462ccb6af8faa5e16dcd61"
LYNQ_CONFIG_VERSION = "T106_ap_version_cap_0425"
LYNQ_CONFIG_SW_VERSION = "T106_ap_version_MR3.02b06.00"
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-gnss/liblynq-qser-gnss.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-gnss/liblynq-qser-gnss.bb
index 8dcdfb7..e55271a 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-gnss/liblynq-qser-gnss.bb
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-gnss/liblynq-qser-gnss.bb
@@ -17,12 +17,12 @@
BB_INCLUDE_ADD = "--sysroot=${STAGING_DIR_HOST}"
BB_LDFLAGS_ADD = "--sysroot=${STAGING_DIR_HOST} -Wl,--hash-style=gnu"
+EXTRA_OEMAKE += "'MOBILETEK_GNSS_TYPE = ${MOBILETEK_GNSS_TYPE}'"
+
+EXTRA_OEMAKE += "'TARGET_PLATFORM = ${TARGET_PLATFORM}'"
+
FILES_${PN} += "${bindir} /data/gnss_update"
-
-EXTRA_OEMAKE = "'TARGET_PLATFORM = ${TARGET_PLATFORM}'"
-
FILES_${PN} += "${base_libdir}/*.so "
-
FILES_${PN}-dev = "/test \
${includedir}"
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_gnss_internal.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_gnss_internal.h
index bb24b17..5ae667a 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_gnss_internal.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_gnss_internal.h
@@ -278,7 +278,6 @@
static int firmware_extren_state = 0;
static char g_no_sv = 0;// 参与定位的卫星数量
-extern int gpio21_value;
int mopen_gnss_get_nmea_config(uint32 h_gnss);
int mopen_gnss_get_ant_state_info(uint32 h_gnss);
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/makefile b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/makefile
index 8ab6383..174c713 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/makefile
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/makefile
@@ -11,6 +11,13 @@
ifeq ($(strip $(TARGET_PLATFORM)), T106)
LOCAL_CFLAGS += -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL -DHAVE_MEMSET16 -DHAVE_MEMSET32 -DANDROID_SMP=0
endif
+
+ifeq ($(strip $(MOBILETEK_GNSS_TYPE)), HD)
+ LOCAL_CFLAGS += -DHD_GNSS
+else ifeq ($(strip $(MOBILETEK_GNSS_TYPE)), HX)
+ LOCAL_CFLAGS += -DHX_GNSS
+endif
+
$(warning lynq qser gnss demo ROOT = $(ROOT), includedir = $(includedir))
LOCAL_PATH = .
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/lynq_qser_gnss.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/lynq_qser_gnss.cpp
index c879eb5..f769e44 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/lynq_qser_gnss.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/lynq_qser_gnss.cpp
@@ -53,8 +53,7 @@
{
ALOGE("Init faild\n");
}
- if(gpio21_value == 1)
- {
+#ifdef HD_GNSS
login_information_t = (login_information*)malloc(sizeof(struct login_information));
if(NULL == login_information_t)
{
@@ -69,7 +68,7 @@
login_information_t->host = NULL;
login_information_t->id = NULL;
login_information_t->password = NULL;
- }
+#endif
inited = 1;
return 0;
}
@@ -210,23 +209,19 @@
g_gnss_sync_done = 0;
lynq_open_gps(1);
- ALOGE("GNSS_VALUE: %d\n",gpio21_value);
- if(gpio21_value == 1)
- {
+#if defined(HD_GNSS)
ret = set_baudrate(gnss_handle->dev_fd, B115200);
if(-1 == ret)
{
return -2;
}
- }
- else if(gpio21_value == 0)
- {
+#elif defined(HX_GNSS)
ret = set_baudrate(gnss_handle->dev_fd, B9600);
if(-1 == ret)
{
return -2;
}
- }
+#endif
return 0;
}
@@ -433,22 +428,19 @@
ALOGE("has not been initiated\n");
return -1;
}
- if(gpio21_value == 0)
- {
- ret = mopen_gnss_download_tle();
- if(ret < 0)
- {
- return -1;
- }
- }
- else if(gpio21_value == 1)
- {
+#if defined(HD_GNSS)
ret = hd_gnss_download_tle(login_information_t->host, login_information_t->id, login_information_t->password);
if(ret < 0)
{
return -1;
}
- }
+#elif defined(HX_GNSS)
+ ret = mopen_gnss_download_tle();
+ if(ret < 0)
+ {
+ return -1;
+ }
+#endif
return 0;
}
@@ -470,22 +462,20 @@
ALOGE("has not been initiated\n");
return -1;
}
- if(gpio21_value == 0)
- {
- ret = mopen_gnss_injects_aidpos(h_gnss);
- if(ret < 0)
- {
- return -1;
- }
- }
- else if(gpio21_value == 1)
- {
+#if defined(HD_GNSS)
ret = hd_gnss_injects_aidpos(h_gnss);
if(ret < 0)
{
return -1;
}
- }
+#elif defined(HX_GNSS)
+ ret = mopen_gnss_injects_aidpos(h_gnss);
+ if(ret < 0)
+ {
+ return -1;
+ }
+#endif
+
return 0;
}
@@ -680,22 +670,19 @@
return -1;
}
lynq_open_gps(1);
- if(gpio21_value == 1)
- {
+ #if defined(HD_GNSS)
ret = set_baudrate(tty_fd, B115200);
if(-1 == ret)
{
return -2;
}
- }
- else if(gpio21_value == 0)
- {
+ #elif defined(HX_GNSS)
ret = set_baudrate(tty_fd, B9600);
if(-1 == ret)
{
return -2;
}
- }
+ #endif
}
else
{
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_gnss.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_gnss.cpp
index 90a5521..fd0b9be 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_gnss.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_gnss.cpp
@@ -514,8 +514,11 @@
//set system time.
if (g_gnss_sync_enable_flag == 1 && g_gnss_sync_done == 0)
{
-
- location = (gpio21_value == 0?17:18);
+ #if defined(HD_GNSS)
+ location = 18;
+ #elif defined(HX_GNSS)
+ location = 17;
+ #endif
if(strncmp(data+3,NMEA_RMC,strlen(NMEA_RMC)) == 0 && data[location] == 'A')
{
if (update_system_time(nmea_info.timestamp) == 0)
@@ -922,18 +925,9 @@
return -1;
}
-int gpio21_value = -1;
int lynq_open_gps(int state)
{
int ret;
- /*when in Eur,GPIO21 value is 1; in CN,GPIO21 value is 0. so use it to determined CN or Eur*/
- test_gpio_handle[21] = sc_gpio_init(21,0,0,0);
- ret = sc_gpio_value_get(test_gpio_handle[21],&gpio21_value);
- if(ret)
- {
- ALOGE("gpio21 value get error\n");
- }
-
/*in Eur,need set GPIO15 and 84 value; in CN,need set GPIO86 value*/
if(0 == state)
{
@@ -947,8 +941,7 @@
usleep(10000);
}
- if(gpio21_value == 1)
- {
+ #if defined(HD_GNSS)
test_gpio_handle[15] = sc_gpio_init(15,1,0,0);
test_gpio_handle[84] = sc_gpio_init(84,1,0,0);
ret = sc_gpio_value_set(test_gpio_handle[15],0);
@@ -962,25 +955,21 @@
{
ALOGE("gpio84 set value 0 error\n");
}
- }
-
- else if(gpio21_value == 0)
- {
+ #elif defined(HX_GNSS)
test_gpio_handle[86] = sc_gpio_init(86,1,0,0);
ret = sc_gpio_value_set(test_gpio_handle[86],0);
if(ret)
{
ALOGE("gpio86 set value 0 error\n");
}
- }
+ #endif
}
else if(1 == state)
{
nmea_state = 1;
- if(gpio21_value == 1)
- {
+ #if defined(HD_GNSS)
test_gpio_handle[15] = sc_gpio_init(15,1,0,0);
test_gpio_handle[84] = sc_gpio_init(84,1,0,0);
ret = sc_gpio_value_set(test_gpio_handle[15],1);
@@ -994,32 +983,25 @@
{
ALOGE("gpio84 set value 1 error\n");
}
- }
- else if(gpio21_value == 0)
- {
+ #elif defined(HX_GNSS)
test_gpio_handle[86] = sc_gpio_init(86,1,0,0);
ret = sc_gpio_value_set(test_gpio_handle[86],1);
if(ret)
{
ALOGE("gpio86 set value 1 error\n");
}
- }
+ #endif
}
- sc_gpio_uninit(test_gpio_handle[21]);
- test_gpio_handle[21] = NULL;
- if(gpio21_value == 1)
- {
+ #if defined(HD_GNSS)
sc_gpio_uninit(test_gpio_handle[15]);
sc_gpio_uninit(test_gpio_handle[84]);
test_gpio_handle[15] = NULL;
test_gpio_handle[84] = NULL;
- }
- else if(gpio21_value == 0)
- {
+ #elif defined(HX_GNSS)
sc_gpio_uninit(test_gpio_handle[86]);
test_gpio_handle[86] = NULL;
- }
+ #endif
return 0;
}
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c
index 5d3f1d4..556f9c4 100644
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.c
@@ -1392,17 +1392,30 @@
/*jb.qi add for gamc power down on 20231116 end */
/*zw.wang add for switching the primary/secondary mode of gmac on 20240118 start*/
-int mode_type = -1;
+static int mode_type = -1;
+static int enter_only_one = 0;
ssize_t gmac_master_or_slave_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct net_device *ndev = platform_get_drvdata(pdev);
- struct zx29_gmac_dev *priv = (struct zx29_gmac_dev *)netdev_priv(ndev);
int mmd = 0;
int reg = 0;
int val = 0;
int ret;
+ struct platform_device *pdev = to_platform_device(dev);
+ if(!pdev){
+ printk(KERN_ERR "%s : %s pdev : %x \n", __func__, __LINE__, pdev);
+ return -1;
+ }
+ struct net_device *ndev = platform_get_drvdata(pdev);
+ if(!ndev){
+ printk(KERN_ERR "%s : %s ndev : %x \n", __func__, __LINE__, ndev);
+ return -1;
+ }
+ struct zx29_gmac_dev *priv = (struct zx29_gmac_dev *)netdev_priv(ndev);
+ if(!priv){
+ printk(KERN_ERR "%s : %s priv : %x \n", __func__, __LINE__, priv);
+ return -1;
+ }
///read mode_type
ret = sscanf(buf, "%d", &mode_type);
@@ -1456,14 +1469,33 @@
ssize_t gmac_master_or_slave_show(struct device *dev, struct device_attribute *attr, char *buf)
{
- struct platform_device *pdev = to_platform_device(dev);
- struct net_device *ndev = platform_get_drvdata(pdev);
- struct zx29_gmac_dev *priv = (struct zx29_gmac_dev *)netdev_priv(ndev);
int mmd = 0;
int reg = 0;
int val = 0;
int len = 0;
int ret;
+ struct platform_device *pdev = to_platform_device(dev);
+ if(!pdev){
+ printk(KERN_ERR "%s : %s pdev : %x \n", __func__, __LINE__, pdev);
+ return -1;
+ }
+ struct net_device *ndev = platform_get_drvdata(pdev);
+ if(!ndev){
+ printk(KERN_ERR "%s : %s ndev : %x \n", __func__, __LINE__, ndev);
+ return -1;
+ }
+ struct zx29_gmac_dev *priv = (struct zx29_gmac_dev *)netdev_priv(ndev);
+ if(!priv){
+ printk(KERN_ERR "%s : %s priv : %x \n", __func__, __LINE__, priv);
+ return -1;
+ }
+
+ ///Reentrant prevention
+ if(enter_only_one == 1)
+ {
+ return 0;
+ }
+ enter_only_one = 1;
///Read the network master/slave
if (mode_type == 0 || mode_type == 1) {
@@ -1503,7 +1535,7 @@
mdiobus_write(priv->phydev->mdio.bus, priv->phydev->mdio.addr, 0x0e, reg);
mdiobus_write(priv->phydev->mdio.bus, priv->phydev->mdio.addr, 0x0d, 0x4000 | mmd);
mdiobus_write(priv->phydev->mdio.bus, priv->phydev->mdio.addr, 0x0e, BIT(14) | BIT(12));
-
+ msleep(10);
///--Read VCT
mmd = 0x1;
reg = 0x8B02;
@@ -1512,9 +1544,9 @@
mdiobus_write(priv->phydev->mdio.bus, priv->phydev->mdio.addr, 0x0d, 0x4000 | mmd);
val = mdiobus_read(priv->phydev->mdio.bus, priv->phydev->mdio.addr, 0x0e);
printk(KERN_DEBUG "Open status: %s - Short status: %s\n",
- (val & BIT(0)) ? "Open" : "Normal", (val & BIT(1)) ? "Short" : "Normal");
+ (val & BIT(1)) ? "Open" : "Normal", (val & BIT(0)) ? "Short" : "Normal");
sprintf(buf, "Open status: %s\nShort status: %s\n",
- (val & BIT(0)) ? "Open" : "Normal", (val & BIT(1)) ? "Short" : "Normal");
+ (val & BIT(1)) ? "Open" : "Normal", (val & BIT(0)) ? "Short" : "Normal");
reg = 0x8B01;
mdiobus_write(priv->phydev->mdio.bus, priv->phydev->mdio.addr, 0x0d, mmd);
mdiobus_write(priv->phydev->mdio.bus, priv->phydev->mdio.addr, 0x0e, reg);
@@ -1547,6 +1579,7 @@
"3: Set the VCT value view mode \n"
"After the mode is set, the corresponding value can be obtained\n");
}
+ enter_only_one = 0;
return strlen(buf);
}