mb/starlabs/starlite_adl: Add CFR option for USB card reader
Add a CFR setup menu option to enable/disable the USB micro-SD card reader, but restrict it to newer boards which use the MXC accelerometer, as those boards have the card reader on USB2 port 4, rather than shared with the detachable keyboard on port 3. TEST=build/boot on starlite_adl boards with and without the MXC accelerometer, verify only boards with it have the CFR option to disable the card reader shown, and that the option works as expected. Change-Id: I9255d008c6f322d01390ed9f19e4e963cf04eeb6 Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/89626 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Sean Rhodes <sean@starlabs.systems>
This commit is contained in:
parent
5c1a9fa809
commit
80861a9f69
3 changed files with 26 additions and 1 deletions
|
|
@ -5,6 +5,9 @@
|
|||
#include <drivers/option/cfr_frontend.h>
|
||||
#include <ec/starlabs/merlin/cfr.h>
|
||||
#include <intelblocks/cfr.h>
|
||||
#include <device/i2c_bus.h>
|
||||
#include <device/i2c_simple.h>
|
||||
#include <static.h>
|
||||
#include <variants.h>
|
||||
|
||||
static const struct sm_object accelerometer = SM_DECLARE_BOOL({
|
||||
|
|
@ -14,6 +17,21 @@ static const struct sm_object accelerometer = SM_DECLARE_BOOL({
|
|||
.default_value = true,
|
||||
});
|
||||
|
||||
static void update_card_reader(const struct sm_object *obj, struct sm_object *new)
|
||||
{
|
||||
struct device *mxc_accel = DEV_PTR(mxc6655);
|
||||
|
||||
if (!i2c_dev_detect(i2c_busdev(mxc_accel), mxc_accel->path.i2c.device))
|
||||
new->sm_bool.flags = CFR_OPTFLAG_SUPPRESS;
|
||||
}
|
||||
|
||||
static const struct sm_object card_reader = SM_DECLARE_BOOL({
|
||||
.opt_name = "card_reader",
|
||||
.ui_name = "Card Reader",
|
||||
.ui_helptext = "Enable or disable the built-in card reader",
|
||||
.default_value = true,
|
||||
}, WITH_CALLBACK(update_card_reader));
|
||||
|
||||
#if CONFIG(SOC_INTEL_TIGERLAKE) || CONFIG(SOC_INTEL_ALDERLAKE) || CONFIG(SOC_INTEL_RAPTORLAKE)
|
||||
static const struct sm_object gna = SM_DECLARE_BOOL({
|
||||
.opt_name = "gna",
|
||||
|
|
@ -147,6 +165,7 @@ static struct sm_obj_form devices = {
|
|||
.ui_name = "Devices",
|
||||
.obj_list = (const struct sm_object *[]) {
|
||||
&accelerometer,
|
||||
&card_reader,
|
||||
&display_native_res,
|
||||
#if CONFIG(SOC_INTEL_TIGERLAKE) || CONFIG(SOC_INTEL_ALDERLAKE) || CONFIG(SOC_INTEL_RAPTORLAKE)
|
||||
&gna,
|
||||
|
|
|
|||
|
|
@ -85,6 +85,8 @@ chip soc/intel/alderlake
|
|||
# Internal Bluetooth 1874 mil
|
||||
register "usb2_ports[9]" = "USB2_PORT_SHORT(OC_SKIP)"
|
||||
|
||||
register "usb2_ports[3]" = "USB2_PORT_MID(OC_SKIP)"
|
||||
|
||||
chip drivers/usb/acpi
|
||||
device ref xhci_root_hub on
|
||||
chip drivers/usb/acpi
|
||||
|
|
@ -167,7 +169,7 @@ chip soc/intel/alderlake
|
|||
register "has_rotation_matrix" = "1"
|
||||
register "rotation_matrix" = "{1, 0, 0, 0, -1, 0, 0, 0, 1}"
|
||||
register "detect" = "1"
|
||||
device i2c 15 on end
|
||||
device i2c 15 alias mxc6655 on end
|
||||
end
|
||||
end
|
||||
device ref i2c2 on # Touchscreen
|
||||
|
|
|
|||
|
|
@ -72,4 +72,8 @@ void devtree_update(void)
|
|||
/* Enable/Disable GNA based on CMOS settings */
|
||||
if (get_uint_option("gna", 0) == 0)
|
||||
gna_dev->enabled = 0;
|
||||
|
||||
/* Enable/Disable Card Reader based on CMOS Settings */
|
||||
if (get_uint_option("card_reader", 1) == 0)
|
||||
cfg->usb2_ports[3].enable = 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue