Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Documentation/devicetree/bindings/media/qcom,nord-camss.yaml
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,13 +17,16 @@ properties:
const: qcom,nord-camss

reg:
maxItems: 29
maxItems: 32

reg-names:
items:
- const: csid0
- const: csid1
- const: csid2
- const: csid_wrapper0
- const: csid_wrapper1
- const: csid_wrapper2
- const: csid_lite0
- const: csid_lite1
- const: csid_lite2
Expand DownExpand Up@@ -199,6 +202,9 @@ examples:
reg = <0 0x09b32000 0 0x2000>,
<0 0x09b38800 0 0x2000>,
<0 0x09b3f000 0 0x2000>,
<0 0x09b31000 0 0x1000>,
<0 0x09b37800 0 0x1000>,
<0 0x09b3e000 0 0x1000>,
<0 0x09c32000 0 0x1000>,
<0 0x09c37000 0 0x1000>,
<0 0x09c3c000 0 0x1000>,
Expand DownExpand Up@@ -229,6 +235,9 @@ examples:
reg-names = "csid0",
"csid1",
"csid2",
"csid_wrapper0",
"csid_wrapper1",
"csid_wrapper2",
"csid_lite0",
"csid_lite1",
"csid_lite2",
Expand Down
6 changes: 6 additions & 0 deletions arch/arm64/boot/dts/qcom/nord-embedded.dtsi
Original file line numberDiff line numberDiff line change
Expand Up@@ -1067,6 +1067,9 @@
reg = <0 0x09b32000 0 0x2000>,
<0 0x09b38800 0 0x2000>,
<0 0x09b3f000 0 0x2000>,
<0 0x09b31000 0 0x1000>,
<0 0x09b37800 0 0x1000>,
<0 0x09b3e000 0 0x1000>,
<0 0x09c32000 0 0x1000>,
<0 0x09c37000 0 0x1000>,
<0 0x09c3c000 0 0x1000>,
Expand DownExpand Up@@ -1097,6 +1100,9 @@
reg-names = "csid0",
"csid1",
"csid2",
"csid_wrapper0",
"csid_wrapper1",
"csid_wrapper2",
"csid_lite0",
"csid_lite1",
"csid_lite2",
Expand Down
26 changes: 26 additions & 0 deletions drivers/media/platform/qcom/camss/camss-csid-900.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -93,6 +93,14 @@
#define CSID_CSI2_RDIN_IRQ_CLEAR(rdi) (0x11C + 0x10 * (rdi))
#define INFO_RUP_DONE BIT(23)

/*
* Per-path domain_id (CSID wrapper, full CSID only). A domain_id of 0 selects
* an unmapped SMMU SID, so RDI writes never reach memory; program a non-zero
* value to select the IFE SID that the device tree maps via "iommus".
*/
#define CSID_PATH_DOMAIN_ID_CFG1 0x4
#define PATH_DOMAIN_ID_RDI(rdi) (1U << ((rdi) * 8))

static void __csid_aup_rup_trigger(struct csid_device *csid)
{
writel(RUP_SET, csid->base + CSID_RUP_AUP_CMD);
Expand DownExpand Up@@ -233,12 +241,30 @@ static void __csid_configure_rdi_stream(struct csid_device *csid, u8 enable, u8
writel(val, csid->base + rdi_cfg0_offset);
}

static void __csid_configure_domain_id(struct csid_device *csid)
{
u32 val;
int i;

if (csid_is_lite(csid) || !csid->wrapper_base)
return;

val = readl(csid->wrapper_base + CSID_PATH_DOMAIN_ID_CFG1);
for (i = 0; i < MSM_CSID_MAX_SRC_STREAMS; i++)
if (csid->phy.en_vc & BIT(i))
val |= PATH_DOMAIN_ID_RDI(i);
writel(val, csid->wrapper_base + CSID_PATH_DOMAIN_ID_CFG1);
}

static void csid_configure_stream(struct csid_device *csid, u8 enable)
{
u8 i, k;

__csid_configure_rx(csid, &csid->phy);

if (enable)
__csid_configure_domain_id(csid);

for (i = 0; i < MSM_CSID_MAX_SRC_STREAMS_900; i++) {
if (csid->phy.en_vc & BIT(i)) {
__csid_configure_rdi_stream(csid, enable, i, 0);
Expand Down
9 changes: 9 additions & 0 deletions drivers/media/platform/qcom/camss/camss-csid.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -1130,6 +1130,15 @@ int msm_csid_subdev_init(struct camss *camss, struct csid_device *csid,
return PTR_ERR(csid->base);
}

/* Optional per-CSID wrapper region (e.g. secure control on CSID 900) */

if (res->reg[1]) {
csid->wrapper_base =
devm_platform_ioremap_resource_byname(pdev, res->reg[1]);
if (IS_ERR(csid->wrapper_base))
return PTR_ERR(csid->wrapper_base);
}

/* Interrupt */

ret = platform_get_irq_byname(pdev, res->interrupt[0]);
Expand Down
1 change: 1 addition & 0 deletions drivers/media/platform/qcom/camss/camss-csid.h
Original file line numberDiff line numberDiff line change
Expand Up@@ -154,6 +154,7 @@ struct csid_device {
struct v4l2_subdev subdev;
struct media_pad pads[MSM_CSID_PADS_NUM];
void __iomem *base;
void __iomem *wrapper_base;
u32 irq;
char irq_name[30];
union {
Expand Down
6 changes: 3 additions & 3 deletions drivers/media/platform/qcom/camss/camss.c
Original file line numberDiff line numberDiff line change
Expand Up@@ -427,7 +427,7 @@ static const struct camss_subdev_resources csid_res_nord[] = {
.clock_rate = { { 400000000, 480000000 },
{ 400000000, 480000000 },
{ 0 } },
.reg = { "csid0" },
.reg = { "csid0", "csid_wrapper0" },
.interrupt = { "csid0" },
.csid = {
.is_lite = false,
Expand All@@ -442,7 +442,7 @@ static const struct camss_subdev_resources csid_res_nord[] = {
.clock_rate = { { 400000000, 480000000 },
{ 400000000, 480000000 },
{ 0 } },
.reg = { "csid1" },
.reg = { "csid1", "csid_wrapper1" },
.interrupt = { "csid1" },
.csid = {
.is_lite = false,
Expand All@@ -457,7 +457,7 @@ static const struct camss_subdev_resources csid_res_nord[] = {
.clock_rate = { { 400000000, 480000000 },
{ 400000000, 480000000 },
{ 0 } },
.reg = { "csid2" },
.reg = { "csid2", "csid_wrapper2" },
.interrupt = { "csid2" },
.csid = {
.is_lite = false,
Expand Down
Loading