From 7305136e36d4ecb21a6a37e923cf01d0c7dd148a Mon Sep 17 00:00:00 2001 From: ashtonamory <287786029+ashtonamory@users.noreply.github.com> Date: Thu, 3 Dec 2026 20:32:22 -0400 Subject: [PATCH 1/9] dt-bindings: regulator: apple,pmic-touch-regulator: Add Amber touch core The iPhone 5s's Amber (D2045) PMIC switches the touchscreen's core supply. Add its compatible. Assisted-by: LLM Signed-off-by: ashtonamory <287786029+ashtonamory@users.noreply.github.com> --- .../bindings/regulator/apple,pmic-touch-regulator.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/regulator/apple,pmic-touch-regulator.yaml b/Documentation/devicetree/bindings/regulator/apple,pmic-touch-regulator.yaml index c99d6d61c237ee..8b4d455138c981 100644 --- a/Documentation/devicetree/bindings/regulator/apple,pmic-touch-regulator.yaml +++ b/Documentation/devicetree/bindings/regulator/apple,pmic-touch-regulator.yaml @@ -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-touch-core-regulator - apple,august-touch-analog-regulator From 301c896b116eb7e2d269c71af8afd6d428fce9eb Mon Sep 17 00:00:00 2001 From: ashtonamory <287786029+ashtonamory@users.noreply.github.com> Date: Thu, 3 Dec 2026 20:32:22 -0400 Subject: [PATCH 2/9] regulator: apple-pmic-touch: Add the Amber (D2045) touch core supply The iPhone 5s's ADT gives the multi-touch node function-power_ldo = pmuL(0x20e), LDO index 14 on the D2045. In iOS 12.5.8 (16H88), AppleD2045PMU::_setLDO indexes a table of 12-byte entries; entry 14 is an enable-only switch at register 0x85 bit 1, set by read/modify/write. Tested on an iPhone 5s (N51): the touchscreen powers up and boots. Assisted-by: LLM Signed-off-by: ashtonamory <287786029+ashtonamory@users.noreply.github.com> --- .../regulator/apple-pmic-touch-regulator.c | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/regulator/apple-pmic-touch-regulator.c b/drivers/regulator/apple-pmic-touch-regulator.c index 523358d40f2b69..d36035e222434f 100644 --- a/drivers/regulator/apple-pmic-touch-regulator.c +++ b/drivers/regulator/apple-pmic-touch-regulator.c @@ -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, @@ -434,6 +451,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, From cf2833b770d3ab559bb07e995693f76cefd4c59c Mon Sep 17 00:00:00 2001 From: ashtonamory <287786029+ashtonamory@users.noreply.github.com> Date: Thu, 3 Dec 2026 20:32:23 -0400 Subject: [PATCH 3/9] dt-bindings: input: apple,z2-multitouch: Add the iPhone 5s The iPhone 5s touchscreen takes the iPhone 6's properties: analog and core supplies, the touch clock and the loader's calibration. Assisted-by: LLM Signed-off-by: ashtonamory <287786029+ashtonamory@users.noreply.github.com> --- .../bindings/input/touchscreen/apple,z2-multitouch.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/input/touchscreen/apple,z2-multitouch.yaml b/Documentation/devicetree/bindings/input/touchscreen/apple,z2-multitouch.yaml index 259112efc8b9d1..9e5b8354bfea45 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/apple,z2-multitouch.yaml +++ b/Documentation/devicetree/bindings/input/touchscreen/apple,z2-multitouch.yaml @@ -36,6 +36,7 @@ properties: - apple,d20-touchscreen - apple,d201-touchscreen - apple,d21-touchscreen + - apple,n51-touchscreen - apple,n61-touchscreen - apple,n102-touchscreen - apple,n66-touchscreen @@ -409,6 +410,7 @@ allOf: - apple,j127-touchscreen - apple,j207-touchscreen - apple,j208-touchscreen + - apple,n51-touchscreen - apple,n61-touchscreen - apple,n102-touchscreen - apple,n66-touchscreen @@ -495,7 +497,9 @@ allOf: - if: properties: compatible: - const: apple,n61-touchscreen + enum: + - apple,n51-touchscreen + - apple,n61-touchscreen then: properties: apple,z2-cal-blob: From cf7a36875c5713977d3f4795aa7a88463a8d3f2e Mon Sep 17 00:00:00 2001 From: ashtonamory <287786029+ashtonamory@users.noreply.github.com> Date: Thu, 3 Dec 2026 20:32:23 -0400 Subject: [PATCH 4/9] Input: apple_z2: Add the iPhone 5s touchscreen The iPhone 5s (N51 and N53) runs the iPhone 6's generation-1 protocol. 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. Reuse the N61 variant and its SPI timings. Tested on an iPhone 5s (N51): multi-touch reports cover the panel in the right orientation. Assisted-by: LLM Signed-off-by: ashtonamory <287786029+ashtonamory@users.noreply.github.com> --- drivers/input/touchscreen/apple_z2.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/input/touchscreen/apple_z2.c b/drivers/input/touchscreen/apple_z2.c index 7bbda8df4ffb14..d051afa4933f94 100644 --- a/drivers/input/touchscreen/apple_z2.c +++ b/drivers/input/touchscreen/apple_z2.c @@ -6025,6 +6025,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 @@ -6578,6 +6593,7 @@ static const struct of_device_id apple_z2_of_match[] = { { .compatible = "apple,d20-touchscreen", .data = &apple_z2_iphone8_global_info }, { .compatible = "apple,d201-touchscreen", .data = &apple_z2_iphone8_gsm_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 }, @@ -6611,6 +6627,7 @@ static struct spi_device_id apple_z2_of_id[] = { { .name = "d20-touchscreen", .driver_data = (kernel_ulong_t)&apple_z2_iphone8_global_info }, { .name = "d201-touchscreen", .driver_data = (kernel_ulong_t)&apple_z2_iphone8_gsm_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 }, From 04a7697f24ceae05a5f70c25ccb2725f3cdfd157 Mon Sep 17 00:00:00 2001 From: ashtonamory <287786029+ashtonamory@users.noreply.github.com> Date: Thu, 3 Dec 2026 20:32:23 -0400 Subject: [PATCH 5/9] arm64: dts: apple: s5l8960x-5s: Add the touchscreen Describe the N1 on SPI1 from the N51 ADT (/arm-io/spi1/multi-touch): attention GPIO 22, reset GPIO 23, the PWM touch clock, the analog supply on the Chestnut display PMU (dpLE(0x302)) and the core supply on the D2045 (pmuL(0x20e)). N51 and N53 share their kernelcache, whose only 5s touch personality matches multi-touch,n51, and identical mtprops, so the node goes in the shared 5s dtsi. Tested on an iPhone 5s (N51). Assisted-by: LLM Signed-off-by: ashtonamory <287786029+ashtonamory@users.noreply.github.com> --- arch/arm64/boot/dts/apple/s5l8960x-5s.dtsi | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/arch/arm64/boot/dts/apple/s5l8960x-5s.dtsi b/arch/arm64/boot/dts/apple/s5l8960x-5s.dtsi index c0312ccbfc2622..1c5c913420b794 100644 --- a/arch/arm64/boot/dts/apple/s5l8960x-5s.dtsi +++ b/arch/arm64/boot/dts/apple/s5l8960x-5s.dtsi @@ -14,6 +14,10 @@ / { chassis-type = "handset"; + aliases { + touchscreen0 = &touchscreen; /* the loader copies the ADT calibration */ + }; + gpio-keys { compatible = "gpio-keys"; @@ -89,6 +93,53 @@ }; }; }; + + /* 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>; }; }; From f9d43da6a11c3270129ac55a978077fa3073ffeb Mon Sep 17 00:00:00 2001 From: ashtonamory <287786029+ashtonamory@users.noreply.github.com> Date: Fri, 4 Dec 2026 06:26:37 -0400 Subject: [PATCH 6/9] dt-bindings: usb: apple,s5l8960x-hsic-wlan: Describe the reset and radio identity The iPhone 5s puts its HSIC radio's reset on another PMIC and line than the A7 iPads, and its boot ROM is another chip with another USB product ID. Add apple,pmu-reset, apple,rom-chip and apple,usb-pid; without them the iPads' values apply. Assisted-by: LLM Signed-off-by: ashtonamory <287786029+ashtonamory@users.noreply.github.com> --- .../usb/apple,s5l8960x-hsic-wlan.yaml | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Documentation/devicetree/bindings/usb/apple,s5l8960x-hsic-wlan.yaml b/Documentation/devicetree/bindings/usb/apple,s5l8960x-hsic-wlan.yaml index ed0ac5230e7d9a..14c95cbadd8c75 100644 --- a/Documentation/devicetree/bindings/usb/apple,s5l8960x-hsic-wlan.yaml +++ b/Documentation/devicetree/bindings/usb/apple,s5l8960x-hsic-wlan.yaml @@ -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 From c4460a993969d6850bd5e1286f18b3fbb19f18f3 Mon Sep 17 00:00:00 2001 From: ashtonamory <287786029+ashtonamory@users.noreply.github.com> Date: Fri, 4 Dec 2026 06:26:37 -0400 Subject: [PATCH 7/9] usb: host: apple-a7-wlan: Take the reset and radio identity from the device tree The reset was GPIO 3 of the D2089 at I2C 0x3c and the boot ROM 0a5c:bd1c reporting chip 0x4324, as on every A7 iPad. The iPhone 5s resets its BCM43342 with GPIO 10 of the D2045 at 0x74, and its ROM is 0a5c:bd21, chip 0xa94e. Read apple,pmu-reset, apple,rom-chip and apple,usb-pid, keeping the iPads' values as defaults. iOS's D2045 and D2089 drivers both configure PMU GPIO n at register 0x400 | n (n <= 15); the 5s reset reads the same 0x09 baseline, so the measured 09/0b/09 sequence and its gates are unchanged. Tested on an iPhone 5s (N51): the radio enumerates and its ROM reports a94e rev 1, 0x80000 bytes at 0x60000000. Assisted-by: LLM Signed-off-by: ashtonamory <287786029+ashtonamory@users.noreply.github.com> --- drivers/usb/host/apple-a7-wlan.c | 63 ++++++++++++++++++++++++-------- 1 file changed, 47 insertions(+), 16 deletions(-) diff --git a/drivers/usb/host/apple-a7-wlan.c b/drivers/usb/host/apple-a7-wlan.c index 8542168c76ae08..f1ec03dedba3c7 100644 --- a/drivers/usb/host/apple-a7-wlan.c +++ b/drivers/usb/host/apple-a7-wlan.c @@ -45,7 +45,14 @@ #define PMGR_BASE 0x20e000000ULL #define USB_COMPLEX 0x20c900000ULL /* ADT usb-complex reg, usb_widget at +1c/3c/5c/7c */ #define GPIO_BASE 0x20e300000ULL -#define PMU_GPIO3 0x403 /* D2089 GPIO3 configuration: radio reset */ +/* The iPads' radio reset: D2089 (pmic@3c) GPIO3. A board names another with + * apple,pmu-reset = <&pmic LINE>; Apple's D2045 and D2089 drivers both + * configure GPIO n at register 0x400 | n (n <= 15). + */ +#define PMU_GPIO_BASE 0x400 +#define PMU_GPIO_LINES 16 +#define J72_PMU_PATH "/soc/i2c@20a110000/pmic@3c" +#define J72_PMU_LINE 3 /* The BCM43241 boot ROM: AppleBCMWLANBusInterfaceHSICShim's "4324" personality */ #define RADIO_PID 0xbd1c @@ -74,6 +81,9 @@ struct a7_wlan_board { unsigned int port; /* EHCI root port of the radio */ u32 host_ready_gpio, device_ready_gpio; u16 usb_pid; /* 0a5c:xxxx boot ROM identity */ + u32 rom_chip; /* the boot ROM's chip ID (apple,rom-chip) */ + struct device_node *pmu_np; /* the PMIC holding the radio reset */ + u32 pmu_reg; /* its GPIO configuration register */ }; static struct a7_wlan_board radio; @@ -192,21 +202,18 @@ static int ready_window(void __iomem *gpio, u32 expected_host, u32 *samples, u32 static int exact_pmic(struct device *dev, const void *expected) { struct i2c_client *client = i2c_verify_client(dev); - return client && client->addr == 0x3c && dev->of_node == expected && - of_device_is_compatible(dev->of_node, "apple,anya-pmic"); + return client && dev->of_node == expected && + of_device_is_compatible(dev->of_node, "apple,i2c-pmic"); } static int acquire_pmu(void) { - struct device_node *node = of_find_node_by_path("/soc/i2c@20a110000/pmic@3c"); - if (!node) return -ENODEV; - pmic = bus_find_device(&i2c_bus_type, NULL, node, exact_pmic); - of_node_put(node); + pmic = bus_find_device(&i2c_bus_type, NULL, board->pmu_np, exact_pmic); if (!pmic) return -ENODEV; pmu_map = dev_get_regmap(pmic, NULL); if (!pmic->driver || !pmu_map || regmap_get_val_bytes(pmu_map) != 1) return -ENODEV; - return regmap_read_bypassed(pmu_map, PMU_GPIO3, &pmu_before); + return regmap_read_bypassed(pmu_map, board->pmu_reg, &pmu_before); } module_param(confirm_native, bool, 0400); @@ -376,9 +383,9 @@ static bool rom_identity_ok(void) if (rom_result || radio_vid != 0x0a5c || radio_pid != board->usb_pid) return false; /* The ADT names the chipset ('wifi-chipset' 4324); the rest is J72's. */ - if (rom_words[0] != J72_ROM_CHIP) { - pr_warn(DRV_NAME ": %s ROM chip %04x is not the ADT 4324\n", - board->name, rom_words[0]); + if (rom_words[0] != board->rom_chip) { + pr_warn(DRV_NAME ": %s ROM chip %04x is not the device tree's %04x\n", + board->name, rom_words[0], board->rom_chip); return false; } observe("ROM revision", rom_words[1], J72_ROM_REV); @@ -428,7 +435,31 @@ static int radio_from_dt(void) radio.phy_base = phy_res.start; radio.ehci_base = ehci_res.start; radio.ehci_irq = cell[1]; + /* The boot ROM's USB product ID: bd1c on the iPads, bd21 on the 5s. */ radio.usb_pid = RADIO_PID; + if (!of_property_read_u32(node, "apple,usb-pid", &cell[0])) { + if (!cell[0] || cell[0] > 0xffff) + goto out; + radio.usb_pid = cell[0]; + } + /* The ADT's 'wifi-chipset': 4324 on the iPads, 43342 on the iPhone 5s. */ + radio.rom_chip = J72_ROM_CHIP; + of_property_read_u32(node, "apple,rom-chip", &radio.rom_chip); + if (of_property_present(node, "apple,pmu-reset")) { + struct of_phandle_args reset; + + if (of_parse_phandle_with_fixed_args(node, "apple,pmu-reset", 1, 0, &reset)) + goto out; + radio.pmu_np = reset.np; + if (reset.args[0] >= PMU_GPIO_LINES) + goto out; + radio.pmu_reg = PMU_GPIO_BASE | reset.args[0]; + } else { + radio.pmu_np = of_find_node_by_path(J72_PMU_PATH); + radio.pmu_reg = PMU_GPIO_BASE | J72_PMU_LINE; + } + if (!radio.pmu_np) + goto out; ret = 0; out: of_node_put(node); @@ -545,7 +576,7 @@ static int __init observer_init(void) host_ready_before = host_ready_reg(gpio); device_ready_before = readl(gpio + board->device_ready_gpio * 4); /* The reset write 0b is only known from the 09 baseline. */ - if (!gate("PMU GPIO3", pmu_before, J72_PMU_RESET) || + if (!gate("PMU reset", pmu_before, J72_PMU_RESET) || !observe("HOST_READY config", host_ready_before, J72_HOST_READY_CFG) || !observe("DEVICE_READY config", device_ready_before & ~1U, J72_DEVICE_READY_CFG)) { result = -EPROTO; @@ -618,9 +649,9 @@ static int __init observer_init(void) /* Known full byte avoids consulting a potentially cached RMW value. * Exact native function yields0b from our required raw baseline09. */ - result = regmap_write(pmu_map, PMU_GPIO3, 0x0b); + result = regmap_write(pmu_map, board->pmu_reg, 0x0b); if (result) goto cleanup; - result = regmap_read_bypassed(pmu_map, PMU_GPIO3, &pmu_released); + result = regmap_read_bypassed(pmu_map, board->pmu_reg, &pmu_released); if (result) goto cleanup; if (pmu_released != 0x0b) { result = -EIO; @@ -704,8 +735,8 @@ static int cleanup_session(void) goto out; } if (reset_touched) { - int reset_ret = regmap_write(pmu_map, PMU_GPIO3, pmu_before); - int read_ret = regmap_read_bypassed(pmu_map, PMU_GPIO3, &pmu_after); + int reset_ret = regmap_write(pmu_map, board->pmu_reg, pmu_before); + int read_ret = regmap_read_bypassed(pmu_map, board->pmu_reg, &pmu_after); reset_restored = !reset_ret && !read_ret && pmu_after == pmu_before; if (!reset_restored) { result = -EIO; From 0b31d0151db1f564bc5b4d05fa653891756e3612 Mon Sep 17 00:00:00 2001 From: ashtonamory <287786029+ashtonamory@users.noreply.github.com> Date: Fri, 4 Dec 2026 06:26:38 -0400 Subject: [PATCH 8/9] wifi: brcmfmac: usb: Support the iPhone 5s BCM43342 on HSIC Look the HSIC radio up in a table of boot ROM chip IDs, firmware names and RAM bounds instead of assuming the BCM43241, add the BCM43342 (0a5c:bd21, ROM chip 43342) and name its firmware brcmfmac43342--usb. Tested on an iPhone 5s (N51): firmware 6.46.79 starts and a scan finds 2.4 and 5 GHz networks. Assisted-by: LLM Signed-off-by: ashtonamory <287786029+ashtonamory@users.noreply.github.com> --- .../broadcom/brcm80211/brcmfmac/usb.c | 50 +++++++++++++++---- .../broadcom/brcm80211/include/brcm_hw_ids.h | 1 + 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c index d472ac847a52de..4b6ce21ba4c0a9 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c @@ -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--usb.bin, where + * the module NVRAM of that board: brcm/brcmfmac--usb.bin, where * 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 @@ -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 */ @@ -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; @@ -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); @@ -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; @@ -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) { @@ -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); @@ -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, @@ -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) { @@ -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) }, diff --git a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h index 91ac4371c90d52..2198a27241e4e1 100644 --- a/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h +++ b/drivers/net/wireless/broadcom/brcm80211/include/brcm_hw_ids.h @@ -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 From 4ac10bc72c24e59756cfffdd8eccf8180d198353 Mon Sep 17 00:00:00 2001 From: ashtonamory <287786029+ashtonamory@users.noreply.github.com> Date: Fri, 4 Dec 2026 06:26:38 -0400 Subject: [PATCH 9/9] arm64: dts: apple: s5l8960x-5s: Add the Wi-Fi radio The N51 ADT puts the BCM43342 (module chardonnay, wifi-chipset 43342) on EHCI1 port 1 with 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. Tested on an iPhone 5s (N51). Assisted-by: LLM Signed-off-by: ashtonamory <287786029+ashtonamory@users.noreply.github.com> --- arch/arm64/boot/dts/apple/s5l8960x-5s.dtsi | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/apple/s5l8960x-5s.dtsi b/arch/arm64/boot/dts/apple/s5l8960x-5s.dtsi index 1c5c913420b794..d3743686daae6f 100644 --- a/arch/arm64/boot/dts/apple/s5l8960x-5s.dtsi +++ b/arch/arm64/boot/dts/apple/s5l8960x-5s.dtsi @@ -66,7 +66,7 @@ &i2c0 { status = "okay"; - pmic@74 { + pmu: pmic@74 { compatible = "apple,amber-pmic", "apple,i2c-pmic"; reg = <0x74>; #address-cells = <1>; @@ -143,6 +143,32 @@ }; }; +/ { + /* + * 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 = ; + 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>; + }; +}; + /* The boot loader set up the display; nothing restores it after power loss. */ &ps_disp0 { apple,always-on;