Skip to content

Commit 2800777

Browse files
committed
remove local tracking of never_reset in all common-hal/busio/SPI.c
1 parent 6b458a9 commit 2800777

File tree

9 files changed

+1
-28
lines changed
  • ports
    • analog/common-hal/busio
    • broadcom/common-hal/busio
    • espressif
    • mimxrt10xx/common-hal/busio
    • nordic/common-hal/busio
    • raspberrypi/common-hal/busio
    • silabs/common-hal/busio
    • stm/common-hal/busio

9 files changed

+1
-28
lines changed

ports/analog/common-hal/busio/SPI.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
typedef enum {
4343
SPI_FREE = 0,
4444
SPI_BUSY,
45-
SPI_NEVER_RESET,
4645
} spi_status_t;
4746

4847
// Set each bit to indicate an active SPI
@@ -121,8 +120,6 @@ void common_hal_busio_spi_never_reset(busio_spi_obj_t *self) {
121120
common_hal_never_reset_pin(self->miso);
122121
common_hal_never_reset_pin(self->sck);
123122
common_hal_never_reset_pin(self->nss);
124-
125-
spi_status[self->spi_id] = SPI_NEVER_RESET;
126123
}
127124

128125
// Check SPI status, deinited or not

ports/broadcom/common-hal/busio/SPI.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ static SPI0_Type *spi[NUM_SPI] = {SPI0, NULL, NULL};
3030
static SPI1_Type *aux_spi[NUM_SPI] = {NULL, SPI1, SPI2};
3131
#endif
3232

33-
static bool never_reset_spi[NUM_SPI];
3433
static bool spi_in_use[NUM_SPI];
3534

3635
void common_hal_busio_spi_construct(busio_spi_obj_t *self,
@@ -99,8 +98,6 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
9998
}
10099

101100
void common_hal_busio_spi_never_reset(busio_spi_obj_t *self) {
102-
never_reset_spi[self->index] = true;
103-
104101
common_hal_never_reset_pin(self->clock);
105102
common_hal_never_reset_pin(self->MOSI);
106103
common_hal_never_reset_pin(self->MISO);
@@ -118,7 +115,6 @@ void common_hal_busio_spi_deinit(busio_spi_obj_t *self) {
118115
if (common_hal_busio_spi_deinited(self)) {
119116
return;
120117
}
121-
never_reset_spi[self->index] = false;
122118

123119
common_hal_reset_pin(self->clock);
124120
common_hal_reset_pin(self->MOSI);

ports/espressif/common-hal/busio/SPI.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#define SPI_MAX_DMA_BITS (SPI_MAX_DMA_LEN * 8)
1717
#define MAX_SPI_TRANSACTIONS 10
1818

19-
static bool spi_never_reset[SOC_SPI_PERIPH_NUM];
2019
static spi_device_handle_t spi_handle[SOC_SPI_PERIPH_NUM];
2120

2221
static bool spi_bus_is_free(spi_host_device_t host_id) {
@@ -107,7 +106,6 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
107106
}
108107

109108
void common_hal_busio_spi_never_reset(busio_spi_obj_t *self) {
110-
spi_never_reset[self->host_id] = true;
111109
common_hal_never_reset_pin(self->clock);
112110
if (self->MOSI != NULL) {
113111
common_hal_never_reset_pin(self->MOSI);
@@ -139,7 +137,6 @@ void common_hal_busio_spi_deinit(busio_spi_obj_t *self) {
139137
common_hal_reset_pin(self->clock);
140138
common_hal_busio_spi_mark_deinit(self);
141139

142-
spi_never_reset[self->host_id] = false;
143140
spi_bus_remove_device(spi_handle[self->host_id]);
144141
spi_bus_free(self->host_id);
145142

ports/espressif/supervisor/port.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ void reset_to_bootloader(void) {
414414
}
415415

416416
void reset_cpu(void) {
417-
#if CIRCUITPY_DEBUG || 1
417+
#if CIRCUITPY_DEBUG
418418
esp_backtrace_print(100);
419419
#endif
420420
esp_restart();

ports/mimxrt10xx/common-hal/busio/SPI.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
// arrays use 0 based numbering: SPI1 is stored at index 0
2828
static bool reserved_spi[MP_ARRAY_SIZE(mcu_spi_banks)];
29-
static bool never_reset_spi[MP_ARRAY_SIZE(mcu_spi_banks)];
3029

3130
#if IMXRT11XX
3231
static const clock_ip_name_t s_lpspiClocks[] = LPSPI_CLOCKS;
@@ -187,7 +186,6 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
187186
}
188187

189188
void common_hal_busio_spi_never_reset(busio_spi_obj_t *self) {
190-
never_reset_spi[self->clock->bank_idx - 1] = true;
191189
common_hal_never_reset_pin(self->clock->pin);
192190
if (self->mosi != NULL) {
193191
common_hal_never_reset_pin(self->mosi->pin);
@@ -211,7 +209,6 @@ void common_hal_busio_spi_deinit(busio_spi_obj_t *self) {
211209
}
212210
LPSPI_Deinit(self->spi);
213211
reserved_spi[self->clock->bank_idx - 1] = false;
214-
never_reset_spi[self->clock->bank_idx - 1] = false;
215212

216213
common_hal_reset_pin(self->clock->pin);
217214
common_hal_reset_pin(self->mosi->pin);

ports/nordic/common-hal/busio/SPI.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,13 @@ static const spim_peripheral_t spim_peripherals[] = {
5959
#endif
6060
};
6161

62-
static bool never_reset[MP_ARRAY_SIZE(spim_peripherals)];
63-
6462
// Separate RAM area for SPIM3 transmit buffer to avoid SPIM3 hardware errata.
6563
// https://infocenter.nordicsemi.com/index.jsp?topic=%2Ferrata_nRF52840_Rev2%2FERR%2FnRF52840%2FRev2%2Flatest%2Fanomaly_840_198.html
6664
static uint8_t *spim3_transmit_buffer = (uint8_t *)SPIM3_BUFFER_RAM_START_ADDR;
6765

6866
void common_hal_busio_spi_never_reset(busio_spi_obj_t *self) {
6967
for (size_t i = 0; i < MP_ARRAY_SIZE(spim_peripherals); i++) {
7068
if (self->spim_peripheral == &spim_peripherals[i]) {
71-
never_reset[i] = true;
72-
7369
never_reset_pin_number(self->clock_pin_number);
7470
never_reset_pin_number(self->MOSI_pin_number);
7571
never_reset_pin_number(self->MISO_pin_number);

ports/raspberrypi/common-hal/busio/SPI.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919

2020
#define NO_INSTANCE 0xff
2121

22-
static bool never_reset_spi[2];
23-
2422
void common_hal_busio_spi_construct(busio_spi_obj_t *self,
2523
const mcu_pin_obj_t *clock, const mcu_pin_obj_t *mosi,
2624
const mcu_pin_obj_t *miso, bool half_duplex) {
@@ -88,8 +86,6 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
8886
}
8987

9088
void common_hal_busio_spi_never_reset(busio_spi_obj_t *self) {
91-
never_reset_spi[spi_get_index(self->peripheral)] = true;
92-
9389
common_hal_never_reset_pin(self->clock);
9490
common_hal_never_reset_pin(self->MOSI);
9591
common_hal_never_reset_pin(self->MISO);
@@ -107,7 +103,6 @@ void common_hal_busio_spi_deinit(busio_spi_obj_t *self) {
107103
if (common_hal_busio_spi_deinited(self)) {
108104
return;
109105
}
110-
never_reset_spi[spi_get_index(self->peripheral)] = false;
111106
spi_deinit(self->peripheral);
112107

113108
common_hal_reset_pin(self->clock);

ports/silabs/common-hal/busio/SPI.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
static SPIDRV_HandleData_t spidrv_eusart_handle;
3838
static SPIDRV_Init_t spidrv_eusart_init = SPIDRV_MASTER_EUSART1;
3939
static bool in_used = false;
40-
static bool never_reset = false;
4140

4241
// Construct SPI protocol, this function init SPI peripheral
4342
void common_hal_busio_spi_construct(busio_spi_obj_t *self,
@@ -102,7 +101,6 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
102101

103102
// Never reset SPI when reload
104103
void common_hal_busio_spi_never_reset(busio_spi_obj_t *self) {
105-
never_reset = true;
106104
common_hal_never_reset_pin(self->mosi);
107105
common_hal_never_reset_pin(self->miso);
108106
common_hal_never_reset_pin(self->sck);

ports/stm/common-hal/busio/SPI.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#define MAX_SPI 6
2020

2121
static bool reserved_spi[MAX_SPI];
22-
static bool never_reset_spi[MAX_SPI];
2322

2423
#define ALL_CLOCKS 0xFF
2524
static void spi_clock_enable(uint8_t mask);
@@ -215,7 +214,6 @@ void common_hal_busio_spi_construct(busio_spi_obj_t *self,
215214

216215
void common_hal_busio_spi_never_reset(busio_spi_obj_t *self) {
217216

218-
never_reset_spi[self->sck->periph_index - 1] = true;
219217
never_reset_pin_number(self->sck->pin->port, self->sck->pin->number);
220218
if (self->mosi != NULL) {
221219
never_reset_pin_number(self->mosi->pin->port, self->mosi->pin->number);
@@ -239,7 +237,6 @@ void common_hal_busio_spi_deinit(busio_spi_obj_t *self) {
239237
}
240238
spi_clock_disable(1 << (self->sck->periph_index - 1));
241239
reserved_spi[self->sck->periph_index - 1] = false;
242-
never_reset_spi[self->sck->periph_index - 1] = false;
243240

244241
reset_pin_number(self->sck->pin->port, self->sck->pin->number);
245242
if (self->mosi != NULL) {

0 commit comments

Comments
 (0)