> ## 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.

# TSC Functionality Enablement for Monaco and Lemans

> Device tree, driver, and platform-specific steps to enable TSC (Timestamp Counter) functionality on Monaco (QCS8300) and Lemans (SA8775P).

# TSC Functionality Enablement for Monaco and Lemans

## Overview

This document outlines the steps required to enable **TSC** (Timestamp Counter) functionality on **Monaco (QCS8300)** and **Lemans (SA8775P)** platforms. It includes device tree configurations, driver enablement, and target-specific notes.

## 1. Monaco Device Configuration

The following updates are required on the **Monaco** target to enable TSC functionality.

### 1.1 GPIO Configuration

Add the following GPIO pin configuration. Ensure these pins are reworked for **ETU** functionality.

Add this under the `tlmm` node:

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

### 1.2 TSC Node Configuration

Add this under the `soc` node:

```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 Kernel Configuration

Ensure the TSC driver configuration is enabled:

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

## 2. Lemans (SA8775P) Configuration

On the **Lemans** target, the required TSC configurations are already present in the release in the `lemans-staging.dtso` overlay.

Ensure the appropriate overlay is loaded to enable TSC functionality on the **Lemans** platform.

## Summary

To enable TSC functionality:

### Monaco (QCS8300)

1. Add the required `cci_async` pin configuration under the `tlmm` node.
2. Add the `tsc@1c80000` node under the `soc` node.
3. Enable the TSC driver using:

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

### Lemans (SA8775P)

1. Use the existing `lemans-staging.dtso` overlay.
2. Ensure the correct overlay is loaded in the target build or boot flow.
