Re: [RFC PATCH v2 03/30] arch/sh: Disable SH specific drivers in OF enabled.

Geert Uytterhoeven <[email protected]>
Newsgroups gmane.linux.ports.sh.devel
Message-ID <CAMuHMdWn1hO4MFHrrUibmxnapQOEUYc-57U+__-8Ldb_s1qYug@mail.gmail.com>
Hi Sato-san,

On Wed, Sep 13, 2023 at 11:35 AM Yoshinori Sato
<[email protected]> wrote:
> OF uses a common framework.
> Avoid using clk, irq and PCI SH-specific drivers.
>
> Signed-off-by: Yoshinori Sato <[email protected]>

Thanks for your patch!

> --- a/arch/sh/Kconfig
> +++ b/arch/sh/Kconfig

> @@ -379,6 +379,7 @@ config CPU_SUBTYPE_SH7751
>  config CPU_SUBTYPE_SH7751R
>         bool "Support SH7751R processor"
>         select CPU_SH4
> +       select PCI_SH7751 if SH_DEVICE_TREE

Is PCI a hard requirement for using SH7751?
It not, it should not be auto-enabled by default.

> --- a/arch/sh/boards/of-generic.c
> +++ b/arch/sh/boards/of-generic.c

> @@ -116,6 +117,8 @@ static void __init sh_of_mem_reserve(void)
>  static void __init sh_of_setup(char **cmdline_p)
>  {
>         struct device_node *root;
> +       struct device_node *cpu;
> +       int freq;

u32

>
>         sh_mv.mv_name = "Unknown SH model";
>         root = of_find_node_by_path("/");
> @@ -125,6 +128,9 @@ static void __init sh_of_setup(char **cmdline_p)
>         }
>
>         sh_of_smp_probe();
> +       cpu = of_find_node_by_name(NULL, "cpu");
> +       if (!of_property_read_u32(cpu, "clock-frequency", &freq))
> +               preset_lpj = freq / 500;
>  }
>
>  static int sh_of_irq_demux(int irq)
> @@ -140,25 +146,14 @@ static void __init sh_of_init_irq(void)
>         irqchip_init();
>  }
>
> -static int __init sh_of_clk_init(void)
> -{
> -#ifdef CONFIG_COMMON_CLK
> -       /* Disabled pending move to COMMON_CLK framework. */
> -       pr_info("SH generic board support: scanning for clk providers\n");
> -       of_clk_init(NULL);
> -#endif
> -       return 0;
> -}
> -
>  static struct sh_machine_vector __initmv sh_of_generic_mv = {
>         .mv_setup       = sh_of_setup,
>         .mv_name        = "devicetree", /* replaced by DT root's model */
>         .mv_irq_demux   = sh_of_irq_demux,
>         .mv_init_irq    = sh_of_init_irq,
> -       .mv_clk_init    = sh_of_clk_init,
> +       .mv_clk_init    = noopi,
>         .mv_mode_pins   = noopi,
> -       .mv_mem_init    = noop,

warning: ‘noop’ defined but not used [-Wunused-function]

> -       .mv_mem_reserve = sh_of_mem_reserve,
> +       .mv_mem_init    = sh_of_mem_init,
>  };
>
>  struct sh_clk_ops;

> --- a/drivers/sh/Makefile
> +++ b/drivers/sh/Makefile
> @@ -2,7 +2,9 @@
>  #
>  # Makefile for the SuperH specific drivers.
>  #
> +ifneq ($(CONFIG_SH_DEVICE_TREE),y)
>  obj-$(CONFIG_SH_INTC)                  += intc/
> +endif
>  ifneq ($(CONFIG_COMMON_CLK),y)
>  obj-$(CONFIG_HAVE_CLK)                 += clk/
>  endif

The above three lines can be simplified to

    obj-$(CONFIG_HAVE_LEGACY_CLK) += clk

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.