Hi Wolfram, On Wed, Sep 20, 2023 at 10:41 PM Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx> wrote: > > There are Renesas ARM Trusted Firmware version out there which e.g. > > configure 0x201 (shifted logical right by 2: 0x80) and with this match > > the added { STPnHCK | 0, 1 }: > > IIRC, that means that the ATF uses 200MHz for the data channel but > disables the 800MHz for the SCC. Because of that, I assume ATF doesn't > do tuning then? Isn't that risky to operate at 200MHz without tuning? Perhaps these products don't care about using SDHI for booting (i.e. use HyperFLASH instead), and thus expect only the application OS (Linux) to use SDHI? > > static const struct clk_div_table cpg_sdh_div_table[] = { > > - { 0, 1 }, { 1, 2 }, { STPnHCK | 2, 4 }, { STPnHCK | 3, 8 }, > > - { STPnHCK | 4, 16 }, { 0, 0 }, > > + { 0, 1 }, { 1, 2 }, { STPnHCK | 0, 1 }, { STPnHCK | 1, 2 }, > > + { STPnHCK | 2, 4 }, { STPnHCK | 3, 8 }, { STPnHCK | 4, 16 }, { 0, 0 }, > > Anyhow, since such ATF seems to be in the wild then, I assume we should > at least support reading such configuration values. I'd reorder it like > this, though: > > + { 0, 1 }, { STPnHCK | 0, 1 }, { 1, 2 }, { STPnHCK | 1, 2 }, > + { STPnHCK | 2, 4 }, { STPnHCK | 3, 8 }, { STPnHCK | 4, 16 }, { 0, 0 }, > > And probably add a comment that the duplicate entries are only for > reading and are not recommended for use with Linux (which will still use > the first matching pair i.e. without STPnHCK). > > Geert, does this all make sense to you? I'm sure you remember better than me the relation between and the impact of the stop bit and the various divider values ;-) An alternative would be to let cpg_sdh_clk_register() sanitize the pre-existing contents of the SD-IFn Clock Frequency Control Register, so there would be no need to extend cpg_sdh_div_table[]. An advantage of that approach would be that it can handle all invalid combinations, not just the few that have been seen in the wild. (following the old networking mantra: "be strict when sinding, be liberal when receiving'). Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds