xref: /aosp_15_r20/external/coreboot/util/autoport/rce823.go (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1package main
2
3import "fmt"
4
5type rce823 struct {
6	variant string
7}
8
9func (r rce823) Scan(ctx Context, addr PCIDevData) {
10	if addr.Dev == 0 && addr.Func == 0 {
11		cur := DevTreeNode{
12			Chip:    "drivers/ricoh/rce822",
13			Comment: "Ricoh cardreader",
14			Registers: map[string]string{
15
16				"sdwppol":      fmt.Sprintf("%d", (addr.ConfigDump[0xfb]&2)>>1),
17				"disable_mask": fmt.Sprintf("0x%x", addr.ConfigDump[0xcb]),
18			},
19			PCISlots: []PCISlot{
20				PCISlot{PCIAddr: PCIAddr{Bus: addr.Bus, Dev: 0x0, Func: 0}, writeEmpty: false},
21				PCISlot{PCIAddr: PCIAddr{Bus: addr.Bus, Dev: 0x0, Func: 1}, writeEmpty: false},
22				PCISlot{PCIAddr: PCIAddr{Bus: addr.Bus, Dev: 0x0, Func: 2}, writeEmpty: false},
23				PCISlot{PCIAddr: PCIAddr{Bus: addr.Bus, Dev: 0x0, Func: 3}, writeEmpty: false},
24				PCISlot{PCIAddr: PCIAddr{Bus: addr.Bus, Dev: 0x0, Func: 4}, writeEmpty: false},
25				PCISlot{PCIAddr: PCIAddr{Bus: addr.Bus, Dev: 0x0, Func: 5}, writeEmpty: false},
26				PCISlot{PCIAddr: PCIAddr{Bus: addr.Bus, Dev: 0x0, Func: 6}, writeEmpty: false},
27				PCISlot{PCIAddr: PCIAddr{Bus: addr.Bus, Dev: 0x0, Func: 7}, writeEmpty: false},
28			},
29		}
30		PutPCIChip(addr, cur)
31	}
32	PutPCIDev(addr, "Ricoh SD card reader")
33	KconfigBool["DRIVERS_RICOH_RCE822"] = true
34}
35
36func init() {
37	RegisterPCI(0x1180, 0xe822, rce823{})
38	RegisterPCI(0x1180, 0xe823, rce823{})
39}
40