diff --git a/drivers/spi/spi-sunxi.c b/drivers/spi/spi-sunxi.c
old mode 100644
new mode 100755
index 6f60027ac..853323457
--- a/drivers/spi/spi-sunxi.c
+++ b/drivers/spi/spi-sunxi.c
@@ -47,6 +47,9 @@
 #include "spi-sunxi.h"
 #include "spi-slave-protocol.h"
 
+static s8 spi_rx_buf[32];
+static u32 spi_rx_buf_idx;
+
 /* For debug */
 #define SPI_ERR(fmt, arg...)	pr_warn("%s()%d - "fmt, __func__, __LINE__, ##arg)
 
@@ -1805,6 +1808,101 @@ static bool sunxi_spi_can_dma(struct spi_master *master, struct spi_device *spi,
 {
 	return (xfer->len > BULK_DATA_BOUNDARY);
 }
+ssize_t ye_spi_buf_show(struct class *class,
+			     struct class_attribute *attr, char *buf)
+{
+	u32 len = sizeof(spi_rx_buf);
+	u32 i, cnt = 0;
+	u8 *tmp = buf;
+
+	// tmp = kzalloc(len, GFP_KERNEL);
+	if (!tmp)
+		return;
+
+	for (i = 0; i < len; i++) {
+		if (i%HEXADECIMAL == 0)
+			cnt += sprintf(tmp + cnt, "0x%08x: ", i);
+
+		cnt += sprintf(tmp + cnt, "%02x ", spi_rx_buf[i]);
+
+		if ((i%HEXADECIMAL == REG_END) || (i == (len - 1))) {
+			cnt += sprintf(tmp + cnt, "\n");
+		}
+	}
+	cnt += sprintf(tmp + cnt, "\n");
+	// memcpy(buf, tmp, cnt);
+	// kfree(tmp);
+	return cnt;
+}
+
+ssize_t ye_spi_buf_store(struct class *class, struct class_attribute *attr,
+		const char *buf, size_t count)
+{
+	if (count > 32)
+		return -EINVAL;
+
+	memset(spi_rx_buf, 0, sizeof(spi_rx_buf));
+	strncpy(spi_rx_buf, buf, count);
+	return count;
+}
+
+static struct device_data *ye_spi_slave_set_txdata(struct sunxi_spi_slave_head *head)
+{
+	u8 *buf, i;
+	struct device_data *data;
+
+	buf = kzalloc(head->len, GFP_KERNEL);
+	if (IS_ERR_OR_NULL(buf)) {
+		SPI_ERR("failed to alloc mem\n");
+		goto err0;
+	}
+
+	data = kzalloc(sizeof(*data), GFP_KERNEL);
+	if (IS_ERR_OR_NULL(data)) {
+		SPI_ERR("failed to alloc mem\n");
+		goto err1;
+	}
+
+	int arr_len = sizeof(spi_rx_buf);
+	int start_idx = head->addr;
+	int copy_len = head->len;
+	if (arr_len - start_idx > 0 && start_idx <= arr_len && copy_len > 0)
+	{
+		if (start_idx + copy_len > arr_len)
+			copy_len = arr_len - start_idx;
+		
+		for (i = 0; i < head->len; i++)
+		{
+			if (start_idx + i < arr_len)
+				buf[i] = spi_rx_buf[start_idx + i];
+			else
+				buf[i] = 0xFF;
+		}
+	}
+	else
+	{
+		SPI_ERR("old set txdata\n");
+		for (i = 0; i < head->len; i++) 
+		{
+			buf[i] = i + SAMPLE_NUMBER;
+		}
+	}
+	udelay(100);
+
+	dprintk(DEBUG_DATA, "[debugging only] send data:\n");
+	if (debug_mask & DEBUG_DATA)
+		spi_dump_data(buf, head->len);
+
+	data->tx_buf = buf;
+	data->len = head->len;
+
+	return data;
+
+err1:
+	kfree(buf);
+err0:
+	return NULL;
+}
 
 static struct device_data *sunxi_spi_slave_set_txdata(struct sunxi_spi_slave_head *head)
 {
@@ -1852,6 +1950,7 @@ static int sunxi_spi_slave_cpu_tx_config(struct sunxi_spi *sspi)
 
 	dprintk(DEBUG_INFO, "[spi%d] receive pkt head ok\n", sspi->master->bus_num);
 	if (sspi->slave->set_up_txdata) {
+		// YE: 替换了新的set_up_txdata的函数指针
 		sspi->slave->data = sspi->slave->set_up_txdata(sspi->slave->head);
 		if (IS_ERR_OR_NULL(sspi->slave->data)) {
 			SPI_ERR("[spi%d] null data\n", sspi->master->bus_num);
@@ -1885,7 +1984,7 @@ static int sunxi_spi_slave_cpu_tx_config(struct sunxi_spi *sspi)
 	}
 	spin_unlock_irqrestore(&sspi->lock, flags);
 
-	dprintk(DEBUG_INFO, "[spi%d] already send data to fifo\n", sspi->master->bus_num);
+	// dprintk(DEBUG_INFO, "[spi%d] already send data to fifo\n", sspi->master->bus_num);
 
 	/* wait for xfer complete in the isr. */
 	timeout = wait_for_completion_timeout(
@@ -1901,6 +2000,8 @@ static int sunxi_spi_slave_cpu_tx_config(struct sunxi_spi *sspi)
 		goto err;
 	}
 
+	dprintk(DEBUG_INFO, "[spi%d] already send data to fifo\n", sspi->master->bus_num);
+	
 err:
 	spi_clr_irq_pending(SPI_INT_STA_MASK, sspi->base_addr);
 	spi_disable_irq(SPI_INTEN_TC|SPI_INTEN_ERR, sspi->base_addr);
@@ -1948,7 +2049,6 @@ static int sunxi_spi_slave_cpu_rx_config(struct sunxi_spi *sspi)
 		sspi->slave->data->rx_buf[i] =  readb(sspi->base_addr + SPI_RXDATA_REG);
 	}
 
-
 	if (poll_time <= 0) {
 		SPI_ERR("[spi%d] cpu receive pkt head time out!\n", sspi->master->bus_num);
 		spi_reset_fifo(sspi->base_addr);
@@ -1961,9 +2061,23 @@ static int sunxi_spi_slave_cpu_rx_config(struct sunxi_spi *sspi)
 		goto err2;
 	}
 
-	dprintk(DEBUG_DATA, "[debugging only] receive data:\n");
-	if (debug_mask & DEBUG_DATA)
-		spi_dump_data(sspi->slave->data->rx_buf, sspi->slave->data->len);
+	// YE
+	int arr_len = sizeof(spi_rx_buf);
+	int start_idx = sspi->slave->head->addr;
+	int copy_len = sspi->slave->head->len;
+	if ((arr_len - start_idx > 0 && start_idx < arr_len) && copy_len > 0) // 32 - xx
+	{
+		if (start_idx + copy_len > arr_len)
+			copy_len = arr_len - start_idx;
+		
+		memcpy(spi_rx_buf + start_idx, sspi->slave->data->rx_buf, copy_len);
+	}
+	
+	spi_dump_data(spi_rx_buf, arr_len);
+	// dprintk(DEBUG_DATA, "[debugging only] receive data:\n");
+	// // if (debug_mask & DEBUG_DATA)
+	// if (1)
+	// 	spi_dump_data(sspi->slave->data->rx_buf, sspi->slave->data->len);
 
 err2:
 	spi_clr_irq_pending(SPI_INT_STA_MASK, sspi->base_addr);
@@ -1978,6 +2092,7 @@ static int sunxi_spi_slave_cpu_rx_config(struct sunxi_spi *sspi)
 err0:
 	return ret;
 }
+
 static int sunxi_spi_slave_handle_head(struct sunxi_spi *sspi, u8 *buf)
 {
 	struct sunxi_spi_slave_head *head;
@@ -2007,7 +2122,13 @@ static int sunxi_spi_slave_handle_head(struct sunxi_spi *sspi, u8 *buf)
 
 	if (head->op_code == SUNXI_OP_WRITE) {
 		sunxi_spi_slave_cpu_rx_config(sspi);
-	} else if (head->op_code == SUNXI_OP_READ) {
+	} 
+	else if(head->op_code == 0x02)
+	{
+		debug_mask = DEBUG_INFO;
+		dprintk(DEBUG_INFO, "[spi%d] open debug!\n", sspi->master->bus_num);
+	}
+	else if (head->op_code == SUNXI_OP_READ) {
 		sunxi_spi_slave_cpu_tx_config(sspi);
 	} else {
 		dprintk(DEBUG_INFO, "[spi%d] pkt head opcode err\n", sspi->master->bus_num);
@@ -2044,17 +2165,18 @@ static int sunxi_spi_slave_task(void *data)
 		spi_reset_fifo(sspi->base_addr);
 		spi_clr_irq_pending(SPI_INT_STA_MASK, sspi->base_addr);
 #if IS_ENABLED(CONFIG_DMA_ENGINE)
+		// dprintk(DEBUG_INIT, "[spi]CONFIG_DMA_ENGINE is Enable\n");
 		spi_disable_dma_irq(SPI_FIFO_CTL_DRQEN_MASK, sspi->base_addr);
 #endif
 		spi_enable_irq(SPI_INTEN_ERR|SPI_INTEN_RX_RDY, sspi->base_addr);
 		spi_set_rx_trig(HEAD_LEN, sspi->base_addr);
 		spi_set_bc_tc_stc(0, 0, 0, 0, sspi->base_addr);
 
-		dprintk(DEBUG_INFO, "[spi%d] receive pkt head init ok, sleep and wait for data\n", sspi->master->bus_num);
+		dprintk(DEBUG_INIT, "[spi%d] receive pkt head init ok, sleep and wait for data\n", sspi->master->bus_num);
 		set_current_state(TASK_INTERRUPTIBLE);
 		schedule();
 
-		dprintk(DEBUG_INFO, "[spi%d] data is come, wake up and receive pkt head\n", sspi->master->bus_num);
+		dprintk(DEBUG_INIT, "[spi%d] data is come, wake up and receive pkt head\n", sspi->master->bus_num);
 
 		for (i = 0; i < HEAD_LEN ; i++) {
 			while (!spi_query_rxfifo(sspi->base_addr) && (--poll_time > 0))
@@ -2471,17 +2593,37 @@ static void sunxi_spi_remove_sysfs(struct platform_device *_pdev)
 	device_remove_file(&_pdev->dev, &sunxi_spi_status_attr);
 }
 
+
 static int sunxi_spi_probe(struct platform_device *pdev)
 {
+	// YE 2023-2-24 16:56:26
+	memset(spi_rx_buf, 0, sizeof(spi_rx_buf));
+	spi_rx_buf_idx = 0;
+
 	struct device_node *np = pdev->dev.of_node;
-	struct resource	*mem_res;
 	struct sunxi_spi *sspi;
+	struct resource	*mem_res;
 	struct sunxi_spi_platform_data *pdata;
 	struct spi_master *master;
 	struct sunxi_slave *slave = NULL;
 	char spi_para[16] = {0};
 	int ret = 0, err = 0, irq;
 
+	// s32 i = 0;
+	// struct class * ye_spi_info_class = pdev->dev.class;
+	// if (ye_spi_info_class == NULL) {
+	// 	SPI_ERR("ye_spi_info_class is NULL\n");
+	// 	return -ENODEV;
+	// }
+
+	// ret = class_register(ye_spi_info_class);
+	// if (ret != 0)
+	// 	return ret;
+
+	// ret = class_create_file(ye_spi_info_class, &ye_spi_buf_attrs[i]);
+	// if (ret)
+	// 	SPI_ERR("class_create_file => %d\n", ret);
+
 	if (np == NULL) {
 		SPI_ERR("SPI failed to get of_node\n");
 		return -ENODEV;
@@ -2574,6 +2716,7 @@ static int sunxi_spi_probe(struct platform_device *pdev)
 
 	snprintf(sspi->dev_name, sizeof(sspi->dev_name), SUNXI_SPI_DEV_NAME"%d", pdev->id);
 
+	
 	err = devm_request_irq(&pdev->dev, irq, sunxi_spi_handler, 0,
 			sspi->dev_name, sspi);
 	if (err) {
@@ -2626,7 +2769,8 @@ static int sunxi_spi_probe(struct platform_device *pdev)
 			goto err5;
 		}
 		sspi->slave = slave;
-		sspi->slave->set_up_txdata = sunxi_spi_slave_set_txdata;
+		// sspi->slave->set_up_txdata = sunxi_spi_slave_set_txdata;
+		sspi->slave->set_up_txdata = ye_spi_slave_set_txdata;
 		sspi->task = kthread_create(sunxi_spi_slave_task, sspi, "spi_slave");
 		if (IS_ERR(sspi->task)) {
 			SPI_ERR("[spi%d] unable to start kernel thread.\n", sspi->master->bus_num);
@@ -2786,6 +2930,11 @@ static struct platform_driver sunxi_spi_driver = {
 	},
 };
 
+// static struct class ye_spi_info_class = {
+// 	.name           = "sunxi_spi_slave",
+// 	.owner          = THIS_MODULE,
+// };
+
 static int __init sunxi_spi_init(void)
 {
 	return platform_driver_register(&sunxi_spi_driver);
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
old mode 100644
new mode 100755
index cbcb40924..08a04680f
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -3848,6 +3848,15 @@ static struct notifier_block spi_acpi_notifier = {
 extern struct notifier_block spi_acpi_notifier;
 #endif
 
+extern ssize_t ye_spi_buf_show(struct class *class,
+			     struct class_attribute *attr, char *buf);
+extern ssize_t ye_spi_buf_store(struct class *class, struct class_attribute *attr,
+		const char *buf, size_t count);
+
+static struct class_attribute ye_spi_buf_attrs[] = {
+	__ATTR(spi_buf, 0644, ye_spi_buf_show, ye_spi_buf_store),
+};
+
 static int __init spi_init(void)
 {
 	int	status;
@@ -3870,6 +3879,10 @@ static int __init spi_init(void)
 		status = class_register(&spi_slave_class);
 		if (status < 0)
 			goto err3;
+		
+		status = class_create_file(&spi_slave_class, &ye_spi_buf_attrs[0]);
+		if (status)
+			pr_err("class_create_file => %d\n", status);
 	}
 
 	if (IS_ENABLED(CONFIG_OF_DYNAMIC))
