linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Sergei Ianovich <ynvich-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org>,
	Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	Ian Campbell
	<ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org>,
	Kumar Gala <galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"open list:SPI SUBSYSTEM"
	<linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH v1] spi: master driver to enable RTC on ICPDAS LP-8841
Date: Mon, 22 Feb 2016 12:10:27 +0900	[thread overview]
Message-ID: <20160222031027.GP18327@sirena.org.uk> (raw)
In-Reply-To: <1456105630-28914-1-git-send-email-ynvich-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1968 bytes --]

On Mon, Feb 22, 2016 at 04:47:06AM +0300, Sergei Ianovich wrote:
> ICP DAS LP-8841 contains a DS-1302 RTC. This driver provides an SPI
> master which makes the RTC usable. The driver is not supposed to work
> with anything else.

So this is something that is internal to a single chip or something?
I'm slightly unclear from the above if this is or is not a SPI
controller.  If it isn't generic the DT should probably just describe
the IP and let the driver create the SPI controller and device if that
is an expedient way of doing things.

> +spi0@901c {
> +	#address-cells = <1>;
> +	#size-cells = <0>;
> +	compatible = "icpdas,spi-lp8841-rtc";
> +	reg = <0x901c 0x1>;
> +
> +	rtc@0 {
> +		compatible = "maxim,rtc-ds1302";
> +		reg = <0>;
> +		spi-max-frequency = <500000>;
> +		spi-3wire;
> +		spi-lsb-first;
> +		spi-cs-high;
> +	};
> +};

This example makes it seem like an actual SPI controller but just one
that's broken/limited?

> +config SPI_LP8841_RTC
> +	tristate "ICP DAS LP-8841 SPI Controller for RTC"
> +	depends on OF && (MACH_PXA27X_DT || COMPILE_TEST)

Does this need a strict DT dependency or can it build without DT?

> +/*
> + * REVISIT If there is support for SPI_3WIRE and SPI_LSB_FIRST in SPI
> + * GPIO driver, this SPI driver can be replaced by a simple GPIO driver
> + * providing 3 GPIO pins.
> + */

What's the advantage of not doing that?  Overall the driver looks fairly
good but it does seem to just implement a straight bitbanging driver
with less flexibility.

> +#ifndef DRIVER_NAME
> +#define DRIVER_NAME	"spi_lp8841_rtc"
> +#endif

If you want to use a define for this just use a define for it, don't do
this ifdef stuff.

> +static inline void
> +spidelay(unsigned usec)
> +{
> +	usleep_range(usec, usec + 1);
> +}

Just use usleep_range() directly.

> +static void
> +spi_lp8841_rtc_cleanup(struct spi_device *spi)
> +{
> +}

Remove empty functions, if they can be empty the core will support
ignoring them if they are missing.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  parent reply	other threads:[~2016-02-22  3:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-22  1:47 [PATCH v1] spi: master driver to enable RTC on ICPDAS LP-8841 Sergei Ianovich
     [not found] ` <1456105630-28914-1-git-send-email-ynvich-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-02-22  3:10   ` Mark Brown [this message]
2016-02-22  9:26     ` Sergei Ianovich
     [not found]       ` <1456133174.2386.33.camel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-02-22 11:08         ` Mark Brown
2016-02-22 17:55   ` Rob Herring
2016-02-23 10:44   ` [PATCH v4] " Sergei Ianovich
2016-02-24  4:09     ` Mark Brown
     [not found]     ` <1456224272-4391-1-git-send-email-ynvich-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-02-23 23:28       ` Rob Herring
2016-02-24  4:15       ` Applied "spi: master driver to enable RTC on ICPDAS LP-8841" to the spi tree Mark Brown
2016-02-22  9:40 ` [PATCH v2] spi: master driver to enable RTC on ICPDAS LP-8841 Sergei Ianovich
     [not found]   ` <1456134057-9824-1-git-send-email-ynvich-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-02-22 10:39     ` Mark Brown
2016-02-22 11:57 ` [PATCH v3] " Sergei Ianovich
     [not found]   ` <1456142265-12925-1-git-send-email-ynvich-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-02-22 21:27     ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160222031027.GP18327@sirena.org.uk \
    --to=broonie-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=ynvich-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).