Re: [PATCH v12 05/13] clk: ingenic: Add driver for the TCU clocks

From: Stephen Boyd
Date: Fri Jun 07 2019 - 18:54:56 EST


Quoting Paul Cercueil (2019-06-07 14:59:54)
> Hi Stephen, thanks for the review.
> > Quoting Paul Cercueil (2019-05-21 07:51:33)
> >> diff --git a/drivers/clk/ingenic/tcu.c b/drivers/clk/ingenic/tcu.c
> >> new file mode 100644
> >> index 000000000000..7249225a6994
> >> --- /dev/null
> >> +++ b/drivers/clk/ingenic/tcu.c
> >> @@ -0,0 +1,458 @@
> >> +// SPDX-License-Identifier: GPL-2.0
> >> +/*
> >> + * JZ47xx SoCs TCU clocks driver
> >> + * Copyright (C) 2019 Paul Cercueil <paul@xxxxxxxxxxxxxxx>
> >> + */
> >> +
> >> +#include <linux/clk.h>
> >> +#include <linux/clk-provider.h>
> >> +#include <linux/clkdev.h>
> >> +#include <linux/clockchips.h>
> >> +#include <linux/mfd/ingenic-tcu.h>
> >> +#include <linux/regmap.h>
> >> +
> >> +#include <dt-bindings/clock/ingenic,tcu.h>
> >> +
> >> +/* 8 channels max + watchdog + OST */
> >> +#define TCU_CLK_COUNT 10
> >> +
> >> +#define TCU_ERR(...) pr_crit("ingenic-tcu-clk: " __VA_ARGS__)
> >
> > Why is it pr_crit instead of pr_err()?
>
> If the TCU timer clocks are not provided for any reason, the system
> will have no timer, and the kernel will hang very early in the init
> process. That's why I chose pr_crit().

HMm. So maybe it should be TCU_CRIT() then? Or just drop the wrapper
macro and define a pr_fmt for this file that has ingenic-tcu-clk: for
it?

>
> Most of the code here works without a struct device, it wouldn't be
> easy to
> get it to work with runtime PM.
>
> I can enable the "tcu" clock in the probe and just gate/ungate it in the
> suspend/resume callbacks, that would work just fine. We don't need
> anything
> fancy here.

OK. That sounds like a better approach to gate and ungate in
suspend/resume.