Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ properties:
- apple,d201-touchscreen
- apple,d21-touchscreen
- apple,d79-touchscreen
- apple,n51-touchscreen
- apple,n61-touchscreen
- apple,n102-touchscreen
- apple,n66-touchscreen
Expand Down Expand Up @@ -416,6 +417,7 @@ allOf:
- apple,j127-touchscreen
- apple,j207-touchscreen
- apple,j208-touchscreen
- apple,n51-touchscreen
- apple,n61-touchscreen
- apple,n102-touchscreen
- apple,n66-touchscreen
Expand Down Expand Up @@ -515,7 +517,9 @@ allOf:
- if:
properties:
compatible:
const: apple,n61-touchscreen
enum:
- apple,n51-touchscreen
- apple,n61-touchscreen
then:
properties:
apple,z2-cal-blob:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ properties:
- apple,adelyn-cam-avdd3-regulator
- apple,adelyn-cam0-regulator
- apple,adelyn-touch-core-regulator
- apple,amber-touch-core-regulator
- apple,angel-touch-analog-regulator
- apple,antigua-cam-avdd-regulator
- apple,antigua-cam0-regulator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,31 @@ properties:
minimum: 1
description: The EHCI root port of the radio

apple,pmu-reset:
$ref: /schemas/types.yaml#/definitions/phandle-array
items:
- items:
- description: The PMIC whose GPIO resets the radio
- description: That PMIC GPIO line (0 to 15)
maximum: 15
description:
The radio's reset, the ADT wlan node's function-device_reset. Without
it, the reset is GPIO 3 of the D2089 at I2C 0x3c, as on the A7 iPads.

apple,rom-chip:
$ref: /schemas/types.yaml#/definitions/uint32
description:
The chip ID the radio's boot ROM reports (the ADT's /product
wifi-chipset), 43342 on the iPhone 5s. Without it, 0x4324 (the
iPads' BCM43241).

apple,usb-pid:
$ref: /schemas/types.yaml#/definitions/uint32
maximum: 0xffff
description:
The USB product ID (vendor 0a5c) of the radio's boot ROM: 0xbd21 on the
iPhone 5s. Without it, 0xbd1c (the iPads' BCM43241).

host-ready-gpios:
maxItems: 1
description: HOST_READY, driven by the host
Expand Down
79 changes: 78 additions & 1 deletion arch/arm64/boot/dts/apple/s5l8960x-5s.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
/ {
chassis-type = "handset";

aliases {
touchscreen0 = &touchscreen; /* the loader copies the ADT calibration */
};

gpio-keys {
compatible = "gpio-keys";

Expand Down Expand Up @@ -62,7 +66,7 @@
&i2c0 {
status = "okay";

pmic@74 {
pmu: pmic@74 {
compatible = "apple,amber-pmic", "apple,i2c-pmic";
reg = <0x74>;
#address-cells = <1>;
Expand All @@ -89,6 +93,79 @@
};
};
};

/* ADT multi-touch function-power_ldo = pmuL(0x20e) */
touch_core: regulator-touch-core {
compatible = "apple,amber-touch-core-regulator";
regulator-name = "touch-core";
};
};

/* ADT display-pmu,chestnut @0x27: touch function-power_ana = dpLE(0x302) */
display-pmu@27 {
compatible = "apple,chestnut-pmic";
reg = <0x27>;

touch_ana: regulator-touch-hv {
compatible = "apple,chestnut-touch-hv-regulator";
regulator-name = "touch-analog";
};
};
};

/*
* The touchscreen: an N1 on SPI1, the N51 ADT's /arm-io/spi1/multi-touch
* (multi-touch,n51): chip select GPIO 71 (SPI1's own), attention GPIO 22,
* reset GPIO 23, the PWM's 32768 Hz touch clock, the analog supply on the
* Chestnut and the LDO on the D2045. N51 and N53 share one kernelcache in
* iOS 12.5.8, whose only 5s touch personality matches multi-touch,n51, and
* identical N51.mtprops and N53.mtprops (C1F57,3).
*/
&touchclk {
status = "okay";
};

&spi1 {
status = "okay";

touchscreen: touchscreen@0 {
compatible = "apple,n51-touchscreen";
reg = <0>;
spi-max-frequency = <500000>;
interrupts-extended = <&pinctrl 22 IRQ_TYPE_EDGE_FALLING>;
reset-gpios = <&pinctrl 23 GPIO_ACTIVE_LOW>;
ana-supply = <&touch_ana>;
core-supply = <&touch_core>;
clocks = <&touchclk>;
firmware-name = "apple/n51-fwstart.z2fw";
touchscreen-size-x = <640>;
touchscreen-size-y = <1136>;
};
};

/ {
/*
* The BCM43342 Wi-Fi radio on HSIC (the N51 ADT's
* /arm-io/usb-complex/usb-ehci1/wlan, module 'chardonnay', /product
* wifi-chipset 43342): EHCI1 root port 1, its HSIC PHY at usb-complex
* +0x60, HOST_READY on GPIO 166, DEVICE_READY on GPIO 167 and the
* reset on the D2045's GPIO 10 (function-device_reset), as on the iPad
* mini 2 but for the pins and the PMIC. Its boot ROM enumerates as
* 0a5c:bd21 (N51, 2026-12-04). apple-a7-wlan owns it.
*/
wifi@20c000060 {
compatible = "apple,s5l8960x-hsic-wlan";
reg = <0x2 0x0c000060 0x0 0x10>, <0x2 0x0c400000 0x0 0x10000>;
reg-names = "phy", "ehci";
interrupt-parent = <&aic>;
interrupts = <AIC_IRQ 165 IRQ_TYPE_LEVEL_HIGH>;
power-domains = <&ps_hsic2_phy>;
apple,ehci-port = <1>;
apple,pmu-reset = <&pmu 10>;
apple,rom-chip = <43342>;
apple,usb-pid = <0xbd21>;
host-ready-gpios = <&pinctrl 166 GPIO_ACTIVE_HIGH>;
device-ready-gpios = <&pinctrl 167 GPIO_ACTIVE_HIGH>;
};
};

Expand Down
17 changes: 17 additions & 0 deletions drivers/input/touchscreen/apple_z2.c
Original file line number Diff line number Diff line change
Expand Up @@ -6041,6 +6041,21 @@ static const struct apple_z2_chip_info apple_z2_n61_info = {
.cs_inactive_us = 1000,
};

/*
* The iPhone 5s (N51 and N53, which ship the same N51.mtprops) has the
* N61's generation-1 runtime: its iOS 12.5.8 personality "C1,N51"
* (C1F57,3) is AppleMultitouchN1SPI with the N61's calibration download
* (0x10009000) and proximity (0x10009600) addresses, fll-mval 6099,
* ref-clk-div 2, clk32 enable and execute address 0x10003400.
*/
static const struct apple_z2_chip_info apple_z2_n51_info = {
.name = "iPhone 5s Touchscreen",
.variant = APPLE_Z2_VARIANT_N61,
.cs_setup_us = 1000,
.cs_hold_us = 1000,
.cs_inactive_us = 1000,
};

/*
* The N56 shares the N61's generation-1 runtime protocol, its SPI chip
* select timings and its calibration addresses; only the panel (and with
Expand Down Expand Up @@ -6595,6 +6610,7 @@ static const struct of_device_id apple_z2_of_match[] = {
{ .compatible = "apple,d201-touchscreen", .data = &apple_z2_iphone8_gsm_info },
{ .compatible = "apple,d79-touchscreen", .data = &apple_z2_d79_info },
{ .compatible = "apple,d21-touchscreen", .data = &apple_z2_iphone8_plus_info },
{ .compatible = "apple,n51-touchscreen", .data = &apple_z2_n51_info },
{ .compatible = "apple,n61-touchscreen", .data = &apple_z2_n61_info },
{ .compatible = "apple,n56-touchscreen", .data = &apple_z2_n56_info },
{ .compatible = "apple,n102-touchscreen", .data = &apple_z2_n102_info },
Expand Down Expand Up @@ -6629,6 +6645,7 @@ static struct spi_device_id apple_z2_of_id[] = {
{ .name = "d201-touchscreen", .driver_data = (kernel_ulong_t)&apple_z2_iphone8_gsm_info },
{ .name = "d79-touchscreen", .driver_data = (kernel_ulong_t)&apple_z2_d79_info },
{ .name = "d21-touchscreen", .driver_data = (kernel_ulong_t)&apple_z2_iphone8_plus_info },
{ .name = "n51-touchscreen", .driver_data = (kernel_ulong_t)&apple_z2_n51_info },
{ .name = "n61-touchscreen", .driver_data = (kernel_ulong_t)&apple_z2_n61_info },
{ .name = "n56-touchscreen", .driver_data = (kernel_ulong_t)&apple_z2_n56_info },
{ .name = "n102-touchscreen", .driver_data = (kernel_ulong_t)&apple_z2_n102_info },
Expand Down
50 changes: 39 additions & 11 deletions drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,25 @@ static const struct brcmf_firmware_mapping brcmf_usb_fwnames[] = {
};

/* The HSIC radio's firmware is per board, because Apple's TRX for it carries
* the module NVRAM of that board: brcm/brcmfmac43241-<board>-usb.bin, where
* the module NVRAM of that board: brcm/brcmfmac<chip>-<board>-usb.bin, where
* <board> is the machine's first compatible without its "apple," prefix
* (brcmfmac43241-j72-usb.bin on the J72).
* (brcmfmac43241-j72-usb.bin on the J72, brcmfmac43342-n51-usb.bin on the
* iPhone 5s).
*/
#define BRCMF_USB_HSIC_FW_FMT BRCMF_FW_DEFAULT_PATH "brcmfmac43241-%s-usb"
#define BRCMF_USB_HSIC_FW_FMT BRCMF_FW_DEFAULT_PATH "brcmfmac%s-%s-usb"

/* The HSIC radios: the boot ROM's chip ID, the firmware's chip name and the
* largest RAM the ROM may report. The A7 iPads' BCM43241 reports 0x4324
* (J72 measured: rev 6, 0x90000 bytes at 0x60000000).
*/
static const struct brcmf_usb_hsic_chip {
u32 chip;
const char *name;
u32 max_ramsize;
} brcmf_usb_hsic_chips[] = {
{ BRCM_CC_43241_CHIP_ID, "43241", 0x90000 },
{ BRCM_CC_43342_CHIP_ID, "43342", 0x90000 }, /* iPhone 5s */
};

/* Measured on J72; the reference on every board. */
#define BRCMF_USB_HSIC_ROM_REV 6
Expand All @@ -80,6 +94,8 @@ static const struct brcmf_firmware_mapping brcmf_usb_fwnames[] = {
/* Cascadia: the iPad mini 1's BCM4334 on HSIC, as both its boot ROM and
* Apple's firmware enumerate ("M=HEIN m=2.6 V=t", bcdDevice 0.01). */
#define BRCM_USB_APPLE_HSIC_DEVICE_ID 0xbd1c
/* The iPhone 5s BCM43342 boot ROM. */
#define BRCM_USB_APPLE_HSIC_43342_DEVICE_ID 0xbd21
/* Cascadia: how long that firmware gets to start before its bus is reset */
#define BRCMF_USB_HSIC_BOOT_WAIT 500 /* in unit of ms */

Expand Down Expand Up @@ -185,6 +201,7 @@ struct brcmf_usbdev_info {
struct usb_device *usbdev;
bool hsic_reenum; /* Cascadia: firmware started, reset the bus */
u32 hsic_ramsize; /* ROM-reported RAM, bounds the HSIC image */
const struct brcmf_usb_hsic_chip *hsic_chip;
struct device *dev;
struct completion dev_init_done;

Expand Down Expand Up @@ -854,7 +871,8 @@ static bool brcmf_usb_hsic_radio(struct usb_device *udev)
bool described;

if (le16_to_cpu(udev->descriptor.idVendor) != BRCM_USB_VENDOR_ID_BROADCOM ||
le16_to_cpu(udev->descriptor.idProduct) != BRCM_USB_APPLE_HSIC_DEVICE_ID)
(le16_to_cpu(udev->descriptor.idProduct) != BRCM_USB_APPLE_HSIC_DEVICE_ID &&
le16_to_cpu(udev->descriptor.idProduct) != BRCM_USB_APPLE_HSIC_43342_DEVICE_ID))
return false;
np = of_find_compatible_node(NULL, NULL, "apple,s5l8960x-hsic-wlan");
described = np && of_device_is_available(np);
Expand Down Expand Up @@ -956,21 +974,27 @@ static int brcmf_usb_hsic_rom(struct brcmf_usbdev_info *devinfo,
{
u32 chipid = le32_to_cpu(id->chip), chiprev = le32_to_cpu(id->chiprev);
u32 ramsize = le32_to_cpu(id->ramsize), remap = le32_to_cpu(id->remapbase);
unsigned int i;
bool j72 = chiprev == BRCMF_USB_HSIC_ROM_REV &&
ramsize == BRCMF_USB_HSIC_ROM_RAMSIZE &&
remap == BRCMF_USB_HSIC_ROM_REMAP;

if (chipid == BRCMF_POSTBOOT_ID)
return 0;
/* Every A7 board's ADT names the chipset 4324. */
if (chipid != BRCM_CC_43241_CHIP_ID)
for (i = 0; i < ARRAY_SIZE(brcmf_usb_hsic_chips); i++)
if (brcmf_usb_hsic_chips[i].chip == chipid)
devinfo->hsic_chip = &brcmf_usb_hsic_chips[i];
if (!devinfo->hsic_chip) {
brcmf_err("HSIC ROM chip %#x rev %u ram %#x remap %#x is not known\n",
chipid, chiprev, ramsize, remap);
return -ENODEV;
}
if (!j72)
brcmf_info("HSIC ROM rev %u ram %#x remap %#x, J72 measured rev %u ram %#x remap %#x\n",
chiprev, ramsize, remap, BRCMF_USB_HSIC_ROM_REV,
BRCMF_USB_HSIC_ROM_RAMSIZE, BRCMF_USB_HSIC_ROM_REMAP);
/* chiprev selects the firmware by BIT(chiprev) */
if (chiprev >= 32 || !ramsize || ramsize > BRCMF_USB_HSIC_ROM_RAMSIZE)
if (chiprev >= 32 || !ramsize || ramsize > devinfo->hsic_chip->max_ramsize)
return -ENODEV;
devinfo->hsic_ramsize = ramsize;
return 0;
Expand All @@ -989,7 +1013,8 @@ static int brcmf_usb_dlneeded(struct brcmf_usbdev_info *devinfo)
if (brcmf_usb_is_hsic(devinfo)) {
ret = brcmf_usb_hsic_rom(devinfo, &id);
if (ret) return ret;
devinfo->bus_pub.devid = BRCM_CC_43241_CHIP_ID;
devinfo->bus_pub.devid = devinfo->hsic_chip ? devinfo->hsic_chip->chip :
BRCM_CC_43241_CHIP_ID;
devinfo->bus_pub.chiprev = chiprev;
}
if (chipid == BRCMF_POSTBOOT_ID) {
Expand Down Expand Up @@ -1474,7 +1499,7 @@ brcmf_usb_prepare_fw_request(struct brcmf_usbdev_info *devinfo)
};
char hsic_base[BRCMF_FW_NAME_LEN];
struct brcmf_firmware_mapping hsic_fwnames[] = {
{ BRCM_CC_43241_CHIP_ID, 0xFFFFFFFF, hsic_base },
{ devinfo->bus_pub.devid, 0xFFFFFFFF, hsic_base },
};
bool hsic = brcmf_usb_is_hsic(devinfo);

Expand All @@ -1485,7 +1510,8 @@ brcmf_usb_prepare_fw_request(struct brcmf_usbdev_info *devinfo)
return NULL;
if (strstarts(board, "apple,"))
board += strlen("apple,");
snprintf(hsic_base, sizeof(hsic_base), BRCMF_USB_HSIC_FW_FMT, board);
snprintf(hsic_base, sizeof(hsic_base), BRCMF_USB_HSIC_FW_FMT,
devinfo->hsic_chip ? devinfo->hsic_chip->name : "43241", board);
}
fwreq = brcmf_fw_alloc_request(devinfo->bus_pub.devid,
devinfo->bus_pub.chiprev,
Expand Down Expand Up @@ -1621,7 +1647,8 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
u8 endpoint_num, ep;

if (le16_to_cpu(usb->descriptor.idVendor) == BRCM_USB_VENDOR_ID_BROADCOM &&
le16_to_cpu(usb->descriptor.idProduct) == BRCM_USB_APPLE_HSIC_DEVICE_ID &&
(le16_to_cpu(usb->descriptor.idProduct) == BRCM_USB_APPLE_HSIC_DEVICE_ID ||
le16_to_cpu(usb->descriptor.idProduct) == BRCM_USB_APPLE_HSIC_43342_DEVICE_ID) &&
(!brcmf_usb_hsic_radio(usb) || !hsic_bind)) return -ENODEV;

if (!id) {
Expand Down Expand Up @@ -1831,6 +1858,7 @@ static const struct usb_device_id brcmf_usb_devid_table[] = {
BRCMF_USB_DEVICE(BRCM_USB_43242_DEVICE_ID),
BRCMF_USB_DEVICE(BRCM_USB_43569_DEVICE_ID),
BRCMF_USB_DEVICE(BRCM_USB_APPLE_HSIC_DEVICE_ID), /* Cascadia */
BRCMF_USB_DEVICE(BRCM_USB_APPLE_HSIC_43342_DEVICE_ID), /* iPhone 5s */
LINKSYS_USB_DEVICE(BRCM_USB_43235_LINKSYS_DEVICE_ID),
CYPRESS_USB_DEVICE(CY_USB_4373_DEVICE_ID),
{ USB_DEVICE(BRCM_USB_VENDOR_ID_LG, BRCM_USB_43242_LG_DEVICE_ID) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#define BRCM_CC_4334_CHIP_ID 0x4334
#define BRCM_CC_43340_CHIP_ID 43340
#define BRCM_CC_43341_CHIP_ID 43341
#define BRCM_CC_43342_CHIP_ID 43342
#define BRCM_CC_43362_CHIP_ID 43362
#define BRCM_CC_4335_CHIP_ID 0x4335
#define BRCM_CC_4339_CHIP_ID 0x4339
Expand Down
21 changes: 21 additions & 0 deletions drivers/regulator/apple-pmic-touch-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,23 @@ static const struct regulator_desc apple_august_touch_analog = {
.disable_val = 0,
};

/*
* Amber (D2045, A7 iPhone 5s) pmuL(0x20e): LDO index 14. In iOS 12.5.8
* (16H88), AppleD2045PMU::_setLDO at 0xfffffff008441950 indexes 12-byte
* entries at 0xfffffff0070aa494; entry 14 enables with register 0x85 bit 1
* (read/modify/write), an enable-only switch with no voltage field.
*/
static const struct regulator_desc apple_amber_touch_core = {
.name = "amber-touch-core",
.ops = &apple_pmic_touch_regulator_ops,
.type = REGULATOR_VOLTAGE,
.owner = THIS_MODULE,
.enable_reg = 0x85,
.enable_mask = 0x02,
.enable_val = 0x02,
.disable_val = 0,
};

static const struct regulator_desc apple_d2186_touch_core = {
.name = "d2186-touch-core",
.ops = &apple_pmic_touch_regulator_ops,
Expand Down Expand Up @@ -455,6 +472,10 @@ static const struct of_device_id apple_pmic_touch_regulator_of_match[] = {
.compatible = "apple,august-touch-analog-regulator",
.data = &apple_august_touch_analog,
},
{
.compatible = "apple,amber-touch-core-regulator",
.data = &apple_amber_touch_core,
},
{
.compatible = "apple,d2186-touch-core-regulator",
.data = &apple_d2186_touch_core,
Expand Down
Loading
Loading