mirror of
https://github.com/torvalds/linux.git
synced 2024-12-11 21:52:04 +00:00
habanalabs: Add descriptive names to PSOC scratch-pad registers
The PSOC scratch-pad registers are used for communication with the device CPU. This patch adds new definitions for these registers which are more descriptive than their general names. The new set of definitions also gathers and documents the current usage of the scratch-pad registers by the driver and the device CPU. Signed-off-by: Tomer Tayar <ttayar@habana.ai> Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com> Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
This commit is contained in:
parent
4d6a7751f6
commit
4095a17657
@ -9,6 +9,7 @@
|
||||
#include "include/hw_ip/mmu/mmu_general.h"
|
||||
#include "include/hw_ip/mmu/mmu_v1_0.h"
|
||||
#include "include/goya/asic_reg/goya_masks.h"
|
||||
#include "include/goya/goya_reg_map.h"
|
||||
|
||||
#include <linux/pci.h>
|
||||
#include <linux/genalloc.h>
|
||||
@ -1006,36 +1007,34 @@ int goya_init_cpu_queues(struct hl_device *hdev)
|
||||
|
||||
eq = &hdev->event_queue;
|
||||
|
||||
WREG32(mmPSOC_GLOBAL_CONF_SCRATCHPAD_0,
|
||||
lower_32_bits(cpu_pq->bus_address));
|
||||
WREG32(mmPSOC_GLOBAL_CONF_SCRATCHPAD_1,
|
||||
upper_32_bits(cpu_pq->bus_address));
|
||||
WREG32(mmCPU_PQ_BASE_ADDR_LOW, lower_32_bits(cpu_pq->bus_address));
|
||||
WREG32(mmCPU_PQ_BASE_ADDR_HIGH, upper_32_bits(cpu_pq->bus_address));
|
||||
|
||||
WREG32(mmPSOC_GLOBAL_CONF_SCRATCHPAD_2, lower_32_bits(eq->bus_address));
|
||||
WREG32(mmPSOC_GLOBAL_CONF_SCRATCHPAD_3, upper_32_bits(eq->bus_address));
|
||||
WREG32(mmCPU_EQ_BASE_ADDR_LOW, lower_32_bits(eq->bus_address));
|
||||
WREG32(mmCPU_EQ_BASE_ADDR_HIGH, upper_32_bits(eq->bus_address));
|
||||
|
||||
WREG32(mmPSOC_GLOBAL_CONF_SCRATCHPAD_8,
|
||||
WREG32(mmCPU_CQ_BASE_ADDR_LOW,
|
||||
lower_32_bits(VA_CPU_ACCESSIBLE_MEM_ADDR));
|
||||
WREG32(mmPSOC_GLOBAL_CONF_SCRATCHPAD_9,
|
||||
WREG32(mmCPU_CQ_BASE_ADDR_HIGH,
|
||||
upper_32_bits(VA_CPU_ACCESSIBLE_MEM_ADDR));
|
||||
|
||||
WREG32(mmPSOC_GLOBAL_CONF_SCRATCHPAD_5, HL_QUEUE_SIZE_IN_BYTES);
|
||||
WREG32(mmPSOC_GLOBAL_CONF_SCRATCHPAD_4, HL_EQ_SIZE_IN_BYTES);
|
||||
WREG32(mmPSOC_GLOBAL_CONF_SCRATCHPAD_10, HL_CPU_ACCESSIBLE_MEM_SIZE);
|
||||
WREG32(mmCPU_PQ_LENGTH, HL_QUEUE_SIZE_IN_BYTES);
|
||||
WREG32(mmCPU_EQ_LENGTH, HL_EQ_SIZE_IN_BYTES);
|
||||
WREG32(mmCPU_CQ_LENGTH, HL_CPU_ACCESSIBLE_MEM_SIZE);
|
||||
|
||||
/* Used for EQ CI */
|
||||
WREG32(mmPSOC_GLOBAL_CONF_SCRATCHPAD_6, 0);
|
||||
WREG32(mmCPU_EQ_CI, 0);
|
||||
|
||||
WREG32(mmCPU_IF_PF_PQ_PI, 0);
|
||||
|
||||
WREG32(mmPSOC_GLOBAL_CONF_SCRATCHPAD_7, PQ_INIT_STATUS_READY_FOR_CP);
|
||||
WREG32(mmCPU_PQ_INIT_STATUS, PQ_INIT_STATUS_READY_FOR_CP);
|
||||
|
||||
WREG32(mmGIC_DISTRIBUTOR__5_GICD_SETSPI_NSR,
|
||||
GOYA_ASYNC_EVENT_ID_PI_UPDATE);
|
||||
|
||||
err = hl_poll_timeout(
|
||||
hdev,
|
||||
mmPSOC_GLOBAL_CONF_SCRATCHPAD_7,
|
||||
mmCPU_PQ_INIT_STATUS,
|
||||
status,
|
||||
(status == PQ_INIT_STATUS_READY_FOR_HOST),
|
||||
1000,
|
||||
@ -2205,12 +2204,12 @@ static void goya_read_device_fw_version(struct hl_device *hdev,
|
||||
|
||||
switch (fwc) {
|
||||
case FW_COMP_UBOOT:
|
||||
ver_off = RREG32(mmPSOC_GLOBAL_CONF_SCRATCHPAD_29);
|
||||
ver_off = RREG32(mmUBOOT_VER_OFFSET);
|
||||
dest = hdev->asic_prop.uboot_ver;
|
||||
name = "U-Boot";
|
||||
break;
|
||||
case FW_COMP_PREBOOT:
|
||||
ver_off = RREG32(mmPSOC_GLOBAL_CONF_SCRATCHPAD_28);
|
||||
ver_off = RREG32(mmPREBOOT_VER_OFFSET);
|
||||
dest = hdev->asic_prop.preboot_ver;
|
||||
name = "Preboot";
|
||||
break;
|
||||
@ -3949,7 +3948,7 @@ void goya_add_end_of_cb_packets(struct hl_device *hdev, u64 kernel_address,
|
||||
|
||||
void goya_update_eq_ci(struct hl_device *hdev, u32 val)
|
||||
{
|
||||
WREG32(mmPSOC_GLOBAL_CONF_SCRATCHPAD_6, val);
|
||||
WREG32(mmCPU_EQ_CI, val);
|
||||
}
|
||||
|
||||
void goya_restore_phase_topology(struct hl_device *hdev)
|
||||
|
32
drivers/misc/habanalabs/include/goya/goya_reg_map.h
Normal file
32
drivers/misc/habanalabs/include/goya/goya_reg_map.h
Normal file
@ -0,0 +1,32 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0
|
||||
*
|
||||
* Copyright 2019 HabanaLabs, Ltd.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef GOYA_REG_MAP_H_
|
||||
#define GOYA_REG_MAP_H_
|
||||
|
||||
/*
|
||||
* PSOC scratch-pad registers
|
||||
*/
|
||||
#define mmCPU_PQ_BASE_ADDR_LOW mmPSOC_GLOBAL_CONF_SCRATCHPAD_0
|
||||
#define mmCPU_PQ_BASE_ADDR_HIGH mmPSOC_GLOBAL_CONF_SCRATCHPAD_1
|
||||
#define mmCPU_EQ_BASE_ADDR_LOW mmPSOC_GLOBAL_CONF_SCRATCHPAD_2
|
||||
#define mmCPU_EQ_BASE_ADDR_HIGH mmPSOC_GLOBAL_CONF_SCRATCHPAD_3
|
||||
#define mmCPU_EQ_LENGTH mmPSOC_GLOBAL_CONF_SCRATCHPAD_4
|
||||
#define mmCPU_PQ_LENGTH mmPSOC_GLOBAL_CONF_SCRATCHPAD_5
|
||||
#define mmCPU_EQ_CI mmPSOC_GLOBAL_CONF_SCRATCHPAD_6
|
||||
#define mmCPU_PQ_INIT_STATUS mmPSOC_GLOBAL_CONF_SCRATCHPAD_7
|
||||
#define mmCPU_CQ_BASE_ADDR_LOW mmPSOC_GLOBAL_CONF_SCRATCHPAD_8
|
||||
#define mmCPU_CQ_BASE_ADDR_HIGH mmPSOC_GLOBAL_CONF_SCRATCHPAD_9
|
||||
#define mmCPU_CQ_LENGTH mmPSOC_GLOBAL_CONF_SCRATCHPAD_10
|
||||
#define mmUPD_STS mmPSOC_GLOBAL_CONF_SCRATCHPAD_26
|
||||
#define mmUPD_CMD mmPSOC_GLOBAL_CONF_SCRATCHPAD_27
|
||||
#define mmPREBOOT_VER_OFFSET mmPSOC_GLOBAL_CONF_SCRATCHPAD_28
|
||||
#define mmUBOOT_VER_OFFSET mmPSOC_GLOBAL_CONF_SCRATCHPAD_29
|
||||
#define mmUBOOT_OFFSET mmPSOC_GLOBAL_CONF_SCRATCHPAD_30
|
||||
#define mmBTL_ID mmPSOC_GLOBAL_CONF_SCRATCHPAD_31
|
||||
|
||||
#endif /* GOYA_REG_MAP_H_ */
|
Loading…
Reference in New Issue
Block a user