Merge "[Feature][ZXW-262][ecall] support ecall, set ecall audio driver switch default value from 0 to 1"
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-atcid/lynq_atsvc_plugin.xml b/cap/zx297520v3/src/lynq/framework/lynq-atcid/lynq_atsvc_plugin.xml
index f774aaa..357941c 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-atcid/lynq_atsvc_plugin.xml
+++ b/cap/zx297520v3/src/lynq/framework/lynq-atcid/lynq_atsvc_plugin.xml
@@ -6,7 +6,7 @@
/>
<module name="/lib/liblynq-qser-gnss.so"
register="lynq_register_gnss"
- cmd="AT+CGPS;AT+CGPSNMEA"
+ cmd="AT+CGPS;AT+CGPSNMEA;AT+NAVSAT;AT+GNSSVER"
/>
<module name="/lib/liblynq-at-common.so"
register="lynq_register_at_common"
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 5ae667a..c6486d8 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
@@ -202,6 +202,38 @@
char nmea_ver[4];
};
+static const char *enableMask[]=
+ {
+ "GPS L1",
+ "GLONASS G1",
+ "BEIDOU B1",
+ "",
+ "GALILEO E1",
+ "QZSS L1",
+ "SBAS L1",
+ "IRNSS L5",
+ "GPS L1C",
+ "GPS L5",
+ "GPS L2C",
+ "",
+ "",
+ "GLONASS G2",
+ "BEIDOU B1C",
+ "BEIDOU B2A",
+ "BEIDOU B3I",
+ "BEIDOU B5",
+ "BEIDOU B2",
+ "",
+ "GALILEO E5A",
+ "GALILEO E5B",
+ "GALILEO E6",
+ "",
+ "QZSS L6",
+ "QZSS L1C",
+ "QZSS L5",
+ "QZSS L2C"
+ };
+
#ifdef DEBUG
#define gnss_log(...) printf(__VA_ARGS__)
#else
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 e2e4833..c976162 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
@@ -45,7 +45,7 @@
int g_gnss_sync_enable_flag = 0;
int g_gnss_sync_done = 0;
int inited = 0;
-
+int event = 0;
int qser_Gnss_Init(uint32_t *h_gnss)
{
ret = lynq_gnss_client_init(h_gnss);
@@ -472,10 +472,10 @@
int lynq_at_cgps(int at_type,int gnss_state_type);
int lynq_at_cgpsnmea(int at_type,int gnss_state_type);
lynq_atsvc_outcb atsvc_gnss_outcb;
+uint32_t h_gnss;
int at_gps_status = 0;
int at_gpsnmea_status = 0;
int pthread_state = 1;
-int tty_fd = -1;
int device_fd = -1;
int strUpper(char * str)
@@ -520,45 +520,77 @@
int gps_channel_init()
{
int ret = 0;
- tty_fd = open("/dev/ttyS2", O_RDWR);
- ALOGD("tty_fd:%d\n",tty_fd);
- if (tty_fd == -1)
- {
- ALOGE("Failed to open serial port\n");
- return -1;
- }
device_fd = open("/dev/armps_rpmsgch30", O_RDWR);//30 is AT-channel;31 is modem-channel
ALOGD("device_fd:%d\n",device_fd);
if (device_fd == -1)
{
ALOGE("Failed to open device file\n");
- close(tty_fd);
return -1;
}
ret = channel_config(device_fd);
if(ret < 0)
{
- close(tty_fd);
close(device_fd);
return -1;
}
return 0;
}
-void read_gps_data()
+time_t start;
+time_t end;
+int lynq_at_navsat(uint32_t h_gnss)
{
- char gnss_buf[256];
- while (at_gpsnmea_status)
+ struct mbtk_gnss_handle_t *gnss_handle = (struct mbtk_gnss_handle_t *)h_gnss;
+ event = 1;
+ char send_buf[] = {0xF1,0xD9,0x06,0x0C,0x00,0x00,0x12,0x3C};
+ ret = write(gnss_handle->dev_fd, send_buf, sizeof(send_buf));
+ if(ret < 0)
{
- bzero(gnss_buf,256);
- ssize_t gnss_lenth = read(tty_fd, gnss_buf, sizeof(gnss_buf));
- if (gnss_lenth > 0)
+ ALOGE("send navsat faild");
+ return -1;
+ }
+ time(&start);
+ while(event)
+ {
+ usleep(500000);
+ time(&end);
+ if(difftime(end,start) > 2)
{
- write(device_fd, gnss_buf, gnss_lenth);
+ return -1;
}
}
- pthread_state = 0;
- return;
+
+ return 0;
+}
+
+int lynq_at_gnssver(uint32_t h_gnss)
+{
+ struct mbtk_gnss_handle_t *gnss_handle = (struct mbtk_gnss_handle_t *)h_gnss;
+ event = 2;
+ char send_buf[] = {0xF1,0xD9,0x0A,0x04,0x00,0x00,0x0E,0x34};
+ ret = write(gnss_handle->dev_fd, send_buf, sizeof(send_buf));
+ if(ret < 0)
+ {
+ ALOGE("send gnssver faild");
+ return -1;
+ }
+ time(&start);
+ while(event)
+ {
+ usleep(500000);
+ time(&end);
+ if(difftime(end,start) > 2)
+ {
+ return -1;
+ }
+ }
+ return 0;
+}
+
+void at_callback(uint32_t h_loc,e_msg_id_t e_msg_id,void *pv_data,void *context_ptr)
+{
+ mopen_gnss_nmea_info_t *pt_nmea = (mopen_gnss_nmea_info_t *)pv_data;
+ write(device_fd, pt_nmea->nmea, strlen(pt_nmea->nmea));
}
int gnss_at_cmd_parse(char *cmd,char *parse_cmd,int* gnss_state_type,int* at_type)
@@ -647,9 +679,7 @@
}
if (at_gps_status == 0)
{
- lynq_open_gps(0);
- close(device_fd);
- close(tty_fd);
+ qser_Gnss_Deinit(h_gnss);
}
else if(at_gps_status == 1)
{
@@ -658,20 +688,8 @@
{
return -1;
}
- lynq_open_gps(1);
- #if defined(HD_GNSS)
- ret = set_baudrate(tty_fd, B115200);
- if(-1 == ret)
- {
- return -2;
- }
- #elif defined(HX_GNSS)
- ret = set_baudrate(tty_fd, B9600);
- if(-1 == ret)
- {
- return -2;
- }
- #endif
+ qser_Gnss_Init(&h_gnss);
+ qser_AddRxIndMsgHandler(&at_callback,h_gnss);
}
else
{
@@ -715,21 +733,11 @@
if (at_gpsnmea_status == 0)
{
- ALOGD("gpsnmea_status = %d\n",at_gpsnmea_status);
- for(int i = 0;i < 20;i++)
- {
- if(pthread_state == 0)
- {
- ALOGD("pthread down\n");
- sleep(1);
- break;
- }
- }
+ qser_Gnss_Stop(h_gnss);
}
else if(at_gpsnmea_status == 1)
{
- ALOGE("gpsnmea_status = %d\n",at_gpsnmea_status);
- pthread_create(&thread, NULL, read_gps_data, NULL);
+ qser_Gnss_Start(h_gnss);
}
else
@@ -747,7 +755,6 @@
int res = 0;
int income_at_type = 0;
int gnss_state_type = -1;
- //char at_cmd[128]={0};
char gnss_at_cmd[64] = {0};
char parse_atcmd[128] = {0};
if(NULL == input)
@@ -786,6 +793,26 @@
return;
}
}
+ else if (!strcmp(parse_atcmd, "AT+NAVSAT"))
+ {
+ res = lynq_at_navsat(h_gnss);
+ if (res != 0)
+ {
+ sprintf(gnss_at_cmd,"+CME ERROR: 100\r\n");
+ atsvc_gnss_outcb(gnss_at_cmd,strlen(gnss_at_cmd),0);
+ return;
+ }
+ }
+ else if (!strcmp(parse_atcmd, "AT+GNSSVER"))
+ {
+ res = lynq_at_gnssver(h_gnss);
+ if (res != 0)
+ {
+ sprintf(gnss_at_cmd,"+CME ERROR: 100\r\n");
+ atsvc_gnss_outcb(gnss_at_cmd,strlen(gnss_at_cmd),0);
+ return;
+ }
+ }
sprintf(gnss_at_cmd,"OK\r\n");
atsvc_gnss_outcb(gnss_at_cmd,strlen(gnss_at_cmd),0);
return;
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 0bb8d1f..d4b774f 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
@@ -29,7 +29,8 @@
extern long timezone;
extern int g_gnss_sync_enable_flag;
extern int g_gnss_sync_done;
-
+extern int event;
+extern int device_fd;
typedef int (*sc_rtc_time_get_cb)(unsigned int src_id, unsigned long ulsec);
extern int sc_rtc_timer_init(void);
extern int sc_rtc_timer_uninit(void);
@@ -37,7 +38,6 @@
extern int sc_cfg_get(char *name, char* buf, int bufLen);
extern int sc_cfg_set (char *name, char *value);
-
static inline int update_system_time(time_t timestamp)
{
struct timeval tv;
@@ -81,6 +81,22 @@
return ret;
}
+void navsat(char *data,char *result)
+{
+ int nav_info = *((int*)(data+6));
+ for (int i = 0; i < 28; i++)
+ {
+ if ((nav_info & (1 << i)) != 0)
+ {
+ if (strlen(result) > 0)
+ {
+ strcat(result, "+");
+ }
+ strcat(result, enableMask[i]);
+ }
+ }
+}
+
struct mbtk_gnss_handle_t
{
int dev_fd;
@@ -501,11 +517,11 @@
nmea_info.length = data_len;
memcpy(nmea_info.nmea, data, data_len);
//gnss_log("nmea:[%d] %s", data_len, data);
- if( handle->mode == 3 && nmea_info.timestamp &&handle->gnss_handler_func)
+ if(handle->gnss_handler_func)//handle->mode == 3 && nmea_info.timestamp &&
{
handle->gnss_handler_func((uint32)handle, E_MT_LOC_MSG_ID_NMEA_INFO, &nmea_info, NULL);
}
- if(handle->gnss_handler_func && handle->mode == 1 && mopen_location_info.timestamp && mopen_location_info.flags)
+ else if(handle->mode == 1 && handle->gnss_handler_func && mopen_location_info.timestamp && mopen_location_info.flags)
{
handle->gnss_handler_func((uint32)handle, E_MT_LOC_MSG_ID_LOCATION_INFO, &mopen_location_info, NULL);
@@ -541,45 +557,34 @@
*/
static int get_gnss_from_str(struct mbtk_gnss_handle_t *handle, char *data, int data_len)
{
- char *tail = NULL;
- static int seek = 0;
- // 等待 OK, 如果20条结果没有等到,就异常
- static int reset_count = 0;
- int i = 0, ret = -1;
-
- if (handle->reset_state)
+ if(event)
{
- // 等待 reset 回复的 OK
- if(0 != memcmp(data, "$OK", 3) && reset_count < 20) {
- printf("gnss reset invalid: [%s]\n", data);
- reset_count++;
- return -1;
+ char tar[] = {0xF1,0xD9};
+ char tar2[] = {0x04,0x20};
+ char result[64] = {0};
+ char buf[64];
+ if(strncmp(data,tar,2) == 0 && event == 1)
+ {
+ navsat(data,result);
+ sprintf(buf, "+Navsat:%s\n", result);
+ event = 0;
+ write(device_fd, buf, strlen(buf));
}
- if (reset_count > 19) {
- printf("%s: device reset timeout!!!\n", __FUNCTION__);
- LOGI("%s: device reset timeout!!!\n", __FUNCTION__);
+ else if(strncmp(data,tar2,2) == 0 && event == 2)
+ {
+ sprintf(buf,"+Gnssver:%.11s\n", data+19);//The 19th word of this statement starts with the software version number, which is a total of 11 words
+ event = 0;
+ write(device_fd, buf, strlen(buf));
}
- reset_count = 0;
- gnss_log("reset ok: %s\n", data);
-#if BAUDRATE_115200
- ret = mopen_uart_change(handle->dev_fd, 0);
- if(ret) {
- printf("reset Uart set 115200 error\n");
- }
-#endif
- pthread_mutex_lock(&handle->_cond_mutex);
- handle->reset_state = 0;
- pthread_mutex_unlock(&handle->_cond_mutex);
+ memset(result,0,sizeof(result));
+ memset(buf,0,sizeof(result));
}
if((data[0] == '$' || data[0] == '#') &&
data[data_len - 1] == '\n' &&
data_len < 128) {
process_gnss_callback(handle, data, data_len);
- } else {
- gnss_log("nmea error: %s\n", data);
}
-
return 1;
}
@@ -790,7 +795,6 @@
ret = ring_buffer_dequeue_arr(&gnss_handle->ring_buffer, tmp_arr, i + 1);
if(ret > 0 && 0 == mbtk_gnss_handle->getap_status) {
- // gnss_log("NEMA:[%d] %s", ret, tmp_arr);
get_gnss_from_str(gnss_handle, tmp_arr, ret);
memset(tmp_arr, 0, sizeof(tmp_arr));
} else {
@@ -825,7 +829,6 @@
ret = mopen_gnss_read(gnss_handle->dev_fd, buf, MBTK_UART_RECV_BUFFER_SIZE);
nmea_reading = 0;
if(ret > 0) {
- printf("%s\n",buf);
ring_buffer_queue_arr(&gnss_handle->ring_buffer, buf, ret);
memset(buf, 0, sizeof(buf));
} else {
@@ -942,14 +945,8 @@
}
#if defined(HD_GNSS)
- test_gpio_handle[15] = sc_gpio_init(15,1,0,0);
+ test_gpio_handle[15] = sc_gpio_init(15,0,0,0);
test_gpio_handle[84] = sc_gpio_init(84,1,0,0);
- ret = sc_gpio_value_set(test_gpio_handle[15],0);
- if(ret)
- {
- ALOGE("gpio15 set value 0 error\n");
- }
- usleep(10000);
ret = sc_gpio_value_set(test_gpio_handle[84],0);
if(ret)
{
@@ -970,14 +967,8 @@
{
nmea_state = 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);
- if(ret)
- {
- ALOGE("gpio15 set value 1 error\n");
- }
- usleep(10000);
+ test_gpio_handle[15] = sc_gpio_init(15,0,0,0);
ret = sc_gpio_value_set(test_gpio_handle[84],1);
if(ret)
{
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-uci/lynq_uci.config b/cap/zx297520v3/src/lynq/lib/liblynq-uci/lynq_uci.config
index 7193768..c08d25b 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-uci/lynq_uci.config
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-uci/lynq_uci.config
@@ -14,7 +14,7 @@
config lynq_autosuspend 'lynq_autosuspend'
option auto_enable '0'
option debug '1'
- option whitelist_state '0000'
+ option whitelist_state '1011'
config debug_mode 'debug_mode'
option sysinfo_debug_status '1'
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-vehicle_dc_ref.dts b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-vehicle_dc_ref.dts
index b9638e6..4f4e580 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-vehicle_dc_ref.dts
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-vehicle_dc_ref.dts
@@ -164,9 +164,11 @@
&gmac {
port-nums = <1>;
rmii-ports = <1>;
-
+//zw.wang phy driver support for Marvell_88q1110 on 20240417 start
gpios = <&bgpio 83 GPIO_ACTIVE_HIGH>,
- <&bgpio 63 GPIO_ACTIVE_HIGH>;
+ <&bgpio 63 GPIO_ACTIVE_HIGH>,
+ <&bgpio 51 GPIO_ACTIVE_HIGH>;
+//zw.wang phy driver support for Marvell_88q1110 on 20240417 end
status = "okay";
};
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3.dtsi b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3.dtsi
index b4124b6..92e4177 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3.dtsi
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3.dtsi
@@ -529,10 +529,12 @@
interrupts = <GIC_SPI GMAC_INT IRQ_TYPE_LEVEL_HIGH>;
phy-mode = "rmii";
port-mask = <0x00000000>;
- pinctrl-names = "default", "sleep";
+ //zw.wang phy driver support for Marvell_88q1110 on 20240417 start
+ pinctrl-names = "default", "sleep", "state0";
pinctrl-0 = <&rmii_active>;
pinctrl-1 = <&rmii_sleep>;
-
+ pinctrl-2 = <&rmii_clki_pins>;
+ //zw.wang phy driver support for Marvell_88q1110 on 20240417 end
status = "disabled";
};
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
old mode 100755
new mode 100644
index 9312efe..5dc69f5
--- 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
@@ -491,33 +491,33 @@
struct mdio_device *mdio_dev = NULL;
int ret = 0;
- //zw.wang Without phy, gmac's gpio output power is removed on 20240328 start
- int i = 0;
- for(i = 0;i <= 5;i++)
- {
- if (priv->nports == 1) {
- p = phy_find_first(priv->mii.bus);
- } else if (priv->rmii_port < PHY_MAX_ADDR) {
- mdio_dev = priv->mii.bus->mdio_map[priv->rmii_port];
- p = container_of(mdio_dev, struct phy_device, mdio);
- }
-
- if (!p) {
- if(i == 5){
- gpio_direction_output(priv->gpio_power[0], 0);
-#ifdef CONFIG_MDIO_C45
- gpio_direction_output(priv->gpio_power[1], 0);
-#endif
- }
- else
- continue;
- printk("%s: no PHY found\n", dev->name);
- return -ENODEV;
- }
- else
- break;
- }
- //zw.wang Without phy, gmac's gpio output power is removed on 20240328 end
+ //zw.wang Without phy, gmac's gpio output power is removed on 20240328 start
+ int i = 0;
+ for(i = 0;i <= 5;i++)
+ {
+ if (priv->nports == 1) {
+ p = phy_find_first(priv->mii.bus);
+ } else if (priv->rmii_port < PHY_MAX_ADDR) {
+ mdio_dev = priv->mii.bus->mdio_map[priv->rmii_port];
+ p = container_of(mdio_dev, struct phy_device, mdio);
+ }
+
+ if (!p) {
+ if(i == 5){
+ gpio_direction_output(priv->gpio_power[0], 0);
+#ifdef CONFIG_MDIO_C45
+ gpio_direction_output(priv->gpio_power[1], 0);
+#endif
+ }
+ else
+ continue;
+ printk("%s: no PHY found\n", dev->name);
+ return -ENODEV;
+ }
+ else
+ break;
+ }
+ //zw.wang Without phy, gmac's gpio output power is removed on 20240328 end
ret = phy_connect_direct(dev, p, zx29_gmac_adjust_link, PHY_INTERFACE_MODE_RMII); /* phy_start_machine */
/* supported and advertising */
@@ -879,8 +879,9 @@
static void zx29_gmac_tx_timeout(struct net_device *ndev, unsigned int txqueue)
{
struct zx29_gmac_dev *priv = (struct zx29_gmac_dev *)netdev_priv(ndev);
-
-// genphy_update_link(priv->phydev);
+#ifdef CONFIG_MARVELL_88Q1110 //zw.wang phy driver support for Marvell_88q1110 on 20240417
+ genphy_update_link(priv->phydev);
+#endif
priv->link.isup = priv->phydev->link;
if (0 == priv->link.isup) {
@@ -1159,16 +1160,21 @@
#endif
printk("[%s] netif_running\n", __func__);
-
-
+#ifdef CONFIG_MARVELL_88Q1110 //zw.wang phy driver support for Marvell_88q1110 on 20240417
+ gpio_direction_output(priv->gpio_power[0], 0);
+ gmac_stop((void*)ndev->base_addr);
+#else
gmac_stop((void*)ndev->base_addr);
gpio_direction_output(priv->gpio_power[0], 0);
+#endif
spin_unlock_irqrestore(&priv->lock, flag);
#endif
}
}
+#ifndef CONFIG_MARVELL_88Q1110 //zw.wang phy driver support for Marvell_88q1110 on 20240417
pinctrl_pm_select_sleep_state(&pdev->dev);
+#endif
return 0;
}
@@ -1182,8 +1188,10 @@
void __iomem *base = NULL;
gmac = (unsigned *)ndev->base_addr;
unsigned long flag = 0;
-
+
+#ifndef CONFIG_MARVELL_88Q1110 //zw.wang phy driver support for Marvell_88q1110 on 20240417
pinctrl_pm_select_default_state(&pdev->dev);
+#endif
if(ndev) {
if(netif_running(ndev)) {
// gmac_start((void*)ndev->base_addr);
@@ -1757,8 +1765,12 @@
pctrl = NULL;
goto errirq;
}
-
+
+#ifdef CONFIG_MARVELL_88Q1110 //zw.wang phy driver support for Marvell_88q1110 on 20240417
+ state0 = pinctrl_lookup_state(pctrl, "state0");
+#else
state0 = pinctrl_lookup_state(pctrl, "default");
+#endif
if (IS_ERR(state0)) {
dev_err(&pdev->dev, "TEST: missing state0\n");
goto pinctrl_init_end;
@@ -1768,7 +1780,14 @@
dev_err(&pdev->dev, "setting state0 failed\n");
goto pinctrl_init_end;
}
-
+
+#ifdef CONFIG_MARVELL_88Q1110 //zw.wang phy driver support for Marvell_88q1110 on 20240417
+ prv->gpio_power[2] = of_get_gpio_flags(pdev->dev.of_node, 2, &flags);
+ ret = gpio_request(prv->gpio_power[2], "phy_power"); /* gpio 51 */
+ gpio_direction_output(prv->gpio_power[2], 1);
+ mdelay(15);
+#endif
+
prv->gpio_power[0] = of_get_gpio_flags(pdev->dev.of_node, 0, &flags);
ret = gpio_request(prv->gpio_power[0], "gmac_power"); /* gpio 83/124 */
gpio_direction_output(prv->gpio_power[0], 1);
@@ -1861,7 +1880,11 @@
base = devm_platform_ioremap_resource(pdev, 1);
gmac_phy_release();
base_phy_release = base;
+#ifdef CONFIG_MARVELL_88Q1110 //zw.wang phy driver support for Marvell_88q1110 on 20240417
+ mdelay(500);
+#else
mdelay(10); //zw.wang@20240306 modify. Here, the jl3103 is set as an example, and other phy peripherals need to be optimized according to different reset stability times
+#endif
ret = mdiobus_register(mb);
if (ret < 0) {
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.h b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.h
index 46a87d3..d2abe1e 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/ethernet/zte/zx29_gmac.h
@@ -11,7 +11,11 @@
#ifndef __ZX29_GMAC_
#define __ZX29_GMAC_
-//#define GMAC_NO_INT
+//zw.wang phy driver support for Marvell_88q1110 on 20240417 start
+#ifdef CONFIG_MARVELL_88Q1110
+#define GMAC_NO_INT
+#endif
+//zw.wang phy driver support for Marvell_88q1110 on 20240417 end
#ifdef GMAC_NO_INT
#define GTIMER_INTERVAL 2000
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/Kconfig b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/Kconfig
index a0bf99d..7795b72 100644
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/Kconfig
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/Kconfig
@@ -321,6 +321,14 @@
help
It is disabled by default. The value is C45 if yes, and C22 if N.
# zw.wang Customer chooses phy c22/c45 issues on 20240301 end
+
+# zw.wang phy driver support for Marvell_88q1110 on 20240417 start
+config MARVELL_88Q1110
+ bool "phy driver support for Marvell_88q1110"
+ default n
+ help
+ Phy driver support for Marvell_88q1110.
+# zw.wang phy driver support for Marvell_88q1110 on 20240417 end
endif # PHYLIB
config MICREL_KS8995MA
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/phy_device.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/phy_device.c
index a868814..d9b53ba 100644
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/phy_device.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/net/phy/phy_device.c
@@ -120,6 +120,19 @@
ETHTOOL_LINK_MODE_10000baseT_Full_BIT,
};
+//status = phy_read_cl(phydev, MII_BMSR);
+static int phy_read_cl(struct phy_device *phydev, u32 regnum)
+{
+ int val = 0;
+
+ mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, 0x0d, 1);
+ mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, 0x0e, regnum);
+ mdiobus_write(phydev->mdio.bus, phydev->mdio.addr, 0x0d, 0x4000 | 1);
+ val = mdiobus_read(phydev->mdio.bus, phydev->mdio.addr, 0x0e);
+
+ return val;
+}
+
static void features_init(void)
{
/* 10/100 half/full*/
@@ -2212,8 +2225,11 @@
int genphy_update_link(struct phy_device *phydev)
{
int status = 0, bmcr;
-
+#ifdef CONFIG_MARVELL_88Q1110 //zw.wang phy driver support for Marvell_88q1110 on 20240417
+ bmcr = phy_read_cl(phydev, MII_BMCR);
+#else
bmcr = phy_read(phydev, MII_BMCR);
+#endif
if (bmcr < 0)
return bmcr;
@@ -2229,7 +2245,11 @@
* the link was already down.
*/
if (!phy_polling_mode(phydev) || !phydev->link) {
+#ifdef CONFIG_MARVELL_88Q1110 //zw.wang phy driver support for Marvell_88q1110 on 20240417
+ status = phy_read_cl(phydev, MII_BMSR);
+#else
status = phy_read(phydev, MII_BMSR);
+#endif
if (status < 0)
return status;
else if (status & BMSR_LSTATUS)
@@ -2237,7 +2257,11 @@
}
/* Read link and autonegotiation status */
+#ifdef CONFIG_MARVELL_88Q1110 //zw.wang phy driver support for Marvell_88q1110 on 20240417
+ status = phy_read_cl(phydev, MII_BMSR);
+#else
status = phy_read(phydev, MII_BMSR);
+#endif
if (status < 0)
return status;
done:
@@ -2310,7 +2334,11 @@
*/
int genphy_read_status_fixed(struct phy_device *phydev)
{
+#ifdef CONFIG_MARVELL_88Q1110 //zw.wang phy driver support for Marvell_88q1110 on 20240417
+ int bmcr = phy_read_cl(phydev, MII_BMCR);
+#else
int bmcr = phy_read(phydev, MII_BMCR);
+#endif
if (bmcr < 0)
return bmcr;