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
2 changes: 2 additions & 0 deletions arch/arm64/boot/dts/apple/t6030.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include <dt-bindings/pinctrl/apple.h>
#include <dt-bindings/spmi/spmi.h>

#define NO_ISP_YET 1

/ {
#address-cells = <2>;
#size-cells = <2>;
Expand Down
54 changes: 54 additions & 0 deletions arch/arm64/boot/dts/apple/t6031-die0.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,60 @@
};
};

isp_dart0: iommu@38e4a8000 {
compatible = "apple,t6031-dart", "apple,t8110-dart";
reg = <0x3 0x8e4a8000 0x0 0x4000>;
#iommu-cells = <1>;
interrupt-parent = <&aic>;
interrupts = <AIC_IRQ 0 571 IRQ_TYPE_LEVEL_HIGH>;
power-domains = <&ps_isp_sys>;

apple,dma-range = <0x100 0x0 0x1 0x0>;
status = "disabled";
};

isp_dart1: iommu@38e4b4000 {
compatible = "apple,t6031-dart", "apple,t8110-dart";
reg = <0x3 0x8e4b4000 0x0 0x4000>;
#iommu-cells = <1>;
interrupt-parent = <&aic>;
interrupts = <AIC_IRQ 0 571 IRQ_TYPE_LEVEL_HIGH>;
power-domains = <&ps_isp_sys>;

apple,dma-range = <0x100 0x0 0x1 0x0>;
status = "disabled";
};

isp_dart2: iommu@38e4bc000 {
compatible = "apple,t6031-dart", "apple,t8110-dart";
reg = <0x3 0x8e4bc000 0x0 0x4000>;
#iommu-cells = <1>;
interrupt-parent = <&aic>;
interrupts = <AIC_IRQ 0 571 IRQ_TYPE_LEVEL_HIGH>;
power-domains = <&ps_isp_sys>;

apple,dma-range = <0x100 0x0 0x1 0x0>;
status = "disabled";
};

isp: isp@38c000000 {
compatible = "apple,t6031-isp";
iommus = <&isp_dart0 0>, <&isp_dart1 0>, <&isp_dart2 0>;
reg-names = "coproc", "mbox", "gpio", "mbox2";
reg = <0x3 0x8c000000 0x0 0x2000000>,
<0x3 0x8e4c4000 0x0 0x100>,
<0x3 0x8e4c41d0 0x0 0x100>,
<0x3 0x8e4c4458 0x0 0x100>;
interrupt-parent = <&aic>;
interrupts = <AIC_IRQ 0 566 IRQ_TYPE_LEVEL_HIGH>;
power-domains = <&ps_isp_cpu>, <&ps_isp_fe>,
<&ps_dprx>, <&ps_isp_secure>, <&ps_isp_be>,
<&ps_isp_clr>;
apple,dart-vm-size = <0x0 0xa0000000>;

status = "disabled";
};

i2c0: i2c@391010000 {
compatible = "apple,t6031-i2c", "apple,t8103-i2c";
reg = <0x3 0x91010000 0x0 0x4000>;
Expand Down
4 changes: 4 additions & 0 deletions arch/arm64/boot/dts/apple/t6032.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,10 @@
/delete-node/ &ps_disp_sys_die1;

/* delete non-present ISP power-states */
/delete-node/ &isp_dart0;
/delete-node/ &isp_dart1;
/delete-node/ &isp_dart2;
/delete-node/ &isp;
/delete-node/ &ps_dprx;
/delete-node/ &ps_dprx_die1;
/delete-node/ &ps_isp_be;
Expand Down
8 changes: 8 additions & 0 deletions arch/arm64/boot/dts/apple/t603x-j514-j516.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,14 @@
};
};

#ifndef NO_ISP_YET
&isp {
apple,platform-id = <9>;
};

#include "isp-imx558-cfg0.dtsi"
#endif

#include "spi1-nvram.dtsi"
#include "hwmon-common.dtsi"
#include "hwmon-fan-dual.dtsi"
Expand Down
26 changes: 26 additions & 0 deletions drivers/media/platform/apple/isp/isp-drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "isp-cam.h"
#include "isp-fw.h"
#include "isp-iommu.h"
#include "isp-regs.h"
#include "isp-v4l2.h"

static void apple_isp_detach_genpd(struct apple_isp *isp)
Expand Down Expand Up @@ -224,6 +225,8 @@ static const char * isp_fw2str(enum isp_firmware_version version)
return "12.4";
case ISP_FIRMWARE_V_13_5:
return "13.5";
case ISP_FIRMWARE_V_14_7:
return "14.7";
default:
return "unknown";
}
Expand All @@ -248,6 +251,8 @@ static enum isp_firmware_version isp_read_fw_version(struct device *dev,
return ISP_FIRMWARE_V_12_4;
else if (ver[0] == 13 && ver[1] == 5 && ver[2] == 0)
return ISP_FIRMWARE_V_13_5;
else if (ver[0] == 14 && ver[1] == 7 && ver[2] == 0)
return ISP_FIRMWARE_V_14_7;

dev_warn(dev, "unknown %s: %d.%d.%d\n", name, ver[0], ver[1], ver[2]);
break;
Expand Down Expand Up @@ -454,6 +459,7 @@ static const struct apple_isp_hw apple_isp_hw_t8103 = {
.bandwidth_base = 0x23bc3c000,
.bandwidth_bit = 0x0,
.bandwidth_size = 0x4,
.mbox_irq_enable = ISP_MBOX_IRQ_ENABLE,

.scl1 = false,
.lpdp = false,
Expand Down Expand Up @@ -482,6 +488,7 @@ static const struct apple_isp_hw apple_isp_hw_t6000 = {
.bandwidth_base = 0x0,
.bandwidth_bit = 0x0,
.bandwidth_size = 0x8,
.mbox_irq_enable = ISP_MBOX_IRQ_ENABLE,

.scl1 = false,
.lpdp = false,
Expand All @@ -504,6 +511,7 @@ static const struct apple_isp_hw apple_isp_hw_t8112 = {
.bandwidth_base = 0x0,
.bandwidth_bit = 0x0,
.bandwidth_size = 0x8,
.mbox_irq_enable = ISP_MBOX_IRQ_ENABLE,

.scl1 = false,
.lpdp = false,
Expand All @@ -526,17 +534,35 @@ static const struct apple_isp_hw apple_isp_hw_t6020 = {
.bandwidth_base = 0x0,
.bandwidth_bit = 0x0,
.bandwidth_size = 0x8,
.mbox_irq_enable = ISP_MBOX_IRQ_ENABLE,

.scl1 = true,
.lpdp = true,
.meta_size = ISP_META_SIZE_T8112,
};

static const struct apple_isp_hw apple_isp_hw_t6031 = {
.gen = ISP_GEN_T6031,
.pmu_base = 0x292284008,

.dsid_count = 1,
.dsid_clr_base0 = 0x200f14000,
.dsid_clr_range0 = 0x1000,

.clock_scratch = 0x0,
.mbox_irq_enable = ISP_MBOX_IRQ_ENABLE_T6031,

.scl1 = true,
.lpdp = false,
.meta_size = ISP_META_SIZE_T6031,
};

static const struct of_device_id apple_isp_of_match[] = {
{ .compatible = "apple,t8103-isp", .data = &apple_isp_hw_t8103 },
{ .compatible = "apple,t8112-isp", .data = &apple_isp_hw_t8112 },
{ .compatible = "apple,t6000-isp", .data = &apple_isp_hw_t6000 },
{ .compatible = "apple,t6020-isp", .data = &apple_isp_hw_t6020 },
{ .compatible = "apple,t6031-isp", .data = &apple_isp_hw_t6031 },
{},
};
MODULE_DEVICE_TABLE(of, apple_isp_of_match);
Expand Down
8 changes: 6 additions & 2 deletions drivers/media/platform/apple/isp/isp-drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,25 @@
#define ISP_MAX_CHANNELS 6
#define ISP_IPC_MESSAGE_SIZE 64
#define ISP_IPC_FLAG_ACK 0x1
#define ISP_META_SIZE_T8103 0x4640
#define ISP_META_SIZE_T8112 0x4840
#define ISP_META_SIZE_T8103 0x4640
#define ISP_META_SIZE_T8112 0x4840
#define ISP_META_SIZE_T6031 0x4a40

/* used to limit the user space buffers to the buffer_pool_config */
#define ISP_MAX_BUFFERS 16

enum isp_generation {
ISP_GEN_T8103,
ISP_GEN_T8112,
ISP_GEN_T6031,
};

enum isp_firmware_version {
ISP_FIRMWARE_V_UNKNOWN,
ISP_FIRMWARE_V_12_3,
ISP_FIRMWARE_V_12_4,
ISP_FIRMWARE_V_13_5,
ISP_FIRMWARE_V_14_7,
};

struct isp_surf {
Expand Down Expand Up @@ -118,6 +121,7 @@ struct apple_isp_hw {
u8 bandwidth_bit;
u8 bandwidth_size;

u32 mbox_irq_enable;
u32 meta_size;
bool scl1;
bool lpdp;
Expand Down
22 changes: 12 additions & 10 deletions drivers/media/platform/apple/isp/isp-fw.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ static irqreturn_t apple_isp_isr_thread(int irq, void *dev)

static void isp_disable_irq(struct apple_isp *isp)
{
isp_mbox_write32(isp, ISP_MBOX_IRQ_ENABLE, 0x0);
isp_mbox_write32(isp, isp->hw->mbox_irq_enable, 0x0);
free_irq(isp->irq, isp);
isp_gpio_write32(isp, ISP_GPIO_1, 0xfeedbabe); /* real funny */
}
Expand All @@ -207,7 +207,7 @@ static int isp_enable_irq(struct apple_isp *isp)

isp_dbg(isp, "about to enable interrupts...\n");

isp_mbox_write32(isp, ISP_MBOX_IRQ_ENABLE, 0xf);
isp_mbox_write32(isp, isp->hw->mbox_irq_enable, 0xf);

return 0;
}
Expand Down Expand Up @@ -303,7 +303,7 @@ static int isp_firmware_boot_stage1(struct apple_isp *isp)
isp_gpio_write32(isp, ISP_GPIO_6, 0x0);
isp_gpio_write32(isp, ISP_GPIO_7, 0x0);

isp_mbox_write32(isp, ISP_MBOX_IRQ_ENABLE, 0x0);
isp_mbox_write32(isp, isp->hw->mbox_irq_enable, 0x0);

isp_coproc_write32(isp, ISP_COPROC_CONTROL, 0x0);
isp_coproc_write32(isp, ISP_COPROC_CONTROL, 0x10);
Expand Down Expand Up @@ -672,13 +672,15 @@ static int isp_start_command_processor(struct apple_isp *isp)
return err;
}

err = isp_cmd_pmp_ctrl_set(
isp, isp->hw->clock_scratch, isp->hw->clock_base,
isp->hw->clock_bit, isp->hw->clock_size,
isp->hw->bandwidth_scratch, isp->hw->bandwidth_base,
isp->hw->bandwidth_bit, isp->hw->bandwidth_size);
if (err)
return err;
if (isp->hw->clock_scratch) {
err = isp_cmd_pmp_ctrl_set(
isp, isp->hw->clock_scratch, isp->hw->clock_base,
isp->hw->clock_bit, isp->hw->clock_size,
isp->hw->bandwidth_scratch, isp->hw->bandwidth_base,
isp->hw->bandwidth_bit, isp->hw->bandwidth_size);
if (err)
return err;
}

err = isp_cmd_start(isp, 0);
if (err)
Expand Down
9 changes: 5 additions & 4 deletions drivers/media/platform/apple/isp/isp-regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@
#define ISP_COPROC_IRQ_MASK_4 0x1400a10
#define ISP_COPROC_IRQ_MASK_5 0x1400a14

#define ISP_MBOX_IRQ_INTERRUPT 0x00
#define ISP_MBOX_IRQ_ENABLE 0x04
#define ISP_MBOX2_IRQ_DOORBELL 0x00
#define ISP_MBOX2_IRQ_ACK 0x0c
#define ISP_MBOX_IRQ_INTERRUPT 0x00
#define ISP_MBOX_IRQ_ENABLE 0x04
#define ISP_MBOX_IRQ_ENABLE_T6031 0x08
#define ISP_MBOX2_IRQ_DOORBELL 0x00
#define ISP_MBOX2_IRQ_ACK 0x0c

#define ISP_GPIO_0 0x00
#define ISP_GPIO_1 0x04
Expand Down