All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 3/8] sandbox: gpio: Add basic driver for simulating GPIOs
Date: Fri, 20 Jan 2012 13:59:20 -0500	[thread overview]
Message-ID: <201201201359.21521.vapier@gentoo.org> (raw)
In-Reply-To: <1326242752-9981-3-git-send-email-sjg@chromium.org>

On Tuesday 10 January 2012 19:45:47 Simon Glass wrote:
> This provides a way of simulating GPIOs by setting values which are seen
> by the normal gpio_get/set_value() calls.

seems to be a desync in types ... all "gpio" fields should be "unsigned" and 
not "int"

> --- /dev/null
> +++ b/arch/sandbox/include/asm/gpio.h
>
> +int sandbox_gpio_get_value(int gp);

why bother with parallel sandbox gpio API ?  why can't we just implement the 
gpio API directly and throw away sandbox_gpio_xxx ?  then we can also stub out 
sandbox/include/asm/gpio.h ...

also, missing gpio_status() define to gpio_info()

> --- /dev/null
> +++ b/drivers/gpio/sandbox.c
>
> +enum {
> +	CMD_INFO,
> +	CMD_PORT,
> +	CMD_OUTPUT,
> +	CMD_INPUT,
> +};

CMD_XXX enums are unused -> punt

> +enum {
> +	GPIOF_OUTPUT	= 1 << 1,
> +	GPIOF_HIGH	= 1 << 2,
> +};

turn enum bit flags into defines

also, add a "reserved" bit flag and check it in gpio_request()

> +/* read GPIO IN value of port 'gp' */
> +int gpio_get_value(int gp)
> ...
> +	if (get_gpio_flag(gp, GPIOF_OUTPUT))
> ...
> +int gpio_set_value(int gp, int value)
> ...
> +	if (get_gpio_flag(gp, GPIOF_OUTPUT)) {

drop valid gpio checking in these funcs ... only the request func should do 
this

> +int gpio_request(unsigned gpio, const char *label)
> +{
> +	/* for now, do nothing */
> +	return 0;
> +}

add (gpio <= CONFIG_SANDBOX_GPIO_COUNT) check to verify the gpio is valid

> +int gpio_info(int gp)
> +{
> +	printf("Sandbox GPIOs\n");
> +	return 0;
> +}

implement it ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120120/5fba4e7f/attachment.pgp>

  reply	other threads:[~2012-01-20 18:59 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-11  0:45 [U-Boot] [PATCH v2 1/8] sandbox: fdt: Add support for CONFIG_OF_CONTROL Simon Glass
2012-01-11  0:45 ` [U-Boot] [PATCH v2 2/8] sandbox: config: Enable fdt and snprintf() options Simon Glass
2012-01-20 18:54   ` Mike Frysinger
2012-01-23  5:30     ` Simon Glass
2012-01-24 21:24       ` Mike Frysinger
2012-02-15  6:26         ` Simon Glass
2012-02-21  5:24           ` Mike Frysinger
2012-02-21  5:37             ` Simon Glass
2012-02-21  6:12               ` Mike Frysinger
2012-01-11  0:45 ` [U-Boot] [PATCH v2 3/8] sandbox: gpio: Add basic driver for simulating GPIOs Simon Glass
2012-01-20 18:59   ` Mike Frysinger [this message]
2012-01-23  6:20     ` Simon Glass
2012-01-24 21:35       ` Mike Frysinger
2012-01-24 23:06         ` Mike Frysinger
2012-02-15 22:34           ` Simon Glass
2012-01-11  0:45 ` [U-Boot] [PATCH v2 4/8] sandbox: Enable GPIO driver Simon Glass
2012-01-20 18:59   ` Mike Frysinger
2012-01-23  6:21     ` Simon Glass
2012-01-11  0:45 ` [U-Boot] [PATCH v2 5/8] sandbox: Add concept of sandbox state Simon Glass
2012-01-11  0:45 ` [U-Boot] [PATCH v2 6/8] sandbox: Allow processing instead of or before main loop Simon Glass
2012-01-20 19:00   ` Mike Frysinger
2012-01-23  6:25     ` Simon Glass
2012-01-11  0:45 ` [U-Boot] [PATCH v2 7/8] sandbox: Add flags for open() call Simon Glass
2012-01-15  4:19   ` Mike Frysinger
2012-01-15  4:36     ` Simon Glass
2012-01-15  4:44       ` Mike Frysinger
2012-01-15  4:48         ` Simon Glass
2012-01-11  0:45 ` [U-Boot] [PATCH v2 8/8] sandbox: Add basic command line parsing Simon Glass
2012-01-20 19:05   ` Mike Frysinger
2012-01-23  6:30     ` Simon Glass
2012-01-24 21:36       ` Mike Frysinger
2012-01-20 18:54 ` [U-Boot] [PATCH v2 1/8] sandbox: fdt: Add support for CONFIG_OF_CONTROL Mike Frysinger
2012-01-23  5:27   ` Simon Glass
2012-01-23  7:32     ` Mike Frysinger
2012-02-15  6:11       ` Simon Glass

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=201201201359.21521.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.