Skip to contentSkip to conversation

at91/usb: always provide all the clocks

PATCH New Jean-Christophe PLAGNIOL-VILLARD 3 participants 7 messages Aug 30, 2011 – Sep 7, 2011

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 at91/usb: always provide all the clocks

drop the cpu_is in the driver
at91sam9261 and at91sam9g10 expect 3 clocks

---
 arch/arm/mach-at91/at91cap9.c    |    2 ++
 arch/arm/mach-at91/at91rm9200.c  |    2 ++
 arch/arm/mach-at91/at91sam9260.c |    2 ++
 arch/arm/mach-at91/at91sam9261.c |   29 +++++++++++++++--------------
 arch/arm/mach-at91/at91sam9263.c |    2 ++
 arch/arm/mach-at91/at91sam9g45.c |    2 ++
 drivers/usb/host/ohci-at91.c     |   15 +++++----------
 7 files changed, 30 insertions(+), 24 deletions(-)
arch/arm/mach-at91/at91cap9.c +2 -0
index bfc6844..ecdd54d 100644
@@ -219,6 +219,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
+	/* fake hclk clock */
+	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 };
 
 static struct clk_lookup usart_clocks_lookups[] = {
arch/arm/mach-at91/at91rm9200.c +2 -0
index f73302d..713d3bd 100644
@@ -193,6 +193,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
+	/* fake hclk clock */
+	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 };
 
 static struct clk_lookup usart_clocks_lookups[] = {
arch/arm/mach-at91/at91sam9260.c +2 -0
index cb397be..a9be758 100644
@@ -199,6 +199,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t4_clk", "atmel_tcb.1", &tc4_clk),
 	CLKDEV_CON_DEV_ID("t5_clk", "atmel_tcb.1", &tc5_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc_clk),
+	/* fake hclk clock */
+	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 };
 
 static struct clk_lookup usart_clocks_lookups[] = {
arch/arm/mach-at91/at91sam9261.c +15 -14
index 6c8e3b5..658a518 100644
@@ -129,6 +129,20 @@ static struct clk lcdc_clk = {
 	.type		= CLK_TYPE_PERIPHERAL,
 };
 
+/* HClocks */
+static struct clk hck0 = {
+	.name		= "hck0",
+	.pmc_mask	= AT91_PMC_HCK0,
+	.type		= CLK_TYPE_SYSTEM,
+	.id		= 0,
+};
+static struct clk hck1 = {
+	.name		= "hck1",
+	.pmc_mask	= AT91_PMC_HCK1,
+	.type		= CLK_TYPE_SYSTEM,
+	.id		= 1,
+};
+
 static struct clk *periph_clocks[] __initdata = {
 	&pioA_clk,
 	&pioB_clk,
@@ -161,6 +175,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
+	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &hck0),
 };
 
 static struct clk_lookup usart_clocks_lookups[] = {
@@ -199,20 +214,6 @@ static struct clk pck3 = {
 	.id		= 3,
 };
 
-/* HClocks */
-static struct clk hck0 = {
-	.name		= "hck0",
-	.pmc_mask	= AT91_PMC_HCK0,
-	.type		= CLK_TYPE_SYSTEM,
-	.id		= 0,
-};
-static struct clk hck1 = {
-	.name		= "hck1",
-	.pmc_mask	= AT91_PMC_HCK1,
-	.type		= CLK_TYPE_SYSTEM,
-	.id		= 1,
-};
-
 static void __init at91sam9261_register_clocks(void)
 {
 	int i;
arch/arm/mach-at91/at91sam9263.c +2 -0
index 044f3c9..f83fbb0 100644
@@ -189,6 +189,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
 	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
 	CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk),
+	/* fake hclk clock */
+	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 };
 
 static struct clk_lookup usart_clocks_lookups[] = {
arch/arm/mach-at91/at91sam9g45.c +2 -0
index e04c5fb..4d743c0 100644
@@ -215,6 +215,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tcb0_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
+	/* fake hclk clock */
+	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 };
 
 static struct clk_lookup usart_clocks_lookups[] = {
drivers/usb/host/ohci-at91.c +5 -10
index 944291e..e08cb10 100644
@@ -35,8 +35,7 @@ extern int usb_disabled(void);
 
 static void at91_start_clock(void)
 {
-	if (cpu_is_at91sam9261() || cpu_is_at91sam9g10())
-		clk_enable(hclk);
+	clk_enable(hclk);
 	clk_enable(iclk);
 	clk_enable(fclk);
 	clocked = 1;
@@ -46,8 +45,7 @@ static void at91_stop_clock(void)
 {
 	clk_disable(fclk);
 	clk_disable(iclk);
-	if (cpu_is_at91sam9261() || cpu_is_at91sam9g10())
-		clk_disable(hclk);
+	clk_disable(hclk);
 	clocked = 0;
 }
 
@@ -142,8 +140,7 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver,
 
 	iclk = clk_get(&pdev->dev, "ohci_clk");
 	fclk = clk_get(&pdev->dev, "uhpck");
-	if (cpu_is_at91sam9261() || cpu_is_at91sam9g10())
-		hclk = clk_get(&pdev->dev, "hck0");
+	hclk = clk_get(&pdev->dev, "hclk");
 
 	at91_start_hc(pdev);
 	ohci_hcd_init(hcd_to_ohci(hcd));
@@ -155,8 +152,7 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver,
 	/* Error handling */
 	at91_stop_hc(pdev);
 
-	if (cpu_is_at91sam9261() || cpu_is_at91sam9g10())
-		clk_put(hclk);
+	clk_put(hclk);
 	clk_put(fclk);
 	clk_put(iclk);
 
@@ -192,8 +188,7 @@ static void usb_hcd_at91_remove(struct usb_hcd *hcd,
 	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
 	usb_put_hcd(hcd);
 
-	if (cpu_is_at91sam9261() || cpu_is_at91sam9g10())
-		clk_put(hclk);
+	clk_put(hclk);
 	clk_put(fclk);
 	clk_put(iclk);
 	fclk = iclk = hclk = NULL;
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/1 at91/usb: always provide all the clocks

Quoted 20 lines · Jean-Christophe PLAGNIOL-VILLARD

drop the cpu_is in the driver
at91sam9261 and at91sam9g10 expect 3 clocks

---

?arch/arm/mach-at91/at91cap9.c ? ?| ? ?2 ++
?arch/arm/mach-at91/at91rm9200.c ?| ? ?2 ++
?arch/arm/mach-at91/at91sam9260.c | ? ?2 ++
?arch/arm/mach-at91/at91sam9261.c | ? 29 +++++++++++++++--------------
?arch/arm/mach-at91/at91sam9263.c | ? ?2 ++
?arch/arm/mach-at91/at91sam9g45.c | ? ?2 ++
?drivers/usb/host/ohci-at91.c ? ? | ? 15 +++++----------

?7 files changed, 30 insertions(+), 24 deletions(-)

arch/arm/mach-at91/at91cap9.c +0 -0
index bfc6844..ecdd54d 100644

arch/arm/mach-at91/at91cap9.c static struct clk_lookup periph_clocks_lookups[] = { · line 222

Quoted 4 lines
arch/arm/mach-at91/at91cap9.c +1 -0
@@ -219,6 +219,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 ? ? ? ?CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk),
 ? ? ? ?CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
 ? ? ? ?CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
+ ? ? ? /* fake hclk clock */

why is it a fake clock??

Quoted 172 lines
arch/arm/mach-at91/at91cap9.c +1 -0
+ ? ? ? CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 ?};
 
 ?static struct clk_lookup usart_clocks_lookups[] = {
arch/arm/mach-at91/at91rm9200.c +2 -0
index f73302d..713d3bd 100644
@@ -193,6 +193,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 ? ? ? ?CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
 ? ? ? ?CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
 ? ? ? ?CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
+ ? ? ? /* fake hclk clock */
+ ? ? ? CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 ?};
 
 ?static struct clk_lookup usart_clocks_lookups[] = {
arch/arm/mach-at91/at91sam9260.c +2 -0
index cb397be..a9be758 100644
@@ -199,6 +199,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 ? ? ? ?CLKDEV_CON_DEV_ID("t4_clk", "atmel_tcb.1", &tc4_clk),
 ? ? ? ?CLKDEV_CON_DEV_ID("t5_clk", "atmel_tcb.1", &tc5_clk),
 ? ? ? ?CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc_clk),
+ ? ? ? /* fake hclk clock */
+ ? ? ? CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 ?};
 
 ?static struct clk_lookup usart_clocks_lookups[] = {
arch/arm/mach-at91/at91sam9261.c +15 -14
index 6c8e3b5..658a518 100644
@@ -129,6 +129,20 @@ static struct clk lcdc_clk = {
 ? ? ? ?.type ? ? ? ? ? = CLK_TYPE_PERIPHERAL,
 ?};
 
+/* HClocks */
+static struct clk hck0 = {
+ ? ? ? .name ? ? ? ? ? = "hck0",
+ ? ? ? .pmc_mask ? ? ? = AT91_PMC_HCK0,
+ ? ? ? .type ? ? ? ? ? = CLK_TYPE_SYSTEM,
+ ? ? ? .id ? ? ? ? ? ? = 0,
+};
+static struct clk hck1 = {
+ ? ? ? .name ? ? ? ? ? = "hck1",
+ ? ? ? .pmc_mask ? ? ? = AT91_PMC_HCK1,
+ ? ? ? .type ? ? ? ? ? = CLK_TYPE_SYSTEM,
+ ? ? ? .id ? ? ? ? ? ? = 1,
+};
+
 ?static struct clk *periph_clocks[] __initdata = {
 ? ? ? ?&pioA_clk,
 ? ? ? ?&pioB_clk,
@@ -161,6 +175,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
 ? ? ? ?CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
 ? ? ? ?CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
 ? ? ? ?CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
+ ? ? ? CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &hck0),
 ?};
 
 ?static struct clk_lookup usart_clocks_lookups[] = {
@@ -199,20 +214,6 @@ static struct clk pck3 = {
 ? ? ? ?.id ? ? ? ? ? ? = 3,
 ?};
 
-/* HClocks */
-static struct clk hck0 = {
- ? ? ? .name ? ? ? ? ? = "hck0",
- ? ? ? .pmc_mask ? ? ? = AT91_PMC_HCK0,
- ? ? ? .type ? ? ? ? ? = CLK_TYPE_SYSTEM,
- ? ? ? .id ? ? ? ? ? ? = 0,
-};
-static struct clk hck1 = {
- ? ? ? .name ? ? ? ? ? = "hck1",
- ? ? ? .pmc_mask ? ? ? = AT91_PMC_HCK1,
- ? ? ? .type ? ? ? ? ? = CLK_TYPE_SYSTEM,
- ? ? ? .id ? ? ? ? ? ? = 1,
-};
-
 ?static void __init at91sam9261_register_clocks(void)
 ?{
 ? ? ? ?int i;
arch/arm/mach-at91/at91sam9263.c +2 -0
index 044f3c9..f83fbb0 100644
@@ -189,6 +189,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 ? ? ? ?CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
 ? ? ? ?CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
 ? ? ? ?CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk),
+ ? ? ? /* fake hclk clock */
+ ? ? ? CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 ?};
 
 ?static struct clk_lookup usart_clocks_lookups[] = {
arch/arm/mach-at91/at91sam9g45.c +2 -0
index e04c5fb..4d743c0 100644
@@ -215,6 +215,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 ? ? ? ?CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tcb0_clk),
 ? ? ? ?CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
 ? ? ? ?CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
+ ? ? ? /* fake hclk clock */
+ ? ? ? CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 ?};
 
 ?static struct clk_lookup usart_clocks_lookups[] = {
drivers/usb/host/ohci-at91.c +3 -6
index 944291e..e08cb10 100644
@@ -35,8 +35,7 @@ extern int usb_disabled(void);
 
 ?static void at91_start_clock(void)
 ?{
- ? ? ? if (cpu_is_at91sam9261() || cpu_is_at91sam9g10())
- ? ? ? ? ? ? ? clk_enable(hclk);
+ ? ? ? clk_enable(hclk);
 ? ? ? ?clk_enable(iclk);
 ? ? ? ?clk_enable(fclk);
 ? ? ? ?clocked = 1;
@@ -46,8 +45,7 @@ static void at91_stop_clock(void)
 ?{
 ? ? ? ?clk_disable(fclk);
 ? ? ? ?clk_disable(iclk);
- ? ? ? if (cpu_is_at91sam9261() || cpu_is_at91sam9g10())
- ? ? ? ? ? ? ? clk_disable(hclk);
+ ? ? ? clk_disable(hclk);
 ? ? ? ?clocked = 0;
 ?}
 
@@ -142,8 +140,7 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver,
 
 ? ? ? ?iclk = clk_get(&pdev->dev, "ohci_clk");
 ? ? ? ?fclk = clk_get(&pdev->dev, "uhpck");
- ? ? ? if (cpu_is_at91sam9261() || cpu_is_at91sam9g10())
- ? ? ? ? ? ? ? hclk = clk_get(&pdev->dev, "hck0");
+ ? ? ? hclk = clk_get(&pdev->dev, "hclk");
 
 ? ? ? ?at91_start_hc(pdev);
 ? ? ? ?ohci_hcd_init(hcd_to_ohci(hcd));
@@ -155,8 +152,7 @@ static int usb_hcd_at91_probe(const struct hc_driver *driver,

? ? ? ?/* Error handling */
? ? ? ?at91_stop_hc(pdev);

- ? ? ? if (cpu_is_at91sam9261() || cpu_is_at91sam9g10())
- ? ? ? ? ? ? ? clk_put(hclk);
+ ? ? ? clk_put(hclk);
? ? ? ?clk_put(fclk);
? ? ? ?clk_put(iclk);

drivers/usb/host/ohci-at91.c +1 -3
@@ -192,8 +188,7 @@ static void usb_hcd_at91_remove(struct usb_hcd *hcd,
 ? ? ? ?release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
 ? ? ? ?usb_put_hcd(hcd);
 
- ? ? ? if (cpu_is_at91sam9261() || cpu_is_at91sam9g10())
- ? ? ? ? ? ? ? clk_put(hclk);
+ ? ? ? clk_put(hclk);
 ? ? ? ?clk_put(fclk);
 ? ? ? ?clk_put(iclk);
 ? ? ? ?fclk = iclk = hclk = NULL;
--

1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html

#2 lore raw

PATCH 1/1 at91/usb: always provide all the clocks

Quoted 17 lines · KISHON VIJAY
Quoted 15 lines · Jean-Christophe PLAGNIOL-VILLARD

drop the cpu_is in the driver
at91sam9261 and at91sam9g10 expect 3 clocks

---

?arch/arm/mach-at91/at91cap9.c ? ?| ? ?2 ++
?arch/arm/mach-at91/at91rm9200.c ?| ? ?2 ++
?arch/arm/mach-at91/at91sam9260.c | ? ?2 ++
?arch/arm/mach-at91/at91sam9261.c | ? 29 +++++++++++++++--------------
?arch/arm/mach-at91/at91sam9263.c | ? ?2 ++
?arch/arm/mach-at91/at91sam9g45.c | ? ?2 ++
?drivers/usb/host/ohci-at91.c ? ? | ? 15 +++++----------

?7 files changed, 30 insertions(+), 24 deletions(-)

Quoted 10 lines

arch/arm/mach-at91/at91cap9.c static struct clk_lookup periph_clocks_lookups[] = { · line 222

Quoted 9 lines
arch/arm/mach-at91/at91cap9.c +1 -0
index bfc6844..ecdd54d 100644
@@ -219,6 +219,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 ? ? ? ?CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk),
 ? ? ? ?CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
 ? ? ? ?CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
+ ? ? ? /* fake hclk clock */

why is it a fake clock??

because we do have the hclk only on 9261 and 9g10

Best Regards,
J.

#3 lore raw

PATCH 1/1 at91/usb: always provide all the clocks

In reply to Jean-Christophe PLAGNIOL-VILLARD

Le 30/08/2011 03:29, Jean-Christophe PLAGNIOL-VILLARD :

Quoted 5 lines

drop the cpu_is in the driver
at91sam9261 and at91sam9g10 expect 3 clocks

included in at91-l2 branch on:
git://github.com/at91linux/linux-at91.git
(mind the removal of -2.6-)

Quoted 8 lines
---
 arch/arm/mach-at91/at91cap9.c    |    2 ++
 arch/arm/mach-at91/at91rm9200.c  |    2 ++
 arch/arm/mach-at91/at91sam9260.c |    2 ++
 arch/arm/mach-at91/at91sam9261.c |   29 +++++++++++++++--------------
 arch/arm/mach-at91/at91sam9263.c |    2 ++
 arch/arm/mach-at91/at91sam9g45.c |    2 ++
 drivers/usb/host/ohci-at91.c     |   15 +++++----------

USB guys,

Are you ok if we send this patch upstream through the ARM soc git tree?

Best regards,

Signature · 1 line
Nicolas Ferre
#4 lore raw

PATCH 1/1 at91/usb: always provide all the clocks

In reply to Jean-Christophe PLAGNIOL-VILLARD

Le 30/08/2011 03:29, Jean-Christophe PLAGNIOL-VILLARD :

Quoted 5 lines

drop the cpu_is in the driver
at91sam9261 and at91sam9g10 expect 3 clocks

Quoted 7 lines
---
 arch/arm/mach-at91/at91cap9.c    |    2 ++
 arch/arm/mach-at91/at91rm9200.c  |    2 ++
 arch/arm/mach-at91/at91sam9260.c |    2 ++
 arch/arm/mach-at91/at91sam9261.c |   29 +++++++++++++++--------------
 arch/arm/mach-at91/at91sam9263.c |    2 ++
 arch/arm/mach-at91/at91sam9g45.c |    2 ++

I know that I have signed the patch *but* there is an issue here...

Quoted 101 lines
 drivers/usb/host/ohci-at91.c     |   15 +++++----------
 7 files changed, 30 insertions(+), 24 deletions(-)
arch/arm/mach-at91/at91cap9.c +2 -0
index bfc6844..ecdd54d 100644
@@ -219,6 +219,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
+	/* fake hclk clock */
+	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 };
 
 static struct clk_lookup usart_clocks_lookups[] = {
arch/arm/mach-at91/at91rm9200.c +2 -0
index f73302d..713d3bd 100644
@@ -193,6 +193,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
+	/* fake hclk clock */
+	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 };
 
 static struct clk_lookup usart_clocks_lookups[] = {
arch/arm/mach-at91/at91sam9260.c +2 -0
index cb397be..a9be758 100644
@@ -199,6 +199,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t4_clk", "atmel_tcb.1", &tc4_clk),
 	CLKDEV_CON_DEV_ID("t5_clk", "atmel_tcb.1", &tc5_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc_clk),
+	/* fake hclk clock */
+	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 };
 
 static struct clk_lookup usart_clocks_lookups[] = {
arch/arm/mach-at91/at91sam9261.c +15 -14
index 6c8e3b5..658a518 100644
@@ -129,6 +129,20 @@ static struct clk lcdc_clk = {
 	.type		= CLK_TYPE_PERIPHERAL,
 };
 
+/* HClocks */
+static struct clk hck0 = {
+	.name		= "hck0",
+	.pmc_mask	= AT91_PMC_HCK0,
+	.type		= CLK_TYPE_SYSTEM,
+	.id		= 0,
+};
+static struct clk hck1 = {
+	.name		= "hck1",
+	.pmc_mask	= AT91_PMC_HCK1,
+	.type		= CLK_TYPE_SYSTEM,
+	.id		= 1,
+};
+
 static struct clk *periph_clocks[] __initdata = {
 	&pioA_clk,
 	&pioB_clk,
@@ -161,6 +175,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
+	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &hck0),
 };
 
 static struct clk_lookup usart_clocks_lookups[] = {
@@ -199,20 +214,6 @@ static struct clk pck3 = {
 	.id		= 3,
 };
 
-/* HClocks */
-static struct clk hck0 = {
-	.name		= "hck0",
-	.pmc_mask	= AT91_PMC_HCK0,
-	.type		= CLK_TYPE_SYSTEM,
-	.id		= 0,
-};
-static struct clk hck1 = {
-	.name		= "hck1",
-	.pmc_mask	= AT91_PMC_HCK1,
-	.type		= CLK_TYPE_SYSTEM,
-	.id		= 1,
-};
-
 static void __init at91sam9261_register_clocks(void)
 {
 	int i;
arch/arm/mach-at91/at91sam9263.c +0 -0
index 044f3c9..f83fbb0 100644

arch/arm/mach-at91/at91sam9263.c static struct clk_lookup periph_clocks_lookups[] = { · line 193

Quoted 5 lines
arch/arm/mach-at91/at91sam9263.c +2 -0
@@ -189,6 +189,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
 	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
 	CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk),
+	/* fake hclk clock */
+	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),

We cannot do this: it does not even compiles.
The ohci_clk clock is not existing on this device. Moreover, the "hclk" con_id is already existing for the *gadget* device...

We have to correct this before I can send it upstream.

Bye,

Signature · 1 line
Nicolas Ferre
#5 lore raw

PATCH 1/1 at91/usb: always provide all the clocks

Quoted 128 lines · Nicolas Ferre

Le 30/08/2011 03:29, Jean-Christophe PLAGNIOL-VILLARD :

Quoted 5 lines

drop the cpu_is in the driver
at91sam9261 and at91sam9g10 expect 3 clocks

Quoted 7 lines
---
 arch/arm/mach-at91/at91cap9.c    |    2 ++
 arch/arm/mach-at91/at91rm9200.c  |    2 ++
 arch/arm/mach-at91/at91sam9260.c |    2 ++
 arch/arm/mach-at91/at91sam9261.c |   29 +++++++++++++++--------------
 arch/arm/mach-at91/at91sam9263.c |    2 ++
 arch/arm/mach-at91/at91sam9g45.c |    2 ++

I know that I have signed the patch *but* there is an issue here...

Quoted 101 lines
 drivers/usb/host/ohci-at91.c     |   15 +++++----------
 7 files changed, 30 insertions(+), 24 deletions(-)
arch/arm/mach-at91/at91cap9.c +2 -0
index bfc6844..ecdd54d 100644
@@ -219,6 +219,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
+	/* fake hclk clock */
+	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 };
 
 static struct clk_lookup usart_clocks_lookups[] = {
arch/arm/mach-at91/at91rm9200.c +2 -0
index f73302d..713d3bd 100644
@@ -193,6 +193,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
+	/* fake hclk clock */
+	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 };
 
 static struct clk_lookup usart_clocks_lookups[] = {
arch/arm/mach-at91/at91sam9260.c +2 -0
index cb397be..a9be758 100644
@@ -199,6 +199,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t4_clk", "atmel_tcb.1", &tc4_clk),
 	CLKDEV_CON_DEV_ID("t5_clk", "atmel_tcb.1", &tc5_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc_clk),
+	/* fake hclk clock */
+	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 };
 
 static struct clk_lookup usart_clocks_lookups[] = {
arch/arm/mach-at91/at91sam9261.c +15 -14
index 6c8e3b5..658a518 100644
@@ -129,6 +129,20 @@ static struct clk lcdc_clk = {
 	.type		= CLK_TYPE_PERIPHERAL,
 };
 
+/* HClocks */
+static struct clk hck0 = {
+	.name		= "hck0",
+	.pmc_mask	= AT91_PMC_HCK0,
+	.type		= CLK_TYPE_SYSTEM,
+	.id		= 0,
+};
+static struct clk hck1 = {
+	.name		= "hck1",
+	.pmc_mask	= AT91_PMC_HCK1,
+	.type		= CLK_TYPE_SYSTEM,
+	.id		= 1,
+};
+
 static struct clk *periph_clocks[] __initdata = {
 	&pioA_clk,
 	&pioB_clk,
@@ -161,6 +175,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
+	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &hck0),
 };
 
 static struct clk_lookup usart_clocks_lookups[] = {
@@ -199,20 +214,6 @@ static struct clk pck3 = {
 	.id		= 3,
 };
 
-/* HClocks */
-static struct clk hck0 = {
-	.name		= "hck0",
-	.pmc_mask	= AT91_PMC_HCK0,
-	.type		= CLK_TYPE_SYSTEM,
-	.id		= 0,
-};
-static struct clk hck1 = {
-	.name		= "hck1",
-	.pmc_mask	= AT91_PMC_HCK1,
-	.type		= CLK_TYPE_SYSTEM,
-	.id		= 1,
-};
-
 static void __init at91sam9261_register_clocks(void)
 {
 	int i;
arch/arm/mach-at91/at91sam9263.c +0 -0
index 044f3c9..f83fbb0 100644

arch/arm/mach-at91/at91sam9263.c static struct clk_lookup periph_clocks_lookups[] = { · line 193

Quoted 5 lines
arch/arm/mach-at91/at91sam9263.c +2 -0
@@ -189,6 +189,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
 	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
 	CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk),
+	/* fake hclk clock */
+	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),

We cannot do this: it does not even compiles.
The ohci_clk clock is not existing on this device. Moreover, the "hclk" con_id is already existing for the *gadget* device...

Quoted 1 line

We have to correct this before I can send it upstream.

we can as the conid + devid are prioritary than just the conid

so

	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &uhphs_clk),

Best Regards,
J.

#6 lore raw

PATCH 1/1 at91/usb: always provide all the clocks

Le 07/09/2011 15:38, Jean-Christophe PLAGNIOL-VILLARD :

Quoted 129 lines · Nicolas Ferre
Quoted 128 lines

Le 30/08/2011 03:29, Jean-Christophe PLAGNIOL-VILLARD :

Quoted 5 lines

drop the cpu_is in the driver
at91sam9261 and at91sam9g10 expect 3 clocks

Quoted 7 lines
---
 arch/arm/mach-at91/at91cap9.c    |    2 ++
 arch/arm/mach-at91/at91rm9200.c  |    2 ++
 arch/arm/mach-at91/at91sam9260.c |    2 ++
 arch/arm/mach-at91/at91sam9261.c |   29 +++++++++++++++--------------
 arch/arm/mach-at91/at91sam9263.c |    2 ++
 arch/arm/mach-at91/at91sam9g45.c |    2 ++

I know that I have signed the patch *but* there is an issue here...

Quoted 101 lines
 drivers/usb/host/ohci-at91.c     |   15 +++++----------
 7 files changed, 30 insertions(+), 24 deletions(-)
arch/arm/mach-at91/at91cap9.c +2 -0
index bfc6844..ecdd54d 100644
@@ -219,6 +219,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
+	/* fake hclk clock */
+	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 };
 
 static struct clk_lookup usart_clocks_lookups[] = {
arch/arm/mach-at91/at91rm9200.c +2 -0
index f73302d..713d3bd 100644
@@ -193,6 +193,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
+	/* fake hclk clock */
+	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 };
 
 static struct clk_lookup usart_clocks_lookups[] = {
arch/arm/mach-at91/at91sam9260.c +2 -0
index cb397be..a9be758 100644
@@ -199,6 +199,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("t4_clk", "atmel_tcb.1", &tc4_clk),
 	CLKDEV_CON_DEV_ID("t5_clk", "atmel_tcb.1", &tc5_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc_clk),
+	/* fake hclk clock */
+	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),
 };
 
 static struct clk_lookup usart_clocks_lookups[] = {
arch/arm/mach-at91/at91sam9261.c +15 -14
index 6c8e3b5..658a518 100644
@@ -129,6 +129,20 @@ static struct clk lcdc_clk = {
 	.type		= CLK_TYPE_PERIPHERAL,
 };
 
+/* HClocks */
+static struct clk hck0 = {
+	.name		= "hck0",
+	.pmc_mask	= AT91_PMC_HCK0,
+	.type		= CLK_TYPE_SYSTEM,
+	.id		= 0,
+};
+static struct clk hck1 = {
+	.name		= "hck1",
+	.pmc_mask	= AT91_PMC_HCK1,
+	.type		= CLK_TYPE_SYSTEM,
+	.id		= 1,
+};
+
 static struct clk *periph_clocks[] __initdata = {
 	&pioA_clk,
 	&pioB_clk,
@@ -161,6 +175,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
 	CLKDEV_CON_DEV_ID("pclk", "ssc.2", &ssc2_clk),
+	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &hck0),
 };
 
 static struct clk_lookup usart_clocks_lookups[] = {
@@ -199,20 +214,6 @@ static struct clk pck3 = {
 	.id		= 3,
 };
 
-/* HClocks */
-static struct clk hck0 = {
-	.name		= "hck0",
-	.pmc_mask	= AT91_PMC_HCK0,
-	.type		= CLK_TYPE_SYSTEM,
-	.id		= 0,
-};
-static struct clk hck1 = {
-	.name		= "hck1",
-	.pmc_mask	= AT91_PMC_HCK1,
-	.type		= CLK_TYPE_SYSTEM,
-	.id		= 1,
-};
-
 static void __init at91sam9261_register_clocks(void)
 {
 	int i;
arch/arm/mach-at91/at91sam9263.c +0 -0
index 044f3c9..f83fbb0 100644

arch/arm/mach-at91/at91sam9263.c static struct clk_lookup periph_clocks_lookups[] = { · line 193

Quoted 5 lines
arch/arm/mach-at91/at91sam9263.c +2 -0
@@ -189,6 +189,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
 	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
 	CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk),
+	/* fake hclk clock */
+	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &ohci_clk),

We cannot do this: it does not even compiles.
The ohci_clk clock is not existing on this device. Moreover, the "hclk" con_id is already existing for the *gadget* device...

Quoted 5 lines
Quoted 1 line

We have to correct this before I can send it upstream.

we can as the conid + devid are prioritary than just the conid

so

	CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &uhphs_clk),

Ok, I correct in the patch.

Thanks for the quick answer. Bye,

Signature · 1 line
Nicolas Ferre