1
0
Fork 0

Reset controller changes for v4.16

- Fix device_reset_optional to be really optional
 - Header clean up: includes, warnings, and deprecated calls.
 - Add driver and bindings for the Meson-AXG SoC reset controller
 -----BEGIN PGP SIGNATURE-----
 
 iQJLBAABCAA1FiEEBsBxhV1FaKwXuCOBUMKIHHCeYOsFAlpLODAXHHAuemFiZWxA
 cGVuZ3V0cm9uaXguZGUACgkQUMKIHHCeYOtW4xAA3cW+A5m80FNxJEOH1fT6UINp
 FmFBl1tkaTjM4jVOtYRGD6qzfd+Tp6aGttid8IBj+b1VE6uDBpIt1M+uRobLbpRr
 XXwlYE5FZLHj2WlXR/dPheB55BnJF06Q3ieHI2QbEU+z2bExKMMj+9wgkwoWSgt/
 5Z6FU849aU8TPEps8z/YmTT+RlES+KUe8vX4wWvaE8Jle99HLOeIfkZtsYRPVdEB
 +DY2lZbV4eRGDL0GEtCiNY1csz2joM5NLD2xrIQ03TxcRI7wgrcLjjfj+ROfT2rt
 xPkWdfLpuzm2sH2VQyGbmenjA8je+q6yWIbQiUjdEPl5urz+ZLwbLr+IiKX96ARM
 aaVN8EehJm3OiklKT6u1JPOj8FZpsqpMLk8xfP1bxZMV+BHFbhdIaYnVt+7RGky6
 A6jfEcM8oXcgvb0AO4bGo3w3TIqdXX2zmL5PlG6RnzV8RbWwPfJO2DHKJq+Cppqr
 S07TBKes1zXpDtZqxW56Nd1Xnfjd39cDZGoWKqW1e8V2v8Pc6OTuCR3UlTer5mg5
 WgP2KDI6w55PiSHFW9s4sjGweDbzqccCo8JLaggn4QxDD2/JKUPFK1Xvd2+X77rC
 iJW1hDMPP4od3uOBuI2ze8KKK+BeNUEl86Dbdd3CzU+Nt6niNfF1xK7lg9pb5Pud
 YGo+QVAdExV0mFJaCvE=
 =Ks60
 -----END PGP SIGNATURE-----

Merge tag 'reset-for-4.16' of git://git.pengutronix.de/git/pza/linux into next/drivers

Pull "Reset controller changes for v4.16" from Philipp Zabel:

This adds Meson-AXG reset support and fixes a few issues with the reset
include header: device_reset_optional is fixed to be really optional,
unused headers are pruned, and useless warnings and deprecated API calls
are removed.

* tag 'reset-for-4.16' of git://git.pengutronix.de/git/pza/linux:
  reset: meson-axg: add compatible string for Meson-AXG SoC
  dt-bindings: reset: Add bindings for the Meson-AXG SoC Reset Controller
  reset: remove reset_control_get(_optional)
  reset: minimize the number of headers included from <linux/reset.h>
  reset: remove remaining WARN_ON() in <linux/reset.h>
  reset: make device_reset_optional() really optional
hifive-unleashed-5.1
Arnd Bergmann 2018-01-05 12:24:25 +01:00
commit c8ac0b10fd
5 changed files with 149 additions and 39 deletions

View File

@ -5,7 +5,8 @@ Please also refer to reset.txt in this directory for common reset
controller binding usage.
Required properties:
- compatible: Should be "amlogic,meson8b-reset" or "amlogic,meson-gxbb-reset"
- compatible: Should be "amlogic,meson8b-reset", "amlogic,meson-gxbb-reset" or
"amlogic,meson-axg-reset".
- reg: should contain the register address base
- #reset-cells: 1, see below

View File

@ -566,17 +566,18 @@ EXPORT_SYMBOL_GPL(__devm_reset_control_get);
* device_reset - find reset controller associated with the device
* and perform reset
* @dev: device to be reset by the controller
* @optional: whether it is optional to reset the device
*
* Convenience wrapper for reset_control_get() and reset_control_reset().
* Convenience wrapper for __reset_control_get() and reset_control_reset().
* This is useful for the common case of devices with single, dedicated reset
* lines.
*/
int device_reset(struct device *dev)
int __device_reset(struct device *dev, bool optional)
{
struct reset_control *rstc;
int ret;
rstc = reset_control_get(dev, NULL);
rstc = __reset_control_get(dev, NULL, 0, 0, optional);
if (IS_ERR(rstc))
return PTR_ERR(rstc);
@ -586,7 +587,7 @@ int device_reset(struct device *dev)
return ret;
}
EXPORT_SYMBOL_GPL(device_reset);
EXPORT_SYMBOL_GPL(__device_reset);
/**
* APIs to manage an array of reset controls.

View File

@ -139,6 +139,8 @@ static const struct of_device_id meson_reset_dt_ids[] = {
.data = &meson_reset_meson8_ops, },
{ .compatible = "amlogic,meson-gxbb-reset",
.data = &meson_reset_gx_ops, },
{ .compatible = "amlogic,meson-axg-reset",
.data = &meson_reset_gx_ops, },
{ /* sentinel */ },
};

View File

@ -0,0 +1,124 @@
/*
*
* Copyright (c) 2016 BayLibre, SAS.
* Author: Neil Armstrong <narmstrong@baylibre.com>
*
* Copyright (c) 2017 Amlogic, inc.
* Author: Yixun Lan <yixun.lan@amlogic.com>
*
* SPDX-License-Identifier: (GPL-2.0+ OR BSD)
*/
#ifndef _DT_BINDINGS_AMLOGIC_MESON_AXG_RESET_H
#define _DT_BINDINGS_AMLOGIC_MESON_AXG_RESET_H
/* RESET0 */
#define RESET_HIU 0
#define RESET_PCIE_A 1
#define RESET_PCIE_B 2
#define RESET_DDR_TOP 3
/* 4 */
#define RESET_VIU 5
#define RESET_PCIE_PHY 6
#define RESET_PCIE_APB 7
/* 8 */
/* 9 */
#define RESET_VENC 10
#define RESET_ASSIST 11
/* 12 */
#define RESET_VCBUS 13
/* 14 */
/* 15 */
#define RESET_GIC 16
#define RESET_CAPB3_DECODE 17
/* 18-21 */
#define RESET_SYS_CPU_CAPB3 22
#define RESET_CBUS_CAPB3 23
#define RESET_AHB_CNTL 24
#define RESET_AHB_DATA 25
#define RESET_VCBUS_CLK81 26
#define RESET_MMC 27
/* 28-31 */
/* RESET1 */
/* 32 */
/* 33 */
#define RESET_USB_OTG 34
#define RESET_DDR 35
#define RESET_AO_RESET 36
/* 37 */
#define RESET_AHB_SRAM 38
/* 39 */
/* 40 */
#define RESET_DMA 41
#define RESET_ISA 42
#define RESET_ETHERNET 43
/* 44 */
#define RESET_SD_EMMC_B 45
#define RESET_SD_EMMC_C 46
#define RESET_ROM_BOOT 47
#define RESET_SYS_CPU_0 48
#define RESET_SYS_CPU_1 49
#define RESET_SYS_CPU_2 50
#define RESET_SYS_CPU_3 51
#define RESET_SYS_CPU_CORE_0 52
#define RESET_SYS_CPU_CORE_1 53
#define RESET_SYS_CPU_CORE_2 54
#define RESET_SYS_CPU_CORE_3 55
#define RESET_SYS_PLL_DIV 56
#define RESET_SYS_CPU_AXI 57
#define RESET_SYS_CPU_L2 58
#define RESET_SYS_CPU_P 59
#define RESET_SYS_CPU_MBIST 60
/* 61-63 */
/* RESET2 */
/* 64 */
/* 65 */
#define RESET_AUDIO 66
/* 67 */
#define RESET_MIPI_HOST 68
#define RESET_AUDIO_LOCKER 69
#define RESET_GE2D 70
/* 71-76 */
#define RESET_AO_CPU_RESET 77
/* 78-95 */
/* RESET3 */
#define RESET_RING_OSCILLATOR 96
/* 97-127 */
/* RESET4 */
/* 128 */
/* 129 */
#define RESET_MIPI_PHY 130
/* 131-140 */
#define RESET_VENCL 141
#define RESET_I2C_MASTER_2 142
#define RESET_I2C_MASTER_1 143
/* 144-159 */
/* RESET5 */
/* 160-191 */
/* RESET6 */
#define RESET_PERIPHS_GENERAL 192
#define RESET_PERIPHS_SPICC 193
/* 194 */
/* 195 */
#define RESET_PERIPHS_I2C_MASTER_0 196
/* 197-200 */
#define RESET_PERIPHS_UART_0 201
#define RESET_PERIPHS_UART_1 202
/* 203-204 */
#define RESET_PERIPHS_SPI_0 205
#define RESET_PERIPHS_I2C_MASTER_3 206
/* 207-223 */
/* RESET7 */
#define RESET_USB_DDR_0 224
#define RESET_USB_DDR_1 225
#define RESET_USB_DDR_2 226
#define RESET_USB_DDR_3 227
/* 228 */
#define RESET_DEVICE_MMC_ARB 229
/* 230 */
#define RESET_VID_LOCK 231
#define RESET_A9_DMC_PIPEL 232
#define RESET_DMC_VPU_PIPEL 233
/* 234-255 */
#endif

View File

@ -2,8 +2,10 @@
#ifndef _LINUX_RESET_H_
#define _LINUX_RESET_H_
#include <linux/device.h>
#include <linux/types.h>
struct device;
struct device_node;
struct reset_control;
#ifdef CONFIG_RESET_CONTROLLER
@ -20,22 +22,16 @@ struct reset_control *__reset_control_get(struct device *dev, const char *id,
int index, bool shared,
bool optional);
void reset_control_put(struct reset_control *rstc);
int __device_reset(struct device *dev, bool optional);
struct reset_control *__devm_reset_control_get(struct device *dev,
const char *id, int index, bool shared,
bool optional);
int __must_check device_reset(struct device *dev);
struct reset_control *devm_reset_control_array_get(struct device *dev,
bool shared, bool optional);
struct reset_control *of_reset_control_array_get(struct device_node *np,
bool shared, bool optional);
static inline int device_reset_optional(struct device *dev)
{
return device_reset(dev);
}
#else
static inline int reset_control_reset(struct reset_control *rstc)
@ -62,15 +58,9 @@ static inline void reset_control_put(struct reset_control *rstc)
{
}
static inline int __must_check device_reset(struct device *dev)
static inline int __device_reset(struct device *dev, bool optional)
{
WARN_ON(1);
return -ENOTSUPP;
}
static inline int device_reset_optional(struct device *dev)
{
return -ENOTSUPP;
return optional ? 0 : -ENOTSUPP;
}
static inline struct reset_control *__of_reset_control_get(
@ -109,6 +99,16 @@ of_reset_control_array_get(struct device_node *np, bool shared, bool optional)
#endif /* CONFIG_RESET_CONTROLLER */
static inline int __must_check device_reset(struct device *dev)
{
return __device_reset(dev, false);
}
static inline int device_reset_optional(struct device *dev)
{
return __device_reset(dev, true);
}
/**
* reset_control_get_exclusive - Lookup and obtain an exclusive reference
* to a reset controller.
@ -127,9 +127,6 @@ of_reset_control_array_get(struct device_node *np, bool shared, bool optional)
static inline struct reset_control *
__must_check reset_control_get_exclusive(struct device *dev, const char *id)
{
#ifndef CONFIG_RESET_CONTROLLER
WARN_ON(1);
#endif
return __reset_control_get(dev, id, 0, false, false);
}
@ -275,9 +272,6 @@ static inline struct reset_control *
__must_check devm_reset_control_get_exclusive(struct device *dev,
const char *id)
{
#ifndef CONFIG_RESET_CONTROLLER
WARN_ON(1);
#endif
return __devm_reset_control_get(dev, id, 0, false, false);
}
@ -350,18 +344,6 @@ devm_reset_control_get_shared_by_index(struct device *dev, int index)
* These inline function calls will be removed once all consumers
* have been moved over to the new explicit API.
*/
static inline struct reset_control *reset_control_get(
struct device *dev, const char *id)
{
return reset_control_get_exclusive(dev, id);
}
static inline struct reset_control *reset_control_get_optional(
struct device *dev, const char *id)
{
return reset_control_get_optional_exclusive(dev, id);
}
static inline struct reset_control *of_reset_control_get(
struct device_node *node, const char *id)
{