summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0030-Gen3-LVDS-cameras.patch120
1 files changed, 100 insertions, 20 deletions
diff --git a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0030-Gen3-LVDS-cameras.patch b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0030-Gen3-LVDS-cameras.patch
index f927db2..8195e05 100644
--- a/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0030-Gen3-LVDS-cameras.patch
+++ b/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0030-Gen3-LVDS-cameras.patch
@@ -24,13 +24,13 @@ Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
drivers/media/i2c/soc_camera/ti954_ti9x3.c | 414 ++++++++
drivers/media/i2c/soc_camera/ti964_ti9x3.c | 382 ++++++++
drivers/media/i2c/soc_camera/ti9x4_ti9x3.h | 108 ++
- drivers/media/platform/soc_camera/rcar_csi2.c | 253 +++--
+ drivers/media/platform/soc_camera/rcar_csi2.c | 297 ++++--
drivers/media/platform/soc_camera/rcar_vin.c | 159 ++-
drivers/media/platform/soc_camera/soc_camera.c | 17 +-
drivers/media/platform/soc_camera/soc_mediabus.c | 16 +
include/media/drv-intf/soc_mediabus.h | 3 +
include/media/soc_camera.h | 1 +
- 21 files changed, 5781 insertions(+), 107 deletions(-)
+ 21 files changed, 5823 insertions(+), 109 deletions(-)
create mode 100644 drivers/media/i2c/soc_camera/max9286_max9271.c
create mode 100644 drivers/media/i2c/soc_camera/max9286_max9271.h
create mode 100644 drivers/media/i2c/soc_camera/ov10635.c
@@ -5587,7 +5587,7 @@ index 0000000..0cee5f1
+}
+#endif /* _TI9X4_H */
diff --git a/drivers/media/platform/soc_camera/rcar_csi2.c b/drivers/media/platform/soc_camera/rcar_csi2.c
-index 7373ac3..b3bc810 100644
+index 5faac64..cf70414 100644
--- a/drivers/media/platform/soc_camera/rcar_csi2.c
+++ b/drivers/media/platform/soc_camera/rcar_csi2.c
@@ -37,8 +37,9 @@
@@ -5609,7 +5609,18 @@ index 7373ac3..b3bc810 100644
#define RCAR_CSI2_PHTC 0x58
#define RCAR_CSI2_PHYPLL 0x68
-@@ -106,6 +108,9 @@
+@@ -70,6 +72,10 @@
+ #define RCAR_CSI2_PHCLM 0x78
+ #define RCAR_CSI2_PHDLM 0x7C
+
++#define RCAR_CSI2_CSI0CLKFCPR 0x254 /* CSI0CLK Frequency Configuration Preset */
++/* CSI0CLK frequency configuration bit */
++#define CSI0CLKFREQRANGE(n) ((n & 0x3f) << 16)
++
+ #define RCAR_CSI2_PHYCNT_SHUTDOWNZ (1 << 17)
+ #define RCAR_CSI2_PHYCNT_RSTZ (1 << 16)
+ #define RCAR_CSI2_PHYCNT_ENABLECLK (1 << 4)
+@@ -106,6 +112,9 @@
#define RCAR_CSI2_LSWAP_L0SEL_PLANE2 (2 << 0)
#define RCAR_CSI2_LSWAP_L0SEL_PLANE3 (3 << 0)
@@ -5619,7 +5630,19 @@ index 7373ac3..b3bc810 100644
#define RCAR_CSI2_PHTC_TESTCLR (1 << 0)
/* interrupt status registers */
-@@ -179,6 +184,7 @@ struct rcar_csi2_link_config {
+@@ -159,6 +168,11 @@
+ { }
+ };
+
++static const struct soc_device_attribute r8a7795[] = {
++ { .soc_id = "r8a7795", .revision = "ES2.0" },
++ { }
++};
++
+ enum chip_id {
+ RCAR_GEN3,
+ RCAR_GEN2,
+@@ -179,6 +193,7 @@ struct rcar_csi2_link_config {
unsigned char lanes;
unsigned long vcdt;
unsigned long vcdt2;
@@ -5627,7 +5650,7 @@ index 7373ac3..b3bc810 100644
};
#define INIT_RCAR_CSI2_LINK_CONFIG(m) \
-@@ -192,8 +198,7 @@ struct rcar_csi_irq_counter_log {
+@@ -192,8 +207,7 @@ struct rcar_csi_irq_counter_log {
};
struct rcar_csi2 {
@@ -5637,7 +5660,7 @@ index 7373ac3..b3bc810 100644
unsigned int irq;
unsigned long mipi_flags;
void __iomem *base;
-@@ -205,7 +210,9 @@ struct rcar_csi2 {
+@@ -205,7 +219,9 @@ struct rcar_csi2 {
unsigned int field;
unsigned int code;
unsigned int lanes;
@@ -5647,7 +5670,7 @@ index 7373ac3..b3bc810 100644
};
#define RCAR_CSI_80MBPS 0
-@@ -251,6 +258,89 @@ struct rcar_csi2 {
+@@ -251,6 +267,89 @@ struct rcar_csi2 {
#define RCAR_CSI_1400MBPS 40
#define RCAR_CSI_1450MBPS 41
#define RCAR_CSI_1500MBPS 42
@@ -5737,10 +5760,30 @@ index 7373ac3..b3bc810 100644
static int rcar_csi2_set_phy_freq(struct rcar_csi2 *priv)
{
-@@ -276,47 +366,22 @@ static int rcar_csi2_set_phy_freq(struct rcar_csi2 *priv)
+@@ -265,7 +364,7 @@ static int rcar_csi2_set_phy_freq(struct rcar_csi2 *priv)
+ 0x16, 0x36, 0x56, 0x76, 0x18, /* 1150M, 1200M, 1250M, 1300M, 1350M */
+ 0x38, 0x58, 0x38 /* 1400M, 1450M, 1500M */
+ };
+- const uint32_t const hs_freq_range[43] = {
++ const uint32_t const hs_freq_range_m3[43] = {
+ 0x00, 0x10, 0x20, 0x30, 0x01, /* 0-4 */
+ 0x11, 0x21, 0x31, 0x02, 0x12, /* 5-9 */
+ 0x22, 0x32, 0x03, 0x13, 0x23, /* 10-14 */
+@@ -276,47 +375,33 @@ static int rcar_csi2_set_phy_freq(struct rcar_csi2 *priv)
0x0B, 0x1B, 0x2B, 0x3B, 0x0C, /* 35-39 */
0x1C, 0x2C, 0x3C /* 40-42 */
};
++ const uint32_t const hs_freq_range_h3[43] = {
++ 0x00, 0x10, 0x20, 0x30, 0x01, /* 0-4 */
++ 0x11, 0x21, 0x31, 0x02, 0x12, /* 5-9 */
++ 0x22, 0x32, 0x03, 0x13, 0x23, /* 10-14 */
++ 0x33, 0x04, 0x14, 0x25, 0x35, /* 15-19 */
++ 0x05, 0x26, 0x36, 0x37, 0x07, /* 20-24 */
++ 0x18, 0x28, 0x39, 0x09, 0x19, /* 25-29 */
++ 0x29, 0x3A, 0x0A, 0x1A, 0x2A, /* 30-34 */
++ 0x3B, 0x0B, 0x1B, 0x2B, 0x3C, /* 35-39 */
++ 0x0C, 0x1C, 0x2C /* 40-42 */
++ };
+ const uint32_t const csi2_rate_range[43] = {
+ 80, 90, 100, 110, 120, /* 0-4 */
+ 130, 140, 150, 160, 170, /* 5-9 */
@@ -5799,8 +5842,17 @@ index 7373ac3..b3bc810 100644
}
dev_dbg(&priv->pdev->dev, "bps_per_lane (%d)\n", bps_per_lane);
-@@ -329,12 +394,6 @@ static int rcar_csi2_set_phy_freq(struct rcar_csi2 *priv)
- iowrite32(hs_freq_range[bps_per_lane] << 16,
+@@ -325,16 +410,14 @@ static int rcar_csi2_set_phy_freq(struct rcar_csi2 *priv)
+ iowrite32((hs_freq_range_v3m[bps_per_lane] << 16) |
+ RCAR_CSI2_PHTW_DWEN | RCAR_CSI2_PHTW_CWEN | 0x44,
+ priv->base + RCAR_CSI2_PHTW);
++ else if (soc_device_match(r8a7795))
++ iowrite32(hs_freq_range_h3[bps_per_lane] << 16,
++ priv->base + RCAR_CSI2_PHYPLL);
+ else
+- iowrite32(hs_freq_range[bps_per_lane] << 16,
++ /* h3 ws1.x is similar to m3 */
++ iowrite32(hs_freq_range_m3[bps_per_lane] << 16,
priv->base + RCAR_CSI2_PHYPLL);
return 0;
-
@@ -5812,7 +5864,7 @@ index 7373ac3..b3bc810 100644
}
static irqreturn_t rcar_csi2_irq(int irq, void *data)
-@@ -392,6 +451,16 @@ static int rcar_csi2_hwinit(struct rcar_csi2 *priv)
+@@ -392,6 +475,16 @@ static int rcar_csi2_hwinit(struct rcar_csi2 *priv)
iowrite32(0x0001000f, priv->base + RCAR_CSI2_FLD);
tmp |= 0x1;
break;
@@ -5829,7 +5881,35 @@ index 7373ac3..b3bc810 100644
case 4:
/* First field number setting */
iowrite32(0x0002000f, priv->base + RCAR_CSI2_FLD);
-@@ -469,32 +538,22 @@ static int rcar_csi2_hwinit(struct rcar_csi2 *priv)
+@@ -404,11 +497,27 @@ static int rcar_csi2_hwinit(struct rcar_csi2 *priv)
+ return -EINVAL;
+ }
+
++ if (soc_device_match(r8a7795)) {
++ /* Set PHY Test Interface Write Register in R-Car H3(ES2.0) */
++ iowrite32(0x01cc01e2, priv->base + RCAR_CSI2_PHTW);
++ iowrite32(0x010101e3, priv->base + RCAR_CSI2_PHTW);
++ iowrite32(0x010101e4, priv->base + RCAR_CSI2_PHTW);
++ iowrite32(0x01100104, priv->base + RCAR_CSI2_PHTW);
++ iowrite32(0x01030100, priv->base + RCAR_CSI2_PHTW);
++ iowrite32(0x01800107, priv->base + RCAR_CSI2_PHTW);
++ }
++
+ /* set PHY frequency */
+ ret = rcar_csi2_set_phy_freq(priv);
+ if (ret < 0)
+ return ret;
+
++ /* Set CSI0CLK Frequency Configuration Preset Register
++ * in R-Car H3(ES2.0)
++ */
++ if (soc_device_match(r8a7795))
++ iowrite32(CSI0CLKFREQRANGE(32), priv->base + RCAR_CSI2_CSI0CLKFCPR);
++
+ /* Enable lanes */
+ iowrite32(tmp, priv->base + RCAR_CSI2_PHYCNT);
+
+@@ -469,32 +578,22 @@ static int rcar_csi2_hwinit(struct rcar_csi2 *priv)
static int rcar_csi2_s_power(struct v4l2_subdev *sd, int on)
{
@@ -5873,7 +5953,7 @@ index 7373ac3..b3bc810 100644
}
return ret;
-@@ -543,18 +602,19 @@ static int rcar_csi2_parse_dt(struct device_node *np,
+@@ -543,18 +642,19 @@ static int rcar_csi2_parse_dt(struct device_node *np,
return -EINVAL;
v4l2_of_parse_endpoint(endpoint, &bus_cfg);
@@ -5899,7 +5979,7 @@ index 7373ac3..b3bc810 100644
for (i = 0; i < VC_MAX_CHANNEL; i++) {
sprintf(csi_name, "csi2_vc%d", i);
-@@ -573,6 +633,8 @@ static int rcar_csi2_parse_dt(struct device_node *np,
+@@ -573,6 +673,8 @@ static int rcar_csi2_parse_dt(struct device_node *np,
config->vcdt |= (0x24 << (i * 16));
else if (!strcmp(str, "ycbcr422"))
config->vcdt |= (0x1e << (i * 16));
@@ -5908,7 +5988,7 @@ index 7373ac3..b3bc810 100644
else
config->vcdt |= 0;
-@@ -587,6 +649,8 @@ static int rcar_csi2_parse_dt(struct device_node *np,
+@@ -587,6 +689,8 @@ static int rcar_csi2_parse_dt(struct device_node *np,
config->vcdt2 |= (0x24 << (j * 16));
else if (!strcmp(str, "ycbcr422"))
config->vcdt2 |= (0x1e << (j * 16));
@@ -5917,7 +5997,7 @@ index 7373ac3..b3bc810 100644
else
config->vcdt2 |= 0;
-@@ -608,6 +672,7 @@ static int rcar_csi2_probe(struct platform_device *pdev)
+@@ -608,6 +712,7 @@ static int rcar_csi2_probe(struct platform_device *pdev)
/* Platform data specify the PHY, lanes, ECC, CRC */
struct rcar_csi2_pdata *pdata;
struct rcar_csi2_link_config link_config;
@@ -5925,7 +6005,7 @@ index 7373ac3..b3bc810 100644
dev_dbg(&pdev->dev, "CSI2 probed.\n");
-@@ -618,12 +683,7 @@ static int rcar_csi2_probe(struct platform_device *pdev)
+@@ -618,12 +723,7 @@ static int rcar_csi2_probe(struct platform_device *pdev)
if (ret)
return ret;
@@ -5939,7 +6019,7 @@ index 7373ac3..b3bc810 100644
} else {
pdata = pdev->dev.platform_data;
if (!pdata)
-@@ -655,23 +715,27 @@ static int rcar_csi2_probe(struct platform_device *pdev)
+@@ -655,23 +755,27 @@ static int rcar_csi2_probe(struct platform_device *pdev)
return ret;
priv->pdev = pdev;
@@ -5977,7 +6057,7 @@ index 7373ac3..b3bc810 100644
spin_lock_init(&priv->lock);
-@@ -684,10 +748,11 @@ static int rcar_csi2_probe(struct platform_device *pdev)
+@@ -684,10 +788,11 @@ static int rcar_csi2_probe(struct platform_device *pdev)
static int rcar_csi2_remove(struct platform_device *pdev)
{