mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-12-18 17:53:10 +00:00
m1n1.trace.isp: t8112 etc changes
Signed-off-by: Asahi Lina <lina@asahilina.net>
This commit is contained in:
parent
ef7655568b
commit
0db48488a9
3 changed files with 115 additions and 76 deletions
|
@ -10,6 +10,7 @@ CISP_CMD_SET_ISP_PMU_BASE = 0x0011
|
||||||
CISP_CMD_RPC_ENABLE = 0x0013
|
CISP_CMD_RPC_ENABLE = 0x0013
|
||||||
CISP_CMD_PMP_CTRL_SET = 0x001c
|
CISP_CMD_PMP_CTRL_SET = 0x001c
|
||||||
CISP_CMD_TRACE_ENABLE = 0x001d
|
CISP_CMD_TRACE_ENABLE = 0x001d
|
||||||
|
CISP_CMD_FLICKER_SENSOR_SET = 0x0024
|
||||||
CISP_CMD_CH_START = 0x0100
|
CISP_CMD_CH_START = 0x0100
|
||||||
CISP_CMD_CH_STOP = 0x0101
|
CISP_CMD_CH_STOP = 0x0101
|
||||||
CISP_CMD_CH_BUFFER_RETURN = 0x0104
|
CISP_CMD_CH_BUFFER_RETURN = 0x0104
|
||||||
|
@ -39,11 +40,14 @@ CISP_CMD_CH_AE_STABILITY_TO_STABLE_SET = 0x0229
|
||||||
CISP_CMD_CH_SENSOR_NVM_GET = 0x0501
|
CISP_CMD_CH_SENSOR_NVM_GET = 0x0501
|
||||||
CISP_CMD_CH_SENSOR_PERMODULE_LSC_INFO_GET = 0x0507
|
CISP_CMD_CH_SENSOR_PERMODULE_LSC_INFO_GET = 0x0507
|
||||||
CISP_CMD_CH_SENSOR_PERMODULE_LSC_GRID_GET = 0x0511
|
CISP_CMD_CH_SENSOR_PERMODULE_LSC_GRID_GET = 0x0511
|
||||||
|
CISP_CMD_CH_LPDP_HS_RECEIVER_TUNING_SET = 0x051b
|
||||||
CISP_CMD_CH_FOCUS_LIMITS_GET = 0x0701
|
CISP_CMD_CH_FOCUS_LIMITS_GET = 0x0701
|
||||||
CISP_CMD_CH_CROP_SET = 0x0801
|
CISP_CMD_CH_CROP_SET = 0x0801
|
||||||
|
CISP_CMD_CH_CROP_SCL1_SET = 0x080c
|
||||||
CISP_CMD_CH_CNR_START = 0x0a2f
|
CISP_CMD_CH_CNR_START = 0x0a2f
|
||||||
CISP_CMD_CH_MBNR_ENABLE = 0x0a3a
|
CISP_CMD_CH_MBNR_ENABLE = 0x0a3a
|
||||||
CISP_CMD_CH_OUTPUT_CONFIG_SET = 0x0b01
|
CISP_CMD_CH_OUTPUT_CONFIG_SET = 0x0b01
|
||||||
|
CISP_CMD_CH_OUTPUT_CONFIG_SCL1_SET = 0x0b09
|
||||||
CISP_CMD_CH_PREVIEW_STREAM_SET = 0x0b0d
|
CISP_CMD_CH_PREVIEW_STREAM_SET = 0x0b0d
|
||||||
CISP_CMD_CH_FACE_DETECTION_START = 0x0d00
|
CISP_CMD_CH_FACE_DETECTION_START = 0x0d00
|
||||||
CISP_CMD_CH_FACE_DETECTION_CONFIG_GET = 0x0d02
|
CISP_CMD_CH_FACE_DETECTION_CONFIG_GET = 0x0d02
|
||||||
|
@ -71,6 +75,7 @@ opcode_dict = {
|
||||||
0x0013 : "CISP_CMD_RPC_ENABLE",
|
0x0013 : "CISP_CMD_RPC_ENABLE",
|
||||||
0x001c : "CISP_CMD_PMP_CTRL_SET",
|
0x001c : "CISP_CMD_PMP_CTRL_SET",
|
||||||
0x001d : "CISP_CMD_TRACE_ENABLE",
|
0x001d : "CISP_CMD_TRACE_ENABLE",
|
||||||
|
0x0024 : "CISP_CMD_FLICKER_SENSOR_SET",
|
||||||
0x0100 : "CISP_CMD_CH_START",
|
0x0100 : "CISP_CMD_CH_START",
|
||||||
0x0101 : "CISP_CMD_CH_STOP",
|
0x0101 : "CISP_CMD_CH_STOP",
|
||||||
0x0104 : "CISP_CMD_CH_BUFFER_RETURN",
|
0x0104 : "CISP_CMD_CH_BUFFER_RETURN",
|
||||||
|
@ -100,11 +105,14 @@ opcode_dict = {
|
||||||
0x0501 : "CISP_CMD_CH_SENSOR_NVM_GET",
|
0x0501 : "CISP_CMD_CH_SENSOR_NVM_GET",
|
||||||
0x0507 : "CISP_CMD_CH_SENSOR_PERMODULE_LSC_INFO_GET",
|
0x0507 : "CISP_CMD_CH_SENSOR_PERMODULE_LSC_INFO_GET",
|
||||||
0x0511 : "CISP_CMD_CH_SENSOR_PERMODULE_LSC_GRID_GET",
|
0x0511 : "CISP_CMD_CH_SENSOR_PERMODULE_LSC_GRID_GET",
|
||||||
|
0x051b : "CISP_CMD_CH_LPDP_HS_RECEIVER_TUNING_SET",
|
||||||
0x0701 : "CISP_CMD_CH_FOCUS_LIMITS_GET",
|
0x0701 : "CISP_CMD_CH_FOCUS_LIMITS_GET",
|
||||||
0x0801 : "CISP_CMD_CH_CROP_SET",
|
0x0801 : "CISP_CMD_CH_CROP_SET",
|
||||||
|
0x080c : "CISP_CMD_CH_CROP_SCL1_SET",
|
||||||
0x0a2f : "CISP_CMD_CH_CNR_START",
|
0x0a2f : "CISP_CMD_CH_CNR_START",
|
||||||
0x0a3a : "CISP_CMD_CH_MBNR_ENABLE",
|
0x0a3a : "CISP_CMD_CH_MBNR_ENABLE",
|
||||||
0x0b01 : "CISP_CMD_CH_OUTPUT_CONFIG_SET",
|
0x0b01 : "CISP_CMD_CH_OUTPUT_CONFIG_SET",
|
||||||
|
0x0b09 : "CISP_CMD_CH_OUTPUT_CONFIG_SCL1_SET",
|
||||||
0x0b0d : "CISP_CMD_CH_PREVIEW_STREAM_SET",
|
0x0b0d : "CISP_CMD_CH_PREVIEW_STREAM_SET",
|
||||||
0x0d00 : "CISP_CMD_CH_FACE_DETECTION_START",
|
0x0d00 : "CISP_CMD_CH_FACE_DETECTION_START",
|
||||||
0x0d02 : "CISP_CMD_CH_FACE_DETECTION_CONFIG_GET",
|
0x0d02 : "CISP_CMD_CH_FACE_DETECTION_CONFIG_GET",
|
||||||
|
|
|
@ -37,6 +37,15 @@ class ISPRegs(RegMap):
|
||||||
ISP_GPIO_6 = 0x2104188, Register32
|
ISP_GPIO_6 = 0x2104188, Register32
|
||||||
ISP_GPIO_7 = 0x210418c, Register32
|
ISP_GPIO_7 = 0x210418c, Register32
|
||||||
|
|
||||||
|
ISP_GPIO_0_T8112 = 0x24c41b0, Register32
|
||||||
|
ISP_GPIO_1_T8112 = 0x24c41b4, Register32
|
||||||
|
ISP_GPIO_2_T8112 = 0x24c41b8, Register32
|
||||||
|
ISP_GPIO_3_T8112 = 0x24c41bc, Register32
|
||||||
|
ISP_GPIO_4_T8112 = 0x24c41c0, Register32
|
||||||
|
ISP_GPIO_5_T8112 = 0x24c41c4, Register32
|
||||||
|
ISP_GPIO_6_T8112 = 0x24c41c8, Register32
|
||||||
|
ISP_GPIO_7_T8112 = 0x24c41cc, Register32
|
||||||
|
|
||||||
ISP_SENSOR_CLOCK_0_EN = 0x2104190, Register32
|
ISP_SENSOR_CLOCK_0_EN = 0x2104190, Register32
|
||||||
ISP_SENSOR_CLOCK_1_EN = 0x2104194, Register32
|
ISP_SENSOR_CLOCK_1_EN = 0x2104194, Register32
|
||||||
ISP_SENSOR_CLOCK_2_EN = 0x2104198, Register32
|
ISP_SENSOR_CLOCK_2_EN = 0x2104198, Register32
|
||||||
|
@ -45,11 +54,15 @@ class ISPRegs(RegMap):
|
||||||
ISP_IRQ_ENABLE = 0x2104004, Register32
|
ISP_IRQ_ENABLE = 0x2104004, Register32
|
||||||
ISP_IRQ_DOORBELL = 0x21043f0, Register32
|
ISP_IRQ_DOORBELL = 0x21043f0, Register32
|
||||||
ISP_IRQ_ACK = 0x21043fc, Register32
|
ISP_IRQ_ACK = 0x21043fc, Register32
|
||||||
|
ISP_IRQ_INTERRUPT_T8112 = 0x24c4000, Register32
|
||||||
|
ISP_IRQ_DOORBELL_T8112 = 0x24c4430, Register32
|
||||||
|
ISP_IRQ_ACK_T8112 = 0x24c443c, Register32
|
||||||
|
|
||||||
ISP_IRQ_INTERRUPT_1 = 0x2104008, Register32
|
ISP_IRQ_INTERRUPT_1 = 0x2104008, Register32
|
||||||
ISP_IRQ_INTERRUPT_2 = 0x2104010, Register32
|
ISP_IRQ_INTERRUPT_2 = 0x2104010, Register32
|
||||||
ISP_IRQ_INTERRUPT_3 = 0x2104018, Register32
|
ISP_IRQ_INTERRUPT_3 = 0x2104018, Register32
|
||||||
ISP_IRQ_INTERRUPT_4 = 0x21043f8, Register32
|
ISP_IRQ_INTERRUPT_4 = 0x21043f8, Register32
|
||||||
|
ISP_IRQ_INTERRUPT_4_T8112 = 0x24c4438, Register32
|
||||||
|
|
||||||
ISP_DPE_UNK_0 = 0x2504000, Register32
|
ISP_DPE_UNK_0 = 0x2504000, Register32
|
||||||
ISP_DPE_UNK_1 = 0x2508000, Register32
|
ISP_DPE_UNK_1 = 0x2508000, Register32
|
||||||
|
|
|
@ -63,8 +63,7 @@ class ISPIOCommand(ISPCommand):
|
||||||
class ISPT2HBufferCommand(ISPCommand):
|
class ISPT2HBufferCommand(ISPCommand):
|
||||||
def __init__(self, chan, msg, direction):
|
def __init__(self, chan, msg, direction):
|
||||||
super().__init__(chan, msg, direction)
|
super().__init__(chan, msg, direction)
|
||||||
#self.contents = self.read_iova(0x1013140, 0x4000)
|
self.contents = self.read_iova(self.iova, 0x280)
|
||||||
self.contents = None
|
|
||||||
|
|
||||||
def dump(self):
|
def dump(self):
|
||||||
super().dump()
|
super().dump()
|
||||||
|
@ -75,8 +74,8 @@ class ISPT2HBufferCommand(ISPCommand):
|
||||||
class ISPH2TBufferCommand(ISPCommand):
|
class ISPH2TBufferCommand(ISPCommand):
|
||||||
def __init__(self, chan, msg, direction):
|
def __init__(self, chan, msg, direction):
|
||||||
super().__init__(chan, msg, direction)
|
super().__init__(chan, msg, direction)
|
||||||
#self.contents = self.read_iova(0x1013140, 0x4000)
|
self.contents = self.read_iova(self.iova, 0x4000)
|
||||||
self.contents = None
|
#self.contents = None
|
||||||
|
|
||||||
def dump(self):
|
def dump(self):
|
||||||
super().dump()
|
super().dump()
|
||||||
|
@ -182,11 +181,21 @@ class ISPTracer(ADTDevTracer):
|
||||||
self.dart_tracer = DARTTracer(hv, dart_dev_path, verbose=0)
|
self.dart_tracer = DARTTracer(hv, dart_dev_path, verbose=0)
|
||||||
self.dart_tracer.start()
|
self.dart_tracer.start()
|
||||||
self.dart = self.dart_tracer.dart
|
self.dart = self.dart_tracer.dart
|
||||||
|
self.iova_base = 0
|
||||||
|
chip_id = hv.adt["/chosen"].chip_id
|
||||||
|
if 0x6020 <= chip_id <= 0x6fff:
|
||||||
|
self.iova_base = 0x100_0000_0000
|
||||||
|
|
||||||
self.ignored_ranges = [
|
self.ignored_ranges = [
|
||||||
(0x22c0e8000, 0x4000), # dart 1
|
(0x22c0e8000, 0x4000), # dart 1
|
||||||
(0x22c0f4000, 0x4000), # dart 2
|
(0x22c0f4000, 0x4000), # dart 2
|
||||||
(0x22c0fc000, 0x4000), # dart 3
|
(0x22c0fc000, 0x4000), # dart 3
|
||||||
|
(0x3860e8000, 0x4000), # dart 1
|
||||||
|
(0x3860f4000, 0x4000), # dart 2
|
||||||
|
(0x3860fc000, 0x4000), # dart 3
|
||||||
|
(0x22c4a8000, 0x4000), # dart 1
|
||||||
|
(0x22c4b4000, 0x4000), # dart 2
|
||||||
|
(0x22c4bc000, 0x4000), # dart 3
|
||||||
]
|
]
|
||||||
|
|
||||||
self.table = None
|
self.table = None
|
||||||
|
@ -196,43 +205,52 @@ class ISPTracer(ADTDevTracer):
|
||||||
self.log("ISP_GPIO_0 r32: 0x%x" % (val.value))
|
self.log("ISP_GPIO_0 r32: 0x%x" % (val.value))
|
||||||
if val.value == 0x8042006:
|
if val.value == 0x8042006:
|
||||||
self.log(f"ISP_GPIO0 = ACK")
|
self.log(f"ISP_GPIO0 = ACK")
|
||||||
|
elif val.value == 0xf7fbdff9:
|
||||||
|
self.log(f"ISP_GPIO0 = NACK?")
|
||||||
elif val.value < 64:
|
elif val.value < 64:
|
||||||
self.log(f"ISP_IPC_CHANNELS = {val!s}")
|
self.log(f"ISP_IPC_CHANNELS = {val!s}")
|
||||||
self.num_chans = val.value
|
self.num_chans = val.value
|
||||||
elif val.value > 0:
|
elif val.value > 0:
|
||||||
self.log(f"IPC BASE IOVA: {val!s}")
|
self.log(f"IPC BASE IOVA: {val!s}")
|
||||||
self.ipc_iova = val.value
|
self.ipc_iova = val.value
|
||||||
|
# self.dart_tracer.trace_range(0, irange(val.value | self.iova_base, 0x40000))
|
||||||
self.table = ISPChannelTable(self, self.num_chans, val.value)
|
self.table = ISPChannelTable(self, self.num_chans, val.value)
|
||||||
self.log("======== CHANNEL TABLE ========")
|
self.log("======== CHANNEL TABLE ========")
|
||||||
for chan in self.table.chans:
|
for chan in self.table.chans:
|
||||||
self.log(f"ISPIPC: {str(chan)}")
|
self.log(f"ISPIPC: {str(chan)}")
|
||||||
self.log("======== END OF CHANNEL TABLE ========")
|
self.log("======== END OF CHANNEL TABLE ========")
|
||||||
|
r_ISP_GPIO_0_T8112 = r_ISP_GPIO_0
|
||||||
|
|
||||||
def r_ISP_IRQ_INTERRUPT(self, val):
|
def r_ISP_IRQ_INTERRUPT(self, val):
|
||||||
#self.log("ISP_IRQ_INTERRUPT r32: 0x%x" % (val.value))
|
#self.log("ISP_IRQ_INTERRUPT r32: 0x%x" % (val.value))
|
||||||
#self.log(f"======== BEGIN IRQ ========")
|
#self.log(f"======== BEGIN IRQ ========")
|
||||||
self.table.get_last_rx_commands(int(val.value))
|
self.table.get_last_rx_commands(int(val.value))
|
||||||
#self.log(f"======== END IRQ ========")
|
#self.log(f"======== END IRQ ========")
|
||||||
|
r_ISP_IRQ_INTERRUPT_T8112 = r_ISP_IRQ_INTERRUPT
|
||||||
|
|
||||||
def w_ISP_IRQ_DOORBELL(self, val):
|
def w_ISP_IRQ_DOORBELL(self, val):
|
||||||
#self.log("ISP_IRQ_DOORBELL w32: 0x%x" % (val.value))
|
#self.log("ISP_IRQ_DOORBELL w32: 0x%x" % (val.value))
|
||||||
#self.log(f"======== BEGIN DOORBELL ========")
|
#self.log(f"======== BEGIN DOORBELL ========")
|
||||||
self.table.get_last_tx_commands(int(val.value))
|
self.table.get_last_tx_commands(int(val.value))
|
||||||
#self.log(f"======== END DOORBELL ========")
|
#self.log(f"======== END DOORBELL ========")
|
||||||
|
w_ISP_IRQ_DOORBELL_T8112 = w_ISP_IRQ_DOORBELL
|
||||||
|
|
||||||
def w_ISP_GPIO_0(self, val):
|
def w_ISP_GPIO_0(self, val):
|
||||||
self.log("ISP_GPIO_0 w32: 0x%x" % (val.value))
|
self.log("ISP_GPIO_0 w32: 0x%x" % (val.value))
|
||||||
if (val.value >= 0xe00000) and (val.value <= 0x1100000): # dunno
|
if (val.value >= 0xe00000) and (val.value <= 0x1100000): # dunno
|
||||||
self.log("ISP bootargs at 0x%x:" % val.value)
|
self.log("ISP bootargs at 0x%x:" % val.value)
|
||||||
bootargs = self.dart.ioread(0, val.value, 0x200) # justt in case
|
bootargs = self.dart.ioread(0, val.value | self.iova_base, 0x200) # justt in case
|
||||||
chexdump32(bootargs, print_fn=self.log)
|
chexdump32(bootargs, print_fn=self.log)
|
||||||
x = ISPIPCBootArgs.parse(bootargs[:ISPIPCBootArgs.sizeof()])
|
x = ISPIPCBootArgs.parse(bootargs[:ISPIPCBootArgs.sizeof()])
|
||||||
self.log(x)
|
self.log(x)
|
||||||
|
w_ISP_GPIO_0_T8112 = w_ISP_GPIO_0
|
||||||
|
|
||||||
def ioread(self, iova, size):
|
def ioread(self, iova, size):
|
||||||
|
iova |= self.iova_base
|
||||||
return self.dart.ioread(0, iova, size)
|
return self.dart.ioread(0, iova, size)
|
||||||
|
|
||||||
def iowrite(self, iova, data):
|
def iowrite(self, iova, data):
|
||||||
|
iova |= self.iova_base
|
||||||
return self.dart.iowrite(0, iova, data)
|
return self.dart.iowrite(0, iova, data)
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
|
|
Loading…
Reference in a new issue