Skip to content

Commit bf8a471

Browse files
jamin-aspeedlegoater
authored andcommitted
hw/arm/aspeed: Invert sdhci write protected pin for AST2600 EVB
The Write Protect pin of SDHCI model is default active low to match the SDHCI spec. So, write enable the bit 19 should be 1 and write protected the bit 19 should be 0 at the Present State Register (0x24). According to the design of AST2600 EVB, the Write Protected pin is active high by default. To support it, introduces a new "sdhci_wp_inverted" property in ASPEED MACHINE State and set it true for AST2600 EVB and set "wp_inverted" property true of sdhci-generic model. Signed-off-by: Jamin Lin <[email protected]> Reviewed-by: Andrew Jeffery <[email protected]> Acked-by: Philippe Mathieu-Daudé <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Cédric Le Goater <[email protected]>
1 parent 134d9e5 commit bf8a471

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

hw/arm/aspeed.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,12 @@ static void aspeed_machine_init(MachineState *machine)
409409
OBJECT(get_system_memory()), &error_abort);
410410
object_property_set_link(OBJECT(bmc->soc), "dram",
411411
OBJECT(machine->ram), &error_abort);
412+
if (amc->sdhci_wp_inverted) {
413+
for (i = 0; i < bmc->soc->sdhci.num_slots; i++) {
414+
object_property_set_bool(OBJECT(&bmc->soc->sdhci.slots[i]),
415+
"wp-inverted", true, &error_abort);
416+
}
417+
}
412418
if (machine->kernel_filename) {
413419
/*
414420
* When booting with a -kernel command line there is no u-boot
@@ -1415,6 +1421,7 @@ static void aspeed_machine_ast2600_evb_class_init(ObjectClass *oc, void *data)
14151421
amc->num_cs = 1;
14161422
amc->macs_mask = ASPEED_MAC0_ON | ASPEED_MAC1_ON | ASPEED_MAC2_ON |
14171423
ASPEED_MAC3_ON;
1424+
amc->sdhci_wp_inverted = true;
14181425
amc->i2c_init = ast2600_evb_i2c_init;
14191426
mc->default_ram_size = 1 * GiB;
14201427
aspeed_machine_class_init_cpus_defaults(mc);

include/hw/arm/aspeed.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ struct AspeedMachineClass {
3939
uint32_t macs_mask;
4040
void (*i2c_init)(AspeedMachineState *bmc);
4141
uint32_t uart_default;
42+
bool sdhci_wp_inverted;
4243
};
4344

4445

0 commit comments

Comments
 (0)