1 // SPDX-License-Identifier: GPL-2.0-only
3 * platform_bcm43xx.c: bcm43xx platform data initialization file
5 * (C) Copyright 2016 Intel Corporation
6 * Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
9 #include <linux/gpio/machine.h>
10 #include <linux/platform_device.h>
11 #include <linux/regulator/machine.h>
12 #include <linux/regulator/fixed.h>
13 #include <linux/sfi.h>
15 #include <asm/intel-mid.h>
17 #define WLAN_SFI_GPIO_IRQ_NAME "WLAN-interrupt"
18 #define WLAN_SFI_GPIO_ENABLE_NAME "WLAN-enable"
20 #define WLAN_DEV_NAME "0000:00:01.3"
22 static struct regulator_consumer_supply bcm43xx_vmmc_supply
= {
23 .dev_name
= WLAN_DEV_NAME
,
27 static struct regulator_init_data bcm43xx_vmmc_data
= {
29 .valid_ops_mask
= REGULATOR_CHANGE_STATUS
,
31 .num_consumer_supplies
= 1,
32 .consumer_supplies
= &bcm43xx_vmmc_supply
,
35 static struct fixed_voltage_config bcm43xx_vmmc
= {
36 .supply_name
= "bcm43xx-vmmc-regulator",
38 * Announce 2.0V here to be compatible with SDIO specification. The
39 * real voltage and signaling are still 1.8V.
41 .microvolts
= 2000000, /* 1.8V */
42 .startup_delay
= 250 * 1000, /* 250ms */
43 .enabled_at_boot
= 0, /* disabled at boot */
44 .init_data
= &bcm43xx_vmmc_data
,
47 static struct platform_device bcm43xx_vmmc_regulator
= {
48 .name
= "reg-fixed-voltage",
49 .id
= PLATFORM_DEVID_AUTO
,
51 .platform_data
= &bcm43xx_vmmc
,
55 static struct gpiod_lookup_table bcm43xx_vmmc_gpio_table
= {
56 .dev_id
= "reg-fixed-voltage.0",
58 GPIO_LOOKUP("0000:00:0c.0", -1, NULL
, GPIO_ACTIVE_LOW
),
63 static int __init
bcm43xx_regulator_register(void)
65 struct gpiod_lookup_table
*table
= &bcm43xx_vmmc_gpio_table
;
66 struct gpiod_lookup
*lookup
= table
->table
;
69 lookup
[0].chip_hwnum
= get_gpio_by_name(WLAN_SFI_GPIO_ENABLE_NAME
);
70 gpiod_add_lookup_table(table
);
72 ret
= platform_device_register(&bcm43xx_vmmc_regulator
);
74 pr_err("%s: vmmc regulator register failed\n", __func__
);
81 static void __init
*bcm43xx_platform_data(void *info
)
85 ret
= bcm43xx_regulator_register();
89 pr_info("Using generic wifi platform data\n");
91 /* For now it's empty */
95 static const struct devs_id bcm43xx_clk_vmmc_dev_id __initconst
= {
96 .name
= "bcm43xx_clk_vmmc",
97 .type
= SFI_DEV_TYPE_SD
,
98 .get_platform_data
= &bcm43xx_platform_data
,
101 sfi_device(bcm43xx_clk_vmmc_dev_id
);