Re: [PATCH] clk: at91: fix compilation errors in sama5d2.c

2019-05-23 Thread Ahmad Fatoum
Hello Sam,

On 2/4/19 19:10, Sam Ravnborg wrote:
> Hi Ahmad.
> 
> Thanks for looking into this.
> 
> On Mon, Apr 01, 2019 at 12:32:57PM +0200, Ahmad Fatoum wrote:
>> sama5d2 was added along with the update to the upstream
>> device tree bindings, but wasn't wired in anywhere.
>>
>> To prepare for usage in future sama5d2 support, fix
>> compilation errors related to absence of locks and
>> unavailability of audio/i2s clock/pll handling.
>>
>> Signed-off-by: Ahmad Fatoum 
> 
> Another approach could have been to stub out the
> non-existing functions to make diff between the kernel
> and the barebox variant smaller.
> 
> Did you consider that approach?

Originally, I only thought about returning -ENOSYS from stubs,
but that won't work because the function would then fail.
I didn't think of returning NULL instead though..

But returning NULL from the stubs won't work for the hunk
at the bottom (the one guarded by if (regmap_sfr)).
That would cause NULL 'holes' in the array and of_clk_get_from_provider,
which normally never returns NULL could start returning NULL then.

I don't want to audit whether that's ok, so I prefer the route of just
removing the audio/i2s stuff...

> 
> The whole section in CONFIG_HAVE_AT91_AUDIO_PLL in dt-compat.c
> is also something we could drop btw. if we go the "drop all audio" stuff
> from clk. Also prototypes in pmc.h

Indeed, thanks for spotting that and sorry for the late answer.
I haven't had time to look at this since then.

Cheers
Ahmad

> 
> The patch itself looked fine. But I think that from a maintenance point of
> view should stub us out of it.
> Let me know what you think.
> 
>   Sam
> 
> 

-- 
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- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH] clk: at91: fix compilation errors in sama5d2.c

2019-04-02 Thread Sam Ravnborg
Hi Ahmad.

Thanks for looking into this.

On Mon, Apr 01, 2019 at 12:32:57PM +0200, Ahmad Fatoum wrote:
> sama5d2 was added along with the update to the upstream
> device tree bindings, but wasn't wired in anywhere.
> 
> To prepare for usage in future sama5d2 support, fix
> compilation errors related to absence of locks and
> unavailability of audio/i2s clock/pll handling.
> 
> Signed-off-by: Ahmad Fatoum 

Another approach could have been to stub out the
non-existing functions to make diff between the kernel
and the barebox variant smaller.

Did you consider that approach?

The whole section in CONFIG_HAVE_AT91_AUDIO_PLL in dt-compat.c
is also something we could drop btw. if we go the "drop all audio" stuff
from clk. Also prototypes in pmc.h

The patch itself looked fine. But I think that from a maintenance point of
view should stub us out of it.
Let me know what you think.

Sam


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] clk: at91: fix compilation errors in sama5d2.c

2019-04-01 Thread Ahmad Fatoum
sama5d2 was added along with the update to the upstream
device tree bindings, but wasn't wired in anywhere.

To prepare for usage in future sama5d2 support, fix
compilation errors related to absence of locks and
unavailability of audio/i2s clock/pll handling.

Signed-off-by: Ahmad Fatoum 
---
 drivers/clk/at91/sama5d2.c | 52 +-
 1 file changed, 6 insertions(+), 46 deletions(-)

diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c
index dc15f7d9cbf3..7627c584ac08 100644
--- a/drivers/clk/at91/sama5d2.c
+++ b/drivers/clk/at91/sama5d2.c
@@ -84,8 +84,6 @@ static const struct {
{ .n = "trng_clk",.id = 47, .r = { .min = 0, .max = 8300 }, },
{ .n = "pdmic_clk",   .id = 48, .r = { .min = 0, .max = 8300 }, },
{ .n = "securam_clk", .id = 51, },
-   { .n = "i2s0_clk",.id = 54, .r = { .min = 0, .max = 8300 }, },
-   { .n = "i2s1_clk",.id = 55, .r = { .min = 0, .max = 8300 }, },
{ .n = "can0_clk",.id = 56, .r = { .min = 0, .max = 8300 }, },
{ .n = "can1_clk",.id = 57, .r = { .min = 0, .max = 8300 }, },
{ .n = "classd_clk",  .id = 59, .r = { .min = 0, .max = 8300 }, },
@@ -123,8 +121,6 @@ static const struct {
{ .n = "pwm_gclk",.id = 38, .r = { .min = 0, .max = 8300 }, },
{ .n = "isc_gclk",.id = 46, },
{ .n = "pdmic_gclk",  .id = 48, },
-   { .n = "i2s0_gclk",   .id = 54, .pll = true },
-   { .n = "i2s1_gclk",   .id = 55, .pll = true },
{ .n = "can0_gclk",   .id = 56, .r = { .min = 0, .max = 8000 }, },
{ .n = "can1_gclk",   .id = 57, .r = { .min = 0, .max = 8000 }, },
{ .n = "classd_gclk", .id = 59, .r = { .min = 0, .max = 1 },
@@ -136,7 +132,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
struct clk_range range = CLK_RANGE(0, 0);
const char *slck_name, *mainxtal_name;
struct pmc_data *sama5d2_pmc;
-   const char *parent_names[6];
+   const char *parent_names[5];
struct regmap *regmap, *regmap_sfr;
struct clk *hw;
int i;
@@ -157,7 +153,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
if (IS_ERR(regmap))
return;
 
-   sama5d2_pmc = pmc_data_allocate(PMC_I2S1_MUX + 1,
+   sama5d2_pmc = pmc_data_allocate(PMC_MCK2 + 1,
nck(sama5d2_systemck),
nck(sama5d2_periph32ck),
nck(sama5d2_gck));
@@ -193,21 +189,6 @@ static void __init sama5d2_pmc_setup(struct device_node 
*np)
if (IS_ERR(hw))
goto err_free;
 
-   hw = at91_clk_register_audio_pll_frac(regmap, "audiopll_fracck",
- "mainck");
-   if (IS_ERR(hw))
-   goto err_free;
-
-   hw = at91_clk_register_audio_pll_pad(regmap, "audiopll_padck",
-"audiopll_fracck");
-   if (IS_ERR(hw))
-   goto err_free;
-
-   hw = at91_clk_register_audio_pll_pmc(regmap, "audiopll_pmcck",
-"audiopll_fracck");
-   if (IS_ERR(hw))
-   goto err_free;
-
regmap_sfr = syscon_regmap_lookup_by_compatible("atmel,sama5d2-sfr");
if (IS_ERR(regmap_sfr))
regmap_sfr = NULL;
@@ -270,7 +251,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
}
 
for (i = 0; i < ARRAY_SIZE(sama5d2_periphck); i++) {
-   hw = at91_clk_register_sam9x5_peripheral(regmap, _pcr_lock,
+   hw = at91_clk_register_sam9x5_peripheral(regmap,
 sama5d2_periphck[i].n,
 "masterck",
 sama5d2_periphck[i].id,
@@ -282,7 +263,7 @@ static void __init sama5d2_pmc_setup(struct device_node *np)
}
 
for (i = 0; i < ARRAY_SIZE(sama5d2_periph32ck); i++) {
-   hw = at91_clk_register_sam9x5_peripheral(regmap, _pcr_lock,
+   hw = at91_clk_register_sam9x5_peripheral(regmap,
 
sama5d2_periph32ck[i].n,
 "h32mxck",
 
sama5d2_periph32ck[i].id,
@@ -298,11 +279,10 @@ static void __init sama5d2_pmc_setup(struct device_node 
*np)
parent_names[2] = "plladivck";
parent_names[3] = "utmick";
parent_names[4] = "mck";
-   parent_names[5] = "audiopll_pmcck";
for (i = 0; i < ARRAY_SIZE(sama5d2_gck); i++) {
-   hw = at91_clk_register_generated(regmap, _pcr_lock,
+   hw = at91_clk_register_generated(regmap,
 sama5d2_gck[i].n,
-