Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754804AbbHQKVZ (ORCPT ); Mon, 17 Aug 2015 06:21:25 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:58094 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754631AbbHQKVX (ORCPT ); Mon, 17 Aug 2015 06:21:23 -0400 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 X-AuditID: cbfee68d-f79106d00000728c-e6-55d1b5a12a37 Content-transfer-encoding: 8BIT Message-id: <55D1B5A1.3050209@samsung.com> Date: Mon, 17 Aug 2015 19:21:21 +0900 From: Jaehoon Chung User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 To: Ulf Hansson , =?UTF-8?B?SGVpa28gU3TDvGJuZXI=?= Cc: Seungwon Jeon , linux-mmc , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] mmc: dw_mmc: fix pio mode when internal dmac is enabled References: <3018549.c8iX1Dbrhm@diego> In-reply-to: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprAIsWRmVeSWpSXmKPExsWyRsSkQHfh1ouhBm8O6Fn8f/Sa1eLyrjls Fkf+9zNafLh/kdni+NpwB1aPO9f2sHn0bVnF6LH92jxmj8+b5AJYorhsUlJzMstSi/TtErgy Zn2/wlSwR67iysJm1gbGG6JdjJwcEgImEncnPmaEsMUkLtxbz9bFyMUhJLCCUeL1h52MMEUX L7QwQSRmMUrcevSJCSTBKyAo8WPyPZYuRg4OZgF5iSOXsiFMdYkpU3Ihyh8wSlx8fJQNolxL ouXgarBWFgFViY3H9rKA2GwCOhLbvx0Hi4sKhEmcmdEBFhcRiJPYPukAI8ggZoFJjBKrr/9k BkkIC/hIzOleCdYgJJArMXnvF3aQxZwCwRLXt0qD1EsI7GOXmPn+DTPEMgGJb5MPgd0pISAr sekAM8RfkhIHV9xgmcAoNgvJN7MQvpmF8M0CRuZVjK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sh7v3 bdu76NgCn9nXS+eeMmTjEJzAcMqouHWtzyf92SXOUSnSc9VyNgbZ273fcvnfzoYT2YdONiVO kzz8SDbG6YnQi82eK5JFFrO9Xlkz+82331Fnlbc6VHXkRHYcmbzsR++PbudzfS/PXGHROne1 7FPgrY5dSizFGYmGWsxFxYkAKbsvd/ACAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4053 Lines: 97 Hi, Ulf. On 08/17/2015 07:16 PM, Ulf Hansson wrote: > On 3 August 2015 at 17:04, Heiko Stübner wrote: >> The dw_mci_init_dma() may decide to not use dma, but pio instead, caused >> by things like wrong dma settings in the system. >> >> Till now the code dw_mci_init_slot() always assumed that dma is available >> when CONFIG_MMC_DW_IDMAC was defined, ignoring the host->use_dma var >> set during dma init. >> >> So when now the dma init failed for whatever reason, the transfer sizes >> would still be set for dma transfers, especially including the maximum >> block-count calculated from host->ring_size and resulting in a >> >> [ 4.991109] ------------[ cut here ]------------ >> [ 4.991111] kernel BUG at drivers/mmc/core/core.c:256! >> [ 4.991113] Internal error: Oops - BUG: 0 [#1] SMP ARM >> >> because host->ring_size is 0 in this case and the slot init code uses >> the wrong code to calculate the values. >> >> Fix this by selecting the correct calculations using the host->use_dma >> variable instead of the CONFIG_MMC_DW_IDMAC config option. >> >> Signed-off-by: Heiko Stuebner >> --- >> drivers/mmc/host/dw_mmc.c | 27 ++++++++++++++------------- >> 1 file changed, 14 insertions(+), 13 deletions(-) >> >> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c >> index 40e9d8e..9ec3521 100644 >> --- a/drivers/mmc/host/dw_mmc.c >> +++ b/drivers/mmc/host/dw_mmc.c >> @@ -2391,19 +2391,20 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id) >> mmc->max_seg_size = host->pdata->blk_settings->max_seg_size; >> } else { >> /* Useful defaults if platform data is unset. */ >> -#ifdef CONFIG_MMC_DW_IDMAC >> - mmc->max_segs = host->ring_size; >> - mmc->max_blk_size = 65536; >> - mmc->max_seg_size = 0x1000; >> - mmc->max_req_size = mmc->max_seg_size * host->ring_size; >> - mmc->max_blk_count = mmc->max_req_size / 512; >> -#else >> - mmc->max_segs = 64; >> - mmc->max_blk_size = 65536; /* BLKSIZ is 16 bits */ >> - mmc->max_blk_count = 512; >> - mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count; >> - mmc->max_seg_size = mmc->max_req_size; >> -#endif /* CONFIG_MMC_DW_IDMAC */ >> + if (host->use_dma) { >> + mmc->max_segs = host->ring_size; > > I expect this may cause a compiler error since host->ring_size is only > available in the struct dw_mci *host when CONFIG_MMC_DW_IDMAC is set. > > I have already pulled in this patch from Jaehoon's pull request. > Perhaps I should only amend the patch and change the host->ring_size > to be always available no matter if CONFIG_MMC_DW_IDMAC is set or not? Sorry for this. if you can, i think good that CONFIG_MMC_DW_IDMAC is removed at struct dw_mci. Could you amend it? If you want to get patch, i will send patch at now. Best Regards, Jaehoon Chung > >> + mmc->max_blk_size = 65536; >> + mmc->max_seg_size = 0x1000; >> + mmc->max_req_size = mmc->max_seg_size * host->ring_size; >> + mmc->max_blk_count = mmc->max_req_size / 512; >> + } else { >> + mmc->max_segs = 64; >> + mmc->max_blk_size = 65536; /* BLKSIZ is 16 bits */ >> + mmc->max_blk_count = 512; >> + mmc->max_req_size = mmc->max_blk_size * >> + mmc->max_blk_count; >> + mmc->max_seg_size = mmc->max_req_size; >> + } >> } >> >> if (dw_mci_get_cd(mmc)) >> -- >> 2.1.4 >> >> > > Kind regards > Uffe > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/