/* SPDX-License-Identifier: GPL-2.0-or-later */1/*2* Structures used by ASPEED clock drivers3*4* Copyright 2019 IBM Corp.5*/67#include <linux/clk-provider.h>8#include <linux/kernel.h>9#include <linux/reset-controller.h>10#include <linux/spinlock.h>1112struct clk_div_table;13struct regmap;1415/**16* struct aspeed_gate_data - Aspeed gated clocks17* @clock_idx: bit used to gate this clock in the clock register18* @reset_idx: bit used to reset this IP in the reset register. -1 if no19* reset is required when enabling the clock20* @name: the clock name21* @parent_name: the name of the parent clock22* @flags: standard clock framework flags23*/24struct aspeed_gate_data {25u8 clock_idx;26s8 reset_idx;27const char *name;28const char *parent_name;29unsigned long flags;30};3132/**33* struct aspeed_clk_gate - Aspeed specific clk_gate structure34* @hw: handle between common and hardware-specific interfaces35* @reg: register controlling gate36* @clock_idx: bit used to gate this clock in the clock register37* @reset_idx: bit used to reset this IP in the reset register. -1 if no38* reset is required when enabling the clock39* @flags: hardware-specific flags40* @lock: register lock41*42* Some of the clocks in the Aspeed SoC must be put in reset before enabling.43* This modified version of clk_gate allows an optional reset bit to be44* specified.45*/46struct aspeed_clk_gate {47struct clk_hw hw;48struct regmap *map;49u8 clock_idx;50s8 reset_idx;51u8 flags;52spinlock_t *lock;53};5455#define to_aspeed_clk_gate(_hw) container_of(_hw, struct aspeed_clk_gate, hw)5657/**58* struct aspeed_reset - Aspeed reset controller59* @map: regmap to access the containing system controller60* @rcdev: reset controller device61*/62struct aspeed_reset {63struct regmap *map;64struct reset_controller_dev rcdev;65};6667#define to_aspeed_reset(p) container_of((p), struct aspeed_reset, rcdev)6869/**70* struct aspeed_clk_soc_data - Aspeed SoC specific divisor information71* @div_table: Common divider lookup table72* @eclk_div_table: Divider lookup table for ECLK73* @mac_div_table: Divider lookup table for MAC (Ethernet) clocks74* @calc_pll: Callback to maculate common PLL settings75*/76struct aspeed_clk_soc_data {77const struct clk_div_table *div_table;78const struct clk_div_table *eclk_div_table;79const struct clk_div_table *mac_div_table;80struct clk_hw *(*calc_pll)(const char *name, u32 val);81};828384