linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] ARM: mach-shmobile: mackerel: Add mmcif support
@ 2010-12-15  8:31 Yusuke Goda
  2010-12-17 10:45 ` Paul Mundt
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Yusuke Goda @ 2010-12-15  8:31 UTC (permalink / raw)
  To: linux-sh

v2
 Add comment of J22 and OCR field.

Signed-off-by: Yusuke Goda <yusuke.goda.sx@renesas.com>
---
 arch/arm/mach-shmobile/board-mackerel.c |   67 ++++++++++++++++++++++++++++++-
 1 files changed, 66 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index f62f9b9..fd46f06 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -34,6 +34,7 @@
 #include <linux/mfd/sh_mobile_sdhi.h>
 #include <linux/mfd/tmio.h>
 #include <linux/mmc/host.h>
+#include <linux/mmc/sh_mmcif.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/physmap.h>
@@ -153,10 +154,14 @@
  * I/O voltage : 1.8v
  *
  * Power voltage : 1.8v or 3.3v
- *  J22 : select power voltage
+ *  J22 : select power voltage *1
  *	1-2 pin : 1.8v
  *	2-3 pin : 3.3v
  *
+ * *1
+ * Please change J22 depends the card to be used.
+ * MMC's OCR field set to support either voltage for the card inserted.
+ *
  *	SW1	|	SW33
  *		| bit1 | bit2 | bit3 | bit4
  * -------------+------+------+------+-------
@@ -481,6 +486,7 @@ static struct platform_device sdhi0_device = {
 	},
 };

+#if !defined(CONFIG_MMC_SH_MMCIF)
 /* SDHI1 */
 static struct sh_mobile_sdhi_info sdhi1_info = {
 	.dma_slave_tx	= SHDMA_SLAVE_SDHI1_TX,
@@ -514,6 +520,7 @@ static struct platform_device sdhi1_device = {
 		.platform_data	= &sdhi1_info,
 	},
 };
+#endif

 /* SDHI2 */
 static struct sh_mobile_sdhi_info sdhi2_info = {
@@ -547,6 +554,47 @@ static struct platform_device sdhi2_device = {
 	},
 };

+/* SH_MMCIF */
+static struct resource sh_mmcif_resources[] = {
+	[0] = {
+		.name	= "MMCIF",
+		.start	= 0xE6BD0000,
+		.end	= 0xE6BD00FF,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		/* MMC ERR */
+		.start	= evt2irq(0x1ac0),
+		.flags	= IORESOURCE_IRQ,
+	},
+	[2] = {
+		/* MMC NOR */
+		.start	= evt2irq(0x1ae0),
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct sh_mmcif_plat_data sh_mmcif_plat = {
+	.sup_pclk	= 0,
+	.ocr		= MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
+	.caps		= MMC_CAP_4_BIT_DATA |
+			  MMC_CAP_8_BIT_DATA |
+			  MMC_CAP_NEEDS_POLL,
+	.get_cd		= slot_cn7_get_cd,
+};
+
+static struct platform_device sh_mmcif_device = {
+	.name		= "sh_mmcif",
+	.id		= 0,
+	.dev		= {
+		.dma_mask		= NULL,
+		.coherent_dma_mask	= 0xffffffff,
+		.platform_data		= &sh_mmcif_plat,
+	},
+	.num_resources	= ARRAY_SIZE(sh_mmcif_resources),
+	.resource	= sh_mmcif_resources,
+};
+
 static struct platform_device *mackerel_devices[] __initdata = {
 	&nor_flash_device,
 	&smc911x_device,
@@ -556,8 +604,11 @@ static struct platform_device *mackerel_devices[] __initdata = {
 	&fsi_device,
 	&fsi_ak4643_device,
 	&sdhi0_device,
+#if !defined(CONFIG_MMC_SH_MMCIF)
 	&sdhi1_device,
+#endif
 	&sdhi2_device,
+	&sh_mmcif_device,
 };

 /* Keypad Initialization */
@@ -723,6 +774,7 @@ static void __init mackerel_init(void)
 	gpio_request(GPIO_FN_SDHID0_1, NULL);
 	gpio_request(GPIO_FN_SDHID0_0, NULL);

+#if !defined(CONFIG_MMC_SH_MMCIF)
 	/* enable SDHI1 */
 	gpio_request(GPIO_FN_SDHICMD1, NULL);
 	gpio_request(GPIO_FN_SDHICLK1, NULL);
@@ -730,6 +782,7 @@ static void __init mackerel_init(void)
 	gpio_request(GPIO_FN_SDHID1_2, NULL);
 	gpio_request(GPIO_FN_SDHID1_1, NULL);
 	gpio_request(GPIO_FN_SDHID1_0, NULL);
+#endif
 	/* card detect pin for MMC slot (CN7) */
 	gpio_request(GPIO_PORT41, NULL);
 	gpio_direction_input(GPIO_PORT41);
@@ -742,6 +795,18 @@ static void __init mackerel_init(void)
 	gpio_request(GPIO_FN_SDHID2_1, NULL);
 	gpio_request(GPIO_FN_SDHID2_0, NULL);

+	/* MMCIF */
+	gpio_request(GPIO_FN_MMCD0_0, NULL);
+	gpio_request(GPIO_FN_MMCD0_1, NULL);
+	gpio_request(GPIO_FN_MMCD0_2, NULL);
+	gpio_request(GPIO_FN_MMCD0_3, NULL);
+	gpio_request(GPIO_FN_MMCD0_4, NULL);
+	gpio_request(GPIO_FN_MMCD0_5, NULL);
+	gpio_request(GPIO_FN_MMCD0_6, NULL);
+	gpio_request(GPIO_FN_MMCD0_7, NULL);
+	gpio_request(GPIO_FN_MMCCMD0, NULL);
+	gpio_request(GPIO_FN_MMCCLK0, NULL);
+
 	i2c_register_board_info(0, i2c0_devices,
 				ARRAY_SIZE(i2c0_devices));
 	i2c_register_board_info(1, i2c1_devices,
-- 
1.5.6.5



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

* Re: [PATCH v2] ARM: mach-shmobile: mackerel: Add mmcif support
  2010-12-15  8:31 [PATCH v2] ARM: mach-shmobile: mackerel: Add mmcif support Yusuke Goda
@ 2010-12-17 10:45 ` Paul Mundt
  2012-01-19  1:32 ` [PATCH v2] ARM: mach-shmobile: mackerel: use renesas_usbhs instead of r8a66597_hcd Kuninori Morimoto
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Paul Mundt @ 2010-12-17 10:45 UTC (permalink / raw)
  To: linux-sh

On Wed, Dec 15, 2010 at 05:31:04PM +0900, Yusuke Goda wrote:
> v2
>  Add comment of J22 and OCR field.
> 
> Signed-off-by: Yusuke Goda <yusuke.goda.sx@renesas.com>

Applied to rmobile/mackerel, thanks.

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

* [PATCH v2] ARM: mach-shmobile: mackerel: use renesas_usbhs instead of r8a66597_hcd
  2010-12-15  8:31 [PATCH v2] ARM: mach-shmobile: mackerel: Add mmcif support Yusuke Goda
  2010-12-17 10:45 ` Paul Mundt
@ 2012-01-19  1:32 ` Kuninori Morimoto
  2012-01-19  2:17 ` Paul Mundt
  2012-12-15  9:16 ` [PATCH v2] ARM: mach-shmobile: mackerel: update defconfig Simon Horman
  3 siblings, 0 replies; 5+ messages in thread
From: Kuninori Morimoto @ 2012-01-19  1:32 UTC (permalink / raw)
  To: linux-sh

Current renesas_usbhs driver can use both USB host/gadget.
This patch removes current r8a66597_hcd driver settings,
and adds renesas_usbhs host driver settings for mackerel USB1 port.
You can still use this port as "gadget" with small modify.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
v1 -> v2

- remove r8a66597 comment
- remove r8a66597 header

 arch/arm/mach-shmobile/board-mackerel.c |   73 ++++---------------------------
 1 files changed, 9 insertions(+), 64 deletions(-)

diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 95ba9b8..c4a6a9b 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -43,7 +43,6 @@
 #include <linux/smsc911x.h>
 #include <linux/sh_intc.h>
 #include <linux/tca6416_keypad.h>
-#include <linux/usb/r8a66597.h>
 #include <linux/usb/renesas_usbhs.h>
 #include <linux/dma-mapping.h>
 
@@ -145,11 +144,6 @@
  * 1-2 short | VBUS 5V       | Host
  * open      | external VBUS | Function
  *
- * *1
- * CN31 is used as
- * CONFIG_USB_R8A66597_HCD	Host
- * CONFIG_USB_RENESAS_USBHS	Function
- *
  * CAUTION
  *
  * renesas_usbhs driver can use external interrupt mode
@@ -161,15 +155,6 @@
  * mackerel can not use external interrupt (IRQ7-PORT167) mode on "USB0",
  * because Touchscreen is using IRQ7-PORT40.
  * It is impossible to use IRQ7 demux on this board.
- *
- * We can use external interrupt mode USB-Function on "USB1".
- * USB1 can become Host by r8a66597, and become Function by renesas_usbhs.
- * But don't select both drivers in same time.
- * These uses same IRQ number for request_irq(), and aren't supporting
- * IRQF_SHARED / IORESOURCE_IRQ_SHAREABLE.
- *
- * Actually these are old/new version of USB driver.
- * This mean its register will be broken if it supports shared IRQ,
  */
 
 /*
@@ -686,51 +671,16 @@ static struct platform_device usbhs0_device = {
  * Use J30 to select between Host and Function. This setting
  * can however not be detected by software. Hotplug of USBHS1
  * is provided via IRQ8.
+ *
+ * Current USB1 works as "USB Host".
+ *  - set J30 "short"
+ *
+ * If you want to use it as "USB gadget",
+ *  - J30 "open"
+ *  - modify usbhs1_get_id() USBHS_HOST -> USBHS_GADGET
+ *  - add .get_vbus = usbhs_get_vbus in usbhs1_private
  */
 #define IRQ8 evt2irq(0x0300)
-
-/* USBHS1 USB Host support via r8a66597_hcd */
-static void usb1_host_port_power(int port, int power)
-{
-	if (!power) /* only power-on is supported for now */
-		return;
-
-	/* set VBOUT/PWEN and EXTLP1 in DVSTCTR */
-	__raw_writew(__raw_readw(0xE68B0008) | 0x600, 0xE68B0008);
-}
-
-static struct r8a66597_platdata usb1_host_data = {
-	.on_chip	= 1,
-	.port_power	= usb1_host_port_power,
-};
-
-static struct resource usb1_host_resources[] = {
-	[0] = {
-		.name	= "USBHS1",
-		.start	= 0xe68b0000,
-		.end	= 0xe68b00e6 - 1,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1] = {
-		.start	= evt2irq(0x1ce0) /* USB1_USB1I0 */,
-		.flags	= IORESOURCE_IRQ,
-	},
-};
-
-static struct platform_device usb1_host_device = {
-	.name	= "r8a66597_hcd",
-	.id	= 1,
-	.dev = {
-		.dma_mask		= NULL,         /*  not use dma */
-		.coherent_dma_mask	= 0xffffffff,
-		.platform_data		= &usb1_host_data,
-	},
-	.num_resources	= ARRAY_SIZE(usb1_host_resources),
-	.resource	= usb1_host_resources,
-};
-
-/* USBHS1 USB Function support via renesas_usbhs */
-
 #define USB_PHY_MODE		(1 << 4)
 #define USB_PHY_INT_EN		((1 << 3) | (1 << 2))
 #define USB_PHY_ON		(1 << 1)
@@ -786,7 +736,7 @@ static void usbhs1_hardware_exit(struct platform_device *pdev)
 
 static int usbhs1_get_id(struct platform_device *pdev)
 {
-	return USBHS_GADGET;
+	return USBHS_HOST;
 }
 
 static u32 usbhs1_pipe_cfg[] = {
@@ -817,7 +767,6 @@ static struct usbhs_private usbhs1_private = {
 			.hardware_exit	= usbhs1_hardware_exit,
 			.get_id		= usbhs1_get_id,
 			.phy_reset	= usbhs_phy_reset,
-			.get_vbus	= usbhs_get_vbus,
 		},
 		.driver_param = {
 			.buswait_bwait	= 4,
@@ -1321,7 +1270,6 @@ static struct platform_device *mackerel_devices[] __initdata = {
 	&nor_flash_device,
 	&smc911x_device,
 	&lcdc_device,
-	&usb1_host_device,
 	&usbhs1_device,
 	&usbhs0_device,
 	&leds_device,
@@ -1483,9 +1431,6 @@ static void __init mackerel_init(void)
 	gpio_pull_down(GPIO_PORT167CR); /* VBUS0_1 pull down */
 	gpio_request(GPIO_FN_IDIN_1_113, NULL);
 
-	/* USB phy tweak to make the r8a66597_hcd host driver work */
-	__raw_writew(0x8a0a, 0xe6058130);       /* USBCR4 */
-
 	/* enable FSI2 port A (ak4643) */
 	gpio_request(GPIO_FN_FSIAIBT,	NULL);
 	gpio_request(GPIO_FN_FSIAILR,	NULL);
-- 
1.7.5.4


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

* Re: [PATCH v2] ARM: mach-shmobile: mackerel: use renesas_usbhs instead of r8a66597_hcd
  2010-12-15  8:31 [PATCH v2] ARM: mach-shmobile: mackerel: Add mmcif support Yusuke Goda
  2010-12-17 10:45 ` Paul Mundt
  2012-01-19  1:32 ` [PATCH v2] ARM: mach-shmobile: mackerel: use renesas_usbhs instead of r8a66597_hcd Kuninori Morimoto
@ 2012-01-19  2:17 ` Paul Mundt
  2012-12-15  9:16 ` [PATCH v2] ARM: mach-shmobile: mackerel: update defconfig Simon Horman
  3 siblings, 0 replies; 5+ messages in thread
From: Paul Mundt @ 2012-01-19  2:17 UTC (permalink / raw)
  To: linux-sh

On Wed, Jan 18, 2012 at 05:32:05PM -0800, Kuninori Morimoto wrote:
> Current renesas_usbhs driver can use both USB host/gadget.
> This patch removes current r8a66597_hcd driver settings,
> and adds renesas_usbhs host driver settings for mackerel USB1 port.
> You can still use this port as "gadget" with small modify.

On Wed, Jan 18, 2012 at 04:37:07PM -0800, Kuninori Morimoto wrote:
> current ak4642 needs amixer settings for playing which was not
> needed on old kernel.
> This patch show it on comment area

Both applied, thanks.

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

* [PATCH v2] ARM: mach-shmobile: mackerel: update defconfig
  2010-12-15  8:31 [PATCH v2] ARM: mach-shmobile: mackerel: Add mmcif support Yusuke Goda
                   ` (2 preceding siblings ...)
  2012-01-19  2:17 ` Paul Mundt
@ 2012-12-15  9:16 ` Simon Horman
  3 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2012-12-15  9:16 UTC (permalink / raw)
  To: linux-arm-kernel

From: Simon Horman <horms+renesas@verge.net.au>

* Enable ARM_APPENDED_DTB

  Typically the bootloader of a mackerel board does not support DT
  so this option is useful

* Add "rw" to command line

  This appears to be necessary for a successful NFS-root boot

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm/configs/mackerel_defconfig |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

v2
* Fix up comment to remove mention of adding INOTIFY_USER,
  it is already present.

diff --git a/arch/arm/configs/mackerel_defconfig b/arch/arm/configs/mackerel_defconfig
index 2098ce1..8519721 100644
--- a/arch/arm/configs/mackerel_defconfig
+++ b/arch/arm/configs/mackerel_defconfig
@@ -23,7 +23,8 @@ CONFIG_AEABI=y
 CONFIG_FORCE_MAX_ZONEORDER\x15
 CONFIG_ZBOOT_ROM_TEXT=0x0
 CONFIG_ZBOOT_ROM_BSS=0x0
-CONFIG_CMDLINE="console=tty0, console=ttySC0,115200 earlyprintk=sh-sci.0,115200 root=/dev/nfs nfsroot=,tcp,v3 ip=dhcp memchunk.vpudm memchunk.veu0=8m memchunk.spu0=2m mem$0m"
+CONFIG_ARM_APPENDED_DTB=y
+CONFIG_CMDLINE="console=tty0, console=ttySC0,115200 earlyprintk=sh-sci.0,115200 root=/dev/nfs nfsroot=,tcp,v3 ip=dhcp memchunk.vpudm memchunk.veu0=8m memchunk.spu0=2m mem$0m rw"
 CONFIG_KEXEC=y
 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
 CONFIG_PM=y
-- 
1.7.10.4


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

end of thread, other threads:[~2012-12-15  9:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-15  8:31 [PATCH v2] ARM: mach-shmobile: mackerel: Add mmcif support Yusuke Goda
2010-12-17 10:45 ` Paul Mundt
2012-01-19  1:32 ` [PATCH v2] ARM: mach-shmobile: mackerel: use renesas_usbhs instead of r8a66597_hcd Kuninori Morimoto
2012-01-19  2:17 ` Paul Mundt
2012-12-15  9:16 ` [PATCH v2] ARM: mach-shmobile: mackerel: update defconfig Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).