blob: 4a07604133cd1bc24b59de4941c9538b181f6595 [file] [log] [blame]
Angel Pons210a0082020-04-02 23:48:24 +02001/* SPDX-License-Identifier: GPL-2.0-only */
2/* This file is part of the coreboot project. */
Patrick Rudolphb8e325a2017-08-13 12:09:54 +02003
4#include <southbridge/intel/common/gpio.h>
5#include <console/console.h>
6#include <device/device.h>
7#include <ec/acpi/ec.h>
8#include <option.h>
Elyes HAOUAS5fd93e02019-05-15 21:07:30 +02009#include <types.h>
Patrick Rudolphb8e325a2017-08-13 12:09:54 +020010
11#include "h8.h"
12#include "chip.h"
13
14/* Controls radio-off pin in WWAN MiniPCIe slot. */
15void h8_wwan_enable(int on)
16{
17 if (on)
18 ec_set_bit(0x3a, 6);
19 else
20 ec_clr_bit(0x3a, 6);
21}
22
23/*
24 * Detect WWAN on supported MBs.
25 */
Furquan Shaikh4fc17b42020-04-24 21:39:08 -070026bool h8_has_wwan(const struct device *dev)
Patrick Rudolphb8e325a2017-08-13 12:09:54 +020027{
28 struct ec_lenovo_h8_config *conf = dev->chip_info;
29
30 if (!conf->has_wwan_detection) {
31 printk(BIOS_INFO, "H8: WWAN detection not implemented. "
32 "Assuming WWAN installed\n");
33 return true;
34 }
35
36 if (get_gpio(conf->wwan_gpio_num) == conf->wwan_gpio_lvl) {
37 printk(BIOS_INFO, "H8: WWAN installed\n");
38 return true;
39 }
40
41 printk(BIOS_INFO, "H8: WWAN not installed\n");
42 return false;
43}
44
45/*
46 * Return WWAN NVRAM setting.
47 */
48bool h8_wwan_nv_enable(void)
49{
50 u8 val;
51
52 if (get_option(&val, "wwan") != CB_SUCCESS)
53 return true;
54
55 return val;
56}