mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-02 09:46:37 +03:00
board: sunxi: Convert extension support to UCLASS framework
Migrate sunxi board extension detection from legacy implementation to the new UCLASS-based extension board framework. Signed-off-by: Kory Maincent (TI.com) <kory.maincent@bootlin.com>
This commit is contained in:
committed by
Tom Rini
parent
56cbcb1cc9
commit
53e14e9c0c
@@ -1223,7 +1223,7 @@ config BLUETOOTH_DT_DEVICE_FIXUP
|
||||
|
||||
config CHIP_DIP_SCAN
|
||||
bool "Enable DIPs detection for CHIP board"
|
||||
select SUPPORT_EXTENSION_SCAN
|
||||
select SUPPORT_DM_EXTENSION_SCAN
|
||||
select W1
|
||||
select W1_GPIO
|
||||
select W1_EEPROM
|
||||
|
||||
@@ -40,7 +40,8 @@ struct dip_w1_header {
|
||||
u8 data[16]; /* user data, per-dip specific */
|
||||
} __packed;
|
||||
|
||||
int extension_board_scan(struct list_head *extension_list)
|
||||
static int sunxi_extension_board_scan(struct udevice *udev,
|
||||
struct alist *extension_list)
|
||||
{
|
||||
struct udevice *bus, *dev;
|
||||
int num_dip = 0;
|
||||
@@ -55,8 +56,8 @@ int extension_board_scan(struct list_head *extension_list)
|
||||
}
|
||||
|
||||
for_each_w1_device(bus, &dev) {
|
||||
struct extension dip = {0};
|
||||
struct dip_w1_header w1_header;
|
||||
struct extension *dip;
|
||||
u32 vid;
|
||||
u16 pid;
|
||||
|
||||
@@ -82,18 +83,19 @@ int extension_board_scan(struct list_head *extension_list)
|
||||
w1_header.product_name, pid,
|
||||
w1_header.vendor_name, vid);
|
||||
|
||||
dip = calloc(1, sizeof(struct extension));
|
||||
if (!dip) {
|
||||
printf("Error in memory allocation\n");
|
||||
return num_dip;
|
||||
}
|
||||
|
||||
snprintf(dip->overlay, sizeof(dip->overlay), "dip-%x-%x.dtbo",
|
||||
snprintf(dip.overlay, sizeof(dip.overlay), "dip-%x-%x.dtbo",
|
||||
vid, pid);
|
||||
strlcpy(dip->name, w1_header.product_name, sizeof(dip->name));
|
||||
strlcpy(dip->owner, w1_header.vendor_name, sizeof(dip->owner));
|
||||
list_add_tail(&dip->list, extension_list);
|
||||
strlcpy(dip.name, w1_header.product_name, sizeof(dip.name));
|
||||
strlcpy(dip.owner, w1_header.vendor_name, sizeof(dip.owner));
|
||||
if (!alist_add(extension_list, dip))
|
||||
return -ENOMEM;
|
||||
num_dip++;
|
||||
}
|
||||
return num_dip;
|
||||
}
|
||||
|
||||
U_BOOT_EXTENSION(dip, sunxi_extension_board_scan);
|
||||
|
||||
U_BOOT_DRVINFO(dip) = {
|
||||
.name = "dip",
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user