lipengfei28 commented on code in PR #16798: URL: https://github.com/apache/nuttx/pull/16798#discussion_r2261833086
########## arch/arm64/src/imx9/imx9_scmi.h: ########## @@ -0,0 +1,331 @@ +/**************************************************************************** + * arch/arm64/src/imx9/imx9_scmi.h + * + * SPDX-License-Identifier: Apache-2.0 + * SPDX-FileCopyrightText: 2024 NXP + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __ARCH_ARM_SRC_IMX9_IMX9_SCMI_H +#define __ARCH_ARM_SRC_IMX9_IMX9_SCMI_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define SCMI_PLATFORM_A2P 0 /* Agent -> Platform */ +#define SCMI_PLATFORM_NOTIFY 1 /* Platform -> Agent */ +#define SCMI_PLATFORM_PRIORITY 2 + +#define SCMI_CLOCK_RATE_MASK 0xFFFFFFFFU + +/* SCMI clock round options */ +#define SCMI_CLOCK_ROUND_DOWN 0U /* Round down */ +#define SCMI_CLOCK_ROUND_UP 1U /* Round up */ +#define SCMI_CLOCK_ROUND_AUTO 2U /* Round to nearest */ + +/* SCMI clock rate flags */ + +/* Round up/down */ + +#define SCMI_CLOCK_RATE_FLAGS_ROUND(x) (((x) & 0x3U) << 2U) + +/* Ignore delayed response */ + +#define SCMI_CLOCK_RATE_FLAGS_NO_RESP(x) (((x) & 0x1U) << 1U) + +/* Async flag */ + +#define SCMI_CLOCK_RATE_FLAGS_ASYNC(x) (((x) & 0x1U) << 0U) + +/* SCMI clock config attributes */ + +/* OEM specified config type */ + +#define SCMI_CLOCK_CONFIG_SET_OEM(x) (((x) & 0xFFU) << 16U) + +/* Enable/Disable */ + +#define SCMI_CLOCK_CONFIG_SET_ENABLE(x) (((x) & 0x3U) << 0U) + +/* SCMI pin control types */ + +#define SCMI_PINCTRL_SEL_PIN 0U +#define SCMI_PINCTRL_SEL_GROUP 1U +#define SCMI_PINCTRL_TYPE_MUX 192U /* Mux type */ +#define SCMI_PINCTRL_TYPE_CONFIG 193U /* Config type */ +#define SCMI_PINCTRL_TYPE_DAISY_ID 194U /* Daisy ID type */ +#define SCMI_PINCTRL_TYPE_DAISY_CFG 195U /* Daisy config type */ +#define SCMI_PINCTRL_SET_ATTR_NUM_CONFIGS(x) (((x) & 0xFFU) << 2U) +#define SCMI_PINCTRL_SET_ATTR_SELECTOR(x) (((x) & 0x3U) << 0U) + +/* Pinctrl */ +#define SCMI_PLATFORM_PINCTRL_MUX_MODE_MASK (0x7U) +#define SCMI_PLATFORM_PINCTRL_MUX_MODE_SHIFT (0U) +#define SCMI_PLATFORM_PINCTRL_MUX_MODE(x) \ + (((uint32_t)(((uint32_t)(x)) << SCMI_PLATFORM_PINCTRL_MUX_MODE_SHIFT)) \ + & SCMI_PLATFORM_PINCTRL_MUX_MODE_MASK) + +#define SCMI_PLATFORM_PINCTRL_SION_MASK (0x10) +#define SCMI_PLATFORM_PINCTRL_SION_SHIFT (4U) +#define SCMI_PLATFORM_PINCTRL_SION(x) \ + (((uint32_t)(((uint32_t)(x)) << SCMI_PLATFORM_PINCTRL_SION_SHIFT)) \ + & SCMI_PLATFORM_PINCTRL_SION_MASK) + +#define SCMI_PINCTRL_BASE IMX9_IOMUXC1_BASE +#define SCMI_PLATFORM_PINCTRL_MUXREG_OFF (SCMI_PINCTRL_BASE) +#define SCMI_PLATFORM_PINCTRL_CFGREG_OFF (SCMI_PINCTRL_BASE + 0x204) +#define SCMI_PLATFORM_PINCTRL_DAISYREG_OFF (SCMI_PINCTRL_BASE + 0x408) + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +typedef struct +{ + uint32_t channel; /* channel id: SCMI_A2P, SCMI_NOTIRY, SCMI_P2A, */ + uint32_t rateu; + uint32_t ratel; + uint32_t clk_id; /* clock device id */ Review Comment: done -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org