Revision f55966571d5eb2876a11e48e798b4592fa1ffbb7 authored by Linus Torvalds on 08 July 2021, 19:28:15 UTC, committed by Linus Torvalds on 08 July 2021, 19:28:15 UTC
Pull drm fixes from Dave Airlie: "Some fixes for rc1 that came in the past weeks, mainly a bunch of amdgpu fixes, some i915 and the rest are misc around the place. I'm sending this a bit early so some more stuff may show up, but I'll probably take tomorrow off. dma-buf: - doc fixes amdgpu: - Misc Navi fixes - Powergating fix - Yellow Carp updates - Beige Goby updates - S0ix fix - Revert overlay validation fix - GPU reset fix for DC - PPC64 fix - Add new dimgrey cavefish DID - RAS fix - TTM fixes amdkfd: - SVM fixes radeon: - Fix missing drm_gem_object_put in error path - NULL ptr deref fix i915: - display DP VSC fix - DG1 display fix - IRQ fixes - IRQ demidlayering gma500: - bo leaks in error paths fixed" * tag 'drm-next-2021-07-08-1' of git://anongit.freedesktop.org/drm/drm: (52 commits) drm/i915: Drop all references to DRM IRQ midlayer drm/i915: Use the correct IRQ during resume drm/i915/display/dg1: Correctly map DPLLs during state readout drm/i915/display: Do not zero past infoframes.vsc drm/amdgpu: Conditionally reset SDMA RAS error counts drm/amdkfd: Maintain svm_bo reference in page->zone_device_data drm/amdkfd: add invalid pages debug at vram migration drm/amdkfd: skip migration for pages already in VRAM drm/amdkfd: skip invalid pages during migrations drm/amdkfd: classify and map mixed svm range pages in GPU drm/amdkfd: use hmm range fault to get both domain pfns drm/amdgpu: get owner ref in validate and map drm/amdkfd: set owner ref to svm range prefault drm/amdkfd: add owner ref param to get hmm pages drm/amdkfd: device pgmap owner at the svm migrate init drm/amdkfd: inc counter on child ranges with xnack off drm/amd/display: Extend DMUB diagnostic logging to DCN3.1 drm/amdgpu: Update NV SIMD-per-CU to 2 drm/amdgpu: add new dimgrey cavefish DID drm/amd/pm: skip PrepareMp1ForUnload message in s0ix ...
menz69_wdt.c
// SPDX-License-Identifier: GPL-2.0
/*
* Watchdog driver for the MEN z069 IP-Core
*
* Copyright (C) 2018 Johannes Thumshirn <jth@kernel.org>
*/
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/mcb.h>
#include <linux/module.h>
#include <linux/watchdog.h>
struct men_z069_drv {
struct watchdog_device wdt;
void __iomem *base;
struct resource *mem;
};
#define MEN_Z069_WTR 0x10
#define MEN_Z069_WTR_WDEN BIT(15)
#define MEN_Z069_WTR_WDET_MASK 0x7fff
#define MEN_Z069_WVR 0x14
#define MEN_Z069_TIMER_FREQ 500 /* 500 Hz */
#define MEN_Z069_WDT_COUNTER_MIN 1
#define MEN_Z069_WDT_COUNTER_MAX 0x7fff
#define MEN_Z069_DEFAULT_TIMEOUT 30
static bool nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, bool, 0);
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
static int men_z069_wdt_start(struct watchdog_device *wdt)
{
struct men_z069_drv *drv = watchdog_get_drvdata(wdt);
u16 val;
val = readw(drv->base + MEN_Z069_WTR);
val |= MEN_Z069_WTR_WDEN;
writew(val, drv->base + MEN_Z069_WTR);
return 0;
}
static int men_z069_wdt_stop(struct watchdog_device *wdt)
{
struct men_z069_drv *drv = watchdog_get_drvdata(wdt);
u16 val;
val = readw(drv->base + MEN_Z069_WTR);
val &= ~MEN_Z069_WTR_WDEN;
writew(val, drv->base + MEN_Z069_WTR);
return 0;
}
static int men_z069_wdt_ping(struct watchdog_device *wdt)
{
struct men_z069_drv *drv = watchdog_get_drvdata(wdt);
u16 val;
/* The watchdog trigger value toggles between 0x5555 and 0xaaaa */
val = readw(drv->base + MEN_Z069_WVR);
val ^= 0xffff;
writew(val, drv->base + MEN_Z069_WVR);
return 0;
}
static int men_z069_wdt_set_timeout(struct watchdog_device *wdt,
unsigned int timeout)
{
struct men_z069_drv *drv = watchdog_get_drvdata(wdt);
u16 reg, val, ena;
wdt->timeout = timeout;
val = timeout * MEN_Z069_TIMER_FREQ;
reg = readw(drv->base + MEN_Z069_WVR);
ena = reg & MEN_Z069_WTR_WDEN;
reg = ena | val;
writew(reg, drv->base + MEN_Z069_WTR);
return 0;
}
static const struct watchdog_info men_z069_info = {
.options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
.identity = "MEN z069 Watchdog",
};
static const struct watchdog_ops men_z069_ops = {
.owner = THIS_MODULE,
.start = men_z069_wdt_start,
.stop = men_z069_wdt_stop,
.ping = men_z069_wdt_ping,
.set_timeout = men_z069_wdt_set_timeout,
};
static struct watchdog_device men_z069_wdt = {
.info = &men_z069_info,
.ops = &men_z069_ops,
.timeout = MEN_Z069_DEFAULT_TIMEOUT,
.min_timeout = 1,
.max_timeout = MEN_Z069_WDT_COUNTER_MAX / MEN_Z069_TIMER_FREQ,
};
static int men_z069_probe(struct mcb_device *dev,
const struct mcb_device_id *id)
{
struct men_z069_drv *drv;
struct resource *mem;
drv = devm_kzalloc(&dev->dev, sizeof(struct men_z069_drv), GFP_KERNEL);
if (!drv)
return -ENOMEM;
mem = mcb_request_mem(dev, "z069-wdt");
if (IS_ERR(mem))
return PTR_ERR(mem);
drv->base = devm_ioremap(&dev->dev, mem->start, resource_size(mem));
if (drv->base == NULL)
goto release_mem;
drv->mem = mem;
drv->wdt = men_z069_wdt;
watchdog_init_timeout(&drv->wdt, 0, &dev->dev);
watchdog_set_nowayout(&drv->wdt, nowayout);
watchdog_set_drvdata(&drv->wdt, drv);
drv->wdt.parent = &dev->dev;
mcb_set_drvdata(dev, drv);
return watchdog_register_device(&men_z069_wdt);
release_mem:
mcb_release_mem(mem);
return -ENOMEM;
}
static void men_z069_remove(struct mcb_device *dev)
{
struct men_z069_drv *drv = mcb_get_drvdata(dev);
watchdog_unregister_device(&drv->wdt);
mcb_release_mem(drv->mem);
}
static const struct mcb_device_id men_z069_ids[] = {
{ .device = 0x45 },
{ }
};
MODULE_DEVICE_TABLE(mcb, men_z069_ids);
static struct mcb_driver men_z069_driver = {
.driver = {
.name = "z069-wdt",
.owner = THIS_MODULE,
},
.probe = men_z069_probe,
.remove = men_z069_remove,
.id_table = men_z069_ids,
};
module_mcb_driver(men_z069_driver);
MODULE_AUTHOR("Johannes Thumshirn <jth@kernel.org>");
MODULE_LICENSE("GPL v2");
MODULE_ALIAS("mcb:16z069");
MODULE_IMPORT_NS(MCB);
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...