From patchwork Wed Jan 23 16:46:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2026111 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 6D0EB3FE4F for ; Wed, 23 Jan 2013 16:46:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754655Ab3AWQqW (ORCPT ); Wed, 23 Jan 2013 11:46:22 -0500 Received: from moutng.kundenserver.de ([212.227.126.171]:59856 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753105Ab3AWQqV (ORCPT ); Wed, 23 Jan 2013 11:46:21 -0500 Received: from axis700.grange (dslb-178-006-250-035.pools.arcor-ip.net [178.6.250.35]) by mrelayeu.kundenserver.de (node=mrbap4) with ESMTP (Nemesis) id 0M3jZR-1UpKZf3VtB-00rJDr; Wed, 23 Jan 2013 17:46:19 +0100 Received: by axis700.grange (Postfix, from userid 1000) id 827DA40B99; Wed, 23 Jan 2013 17:46:18 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id 7F95A40B98; Wed, 23 Jan 2013 17:46:18 +0100 (CET) Date: Wed, 23 Jan 2013 17:46:18 +0100 (CET) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: linux-sh@vger.kernel.org cc: linux-mmc@vger.kernel.org, Magnus Damm , Chris Ball Subject: [PATCH] mmc: tmio: add barriers to IO operations Message-ID: MIME-Version: 1.0 X-Provags-ID: V02:K0:fjzCkS32HYGvkz/ts46itvWckr1bMjmbWkfXfep8C6L gRQR0rBCZIT2sWtVjpEEiyvL3JskY7jjMkGR5EI4qKZ0zFCY3A MORJksGfjkaTIrWIyu1/zMIdm76j0SXU4Z0oCn4B5tjWh3lgFK BcTxLxGjl44qntdTl+30uqvUL6kh4ym1MaukH8eekQM3TpUAgl yJ0wu7ynhwNA8pywtVxcZuUgPlRkbRXIn+BXGgxrmg0hNv9eep h6uF/jKEcv9l04xSqOpn7JbpVjOqb2JqBeowZKVu2BW9M2eR3g tLpX1YYJQrP0ePnszwnFlmqHjrGPi3M59nMvdcQ60oA7f7yHjF of69j637PVNO2VhLiM7s35AK5NeABs0e7k4zobf4CfMN0kg7AS IL2nOSYG4OBXA== Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Without barriers SDIO operations fail with runtime PM enabled. Signed-off-by: Guennadi Liakhovetski --- drivers/mmc/host/tmio_mmc.h | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h index d857f5c..ad1a1c6 100644 --- a/drivers/mmc/host/tmio_mmc.h +++ b/drivers/mmc/host/tmio_mmc.h @@ -159,19 +159,20 @@ int tmio_mmc_host_runtime_resume(struct device *dev); static inline u16 sd_ctrl_read16(struct tmio_mmc_host *host, int addr) { - return readw(host->ctl + (addr << host->bus_shift)); + return ioread16(host->ctl + (addr << host->bus_shift)); } static inline void sd_ctrl_read16_rep(struct tmio_mmc_host *host, int addr, u16 *buf, int count) { + wmb(); readsw(host->ctl + (addr << host->bus_shift), buf, count); } static inline u32 sd_ctrl_read32(struct tmio_mmc_host *host, int addr) { - return readw(host->ctl + (addr << host->bus_shift)) | - readw(host->ctl + ((addr + 2) << host->bus_shift)) << 16; + return ioread16(host->ctl + (addr << host->bus_shift)) | + ioread16(host->ctl + ((addr + 2) << host->bus_shift)) << 16; } static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr, u16 val) @@ -181,19 +182,20 @@ static inline void sd_ctrl_write16(struct tmio_mmc_host *host, int addr, u16 val */ if (host->pdata->write16_hook && host->pdata->write16_hook(host, addr)) return; - writew(val, host->ctl + (addr << host->bus_shift)); + iowrite16(val, host->ctl + (addr << host->bus_shift)); } static inline void sd_ctrl_write16_rep(struct tmio_mmc_host *host, int addr, u16 *buf, int count) { writesw(host->ctl + (addr << host->bus_shift), buf, count); + wmb(); } static inline void sd_ctrl_write32(struct tmio_mmc_host *host, int addr, u32 val) { - writew(val, host->ctl + (addr << host->bus_shift)); - writew(val >> 16, host->ctl + ((addr + 2) << host->bus_shift)); + iowrite16(val, host->ctl + (addr << host->bus_shift)); + iowrite16(val >> 16, host->ctl + ((addr + 2) << host->bus_shift)); }