> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Monaco 和 Lemans 的 TSC 功能启用

> 在 Monaco (QCS8300) 和 Lemans (SA8775P) 上启用 TSC（时间戳计数器）功能的设备树、驱动及平台特定步骤。

# Monaco 和 Lemans 的 TSC 功能启用

## 概述

本文档概述在 **Monaco (QCS8300)** 和 **Lemans (SA8775P)** 平台上启用 **TSC**（时间戳计数器，Timestamp Counter）功能所需的步骤。内容包括设备树配置、驱动启用以及各目标平台的特定说明。

## 1. Monaco 设备配置

要启用 TSC 功能，需要在 **Monaco** 目标上进行以下更新。

### 1.1 GPIO 配置

添加以下 GPIO 引脚配置。确保这些引脚已为 **ETU** 功能完成改制（rework）。

在 `tlmm` 节点下添加以下内容：

```dts theme={null}
cci_async_default: cci-async-state {
       pins = "gpio63", "gpio64";
       function = "cci_async";
       drive-strength = <2>;
       bias-disable;
};
```

### 1.2 TSC 节点配置

在 `soc` 节点下添加以下内容：

```dts theme={null}
tsc@1c80000 {
       compatible = "qcom,tsc";
       reg = <0x0 0x01c80000 0x0 0x2000>,
             <0x0 0x01c90000 0x0 0x10000>;
       reg-names = "tsc", "etu";
       clocks = <&gcc GCC_TSCSS_AHB_CLK>,
                <&gcc GCC_TSCSS_GLOBAL_CNTR_CLK>,
                <&gcc GCC_TSCSS_ETU_CLK>;
       clock-names = "cfg_ahb", "cntr", "etu";
       assigned-clocks = <&gcc GCC_TSCSS_GLOBAL_CNTR_CLK>,
                         <&gcc GCC_TSCSS_ETU_CLK>;
       assigned-clock-rates = <15625000>, <15625000>;
       qcom,tsc-nsec-update;
       interrupts = <GIC_SPI 766 IRQ_TYPE_EDGE_RISING>;
       interrupt-names = "etu_summary_irq";
       qcom,etu-slice = <10 11>;
       qcom,etu-event-sel = <10 11>;
       qcom,etu-event-names = "gps_pps", "tod_pps";
       pinctrl-names = "default";
       pinctrl-0 = <&cci_async_default>;
};
```

### 1.3 内核配置

确保已启用 TSC 驱动配置：

```config theme={null}
CONFIG_PTP_QCOM_CLOCK_TSC=m
```

## 2. Lemans (SA8775P) 配置

在 **Lemans** 目标上，所需的 TSC 配置已在版本中的 `lemans-staging.dtso` overlay 中提供。

确保加载了正确的 overlay，以便在 **Lemans** 平台上启用 TSC 功能。

## 总结

要启用 TSC 功能：

### Monaco (QCS8300)

1. 在 `tlmm` 节点下添加所需的 `cci_async` 引脚配置。
2. 在 `soc` 节点下添加 `tsc@1c80000` 节点。
3. 使用以下配置启用 TSC 驱动：

```config theme={null}
CONFIG_PTP_QCOM_CLOCK_TSC=m
```

### Lemans (SA8775P)

1. 使用现有的 `lemans-staging.dtso` overlay。
2. 确保在目标构建或启动流程中加载了正确的 overlay。
