mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-26 06:04:14 +08:00
3b9334ac83
Components of the Versatile Express platform (configuration microcontrollers on motherboard and daughterboards in particular) talk to each other over a custom configuration bus. They provide miscellaneous functions (from clock generator control to energy sensors) which are represented as platform devices (and Device Tree nodes). The transactions on the bus can be generated by different "bridges" in the system, some of which are universal for the whole platform (for the price of high transfer latencies), others restricted to a subsystem (but much faster). Until now drivers for such functions were using custom "func" API, which is being replaced in this patch by regmap calls. This required: * a rework (and move to drivers/bus directory, as suggested by Samuel and Arnd) of the config bus core, which is much simpler now and uses device model infrastructure (class) to keep track of the bridges; non-DT case (soon to be retired anyway) is simply covered by a special device registration function * the new config-bus driver also takes over device population, so there is no need for special matching table for of_platform_populate nor "simple-bus" hack in the arm64 model dtsi file (relevant bindings documentation has been updated); this allows all the vexpress devices fit into normal device model, making it possible to remove plenty of early inits and other hacks in the near future * adaptation of the syscfg bridge implementation in the sysreg driver, again making it much simpler; there is a special case of the "energy" function spanning two registers, where they should be both defined in the tree now, but backward compatibility is maintained in the code * modification of the relevant drivers: * hwmon - just a straight-forward API change * power/reset driver - API change * regulator - API change plus error handling simplification * osc clock driver - this one required larger rework in order to turn in into a standard platform driver Signed-off-by: Pawel Moll <pawel.moll@arm.com> Acked-by: Mark Brown <broonie@linaro.org> Acked-by: Lee Jones <lee.jones@linaro.org> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Mike Turquette <mturquette@linaro.org>
87 lines
2.3 KiB
C
87 lines
2.3 KiB
C
/*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* Copyright (C) 2012 ARM Limited
|
|
*/
|
|
|
|
#ifndef _LINUX_VEXPRESS_H
|
|
#define _LINUX_VEXPRESS_H
|
|
|
|
#include <linux/device.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/reboot.h>
|
|
#include <linux/regmap.h>
|
|
|
|
#define VEXPRESS_SITE_MB 0
|
|
#define VEXPRESS_SITE_DB1 1
|
|
#define VEXPRESS_SITE_DB2 2
|
|
#define VEXPRESS_SITE_MASTER 0xf
|
|
|
|
#define VEXPRESS_GPIO_MMC_CARDIN 0
|
|
#define VEXPRESS_GPIO_MMC_WPROT 1
|
|
#define VEXPRESS_GPIO_FLASH_WPn 2
|
|
#define VEXPRESS_GPIO_LED0 3
|
|
#define VEXPRESS_GPIO_LED1 4
|
|
#define VEXPRESS_GPIO_LED2 5
|
|
#define VEXPRESS_GPIO_LED3 6
|
|
#define VEXPRESS_GPIO_LED4 7
|
|
#define VEXPRESS_GPIO_LED5 8
|
|
#define VEXPRESS_GPIO_LED6 9
|
|
#define VEXPRESS_GPIO_LED7 10
|
|
|
|
#define VEXPRESS_RES_FUNC(_site, _func) \
|
|
{ \
|
|
.start = (_site), \
|
|
.end = (_func), \
|
|
.flags = IORESOURCE_BUS, \
|
|
}
|
|
|
|
/* Config infrastructure */
|
|
|
|
void vexpress_config_set_master(u32 site);
|
|
u32 vexpress_config_get_master(void);
|
|
|
|
void vexpress_config_lock(void *arg);
|
|
void vexpress_config_unlock(void *arg);
|
|
|
|
int vexpress_config_get_topo(struct device_node *node, u32 *site,
|
|
u32 *position, u32 *dcc);
|
|
|
|
/* Config bridge API */
|
|
|
|
struct vexpress_config_bridge_ops {
|
|
struct regmap * (*regmap_init)(struct device *dev, void *context);
|
|
void (*regmap_exit)(struct regmap *regmap, void *context);
|
|
};
|
|
|
|
struct device *vexpress_config_bridge_register(struct device *parent,
|
|
struct vexpress_config_bridge_ops *ops, void *context);
|
|
|
|
/* Config regmap API */
|
|
|
|
struct regmap *devm_regmap_init_vexpress_config(struct device *dev);
|
|
|
|
/* Platform control */
|
|
|
|
u32 vexpress_get_procid(int site);
|
|
u32 vexpress_get_hbi(int site);
|
|
void *vexpress_get_24mhz_clock_base(void);
|
|
void vexpress_flags_set(u32 data);
|
|
|
|
void vexpress_sysreg_early_init(void __iomem *base);
|
|
void vexpress_sysreg_of_early_init(void);
|
|
int vexpress_sysreg_config_device_register(struct platform_device *pdev);
|
|
|
|
/* Clocks */
|
|
|
|
void vexpress_clk_init(void __iomem *sp810_base);
|
|
|
|
#endif
|