mmc: mediatek: Fixed bug where clock frequency could be set wrong
authoryong mao <yong.mao@mediatek.com>
Sat, 4 Mar 2017 07:10:03 +0000 (15:10 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Dec 2017 09:07:23 +0000 (10:07 +0100)
commit2a84fce9b0396b62c6e3020b5fb9f5378697b6ae
treeca80f4376d01e0609c97fed7d68e2b05678f09f3
parent28714e962a719d1898b6cff5d51352bac2135534
mmc: mediatek: Fixed bug where clock frequency could be set wrong

[ Upstream commit 40ceda09c8c84694c2ca6b00bcc6dc71e8e62d96 ]

This patch can fix two issues:

Issue 1:
In previous code, div may be overflow when setting clock frequency
as f_min. We can use DIV_ROUND_UP to fix this boundary related
issue.

Issue 2:
In previous code, we can not set the correct clock frequency when
div equals 0xff.

Signed-off-by: Yong Mao <yong.mao@mediatek.com>
Signed-off-by: Chaotian Jing <chaotian.jing@mediatek.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/mmc/host/mtk-sd.c