Source
/*
* drivers/reset/reset-oxnas.c
*
* Copyright (C) 2016 Neil Armstrong <narmstrong@baylibre.com>
* Copyright (C) 2014 Ma Haijun <mahaijuns@gmail.com>
* Copyright (C) 2009 Oxford Semiconductor Ltd
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope 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.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* Regmap offsets */
struct oxnas_reset {
struct regmap *regmap;
struct reset_controller_dev rcdev;
};
static int oxnas_reset_reset(struct reset_controller_dev *rcdev,
unsigned long id)
{
struct oxnas_reset *data =
container_of(rcdev, struct oxnas_reset, rcdev);
regmap_write(data->regmap, RST_SET_REGOFFSET, BIT(id));
msleep(50);
regmap_write(data->regmap, RST_CLR_REGOFFSET, BIT(id));
return 0;
}
static int oxnas_reset_assert(struct reset_controller_dev *rcdev,
unsigned long id)
{
struct oxnas_reset *data =
container_of(rcdev, struct oxnas_reset, rcdev);
regmap_write(data->regmap, RST_SET_REGOFFSET, BIT(id));
return 0;
}