mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
Initialize GPIOs with PIN defines
+ Support in MUX setup (not used thou)
This commit is contained in:
@@ -21,7 +21,7 @@ __code const struct machine machine = {
|
|||||||
.sfp_port[1].pin_tx_disable = GPIO_NA,
|
.sfp_port[1].pin_tx_disable = GPIO_NA,
|
||||||
.sfp_port[1].sds = 0,
|
.sfp_port[1].sds = 0,
|
||||||
.sfp_port[1].i2c = { .sda = GPIO39_I2C_SDA4, .scl = GPIO40_I2C_SCL3_MDC1 },
|
.sfp_port[1].i2c = { .sda = GPIO39_I2C_SDA4, .scl = GPIO40_I2C_SCL3_MDC1 },
|
||||||
.reset_pin = 46,
|
.reset_pin = GPIO46_I2C_SCL0,
|
||||||
};
|
};
|
||||||
#elif defined MACHINE_KP_9000_6XH_X
|
#elif defined MACHINE_KP_9000_6XH_X
|
||||||
__code const struct machine machine = {
|
__code const struct machine machine = {
|
||||||
@@ -38,6 +38,7 @@ __code const struct machine machine = {
|
|||||||
.sfp_port[0].pin_tx_disable = GPIO_NA,
|
.sfp_port[0].pin_tx_disable = GPIO_NA,
|
||||||
.sfp_port[0].sds = 1,
|
.sfp_port[0].sds = 1,
|
||||||
.sfp_port[0].i2c = { .sda = GPIO39_I2C_SDA4, .scl = GPIO40_I2C_SCL3_MDC1 },
|
.sfp_port[0].i2c = { .sda = GPIO39_I2C_SDA4, .scl = GPIO40_I2C_SCL3_MDC1 },
|
||||||
|
.reset_pin = GPIO_NA,
|
||||||
};
|
};
|
||||||
#elif defined MACHINE_KP_9000_9XH_X_EU
|
#elif defined MACHINE_KP_9000_9XH_X_EU
|
||||||
__code const struct machine machine = {
|
__code const struct machine machine = {
|
||||||
@@ -54,6 +55,7 @@ __code const struct machine machine = {
|
|||||||
.sfp_port[0].pin_tx_disable = GPIO_NA,
|
.sfp_port[0].pin_tx_disable = GPIO_NA,
|
||||||
.sfp_port[0].sds = 1,
|
.sfp_port[0].sds = 1,
|
||||||
.sfp_port[0].i2c = { .sda = GPIO39_I2C_SDA4, .scl = GPIO40_I2C_SCL3_MDC1 },
|
.sfp_port[0].i2c = { .sda = GPIO39_I2C_SDA4, .scl = GPIO40_I2C_SCL3_MDC1 },
|
||||||
|
.reset_pin = GPIO_NA,
|
||||||
};
|
};
|
||||||
|
|
||||||
#elif defined MACHINE_SWGT024_V2_0
|
#elif defined MACHINE_SWGT024_V2_0
|
||||||
@@ -78,7 +80,7 @@ __code const struct machine machine = {
|
|||||||
.sfp_port[1].pin_tx_disable = GPIO_NA,
|
.sfp_port[1].pin_tx_disable = GPIO_NA,
|
||||||
.sfp_port[1].sds = 0,
|
.sfp_port[1].sds = 0,
|
||||||
.sfp_port[1].i2c = { .sda = GPIO41_I2C_SDA3_MDIO1, .scl = GPIO40_I2C_SCL3_MDC1 }, /* GPIO 40 */
|
.sfp_port[1].i2c = { .sda = GPIO41_I2C_SDA3_MDIO1, .scl = GPIO40_I2C_SCL3_MDC1 }, /* GPIO 40 */
|
||||||
.reset_pin = 36,
|
.reset_pin = GPIO36_PWM_OUT,
|
||||||
};
|
};
|
||||||
|
|
||||||
#elif defined DEFAULT_8C_1SFP
|
#elif defined DEFAULT_8C_1SFP
|
||||||
@@ -96,5 +98,6 @@ __code const struct machine machine = {
|
|||||||
.sfp_port[0].pin_tx_disable = GPIO_NA,
|
.sfp_port[0].pin_tx_disable = GPIO_NA,
|
||||||
.sfp_port[0].sds = 1,
|
.sfp_port[0].sds = 1,
|
||||||
.sfp_port[0].i2c = { .sda = GPIO39_I2C_SDA4, .scl = GPIO40_I2C_SCL3_MDC1 },
|
.sfp_port[0].i2c = { .sda = GPIO39_I2C_SDA4, .scl = GPIO40_I2C_SCL3_MDC1 },
|
||||||
|
.reset_pin = GPIO_NA,
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -60,8 +60,16 @@ static void gpio_mux_setup(uint8_t pin)
|
|||||||
reg_bit_set(RTL837X_PIN_MUX_1, 30);
|
reg_bit_set(RTL837X_PIN_MUX_1, 30);
|
||||||
break;
|
break;
|
||||||
case GPIO37:
|
case GPIO37:
|
||||||
|
case GPIO38:
|
||||||
// Intentionally empty, always GPIO
|
// Intentionally empty, always GPIO
|
||||||
break;
|
break;
|
||||||
|
case GPIO46_I2C_SCL0:
|
||||||
|
// Bit 7-8 0b00 -> GPIO
|
||||||
|
reg_read_m(RTL837X_PIN_MUX_1);
|
||||||
|
sfr_mask_data(0, 0x80, 0x00);
|
||||||
|
sfr_mask_data(1, 0x01, 0x00);
|
||||||
|
reg_write_m(RTL837X_PIN_MUX_1);
|
||||||
|
break;
|
||||||
case GPIO50_I2C_SCL2_UART1_TX:
|
case GPIO50_I2C_SCL2_UART1_TX:
|
||||||
// Bit 15-16 0b00 -> GPIO
|
// Bit 15-16 0b00 -> GPIO
|
||||||
reg_read_m(RTL837X_PIN_MUX_1);
|
reg_read_m(RTL837X_PIN_MUX_1);
|
||||||
|
|||||||
Reference in New Issue
Block a user