mirror of
https://github.com/sipeed/LicheeRV-Nano-Build.git
synced 2026-11-09 18:04:55 -06:00
add bitbang i2c5 & bitbang spi4
This commit is contained in:
@@ -117,6 +117,10 @@
|
||||
};
|
||||
};
|
||||
|
||||
&spi0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&spi1 {
|
||||
status = "okay";
|
||||
};
|
||||
@@ -125,6 +129,10 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&spi3 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&dac {
|
||||
status = "okay";
|
||||
/delete-property/ mute-gpio-r;
|
||||
@@ -145,6 +153,29 @@
|
||||
/ {
|
||||
model = "LicheeRv Nano";
|
||||
|
||||
spi4: spi4@gpio {
|
||||
compatible = "spi-gpio";
|
||||
sck-gpio = <&porta 22 0>;
|
||||
miso-gpio = <&porta 23 0>;
|
||||
mosi-gpio = <&porta 25 0>;
|
||||
cs-gpio = <&porta 24 0>;
|
||||
num-chipselects = <1>;
|
||||
status = "okay";
|
||||
|
||||
spidev@0 {
|
||||
compatible = "spidev";
|
||||
reg = <0>;
|
||||
};
|
||||
};
|
||||
|
||||
i2c5: i2c5@gpio {
|
||||
compatible = "i2c-gpio";
|
||||
scl-gpios = <&porta 15 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
|
||||
sda-gpios = <&porta 27 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
|
||||
i2c-gpio,delay-us = <5>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
gpio-keys {
|
||||
compatible = "gpio-keys";
|
||||
key-user {
|
||||
|
||||
@@ -120,6 +120,7 @@ CONFIG_I2C=y
|
||||
CONFIG_I2C_CHARDEV=y
|
||||
CONFIG_I2C_MUX=y
|
||||
CONFIG_I2C_DESIGNWARE_PLATFORM=y
|
||||
CONFIG_I2C_GPIO=y
|
||||
# CONFIG_PTP_1588_CLOCK is not set
|
||||
CONFIG_PINCTRL=y
|
||||
CONFIG_CVITEK_PINCTRL_CV1835=y
|
||||
|
||||
@@ -130,6 +130,16 @@ int cvi_board_init(void)
|
||||
mmio_write_32(0x05027078, 0x11);// Unlock PWR_GPIO[3]
|
||||
mmio_write_32(0x0502707c, 0x11);// Unlock PWR_GPIO[4]
|
||||
|
||||
// bitbang i2c
|
||||
mmio_write_32(0x0300103C, 0x03); // GPIOA 15 GPIO_MODE
|
||||
mmio_write_32(0x03001058, 0x03); // GPIOA 27 GPIO_MODE
|
||||
|
||||
// bitbang spi
|
||||
mmio_write_32(0x03001060, 0x03); // GPIOA 24 GPIO_MODE
|
||||
mmio_write_32(0x0300105C, 0x03); // GPIOA 23 GPIO_MODE
|
||||
mmio_write_32(0x03001054, 0x03); // GPIOA 25 GPIO_MODE
|
||||
mmio_write_32(0x03001050, 0x03); // GPIOA 22 GPIO_MODE
|
||||
|
||||
// wait hardware bootup
|
||||
suck_loop(50);
|
||||
user_led_off();
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#define I2C2 "i2c@04020000"
|
||||
#define I2C3 "i2c@04030000"
|
||||
#define I2C4 "i2c@04040000"
|
||||
#define I2C5 "i2c5@gpio"
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -680,6 +681,8 @@ static int i2cdev_attach_adapter(struct device *dev, void *dummy)
|
||||
adap->i2c_idx = 3;
|
||||
if (!strcmp(adap->dev.of_node->full_name, I2C4))
|
||||
adap->i2c_idx = 4;
|
||||
if (!strcmp(adap->dev.of_node->full_name, I2C5))
|
||||
adap->i2c_idx = 5;
|
||||
|
||||
dev_set_name(&i2c_dev->dev, "i2c-%d", adap->i2c_idx);
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user