diff --git a/linux-5.10/rk3568_patch/kernel.patch b/linux-5.10/rk3568_patch/kernel.patch index b62f373be37e8d6bbc7590f3b752f59c65f3ef24..2612c4122e13d08eb965a0a2b4554c89718c5330 100755 --- a/linux-5.10/rk3568_patch/kernel.patch +++ b/linux-5.10/rk3568_patch/kernel.patch @@ -109245,15 +109245,6 @@ index 4b1122e98e16..1b1111e88089 100644 GATE(HCLK_CIF, "hclk_cif", "hclk_vio", 0, RK2928_CLKGATE_CON(6), 4, GFLAGS), GATE(HCLK_EBC, "hclk_ebc", "hclk_vio", 0, RK2928_CLKGATE_CON(9), 9, GFLAGS), -@@ -489,7 +487,7 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = { - GATE(HCLK_I2S_2CH, "hclk_i2s_2ch", "hclk_peri", 0, RK2928_CLKGATE_CON(7), 2, GFLAGS), - GATE(0, "hclk_usb_peri", "hclk_peri", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(9), 13, GFLAGS), - GATE(HCLK_HOST2, "hclk_host2", "hclk_peri", 0, RK2928_CLKGATE_CON(7), 3, GFLAGS), -- GATE(HCLK_OTG, "hclk_otg", "hclk_peri", 0, RK2928_CLKGATE_CON(3), 13, GFLAGS), -+ GATE(HCLK_OTG, "hclk_otg", "hclk_peri", 0, RK2928_CLKGATE_CON(5), 13, GFLAGS), - GATE(0, "hclk_peri_ahb", "hclk_peri", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(9), 14, GFLAGS), - GATE(HCLK_SPDIF, "hclk_spdif", "hclk_peri", 0, RK2928_CLKGATE_CON(10), 9, GFLAGS), - GATE(HCLK_TSP, "hclk_tsp", "hclk_peri", 0, RK2928_CLKGATE_CON(10), 12, GFLAGS), @@ -499,6 +497,7 @@ static struct rockchip_clk_branch common_clk_branches[] __initdata = { GATE(0, "hclk_emmc_peri", "hclk_peri", CLK_IGNORE_UNUSED, RK2928_CLKGATE_CON(3), 6, GFLAGS), GATE(HCLK_NANDC, "hclk_nandc", "hclk_peri", 0, RK2928_CLKGATE_CON(5), 9, GFLAGS), @@ -640888,7 +640879,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 STATE_READ, STATE_WRITE, STATE_STOP -@@ -189,6 +193,8 @@ struct rk3x_i2c_soc_data { +@@ -190,6 +194,8 @@ struct rk3x_i2c_soc_data { * @state: state of i2c transfer * @processed: byte length which has been send or received * @error: error code for i2c transfer @@ -640897,7 +640888,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 */ struct rk3x_i2c { struct i2c_adapter adap; -@@ -219,8 +225,21 @@ struct rk3x_i2c { +@@ -221,8 +227,21 @@ struct rk3x_i2c { enum rk3x_i2c_state state; unsigned int processed; int error; @@ -640919,7 +640910,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 static inline void i2c_writel(struct rk3x_i2c *i2c, u32 value, unsigned int offset) { -@@ -238,6 +257,18 @@ static inline void rk3x_i2c_clean_ipd(struct rk3x_i2c *i2c) +@@ -240,6 +259,18 @@ static inline void rk3x_i2c_clean_ipd(struct rk3x_i2c *i2c) i2c_writel(i2c, REG_INT_ALL, REG_IPD); } @@ -640938,7 +640929,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 /** * rk3x_i2c_start - Generate a START condition, which triggers a REG_INT_START interrupt. * @i2c: target controller data -@@ -245,8 +276,18 @@ static inline void rk3x_i2c_clean_ipd(struct rk3x_i2c *i2c) +@@ -247,8 +278,18 @@ static inline void rk3x_i2c_clean_ipd(struct rk3x_i2c *i2c) static void rk3x_i2c_start(struct rk3x_i2c *i2c) { u32 val = i2c_readl(i2c, REG_CON) & REG_CON_TUNING_MASK; @@ -640958,7 +640949,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 /* enable adapter with correct mode, send START condition */ val |= REG_CON_EN | REG_CON_MOD(i2c->mode) | REG_CON_START; -@@ -256,6 +297,12 @@ static void rk3x_i2c_start(struct rk3x_i2c *i2c) +@@ -258,6 +299,12 @@ static void rk3x_i2c_start(struct rk3x_i2c *i2c) val |= REG_CON_ACTACK; i2c_writel(i2c, val, REG_CON); @@ -640971,7 +640962,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 } /** -@@ -279,6 +326,7 @@ static void rk3x_i2c_stop(struct rk3x_i2c *i2c, int error) +@@ -281,6 +328,7 @@ static void rk3x_i2c_stop(struct rk3x_i2c *i2c, int error) ctrl = i2c_readl(i2c, REG_CON); ctrl |= REG_CON_STOP; @@ -640979,7 +640970,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 i2c_writel(i2c, ctrl, REG_CON); } else { /* Signal rk3x_i2c_xfer to start the next message. */ -@@ -294,7 +342,7 @@ static void rk3x_i2c_stop(struct rk3x_i2c *i2c, int error) +@@ -296,7 +344,7 @@ static void rk3x_i2c_stop(struct rk3x_i2c *i2c, int error) i2c_writel(i2c, ctrl, REG_CON); /* signal that we are finished with the current msg */ @@ -640988,7 +640979,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 } } -@@ -324,6 +372,8 @@ static void rk3x_i2c_prepare_read(struct rk3x_i2c *i2c) +@@ -326,6 +374,8 @@ static void rk3x_i2c_prepare_read(struct rk3x_i2c *i2c) if (i2c->processed != 0) { con &= ~REG_CON_MOD_MASK; con |= REG_CON_MOD(REG_CON_MOD_RX); @@ -640997,7 +640988,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 } i2c_writel(i2c, con, REG_CON); -@@ -334,7 +384,7 @@ static void rk3x_i2c_prepare_read(struct rk3x_i2c *i2c) +@@ -336,7 +386,7 @@ static void rk3x_i2c_prepare_read(struct rk3x_i2c *i2c) * rk3x_i2c_fill_transmit_buf - Fill the transmit buffer with data from i2c->msg * @i2c: target controller data */ @@ -641006,7 +640997,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 { unsigned int i, j; u32 cnt = 0; -@@ -362,40 +412,15 @@ static void rk3x_i2c_fill_transmit_buf(struct rk3x_i2c *i2c) +@@ -364,40 +414,15 @@ static void rk3x_i2c_fill_transmit_buf(struct rk3x_i2c *i2c) break; } @@ -641051,7 +641042,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 static void rk3x_i2c_handle_write(struct rk3x_i2c *i2c, unsigned int ipd) { if (!(ipd & REG_INT_MBTF)) { -@@ -412,7 +437,7 @@ static void rk3x_i2c_handle_write(struct rk3x_i2c *i2c, unsigned int ipd) +@@ -414,7 +439,7 @@ static void rk3x_i2c_handle_write(struct rk3x_i2c *i2c, unsigned int ipd) if (i2c->processed == i2c->msg->len) rk3x_i2c_stop(i2c, i2c->error); else @@ -641060,7 +641051,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 } static void rk3x_i2c_handle_read(struct rk3x_i2c *i2c, unsigned int ipd) -@@ -472,7 +497,7 @@ static void rk3x_i2c_handle_stop(struct rk3x_i2c *i2c, unsigned int ipd) +@@ -474,7 +499,7 @@ static void rk3x_i2c_handle_stop(struct rk3x_i2c *i2c, unsigned int ipd) i2c->state = STATE_IDLE; /* signal rk3x_i2c_xfer that we are finished */ @@ -641069,7 +641060,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 } static irqreturn_t rk3x_i2c_irq(int irqno, void *dev_id) -@@ -484,7 +509,9 @@ static irqreturn_t rk3x_i2c_irq(int irqno, void *dev_id) +@@ -486,7 +511,9 @@ static irqreturn_t rk3x_i2c_irq(int irqno, void *dev_id) ipd = i2c_readl(i2c, REG_IPD); if (i2c->state == STATE_IDLE) { @@ -641080,7 +641071,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 rk3x_i2c_clean_ipd(i2c); goto out; } -@@ -504,8 +531,10 @@ static irqreturn_t rk3x_i2c_irq(int irqno, void *dev_id) +@@ -506,8 +533,10 @@ static irqreturn_t rk3x_i2c_irq(int irqno, void *dev_id) ipd &= ~REG_INT_NAKRCV; @@ -641092,7 +641083,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 } /* is there anything left to handle? */ -@@ -513,9 +542,6 @@ static irqreturn_t rk3x_i2c_irq(int irqno, void *dev_id) +@@ -515,9 +544,6 @@ static irqreturn_t rk3x_i2c_irq(int irqno, void *dev_id) goto out; switch (i2c->state) { @@ -641102,7 +641093,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 case STATE_WRITE: rk3x_i2c_handle_write(i2c, ipd); break; -@@ -1032,7 +1058,6 @@ static int rk3x_i2c_setup(struct rk3x_i2c *i2c, struct i2c_msg *msgs, int num) +@@ -1034,7 +1060,6 @@ static int rk3x_i2c_setup(struct rk3x_i2c *i2c, struct i2c_msg *msgs, int num) i2c->addr = msgs[0].addr; i2c->busy = true; @@ -641110,7 +641101,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 i2c->processed = 0; i2c->error = 0; -@@ -1063,6 +1088,9 @@ static int rk3x_i2c_xfer_common(struct i2c_adapter *adap, +@@ -1065,6 +1090,9 @@ static int rk3x_i2c_xfer_common(struct i2c_adapter *adap, int ret = 0; int i; @@ -641120,20 +641111,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 spin_lock_irqsave(&i2c->lock, flags); clk_enable(i2c->clk); -@@ -1085,10 +1113,10 @@ static int rk3x_i2c_xfer_common(struct i2c_adapter *adap, - if (i + ret >= num) - i2c->is_last_msg = true; - -- spin_unlock_irqrestore(&i2c->lock, flags); -- - rk3x_i2c_start(i2c); - -+ spin_unlock_irqrestore(&i2c->lock, flags); -+ - if (!polling) { - timeout = wait_event_timeout(i2c->wait, !i2c->busy, - msecs_to_jiffies(WAIT_TIMEOUT)); -@@ -1103,7 +1131,7 @@ static int rk3x_i2c_xfer_common(struct i2c_adapter *adap, +@@ -1110,7 +1138,7 @@ static int rk3x_i2c_xfer_common(struct i2c_adapter *adap, i2c_readl(i2c, REG_IPD), i2c->state); /* Force a STOP condition without interrupt */ @@ -641142,7 +641120,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 val = i2c_readl(i2c, REG_CON) & REG_CON_TUNING_MASK; val |= REG_CON_EN | REG_CON_STOP; i2c_writel(i2c, val, REG_CON); -@@ -1120,6 +1148,9 @@ static int rk3x_i2c_xfer_common(struct i2c_adapter *adap, +@@ -1127,6 +1155,9 @@ static int rk3x_i2c_xfer_common(struct i2c_adapter *adap, } } @@ -641152,7 +641130,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 clk_disable(i2c->pclk); clk_disable(i2c->clk); -@@ -1140,12 +1171,69 @@ static int rk3x_i2c_xfer_polling(struct i2c_adapter *adap, +@@ -1147,12 +1178,69 @@ static int rk3x_i2c_xfer_polling(struct i2c_adapter *adap, return rk3x_i2c_xfer_common(adap, msgs, num, true); } @@ -641223,7 +641201,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 return 0; } -@@ -1161,7 +1249,12 @@ static const struct i2c_algorithm rk3x_i2c_algorithm = { +@@ -1168,7 +1256,12 @@ static const struct i2c_algorithm rk3x_i2c_algorithm = { }; static const struct rk3x_i2c_soc_data rv1108_soc_data = { @@ -641237,7 +641215,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 .calc_timings = rk3x_i2c_v1_calc_timings, }; -@@ -1195,6 +1288,10 @@ static const struct of_device_id rk3x_i2c_match[] = { +@@ -1202,6 +1295,10 @@ static const struct of_device_id rk3x_i2c_match[] = { .compatible = "rockchip,rv1108-i2c", .data = &rv1108_soc_data }, @@ -641248,7 +641226,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 { .compatible = "rockchip,rk3066-i2c", .data = &rk3066_soc_data -@@ -1225,7 +1322,6 @@ static int rk3x_i2c_probe(struct platform_device *pdev) +@@ -1232,7 +1329,6 @@ static int rk3x_i2c_probe(struct platform_device *pdev) const struct of_device_id *match; struct rk3x_i2c *i2c; int ret = 0; @@ -641256,7 +641234,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 u32 value; int irq; unsigned long clk_rate; -@@ -1253,13 +1349,18 @@ static int rk3x_i2c_probe(struct platform_device *pdev) +@@ -1260,13 +1356,18 @@ static int rk3x_i2c_probe(struct platform_device *pdev) spin_lock_init(&i2c->lock); init_waitqueue_head(&i2c->wait); @@ -641278,7 +641256,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 /* * Switch to new interface if the SoC also offers the old one. * The control bit is located in the GRF register space. -@@ -1268,24 +1369,34 @@ static int rk3x_i2c_probe(struct platform_device *pdev) +@@ -1275,24 +1376,34 @@ static int rk3x_i2c_probe(struct platform_device *pdev) struct regmap *grf; grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf"); @@ -641331,7 +641309,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 } } -@@ -1363,13 +1474,17 @@ static int rk3x_i2c_remove(struct platform_device *pdev) +@@ -1372,13 +1483,17 @@ static int rk3x_i2c_remove(struct platform_device *pdev) i2c_del_adapter(&i2c->adap); clk_notifier_unregister(i2c->clk, &i2c->clk_rate_nb); @@ -641350,7 +641328,7 @@ index 13c14eb175e9..3a3de40fc90f 100644 static struct platform_driver rk3x_i2c_driver = { .probe = rk3x_i2c_probe, -@@ -1381,7 +1496,21 @@ static struct platform_driver rk3x_i2c_driver = { +@@ -1390,7 +1505,21 @@ static struct platform_driver rk3x_i2c_driver = { }, };