Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F152581678
D29534.id86684.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D29534.id86684.diff
View Options
diff --git a/sys/dev/intel/spi.c b/sys/dev/intel/spi.c
--- a/sys/dev/intel/spi.c
+++ b/sys/dev/intel/spi.c
@@ -305,7 +305,7 @@
{
struct intelspi_softc *sc;
int err;
- uint32_t sscr0, sscr1, mode, clock;
+ uint32_t sscr0, sscr1, mode, clock, cs_delay;
bool restart = false;
sc = device_get_softc(dev);
@@ -376,7 +376,9 @@
sc->sc_len = cmd->tx_cmd_sz + cmd->tx_data_sz;
/* Enable CS */
+ spibus_get_cs_delay(child, &cs_delay);
intelspi_set_cs(sc, CS_LOW);
+ DELAY(cs_delay);
/* Transfer as much as possible to FIFOs */
if (!intelspi_transact(sc)) {
/* If FIFO is not large enough - enable interrupts */
@@ -390,6 +392,7 @@
/* de-asser CS */
intelspi_set_cs(sc, CS_HIGH);
+ DELAY(cs_delay);
/* Clear transaction details */
sc->sc_cmd = NULL;
diff --git a/sys/dev/spibus/spibus.c b/sys/dev/spibus/spibus.c
--- a/sys/dev/spibus/spibus.c
+++ b/sys/dev/spibus/spibus.c
@@ -155,6 +155,9 @@
case SPIBUS_IVAR_CLOCK:
*(uint32_t *)result = devi->clock;
break;
+ case SPIBUS_IVAR_CS_DELAY:
+ *(uint32_t *)result = devi->cs_delay;
+ break;
}
return (0);
}
@@ -183,6 +186,9 @@
return (EINVAL);
devi->mode = (uint32_t)value;
break;
+ case SPIBUS_IVAR_CS_DELAY:
+ devi->cs_delay = (uint32_t)value;
+ break;
default:
return (EINVAL);
}
diff --git a/sys/dev/spibus/spibusvar.h b/sys/dev/spibus/spibusvar.h
--- a/sys/dev/spibus/spibusvar.h
+++ b/sys/dev/spibus/spibusvar.h
@@ -43,6 +43,7 @@
uint32_t cs;
uint32_t mode;
uint32_t clock;
+ uint32_t cs_delay;
struct resource_list rl;
};
@@ -52,6 +53,7 @@
SPIBUS_IVAR_CS, /* chip select that we're on */
SPIBUS_IVAR_MODE, /* SPI mode (0-3) */
SPIBUS_IVAR_CLOCK, /* maximum clock freq for device */
+ SPIBUS_IVAR_CS_DELAY, /* delay in microseconds after toggling chip select */
};
#define SPIBUS_ACCESSOR(A, B, T) \
@@ -71,6 +73,7 @@
SPIBUS_ACCESSOR(cs, CS, uint32_t)
SPIBUS_ACCESSOR(mode, MODE, uint32_t)
SPIBUS_ACCESSOR(clock, CLOCK, uint32_t)
+SPIBUS_ACCESSOR(cs_delay, CS_DELAY, uint32_t)
extern driver_t spibus_driver;
extern devclass_t spibus_devclass;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 16, 7:32 PM (20 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31620928
Default Alt Text
D29534.id86684.diff (2 KB)
Attached To
Mode
D29534: spibus: extend API: add cs_delay ivar, KEEP_CS and NO_SLEEP flags
Attached
Detach File
Event Timeline
Log In to Comment