[PATCH v2 1/1] hw: aspeed_gpio: Fix GPIO array indexing

2021-10-07 Thread pdel
From: Peter Delevoryas The gpio array is declared as a dense array: qemu_irq gpios[ASPEED_GPIO_NR_PINS]; (AST2500 has 228, AST2400 has 216, AST2600 has 208) However, this array is used like a matrix of GPIO sets (e.g. gpio[NR_SETS][NR_PINS_PER_SET] = gpio[8][32]) size_t offset = set *

[PATCH v2 0/1] hw: aspeed_gpio: Fix GPIO array indexing

2021-10-07 Thread pdel
From: Peter Delevoryas v1: https://lore.kernel.org/qemu-devel/20210924061953.1996620-1-p...@fb.com/ v2: - Standardized the size of the GPIOSetProperties array for each Aspeed SOC so that we can use the constant "ASPEED_GPIO_MAX_NR_SETS" to iterate over all of them.

[PATCH v3 1/2] hw/adc: Add basic Aspeed ADC model

2021-10-04 Thread pdel
for multiple engines (AST2600) ] Signed-off-by: Cédric Le Goater [pdel : refactored engine register struct fields to regs[] array field] [pdel : added guest-error checking for upper-8 channel regs in AST2600] [pdel : allow 16-bit reads of the channel data registers] Signed-off-by: Peter Delevoryas

[PATCH v3 0/2] hw/adc: Add basic Aspeed ADC model

2021-10-04 Thread pdel
From: Peter Delevoryas v1: https://lore.kernel.org/qemu-devel/20211002214414.2858382-1-p...@fbc.om/ v2: https://lore.kernel.org/qemu-devel/20211003191850.513658-1-p...@fb.com/ v3: - Reduced the minimum access size to 2, to allow 16-bit reads - Shifted the read value down 16 bits when

[PATCH v3 2/2] hw/arm: Integrate ADC model into Aspeed SoC

2021-10-04 Thread pdel
From: Andrew Jeffery Signed-off-by: Andrew Jeffery Signed-off-by: Cédric Le Goater Signed-off-by: Peter Delevoryas --- hw/arm/aspeed_ast2600.c | 11 +++ hw/arm/aspeed_soc.c | 11 +++ include/hw/arm/aspeed_soc.h | 2 ++ 3 files changed, 24 insertions(+) diff

[PATCH v2 2/2] hw/arm: Integrate ADC model into Aspeed SoC

2021-10-03 Thread pdel
From: Andrew Jeffery Signed-off-by: Andrew Jeffery Signed-off-by: Cédric Le Goater Signed-off-by: Peter Delevoryas --- hw/arm/aspeed_ast2600.c | 11 +++ hw/arm/aspeed_soc.c | 11 +++ include/hw/arm/aspeed_soc.h | 2 ++ 3 files changed, 24 insertions(+) diff

[PATCH v2 1/2] hw/adc: Add basic Aspeed ADC model

2021-10-03 Thread pdel
for multiple engines (AST2600) ] Signed-off-by: Cédric Le Goater [pdel : refactored engine register struct fields to regs[] array field] [pdel : added guest-error checking for upper-8 channel regs in AST2600] Signed-off-by: Peter Delevoryas --- hw/adc/aspeed_adc.c | 422

[PATCH v2 0/2] hw/adc: Add basic Aspeed ADC model

2021-10-03 Thread pdel
From: Peter Delevoryas v1: https://lore.kernel.org/qemu-devel/20211002214414.2858382-1-p...@fbc.om/ v2: - Added summary of changes above signed-off-by in commit message. - Added #define's for ADC and ADC engine memory region sizes. - Fixed "From: p...@fbc.com" Thanks, Peter Andrew Jeffery

[PATCH 1/2] hw/adc: Add basic Aspeed ADC model

2021-10-02 Thread pdel
From: Andrew Jeffery This model implements enough behaviour to do basic functionality tests such as device initialisation and read out of dummy sample values. The sample value generation strategy is similar to the STM ADC already in the tree. This patch was originally created by Andrew Jeffery,

[PATCH 2/2] hw/arm: Integrate ADC model into Aspeed SoC

2021-10-02 Thread pdel
From: Andrew Jeffery Signed-off-by: Andrew Jeffery Signed-off-by: Cédric Le Goater Signed-off-by: Peter Delevoryas --- hw/arm/aspeed_ast2600.c | 11 +++ hw/arm/aspeed_soc.c | 11 +++ include/hw/arm/aspeed_soc.h | 2 ++ 3 files changed, 24 insertions(+) diff

[PATCH 0/2] hw/adc: Add basic Aspeed ADC model

2021-10-02 Thread pdel
From: Peter Delevoryas Following up from https://lore.kernel.org/qemu-devel/20210930004235.1656003-1-p...@fb.com/ This is a resubmission of Andrew Jeffery's ADC model, but with the registers converted from typed-member-fields to a regs[] array. Otherwise, it should be pretty much equivalent.

[RFC PATCH 0/1] hw: aspeed_adc: Add initial Aspeed ADC support

2021-09-29 Thread pdel
From: Peter Delevoryas Hey everyone, This patch mostly just does the basic, boilerplate setup for the ADC, so that we can start adding more ADC feature emulation in the future. The only device behavior that I tried to add was emulating the control initialization sequence and the sequence for

[RFC PATCH 1/1] hw: aspeed_adc: Add initial Aspeed ADC support

2021-09-29 Thread pdel
From: Peter Delevoryas This change sets up Aspeed SoC ADC emulation, so that most ADC drivers will pass the initialization sequence and load successfully. In the future, we can extend this to emulate more features. The initialization sequence is: 1. Set `ADC00` to `0xF`. 2. Wait for

[PATCH 0/1] hw: aspeed_gpio: Fix GPIO array indexing

2021-09-27 Thread pdel
From: Peter Delevoryas Hey everyone, I think there might be a bug in aspeed_gpio_update, where it's selecting a GPIO IRQ to update. The indexing that maps from GPIO pin to IRQ leads to an out-of-bounds array access and a segfault after that. tl;dr There's 8 rows of 32 pins (8 * 32 == 256

[PATCH 1/1] hw: aspeed_gpio: Fix GPIO array indexing

2021-09-27 Thread pdel
From: Peter Delevoryas The gpio array is declared as a dense array: qemu_irq gpios[ASPEED_GPIO_NR_PINS]; (AST2500 has 228, AST2400 has 216, AST2600 has 208) However, this array is used like a matrix of GPIO sets (e.g. gpio[NR_SETS][NR_PINS_PER_SET] = gpio[8][32]) size_t offset = set *

[PATCH 1/1] hw: aspeed_gpio: Fix pin I/O type declarations

2021-09-27 Thread pdel
From: Peter Delevoryas Some of the pin declarations in the Aspeed GPIO module were incorrect, probably because of confusion over which bits in the input and output uint32_t's correspond to which groups in the label array. Since the uint32_t literals are in big endian, it's sort of the opposite

[PATCH 0/1] hw: aspeed_gpio: Fix pin I/O type declarations

2021-09-27 Thread pdel
From: Peter Delevoryas In the Aspeed chips, the GPIO pins are mostly labeled in groups of 8, but some of the groups only have 4 elements. Also, most pins have input and output capabilities, but some are strictly input or strictly output pins. We have some arrays that describe the I/O

[PATCH 0/1] hw: aspeed_gpio: Fix GPIO array indexing

2021-09-24 Thread pdel
From: Peter Delevoryas Hey everyone, I think there might be a bug aspeed_gpio_update, when it's selecting a GPIO IRQ to update. I was testing booting Facebook's OpenBMC platform "YosemiteV2" (fby2), and I was hitting a segfault in QEMU: qemu-system-arm -machine ast2500-evb \ -drive

[PATCH 1/1] hw: aspeed_gpio: Fix GPIO array indexing

2021-09-24 Thread pdel
From: Peter Delevoryas The gpio array is declared as a dense array: ... qemu_irq gpios[ASPEED_GPIO_NR_PINS]; (AST2500 has 228, AST2400 has 216, AST2600 has 208) However, this array is used like a matrix of GPIO sets (e.g. gpio[NR_SETS][NR_PINS_PER_SET] = gpio[8][32]) size_t offset = set *

[PATCH v4] hw/arm/aspeed: Add Fuji machine type

2021-09-06 Thread pdel
From: Peter Delevoryas This adds a new machine type "fuji-bmc" based on the following device tree: https://github.com/torvalds/linux/blob/40cb6373b46/arch/arm/boot/dts/aspeed-bmc-facebook-fuji.dts Most of the i2c devices are not there, they're added here:

[PATCH v2 0/1] hw/arm/aspeed: Initialize AST2600 UART clock selection registers

2021-09-06 Thread pdel
From: Peter Delevoryas After fixing some commit log issues in another patch: https://lore.kernel.org/qemu-devel/2f2f44c6-4817-4d58-a7a0-496446ac7...@fb.com/ I noticed that I had similar issues in another patch I submitted:

[PATCH v2 1/1] hw/arm/aspeed: Initialize AST2600 UART clock selection registers

2021-09-06 Thread pdel
From: Peter Delevoryas UART5 is typically used as the default debug UART on the AST2600, but UART1 is also designed to be a debug UART. All the AST2600 UART's have semi-configurable clock rates through registers in the System Control Unit (SCU), but only UART5 works out of the box with

[PATCH v3] hw/arm/aspeed: Add Fuji machine type

2021-09-05 Thread pdel
From: Peter Delevoryas This adds a new machine type "fuji-bmc" based on the following device tree: https://github.com/torvalds/linux/blob/master/arch/arm/boot/dts/aspeed-bmc-facebook-fuji.dts Most of the i2c devices are not there, they're added here:

[PATCH v2 0/1] hw/arm/aspeed: Add Fuji machine type

2021-09-03 Thread pdel
From: Peter Delevoryas v2: - Added supported i2c devices (lm75, tmp75, tmp422, 24c64, 24c02) - Switched flash model to mx66l1g45g (128MB) - Completely separated fuji class definition from ast2600-evb - Removed image acceptance test Link:

[PATCH v2 1/1] hw/arm/aspeed: Add Fuji machine type

2021-09-03 Thread pdel
From: Peter Delevoryas This adds a new machine type "fuji-bmc" based on the following device tree: https://github.com/torvalds/linux/blob/master/arch/arm/boot/dts/aspeed-bmc-facebook-fuji.dts Most of the i2c devices are not there, they're added here:

[PATCH 1/1] hw/arm/aspeed: Add Fuji machine type

2021-09-01 Thread pdel
From: Peter Delevoryas This adds a new machine type "fuji-bmc" that's equivalent to "ast2600-evb" except that it uses MAC3 and UART1. It might be appropriate to change other aspects of this machine type in the future, but so far this is all the specificity necessary to get a Fuji OpenBMC image

[PATCH 0/1] hw/arm/aspeed: Add Fuji machine type

2021-09-01 Thread pdel
From: Peter Delevoryas Adding a new Aspeed AST2600 machine type, uses MAC3 for ethernet1 and UART1 for the serial console, which is different than the existing ast2600-evb. Otherwise though, my usage so far hasn't required a different set of hardware strap registers or anything, so I just

[PATCH v2 1/1] hw/arm/aspeed: Allow machine to set UART default

2021-09-01 Thread pdel
From: Peter Delevoryas When you run QEMU with an Aspeed machine and a single serial device using stdio like this: qemu -machine ast2600-evb -drive ... -serial stdio The guest OS can read and write to the UART5 registers at 0x1E784000 and it will receive from stdin and write to stdout. The

[PATCH v2 0/1] hw/arm/aspeed: Allow machine to set UART default

2021-09-01 Thread pdel
From: Peter Delevoryas v1: https://lore.kernel.org/qemu-devel/20210831233140.2659116-1-p...@fb.com/ v2: - Replaced AspeedMachineClass "serial_hd0" with "uart_default" - Removed "qdev_get_machine()" usage - Removed unnecessary aspeed.h (machine class) includes in device files - Added "uint32_t

[PATCH 0/1] hw/arm/aspeed: Allow machine to set serial_hd(0)

2021-08-31 Thread pdel
From: Peter Delevoryas This is a follow-up to a discussion in a previous series I sent: https://lore.kernel.org/qemu-devel/20210827210417.4022054-1-p...@fb.com/ I tried to add a new machine type called Fuji that required the ability to specify the UART connected to the first serial device on

[PATCH 1/1] hw/arm/aspeed: Allow machine to set serial_hd(0)

2021-08-31 Thread pdel
From: Peter Delevoryas When you run QEMU with an Aspeed machine and a single serial device using stdio like this: qemu -machine ast2600-evb -drive ... -serial stdio The guest OS can read and write to the UART5 registers at 0x1E784000 and it will receive from stdin and write to stdout. The

[PATCH] hw/arm/aspeed: Initialize AST2600 clock selection registers

2021-08-31 Thread pdel
From: Peter Delevoryas UART5 is typically used as the default debug UART on the AST2600, but UART1 is also designed to be a debug UART. All the AST2600 UART's have semi-configurable clock rates through registers in the System Control Unit (SCU), but only UART5 works out of the box with

[PATCH 2/5] hw/arm/aspeed: Select console UART from machine

2021-08-27 Thread pdel
From: Peter Delevoryas This change replaces the UART serial device initialization code with machine configuration data, making it so that we have a single code path for console UART initialization, but allowing different machines to use different UART's. This is relevant because the Aspeed chips

[PATCH 1/5] hw/arm/aspeed: Add get_irq to AspeedSoCClass

2021-08-27 Thread pdel
From: Peter Delevoryas The AST2500 uses different logic than the AST2600 for getting IRQ's. This adds a virtual `get_irq` function to the Aspeed SOC class, so that the shared initialization code in `hw/arm/aspeed.c` can retrieve IRQ's. Signed-off-by: Peter Delevoryas ---

[PATCH 3/5] hw/arm/aspeed: Add fuji machine type

2021-08-27 Thread pdel
From: Peter Delevoryas Fuji uses the AST2600, so it's very similar to `ast2600-evb`, but it has a few slight differences, such as using UART1 for the serial console. Signed-off-by: Peter Delevoryas --- hw/arm/aspeed.c | 13 + 1 file changed, 13 insertions(+) diff --git

[PATCH 4/5] hw/arm/aspeed: Fix AST2600_CLK_SEL3 address

2021-08-27 Thread pdel
From: Peter Delevoryas This register address is not actually used anywhere, and the datasheet specifies that it's zero-initialized by default anyways, but the address is incorrect. This just corrects the address. Fixes: e09cf36321f6 ("hw: aspeed_scu: Add AST2600 support") Signed-off-by: Peter

[PATCH 5/5] hw/arm/aspeed: Initialize AST2600 clock selection registers

2021-08-27 Thread pdel
From: Peter Delevoryas UART5 is typically used as the default debug UART on the AST2600, but UART1 is also designed to be a debug UART. All the AST2600 UART's have semi-configurable clock rates through registers in the System Control Unit (SCU), but only UART5 works out of the box with

[PATCH 0/5] hw/arm/aspeed: Add fuji machine type

2021-08-27 Thread pdel
From: Peter Delevoryas Hello! This patch series creates an Aspeed machine type for Facebook's OpenBMC platform "fuji". The first 2 commits do some refactoring, to allow Aspeed machines to configure the first serial device. Most board configurations use UART5 for the console, but fuji uses