[PATCH v6 4/8] clocksource/drivers/timer-gxp: Add HPE GXP Timer

Arnd Bergmann arnd at arndb.de
Tue May 3 03:34:00 PDT 2022


On Mon, May 2, 2022 at 10:40 PM <nick.hawkins at hpe.com> wrote:
>
> +config GXP_TIMER
> +       bool "GXP timer driver" if COMPILE_TEST
> +       depends on ARCH_HPE
> +       default y

I don't think this does what you intended: with the COMPILE_TEST option,
you make it possible to disable the driver when ARCH_HPE is set,
but you don't allow enabling it on other platforms, which is actually the
point of compile testing.

Maybe instead use

config GXP_TIMER
       bool "GXP timer driver" if COMPILE_TEST && !ARCH_HPE
       default ARCH_HPE

Also change the prompt to be more specific and mention HPE,
as the 'GXP timer' is not a particularly obvious name for random
users.

You probably also need

        select TIMER_OF if OF


> +/*
> + * This probe gets called after the timer is already up and running. This will create
> + * the watchdog device as a child since the registers are shared.
> + */
> +
> +static int gxp_timer_probe(struct platform_device *pdev)
> +{
> +       struct platform_device *gxp_watchdog_device;
> +       struct device *dev = &pdev->dev;
> +
> +       if (!gxp_timer) {
> +               pr_err("Gxp Timer not initialized, cannot create watchdog");
> +               return -ENOMEM;
> +       }
> +
> +       gxp_watchdog_device = platform_device_alloc("gxp-wdt", -1);
> +       if (!gxp_watchdog_device) {
> +               pr_err("Timer failed to allocate gxp-wdt");
> +               return -ENOMEM;
> +       }
> +
> +       /* Pass the base address (counter) as platform data and nothing else */
> +       gxp_watchdog_device->dev.platform_data = gxp_timer->counter;
> +       gxp_watchdog_device->dev.parent = dev;
> +
> +       return platform_device_add(gxp_watchdog_device);
> +}

This looks good to me now.

        Arnd



More information about the linux-arm-kernel mailing list