Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Added i2c and spi1, spi2 to arty bsp #631

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions bsp/freedom-e310-arty/core.dts
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,32 @@
interrupts = <6>;
reg = <0x10014000 0x1000 0x20000000 0x20000000>;
reg-names = "control", "mem";
clocks = <&hfclk>;
#address-cells = <1>;
#size-cells = <1>;
flash@0 {
compatible = "jedec,spi-nor";
reg = <0x20000000 0x7a12000>;
};
};
spi2: spi@10034000 {
compatible = "sifive,spi0";
interrupt-parent = <&plic>;
interrupts = <6>;
reg = <0x10034000 0x1000>;
reg-names = "control";
clocks = <&hfclk>;

};
i2c0: i2c@10016000 {
compatible = "sifive,i2c0";
interrupt-parent = <&plic>;
interrupts = <1>;
reg = <0x10016000 0x1000>;
reg-names = "control";
clocks = <&hfclk>;
};


};
};
48 changes: 46 additions & 2 deletions bsp/freedom-e310-arty/metal-inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,23 @@ extern __inline__ int __metal_driver_sifive_gpio0_interrupt_lines(struct metal_g


/* --------------------- sifive_gpio_led ------------ */

extern __inline__ struct metal_gpio * __metal_driver_sifive_gpio_led_gpio(struct metal_led *led);
extern __inline__ int __metal_driver_sifive_gpio_led_pin(struct metal_led *led);
extern __inline__ char * __metal_driver_sifive_gpio_led_label(struct metal_led *led);

/* --------------------- sifive_gpio_switch ------------ */


/* --------------------- sifive_i2c0 ------------ */

extern __inline__ unsigned long __metal_driver_sifive_i2c0_control_base(struct metal_i2c *i2c);
extern __inline__ unsigned long __metal_driver_sifive_i2c0_control_size(struct metal_i2c *i2c);
extern __inline__ int __metal_driver_sifive_i2c0_num_interrupts(struct metal_i2c *i2c);
extern __inline__ struct metal_interrupt * __metal_driver_sifive_i2c0_interrupt_parent(struct metal_i2c *i2c);
extern __inline__ int __metal_driver_sifive_i2c0_interrupt_line(struct metal_i2c *i2c);
extern __inline__ struct metal_clock * __metal_driver_sifive_i2c0_clock(struct metal_i2c *i2c);
extern __inline__ struct __metal_driver_sifive_gpio0 * __metal_driver_sifive_i2c0_pinmux(struct metal_i2c *i2c);
extern __inline__ unsigned long __metal_driver_sifive_i2c0_pinmux_output_selector(struct metal_i2c *i2c);
extern __inline__ unsigned long __metal_driver_sifive_i2c0_pinmux_source_selector(struct metal_i2c *i2c);

/* --------------------- sifive_prci0 ------------ */

Expand Down Expand Up @@ -231,11 +241,45 @@ struct __metal_driver_sifive_spi0 __metal_dt_spi_10014000 = {
.spi.vtable = &__metal_driver_vtable_sifive_spi0.spi,
};

/* From spi@10024000 */
struct __metal_driver_sifive_spi0 __metal_dt_spi_10024000 = {
.spi.vtable = &__metal_driver_vtable_sifive_spi0.spi,
};

/* From spi@10034000 */
struct __metal_driver_sifive_spi0 __metal_dt_spi_10034000 = {
.spi.vtable = &__metal_driver_vtable_sifive_spi0.spi,
};

/* From serial@10013000 */
struct __metal_driver_sifive_uart0 __metal_dt_serial_10013000 = {
.uart.vtable = &__metal_driver_vtable_sifive_uart0.uart,
};

/* From led@0red */
struct __metal_driver_sifive_gpio_led __metal_dt_led_0red = {
.led.vtable = &__metal_driver_vtable_sifive_led.led_vtable,
};

/* From led@0green */
struct __metal_driver_sifive_gpio_led __metal_dt_led_0green = {
.led.vtable = &__metal_driver_vtable_sifive_led.led_vtable,
};

/* From led@0blue */
struct __metal_driver_sifive_gpio_led __metal_dt_led_0blue = {
.led.vtable = &__metal_driver_vtable_sifive_led.led_vtable,
};

/* From led@0blue */
struct __metal_driver_sifive_gpio_led __metal_dt_led_3 = {
.led.vtable = &__metal_driver_vtable_sifive_led.led_vtable,
};

/* From i2c@10016000 */
struct __metal_driver_sifive_i2c0 __metal_dt_i2c_10016000 = {
.i2c.vtable = &__metal_driver_vtable_sifive_i2c0.i2c,
};

#endif /* METAL_INLINE_H*/
#endif /* ! ASSEMBLY */
66 changes: 51 additions & 15 deletions bsp/freedom-e310-arty/metal-platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,23 +92,35 @@
#define METAL_SIFIVE_SPI0_10014000_SIZE 4096UL
#define METAL_SIFIVE_SPI0_0_SIZE 4096UL

/* From spi@10024000 */
#define METAL_SIFIVE_SPI0_10024000_BASE_ADDRESS 268582912UL
#define METAL_SIFIVE_SPIO0_1_BASE_ADDRESS 268582912UL
#define METAL_SIFIVE_SPI0_10024000_SIZE 4096UL
#define METAL_SIFIVE_SPIO0_1_SIZE 4096UL

/* From spi@10034000 */
#define METAL_SIFIVE_SPI0_10034000_BASE_ADDRESS 268648448UL
#define METAL_SIFIVE_SPIO0_2_BASE_ADDRESS 268648448UL
#define METAL_SIFIVE_SPI0_10034000_SIZE 4096UL
#define METAL_SIFIVE_SPI0_2_SIZE 4096UL

#define METAL_SIFIVE_SPI0
#define METAL_SIFIVE_SPI0_SCKDIV 0UL
#define METAL_SIFIVE_SPI0_SCKMODE 4UL
#define METAL_SIFIVE_SPI0_CSID 16UL
#define METAL_SIFIVE_SPI0_CSDEF 20UL
#define METAL_SIFIVE_SPI0_CSMODE 24UL
#define METAL_SIFIVE_SPI0_DELAY0 40UL
#define METAL_SIFIVE_SPI0_DELAY1 44UL
#define METAL_SIFIVE_SPI0_FMT 64UL
#define METAL_SIFIVE_SPI0_TXDATA 72UL
#define METAL_SIFIVE_SPI0_RXDATA 76UL
#define METAL_SIFIVE_SPI0_TXMARK 80UL
#define METAL_SIFIVE_SPI0_RXMARK 84UL
#define METAL_SIFIVE_SPI0_FCTRL 96UL
#define METAL_SIFIVE_SPI0_FFMT 100UL
#define METAL_SIFIVE_SPI0_IE 112UL
#define METAL_SIFIVE_SPI0_IP 116UL
#define METAL_SIFIVE_SPI0_SCKMODE 4UL //0x04
#define METAL_SIFIVE_SPI0_CSID 16UL //0x10
#define METAL_SIFIVE_SPI0_CSDEF 20UL //0x14
#define METAL_SIFIVE_SPI0_CSMODE 24UL //0x18
#define METAL_SIFIVE_SPI0_DELAY0 40UL //0x28
#define METAL_SIFIVE_SPI0_DELAY1 44UL //0x2C
#define METAL_SIFIVE_SPI0_FMT 64UL //0x40
#define METAL_SIFIVE_SPI0_TXDATA 72UL //0x48
#define METAL_SIFIVE_SPI0_RXDATA 76UL //0x4C
#define METAL_SIFIVE_SPI0_TXMARK 80UL //0x50
#define METAL_SIFIVE_SPI0_RXMARK 84UL //0x54
#define METAL_SIFIVE_SPI0_FCTRL 96UL //0x60
#define METAL_SIFIVE_SPI0_FFMT 100UL //0x64
#define METAL_SIFIVE_SPI0_IE 112UL //0x70
#define METAL_SIFIVE_SPI0_IP 116UL //0x74

/* From serial@10013000 */
#define METAL_SIFIVE_UART0_10013000_BASE_ADDRESS 268513280UL
Expand All @@ -125,4 +137,28 @@
#define METAL_SIFIVE_UART0_IP 20UL
#define METAL_SIFIVE_UART0_DIV 24UL

/* From led@0red */

/* From led@0green */

/* From led@0blue */

#define METAL_SIFIVE_GPIO_LEDS

/* From i2c@10016000 */
#define METAL_SIFIVE_I2C0_10016000_BASE_ADDRESS 268525568UL
#define METAL_SIFIVE_I2C0_0_BASE_ADDRESS 268525568UL
#define METAL_SIFIVE_I2C0_10016000_SIZE 4096UL
#define METAL_SIFIVE_I2C0_0_SIZE 4096UL

#define METAL_SIFIVE_I2C0
#define METAL_SIFIVE_I2C0_PRESCALE_LOW 0UL
#define METAL_SIFIVE_I2C0_PRESCALE_HIGH 4UL
#define METAL_SIFIVE_I2C0_CONTROL 8UL
#define METAL_SIFIVE_I2C0_TRANSMIT 12UL
#define METAL_SIFIVE_I2C0_RECEIVE 12UL
#define METAL_SIFIVE_I2C0_COMMAND 16UL
#define METAL_SIFIVE_I2C0_STATUS 16UL


#endif /* METAL_PLATFORM_H*/
Loading