Commit 6e865c72 authored by Dave Airlie's avatar Dave Airlie

Merge tag 'drm/tegra/for-5.2-rc1' of git://anongit.freedesktop.org/tegra/linux into drm-next

drm/tegra: Changes for v5.2-rc1

This contains a fix for the usage of shared resets that previously
generated a WARN on boot. In addition, there's a fix for CPU cache
maintenance of GEM buffers allocated using get_pages().

(airlied: contains a merge from a shared tegra tree)
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>

From: Thierry Reding <thierry.reding@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190418151447.9430-1-thierry.reding@gmail.com
parents 8d8f6f70 61b51fb5
......@@ -204,7 +204,7 @@ static void tegra_bo_free(struct drm_device *drm, struct tegra_bo *bo)
{
if (bo->pages) {
dma_unmap_sg(drm->dev, bo->sgt->sgl, bo->sgt->nents,
DMA_BIDIRECTIONAL);
DMA_FROM_DEVICE);
drm_gem_put_pages(&bo->gem, bo->pages, true, true);
sg_free_table(bo->sgt);
kfree(bo->sgt);
......@@ -230,7 +230,7 @@ static int tegra_bo_get_pages(struct drm_device *drm, struct tegra_bo *bo)
}
err = dma_map_sg(drm->dev, bo->sgt->sgl, bo->sgt->nents,
DMA_BIDIRECTIONAL);
DMA_FROM_DEVICE);
if (err == 0) {
err = -EFAULT;
goto free_sgt;
......
......@@ -2871,6 +2871,13 @@ static int tegra_sor_init(struct host1x_client *client)
* kernel is possible.
*/
if (sor->rst) {
err = reset_control_acquire(sor->rst);
if (err < 0) {
dev_err(sor->dev, "failed to acquire SOR reset: %d\n",
err);
return err;
}
err = reset_control_assert(sor->rst);
if (err < 0) {
dev_err(sor->dev, "failed to assert SOR reset: %d\n",
......@@ -2894,6 +2901,8 @@ static int tegra_sor_init(struct host1x_client *client)
err);
return err;
}
reset_control_release(sor->rst);
}
err = clk_prepare_enable(sor->clk_safe);
......@@ -3331,7 +3340,7 @@ static int tegra_sor_probe(struct platform_device *pdev)
goto remove;
}
sor->rst = devm_reset_control_get(&pdev->dev, "sor");
sor->rst = devm_reset_control_get_exclusive_released(&pdev->dev, "sor");
if (IS_ERR(sor->rst)) {
err = PTR_ERR(sor->rst);
......@@ -3519,6 +3528,8 @@ static int tegra_sor_suspend(struct device *dev)
dev_err(dev, "failed to assert reset: %d\n", err);
return err;
}
reset_control_release(sor->rst);
}
usleep_range(1000, 2000);
......@@ -3542,9 +3553,17 @@ static int tegra_sor_resume(struct device *dev)
usleep_range(1000, 2000);
if (sor->rst) {
err = reset_control_acquire(sor->rst);
if (err < 0) {
dev_err(dev, "failed to acquire reset: %d\n", err);
clk_disable_unprepare(sor->clk);
return err;
}
err = reset_control_deassert(sor->rst);
if (err < 0) {
dev_err(dev, "failed to deassert reset: %d\n", err);
reset_control_release(sor->rst);
clk_disable_unprepare(sor->clk);
return err;
}
......
This diff is collapsed.
......@@ -107,7 +107,8 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
simple->pulse_resets = true;
}
simple->resets = of_reset_control_array_get(np, shared_resets, true);
simple->resets = of_reset_control_array_get(np, shared_resets, true,
true);
if (IS_ERR(simple->resets)) {
ret = PTR_ERR(simple->resets);
dev_err(dev, "failed to get device resets, err=%d\n", ret);
......
......@@ -14,23 +14,26 @@ int reset_control_reset(struct reset_control *rstc);
int reset_control_assert(struct reset_control *rstc);
int reset_control_deassert(struct reset_control *rstc);
int reset_control_status(struct reset_control *rstc);
int reset_control_acquire(struct reset_control *rstc);
void reset_control_release(struct reset_control *rstc);
struct reset_control *__of_reset_control_get(struct device_node *node,
const char *id, int index, bool shared,
bool optional);
bool optional, bool acquired);
struct reset_control *__reset_control_get(struct device *dev, const char *id,
int index, bool shared,
bool optional);
bool optional, bool acquired);
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);
bool optional, bool acquired);
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);
bool shared, bool optional,
bool acquired);
int reset_control_get_count(struct device *dev);
......@@ -56,6 +59,15 @@ static inline int reset_control_status(struct reset_control *rstc)
return 0;
}
static inline int reset_control_acquire(struct reset_control *rstc)
{
return 0;
}
static inline void reset_control_release(struct reset_control *rstc)
{
}
static inline void reset_control_put(struct reset_control *rstc)
{
}
......@@ -68,21 +80,23 @@ static inline int __device_reset(struct device *dev, bool optional)
static inline struct reset_control *__of_reset_control_get(
struct device_node *node,
const char *id, int index, bool shared,
bool optional)
bool optional, bool acquired)
{
return optional ? NULL : ERR_PTR(-ENOTSUPP);
}
static inline struct reset_control *__reset_control_get(
struct device *dev, const char *id,
int index, bool shared, bool optional)
int index, bool shared, bool optional,
bool acquired)
{
return optional ? NULL : ERR_PTR(-ENOTSUPP);
}
static inline struct reset_control *__devm_reset_control_get(
struct device *dev, const char *id,
int index, bool shared, bool optional)
int index, bool shared, bool optional,
bool acquired)
{
return optional ? NULL : ERR_PTR(-ENOTSUPP);
}
......@@ -94,7 +108,8 @@ devm_reset_control_array_get(struct device *dev, bool shared, bool optional)
}
static inline struct reset_control *
of_reset_control_array_get(struct device_node *np, bool shared, bool optional)
of_reset_control_array_get(struct device_node *np, bool shared, bool optional,
bool acquired)
{
return optional ? NULL : ERR_PTR(-ENOTSUPP);
}
......@@ -134,7 +149,28 @@ static inline int device_reset_optional(struct device *dev)
static inline struct reset_control *
__must_check reset_control_get_exclusive(struct device *dev, const char *id)
{
return __reset_control_get(dev, id, 0, false, false);
return __reset_control_get(dev, id, 0, false, false, true);
}
/**
* reset_control_get_exclusive_released - Lookup and obtain a temoprarily
* exclusive reference to a reset
* controller.
* @dev: device to be reset by the controller
* @id: reset line name
*
* Returns a struct reset_control or IS_ERR() condition containing errno.
* reset-controls returned by this function must be acquired via
* reset_control_acquire() before they can be used and should be released
* via reset_control_release() afterwards.
*
* Use of id names is optional.
*/
static inline struct reset_control *
__must_check reset_control_get_exclusive_released(struct device *dev,
const char *id)
{
return __reset_control_get(dev, id, 0, false, false, false);
}
/**
......@@ -162,19 +198,19 @@ __must_check reset_control_get_exclusive(struct device *dev, const char *id)
static inline struct reset_control *reset_control_get_shared(
struct device *dev, const char *id)
{
return __reset_control_get(dev, id, 0, true, false);
return __reset_control_get(dev, id, 0, true, false, false);
}
static inline struct reset_control *reset_control_get_optional_exclusive(
struct device *dev, const char *id)
{
return __reset_control_get(dev, id, 0, false, true);
return __reset_control_get(dev, id, 0, false, true, true);
}
static inline struct reset_control *reset_control_get_optional_shared(
struct device *dev, const char *id)
{
return __reset_control_get(dev, id, 0, true, true);
return __reset_control_get(dev, id, 0, true, true, false);
}
/**
......@@ -190,7 +226,7 @@ static inline struct reset_control *reset_control_get_optional_shared(
static inline struct reset_control *of_reset_control_get_exclusive(
struct device_node *node, const char *id)
{
return __of_reset_control_get(node, id, 0, false, false);
return __of_reset_control_get(node, id, 0, false, false, true);
}
/**
......@@ -215,7 +251,7 @@ static inline struct reset_control *of_reset_control_get_exclusive(
static inline struct reset_control *of_reset_control_get_shared(
struct device_node *node, const char *id)
{
return __of_reset_control_get(node, id, 0, true, false);
return __of_reset_control_get(node, id, 0, true, false, false);
}
/**
......@@ -232,7 +268,7 @@ static inline struct reset_control *of_reset_control_get_shared(
static inline struct reset_control *of_reset_control_get_exclusive_by_index(
struct device_node *node, int index)
{
return __of_reset_control_get(node, NULL, index, false, false);
return __of_reset_control_get(node, NULL, index, false, false, true);
}
/**
......@@ -260,7 +296,7 @@ static inline struct reset_control *of_reset_control_get_exclusive_by_index(
static inline struct reset_control *of_reset_control_get_shared_by_index(
struct device_node *node, int index)
{
return __of_reset_control_get(node, NULL, index, true, false);
return __of_reset_control_get(node, NULL, index, true, false, false);
}
/**
......@@ -279,7 +315,26 @@ static inline struct reset_control *
__must_check devm_reset_control_get_exclusive(struct device *dev,
const char *id)
{
return __devm_reset_control_get(dev, id, 0, false, false);
return __devm_reset_control_get(dev, id, 0, false, false, true);
}
/**
* devm_reset_control_get_exclusive_released - resource managed
* reset_control_get_exclusive_released()
* @dev: device to be reset by the controller
* @id: reset line name
*
* Managed reset_control_get_exclusive_released(). For reset controllers
* returned from this function, reset_control_put() is called automatically on
* driver detach.
*
* See reset_control_get_exclusive_released() for more information.
*/
static inline struct reset_control *
__must_check devm_reset_control_get_exclusive_released(struct device *dev,
const char *id)
{
return __devm_reset_control_get(dev, id, 0, false, false, false);
}
/**
......@@ -294,19 +349,19 @@ __must_check devm_reset_control_get_exclusive(struct device *dev,
static inline struct reset_control *devm_reset_control_get_shared(
struct device *dev, const char *id)
{
return __devm_reset_control_get(dev, id, 0, true, false);
return __devm_reset_control_get(dev, id, 0, true, false, false);
}
static inline struct reset_control *devm_reset_control_get_optional_exclusive(
struct device *dev, const char *id)
{
return __devm_reset_control_get(dev, id, 0, false, true);
return __devm_reset_control_get(dev, id, 0, false, true, true);
}
static inline struct reset_control *devm_reset_control_get_optional_shared(
struct device *dev, const char *id)
{
return __devm_reset_control_get(dev, id, 0, true, true);
return __devm_reset_control_get(dev, id, 0, true, true, false);
}
/**
......@@ -324,7 +379,7 @@ static inline struct reset_control *devm_reset_control_get_optional_shared(
static inline struct reset_control *
devm_reset_control_get_exclusive_by_index(struct device *dev, int index)
{
return __devm_reset_control_get(dev, NULL, index, false, false);
return __devm_reset_control_get(dev, NULL, index, false, false, true);
}
/**
......@@ -340,7 +395,7 @@ devm_reset_control_get_exclusive_by_index(struct device *dev, int index)
static inline struct reset_control *
devm_reset_control_get_shared_by_index(struct device *dev, int index)
{
return __devm_reset_control_get(dev, NULL, index, true, false);
return __devm_reset_control_get(dev, NULL, index, true, false, false);
}
/*
......@@ -412,24 +467,30 @@ devm_reset_control_array_get_optional_shared(struct device *dev)
static inline struct reset_control *
of_reset_control_array_get_exclusive(struct device_node *node)
{
return of_reset_control_array_get(node, false, false);
return of_reset_control_array_get(node, false, false, true);
}
static inline struct reset_control *
of_reset_control_array_get_exclusive_released(struct device_node *node)
{
return of_reset_control_array_get(node, false, false, false);
}
static inline struct reset_control *
of_reset_control_array_get_shared(struct device_node *node)
{
return of_reset_control_array_get(node, true, false);
return of_reset_control_array_get(node, true, false, true);
}
static inline struct reset_control *
of_reset_control_array_get_optional_exclusive(struct device_node *node)
{
return of_reset_control_array_get(node, false, true);
return of_reset_control_array_get(node, false, true, true);
}
static inline struct reset_control *
of_reset_control_array_get_optional_shared(struct device_node *node)
{
return of_reset_control_array_get(node, true, true);
return of_reset_control_array_get(node, true, true, true);
}
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment