* [RFC][PATCH 1/3] spi: let master a chance to setup device before registering it
@ 2011-08-29 12:25 Paul Fertser
2011-08-29 12:39 ` [RFC][PATCH 2/3] spi: enfore default bits_per_word value Paul Fertser
2011-08-30 5:39 ` [RFC][PATCH 3/3] spi: indicate in the docs that per-transfer bpw setting is not supported Paul Fertser
0 siblings, 2 replies; 3+ messages in thread
From: Paul Fertser @ 2011-08-29 12:25 UTC (permalink / raw)
To: barebox
Call setup() before registering the device because registering leads
to a probe routine of the slave device and that requires an
initialised master.
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
---
TBH, i do not fully understand the framework, so this and the following patches
might be rather wrong. But the issues i tried to fix were real indeed :)
drivers/spi/spi.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index b561f9d..82393ea 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -80,7 +80,6 @@ struct spi_device *spi_new_device(struct spi_master *master,
strcpy(proxy->dev.name, chip->name);
proxy->dev.type_data = proxy;
dev_add_child(master->dev, &proxy->dev);
- status = register_device(&proxy->dev);
/* drivers may modify this initial i/o setup */
status = master->setup(proxy);
@@ -90,10 +89,10 @@ struct spi_device *spi_new_device(struct spi_master *master,
goto fail;
}
- return proxy;
+ register_device(&proxy->dev);
+ return proxy;
fail:
- unregister_device(&proxy->dev);
free(proxy);
return NULL;
}
--
1.5.2.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* [RFC][PATCH 2/3] spi: enfore default bits_per_word value
2011-08-29 12:25 [RFC][PATCH 1/3] spi: let master a chance to setup device before registering it Paul Fertser
@ 2011-08-29 12:39 ` Paul Fertser
2011-08-30 5:39 ` [RFC][PATCH 3/3] spi: indicate in the docs that per-transfer bpw setting is not supported Paul Fertser
1 sibling, 0 replies; 3+ messages in thread
From: Paul Fertser @ 2011-08-29 12:39 UTC (permalink / raw)
To: barebox
Documentation says it should default to 8 when not specified
explicitly by the device data.
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
---
drivers/spi/spi.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 82393ea..7a8aed4 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -75,7 +75,7 @@ struct spi_device *spi_new_device(struct spi_master *master,
proxy->chip_select = chip->chip_select;
proxy->max_speed_hz = chip->max_speed_hz;
proxy->mode = chip->mode;
- proxy->bits_per_word = chip->bits_per_word;
+ proxy->bits_per_word = chip->bits_per_word ? chip->bits_per_word : 8;
proxy->dev.platform_data = chip->platform_data;
strcpy(proxy->dev.name, chip->name);
proxy->dev.type_data = proxy;
--
1.5.2.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* [RFC][PATCH 3/3] spi: indicate in the docs that per-transfer bpw setting is not supported
2011-08-29 12:25 [RFC][PATCH 1/3] spi: let master a chance to setup device before registering it Paul Fertser
2011-08-29 12:39 ` [RFC][PATCH 2/3] spi: enfore default bits_per_word value Paul Fertser
@ 2011-08-30 5:39 ` Paul Fertser
1 sibling, 0 replies; 3+ messages in thread
From: Paul Fertser @ 2011-08-30 5:39 UTC (permalink / raw)
To: barebox
Currently it's not implemented by any driver so add a note to the
documentation.
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
---
include/spi/spi.h | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/include/spi/spi.h b/include/spi/spi.h
index 948e050..9d01d06 100644
--- a/include/spi/spi.h
+++ b/include/spi/spi.h
@@ -37,7 +37,8 @@ struct spi_board_info {
* powers of two bytes (e.g. 20 bit samples use 32 bits).
* This may be changed by the device's driver, or left at the
* default (0) indicating protocol words are eight bit bytes.
- * The spi_transfer.bits_per_word can override this for each transfer.
+ * The spi_transfer.bits_per_word can override this for each transfer
+ * (FIXME: not currently implemented).
* @irq: Negative, or the number passed to request_irq() to receive
* interrupts from this device.
* @controller_state: Controller's runtime state
--
1.5.2.2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-08-30 5:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-29 12:25 [RFC][PATCH 1/3] spi: let master a chance to setup device before registering it Paul Fertser
2011-08-29 12:39 ` [RFC][PATCH 2/3] spi: enfore default bits_per_word value Paul Fertser
2011-08-30 5:39 ` [RFC][PATCH 3/3] spi: indicate in the docs that per-transfer bpw setting is not supported Paul Fertser
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox