All of lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND] Altera socfpga big endian work
@ 2015-03-25 11:27 Ben Dooks
  2015-03-25 11:27 ` [PATCH RESEND 1/7] ARM: debug: fix big endian operation for 8250 word mode Ben Dooks
                   ` (7 more replies)
  0 siblings, 8 replies; 19+ messages in thread
From: Ben Dooks @ 2015-03-25 11:27 UTC (permalink / raw)
  To: linux-arm-kernel

This series enables the core of the socfpga systen to run in big endian
mode. It inclusdes support for debug uart, secondary core boot and has
support for timers and initial conversion patches for the mmc.

The two drivers that are known to not work are the Ethernet and the
dwc2 usb. I do not have data for either, so I currently do not know
if it possible to change the hardware's endian fetch mode.

The dwc2 driver on my cyclone5 socfpga board with v4.0-rc5 does not
work in little endian mode, which makes testing converting the driver
difficult. The supplied 3.10 kernel does work so it is not down to the
hardware. It detects the presence of a new device and then fails to
enumerate it (no other errors shown)

This is up on git.baserock.org/delta/linux.git in the branch
baserock/bjdooks/socfpga-v5

Sorry, this is a resend due to incorrect linux-arm-kernel mailing list
address.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH RESEND 1/7] ARM: debug: fix big endian operation for 8250 word mode
  2015-03-25 11:27 [RESEND] Altera socfpga big endian work Ben Dooks
@ 2015-03-25 11:27 ` Ben Dooks
  2015-03-25 11:27 ` [PATCH RESEND 2/7] ARM: socfpga: enable big endian for secondary core(s) Ben Dooks
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Ben Dooks @ 2015-03-25 11:27 UTC (permalink / raw)
  To: linux-arm-kernel

If the 8250 debug code is used in word mode on an big endian
host then the writes need to be change into little endian for
the bus.

Note, we have to re-convert the value back as the debug code
will inspect the value after writing it to see if a newline
has been written.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
 arch/arm/include/debug/8250.S | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/include/debug/8250.S b/arch/arm/include/debug/8250.S
index 7a2baf9..7f7446f 100644
--- a/arch/arm/include/debug/8250.S
+++ b/arch/arm/include/debug/8250.S
@@ -16,11 +16,14 @@
 
 #ifdef CONFIG_DEBUG_UART_8250_WORD
 		.macro	store, rd, rx:vararg
+	 ARM_BE8(rev \rd, \rd)
 		str	\rd, \rx
+	 ARM_BE8(rev \rd, \rd)
 		.endm
 
 		.macro	load, rd, rx:vararg
 		ldr	\rd, \rx
+	ARM_BE8(rev \rd, \rd)
 		.endm
 #else
 		.macro	store, rd, rx:vararg
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH RESEND 2/7] ARM: socfpga: enable big endian for secondary core(s)
  2015-03-25 11:27 [RESEND] Altera socfpga big endian work Ben Dooks
  2015-03-25 11:27 ` [PATCH RESEND 1/7] ARM: debug: fix big endian operation for 8250 word mode Ben Dooks
@ 2015-03-25 11:27 ` Ben Dooks
  2015-03-25 11:27 ` [PATCH RESEND 3/7] ARM: socfpga: support big endian for socfpga Ben Dooks
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Ben Dooks @ 2015-03-25 11:27 UTC (permalink / raw)
  To: linux-arm-kernel

Update the secondary code to allow the secondary boot to work when the
system is running big endian.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
--
CC: Linux ARM Kernel <linux-arm-kernel@lists.infradead.org>
CC: Dinh Nguyen <dinguyen@opensource.altera.com>
---
 arch/arm/mach-socfpga/headsmp.S | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-socfpga/headsmp.S b/arch/arm/mach-socfpga/headsmp.S
index f65ea0a..a580dcd 100644
--- a/arch/arm/mach-socfpga/headsmp.S
+++ b/arch/arm/mach-socfpga/headsmp.S
@@ -10,6 +10,7 @@
 #include <linux/linkage.h>
 #include <linux/init.h>
 #include <asm/memory.h>
+#include <asm/assembler.h>
 
 	.arch	armv7-a
 
@@ -18,12 +19,14 @@ ENTRY(secondary_trampoline)
 	 * Thus, we can just subtract the PAGE_OFFSET to get the physical
 	 * address of &cpu1start_addr. This would not work for platforms
 	 * where the physical memory does not start at 0x0.
-	 */
+	*/
+ARM_BE8(setend	be)
 	adr	r0, 1f
 	ldmia	r0, {r1, r2}
 	sub	r2, r2, #PAGE_OFFSET
 	ldr	r3, [r2]
 	ldr	r4, [r3]
+ARM_BE8(rev	r4, r4)
 	bx	r4
 
 	.align
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH RESEND 3/7] ARM: socfpga: support big endian for socfpga
  2015-03-25 11:27 [RESEND] Altera socfpga big endian work Ben Dooks
  2015-03-25 11:27 ` [PATCH RESEND 1/7] ARM: debug: fix big endian operation for 8250 word mode Ben Dooks
  2015-03-25 11:27 ` [PATCH RESEND 2/7] ARM: socfpga: enable big endian for secondary core(s) Ben Dooks
@ 2015-03-25 11:27 ` Ben Dooks
  2015-03-25 11:27 ` [PATCH RESEND 4/7] clocksource: dw_apb_timer_of: make IO endian agnostic Ben Dooks
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Ben Dooks @ 2015-03-25 11:27 UTC (permalink / raw)
  To: linux-arm-kernel

Now the debug and platsmp.S are fixed for big endian, the
architecture can now advertise big endian support.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
--
CC: Linux ARM Kernel <linux-arm-kernel@lists.infradead.org>
CC: Dinh Nguyen <dinguyen@opensource.altera.com>
---
 arch/arm/mach-socfpga/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-socfpga/Kconfig b/arch/arm/mach-socfpga/Kconfig
index b5f8d75..f420a1b 100644
--- a/arch/arm/mach-socfpga/Kconfig
+++ b/arch/arm/mach-socfpga/Kconfig
@@ -1,5 +1,6 @@
 config ARCH_SOCFPGA
 	bool "Altera SOCFPGA family" if ARCH_MULTI_V7
+	select ARCH_SUPPORTS_BIG_ENDIAN
 	select ARM_AMBA
 	select ARM_GIC
 	select CACHE_L2X0
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH RESEND 4/7] clocksource: dw_apb_timer_of: make IO endian agnostic
  2015-03-25 11:27 [RESEND] Altera socfpga big endian work Ben Dooks
                   ` (2 preceding siblings ...)
  2015-03-25 11:27 ` [PATCH RESEND 3/7] ARM: socfpga: support big endian for socfpga Ben Dooks
@ 2015-03-25 11:27 ` Ben Dooks
  2015-03-25 11:27   ` Ben Dooks
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Ben Dooks @ 2015-03-25 11:27 UTC (permalink / raw)
  To: linux-arm-kernel

The dw_apb_timer_of timer is using __raw_readl to access the timer
register, which is causing issues when the system is running in
big endian mode. Fix this by using readl_relaxed() which should
account for the endian settings.

This fixes issues where the time jumps around in the dmesg output
due to returnling __le32 values.

For an example, these two console lines show time running backwards:

[   49.882572] CPU1: failed to come online
[   43.282457] Brought up 1 CPUs

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
--
CC: Daniel Lezcano <daniel.lezcano@linaro.org>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Linux ARM Kernel <linux-arm-kernel@lists.infradead.org>
CC: Dinh Nguyen <dinguyen@opensource.altera.com>
---
 drivers/clocksource/dw_apb_timer_of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/dw_apb_timer_of.c b/drivers/clocksource/dw_apb_timer_of.c
index d305fb0..a19a3f6 100644
--- a/drivers/clocksource/dw_apb_timer_of.c
+++ b/drivers/clocksource/dw_apb_timer_of.c
@@ -108,7 +108,7 @@ static void __init add_clocksource(struct device_node *source_timer)
 
 static u64 notrace read_sched_clock(void)
 {
-	return ~__raw_readl(sched_io_base);
+	return ~readl_relaxed(sched_io_base);
 }
 
 static const struct of_device_id sptimer_ids[] __initconst = {
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH RESEND 5/7] mmc: host: dw_mmc make IO accessors endian agnostic
  2015-03-25 11:27 [RESEND] Altera socfpga big endian work Ben Dooks
@ 2015-03-25 11:27   ` Ben Dooks
  2015-03-25 11:27 ` [PATCH RESEND 2/7] ARM: socfpga: enable big endian for secondary core(s) Ben Dooks
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Ben Dooks @ 2015-03-25 11:27 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-kernel, marc.dunford, sam.bishop, Dinh Nguyen, Ben Dooks,
	Linux MMC, Chris Ball, Ulf Hansson, Jaehoon Chung, Seungwon Jeon

The dw_mmc driver does not use endian agnostic IO accessors, so fix
the use of __raw reads and writes to be the relaxed versions.

This fixes the dw_mmc driver initialisation on Altera socfpga in big endian.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
--
CC: Linux MMC <linux-mmc@vger.kernel.org>
CC: Linux ARM Kernel <linux-arm-kernel@lists.infradead.org>
CC: Dinh Nguyen <dinguyen@opensource.altera.com>
CC: Chris Ball <chris@printf.net>
CC: Ulf Hansson <ulf.hansson@linaro.org>
CC: Jaehoon Chung <jh80.chung@samsung.com>
CC: Seungwon Jeon <tgih.jun@samsung.com>
---
 drivers/mmc/host/dw_mmc.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
index 18c4afe..46efdc5 100644
--- a/drivers/mmc/host/dw_mmc.h
+++ b/drivers/mmc/host/dw_mmc.h
@@ -171,22 +171,22 @@
 
 /* Register access macros */
 #define mci_readl(dev, reg)			\
-	__raw_readl((dev)->regs + SDMMC_##reg)
+	readl_relaxed((dev)->regs + SDMMC_##reg)
 #define mci_writel(dev, reg, value)			\
-	__raw_writel((value), (dev)->regs + SDMMC_##reg)
+	writel_relaxed((value), (dev)->regs + SDMMC_##reg)
 
 /* 16-bit FIFO access macros */
 #define mci_readw(dev, reg)			\
-	__raw_readw((dev)->regs + SDMMC_##reg)
+	readw_relaxed((dev)->regs + SDMMC_##reg)
 #define mci_writew(dev, reg, value)			\
-	__raw_writew((value), (dev)->regs + SDMMC_##reg)
+	writew_relaxed((value), (dev)->regs + SDMMC_##reg)
 
 /* 64-bit FIFO access macros */
 #ifdef readq
 #define mci_readq(dev, reg)			\
-	__raw_readq((dev)->regs + SDMMC_##reg)
+	readq_relaxed((dev)->regs + SDMMC_##reg)
 #define mci_writeq(dev, reg, value)			\
-	__raw_writeq((value), (dev)->regs + SDMMC_##reg)
+	writeq_relaxed((value), (dev)->regs + SDMMC_##reg)
 #else
 /*
  * Dummy readq implementation for architectures that don't define it.
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH RESEND 5/7] mmc: host: dw_mmc make IO accessors endian agnostic
@ 2015-03-25 11:27   ` Ben Dooks
  0 siblings, 0 replies; 19+ messages in thread
From: Ben Dooks @ 2015-03-25 11:27 UTC (permalink / raw)
  To: linux-arm-kernel

The dw_mmc driver does not use endian agnostic IO accessors, so fix
the use of __raw reads and writes to be the relaxed versions.

This fixes the dw_mmc driver initialisation on Altera socfpga in big endian.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
--
CC: Linux MMC <linux-mmc@vger.kernel.org>
CC: Linux ARM Kernel <linux-arm-kernel@lists.infradead.org>
CC: Dinh Nguyen <dinguyen@opensource.altera.com>
CC: Chris Ball <chris@printf.net>
CC: Ulf Hansson <ulf.hansson@linaro.org>
CC: Jaehoon Chung <jh80.chung@samsung.com>
CC: Seungwon Jeon <tgih.jun@samsung.com>
---
 drivers/mmc/host/dw_mmc.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
index 18c4afe..46efdc5 100644
--- a/drivers/mmc/host/dw_mmc.h
+++ b/drivers/mmc/host/dw_mmc.h
@@ -171,22 +171,22 @@
 
 /* Register access macros */
 #define mci_readl(dev, reg)			\
-	__raw_readl((dev)->regs + SDMMC_##reg)
+	readl_relaxed((dev)->regs + SDMMC_##reg)
 #define mci_writel(dev, reg, value)			\
-	__raw_writel((value), (dev)->regs + SDMMC_##reg)
+	writel_relaxed((value), (dev)->regs + SDMMC_##reg)
 
 /* 16-bit FIFO access macros */
 #define mci_readw(dev, reg)			\
-	__raw_readw((dev)->regs + SDMMC_##reg)
+	readw_relaxed((dev)->regs + SDMMC_##reg)
 #define mci_writew(dev, reg, value)			\
-	__raw_writew((value), (dev)->regs + SDMMC_##reg)
+	writew_relaxed((value), (dev)->regs + SDMMC_##reg)
 
 /* 64-bit FIFO access macros */
 #ifdef readq
 #define mci_readq(dev, reg)			\
-	__raw_readq((dev)->regs + SDMMC_##reg)
+	readq_relaxed((dev)->regs + SDMMC_##reg)
 #define mci_writeq(dev, reg, value)			\
-	__raw_writeq((value), (dev)->regs + SDMMC_##reg)
+	writeq_relaxed((value), (dev)->regs + SDMMC_##reg)
 #else
 /*
  * Dummy readq implementation for architectures that don't define it.
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH RESEND 6/7] mmc: host: dw_mmc: change idmac descriptor files to __le32
  2015-03-25 11:27 [RESEND] Altera socfpga big endian work Ben Dooks
@ 2015-03-25 11:27   ` Ben Dooks
  2015-03-25 11:27 ` [PATCH RESEND 2/7] ARM: socfpga: enable big endian for secondary core(s) Ben Dooks
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Ben Dooks @ 2015-03-25 11:27 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-kernel, marc.dunford, sam.bishop, Dinh Nguyen, Ben Dooks,
	Linux MCC, Chris Ball, Ulf Hansson, Jaehoon Chung, Seungwon Jeon

The dw_mmc driver does not take into account the processor may be in
big endian when writing the descriptors. Change the descriptors for
the 32bit IDMA to use __le32 and ensure they are suitably swapped
before writing.

Note, this has not been tested as the socfpga driver does not try to
use idma.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
--
CC: Linux MCC <linux-mmc@vger.kernel.org>
CC: Linux ARM Kernel <linux-arm-kernel@lists.infradead.org>
CC: Dinh Nguyen <dinguyen@opensource.altera.com>
CC: Chris Ball <chris@printf.net>
CC: Ulf Hansson <ulf.hansson@linaro.org>
CC: Jaehoon Chung <jh80.chung@samsung.com>
CC: Seungwon Jeon <tgih.jun@samsung.com>
---
 drivers/mmc/host/dw_mmc.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 4d2e3c2..12e681c 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -69,7 +69,7 @@ struct idmac_desc_64addr {
 
 	u32		des2;	/*Buffer sizes */
 #define IDMAC_64ADDR_SET_BUFFER1_SIZE(d, s) \
-	((d)->des2 = ((d)->des2 & 0x03ffe000) | ((s) & 0x1fff))
+	((d)->des2 = ((d)->des2 & cpu_to_le32(0x03ffe000)) | ((cpu_to_le32(s)) & cpu_to_le32(0x1fff)))
 
 	u32		des3;	/* Reserved */
 
@@ -81,7 +81,7 @@ struct idmac_desc_64addr {
 };
 
 struct idmac_desc {
-	u32		des0;	/* Control Descriptor */
+	__le32		des0;	/* Control Descriptor */
 #define IDMAC_DES0_DIC	BIT(1)
 #define IDMAC_DES0_LD	BIT(2)
 #define IDMAC_DES0_FD	BIT(3)
@@ -90,13 +90,13 @@ struct idmac_desc {
 #define IDMAC_DES0_CES	BIT(30)
 #define IDMAC_DES0_OWN	BIT(31)
 
-	u32		des1;	/* Buffer sizes */
+	__le32		des1;	/* Buffer sizes */
 #define IDMAC_SET_BUFFER1_SIZE(d, s) \
 	((d)->des1 = ((d)->des1 & 0x03ffe000) | ((s) & 0x1fff))
 
-	u32		des2;	/* buffer 1 physical address */
+	__le32		des2;	/* buffer 1 physical address */
 
-	u32		des3;	/* buffer 2 physical address */
+	__le32		des3;	/* buffer 2 physical address */
 };
 #endif /* CONFIG_MMC_DW_IDMAC */
 
@@ -477,23 +477,23 @@ static void dw_mci_translate_sglist(struct dw_mci *host, struct mmc_data *data,
 			 * Set the OWN bit and disable interrupts for this
 			 * descriptor
 			 */
-			desc->des0 = IDMAC_DES0_OWN | IDMAC_DES0_DIC |
-						IDMAC_DES0_CH;
+			desc->des0 = cpu_to_le32(IDMAC_DES0_OWN | IDMAC_DES0_DIC |
+						 IDMAC_DES0_CH);
 			/* Buffer length */
 			IDMAC_SET_BUFFER1_SIZE(desc, length);
 
 			/* Physical address to DMA to/from */
-			desc->des2 = mem_addr;
+			desc->des2 = cpu_to_le32(mem_addr);
 		}
 
 		/* Set first descriptor */
 		desc = host->sg_cpu;
-		desc->des0 |= IDMAC_DES0_FD;
+		desc->des0 |= cpu_to_le32(IDMAC_DES0_FD);
 
 		/* Set last descriptor */
 		desc = host->sg_cpu + (i - 1) * sizeof(struct idmac_desc);
-		desc->des0 &= ~(IDMAC_DES0_CH | IDMAC_DES0_DIC);
-		desc->des0 |= IDMAC_DES0_LD;
+		desc->des0 &= cpu_to_le32(~(IDMAC_DES0_CH | IDMAC_DES0_DIC));
+		desc->des0 |= cpu_to_le32(IDMAC_DES0_LD);
 	}
 
 	wmb();
@@ -562,12 +562,12 @@ static int dw_mci_idmac_init(struct dw_mci *host)
 
 		/* Forward link the descriptor list */
 		for (i = 0, p = host->sg_cpu; i < host->ring_size - 1; i++, p++)
-			p->des3 = host->sg_dma + (sizeof(struct idmac_desc) *
-								(i + 1));
+			p->des3 = cpu_to_le32(host->sg_dma + (sizeof(struct idmac_desc) *
+							      (i + 1)));
 
 		/* Set the last descriptor as the end-of-ring descriptor */
-		p->des3 = host->sg_dma;
-		p->des0 = IDMAC_DES0_ER;
+		p->des3 = cpu_to_le32(host->sg_dma);
+		p->des0 = cpu_to_le32(IDMAC_DES0_ER);
 	}
 
 	dw_mci_idmac_reset(host);
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH RESEND 6/7] mmc: host: dw_mmc: change idmac descriptor files to __le32
@ 2015-03-25 11:27   ` Ben Dooks
  0 siblings, 0 replies; 19+ messages in thread
From: Ben Dooks @ 2015-03-25 11:27 UTC (permalink / raw)
  To: linux-arm-kernel

The dw_mmc driver does not take into account the processor may be in
big endian when writing the descriptors. Change the descriptors for
the 32bit IDMA to use __le32 and ensure they are suitably swapped
before writing.

Note, this has not been tested as the socfpga driver does not try to
use idma.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
--
CC: Linux MCC <linux-mmc@vger.kernel.org>
CC: Linux ARM Kernel <linux-arm-kernel@lists.infradead.org>
CC: Dinh Nguyen <dinguyen@opensource.altera.com>
CC: Chris Ball <chris@printf.net>
CC: Ulf Hansson <ulf.hansson@linaro.org>
CC: Jaehoon Chung <jh80.chung@samsung.com>
CC: Seungwon Jeon <tgih.jun@samsung.com>
---
 drivers/mmc/host/dw_mmc.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 4d2e3c2..12e681c 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -69,7 +69,7 @@ struct idmac_desc_64addr {
 
 	u32		des2;	/*Buffer sizes */
 #define IDMAC_64ADDR_SET_BUFFER1_SIZE(d, s) \
-	((d)->des2 = ((d)->des2 & 0x03ffe000) | ((s) & 0x1fff))
+	((d)->des2 = ((d)->des2 & cpu_to_le32(0x03ffe000)) | ((cpu_to_le32(s)) & cpu_to_le32(0x1fff)))
 
 	u32		des3;	/* Reserved */
 
@@ -81,7 +81,7 @@ struct idmac_desc_64addr {
 };
 
 struct idmac_desc {
-	u32		des0;	/* Control Descriptor */
+	__le32		des0;	/* Control Descriptor */
 #define IDMAC_DES0_DIC	BIT(1)
 #define IDMAC_DES0_LD	BIT(2)
 #define IDMAC_DES0_FD	BIT(3)
@@ -90,13 +90,13 @@ struct idmac_desc {
 #define IDMAC_DES0_CES	BIT(30)
 #define IDMAC_DES0_OWN	BIT(31)
 
-	u32		des1;	/* Buffer sizes */
+	__le32		des1;	/* Buffer sizes */
 #define IDMAC_SET_BUFFER1_SIZE(d, s) \
 	((d)->des1 = ((d)->des1 & 0x03ffe000) | ((s) & 0x1fff))
 
-	u32		des2;	/* buffer 1 physical address */
+	__le32		des2;	/* buffer 1 physical address */
 
-	u32		des3;	/* buffer 2 physical address */
+	__le32		des3;	/* buffer 2 physical address */
 };
 #endif /* CONFIG_MMC_DW_IDMAC */
 
@@ -477,23 +477,23 @@ static void dw_mci_translate_sglist(struct dw_mci *host, struct mmc_data *data,
 			 * Set the OWN bit and disable interrupts for this
 			 * descriptor
 			 */
-			desc->des0 = IDMAC_DES0_OWN | IDMAC_DES0_DIC |
-						IDMAC_DES0_CH;
+			desc->des0 = cpu_to_le32(IDMAC_DES0_OWN | IDMAC_DES0_DIC |
+						 IDMAC_DES0_CH);
 			/* Buffer length */
 			IDMAC_SET_BUFFER1_SIZE(desc, length);
 
 			/* Physical address to DMA to/from */
-			desc->des2 = mem_addr;
+			desc->des2 = cpu_to_le32(mem_addr);
 		}
 
 		/* Set first descriptor */
 		desc = host->sg_cpu;
-		desc->des0 |= IDMAC_DES0_FD;
+		desc->des0 |= cpu_to_le32(IDMAC_DES0_FD);
 
 		/* Set last descriptor */
 		desc = host->sg_cpu + (i - 1) * sizeof(struct idmac_desc);
-		desc->des0 &= ~(IDMAC_DES0_CH | IDMAC_DES0_DIC);
-		desc->des0 |= IDMAC_DES0_LD;
+		desc->des0 &= cpu_to_le32(~(IDMAC_DES0_CH | IDMAC_DES0_DIC));
+		desc->des0 |= cpu_to_le32(IDMAC_DES0_LD);
 	}
 
 	wmb();
@@ -562,12 +562,12 @@ static int dw_mci_idmac_init(struct dw_mci *host)
 
 		/* Forward link the descriptor list */
 		for (i = 0, p = host->sg_cpu; i < host->ring_size - 1; i++, p++)
-			p->des3 = host->sg_dma + (sizeof(struct idmac_desc) *
-								(i + 1));
+			p->des3 = cpu_to_le32(host->sg_dma + (sizeof(struct idmac_desc) *
+							      (i + 1)));
 
 		/* Set the last descriptor as the end-of-ring descriptor */
-		p->des3 = host->sg_dma;
-		p->des0 = IDMAC_DES0_ER;
+		p->des3 = cpu_to_le32(host->sg_dma);
+		p->des0 = cpu_to_le32(IDMAC_DES0_ER);
 	}
 
 	dw_mci_idmac_reset(host);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH RESEND 7/7] mmc: host: dw_mmc: fix fifo ordering in big endian
  2015-03-25 11:27 [RESEND] Altera socfpga big endian work Ben Dooks
@ 2015-03-25 11:27   ` Ben Dooks
  2015-03-25 11:27 ` [PATCH RESEND 2/7] ARM: socfpga: enable big endian for secondary core(s) Ben Dooks
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 19+ messages in thread
From: Ben Dooks @ 2015-03-25 11:27 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-kernel, marc.dunford, sam.bishop, Dinh Nguyen, Ben Dooks,
	Linux MMC, Chris Ball, Ulf Hansson, Jaehoon Chung, Seungwon Jeon

The dw_mmc driver changes to make the IO accesors endian agnostic did not
take into account the fifo accesses do not need to be swapped. To fix this
add a mmci_fifo_read/write wrapper to allow these to be passed through the
IO without being swapped.

Since these are now specific functions, it would be easier just to store
the pointer to the fifo registers in the host block instead of the offset
to them. So change the host->data_offset to host->fifo_reg (which also
means we catch all the places this is read or written).

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
--
CC: Linux MMC <linux-mmc@vger.kernel.org>
CC: Linux ARM Kernel <linux-arm-kernel@lists.infradead.org>
CC: Dinh Nguyen <dinguyen@opensource.altera.com>
CC: Chris Ball <chris@printf.net>
CC: Ulf Hansson <ulf.hansson@linaro.org>
CC: Jaehoon Chung <jh80.chung@samsung.com>
CC: Seungwon Jeon <tgih.jun@samsung.com>
---
 drivers/mmc/host/dw_mmc.c  | 59 +++++++++++++++++++---------------------------
 drivers/mmc/host/dw_mmc.h  | 14 +++++++++++
 include/linux/mmc/dw_mmc.h |  4 ++--
 3 files changed, 40 insertions(+), 37 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 12e681c..98f0c92 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1685,8 +1685,7 @@ static void dw_mci_push_data16(struct dw_mci *host, void *buf, int cnt)
 		buf += len;
 		cnt -= len;
 		if (host->part_buf_count == 2) {
-			mci_writew(host, DATA(host->data_offset),
-					host->part_buf16);
+			mci_fifo_writew(host->fifo_reg, host->part_buf16);
 			host->part_buf_count = 0;
 		}
 	}
@@ -1703,15 +1702,14 @@ static void dw_mci_push_data16(struct dw_mci *host, void *buf, int cnt)
 			cnt -= len;
 			/* push data from aligned buffer into fifo */
 			for (i = 0; i < items; ++i)
-				mci_writew(host, DATA(host->data_offset),
-						aligned_buf[i]);
+				mci_fifo_writew(host->fifo_reg, aligned_buf[i]);
 		}
 	} else
 #endif
 	{
 		u16 *pdata = buf;
 		for (; cnt >= 2; cnt -= 2)
-			mci_writew(host, DATA(host->data_offset), *pdata++);
+			mci_fifo_writew(host->fifo_reg, *pdata++);
 		buf = pdata;
 	}
 	/* put anything remaining in the part_buf */
@@ -1720,8 +1718,7 @@ static void dw_mci_push_data16(struct dw_mci *host, void *buf, int cnt)
 		 /* Push data if we have reached the expected data length */
 		if ((data->bytes_xfered + init_cnt) ==
 		    (data->blksz * data->blocks))
-			mci_writew(host, DATA(host->data_offset),
-				   host->part_buf16);
+			mci_fifo_writew(host->fifo_reg, host->part_buf16);
 	}
 }
 
@@ -1736,8 +1733,7 @@ static void dw_mci_pull_data16(struct dw_mci *host, void *buf, int cnt)
 			int items = len >> 1;
 			int i;
 			for (i = 0; i < items; ++i)
-				aligned_buf[i] = mci_readw(host,
-						DATA(host->data_offset));
+				aligned_buf[i] = mci_fifo_readw(host->fifo_reg);
 			/* memcpy from aligned buffer into output buffer */
 			memcpy(buf, aligned_buf, len);
 			buf += len;
@@ -1748,11 +1744,11 @@ static void dw_mci_pull_data16(struct dw_mci *host, void *buf, int cnt)
 	{
 		u16 *pdata = buf;
 		for (; cnt >= 2; cnt -= 2)
-			*pdata++ = mci_readw(host, DATA(host->data_offset));
+			*pdata++ = mci_fifo_readw(host->fifo_reg);
 		buf = pdata;
 	}
 	if (cnt) {
-		host->part_buf16 = mci_readw(host, DATA(host->data_offset));
+		host->part_buf16 = mci_fifo_readw(host->fifo_reg);
 		dw_mci_pull_final_bytes(host, buf, cnt);
 	}
 }
@@ -1768,8 +1764,7 @@ static void dw_mci_push_data32(struct dw_mci *host, void *buf, int cnt)
 		buf += len;
 		cnt -= len;
 		if (host->part_buf_count == 4) {
-			mci_writel(host, DATA(host->data_offset),
-					host->part_buf32);
+			mci_fifo_writel(host->fifo_reg,	host->part_buf32);
 			host->part_buf_count = 0;
 		}
 	}
@@ -1786,15 +1781,14 @@ static void dw_mci_push_data32(struct dw_mci *host, void *buf, int cnt)
 			cnt -= len;
 			/* push data from aligned buffer into fifo */
 			for (i = 0; i < items; ++i)
-				mci_writel(host, DATA(host->data_offset),
-						aligned_buf[i]);
+				mci_fifo_writel(host->fifo_reg,	aligned_buf[i]);
 		}
 	} else
 #endif
 	{
 		u32 *pdata = buf;
 		for (; cnt >= 4; cnt -= 4)
-			mci_writel(host, DATA(host->data_offset), *pdata++);
+			mci_fifo_writel(host->fifo_reg, *pdata++);
 		buf = pdata;
 	}
 	/* put anything remaining in the part_buf */
@@ -1803,8 +1797,7 @@ static void dw_mci_push_data32(struct dw_mci *host, void *buf, int cnt)
 		 /* Push data if we have reached the expected data length */
 		if ((data->bytes_xfered + init_cnt) ==
 		    (data->blksz * data->blocks))
-			mci_writel(host, DATA(host->data_offset),
-				   host->part_buf32);
+			mci_fifo_writel(host->fifo_reg, host->part_buf32);
 	}
 }
 
@@ -1819,8 +1812,7 @@ static void dw_mci_pull_data32(struct dw_mci *host, void *buf, int cnt)
 			int items = len >> 2;
 			int i;
 			for (i = 0; i < items; ++i)
-				aligned_buf[i] = mci_readl(host,
-						DATA(host->data_offset));
+				aligned_buf[i] = mci_fifo_readl(host->fifo_reg);
 			/* memcpy from aligned buffer into output buffer */
 			memcpy(buf, aligned_buf, len);
 			buf += len;
@@ -1831,11 +1823,11 @@ static void dw_mci_pull_data32(struct dw_mci *host, void *buf, int cnt)
 	{
 		u32 *pdata = buf;
 		for (; cnt >= 4; cnt -= 4)
-			*pdata++ = mci_readl(host, DATA(host->data_offset));
+			*pdata++ = mci_fifo_readl(host->fifo_reg);
 		buf = pdata;
 	}
 	if (cnt) {
-		host->part_buf32 = mci_readl(host, DATA(host->data_offset));
+		host->part_buf32 = mci_fifo_readl(host->fifo_reg);
 		dw_mci_pull_final_bytes(host, buf, cnt);
 	}
 }
@@ -1852,8 +1844,7 @@ static void dw_mci_push_data64(struct dw_mci *host, void *buf, int cnt)
 		cnt -= len;
 
 		if (host->part_buf_count == 8) {
-			mci_writeq(host, DATA(host->data_offset),
-					host->part_buf);
+			mci_fifo_writeq(host->fifo_reg,	host->part_buf);
 			host->part_buf_count = 0;
 		}
 	}
@@ -1870,15 +1861,14 @@ static void dw_mci_push_data64(struct dw_mci *host, void *buf, int cnt)
 			cnt -= len;
 			/* push data from aligned buffer into fifo */
 			for (i = 0; i < items; ++i)
-				mci_writeq(host, DATA(host->data_offset),
-						aligned_buf[i]);
+				mci_fifo_writeq(host->fifo_reg,	aligned_buf[i]);
 		}
 	} else
 #endif
 	{
 		u64 *pdata = buf;
 		for (; cnt >= 8; cnt -= 8)
-			mci_writeq(host, DATA(host->data_offset), *pdata++);
+			mci_fifo_writeq(host->fifo_reg, *pdata++);
 		buf = pdata;
 	}
 	/* put anything remaining in the part_buf */
@@ -1887,8 +1877,7 @@ static void dw_mci_push_data64(struct dw_mci *host, void *buf, int cnt)
 		/* Push data if we have reached the expected data length */
 		if ((data->bytes_xfered + init_cnt) ==
 		    (data->blksz * data->blocks))
-			mci_writeq(host, DATA(host->data_offset),
-				   host->part_buf);
+			mci_fifo_writeq(host->fifo_reg, host->part_buf);
 	}
 }
 
@@ -1903,8 +1892,8 @@ static void dw_mci_pull_data64(struct dw_mci *host, void *buf, int cnt)
 			int items = len >> 3;
 			int i;
 			for (i = 0; i < items; ++i)
-				aligned_buf[i] = mci_readq(host,
-						DATA(host->data_offset));
+				aligned_buf[i] = mci_fifo_readq(host->fifo_reg);
+
 			/* memcpy from aligned buffer into output buffer */
 			memcpy(buf, aligned_buf, len);
 			buf += len;
@@ -1915,11 +1904,11 @@ static void dw_mci_pull_data64(struct dw_mci *host, void *buf, int cnt)
 	{
 		u64 *pdata = buf;
 		for (; cnt >= 8; cnt -= 8)
-			*pdata++ = mci_readq(host, DATA(host->data_offset));
+			*pdata++ = mci_fifo_readq(host->fifo_reg);
 		buf = pdata;
 	}
 	if (cnt) {
-		host->part_buf = mci_readq(host, DATA(host->data_offset));
+		host->part_buf = mci_fifo_readq(host->fifo_reg);
 		dw_mci_pull_final_bytes(host, buf, cnt);
 	}
 }
@@ -2731,9 +2720,9 @@ int dw_mci_probe(struct dw_mci *host)
 	dev_info(host->dev, "Version ID is %04x\n", host->verid);
 
 	if (host->verid < DW_MMC_240A)
-		host->data_offset = DATA_OFFSET;
+		host->fifo_reg = host->regs + DATA_OFFSET;
 	else
-		host->data_offset = DATA_240A_OFFSET;
+		host->fifo_reg = host->regs + DATA_240A_OFFSET;
 
 	tasklet_init(&host->tasklet, dw_mci_tasklet_func, (unsigned long)host);
 	ret = devm_request_irq(host->dev, host->irq, dw_mci_interrupt,
diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
index 46efdc5..2eebe48 100644
--- a/drivers/mmc/host/dw_mmc.h
+++ b/drivers/mmc/host/dw_mmc.h
@@ -169,6 +169,16 @@
 #define SDMMC_CTRL_ALL_RESET_FLAGS \
 	(SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET | SDMMC_CTRL_DMA_RESET)
 
+/* FIFO register access macros. These should not change the data endian-ness
+ * as they are written to memory to be dealt with by the upper layers */
+#define mci_fifo_readw(__reg)	__raw_readw(__reg)
+#define mci_fifo_readl(__reg)	__raw_readl(__reg)
+#define mci_fifo_readq(__reg)	__raw_readq(__reg)
+
+#define mci_fifo_writew(__value, __reg)	__raw_writew(__reg, __value)
+#define mci_fifo_writel(__value, __reg)	__raw_writel(__reg, __value)
+#define mci_fifo_writeq(__value, __reg)	__raw_writeq(__reg, __value)
+
 /* Register access macros */
 #define mci_readl(dev, reg)			\
 	readl_relaxed((dev)->regs + SDMMC_##reg)
@@ -200,6 +210,10 @@
 	(*(volatile u64 __force *)((dev)->regs + SDMMC_##reg))
 #define mci_writeq(dev, reg, value)			\
 	(*(volatile u64 __force *)((dev)->regs + SDMMC_##reg) = (value))
+
+#define __raw_writeq(__value, __reg) \
+	(*(volatile u64 __force *)(__reg)= (__value))
+#define __raw_readq(__reg) (*(volatile u64 __force *)(__reg))
 #endif
 
 extern int dw_mci_probe(struct dw_mci *host);
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 471fb31..49addec 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -44,6 +44,7 @@ struct mmc_data;
  * struct dw_mci - MMC controller state shared between all slots
  * @lock: Spinlock protecting the queue and associated data.
  * @regs: Pointer to MMIO registers.
+ * @fifo_reg: Pointer to MMIO registers for data FIFO
  * @sg: Scatterlist entry currently being processed by PIO code, if any.
  * @sg_miter: PIO mapping scatterlist iterator.
  * @cur_slot: The slot which is currently using the controller.
@@ -79,7 +80,6 @@ struct mmc_data;
  * @current_speed: Configured rate of the controller.
  * @num_slots: Number of slots available.
  * @verid: Denote Version ID.
- * @data_offset: Set the offset of DATA register according to VERID.
  * @dev: Device associated with the MMC controller.
  * @pdata: Platform data associated with the MMC controller.
  * @drv_data: Driver specific data for identified variant of the controller
@@ -132,6 +132,7 @@ struct dw_mci {
 	spinlock_t		lock;
 	spinlock_t		irq_lock;
 	void __iomem		*regs;
+	void __iomem		*fifo_reg;
 
 	struct scatterlist	*sg;
 	struct sg_mapping_iter	sg_miter;
@@ -172,7 +173,6 @@ struct dw_mci {
 	u32			num_slots;
 	u32			fifoth_val;
 	u16			verid;
-	u16			data_offset;
 	struct device		*dev;
 	struct dw_mci_board	*pdata;
 	const struct dw_mci_drv_data	*drv_data;
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH RESEND 7/7] mmc: host: dw_mmc: fix fifo ordering in big endian
@ 2015-03-25 11:27   ` Ben Dooks
  0 siblings, 0 replies; 19+ messages in thread
From: Ben Dooks @ 2015-03-25 11:27 UTC (permalink / raw)
  To: linux-arm-kernel

The dw_mmc driver changes to make the IO accesors endian agnostic did not
take into account the fifo accesses do not need to be swapped. To fix this
add a mmci_fifo_read/write wrapper to allow these to be passed through the
IO without being swapped.

Since these are now specific functions, it would be easier just to store
the pointer to the fifo registers in the host block instead of the offset
to them. So change the host->data_offset to host->fifo_reg (which also
means we catch all the places this is read or written).

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
--
CC: Linux MMC <linux-mmc@vger.kernel.org>
CC: Linux ARM Kernel <linux-arm-kernel@lists.infradead.org>
CC: Dinh Nguyen <dinguyen@opensource.altera.com>
CC: Chris Ball <chris@printf.net>
CC: Ulf Hansson <ulf.hansson@linaro.org>
CC: Jaehoon Chung <jh80.chung@samsung.com>
CC: Seungwon Jeon <tgih.jun@samsung.com>
---
 drivers/mmc/host/dw_mmc.c  | 59 +++++++++++++++++++---------------------------
 drivers/mmc/host/dw_mmc.h  | 14 +++++++++++
 include/linux/mmc/dw_mmc.h |  4 ++--
 3 files changed, 40 insertions(+), 37 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 12e681c..98f0c92 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1685,8 +1685,7 @@ static void dw_mci_push_data16(struct dw_mci *host, void *buf, int cnt)
 		buf += len;
 		cnt -= len;
 		if (host->part_buf_count == 2) {
-			mci_writew(host, DATA(host->data_offset),
-					host->part_buf16);
+			mci_fifo_writew(host->fifo_reg, host->part_buf16);
 			host->part_buf_count = 0;
 		}
 	}
@@ -1703,15 +1702,14 @@ static void dw_mci_push_data16(struct dw_mci *host, void *buf, int cnt)
 			cnt -= len;
 			/* push data from aligned buffer into fifo */
 			for (i = 0; i < items; ++i)
-				mci_writew(host, DATA(host->data_offset),
-						aligned_buf[i]);
+				mci_fifo_writew(host->fifo_reg, aligned_buf[i]);
 		}
 	} else
 #endif
 	{
 		u16 *pdata = buf;
 		for (; cnt >= 2; cnt -= 2)
-			mci_writew(host, DATA(host->data_offset), *pdata++);
+			mci_fifo_writew(host->fifo_reg, *pdata++);
 		buf = pdata;
 	}
 	/* put anything remaining in the part_buf */
@@ -1720,8 +1718,7 @@ static void dw_mci_push_data16(struct dw_mci *host, void *buf, int cnt)
 		 /* Push data if we have reached the expected data length */
 		if ((data->bytes_xfered + init_cnt) ==
 		    (data->blksz * data->blocks))
-			mci_writew(host, DATA(host->data_offset),
-				   host->part_buf16);
+			mci_fifo_writew(host->fifo_reg, host->part_buf16);
 	}
 }
 
@@ -1736,8 +1733,7 @@ static void dw_mci_pull_data16(struct dw_mci *host, void *buf, int cnt)
 			int items = len >> 1;
 			int i;
 			for (i = 0; i < items; ++i)
-				aligned_buf[i] = mci_readw(host,
-						DATA(host->data_offset));
+				aligned_buf[i] = mci_fifo_readw(host->fifo_reg);
 			/* memcpy from aligned buffer into output buffer */
 			memcpy(buf, aligned_buf, len);
 			buf += len;
@@ -1748,11 +1744,11 @@ static void dw_mci_pull_data16(struct dw_mci *host, void *buf, int cnt)
 	{
 		u16 *pdata = buf;
 		for (; cnt >= 2; cnt -= 2)
-			*pdata++ = mci_readw(host, DATA(host->data_offset));
+			*pdata++ = mci_fifo_readw(host->fifo_reg);
 		buf = pdata;
 	}
 	if (cnt) {
-		host->part_buf16 = mci_readw(host, DATA(host->data_offset));
+		host->part_buf16 = mci_fifo_readw(host->fifo_reg);
 		dw_mci_pull_final_bytes(host, buf, cnt);
 	}
 }
@@ -1768,8 +1764,7 @@ static void dw_mci_push_data32(struct dw_mci *host, void *buf, int cnt)
 		buf += len;
 		cnt -= len;
 		if (host->part_buf_count == 4) {
-			mci_writel(host, DATA(host->data_offset),
-					host->part_buf32);
+			mci_fifo_writel(host->fifo_reg,	host->part_buf32);
 			host->part_buf_count = 0;
 		}
 	}
@@ -1786,15 +1781,14 @@ static void dw_mci_push_data32(struct dw_mci *host, void *buf, int cnt)
 			cnt -= len;
 			/* push data from aligned buffer into fifo */
 			for (i = 0; i < items; ++i)
-				mci_writel(host, DATA(host->data_offset),
-						aligned_buf[i]);
+				mci_fifo_writel(host->fifo_reg,	aligned_buf[i]);
 		}
 	} else
 #endif
 	{
 		u32 *pdata = buf;
 		for (; cnt >= 4; cnt -= 4)
-			mci_writel(host, DATA(host->data_offset), *pdata++);
+			mci_fifo_writel(host->fifo_reg, *pdata++);
 		buf = pdata;
 	}
 	/* put anything remaining in the part_buf */
@@ -1803,8 +1797,7 @@ static void dw_mci_push_data32(struct dw_mci *host, void *buf, int cnt)
 		 /* Push data if we have reached the expected data length */
 		if ((data->bytes_xfered + init_cnt) ==
 		    (data->blksz * data->blocks))
-			mci_writel(host, DATA(host->data_offset),
-				   host->part_buf32);
+			mci_fifo_writel(host->fifo_reg, host->part_buf32);
 	}
 }
 
@@ -1819,8 +1812,7 @@ static void dw_mci_pull_data32(struct dw_mci *host, void *buf, int cnt)
 			int items = len >> 2;
 			int i;
 			for (i = 0; i < items; ++i)
-				aligned_buf[i] = mci_readl(host,
-						DATA(host->data_offset));
+				aligned_buf[i] = mci_fifo_readl(host->fifo_reg);
 			/* memcpy from aligned buffer into output buffer */
 			memcpy(buf, aligned_buf, len);
 			buf += len;
@@ -1831,11 +1823,11 @@ static void dw_mci_pull_data32(struct dw_mci *host, void *buf, int cnt)
 	{
 		u32 *pdata = buf;
 		for (; cnt >= 4; cnt -= 4)
-			*pdata++ = mci_readl(host, DATA(host->data_offset));
+			*pdata++ = mci_fifo_readl(host->fifo_reg);
 		buf = pdata;
 	}
 	if (cnt) {
-		host->part_buf32 = mci_readl(host, DATA(host->data_offset));
+		host->part_buf32 = mci_fifo_readl(host->fifo_reg);
 		dw_mci_pull_final_bytes(host, buf, cnt);
 	}
 }
@@ -1852,8 +1844,7 @@ static void dw_mci_push_data64(struct dw_mci *host, void *buf, int cnt)
 		cnt -= len;
 
 		if (host->part_buf_count == 8) {
-			mci_writeq(host, DATA(host->data_offset),
-					host->part_buf);
+			mci_fifo_writeq(host->fifo_reg,	host->part_buf);
 			host->part_buf_count = 0;
 		}
 	}
@@ -1870,15 +1861,14 @@ static void dw_mci_push_data64(struct dw_mci *host, void *buf, int cnt)
 			cnt -= len;
 			/* push data from aligned buffer into fifo */
 			for (i = 0; i < items; ++i)
-				mci_writeq(host, DATA(host->data_offset),
-						aligned_buf[i]);
+				mci_fifo_writeq(host->fifo_reg,	aligned_buf[i]);
 		}
 	} else
 #endif
 	{
 		u64 *pdata = buf;
 		for (; cnt >= 8; cnt -= 8)
-			mci_writeq(host, DATA(host->data_offset), *pdata++);
+			mci_fifo_writeq(host->fifo_reg, *pdata++);
 		buf = pdata;
 	}
 	/* put anything remaining in the part_buf */
@@ -1887,8 +1877,7 @@ static void dw_mci_push_data64(struct dw_mci *host, void *buf, int cnt)
 		/* Push data if we have reached the expected data length */
 		if ((data->bytes_xfered + init_cnt) ==
 		    (data->blksz * data->blocks))
-			mci_writeq(host, DATA(host->data_offset),
-				   host->part_buf);
+			mci_fifo_writeq(host->fifo_reg, host->part_buf);
 	}
 }
 
@@ -1903,8 +1892,8 @@ static void dw_mci_pull_data64(struct dw_mci *host, void *buf, int cnt)
 			int items = len >> 3;
 			int i;
 			for (i = 0; i < items; ++i)
-				aligned_buf[i] = mci_readq(host,
-						DATA(host->data_offset));
+				aligned_buf[i] = mci_fifo_readq(host->fifo_reg);
+
 			/* memcpy from aligned buffer into output buffer */
 			memcpy(buf, aligned_buf, len);
 			buf += len;
@@ -1915,11 +1904,11 @@ static void dw_mci_pull_data64(struct dw_mci *host, void *buf, int cnt)
 	{
 		u64 *pdata = buf;
 		for (; cnt >= 8; cnt -= 8)
-			*pdata++ = mci_readq(host, DATA(host->data_offset));
+			*pdata++ = mci_fifo_readq(host->fifo_reg);
 		buf = pdata;
 	}
 	if (cnt) {
-		host->part_buf = mci_readq(host, DATA(host->data_offset));
+		host->part_buf = mci_fifo_readq(host->fifo_reg);
 		dw_mci_pull_final_bytes(host, buf, cnt);
 	}
 }
@@ -2731,9 +2720,9 @@ int dw_mci_probe(struct dw_mci *host)
 	dev_info(host->dev, "Version ID is %04x\n", host->verid);
 
 	if (host->verid < DW_MMC_240A)
-		host->data_offset = DATA_OFFSET;
+		host->fifo_reg = host->regs + DATA_OFFSET;
 	else
-		host->data_offset = DATA_240A_OFFSET;
+		host->fifo_reg = host->regs + DATA_240A_OFFSET;
 
 	tasklet_init(&host->tasklet, dw_mci_tasklet_func, (unsigned long)host);
 	ret = devm_request_irq(host->dev, host->irq, dw_mci_interrupt,
diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
index 46efdc5..2eebe48 100644
--- a/drivers/mmc/host/dw_mmc.h
+++ b/drivers/mmc/host/dw_mmc.h
@@ -169,6 +169,16 @@
 #define SDMMC_CTRL_ALL_RESET_FLAGS \
 	(SDMMC_CTRL_RESET | SDMMC_CTRL_FIFO_RESET | SDMMC_CTRL_DMA_RESET)
 
+/* FIFO register access macros. These should not change the data endian-ness
+ * as they are written to memory to be dealt with by the upper layers */
+#define mci_fifo_readw(__reg)	__raw_readw(__reg)
+#define mci_fifo_readl(__reg)	__raw_readl(__reg)
+#define mci_fifo_readq(__reg)	__raw_readq(__reg)
+
+#define mci_fifo_writew(__value, __reg)	__raw_writew(__reg, __value)
+#define mci_fifo_writel(__value, __reg)	__raw_writel(__reg, __value)
+#define mci_fifo_writeq(__value, __reg)	__raw_writeq(__reg, __value)
+
 /* Register access macros */
 #define mci_readl(dev, reg)			\
 	readl_relaxed((dev)->regs + SDMMC_##reg)
@@ -200,6 +210,10 @@
 	(*(volatile u64 __force *)((dev)->regs + SDMMC_##reg))
 #define mci_writeq(dev, reg, value)			\
 	(*(volatile u64 __force *)((dev)->regs + SDMMC_##reg) = (value))
+
+#define __raw_writeq(__value, __reg) \
+	(*(volatile u64 __force *)(__reg)= (__value))
+#define __raw_readq(__reg) (*(volatile u64 __force *)(__reg))
 #endif
 
 extern int dw_mci_probe(struct dw_mci *host);
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 471fb31..49addec 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -44,6 +44,7 @@ struct mmc_data;
  * struct dw_mci - MMC controller state shared between all slots
  * @lock: Spinlock protecting the queue and associated data.
  * @regs: Pointer to MMIO registers.
+ * @fifo_reg: Pointer to MMIO registers for data FIFO
  * @sg: Scatterlist entry currently being processed by PIO code, if any.
  * @sg_miter: PIO mapping scatterlist iterator.
  * @cur_slot: The slot which is currently using the controller.
@@ -79,7 +80,6 @@ struct mmc_data;
  * @current_speed: Configured rate of the controller.
  * @num_slots: Number of slots available.
  * @verid: Denote Version ID.
- * @data_offset: Set the offset of DATA register according to VERID.
  * @dev: Device associated with the MMC controller.
  * @pdata: Platform data associated with the MMC controller.
  * @drv_data: Driver specific data for identified variant of the controller
@@ -132,6 +132,7 @@ struct dw_mci {
 	spinlock_t		lock;
 	spinlock_t		irq_lock;
 	void __iomem		*regs;
+	void __iomem		*fifo_reg;
 
 	struct scatterlist	*sg;
 	struct sg_mapping_iter	sg_miter;
@@ -172,7 +173,6 @@ struct dw_mci {
 	u32			num_slots;
 	u32			fifoth_val;
 	u16			verid;
-	u16			data_offset;
 	struct device		*dev;
 	struct dw_mci_board	*pdata;
 	const struct dw_mci_drv_data	*drv_data;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH RESEND 5/7] mmc: host: dw_mmc make IO accessors endian agnostic
  2015-03-25 11:27   ` Ben Dooks
@ 2015-03-30  0:48     ` Jaehoon Chung
  -1 siblings, 0 replies; 19+ messages in thread
From: Jaehoon Chung @ 2015-03-30  0:48 UTC (permalink / raw)
  To: Ben Dooks, linux-arm-kernel
  Cc: linux-kernel, marc.dunford, sam.bishop, Dinh Nguyen, Linux MMC,
	Chris Ball, Ulf Hansson, Jaehoon Chung, Seungwon Jeon

Hi, Ben.

Your patches (5/7~7/7) looks good to me..I will pick them..
But could you fix the checkpatch warning?
Or if you're ok. i will fix the checkpatch warning..then will apply them.

Best Regards,
Jaehoon Chung

On 03/25/2015 08:27 PM, Ben Dooks wrote:
> The dw_mmc driver does not use endian agnostic IO accessors, so fix
> the use of __raw reads and writes to be the relaxed versions.
> 
> This fixes the dw_mmc driver initialisation on Altera socfpga in big endian.
> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> --
> CC: Linux MMC <linux-mmc@vger.kernel.org>
> CC: Linux ARM Kernel <linux-arm-kernel@lists.infradead.org>
> CC: Dinh Nguyen <dinguyen@opensource.altera.com>
> CC: Chris Ball <chris@printf.net>
> CC: Ulf Hansson <ulf.hansson@linaro.org>
> CC: Jaehoon Chung <jh80.chung@samsung.com>
> CC: Seungwon Jeon <tgih.jun@samsung.com>
> ---
>  drivers/mmc/host/dw_mmc.h | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
> index 18c4afe..46efdc5 100644
> --- a/drivers/mmc/host/dw_mmc.h
> +++ b/drivers/mmc/host/dw_mmc.h
> @@ -171,22 +171,22 @@
>  
>  /* Register access macros */
>  #define mci_readl(dev, reg)			\
> -	__raw_readl((dev)->regs + SDMMC_##reg)
> +	readl_relaxed((dev)->regs + SDMMC_##reg)
>  #define mci_writel(dev, reg, value)			\
> -	__raw_writel((value), (dev)->regs + SDMMC_##reg)
> +	writel_relaxed((value), (dev)->regs + SDMMC_##reg)
>  
>  /* 16-bit FIFO access macros */
>  #define mci_readw(dev, reg)			\
> -	__raw_readw((dev)->regs + SDMMC_##reg)
> +	readw_relaxed((dev)->regs + SDMMC_##reg)
>  #define mci_writew(dev, reg, value)			\
> -	__raw_writew((value), (dev)->regs + SDMMC_##reg)
> +	writew_relaxed((value), (dev)->regs + SDMMC_##reg)
>  
>  /* 64-bit FIFO access macros */
>  #ifdef readq
>  #define mci_readq(dev, reg)			\
> -	__raw_readq((dev)->regs + SDMMC_##reg)
> +	readq_relaxed((dev)->regs + SDMMC_##reg)
>  #define mci_writeq(dev, reg, value)			\
> -	__raw_writeq((value), (dev)->regs + SDMMC_##reg)
> +	writeq_relaxed((value), (dev)->regs + SDMMC_##reg)
>  #else
>  /*
>   * Dummy readq implementation for architectures that don't define it.
> 


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH RESEND 5/7] mmc: host: dw_mmc make IO accessors endian agnostic
@ 2015-03-30  0:48     ` Jaehoon Chung
  0 siblings, 0 replies; 19+ messages in thread
From: Jaehoon Chung @ 2015-03-30  0:48 UTC (permalink / raw)
  To: linux-arm-kernel

Hi, Ben.

Your patches (5/7~7/7) looks good to me..I will pick them..
But could you fix the checkpatch warning?
Or if you're ok. i will fix the checkpatch warning..then will apply them.

Best Regards,
Jaehoon Chung

On 03/25/2015 08:27 PM, Ben Dooks wrote:
> The dw_mmc driver does not use endian agnostic IO accessors, so fix
> the use of __raw reads and writes to be the relaxed versions.
> 
> This fixes the dw_mmc driver initialisation on Altera socfpga in big endian.
> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> --
> CC: Linux MMC <linux-mmc@vger.kernel.org>
> CC: Linux ARM Kernel <linux-arm-kernel@lists.infradead.org>
> CC: Dinh Nguyen <dinguyen@opensource.altera.com>
> CC: Chris Ball <chris@printf.net>
> CC: Ulf Hansson <ulf.hansson@linaro.org>
> CC: Jaehoon Chung <jh80.chung@samsung.com>
> CC: Seungwon Jeon <tgih.jun@samsung.com>
> ---
>  drivers/mmc/host/dw_mmc.h | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/mmc/host/dw_mmc.h b/drivers/mmc/host/dw_mmc.h
> index 18c4afe..46efdc5 100644
> --- a/drivers/mmc/host/dw_mmc.h
> +++ b/drivers/mmc/host/dw_mmc.h
> @@ -171,22 +171,22 @@
>  
>  /* Register access macros */
>  #define mci_readl(dev, reg)			\
> -	__raw_readl((dev)->regs + SDMMC_##reg)
> +	readl_relaxed((dev)->regs + SDMMC_##reg)
>  #define mci_writel(dev, reg, value)			\
> -	__raw_writel((value), (dev)->regs + SDMMC_##reg)
> +	writel_relaxed((value), (dev)->regs + SDMMC_##reg)
>  
>  /* 16-bit FIFO access macros */
>  #define mci_readw(dev, reg)			\
> -	__raw_readw((dev)->regs + SDMMC_##reg)
> +	readw_relaxed((dev)->regs + SDMMC_##reg)
>  #define mci_writew(dev, reg, value)			\
> -	__raw_writew((value), (dev)->regs + SDMMC_##reg)
> +	writew_relaxed((value), (dev)->regs + SDMMC_##reg)
>  
>  /* 64-bit FIFO access macros */
>  #ifdef readq
>  #define mci_readq(dev, reg)			\
> -	__raw_readq((dev)->regs + SDMMC_##reg)
> +	readq_relaxed((dev)->regs + SDMMC_##reg)
>  #define mci_writeq(dev, reg, value)			\
> -	__raw_writeq((value), (dev)->regs + SDMMC_##reg)
> +	writeq_relaxed((value), (dev)->regs + SDMMC_##reg)
>  #else
>  /*
>   * Dummy readq implementation for architectures that don't define it.
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [RESEND] Altera socfpga big endian work
  2015-03-25 11:27 [RESEND] Altera socfpga big endian work Ben Dooks
                   ` (6 preceding siblings ...)
  2015-03-25 11:27   ` Ben Dooks
@ 2015-03-31 14:13 ` Dinh Nguyen
  2015-03-31 15:34   ` Ben Dooks
  7 siblings, 1 reply; 19+ messages in thread
From: Dinh Nguyen @ 2015-03-31 14:13 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Ben,

On 3/25/15 6:27 AM, Ben Dooks wrote:
> This series enables the core of the socfpga systen to run in big endian
> mode. It inclusdes support for debug uart, secondary core boot and has
> support for timers and initial conversion patches for the mmc.
> 
> The two drivers that are known to not work are the Ethernet and the
> dwc2 usb. I do not have data for either, so I currently do not know
> if it possible to change the hardware's endian fetch mode.
> 
> The dwc2 driver on my cyclone5 socfpga board with v4.0-rc5 does not
> work in little endian mode, which makes testing converting the driver
> difficult. The supplied 3.10 kernel does work so it is not down to the
> hardware. It detects the presence of a new device and then fails to
> enumerate it (no other errors shown)
> 
> This is up on git.baserock.org/delta/linux.git in the branch
> baserock/bjdooks/socfpga-v5
> 
> Sorry, this is a resend due to incorrect linux-arm-kernel mailing list
> address.
> 

I think I can take patches 1-3 through my tree, but the mmc patches
[4-7] will need to linux-mmc tree.

Thanks,
Dinh

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [RESEND] Altera socfpga big endian work
  2015-03-31 14:13 ` [RESEND] Altera socfpga big endian work Dinh Nguyen
@ 2015-03-31 15:34   ` Ben Dooks
  2015-03-31 17:47     ` Dinh Nguyen
  0 siblings, 1 reply; 19+ messages in thread
From: Ben Dooks @ 2015-03-31 15:34 UTC (permalink / raw)
  To: linux-arm-kernel

On 31/03/15 15:13, Dinh Nguyen wrote:
> Hi Ben,
> 
> On 3/25/15 6:27 AM, Ben Dooks wrote:
>> This series enables the core of the socfpga systen to run in big endian
>> mode. It inclusdes support for debug uart, secondary core boot and has
>> support for timers and initial conversion patches for the mmc.
>>
>> The two drivers that are known to not work are the Ethernet and the
>> dwc2 usb. I do not have data for either, so I currently do not know
>> if it possible to change the hardware's endian fetch mode.
>>
>> The dwc2 driver on my cyclone5 socfpga board with v4.0-rc5 does not
>> work in little endian mode, which makes testing converting the driver
>> difficult. The supplied 3.10 kernel does work so it is not down to the
>> hardware. It detects the presence of a new device and then fails to
>> enumerate it (no other errors shown)
>>
>> This is up on git.baserock.org/delta/linux.git in the branch
>> baserock/bjdooks/socfpga-v5
>>
>> Sorry, this is a resend due to incorrect linux-arm-kernel mailing list
>> address.
>>
> 
> I think I can take patches 1-3 through my tree, but the mmc patches
> [4-7] will need to linux-mmc tree.

Thanks. I did CC 4-7 to the relevant maintainers.

Any idea if dwc2 is going to be fixed before 4.1?


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [RESEND] Altera socfpga big endian work
  2015-03-31 15:34   ` Ben Dooks
@ 2015-03-31 17:47     ` Dinh Nguyen
  2015-04-01 10:50       ` Ben Dooks
  0 siblings, 1 reply; 19+ messages in thread
From: Dinh Nguyen @ 2015-03-31 17:47 UTC (permalink / raw)
  To: linux-arm-kernel



On 3/31/15 10:34 AM, Ben Dooks wrote:
> On 31/03/15 15:13, Dinh Nguyen wrote:
>> Hi Ben,
>>
>> On 3/25/15 6:27 AM, Ben Dooks wrote:
>>> This series enables the core of the socfpga systen to run in big endian
>>> mode. It inclusdes support for debug uart, secondary core boot and has
>>> support for timers and initial conversion patches for the mmc.
>>>
>>> The two drivers that are known to not work are the Ethernet and the
>>> dwc2 usb. I do not have data for either, so I currently do not know
>>> if it possible to change the hardware's endian fetch mode.
>>>
>>> The dwc2 driver on my cyclone5 socfpga board with v4.0-rc5 does not
>>> work in little endian mode, which makes testing converting the driver
>>> difficult. The supplied 3.10 kernel does work so it is not down to the
>>> hardware. It detects the presence of a new device and then fails to
>>> enumerate it (no other errors shown)
>>>
>>> This is up on git.baserock.org/delta/linux.git in the branch
>>> baserock/bjdooks/socfpga-v5
>>>
>>> Sorry, this is a resend due to incorrect linux-arm-kernel mailing list
>>> address.
>>>
>>
>> I think I can take patches 1-3 through my tree, but the mmc patches
>> [4-7] will need to linux-mmc tree.
> 
> Thanks. I did CC 4-7 to the relevant maintainers.
> 
> Any idea if dwc2 is going to be fixed before 4.1?
> 
> 

I'll have to double check again, but I thought dwc2 on the socfpga has
been work fine for quite some time now. What are the errors that you are
seeing?

Dinh

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [RESEND] Altera socfpga big endian work
  2015-03-31 17:47     ` Dinh Nguyen
@ 2015-04-01 10:50       ` Ben Dooks
  2015-04-01 14:50         ` Dinh Nguyen
  0 siblings, 1 reply; 19+ messages in thread
From: Ben Dooks @ 2015-04-01 10:50 UTC (permalink / raw)
  To: linux-arm-kernel

On 31/03/15 18:47, Dinh Nguyen wrote:
> 
> 
> On 3/31/15 10:34 AM, Ben Dooks wrote:
>> On 31/03/15 15:13, Dinh Nguyen wrote:
>>> Hi Ben,
>>>
>>> On 3/25/15 6:27 AM, Ben Dooks wrote:
>>>> This series enables the core of the socfpga systen to run in big endian
>>>> mode. It inclusdes support for debug uart, secondary core boot and has
>>>> support for timers and initial conversion patches for the mmc.
>>>>
>>>> The two drivers that are known to not work are the Ethernet and the
>>>> dwc2 usb. I do not have data for either, so I currently do not know
>>>> if it possible to change the hardware's endian fetch mode.
>>>>
>>>> The dwc2 driver on my cyclone5 socfpga board with v4.0-rc5 does not
>>>> work in little endian mode, which makes testing converting the driver
>>>> difficult. The supplied 3.10 kernel does work so it is not down to the
>>>> hardware. It detects the presence of a new device and then fails to
>>>> enumerate it (no other errors shown)
>>>>
>>>> This is up on git.baserock.org/delta/linux.git in the branch
>>>> baserock/bjdooks/socfpga-v5
>>>>
>>>> Sorry, this is a resend due to incorrect linux-arm-kernel mailing list
>>>> address.
>>>>
>>>
>>> I think I can take patches 1-3 through my tree, but the mmc patches
>>> [4-7] will need to linux-mmc tree.
>>
>> Thanks. I did CC 4-7 to the relevant maintainers.
>>
>> Any idea if dwc2 is going to be fixed before 4.1?
>>
>>
> 
> I'll have to double check again, but I thought dwc2 on the socfpga has
> been work fine for quite some time now. What are the errors that you are
> seeing?

With 4.0-rc5 it failed to enumerate a USB memory stick attached to
the board. It looked like VCC was supplied. We know the adapter is
working as it comes up under the default boot supplied on the board.

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [RESEND] Altera socfpga big endian work
  2015-04-01 10:50       ` Ben Dooks
@ 2015-04-01 14:50         ` Dinh Nguyen
  2015-04-01 16:01           ` Ben Dooks
  0 siblings, 1 reply; 19+ messages in thread
From: Dinh Nguyen @ 2015-04-01 14:50 UTC (permalink / raw)
  To: linux-arm-kernel

On 04/01/2015 05:50 AM, Ben Dooks wrote:
> On 31/03/15 18:47, Dinh Nguyen wrote:
>>
>>
>> On 3/31/15 10:34 AM, Ben Dooks wrote:
>>> On 31/03/15 15:13, Dinh Nguyen wrote:
>>>> Hi Ben,
>>>>
>>>> On 3/25/15 6:27 AM, Ben Dooks wrote:
>>>>> This series enables the core of the socfpga systen to run in big endian
>>>>> mode. It inclusdes support for debug uart, secondary core boot and has
>>>>> support for timers and initial conversion patches for the mmc.
>>>>>
>>>>> The two drivers that are known to not work are the Ethernet and the
>>>>> dwc2 usb. I do not have data for either, so I currently do not know
>>>>> if it possible to change the hardware's endian fetch mode.
>>>>>
>>>>> The dwc2 driver on my cyclone5 socfpga board with v4.0-rc5 does not
>>>>> work in little endian mode, which makes testing converting the driver
>>>>> difficult. The supplied 3.10 kernel does work so it is not down to the
>>>>> hardware. It detects the presence of a new device and then fails to
>>>>> enumerate it (no other errors shown)
>>>>>
>>>>> This is up on git.baserock.org/delta/linux.git in the branch
>>>>> baserock/bjdooks/socfpga-v5
>>>>>
>>>>> Sorry, this is a resend due to incorrect linux-arm-kernel mailing list
>>>>> address.
>>>>>
>>>>
>>>> I think I can take patches 1-3 through my tree, but the mmc patches
>>>> [4-7] will need to linux-mmc tree.
>>>
>>> Thanks. I did CC 4-7 to the relevant maintainers.
>>>
>>> Any idea if dwc2 is going to be fixed before 4.1?
>>>
>>>
>>
>> I'll have to double check again, but I thought dwc2 on the socfpga has
>> been work fine for quite some time now. What are the errors that you are
>> seeing?
> 
> With 4.0-rc5 it failed to enumerate a USB memory stick attached to
> the board. It looked like VCC was supplied. We know the adapter is
> working as it comes up under the default boot supplied on the board.
> 

Hmm...4.0-rc6's USB is working fine on my devkit:

socfpga_cyclone5 login: [   74.933518] usb 1-1: new high-speed USB
device number 2 using dwc2
[   75.144505] usb-storage 1-1:1.0: USB Mass Storage device detected
[   75.150873] scsi host0: usb-storage 1-1:1.0
[   76.154413] scsi 0:0:0:0: Direct-Access     SanDisk  Ultra
 1.26 PQ: 0 ANSI: 5
[   76.164091] sd 0:0:0:0: [sda] 31266816 512-byte logical blocks: (16.0
GB/14.9 GiB)
[   76.172386] sd 0:0:0:0: [sda] Write Protect is off
[   76.177645] sd 0:0:0:0: [sda] Write cache: disabled, read cache:
enabled, doesn't support DPO or FUA
[   76.194265]  sda: sda1
[   76.198088] sd 0:0:0:0: [sda] Attached SCSI removable disk
root
root at socfpga_cyclone5:~# uname -a
Linux socfpga_cyclone5 4.0.0-rc6-00009-g6c310bc #1 SMP Wed Apr 1
09:46:55 CDT 2015 armv7l GNU/Linux
root at socfpga_cyclone5:~#

Attached is my defconfig...

Dinh

-------------- next part --------------
CONFIG_SYSVIPC=y
CONFIG_FHANDLE=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_LOG_BUF_SHIFT=14
CONFIG_CGROUPS=y
CONFIG_CPUSETS=y
CONFIG_NAMESPACES=y
CONFIG_EMBEDDED=y
CONFIG_PROFILING=y
CONFIG_OPROFILE=y
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
# CONFIG_LBDAF is not set
# CONFIG_BLK_DEV_BSG is not set
# CONFIG_IOSCHED_DEADLINE is not set
# CONFIG_IOSCHED_CFQ is not set
CONFIG_ARCH_SOCFPGA=y
CONFIG_ARM_THUMBEE=y
CONFIG_SMP=y
CONFIG_NR_CPUS=2
CONFIG_AEABI=y
CONFIG_ZBOOT_ROM_TEXT=0x0
CONFIG_ZBOOT_ROM_BSS=0x0
CONFIG_VFP=y
CONFIG_NEON=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_NET_KEY=y
CONFIG_NET_KEY_MIGRATE=y
CONFIG_INET=y
CONFIG_IP_MULTICAST=y
CONFIG_IP_PNP=y
CONFIG_IP_PNP_DHCP=y
CONFIG_IP_PNP_BOOTP=y
CONFIG_IP_PNP_RARP=y
CONFIG_IPV6=y
CONFIG_NETWORK_PHY_TIMESTAMPING=y
CONFIG_VLAN_8021Q=y
CONFIG_VLAN_8021Q_GVRP=y
CONFIG_CAN=y
CONFIG_CAN_C_CAN=y
CONFIG_CAN_C_CAN_PLATFORM=y
CONFIG_CAN_DEBUG_DEVICES=y
CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=2
CONFIG_BLK_DEV_RAM_SIZE=8192
CONFIG_SRAM=y
CONFIG_SCSI=y
# CONFIG_SCSI_PROC_FS is not set
CONFIG_BLK_DEV_SD=y
# CONFIG_SCSI_LOWLEVEL is not set
CONFIG_NETDEVICES=y
CONFIG_STMMAC_ETH=y
CONFIG_MICREL_PHY=y
CONFIG_INPUT_EVDEV=y
# CONFIG_SERIO_SERPORT is not set
CONFIG_SERIO_AMBAKMI=y
CONFIG_LEGACY_PTY_COUNT=16
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_NR_UARTS=2
CONFIG_SERIAL_8250_RUNTIME_UARTS=2
CONFIG_SERIAL_8250_DW=y
CONFIG_I2C=y
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_DESIGNWARE_PLATFORM=y
CONFIG_GPIOLIB=y
CONFIG_GPIO_SYSFS=y
CONFIG_GPIO_DWAPB=y
CONFIG_PMBUS=y
CONFIG_SENSORS_LTC2978=y
CONFIG_SENSORS_LTC2978_REGULATOR=y
CONFIG_WATCHDOG=y
CONFIG_DW_WATCHDOG=y
CONFIG_REGULATOR=y
CONFIG_REGULATOR_FIXED_VOLTAGE=y
CONFIG_USB=y
CONFIG_USB_STORAGE=y
CONFIG_USB_DWC2=y
CONFIG_MMC=y
CONFIG_MMC_DW=y
CONFIG_EXT2_FS=y
CONFIG_EXT2_FS_XATTR=y
CONFIG_EXT2_FS_POSIX_ACL=y
CONFIG_EXT3_FS=y
CONFIG_EXT4_FS=y
CONFIG_VFAT_FS=y
CONFIG_NTFS_FS=y
CONFIG_NTFS_RW=y
CONFIG_TMPFS=y
CONFIG_CONFIGFS_FS=y
CONFIG_NFS_FS=y
CONFIG_ROOT_NFS=y
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_ISO8859_1=y
CONFIG_PRINTK_TIME=y
CONFIG_DEBUG_INFO=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_DETECT_HUNG_TASK=y
# CONFIG_SCHED_DEBUG is not set
CONFIG_ENABLE_DEFAULT_TRACERS=y
CONFIG_DEBUG_USER=y
CONFIG_XZ_DEC=y

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [RESEND] Altera socfpga big endian work
  2015-04-01 14:50         ` Dinh Nguyen
@ 2015-04-01 16:01           ` Ben Dooks
  0 siblings, 0 replies; 19+ messages in thread
From: Ben Dooks @ 2015-04-01 16:01 UTC (permalink / raw)
  To: linux-arm-kernel

On 01/04/15 15:50, Dinh Nguyen wrote:
> On 04/01/2015 05:50 AM, Ben Dooks wrote:
>> On 31/03/15 18:47, Dinh Nguyen wrote:
>>>
>>>
>>> On 3/31/15 10:34 AM, Ben Dooks wrote:
>>>> On 31/03/15 15:13, Dinh Nguyen wrote:
>>>>> Hi Ben,
>>>>>
>>>>> On 3/25/15 6:27 AM, Ben Dooks wrote:
>>>>>> This series enables the core of the socfpga systen to run in big endian
>>>>>> mode. It inclusdes support for debug uart, secondary core boot and has
>>>>>> support for timers and initial conversion patches for the mmc.
>>>>>>
>>>>>> The two drivers that are known to not work are the Ethernet and the
>>>>>> dwc2 usb. I do not have data for either, so I currently do not know
>>>>>> if it possible to change the hardware's endian fetch mode.
>>>>>>
>>>>>> The dwc2 driver on my cyclone5 socfpga board with v4.0-rc5 does not
>>>>>> work in little endian mode, which makes testing converting the driver
>>>>>> difficult. The supplied 3.10 kernel does work so it is not down to the
>>>>>> hardware. It detects the presence of a new device and then fails to
>>>>>> enumerate it (no other errors shown)
>>>>>>
>>>>>> This is up on git.baserock.org/delta/linux.git in the branch
>>>>>> baserock/bjdooks/socfpga-v5
>>>>>>
>>>>>> Sorry, this is a resend due to incorrect linux-arm-kernel mailing list
>>>>>> address.
>>>>>>
>>>>>
>>>>> I think I can take patches 1-3 through my tree, but the mmc patches
>>>>> [4-7] will need to linux-mmc tree.
>>>>
>>>> Thanks. I did CC 4-7 to the relevant maintainers.
>>>>
>>>> Any idea if dwc2 is going to be fixed before 4.1?
>>>>
>>>>
>>>
>>> I'll have to double check again, but I thought dwc2 on the socfpga has
>>> been work fine for quite some time now. What are the errors that you are
>>> seeing?
>>
>> With 4.0-rc5 it failed to enumerate a USB memory stick attached to
>> the board. It looked like VCC was supplied. We know the adapter is
>> working as it comes up under the default boot supplied on the board.
>>
> 
> Hmm...4.0-rc6's USB is working fine on my devkit:
> 
> socfpga_cyclone5 login: [   74.933518] usb 1-1: new high-speed USB
> device number 2 using dwc2
> [   75.144505] usb-storage 1-1:1.0: USB Mass Storage device detected
> [   75.150873] scsi host0: usb-storage 1-1:1.0
> [   76.154413] scsi 0:0:0:0: Direct-Access     SanDisk  Ultra
>  1.26 PQ: 0 ANSI: 5
> [   76.164091] sd 0:0:0:0: [sda] 31266816 512-byte logical blocks: (16.0
> GB/14.9 GiB)
> [   76.172386] sd 0:0:0:0: [sda] Write Protect is off
> [   76.177645] sd 0:0:0:0: [sda] Write cache: disabled, read cache:
> enabled, doesn't support DPO or FUA
> [   76.194265]  sda: sda1
> [   76.198088] sd 0:0:0:0: [sda] Attached SCSI removable disk
> root
> root at socfpga_cyclone5:~# uname -a
> Linux socfpga_cyclone5 4.0.0-rc6-00009-g6c310bc #1 SMP Wed Apr 1
> 09:46:55 CDT 2015 armv7l GNU/Linux
> root at socfpga_cyclone5:~#
> 
> Attached is my defconfig...

Thanks, I will see if I can replicate this when I am back from the
mandatory holidays here.


-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2015-04-01 16:01 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-25 11:27 [RESEND] Altera socfpga big endian work Ben Dooks
2015-03-25 11:27 ` [PATCH RESEND 1/7] ARM: debug: fix big endian operation for 8250 word mode Ben Dooks
2015-03-25 11:27 ` [PATCH RESEND 2/7] ARM: socfpga: enable big endian for secondary core(s) Ben Dooks
2015-03-25 11:27 ` [PATCH RESEND 3/7] ARM: socfpga: support big endian for socfpga Ben Dooks
2015-03-25 11:27 ` [PATCH RESEND 4/7] clocksource: dw_apb_timer_of: make IO endian agnostic Ben Dooks
2015-03-25 11:27 ` [PATCH RESEND 5/7] mmc: host: dw_mmc make IO accessors " Ben Dooks
2015-03-25 11:27   ` Ben Dooks
2015-03-30  0:48   ` Jaehoon Chung
2015-03-30  0:48     ` Jaehoon Chung
2015-03-25 11:27 ` [PATCH RESEND 6/7] mmc: host: dw_mmc: change idmac descriptor files to __le32 Ben Dooks
2015-03-25 11:27   ` Ben Dooks
2015-03-25 11:27 ` [PATCH RESEND 7/7] mmc: host: dw_mmc: fix fifo ordering in big endian Ben Dooks
2015-03-25 11:27   ` Ben Dooks
2015-03-31 14:13 ` [RESEND] Altera socfpga big endian work Dinh Nguyen
2015-03-31 15:34   ` Ben Dooks
2015-03-31 17:47     ` Dinh Nguyen
2015-04-01 10:50       ` Ben Dooks
2015-04-01 14:50         ` Dinh Nguyen
2015-04-01 16:01           ` Ben Dooks

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.