From: Matthew Wilcox Date: Sat, 4 May 2013 10:43:17 +0000 (-0400) Subject: NVMe: Only clear the enable bit when disabling controller X-Git-Tag: upstream/snapshot3+hdmi~5119^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=44af146a84fa4a8e136d824207dcd356958a112b;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git NVMe: Only clear the enable bit when disabling controller Many of the bits in the Controller Configuration register may only be modified when the Enable bit is clear. Clearing them at the same time as the Enable bit might be OK, but let's play it safe and only touch the Enable bit. Signed-off-by: Matthew Wilcox Reviewed-by: Keith Busch --- diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index 2b1b5a7..310d573 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c @@ -1137,7 +1137,10 @@ static int nvme_wait_ready(struct nvme_dev *dev, u64 cap, bool enabled) */ static int nvme_disable_ctrl(struct nvme_dev *dev, u64 cap) { - writel(0, &dev->bar->cc); + u32 cc = readl(&dev->bar->cc); + + if (cc & NVME_CC_ENABLE) + writel(cc & ~NVME_CC_ENABLE, &dev->bar->cc); return nvme_wait_ready(dev, cap, false); }