1294660Smmel#- 2294660Smmel# Copyright 2016 Michal Meloun <mmel@FreeBSD.org> 3294660Smmel# All rights reserved. 4294660Smmel# 5294660Smmel# Redistribution and use in source and binary forms, with or without 6294660Smmel# modification, are permitted provided that the following conditions 7294660Smmel# are met: 8294660Smmel# 1. Redistributions of source code must retain the above copyright 9294660Smmel# notice, this list of conditions and the following disclaimer. 10294660Smmel# 2. Redistributions in binary form must reproduce the above copyright 11294660Smmel# notice, this list of conditions and the following disclaimer in the 12294660Smmel# documentation and/or other materials provided with the distribution. 13294660Smmel# 14294660Smmel# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15294660Smmel# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16294660Smmel# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17294660Smmel# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18294660Smmel# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19294660Smmel# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20294660Smmel# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21294660Smmel# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22294660Smmel# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23294660Smmel# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24294660Smmel# SUCH DAMAGE. 25294660Smmel# 26294660Smmel# $FreeBSD: releng/11.0/sys/dev/extres/clk/clknode_if.m 294660 2016-01-24 11:00:38Z mmel $ 27294660Smmel# 28294660Smmel 29294660SmmelINTERFACE clknode; 30294660Smmel 31294660SmmelHEADER { 32294660Smmel struct clknode; 33294660Smmel} 34294660Smmel 35294660Smmel# 36294660Smmel# Initialize clock node, get shanpshot of cached values 37294660Smmel# 38294660SmmelMETHOD int init { 39294660Smmel struct clknode *clk; 40294660Smmel device_t dev; 41294660Smmel}; 42294660Smmel 43294660Smmel# 44294660Smmel# Recalculate frequency 45294660Smmel# req - in/out recalulated frequency 46294660Smmel# 47294660SmmelMETHOD int recalc_freq { 48294660Smmel struct clknode *clk; 49294660Smmel uint64_t *freq; 50294660Smmel}; 51294660Smmel 52294660Smmel# 53294660Smmel# Set frequency 54294660Smmel# fin - parent (input)frequency. 55294660Smmel# fout - requested output freqency. If clock cannot change frequency, 56294660Smmel# then must return new requested frequency for his parent 57294660SmmelMETHOD int set_freq { 58294660Smmel struct clknode *clk; 59294660Smmel uint64_t fin; 60294660Smmel uint64_t *fout; 61294660Smmel int flags; 62294660Smmel int *done; 63294660Smmel}; 64294660Smmel 65294660Smmel# 66294660Smmel# Enable/disable clock 67294660Smmel# 68294660SmmelMETHOD int set_gate { 69294660Smmel struct clknode *clk; 70294660Smmel bool enable; 71294660Smmel}; 72294660Smmel 73294660Smmel# 74294660Smmel# Set multiplexer 75294660Smmel# 76294660SmmelMETHOD int set_mux { 77294660Smmel struct clknode *clk; 78294660Smmel int idx; 79294660Smmel}; 80