1*57251285SSimon Glass /* 2*57251285SSimon Glass * Copyright (c) 2015 Google, Inc 3*57251285SSimon Glass * Written by Simon Glass <sjg@chromium.org> 4*57251285SSimon Glass * 5*57251285SSimon Glass * SPDX-License-Identifier: GPL-2.0+ 6*57251285SSimon Glass */ 7*57251285SSimon Glass 8*57251285SSimon Glass #ifndef __SYSCON_H 9*57251285SSimon Glass #define __SYSCON_H 10*57251285SSimon Glass 11*57251285SSimon Glass /** 12*57251285SSimon Glass * struct syscon_uc_info - Information stored by the syscon UCLASS_UCLASS 13*57251285SSimon Glass * 14*57251285SSimon Glass * @regmap: Register map for this controller 15*57251285SSimon Glass */ 16*57251285SSimon Glass struct syscon_uc_info { 17*57251285SSimon Glass struct regmap *regmap; 18*57251285SSimon Glass }; 19*57251285SSimon Glass 20*57251285SSimon Glass /* So far there are no ops so this is a placeholder */ 21*57251285SSimon Glass struct syscon_ops { 22*57251285SSimon Glass }; 23*57251285SSimon Glass 24*57251285SSimon Glass #define syscon_get_ops(dev) ((struct syscon_ops *)(dev)->driver->ops) 25*57251285SSimon Glass 26*57251285SSimon Glass /** 27*57251285SSimon Glass * syscon_get_regmap() - Get access to a register map 28*57251285SSimon Glass * 29*57251285SSimon Glass * @dev: Device to check (UCLASS_SCON) 30*57251285SSimon Glass * @info: Returns regmap for the device 31*57251285SSimon Glass * @return 0 if OK, -ve on error 32*57251285SSimon Glass */ 33*57251285SSimon Glass struct regmap *syscon_get_regmap(struct udevice *dev); 34*57251285SSimon Glass 35*57251285SSimon Glass /** 36*57251285SSimon Glass * syscon_get_regmap_by_driver_data() - Look up a controller by its ID 37*57251285SSimon Glass * 38*57251285SSimon Glass * Each system controller can be accessed by its driver data, which is 39*57251285SSimon Glass * assumed to be unique through the scope of all system controllers that 40*57251285SSimon Glass * are in use. This function looks up the regmap given this driver data. 41*57251285SSimon Glass * 42*57251285SSimon Glass * @driver_data: Driver data value to look up 43*57251285SSimon Glass * @return register map correponding to @driver_data, or -ve error code 44*57251285SSimon Glass */ 45*57251285SSimon Glass struct regmap *syscon_get_regmap_by_driver_data(ulong driver_data); 46*57251285SSimon Glass 47*57251285SSimon Glass /** 48*57251285SSimon Glass * syscon_get_first_range() - get the first memory range from a syscon regmap 49*57251285SSimon Glass * 50*57251285SSimon Glass * @driver_data: Driver data value to look up 51*57251285SSimon Glass * @return first region of register map correponding to @driver_data, or 52*57251285SSimon Glass * -ve error code 53*57251285SSimon Glass */ 54*57251285SSimon Glass void *syscon_get_first_range(ulong driver_data); 55*57251285SSimon Glass 56*57251285SSimon Glass #endif 57