uboot/arch/arm/include/asm/arch-sunxi/ccu.h
<<
>>
Prefs
   1// SPDX-License-Identifier: GPL-2.0+
   2/*
   3 * Copyright (C) 2018 Amarula Solutions.
   4 * Author: Jagan Teki <jagan@amarulasolutions.com>
   5 */
   6
   7#ifndef _ASM_ARCH_CCU_H
   8#define _ASM_ARCH_CCU_H
   9
  10/**
  11 * enum ccu_flags - ccu clock/reset flags
  12 *
  13 * @CCU_CLK_F_IS_VALID:         is given clock gate is valid?
  14 * @CCU_RST_F_IS_VALID:         is given reset control is valid?
  15 */
  16enum ccu_flags {
  17        CCU_CLK_F_IS_VALID              = BIT(0),
  18        CCU_RST_F_IS_VALID              = BIT(1),
  19};
  20
  21/**
  22 * struct ccu_clk_gate - ccu clock gate
  23 * @off:        gate offset
  24 * @bit:        gate bit
  25 * @flags:      ccu clock gate flags
  26 */
  27struct ccu_clk_gate {
  28        u16 off;
  29        u32 bit;
  30        enum ccu_flags flags;
  31};
  32
  33#define GATE(_off, _bit) {                      \
  34        .off = _off,                            \
  35        .bit = _bit,                            \
  36        .flags = CCU_CLK_F_IS_VALID,            \
  37}
  38
  39/**
  40 * struct ccu_reset - ccu reset
  41 * @off:        reset offset
  42 * @bit:        reset bit
  43 * @flags:      ccu reset control flags
  44 */
  45struct ccu_reset {
  46        u16 off;
  47        u32 bit;
  48        enum ccu_flags flags;
  49};
  50
  51#define RESET(_off, _bit) {                     \
  52        .off = _off,                            \
  53        .bit = _bit,                            \
  54        .flags = CCU_RST_F_IS_VALID,            \
  55}
  56
  57/**
  58 * struct ccu_desc - clock control unit descriptor
  59 *
  60 * @gates:      clock gates
  61 * @resets:     reset unit
  62 */
  63struct ccu_desc {
  64        const struct ccu_clk_gate *gates;
  65        const struct ccu_reset *resets;
  66};
  67
  68/**
  69 * struct ccu_priv - sunxi clock control unit
  70 *
  71 * @base:       base address
  72 * @desc:       ccu descriptor
  73 */
  74struct ccu_priv {
  75        void *base;
  76        const struct ccu_desc *desc;
  77};
  78
  79/**
  80 * sunxi_clk_probe - common sunxi clock probe
  81 * @dev:        clock device
  82 */
  83int sunxi_clk_probe(struct udevice *dev);
  84
  85extern struct clk_ops sunxi_clk_ops;
  86
  87/**
  88 * sunxi_reset_bind() - reset binding
  89 *
  90 * @dev:       reset device
  91 * @count:     reset count
  92 * @return 0 success, or error value
  93 */
  94int sunxi_reset_bind(struct udevice *dev, ulong count);
  95
  96#endif /* _ASM_ARCH_CCU_H */
  97