Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144523162
D8614.1775198394.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D8614.1775198394.diff
View Options
Index: head/sys/arm/at91/at91_spi.c
===================================================================
--- head/sys/arm/at91/at91_spi.c
+++ head/sys/arm/at91/at91_spi.c
@@ -301,6 +301,8 @@
/* get the proper chip select */
spibus_get_cs(child, &cs);
+ cs &= ~SPIBUS_CS_HIGH;
+
sc = device_get_softc(dev);
i = 0;
Index: head/sys/arm/broadcom/bcm2835/bcm2835_spi.c
===================================================================
--- head/sys/arm/broadcom/bcm2835/bcm2835_spi.c
+++ head/sys/arm/broadcom/bcm2835/bcm2835_spi.c
@@ -433,6 +433,9 @@
/* Get the proper chip select for this child. */
spibus_get_cs(child, &cs);
+
+ cs &= ~SPIBUS_CS_HIGH;
+
if (cs > 2) {
device_printf(dev,
"Invalid chip select %d requested by %s\n", cs,
Index: head/sys/arm/freescale/vybrid/vf_spi.c
===================================================================
--- head/sys/arm/freescale/vybrid/vf_spi.c
+++ head/sys/arm/freescale/vybrid/vf_spi.c
@@ -262,6 +262,8 @@
/* get the proper chip select */
spibus_get_cs(child, &cs);
+ cs &= ~SPIBUS_CS_HIGH;
+
/* Command */
spi_txrx(sc, cmd->tx_cmd, cmd->rx_cmd, cmd->tx_cmd_sz, cs);
Index: head/sys/arm/lpc/lpc_spi.c
===================================================================
--- head/sys/arm/lpc/lpc_spi.c
+++ head/sys/arm/lpc/lpc_spi.c
@@ -147,6 +147,8 @@
spibus_get_cs(child, &cs);
+ cs &= ~SPIBUS_CS_HIGH;
+
/* Set CS active */
lpc_gpio_set_state(child, cs, 0);
Index: head/sys/arm/samsung/exynos/exynos5_spi.c
===================================================================
--- head/sys/arm/samsung/exynos/exynos5_spi.c
+++ head/sys/arm/samsung/exynos/exynos5_spi.c
@@ -204,6 +204,8 @@
/* get the proper chip select */
spibus_get_cs(child, &cs);
+ cs &= ~SPIBUS_CS_HIGH;
+
/* Command */
spi_txrx(sc, cmd->tx_cmd, cmd->rx_cmd, cmd->tx_cmd_sz, cs);
Index: head/sys/arm/ti/ti_spi.c
===================================================================
--- head/sys/arm/ti/ti_spi.c
+++ head/sys/arm/ti/ti_spi.c
@@ -457,6 +457,9 @@
/* Get the proper chip select for this child. */
spibus_get_cs(child, &cs);
+
+ cs &= ~SPIBUS_CS_HIGH;
+
if (cs > sc->sc_numcs) {
device_printf(dev, "Invalid chip select %d requested by %s\n",
cs, device_get_nameunit(child));
Index: head/sys/dev/spibus/ofw_spibus.c
===================================================================
--- head/sys/dev/spibus/ofw_spibus.c
+++ head/sys/dev/spibus/ofw_spibus.c
@@ -80,6 +80,7 @@
phandle_t child;
pcell_t clock, paddr;
device_t childdev;
+ uint32_t mode = SPIBUS_MODE_NONE;
sc->dev = dev;
@@ -103,6 +104,24 @@
}
/*
+ * Try to get the cpol/cpha mode
+ */
+ if (OF_hasprop(child, "spi-cpol"))
+ mode = SPIBUS_MODE_CPOL;
+ if (OF_hasprop(child, "spi-cpha")) {
+ if (mode == SPIBUS_MODE_CPOL)
+ mode = SPIBUS_MODE_CPOL_CPHA;
+ else
+ mode = SPIBUS_MODE_CPHA;
+ }
+
+ /*
+ * Try to get the CS polarity
+ */
+ if (OF_hasprop(child, "spi-cs-high"))
+ paddr |= SPIBUS_CS_HIGH;
+
+ /*
* Get the maximum clock frequency for device, zero means
* use the default bus speed.
*/
@@ -120,6 +139,7 @@
continue;
dinfo->opd_dinfo.cs = paddr;
dinfo->opd_dinfo.clock = clock;
+ dinfo->opd_dinfo.mode = mode;
if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, child) !=
0) {
free(dinfo, M_DEVBUF);
Index: head/sys/dev/spibus/spibusvar.h
===================================================================
--- head/sys/dev/spibus/spibusvar.h
+++ head/sys/dev/spibus/spibusvar.h
@@ -46,6 +46,8 @@
uint32_t clock;
};
+#define SPIBUS_CS_HIGH (1U << 31)
+
enum {
SPIBUS_IVAR_CS, /* chip select that we're on */
SPIBUS_IVAR_MODE, /* SPI mode (0-3) */
Index: head/sys/dev/xilinx/axi_quad_spi.c
===================================================================
--- head/sys/dev/xilinx/axi_quad_spi.c
+++ head/sys/dev/xilinx/axi_quad_spi.c
@@ -193,6 +193,8 @@
/* get the proper chip select */
spibus_get_cs(child, &cs);
+ cs &= ~SPIBUS_CS_HIGH;
+
/* Assert CS */
reg = READ4(sc, SPI_SSR);
reg &= ~(1 << cs);
Index: head/sys/mips/atheros/ar531x/ar5315_spi.c
===================================================================
--- head/sys/mips/atheros/ar531x/ar5315_spi.c
+++ head/sys/mips/atheros/ar531x/ar5315_spi.c
@@ -166,6 +166,8 @@
spibus_get_cs(child, &cs);
+ cs &= ~SPIBUS_CS_HIGH;
+
/* Open SPI controller interface */
ar5315_spi_chip_activate(sc, cs);
Index: head/sys/mips/atheros/ar71xx_spi.c
===================================================================
--- head/sys/mips/atheros/ar71xx_spi.c
+++ head/sys/mips/atheros/ar71xx_spi.c
@@ -212,6 +212,8 @@
spibus_get_cs(child, &cs);
+ cs &= ~SPIBUS_CS_HIGH;
+
ar71xx_spi_chip_activate(sc, cs);
KASSERT(cmd->tx_cmd_sz == cmd->rx_cmd_sz,
Index: head/sys/mips/mediatek/mtk_spi_v1.c
===================================================================
--- head/sys/mips/mediatek/mtk_spi_v1.c
+++ head/sys/mips/mediatek/mtk_spi_v1.c
@@ -231,6 +231,8 @@
spibus_get_cs(child, &cs);
+ cs &= ~SPIBUS_CS_HIGH;
+
if (cs != 0)
/* Only 1 CS */
return (ENXIO);
Index: head/sys/mips/mediatek/mtk_spi_v2.c
===================================================================
--- head/sys/mips/mediatek/mtk_spi_v2.c
+++ head/sys/mips/mediatek/mtk_spi_v2.c
@@ -236,6 +236,8 @@
spibus_get_cs(child, &cs);
+ cs &= ~SPIBUS_CS_HIGH;
+
if (cs != 0)
/* Only 1 CS */
return (ENXIO);
Index: head/sys/mips/rt305x/rt305x_spi.c
===================================================================
--- head/sys/mips/rt305x/rt305x_spi.c
+++ head/sys/mips/rt305x/rt305x_spi.c
@@ -226,6 +226,8 @@
spibus_get_cs(child, &cs);
+ cs &= ~SPIBUS_CS_HIGH;
+
if (cs != 0)
/* Only 1 CS */
return (ENXIO);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 3, 6:39 AM (11 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28251414
Default Alt Text
D8614.1775198394.diff (5 KB)
Attached To
Mode
D8614: ofw_spibus Parse spi-cpol, spi-cpha and spi-cs-high
Attached
Detach File
Event Timeline
Log In to Comment