linux/include/linux/vexpress.h
<<
>>
Prefs
   1/*
   2 * This program is free software; you can redistribute it and/or modify
   3 * it under the terms of the GNU General Public License version 2 as
   4 * published by the Free Software Foundation.
   5 *
   6 * This program is distributed in the hope that it will be useful,
   7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
   8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   9 * GNU General Public License for more details.
  10 *
  11 * Copyright (C) 2012 ARM Limited
  12 */
  13
  14#ifndef _LINUX_VEXPRESS_H
  15#define _LINUX_VEXPRESS_H
  16
  17#include <linux/device.h>
  18
  19#define VEXPRESS_SITE_MB                0
  20#define VEXPRESS_SITE_DB1               1
  21#define VEXPRESS_SITE_DB2               2
  22#define VEXPRESS_SITE_MASTER            0xf
  23
  24#define VEXPRESS_CONFIG_STATUS_DONE     0
  25#define VEXPRESS_CONFIG_STATUS_WAIT     1
  26
  27#define VEXPRESS_GPIO_MMC_CARDIN        0
  28#define VEXPRESS_GPIO_MMC_WPROT         1
  29#define VEXPRESS_GPIO_FLASH_WPn         2
  30
  31#define VEXPRESS_RES_FUNC(_site, _func) \
  32{                                       \
  33        .start = (_site),               \
  34        .end = (_func),                 \
  35        .flags = IORESOURCE_BUS,        \
  36}
  37
  38/* Config bridge API */
  39
  40/**
  41 * struct vexpress_config_bridge_info - description of the platform
  42 * configuration infrastructure bridge.
  43 *
  44 * @name:       Bridge name
  45 *
  46 * @func_get:   Obtains pointer to a configuration function for a given
  47 *              device or a Device Tree node, to be used with @func_put
  48 *              and @func_exec. The node pointer should take precedence
  49 *              over device pointer when both are passed.
  50 *
  51 * @func_put:   Tells the bridge that the function will not be used any
  52 *              more, so all allocated resources can be released.
  53 *
  54 * @func_exec:  Executes a configuration function read or write operation.
  55 *              The offset selects a 32 bit word of the value accessed.
  56 *              Must return VEXPRESS_CONFIG_STATUS_DONE when operation
  57 *              is finished immediately, VEXPRESS_CONFIG_STATUS_WAIT when
  58 *              will be completed in some time or negative value in case
  59 *              of error.
  60 */
  61struct vexpress_config_bridge_info {
  62        const char *name;
  63        void *(*func_get)(struct device *dev, struct device_node *node);
  64        void (*func_put)(void *func);
  65        int (*func_exec)(void *func, int offset, bool write, u32 *data);
  66};
  67
  68struct vexpress_config_bridge;
  69
  70struct vexpress_config_bridge *vexpress_config_bridge_register(
  71                struct device_node *node,
  72                struct vexpress_config_bridge_info *info);
  73void vexpress_config_bridge_unregister(struct vexpress_config_bridge *bridge);
  74
  75void vexpress_config_complete(struct vexpress_config_bridge *bridge,
  76                int status);
  77
  78/* Config function API */
  79
  80struct vexpress_config_func;
  81
  82struct vexpress_config_func *__vexpress_config_func_get(struct device *dev,
  83                struct device_node *node);
  84#define vexpress_config_func_get_by_dev(dev) \
  85                __vexpress_config_func_get(dev, NULL)
  86#define vexpress_config_func_get_by_node(node) \
  87                __vexpress_config_func_get(NULL, node)
  88void vexpress_config_func_put(struct vexpress_config_func *func);
  89
  90/* Both may sleep! */
  91int vexpress_config_read(struct vexpress_config_func *func, int offset,
  92                u32 *data);
  93int vexpress_config_write(struct vexpress_config_func *func, int offset,
  94                u32 data);
  95
  96/* Platform control */
  97
  98u32 vexpress_get_procid(int site);
  99u32 vexpress_get_hbi(int site);
 100void *vexpress_get_24mhz_clock_base(void);
 101void vexpress_flags_set(u32 data);
 102
 103#define vexpress_get_site_by_node(node) __vexpress_get_site(NULL, node)
 104#define vexpress_get_site_by_dev(dev) __vexpress_get_site(dev, NULL)
 105unsigned __vexpress_get_site(struct device *dev, struct device_node *node);
 106
 107void vexpress_sysreg_early_init(void __iomem *base);
 108void vexpress_sysreg_of_early_init(void);
 109
 110void vexpress_power_off(void);
 111void vexpress_restart(char str, const char *cmd);
 112
 113/* Clocks */
 114
 115struct clk *vexpress_osc_setup(struct device *dev);
 116void vexpress_osc_of_setup(struct device_node *node);
 117
 118void vexpress_clk_init(void __iomem *sp810_base);
 119void vexpress_clk_of_init(void);
 120
 121#endif
 122
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.