Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Jan 2013 11:23:12 +0200
From:      Alexander Motin <mav@FreeBSD.org>
To:        Ganbold Tsagaankhuu <ganbold@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r245450 - in head/sys: arm/allwinner arm/conf boot/fdt/dts
Message-ID:  <50F52000.30009@FreeBSD.org>
In-Reply-To: <201301150826.r0F8QGJr044600@svn.freebsd.org>
References:  <201301150826.r0F8QGJr044600@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 15.01.2013 10:26, Ganbold Tsagaankhuu wrote:
> Author: ganbold (doc committer)
> Date: Tue Jan 15 08:26:16 2013
> New Revision: 245450
> URL: http://svnweb.freebsd.org/changeset/base/245450
> 
> Log:
>   Initial support for Allwinner A10 SoC (Cubieboard)
>   	Add simple console driver
>   	Add interrupt handling and timer codes
>   	Add kernel config file
>   	Add dts file
>   Approved by: gonzo

> +        /* Set desired frequency in event timer and timecounter */
> +	sc->et.et_frequency = (uint64_t)freq;
> +	sc->clkfreq = (uint64_t)freq;
> +	sc->et.et_name = "a10_timer Eventtimer";
> +	sc->et.et_flags = ET_FLAGS_ONESHOT | ET_FLAGS_PERIODIC;
> +	sc->et.et_quality = 1000;
> +	sc->et.et_min_period.sec = 0;
> +	sc->et.et_min_period.frac =
> +	    ((0x00000002LLU << 32) / sc->et.et_frequency) << 32;
> +	sc->et.et_max_period.sec = 0xfffffff0U / sc->et.et_frequency;
> +	sc->et.et_max_period.frac =
> +	    ((0xfffffffeLLU << 32) / sc->et.et_frequency) << 32;
> +	sc->et.et_start = a10_timer_timer_start;
> +	sc->et.et_stop = a10_timer_timer_stop;
> +	sc->et.et_priv = sc;
> +	et_register(&sc->et);


> +static int
> +a10_timer_timer_start(struct eventtimer *et, struct bintime *first,
> +    struct bintime *period)
> +{
> +	struct a10_timer_softc *sc;
> +	uint32_t clo, count;
> +
> +	sc = (struct a10_timer_softc *)et->et_priv;
> +
> +	if (first != NULL) {
> +		count = (sc->et.et_frequency * (first->frac >> 32)) >> 32;
> +		if (first->sec != 0)
> +			count += sc->et.et_frequency * first->sec;
> +
> +		/* clear */
> +		timer_write_4(sc, SW_TIMER0_CUR_VALUE_REG, 0);
> +		clo = timer_read_4(sc, SW_TIMER0_CUR_VALUE_REG);
> +		clo += count;
> +		timer_write_4(sc, SW_TIMER0_CUR_VALUE_REG, clo);
> +
> +		return (0);
> +	}
> +
> +	return (EINVAL);
> +}

It seems like you've announced periodic mode support above, but haven't
implemented it here.

-- 
Alexander Motin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?50F52000.30009>