Skip to contentSkip to conversation

spi/sun6i: Add Master Sample Data Mode for SPI

PATCH New Vinicius Maciel 3 participants 4 messages Feb 13, 2017 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi/sun6i: Add Master Sample Data Mode for SPI

In order to work appropriately, some SPI chips, such as max11043, require SPI master samples the data at the correct edge.

This patch add Master Sample Data Mode bit in normal sample mode.

---
 drivers/spi/spi-sun6i.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/spi/spi-sun6i.c +3 -0
index e3114832c485..170f4ad407dd 100644
@@ -43,6 +43,7 @@
 #define SUN6I_TFR_CTL_CS_LEVEL			BIT(7)
 #define SUN6I_TFR_CTL_DHB			BIT(8)
 #define SUN6I_TFR_CTL_FBS			BIT(12)
+#define SUN6I_TFR_CTL_SDM			BIT(13)
 #define SUN6I_TFR_CTL_XCH			BIT(31)
 
 #define SUN6I_INT_CTL_REG		0x10
@@ -342,6 +343,8 @@ static int sun6i_spi_runtime_resume(struct device *dev)
 
 	sun6i_spi_write(sspi, SUN6I_GBL_CTL_REG,
 			SUN6I_GBL_CTL_BUS_ENABLE | SUN6I_GBL_CTL_MASTER | SUN6I_GBL_CTL_TP);
+        sun6i_spi_write(sspi, SUN6I_TFR_CTL_REG,
+			SUN6I_TFR_CTL_SDM);
 
 	return 0;
 
Signature · 1 line
2.11.0
maintainer
#1 lore raw

PATCH 1/1 spi/sun6i: Add Master Sample Data Mode for SPI

Quoted 3 lines · Vinicius Maciel

In order to work appropriately, some SPI chips, such as max11043, require SPI master samples the data at the correct edge.

As I said on another version of this patch this should really be done by
implementing the SPI modes - there isn't one universal configuration for
SPI devices unfortunately.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170213/ce76abd3/attachment.sig>

A message that is not in the archive (sent off-list or not yet received): 20170213183430.65vbm3cubid2ljkv-GFdadSzt00ze9xe1eoZjHA@public.gmane.org

#3 lore raw

Hi Mark,

Sorry for the mess up. sun6i is a reference to the Allwinner A31 processor and sun7i is a reference to the Allwinner A20 processor. A31 uses spi-sun6i.c code, while A20 uses spi-sun4i.c code. Therefore, this is a different patch.
About your recommedantion, I have to check with Maxine what can be done.

Thanks.

2017-02-13 15:34 GMT-03:00 Mark Brown <[email protected]>:

Quoted 9 lines · Vinicius Maciel
Quoted 3 lines

In order to work appropriately, some SPI chips, such as max11043, require SPI master samples the data at the correct edge.

As I said on another version of this patch this should really be done by implementing the SPI modes - there isn't one universal configuration for SPI devices unfortunately.

Signature · 3 lines
You received this message because you are subscribed to the Google Groups "linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
For more options, visit https://groups.google.com/d/optout.
maintainer
#4 lore raw

PATCH 1/1 spi/sun6i: Add Master Sample Data Mode for SPI

Quoted 1 line · Vinicius Maciel

Hi Mark,

Please don't top post, reply in line with needed context. This allows readers to readily follow the flow of conversation and understand what you are talking about and also helps ensure that everything in the discussion is being addressed.

Quoted 5 lines

Sorry for the mess up. sun6i is a reference to the Allwinner A31 processor and sun7i is a reference to the Allwinner A20 processor. A31 uses spi-sun6i.c code, while A20 uses spi-sun4i.c code. Therefore, this is a different patch.
About your recommedantion, I have to check with Maxine what can be done.

Usually duplicate patches to the two drivers are sent as a series to
make sure it's the same thing being done twice.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170213/64f2edb3/attachment.sig>