Kernel 5.4

AmigaOne X5000 platform specific issues related to Linux only.
Post Reply
User avatar
xeno74
Posts: 6190
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 5.4

Post by xeno74 »

Hi All,

I figured out that the DMA part of the commit 'mmc-v5.4-2' is responsible for the issue with the onboard SD card. I reduced the patch to the DMA part.


mmc2.patch:

Code: Select all

diff -rupN a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
--- a/drivers/mmc/host/sdhci.c	2019-10-04 12:40:23.736729250 +0200
+++ b/drivers/mmc/host/sdhci.c	2019-10-04 12:40:46.476869118 +0200
@@ -2874,7 +2874,6 @@ static void sdhci_cmd_irq(struct sdhci_h
 static void sdhci_adma_show_error(struct sdhci_host *host)
 {
 	void *desc = host->adma_table;
-	dma_addr_t dma = host->adma_addr;
 
 	sdhci_dumpregs(host);
 
@@ -2882,21 +2881,18 @@ static void sdhci_adma_show_error(struct
 		struct sdhci_adma2_64_desc *dma_desc = desc;
 
 		if (host->flags & SDHCI_USE_64_BIT_DMA)
-			SDHCI_DUMP("%08llx: DMA 0x%08x%08x, LEN 0x%04x, Attr=0x%02x\n",
-			    (unsigned long long)dma,
-			    le32_to_cpu(dma_desc->addr_hi),
+			DBG("%p: DMA 0x%08x%08x, LEN 0x%04x, Attr=0x%02x\n",
+			    desc, le32_to_cpu(dma_desc->addr_hi),
 			    le32_to_cpu(dma_desc->addr_lo),
 			    le16_to_cpu(dma_desc->len),
 			    le16_to_cpu(dma_desc->cmd));
 		else
-			SDHCI_DUMP("%08llx: DMA 0x%08x, LEN 0x%04x, Attr=0x%02x\n",
-			    (unsigned long long)dma,
-			    le32_to_cpu(dma_desc->addr_lo),
+			DBG("%p: DMA 0x%08x, LEN 0x%04x, Attr=0x%02x\n",
+			    desc, le32_to_cpu(dma_desc->addr_lo),
 			    le16_to_cpu(dma_desc->len),
 			    le16_to_cpu(dma_desc->cmd));
 
 		desc += host->desc_sz;
-		dma += host->desc_sz;
 
 		if (dma_desc->cmd & cpu_to_le16(ADMA2_END))
 			break;
@@ -2972,8 +2968,7 @@ static void sdhci_data_irq(struct sdhci_
 			!= MMC_BUS_TEST_R)
 		host->data->error = -EILSEQ;
 	else if (intmask & SDHCI_INT_ADMA_ERROR) {
-		pr_err("%s: ADMA error: 0x%08x\n", mmc_hostname(host->mmc),
-		       intmask);
+		pr_err("%s: ADMA error\n", mmc_hostname(host->mmc));
 		sdhci_adma_show_error(host);
 		host->data->error = -EIO;
 		if (host->ops->adma_workaround)
@@ -3781,14 +3776,18 @@ int sdhci_setup_host(struct sdhci_host *
 		host->flags &= ~SDHCI_USE_ADMA;
 	}
 
+	/*
+	 * It is assumed that a 64-bit capable device has set a 64-bit DMA mask
+	 * and *must* do 64-bit DMA.  A driver has the opportunity to change
+	 * that during the first call to ->enable_dma().  Similarly
+	 * SDHCI_QUIRK2_BROKEN_64_BIT_DMA must be left to the drivers to
+	 * implement.
+	 */
 	if (sdhci_can_64bit_dma(host))
 		host->flags |= SDHCI_USE_64_BIT_DMA;
 
 	if (host->flags & (SDHCI_USE_SDMA | SDHCI_USE_ADMA)) {
-		if (host->ops->set_dma_mask)
-			ret = host->ops->set_dma_mask(host);
-		else
-			ret = sdhci_set_dma_mask(host);
+		ret = sdhci_set_dma_mask(host);
 
 		if (!ret && host->ops->enable_dma)
 			ret = host->ops->enable_dma(host);
diff -rupN a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
--- a/drivers/mmc/host/sdhci.h	2019-10-04 12:40:23.736729250 +0200
+++ b/drivers/mmc/host/sdhci.h	2019-10-04 12:40:46.476869118 +0200
@@ -622,7 +622,6 @@ struct sdhci_ops {
 
 	u32		(*irq)(struct sdhci_host *host, u32 intmask);
 
-	int		(*set_dma_mask)(struct sdhci_host *host);
 	int		(*enable_dma)(struct sdhci_host *host);
 	unsigned int	(*get_max_clock)(struct sdhci_host *host);
 	unsigned int	(*get_min_clock)(struct sdhci_host *host);
diff -rupN a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
--- a/drivers/mmc/host/sdhci-of-esdhc.c	2019-10-04 12:40:23.736729250 +0200
+++ b/drivers/mmc/host/sdhci-of-esdhc.c	2019-10-04 12:40:46.476869118 +0200
@@ -495,12 +495,7 @@ static int esdhc_of_enable_dma(struct sd
 		dma_set_mask_and_coherent(dev, DMA_BIT_MASK(40));
 
 	value = sdhci_readl(host, ESDHC_DMA_SYSCTL);
-
-	if (of_dma_is_coherent(dev->of_node))
-		value |= ESDHC_DMA_SNOOP;
-	else
-		value &= ~ESDHC_DMA_SNOOP;
-
+	value |= ESDHC_DMA_SNOOP;
 	sdhci_writel(host, value, ESDHC_DMA_SYSCTL);
 	return 0;
 }
After that I patched the RC1 with this patch and compiled a new kernel.

Download: uImage-mmc3

Then I tested this new RC1 and the onboard SD card works.

dmesg output:

Code: Select all

[   12.114190] mmc0: SDHCI controller on ffe114000.sdhc [ffe114000.sdhc] using ADMA
[   12.222030] mmc0: new high speed SDHC card at address 59b4
[   12.228664] mmcblk0: mmc0:59b4 USD   3.73 GiB
Cheers,
Christian
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.

User avatar
kilaueabart
Posts: 719
Joined: Mon Mar 05, 2012 2:36 am

Re: Kernel 5.4

Post by kilaueabart »

xeno74 wrote: Please test the alpha1. I would like to know if Ubuntu boots with the alpha1.
I wish I had read your latest posts before I got started. Turned out to be a bit of a hassle setting up uImage-5.41, etc.

But for what it's worth, the answer appears to be yes, it works.
alpha1.png

User avatar
xeno74
Posts: 6190
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 5.4

Post by xeno74 »

kilaueabart wrote: I wish I had read your latest posts before I got started. Turned out to be a bit of a hassle setting up uImage-5.41, etc.

But for what it's worth, the answer appears to be yes, it works.
Thanks a lot for testing! :-)
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.

User avatar
xeno74
Posts: 6190
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 5.4

Post by xeno74 »

Hi All,

I have found the issue in the DMA changes of the 'mmc-v5.4-2' updates. It's the commit "121bd08b029e03404c451bb237729cdff76eafed (mmc: sdhci-of-esdhc: set DMA snooping based on DMA coherence)".

The commit changed the code of the file "drivers/mmc/host/sdhci-of-esdhc.c". I created a new patch.

New patch:

Code: Select all

diff -rupN a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c
--- a/drivers/mmc/host/sdhci-of-esdhc.c	2019-10-04 12:40:23.736729250 +0200
+++ b/drivers/mmc/host/sdhci-of-esdhc.c	2019-10-04 12:40:46.476869118 +0200
@@ -495,12 +495,7 @@ static int esdhc_of_enable_dma(struct sd
 		dma_set_mask_and_coherent(dev, DMA_BIT_MASK(40));
 
 	value = sdhci_readl(host, ESDHC_DMA_SYSCTL);
-
-	if (of_dma_is_coherent(dev->of_node))
-		value |= ESDHC_DMA_SNOOP;
-	else
-		value &= ~ESDHC_DMA_SNOOP;
-
+	value |= ESDHC_DMA_SNOOP;
 	sdhci_writel(host, value, ESDHC_DMA_SYSCTL);
 	return 0;
 }
I patched the RC1 with this patch and compiled it again.

Download kernel: uImage-mmc4

Download patch: mmc3.patch

Please test it.

Thanks,
Christian
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.

acefnq
Posts: 188
Joined: Fri Sep 09, 2011 9:58 am

Re: Kernel 5.4

Post by acefnq »

Hi Christian
UImage-mmc4 boots Ubuntu 16.04 fine.

ace

User avatar
xeno74
Posts: 6190
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 5.4

Post by xeno74 »

acefnq wrote:Hi Christian
UImage-mmc4 boots Ubuntu 16.04 fine.

ace
Ace,

Thanks a lot for testing! :-) Could you please post the output of dmesg | grep mmc0?

@All
I reported the issue with the onboard SD card on the linux-mmc mailing list today.

Cheers,
Christian
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.

User avatar
xeno74
Posts: 6190
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 5.4

Post by xeno74 »

Link to the thread on the linux-mmc mailing list: Onboard SD card doesn't work anymore after the 'mmc-v5.4-2' updates
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.

User avatar
xeno74
Posts: 6190
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 5.4

Post by xeno74 »

Hi All,

Here is the RC2 of kernel 5.4 for testing.

New:
Download: linux-image-5.4-rc2-X1000_X5000_A1222.tar.gz

Image

Please test the kernels.

Thanks,
Christian
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.

User avatar
Skateman
Posts: 513
Joined: Thu Aug 10, 2017 8:36 pm
Location: The Netherlands

Re: Kernel 5.4

Post by Skateman »

Kernel 5.4 RC2 is up and running on the AmigaOne X5000

Image

Big picture http://www.skateman.nl/wp-content/uploa ... 212110.png

Great work Christian!
AmigaOne X5000 -> 2GHz / 16GB RAM / Radeon R7 250 / M-Audio 5.1 -> AmigaOS 4.1 FE / Ubuntu Linux
Amiga 1200 -> Recapped / 68ec020 ACA 1221ec / CF HDD / RetroNET connected to the world

User avatar
xeno74
Posts: 6190
Joined: Fri Mar 23, 2012 7:58 am

Re: Kernel 5.4

Post by xeno74 »

Skateman wrote:Kernel 5.4 RC2 is up and running on the AmigaOne X5000

Great work Christian!
Hi Skateman,

Thanks a lot for testing! Great to see that your onboard SD card works!

Cheers,
Christian
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.

Post Reply