Skip to contentSkip to conversation

USB: Armada100: Add UTMI PHY interface driver

PATCH Superseded Ajay Bhargav 3 participants 12 messages Feb 13, 2012

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/4 USB: Armada100: Add UTMI PHY interface driver

This patch adds USB host controller's UTMI PHY interface driver for Armada100 SOCs.

---
Changes for v2:
- Fix: enable only required clock in MPMU

 arch/arm/include/asm/arch-armada100/armada100.h |    8 ++
 drivers/usb/host/utmi-armada100.c               |   87 +++++++++++++++++++++++
 drivers/usb/host/utmi-armada100.h               |   79 ++++++++++++++++++++
 3 files changed, 174 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/host/utmi-armada100.c
 create mode 100644 drivers/usb/host/utmi-armada100.h
arch/arm/include/asm/arch-armada100/armada100.h +8 -0
index 0ed3a8e..70fba27 100644
@@ -43,6 +43,14 @@
 #define SSP2_APBCLK		0x01
 #define SSP2_FNCLK		0x02
 
+/* USB Clock/reset control bits */
+#define USB_SPH_AXICLK_EN	0x10
+#define USB_SPH_AXI_RST		0x02
+
+/* MPMU Clocks */
+#define APB2_26M_EN		(1 << 20)
+#define AP_26M			(1 << 4)
+
 /* Register Base Addresses */
 #define ARMD1_DRAM_BASE		0xB0000000
 #define ARMD1_FEC_BASE		0xC0800000
drivers/usb/host/utmi-armada100.c new file +87 -0

87 lines not on this page · raw message

drivers/usb/host/utmi-armada100.h new file +79 -0

79 lines not on this page · raw message

Signature · 1 line
1.7.7.2
#1 lore raw

PATCH v2 2/4 USB: Armada100: ECHI Driver for Armada100 SOCs

This patch adds support for USB EHCI driver for Armada100 SOCs.

---
Changes for v2:
- Fix typo for SOC name
- change printf to debug

 arch/arm/include/asm/arch-armada100/armada100.h |    1 +
 drivers/usb/host/Makefile                       |    1 +
 drivers/usb/host/ehci-armada100.c               |   62 +++++++++++++++++++++++
 3 files changed, 64 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/host/ehci-armada100.c
arch/arm/include/asm/arch-armada100/armada100.h +1 -0
index 70fba27..614de55 100644
@@ -68,6 +68,7 @@
 #define ARMD1_SSP5_BASE		0xD4021000
 #define ARMD1_UART3_BASE	0xD4026000
 #define ARMD1_MPMU_BASE		0xD4050000
+#define ARMD1_USB_HOST_BASE	0xD4209000
 #define ARMD1_APMU_BASE		0xD4282800
 #define ARMD1_CPU_BASE		0xD4282C00
 
drivers/usb/host/Makefile +1 -0
index 7c4df53..5fdc97b 100644
@@ -35,6 +35,7 @@ COBJS-$(CONFIG_USB_SL811HS) += sl811-hcd.o
 
 # echi
 COBJS-$(CONFIG_USB_EHCI) += ehci-hcd.o
+COBJS-$(CONFIG_USB_EHCI_ARMADA100) += ehci-armada100.o utmi-armada100.o
 ifdef CONFIG_MPC512X
 COBJS-$(CONFIG_USB_EHCI_FSL) += ehci-mpc512x.o
 else
drivers/usb/host/ehci-armada100.c new file +62 -0

62 lines not on this page · raw message

Signature · 1 line
1.7.7.2
#2 lore raw

PATCH v2 2/4 USB: Armada100: ECHI Driver for Armada100 SOCs

Quoted 1 line

This patch adds support for USB EHCI driver for Armada100 SOCs.

Fix the subject, you have ECHI written there ;-)

Quoted 71 lines

---
Changes for v2:
- Fix typo for SOC name
- change printf to debug

 arch/arm/include/asm/arch-armada100/armada100.h |    1 +
 drivers/usb/host/Makefile                       |    1 +
 drivers/usb/host/ehci-armada100.c               |   62
+++++++++++++++++++++++ 3 files changed, 64 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/host/ehci-armada100.c
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-armada100/armada100.h index 70fba27..614de55 100644

arch/arm/include/asm/arch-armada100/armada100.h +1 -0
@@ -68,6 +68,7 @@
 #define ARMD1_SSP5_BASE		0xD4021000
 #define ARMD1_UART3_BASE	0xD4026000
 #define ARMD1_MPMU_BASE		0xD4050000
+#define ARMD1_USB_HOST_BASE	0xD4209000
 #define ARMD1_APMU_BASE		0xD4282800
 #define ARMD1_CPU_BASE		0xD4282C00
 
drivers/usb/host/Makefile +1 -0
index 7c4df53..5fdc97b 100644
@@ -35,6 +35,7 @@ COBJS-$(CONFIG_USB_SL811HS) += sl811-hcd.o
 
 # echi
 COBJS-$(CONFIG_USB_EHCI) += ehci-hcd.o
+COBJS-$(CONFIG_USB_EHCI_ARMADA100) += ehci-armada100.o utmi-armada100.o
 ifdef CONFIG_MPC512X
 COBJS-$(CONFIG_USB_EHCI_FSL) += ehci-mpc512x.o
 else
(quoted diff) +0 -0

b/drivers/usb/host/ehci-armada100.c new file mode 100644 index 0000000..cfe159d

drivers/usb/host/ehci-armada100.c new file +27 -0
@@ -0,0 +1,62 @@
+/*
+ * (C) Copyright 2012
+ * eInfochips Ltd. <www.einfochips.com>
+ * Written-by: Ajay Bhargav <[email protected]>
+ *
+ * This driver is based on Kirkwood echi driver
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ * Written-by: Prafulla Wadaskar <[email protected]>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA

drivers/usb/host/ehci-armada100.c line 37

Quoted 10 lines
drivers/usb/host/ehci-armada100.c new file +10 -0
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <usb.h>
+#include "ehci.h"
+#include "ehci-core.h"
+#include <asm/arch/cpu.h>
+#include <asm/arch/armada100.h>
+#include "utmi-armada100.h"

Where does this include come from? Maybe this should be part of the platform includes in asm/arch/... and accessed as such too?

M

Quoted 25 lines
drivers/usb/host/ehci-armada100.c new file +25 -0
+
+/*
+ * EHCI host controller init
+ */
+int ehci_hcd_init(void)
+{
+	utmi_init();
+	hccr = (struct ehci_hccr *)(ARMD1_USB_HOST_BASE + 0x100);
+	hcor = (struct ehci_hcor *)((uint32_t) hccr
+			+ HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
+
+	debug("armada100-ehci: init hccr %x and hcor %x hc_length %d\n",
+		(uint32_t)hccr, (uint32_t)hcor,
+		(uint32_t)HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
+
+	return 0;
+}
+
+/*
+ * EHCI host controller stop
+ */
+int ehci_hcd_stop(void)
+{
+	return 0;
+}
#3 lore raw

PATCH v2 2/4 USB: Armada100: ECHI Driver for Armada100 SOCs

Quoted 3 lines · Marek Vasut
Quoted 1 line

This patch adds support for USB EHCI driver for Armada100 SOCs.

Fix the subject, you have ECHI written there ;-)

what a blunder :)

[...snip...]

Quoted 11 lines

Review

Quoted 8 lines
(quoted diff) +8 -0
+#include<common.h>
+#include<asm/io.h>
+#include<usb.h>
+#include "ehci.h"
+#include "ehci-core.h"
+#include<asm/arch/cpu.h>
+#include<asm/arch/armada100.h>
+#include "utmi-armada100.h"

Where does this include come from? Maybe this should be part of the platform includes in asm/arch/... and accessed as such too?

Quoted 2 lines

M

Utmi might not be required outside usb.. so its always a part of USB. Do i really need to keep it out?

Regards,
Ajay Bhargav

#4 lore raw

PATCH v2 3/4 Armada100: gplugD: Add USB command support

In reply to Ajay Bhargav

This patch adds support for USB commands and USB storage device for Marvell gplugD

---
Changes for v2:
- removed unwanted ifdef
- fat and ext2 command support moved to new patch

 include/configs/gplugd.h |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
include/configs/gplugd.h +12 -0
index 9813309..061ebe6 100644
@@ -72,6 +72,7 @@
 #define CONFIG_CMD_I2C
 #define CONFIG_CMD_AUTOSCRIPT
 #undef CONFIG_CMD_FPGA
+#define CONFIG_CMD_USB
 
 /* Disable DCACHE */
 #define CONFIG_SYS_DCACHE_OFF
@@ -134,4 +135,15 @@
 #define CONFIG_CMD_EDITENV
 #define CONFIG_CMD_SAVEENV
 
+#ifdef CONFIG_CMD_USB
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_ARMADA100
+#define CONFIG_EHCI_IS_TDI
+#define CONFIG_USB_STORAGE
+#endif /* CONFIG_CMD_USB */
+
+#define CONFIG_DOS_PARTITION
+#define CONFIG_ISO_PARTITION
+#define CONFIG_SUPPORT_VFAT
+
 #endif	/* __CONFIG_GPLUGD_H */
Signature · 1 line
1.7.7.2
#5 lore raw

PATCH v2 3/4 Armada100: gplugD: Add USB command support

Quoted 12 lines

This patch adds support for USB commands and USB storage device for Marvell gplugD

---
Changes for v2:
- removed unwanted ifdef
- fat and ext2 command support moved to new patch

 include/configs/gplugd.h |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
Quoted 28 lines
include/configs/gplugd.h +12 -0
index 9813309..061ebe6 100644
@@ -72,6 +72,7 @@
 #define CONFIG_CMD_I2C
 #define CONFIG_CMD_AUTOSCRIPT
 #undef CONFIG_CMD_FPGA
+#define CONFIG_CMD_USB
 
 /* Disable DCACHE */
 #define CONFIG_SYS_DCACHE_OFF
@@ -134,4 +135,15 @@
 #define CONFIG_CMD_EDITENV
 #define CONFIG_CMD_SAVEENV
 
+#ifdef CONFIG_CMD_USB
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_ARMADA100
+#define CONFIG_EHCI_IS_TDI
+#define CONFIG_USB_STORAGE
+#endif /* CONFIG_CMD_USB */
+
+#define CONFIG_DOS_PARTITION
+#define CONFIG_ISO_PARTITION
+#define CONFIG_SUPPORT_VFAT
+
 #endif	/* __CONFIG_GPLUGD_H */
#6 lore raw

PATCH v2 4/4 Armada100: gplugD: Add FAT & EXT2 command support

In reply to Ajay Bhargav

This patch adds FAT and ext2 command support for marvell gplugD

---
Changes for v2:
- added this new patch for command support

 include/configs/gplugd.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
include/configs/gplugd.h +2 -0
index 061ebe6..462cc7e 100644
@@ -73,6 +73,8 @@
 #define CONFIG_CMD_AUTOSCRIPT
 #undef CONFIG_CMD_FPGA
 #define CONFIG_CMD_USB
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_FAT
 
 /* Disable DCACHE */
 #define CONFIG_SYS_DCACHE_OFF
Signature · 1 line
1.7.7.2
#7 lore raw

PATCH v2 4/4 Armada100: gplugD: Add FAT & EXT2 command support

Quoted 15 lines

This patch adds FAT and ext2 command support for marvell gplugD

---
Changes for v2:
- added this new patch for command support

 include/configs/gplugd.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
include/configs/gplugd.h +0 -0
index 061ebe6..462cc7e 100644

include/configs/gplugd.h line 80

Quoted 8 lines
include/configs/gplugd.h +2 -0
@@ -73,6 +73,8 @@
 #define CONFIG_CMD_AUTOSCRIPT
 #undef CONFIG_CMD_FPGA
 #define CONFIG_CMD_USB
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_FAT
 
 /* Disable DCACHE */
 #define CONFIG_SYS_DCACHE_OFF

Just squash it with the previous patch, it's related to it anyway ;-)

#8 lore raw

PATCH v2 4/4 Armada100: gplugD: Add FAT & EXT2 command support

Quoted 31 lines

-----Original Message-----
From: Marek Vasut [mailto:marex at denx.de]
Sent: 13 February 2012 14:35
To: Ajay Bhargav
Cc: linux at bohmer.net; Prafulla Wadaskar; u-boot at lists.denx.de
Subject: Re: [v2 4/4] Armada100: gplugD: Add FAT & EXT2 command support

Quoted 21 lines

This patch adds FAT and ext2 command support for marvell gplugD

---
Changes for v2:
- added this new patch for command support

 include/configs/gplugd.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
include/configs/gplugd.h +2 -0
index 061ebe6..462cc7e 100644
@@ -73,6 +73,8 @@
 #define CONFIG_CMD_AUTOSCRIPT
 #undef CONFIG_CMD_FPGA
 #define CONFIG_CMD_USB
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_FAT
 
Quoted 4 lines

include/configs/gplugd.h line 80

Quoted 2 lines
include/configs/gplugd.h +0 -0
 /* Disable DCACHE */
 #define CONFIG_SYS_DCACHE_OFF

Just squash it with the previous patch, it's related to it anyway ;-

Or you may exclude this patch from this series and post it as a standalone patch (in fact it is).

Regards..
Prafulla . . .

#9 lore raw

PATCH v2 4/4 Armada100: gplugD: Add FAT & EXT2 command support

Quoted 30 lines · Prafulla Wadaskar
Quoted 30 lines

-----Original Message-----
From: Marek Vasut [mailto:marex at denx.de]
Sent: 13 February 2012 14:35
To: Ajay Bhargav
Cc: linux at bohmer.net; Prafulla Wadaskar; u-boot at lists.denx.de
Subject: Re: [v2 4/4] Armada100: gplugD: Add FAT& EXT2 command support

Quoted 21 lines

This patch adds FAT and ext2 command support for marvell gplugD

---
Changes for v2:
- added this new patch for command support

  include/configs/gplugd.h |    2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
include/configs/gplugd.h +2 -0
index 061ebe6..462cc7e 100644
@@ -73,6 +73,8 @@
  #define CONFIG_CMD_AUTOSCRIPT
  #undef CONFIG_CMD_FPGA
  #define CONFIG_CMD_USB
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_FAT
 
Quoted 8 lines
Quoted 3 lines

include/configs/gplugd.h line 80

Quoted 2 lines
include/configs/gplugd.h +0 -0
  /* Disable DCACHE */
  #define CONFIG_SYS_DCACHE_OFF

Just squash it with the previous patch, it's related to it anyway ;-

Or you may exclude this patch from this series and post it as a standalone patch (in fact it is).

Regards..
Prafulla . . .

I better send a new one :) out of this patch series.

Regards,
Ajay Bhargav

#10 lore raw

PATCH v2 1/4 USB: Armada100: Add UTMI PHY interface driver

In reply to Ajay Bhargav
Quoted 83 lines

This patch adds USB host controller's UTMI PHY interface driver for Armada100 SOCs.

---
Changes for v2:
- Fix: enable only required clock in MPMU

 arch/arm/include/asm/arch-armada100/armada100.h |    8 ++
 drivers/usb/host/utmi-armada100.c               |   87
+++++++++++++++++++++++ drivers/usb/host/utmi-armada100.h               | 
 79 ++++++++++++++++++++ 3 files changed, 174 insertions(+), 0
deletions(-)
 create mode 100644 drivers/usb/host/utmi-armada100.c
 create mode 100644 drivers/usb/host/utmi-armada100.h
(quoted diff) +0 -0

b/arch/arm/include/asm/arch-armada100/armada100.h index 0ed3a8e..70fba27 100644

arch/arm/include/asm/arch-armada100/armada100.h +8 -0
@@ -43,6 +43,14 @@
 #define SSP2_APBCLK		0x01
 #define SSP2_FNCLK		0x02
 
+/* USB Clock/reset control bits */
+#define USB_SPH_AXICLK_EN	0x10
+#define USB_SPH_AXI_RST		0x02
+
+/* MPMU Clocks */
+#define APB2_26M_EN		(1 << 20)
+#define AP_26M			(1 << 4)
+
 /* Register Base Addresses */
 #define ARMD1_DRAM_BASE		0xB0000000
 #define ARMD1_FEC_BASE		0xC0800000
(quoted diff) +0 -0

b/drivers/usb/host/utmi-armada100.c new file mode 100644 index 0000000..1a4d3f2

drivers/usb/host/utmi-armada100.c new file +41 -0
@@ -0,0 +1,87 @@
+/*
+ * (C) Copyright 2012
+ * eInfochips Ltd. <www.einfochips.com>
+ * Written-by: Ajay Bhargav <[email protected]>
+ *
+ * (C) Copyright 2009
+ * Marvell Semiconductor <www.marvell.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <usb.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/armada100.h>
+#include "utmi-armada100.h"
+
+static void utmi_phy_init(void)
+{
+	struct armd1usb_phy_reg *phy_regs =
+		(struct armd1usb_phy_reg *)UTMI_PHY_BASE;
+
+	setbits_le32(&phy_regs->utmi_ctrl, INPKT_DELAY_SOF | PLL_PWR_UP);
+	udelay(1000);

drivers/usb/host/utmi-armada100.c line 51

Quoted 10 lines
drivers/usb/host/utmi-armada100.c new file +10 -0
+	setbits_le32(&phy_regs->utmi_ctrl, PHY_PWR_UP);
+
+	clrbits_le32(&phy_regs->utmi_pll, PLL_FBDIV_MASK | PLL_REFDIV_MASK);
+	setbits_le32(&phy_regs->utmi_pll, N_DIVIDER << PLL_FBDIV | M_DIVIDER);
+
+	setbits_le32(&phy_regs->utmi_tx, PHSEL_VAL << CK60_PHSEL);
+
+	/* Calibrate pll */
+	while ((readl(&phy_regs->utmi_pll) & PLL_READY) == 0)
+		;

No endless loops please.

Quoted 4 lines
drivers/usb/host/utmi-armada100.c new file +4 -0
+
+	udelay(200);
+	setbits_le32(&phy_regs->utmi_pll, VCOCAL_START);
+	udelay(400);

drivers/usb/host/utmi-armada100.c line 65

Quoted 10 lines
drivers/usb/host/utmi-armada100.c new file +10 -0
+	clrbits_le32(&phy_regs->utmi_pll, VCOCAL_START);
+
+	udelay(200);
+	setbits_le32(&phy_regs->utmi_tx, RCAL_START);
+	udelay(400);
+	clrbits_le32(&phy_regs->utmi_tx, RCAL_START);
+
+	while ((readl(&phy_regs->utmi_pll) & PLL_READY) == 0)
+		;
+}

DTTO

M

#11 lore raw

PATCH v2 1/4 USB: Armada100: Add UTMI PHY interface driver

Quoted 5 lines · Marek Vasut

drivers/usb/host/utmi-armada100.c line 51

Quoted 3 lines
drivers/usb/host/utmi-armada100.c new file +3 -0
+	/* Calibrate pll */
+	while ((readl(&phy_regs->utmi_pll)&  PLL_READY) == 0)
+		;

No endless loops please.

missed it somehow... :) will fix

Regards,
Ajay Bhargav