Skip to contentSkip to conversation

mach-at91: declare device tree clock

PATCH Applied Raphaël Poggi 2 participants 3 messages Sep 8, 2014 – Sep 10, 2014

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

PATCH v2 1/1 mach-at91: declare device tree clock

This commit use the clkdev_add_physbase function, to declare device tree and non device tree gpio clocks.

---
 arch/arm/mach-at91/at91sam9g45.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
arch/arm/mach-at91/at91sam9g45.c +8 -5
index 9a50deb..584ef9d 100644
@@ -192,11 +192,6 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci1", &mmc1_clk),
 	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi0", &spi0_clk),
 	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi1", &spi1_clk),
-	CLKDEV_DEV_ID("at91rm9200-gpio0", &pioA_clk),
-	CLKDEV_DEV_ID("at91rm9200-gpio1", &pioB_clk),
-	CLKDEV_DEV_ID("at91rm9200-gpio2", &pioC_clk),
-	CLKDEV_DEV_ID("at91rm9200-gpio3", &pioDE_clk),
-	CLKDEV_DEV_ID("at91rm9200-gpio4", &pioDE_clk),
 	CLKDEV_DEV_ID("at91-pit", &mck),
 	CLKDEV_CON_DEV_ID("hck1", "atmel_lcdfb", &lcdc_clk),
 };
@@ -238,6 +233,14 @@ static void __init at91sam9g45_register_clocks(void)
 	clkdev_add_table(usart_clocks_lookups,
 			 ARRAY_SIZE(usart_clocks_lookups));
 
+	clkdev_add_physbase(&twi0_clk, 0xfff84000, NULL);
+	clkdev_add_physbase(&twi1_clk, 0xfff88000, NULL);
+	clkdev_add_physbase(&pioA_clk, 0xfffff200, NULL);
+	clkdev_add_physbase(&pioB_clk, 0xfffff400, NULL);
+	clkdev_add_physbase(&pioC_clk, 0xfffff600, NULL);
+	clkdev_add_physbase(&pioDE_clk, 0xfffff800, NULL);
+	clkdev_add_physbase(&pioDE_clk, 0xfffffa00, NULL);
+
 	if (cpu_is_at91sam9m10() || cpu_is_at91sam9m11())
 		clk_register(&vdec_clk);
 
Signature · 7 lines
2.1.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH v2 1/1 pinctrl: at91: add driver data

This commit adds the driver data for the gpio-at91 driver.

---
 drivers/pinctrl/pinctrl-at91.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/pinctrl/pinctrl-at91.c +10 -0
index d3423d0..3c6b38c 100644
@@ -606,8 +606,10 @@ static struct gpio_ops at91_gpio_ops = {
 static struct of_device_id at91_gpio_dt_ids[] = {
 	{
 		.compatible = "atmel,at91rm9200-gpio",
+		.data = (unsigned long)&at91rm9200_ops,
 	}, {
 		.compatible = "atmel,at91sam9x5-gpio",
+		.data = (unsigned long)&at91sam9x5_ops,
 	}, {
 		/* sentinel */
 	},
@@ -629,6 +631,12 @@ static int at91_gpio_probe(struct device_d *dev)
 
 	at91_gpio = &gpio_chip[alias_idx];
 
+	ret = dev_get_drvdata(dev, (unsigned long *)&at91_gpio->ops);
+	if (ret) {
+		dev_err(dev, "dev_get_drvdata failed: %d\n", ret);
+		return ret;
+	}
+
 	clk = clk_get(dev, NULL);
 	if (IS_ERR(clk)) {
 		ret = PTR_ERR(clk);
@@ -667,8 +675,10 @@ static int at91_gpio_probe(struct device_d *dev)
 static struct platform_device_id at91_gpio_ids[] = {
 	{
 		.name = "at91rm9200-gpio",
+		.driver_data = (unsigned long)&at91rm9200_ops,
 	}, {
 		.name = "at91sam9x5-gpio",
+		.driver_data = (unsigned long)&at91sam9x5_ops,
 	}, {
 		/* sentinel */
 	},
Signature · 7 lines
2.1.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#2 lore raw
In reply to Raphaël Poggi
Quoted 3 lines · Raphaël Poggi

This commit use the clkdev_add_physbase function, to declare device tree and non device tree gpio clocks.

Applied, thanks

I replaced the hardcoded values with the existing defines whily applying.

Sascha

Quoted 43 lines
---
 arch/arm/mach-at91/at91sam9g45.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
arch/arm/mach-at91/at91sam9g45.c +8 -5
index 9a50deb..584ef9d 100644
@@ -192,11 +192,6 @@ static struct clk_lookup periph_clocks_lookups[] = {
 	CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci1", &mmc1_clk),
 	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi0", &spi0_clk),
 	CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi1", &spi1_clk),
-	CLKDEV_DEV_ID("at91rm9200-gpio0", &pioA_clk),
-	CLKDEV_DEV_ID("at91rm9200-gpio1", &pioB_clk),
-	CLKDEV_DEV_ID("at91rm9200-gpio2", &pioC_clk),
-	CLKDEV_DEV_ID("at91rm9200-gpio3", &pioDE_clk),
-	CLKDEV_DEV_ID("at91rm9200-gpio4", &pioDE_clk),
 	CLKDEV_DEV_ID("at91-pit", &mck),
 	CLKDEV_CON_DEV_ID("hck1", "atmel_lcdfb", &lcdc_clk),
 };
@@ -238,6 +233,14 @@ static void __init at91sam9g45_register_clocks(void)
 	clkdev_add_table(usart_clocks_lookups,
 			 ARRAY_SIZE(usart_clocks_lookups));
 
+	clkdev_add_physbase(&twi0_clk, 0xfff84000, NULL);
+	clkdev_add_physbase(&twi1_clk, 0xfff88000, NULL);
+	clkdev_add_physbase(&pioA_clk, 0xfffff200, NULL);
+	clkdev_add_physbase(&pioB_clk, 0xfffff400, NULL);
+	clkdev_add_physbase(&pioC_clk, 0xfffff600, NULL);
+	clkdev_add_physbase(&pioDE_clk, 0xfffff800, NULL);
+	clkdev_add_physbase(&pioDE_clk, 0xfffffa00, NULL);
+
 	if (cpu_is_at91sam9m10() || cpu_is_at91sam9m11())
 		clk_register(&vdec_clk);
 
Signature · 7 lines
2.1.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox