From 76034aa4ad8bbae40bebed08d62032a385b530cf Mon Sep 17 00:00:00 2001 From: baiywt Date: Fri, 10 Jan 2020 09:14:40 +0000 Subject: [PATCH] fix some problem for OrangePi 4 --- gpio/OrangePi.c | 4 ++-- wiringPi/OrangePi.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gpio/OrangePi.c b/gpio/OrangePi.c index f641437..fd0bbca 100755 --- a/gpio/OrangePi.c +++ b/gpio/OrangePi.c @@ -690,11 +690,11 @@ char *physNames[64] = " 3.3v", "GPIO1_C7", "SPI1_TXD", "0v ", "SPI1_RXD", "GPIO1_D0", - "SPI1_CLK", "SPI1_CSn0", + "SPI1_CLK", "SPI1_CS ", " 0v", "GPIO4_C5", "I2C2_SDA", "I2C2_SCL", " I2S0_RX", "0v ", - " I2S0_TX", "I2S_CLK", + " I2S0_TX", "I2S_CLK ", "I2S0_SCK", "0v ", "I2S0_SI0", "I2S0_SO0", "I2S0_SI1", "I2S0_SI2", diff --git a/wiringPi/OrangePi.c b/wiringPi/OrangePi.c index b7ec3d7..03ce106 100755 --- a/wiringPi/OrangePi.c +++ b/wiringPi/OrangePi.c @@ -1378,8 +1378,8 @@ int OrangePi_set_gpio_mode(int pin, int mode) #elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4) writeR(0xffff0180, cru_phyaddr); regval = readR(grf_phyaddr); - regval |= 0xffff << 16; - regval &= ~(0x3) << (offset << 1); + regval |= 0x3 << ((offset << 1) | 0x10); + regval &= ~(0x3 << (offset << 1)); writeR(regval, grf_phyaddr); regval = readR(gpio_phyaddr); regval &= ~(1 << index); @@ -1403,8 +1403,8 @@ int OrangePi_set_gpio_mode(int pin, int mode) #elif (defined CONFIG_ORANGEPI_RK3399 || defined CONFIG_ORANGEPI_4) writeR(0xffff0180, cru_phyaddr); regval = readR(grf_phyaddr); - regval |= 0xffff << 16; - regval &= ~(0x3) << (offset << 1); + regval |= 0x3 << ((offset << 1) | 0x10); + regval &= ~(0x3 << (offset << 1)); writeR(regval, grf_phyaddr); regval = readR(gpio_phyaddr); regval |= 1 << index;