linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: ben-linux@fluff.org (Ben Dooks)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/5] SPI S3C64XX: Header for passing platform data
Date: Thu, 3 Dec 2009 22:06:37 +0000	[thread overview]
Message-ID: <20091203220637.GR4808@trinity.fluff.org> (raw)
In-Reply-To: <1259218097-9845-1-git-send-email-jassi.brar@samsung.com>

On Thu, Nov 26, 2009 at 03:48:17PM +0900, Jassi Brar wrote:
> We need a way to pass controller specific information to the
> SPI device driver. For that purpose a new header is made.
> 
> Signed-off-by: Jassi Brar <jassi.brar@samsung.com>
> ---
>  arch/arm/plat-s3c64xx/include/plat/spi.h |   68 ++++++++++++++++++++++++++++++
>  1 files changed, 68 insertions(+), 0 deletions(-)
>  create mode 100644 arch/arm/plat-s3c64xx/include/plat/spi.h
> 
> diff --git a/arch/arm/plat-s3c64xx/include/plat/spi.h b/arch/arm/plat-s3c64xx/include/plat/spi.h
> new file mode 100644
> index 0000000..d65ddfd
> --- /dev/null
> +++ b/arch/arm/plat-s3c64xx/include/plat/spi.h

let's not have all these called spi.h, it will make life more difficult
when trying to find which spi.h we are searching for in our platform
support.

> @@ -0,0 +1,68 @@
> +/* linux/arch/arm/plat-s3c64xx/include/plat/spi.h
> + *
> + * Copyright (C) 2009 Samsung Electronics Ltd.
> + *	Jaswinder Singh <jassi.brar@samsung.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#ifndef __S3C64XX_PLAT_SPI_H
> +#define __S3C64XX_PLAT_SPI_H __FILE__
> +
> +#define S3C64XX_SPI_SRCCLK_PCLK		0
> +#define S3C64XX_SPI_SRCCLK_SPIBUS	1
> +#define S3C64XX_SPI_SRCCLK_48M		2
> +
> +#define BUSNUM(b)		(b)
> +
> +/**
> + * struct s3c64xx_spi_csinfo - ChipSelect description
> + * @fb_delay: Slave specific feedback delay.
> + * @set_level: CS line control.
> + */
> +struct s3c64xx_spi_csinfo {
> +	u8 fb_delay;
> +	void (*set_level)(int lvl);
> +};

I think set_level should be called 'set_cs' to make it clearer what is
being done here.

> +/**
> + * struct s3c64xx_spi_cntrlr_info - SPI Controller defining structure
> + * @src_clk_nr: Clock source index for the CLK_CFG[SPI_CLKSEL] field.
> + * @src_clk_name: Platform name of the corresponding clock.
> + * @src_clk: Pointer to the source clock.
> + * @num_cs: Number of CS this controller emulates.
> + * @cs: Array describing each CS.
> + * @cfg_gpio: Configure pins for this SPI controller.
> + * @fifo_lvl_mask: All tx fifo_lvl fields start at offset-6
> + * @rx_lvl_offset: Depends on tx fifo_lvl field and bus number
> + * @high_speed: If the controller supports HIGH_SPEED_EN bit
> + */
> +struct s3c64xx_spi_cntrlr_info {

how about not bothering with the _cntrlr_ here and just call it
s3c64xx_spi_info instead?

> +	int src_clk_nr;
> +	char *src_clk_name;
> +	struct clk *src_clk;

do not pass 'struct clk *' in via platform data.

> +	int num_cs;
> +	struct s3c64xx_spi_csinfo *cs;
> +
> +	int (*cfg_gpio)(struct platform_device *pdev);
> +
> +	/* Following two fields are for future compatibility */
> +	int fifo_lvl_mask;
> +	int rx_lvl_offset;
> +	int high_speed;
> +};

I was wondering if a single 'set_cs' callback here would be in order,
given each spi device can already hold a chip-select number for use
with such callbacks, so:

void (*set_cs)(struct s3c64xx_spi_cntrlr_info *us, struct spi_device *sel, int to);

> +/**
> + * s3c64xx_spi_set_info - SPI Controller configure callback by the board
> + *				initialization code.
> + * @cntrlr: SPI controller number the configuration is for.
> + * @src_clk_nr: Clock the SPI controller is to use to generate SPI clocks.
> + * @cs: Pointer to the array of CS descriptions.
> + * @num_cs: Number of elements in the 'cs' array.
> + */
> +extern void s3c64xx_spi_set_info(int cntrlr, int src_clk_nr, int num_cs);
> +
> +#endif /* __S3C64XX_PLAT_SPI_H */
> -- 
> 1.6.2.5
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

-- 
-- 
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.

  reply	other threads:[~2009-12-03 22:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-26  6:48 [PATCH 3/5] SPI S3C64XX: Header for passing platform data Jassi Brar
2009-12-03 22:06 ` Ben Dooks [this message]
2009-12-04 11:06   ` jassi brar
2009-12-07 14:41     ` Ben Dooks
2009-12-09  1:50       ` jassi brar
2009-12-09 12:16         ` Mark Brown
2009-12-09 12:31           ` jassi brar

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=20091203220637.GR4808@trinity.fluff.org \
    --to=ben-linux@fluff.org \
    --cc=linux-arm-kernel@lists.infradead.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).