xref: /openbmc/linux/drivers/clk/at91/at91sam9x5.c (revision 2612e3bbc0386368a850140a6c9b990cd496a5ec)
11eabdc2fSAlexandre Belloni // SPDX-License-Identifier: GPL-2.0
21eabdc2fSAlexandre Belloni #include <linux/clk-provider.h>
31eabdc2fSAlexandre Belloni #include <linux/mfd/syscon.h>
41eabdc2fSAlexandre Belloni #include <linux/slab.h>
51eabdc2fSAlexandre Belloni 
61eabdc2fSAlexandre Belloni #include <dt-bindings/clock/at91.h>
71eabdc2fSAlexandre Belloni 
81eabdc2fSAlexandre Belloni #include "pmc.h"
91eabdc2fSAlexandre Belloni 
107a110b91SClaudiu Beznea static DEFINE_SPINLOCK(mck_lock);
117a110b91SClaudiu Beznea 
121eabdc2fSAlexandre Belloni static const struct clk_master_characteristics mck_characteristics = {
131eabdc2fSAlexandre Belloni 	.output = { .min = 0, .max = 133333333 },
141eabdc2fSAlexandre Belloni 	.divisors = { 1, 2, 4, 3 },
151eabdc2fSAlexandre Belloni 	.have_div3_pres = 1,
161eabdc2fSAlexandre Belloni };
171eabdc2fSAlexandre Belloni 
181eabdc2fSAlexandre Belloni static u8 plla_out[] = { 0, 1, 2, 3, 0, 1, 2, 3 };
191eabdc2fSAlexandre Belloni 
201eabdc2fSAlexandre Belloni static u16 plla_icpll[] = { 0, 0, 0, 0, 1, 1, 1, 1 };
211eabdc2fSAlexandre Belloni 
227b4c162eSStephen Boyd static const struct clk_range plla_outputs[] = {
231eabdc2fSAlexandre Belloni 	{ .min = 745000000, .max = 800000000 },
241eabdc2fSAlexandre Belloni 	{ .min = 695000000, .max = 750000000 },
251eabdc2fSAlexandre Belloni 	{ .min = 645000000, .max = 700000000 },
261eabdc2fSAlexandre Belloni 	{ .min = 595000000, .max = 650000000 },
271eabdc2fSAlexandre Belloni 	{ .min = 545000000, .max = 600000000 },
281eabdc2fSAlexandre Belloni 	{ .min = 495000000, .max = 555000000 },
291eabdc2fSAlexandre Belloni 	{ .min = 445000000, .max = 500000000 },
301eabdc2fSAlexandre Belloni 	{ .min = 400000000, .max = 450000000 },
311eabdc2fSAlexandre Belloni };
321eabdc2fSAlexandre Belloni 
331eabdc2fSAlexandre Belloni static const struct clk_pll_characteristics plla_characteristics = {
341eabdc2fSAlexandre Belloni 	.input = { .min = 2000000, .max = 32000000 },
351eabdc2fSAlexandre Belloni 	.num_output = ARRAY_SIZE(plla_outputs),
361eabdc2fSAlexandre Belloni 	.output = plla_outputs,
371eabdc2fSAlexandre Belloni 	.icpll = plla_icpll,
381eabdc2fSAlexandre Belloni 	.out = plla_out,
391eabdc2fSAlexandre Belloni };
401eabdc2fSAlexandre Belloni 
411eabdc2fSAlexandre Belloni static const struct {
421eabdc2fSAlexandre Belloni 	char *n;
431eabdc2fSAlexandre Belloni 	char *p;
4468b3b6f1SClaudiu Beznea 	unsigned long flags;
451eabdc2fSAlexandre Belloni 	u8 id;
461eabdc2fSAlexandre Belloni } at91sam9x5_systemck[] = {
4768b3b6f1SClaudiu Beznea 	/*
4868b3b6f1SClaudiu Beznea 	 * ddrck feeds DDR controller and is enabled by bootloader thus we need
4968b3b6f1SClaudiu Beznea 	 * to keep it enabled in case there is no Linux consumer for it.
5068b3b6f1SClaudiu Beznea 	 */
5168b3b6f1SClaudiu Beznea 	{ .n = "ddrck", .p = "masterck_div", .id = 2, .flags = CLK_IS_CRITICAL },
521eabdc2fSAlexandre Belloni 	{ .n = "smdck", .p = "smdclk",   .id = 4 },
531eabdc2fSAlexandre Belloni 	{ .n = "uhpck", .p = "usbck",    .id = 6 },
541eabdc2fSAlexandre Belloni 	{ .n = "udpck", .p = "usbck",    .id = 7 },
551eabdc2fSAlexandre Belloni 	{ .n = "pck0",  .p = "prog0",    .id = 8 },
561eabdc2fSAlexandre Belloni 	{ .n = "pck1",  .p = "prog1",    .id = 9 },
571eabdc2fSAlexandre Belloni };
581eabdc2fSAlexandre Belloni 
59cb4f4949SAlexandre Belloni static const struct clk_pcr_layout at91sam9x5_pcr_layout = {
60cb4f4949SAlexandre Belloni 	.offset = 0x10c,
61cb4f4949SAlexandre Belloni 	.cmd = BIT(12),
62cb4f4949SAlexandre Belloni 	.pid_mask = GENMASK(5, 0),
63cb4f4949SAlexandre Belloni 	.div_mask = GENMASK(17, 16),
64cb4f4949SAlexandre Belloni };
65cb4f4949SAlexandre Belloni 
661eabdc2fSAlexandre Belloni struct pck {
671eabdc2fSAlexandre Belloni 	char *n;
681eabdc2fSAlexandre Belloni 	u8 id;
691eabdc2fSAlexandre Belloni };
701eabdc2fSAlexandre Belloni 
711eabdc2fSAlexandre Belloni static const struct pck at91sam9x5_periphck[] = {
721eabdc2fSAlexandre Belloni 	{ .n = "pioAB_clk",  .id = 2, },
731eabdc2fSAlexandre Belloni 	{ .n = "pioCD_clk",  .id = 3, },
741eabdc2fSAlexandre Belloni 	{ .n = "smd_clk",    .id = 4, },
751eabdc2fSAlexandre Belloni 	{ .n = "usart0_clk", .id = 5, },
761eabdc2fSAlexandre Belloni 	{ .n = "usart1_clk", .id = 6, },
771eabdc2fSAlexandre Belloni 	{ .n = "usart2_clk", .id = 7, },
781eabdc2fSAlexandre Belloni 	{ .n = "twi0_clk",   .id = 9, },
791eabdc2fSAlexandre Belloni 	{ .n = "twi1_clk",   .id = 10, },
801eabdc2fSAlexandre Belloni 	{ .n = "twi2_clk",   .id = 11, },
811eabdc2fSAlexandre Belloni 	{ .n = "mci0_clk",   .id = 12, },
821eabdc2fSAlexandre Belloni 	{ .n = "spi0_clk",   .id = 13, },
831eabdc2fSAlexandre Belloni 	{ .n = "spi1_clk",   .id = 14, },
841eabdc2fSAlexandre Belloni 	{ .n = "uart0_clk",  .id = 15, },
851eabdc2fSAlexandre Belloni 	{ .n = "uart1_clk",  .id = 16, },
861eabdc2fSAlexandre Belloni 	{ .n = "tcb0_clk",   .id = 17, },
871eabdc2fSAlexandre Belloni 	{ .n = "pwm_clk",    .id = 18, },
881eabdc2fSAlexandre Belloni 	{ .n = "adc_clk",    .id = 19, },
891eabdc2fSAlexandre Belloni 	{ .n = "dma0_clk",   .id = 20, },
901eabdc2fSAlexandre Belloni 	{ .n = "dma1_clk",   .id = 21, },
911eabdc2fSAlexandre Belloni 	{ .n = "uhphs_clk",  .id = 22, },
921eabdc2fSAlexandre Belloni 	{ .n = "udphs_clk",  .id = 23, },
931eabdc2fSAlexandre Belloni 	{ .n = "mci1_clk",   .id = 26, },
941eabdc2fSAlexandre Belloni 	{ .n = "ssc0_clk",   .id = 28, },
951eabdc2fSAlexandre Belloni };
961eabdc2fSAlexandre Belloni 
971eabdc2fSAlexandre Belloni static const struct pck at91sam9g15_periphck[] = {
981eabdc2fSAlexandre Belloni 	{ .n = "lcdc_clk", .id = 25, },
991eabdc2fSAlexandre Belloni 	{ /* sentinel */}
1001eabdc2fSAlexandre Belloni };
1011eabdc2fSAlexandre Belloni 
1021eabdc2fSAlexandre Belloni static const struct pck at91sam9g25_periphck[] = {
1031eabdc2fSAlexandre Belloni 	{ .n = "usart3_clk", .id = 8, },
1041eabdc2fSAlexandre Belloni 	{ .n = "macb0_clk", .id = 24, },
1051eabdc2fSAlexandre Belloni 	{ .n = "isi_clk", .id = 25, },
1061eabdc2fSAlexandre Belloni 	{ /* sentinel */}
1071eabdc2fSAlexandre Belloni };
1081eabdc2fSAlexandre Belloni 
1091eabdc2fSAlexandre Belloni static const struct pck at91sam9g35_periphck[] = {
1101eabdc2fSAlexandre Belloni 	{ .n = "macb0_clk", .id = 24, },
1111eabdc2fSAlexandre Belloni 	{ .n = "lcdc_clk", .id = 25, },
1121eabdc2fSAlexandre Belloni 	{ /* sentinel */}
1131eabdc2fSAlexandre Belloni };
1141eabdc2fSAlexandre Belloni 
1151eabdc2fSAlexandre Belloni static const struct pck at91sam9x25_periphck[] = {
1161eabdc2fSAlexandre Belloni 	{ .n = "usart3_clk", .id = 8, },
1171eabdc2fSAlexandre Belloni 	{ .n = "macb0_clk", .id = 24, },
1181eabdc2fSAlexandre Belloni 	{ .n = "macb1_clk", .id = 27, },
1191eabdc2fSAlexandre Belloni 	{ .n = "can0_clk", .id = 29, },
1201eabdc2fSAlexandre Belloni 	{ .n = "can1_clk", .id = 30, },
1211eabdc2fSAlexandre Belloni 	{ /* sentinel */}
1221eabdc2fSAlexandre Belloni };
1231eabdc2fSAlexandre Belloni 
1241eabdc2fSAlexandre Belloni static const struct pck at91sam9x35_periphck[] = {
1251eabdc2fSAlexandre Belloni 	{ .n = "macb0_clk", .id = 24, },
1261eabdc2fSAlexandre Belloni 	{ .n = "lcdc_clk", .id = 25, },
1271eabdc2fSAlexandre Belloni 	{ .n = "can0_clk", .id = 29, },
1281eabdc2fSAlexandre Belloni 	{ .n = "can1_clk", .id = 30, },
1291eabdc2fSAlexandre Belloni 	{ /* sentinel */}
1301eabdc2fSAlexandre Belloni };
1311eabdc2fSAlexandre Belloni 
at91sam9x5_pmc_setup(struct device_node * np,const struct pck * extra_pcks,bool has_lcdck)1321eabdc2fSAlexandre Belloni static void __init at91sam9x5_pmc_setup(struct device_node *np,
1331eabdc2fSAlexandre Belloni 					const struct pck *extra_pcks,
1341eabdc2fSAlexandre Belloni 					bool has_lcdck)
1351eabdc2fSAlexandre Belloni {
1361eabdc2fSAlexandre Belloni 	struct clk_range range = CLK_RANGE(0, 0);
1371eabdc2fSAlexandre Belloni 	const char *slck_name, *mainxtal_name;
1381eabdc2fSAlexandre Belloni 	struct pmc_data *at91sam9x5_pmc;
1391eabdc2fSAlexandre Belloni 	const char *parent_names[6];
1401eabdc2fSAlexandre Belloni 	struct regmap *regmap;
1411eabdc2fSAlexandre Belloni 	struct clk_hw *hw;
1421eabdc2fSAlexandre Belloni 	int i;
1431eabdc2fSAlexandre Belloni 	bool bypass;
1441eabdc2fSAlexandre Belloni 
1451eabdc2fSAlexandre Belloni 	i = of_property_match_string(np, "clock-names", "slow_clk");
1461eabdc2fSAlexandre Belloni 	if (i < 0)
1471eabdc2fSAlexandre Belloni 		return;
1481eabdc2fSAlexandre Belloni 
1491eabdc2fSAlexandre Belloni 	slck_name = of_clk_get_parent_name(np, i);
1501eabdc2fSAlexandre Belloni 
1511eabdc2fSAlexandre Belloni 	i = of_property_match_string(np, "clock-names", "main_xtal");
1521eabdc2fSAlexandre Belloni 	if (i < 0)
1531eabdc2fSAlexandre Belloni 		return;
1541eabdc2fSAlexandre Belloni 	mainxtal_name = of_clk_get_parent_name(np, i);
1551eabdc2fSAlexandre Belloni 
1566956eb33SAlexandre Belloni 	regmap = device_node_to_regmap(np);
1571eabdc2fSAlexandre Belloni 	if (IS_ERR(regmap))
1581eabdc2fSAlexandre Belloni 		return;
1591eabdc2fSAlexandre Belloni 
16003a1ee1dSMichał Mirosław 	at91sam9x5_pmc = pmc_data_allocate(PMC_PLLACK + 1,
16199767cd4SMichał Mirosław 					   nck(at91sam9x5_systemck), 31, 0, 2);
1621eabdc2fSAlexandre Belloni 	if (!at91sam9x5_pmc)
1631eabdc2fSAlexandre Belloni 		return;
1641eabdc2fSAlexandre Belloni 
1651eabdc2fSAlexandre Belloni 	hw = at91_clk_register_main_rc_osc(regmap, "main_rc_osc", 12000000,
1661eabdc2fSAlexandre Belloni 					   50000000);
1671eabdc2fSAlexandre Belloni 	if (IS_ERR(hw))
1681eabdc2fSAlexandre Belloni 		goto err_free;
1691eabdc2fSAlexandre Belloni 
1701eabdc2fSAlexandre Belloni 	bypass = of_property_read_bool(np, "atmel,osc-bypass");
1711eabdc2fSAlexandre Belloni 
172b5105e37SClaudiu Beznea 	hw = at91_clk_register_main_osc(regmap, "main_osc", mainxtal_name, NULL,
1731eabdc2fSAlexandre Belloni 					bypass);
1741eabdc2fSAlexandre Belloni 	if (IS_ERR(hw))
1751eabdc2fSAlexandre Belloni 		goto err_free;
1761eabdc2fSAlexandre Belloni 
1771eabdc2fSAlexandre Belloni 	parent_names[0] = "main_rc_osc";
1781eabdc2fSAlexandre Belloni 	parent_names[1] = "main_osc";
179b5105e37SClaudiu Beznea 	hw = at91_clk_register_sam9x5_main(regmap, "mainck", parent_names, NULL, 2);
1801eabdc2fSAlexandre Belloni 	if (IS_ERR(hw))
1811eabdc2fSAlexandre Belloni 		goto err_free;
1821eabdc2fSAlexandre Belloni 
1831eabdc2fSAlexandre Belloni 	at91sam9x5_pmc->chws[PMC_MAIN] = hw;
1841eabdc2fSAlexandre Belloni 
1851eabdc2fSAlexandre Belloni 	hw = at91_clk_register_pll(regmap, "pllack", "mainck", 0,
1861eabdc2fSAlexandre Belloni 				   &at91rm9200_pll_layout, &plla_characteristics);
1871eabdc2fSAlexandre Belloni 	if (IS_ERR(hw))
1881eabdc2fSAlexandre Belloni 		goto err_free;
1891eabdc2fSAlexandre Belloni 
1901eabdc2fSAlexandre Belloni 	hw = at91_clk_register_plldiv(regmap, "plladivck", "pllack");
1911eabdc2fSAlexandre Belloni 	if (IS_ERR(hw))
1921eabdc2fSAlexandre Belloni 		goto err_free;
1931eabdc2fSAlexandre Belloni 
19403a1ee1dSMichał Mirosław 	at91sam9x5_pmc->chws[PMC_PLLACK] = hw;
19503a1ee1dSMichał Mirosław 
196*077782e3SClaudiu Beznea 	hw = at91_clk_register_utmi(regmap, NULL, "utmick", "mainck", NULL);
1971eabdc2fSAlexandre Belloni 	if (IS_ERR(hw))
1981eabdc2fSAlexandre Belloni 		goto err_free;
1991eabdc2fSAlexandre Belloni 
2001eabdc2fSAlexandre Belloni 	at91sam9x5_pmc->chws[PMC_UTMI] = hw;
2011eabdc2fSAlexandre Belloni 
2021eabdc2fSAlexandre Belloni 	parent_names[0] = slck_name;
2031eabdc2fSAlexandre Belloni 	parent_names[1] = "mainck";
2041eabdc2fSAlexandre Belloni 	parent_names[2] = "plladivck";
2051eabdc2fSAlexandre Belloni 	parent_names[3] = "utmick";
2067a110b91SClaudiu Beznea 	hw = at91_clk_register_master_pres(regmap, "masterck_pres", 4,
207171e502cSClaudiu Beznea 					   parent_names, NULL,
2081eabdc2fSAlexandre Belloni 					   &at91sam9x5_master_layout,
2098e842f02SClaudiu Beznea 					   &mck_characteristics, &mck_lock);
2107a110b91SClaudiu Beznea 	if (IS_ERR(hw))
2117a110b91SClaudiu Beznea 		goto err_free;
2127a110b91SClaudiu Beznea 
2137a110b91SClaudiu Beznea 	hw = at91_clk_register_master_div(regmap, "masterck_div",
214171e502cSClaudiu Beznea 					  "masterck_pres", NULL,
2157a110b91SClaudiu Beznea 					  &at91sam9x5_master_layout,
2167a110b91SClaudiu Beznea 					  &mck_characteristics, &mck_lock,
2177029db09SClaudiu Beznea 					  CLK_SET_RATE_GATE, 0);
2181eabdc2fSAlexandre Belloni 	if (IS_ERR(hw))
2191eabdc2fSAlexandre Belloni 		goto err_free;
2201eabdc2fSAlexandre Belloni 
2211eabdc2fSAlexandre Belloni 	at91sam9x5_pmc->chws[PMC_MCK] = hw;
2221eabdc2fSAlexandre Belloni 
2231eabdc2fSAlexandre Belloni 	parent_names[0] = "plladivck";
2241eabdc2fSAlexandre Belloni 	parent_names[1] = "utmick";
2251eabdc2fSAlexandre Belloni 	hw = at91sam9x5_clk_register_usb(regmap, "usbck", parent_names, 2);
2261eabdc2fSAlexandre Belloni 	if (IS_ERR(hw))
2271eabdc2fSAlexandre Belloni 		goto err_free;
2281eabdc2fSAlexandre Belloni 
2291eabdc2fSAlexandre Belloni 	hw = at91sam9x5_clk_register_smd(regmap, "smdclk", parent_names, 2);
2301eabdc2fSAlexandre Belloni 	if (IS_ERR(hw))
2311eabdc2fSAlexandre Belloni 		goto err_free;
2321eabdc2fSAlexandre Belloni 
2331eabdc2fSAlexandre Belloni 	parent_names[0] = slck_name;
2341eabdc2fSAlexandre Belloni 	parent_names[1] = "mainck";
2351eabdc2fSAlexandre Belloni 	parent_names[2] = "plladivck";
2361eabdc2fSAlexandre Belloni 	parent_names[3] = "utmick";
2377a110b91SClaudiu Beznea 	parent_names[4] = "masterck_div";
2381eabdc2fSAlexandre Belloni 	for (i = 0; i < 2; i++) {
2391eabdc2fSAlexandre Belloni 		char name[6];
2401eabdc2fSAlexandre Belloni 
2411eabdc2fSAlexandre Belloni 		snprintf(name, sizeof(name), "prog%d", i);
2421eabdc2fSAlexandre Belloni 
2431eabdc2fSAlexandre Belloni 		hw = at91_clk_register_programmable(regmap, name,
2441a2669dfSClaudiu Beznea 						    parent_names, NULL, 5, i,
245c57aaaa2SClaudiu Beznea 						    &at91sam9x5_programmable_layout,
246c57aaaa2SClaudiu Beznea 						    NULL);
2471eabdc2fSAlexandre Belloni 		if (IS_ERR(hw))
2481eabdc2fSAlexandre Belloni 			goto err_free;
24999767cd4SMichał Mirosław 
25099767cd4SMichał Mirosław 		at91sam9x5_pmc->pchws[i] = hw;
2511eabdc2fSAlexandre Belloni 	}
2521eabdc2fSAlexandre Belloni 
2531eabdc2fSAlexandre Belloni 	for (i = 0; i < ARRAY_SIZE(at91sam9x5_systemck); i++) {
2541eabdc2fSAlexandre Belloni 		hw = at91_clk_register_system(regmap, at91sam9x5_systemck[i].n,
2551a537f62SClaudiu Beznea 					      at91sam9x5_systemck[i].p, NULL,
25668b3b6f1SClaudiu Beznea 					      at91sam9x5_systemck[i].id,
25768b3b6f1SClaudiu Beznea 					      at91sam9x5_systemck[i].flags);
2581eabdc2fSAlexandre Belloni 		if (IS_ERR(hw))
2591eabdc2fSAlexandre Belloni 			goto err_free;
2601eabdc2fSAlexandre Belloni 
2611eabdc2fSAlexandre Belloni 		at91sam9x5_pmc->shws[at91sam9x5_systemck[i].id] = hw;
2621eabdc2fSAlexandre Belloni 	}
2631eabdc2fSAlexandre Belloni 
2641eabdc2fSAlexandre Belloni 	if (has_lcdck) {
26568b3b6f1SClaudiu Beznea 		hw = at91_clk_register_system(regmap, "lcdck", "masterck_div",
2661a537f62SClaudiu Beznea 					      NULL, 3, 0);
2671eabdc2fSAlexandre Belloni 		if (IS_ERR(hw))
2681eabdc2fSAlexandre Belloni 			goto err_free;
2691eabdc2fSAlexandre Belloni 
2701eabdc2fSAlexandre Belloni 		at91sam9x5_pmc->shws[3] = hw;
2711eabdc2fSAlexandre Belloni 	}
2721eabdc2fSAlexandre Belloni 
2731eabdc2fSAlexandre Belloni 	for (i = 0; i < ARRAY_SIZE(at91sam9x5_periphck); i++) {
2741eabdc2fSAlexandre Belloni 		hw = at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock,
275cb4f4949SAlexandre Belloni 							 &at91sam9x5_pcr_layout,
2761eabdc2fSAlexandre Belloni 							 at91sam9x5_periphck[i].n,
277c2f2ca0bSClaudiu Beznea 							 "masterck_div", NULL,
2781eabdc2fSAlexandre Belloni 							 at91sam9x5_periphck[i].id,
27968b3b6f1SClaudiu Beznea 							 &range, INT_MIN, 0);
2801eabdc2fSAlexandre Belloni 		if (IS_ERR(hw))
2811eabdc2fSAlexandre Belloni 			goto err_free;
2821eabdc2fSAlexandre Belloni 
2831eabdc2fSAlexandre Belloni 		at91sam9x5_pmc->phws[at91sam9x5_periphck[i].id] = hw;
2841eabdc2fSAlexandre Belloni 	}
2851eabdc2fSAlexandre Belloni 
2861eabdc2fSAlexandre Belloni 	for (i = 0; extra_pcks[i].id; i++) {
2871eabdc2fSAlexandre Belloni 		hw = at91_clk_register_sam9x5_peripheral(regmap, &pmc_pcr_lock,
288cb4f4949SAlexandre Belloni 							 &at91sam9x5_pcr_layout,
2891eabdc2fSAlexandre Belloni 							 extra_pcks[i].n,
290c2f2ca0bSClaudiu Beznea 							 "masterck_div", NULL,
2911eabdc2fSAlexandre Belloni 							 extra_pcks[i].id,
29268b3b6f1SClaudiu Beznea 							 &range, INT_MIN, 0);
2931eabdc2fSAlexandre Belloni 		if (IS_ERR(hw))
2941eabdc2fSAlexandre Belloni 			goto err_free;
2951eabdc2fSAlexandre Belloni 
2961eabdc2fSAlexandre Belloni 		at91sam9x5_pmc->phws[extra_pcks[i].id] = hw;
2971eabdc2fSAlexandre Belloni 	}
2981eabdc2fSAlexandre Belloni 
2991eabdc2fSAlexandre Belloni 	of_clk_add_hw_provider(np, of_clk_hw_pmc_get, at91sam9x5_pmc);
3001eabdc2fSAlexandre Belloni 
3011eabdc2fSAlexandre Belloni 	return;
3021eabdc2fSAlexandre Belloni 
3031eabdc2fSAlexandre Belloni err_free:
3047425f246SMichał Mirosław 	kfree(at91sam9x5_pmc);
3051eabdc2fSAlexandre Belloni }
3061eabdc2fSAlexandre Belloni 
at91sam9g15_pmc_setup(struct device_node * np)3071eabdc2fSAlexandre Belloni static void __init at91sam9g15_pmc_setup(struct device_node *np)
3081eabdc2fSAlexandre Belloni {
3091eabdc2fSAlexandre Belloni 	at91sam9x5_pmc_setup(np, at91sam9g15_periphck, true);
3101eabdc2fSAlexandre Belloni }
311428d97e1STudor Ambarus 
312428d97e1STudor Ambarus CLK_OF_DECLARE(at91sam9g15_pmc, "atmel,at91sam9g15-pmc", at91sam9g15_pmc_setup);
3131eabdc2fSAlexandre Belloni 
at91sam9g25_pmc_setup(struct device_node * np)3141eabdc2fSAlexandre Belloni static void __init at91sam9g25_pmc_setup(struct device_node *np)
3151eabdc2fSAlexandre Belloni {
3161eabdc2fSAlexandre Belloni 	at91sam9x5_pmc_setup(np, at91sam9g25_periphck, false);
3171eabdc2fSAlexandre Belloni }
318428d97e1STudor Ambarus 
319428d97e1STudor Ambarus CLK_OF_DECLARE(at91sam9g25_pmc, "atmel,at91sam9g25-pmc", at91sam9g25_pmc_setup);
3201eabdc2fSAlexandre Belloni 
at91sam9g35_pmc_setup(struct device_node * np)3211eabdc2fSAlexandre Belloni static void __init at91sam9g35_pmc_setup(struct device_node *np)
3221eabdc2fSAlexandre Belloni {
3231eabdc2fSAlexandre Belloni 	at91sam9x5_pmc_setup(np, at91sam9g35_periphck, true);
3241eabdc2fSAlexandre Belloni }
325428d97e1STudor Ambarus 
326428d97e1STudor Ambarus CLK_OF_DECLARE(at91sam9g35_pmc, "atmel,at91sam9g35-pmc", at91sam9g35_pmc_setup);
3271eabdc2fSAlexandre Belloni 
at91sam9x25_pmc_setup(struct device_node * np)3281eabdc2fSAlexandre Belloni static void __init at91sam9x25_pmc_setup(struct device_node *np)
3291eabdc2fSAlexandre Belloni {
3301eabdc2fSAlexandre Belloni 	at91sam9x5_pmc_setup(np, at91sam9x25_periphck, false);
3311eabdc2fSAlexandre Belloni }
332428d97e1STudor Ambarus 
333428d97e1STudor Ambarus CLK_OF_DECLARE(at91sam9x25_pmc, "atmel,at91sam9x25-pmc", at91sam9x25_pmc_setup);
3341eabdc2fSAlexandre Belloni 
at91sam9x35_pmc_setup(struct device_node * np)3351eabdc2fSAlexandre Belloni static void __init at91sam9x35_pmc_setup(struct device_node *np)
3361eabdc2fSAlexandre Belloni {
3371eabdc2fSAlexandre Belloni 	at91sam9x5_pmc_setup(np, at91sam9x35_periphck, true);
3381eabdc2fSAlexandre Belloni }
339428d97e1STudor Ambarus 
340428d97e1STudor Ambarus CLK_OF_DECLARE(at91sam9x35_pmc, "atmel,at91sam9x35-pmc", at91sam9x35_pmc_setup);
341