Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'staging-4.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging driver fixes from Greg KH:
"Here are a number of staging driver fixes for 4.12-rc2

Most of them are typec driver fixes found by reviewers and users of
the code. There are also some removals of files no longer needed in
the tree due to the ion driver rewrite in 4.12-rc1, as well as some
wifi driver fixes. And to round it out, a MAINTAINERS file update.

All have been in linux-next with no reported issues"

* tag 'staging-4.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (22 commits)
MAINTAINERS: greybus-dev list is members-only
staging: fsl-dpaa2/eth: add ETHERNET dependency
staging: typec: fusb302: refactor resume retry mechanism
staging: typec: fusb302: reset i2c_busy state in error
staging: rtl8723bs: remove re-positioned call to kfree in os_dep/ioctl_cfg80211.c
staging: rtl8192e: GetTs Fix invalid TID 7 warning.
staging: rtl8192e: rtl92e_get_eeprom_size Fix read size of EPROM_CMD.
staging: rtl8192e: fix 2 byte alignment of register BSSIDR.
staging: rtl8192e: rtl92e_fill_tx_desc fix write to mapped out memory.
staging: vc04_services: Fix bulk cache maintenance
staging: ccree: remove extraneous spin_unlock_bh() in error handler
staging: typec: Fix sparse warnings about incorrect types
staging: typec: fusb302: do not free gpio from managed resource
staging: typec: tcpm: Fix Port Power Role field in PS_RDY messages
staging: typec: tcpm: Respond to Discover Identity commands
staging: typec: tcpm: Set correct flags in PD request messages
staging: typec: tcpm: Drop duplicate PD messages
staging: typec: fusb302: Fix chip->vbus_present init value
staging: typec: fusb302: Fix module autoload
staging: typec: tcpci: declare private structure as static
...

+185 -167
-31
Documentation/devicetree/bindings/staging/ion/hi6220-ion.txt
··· 1 - Hi6220 SoC ION 2 - =================================================================== 3 - Required properties: 4 - - compatible : "hisilicon,hi6220-ion" 5 - - list of the ION heaps 6 - - heap name : maybe heap_sys_user@0 7 - - heap id : id should be unique in the system. 8 - - heap base : base ddr address of the heap,0 means that 9 - it is dynamic. 10 - - heap size : memory size and 0 means it is dynamic. 11 - - heap type : the heap type of the heap, please also 12 - see the define in ion.h(drivers/staging/android/uapi/ion.h) 13 - ------------------------------------------------------------------- 14 - Example: 15 - hi6220-ion { 16 - compatible = "hisilicon,hi6220-ion"; 17 - heap_sys_user@0 { 18 - heap-name = "sys_user"; 19 - heap-id = <0x0>; 20 - heap-base = <0x0>; 21 - heap-size = <0x0>; 22 - heap-type = "ion_system"; 23 - }; 24 - heap_sys_contig@0 { 25 - heap-name = "sys_contig"; 26 - heap-id = <0x1>; 27 - heap-base = <0x0>; 28 - heap-size = <0x0>; 29 - heap-type = "ion_system_contig"; 30 - }; 31 - };
+9 -2
MAINTAINERS
··· 846 846 M: Sumit Semwal <sumit.semwal@linaro.org> 847 847 L: devel@driverdev.osuosl.org 848 848 S: Supported 849 - F: Documentation/devicetree/bindings/staging/ion/ 850 849 F: drivers/staging/android/ion 851 850 F: drivers/staging/android/uapi/ion.h 852 851 F: drivers/staging/android/uapi/ion_test.h ··· 3114 3115 F: drivers/net/ieee802154/cc2520.c 3115 3116 F: include/linux/spi/cc2520.h 3116 3117 F: Documentation/devicetree/bindings/net/ieee802154/cc2520.txt 3118 + 3119 + CCREE ARM TRUSTZONE CRYPTOCELL 700 REE DRIVER 3120 + M: Gilad Ben-Yossef <gilad@benyossef.com> 3121 + L: linux-crypto@vger.kernel.org 3122 + L: driverdev-devel@linuxdriverproject.org 3123 + S: Supported 3124 + F: drivers/staging/ccree/ 3125 + W: https://developer.arm.com/products/system-ip/trustzone-cryptocell/cryptocell-700-family 3117 3126 3118 3127 CEC FRAMEWORK 3119 3128 M: Hans Verkuil <hans.verkuil@cisco.com> ··· 5702 5695 M: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 5703 5696 S: Maintained 5704 5697 F: drivers/staging/greybus/ 5705 - L: greybus-dev@lists.linaro.org 5698 + L: greybus-dev@lists.linaro.org (moderated for non-subscribers) 5706 5699 5707 5700 GREYBUS AUDIO PROTOCOLS DRIVERS 5708 5701 M: Vaibhav Agarwal <vaibhav.sr@gmail.com>
-51
drivers/staging/android/ion/devicetree.txt
··· 1 - Ion Memory Manager 2 - 3 - Ion is a memory manager that allows for sharing of buffers via dma-buf. 4 - Ion allows for different types of allocation via an abstraction called 5 - a 'heap'. A heap represents a specific type of memory. Each heap has 6 - a different type. There can be multiple instances of the same heap 7 - type. 8 - 9 - Specific heap instances are tied to heap IDs. Heap IDs are not to be specified 10 - in the devicetree. 11 - 12 - Required properties for Ion 13 - 14 - - compatible: "linux,ion" PLUS a compatible property for the device 15 - 16 - All child nodes of a linux,ion node are interpreted as heaps 17 - 18 - required properties for heaps 19 - 20 - - compatible: compatible string for a heap type PLUS a compatible property 21 - for the specific instance of the heap. Current heap types 22 - -- linux,ion-heap-system 23 - -- linux,ion-heap-system-contig 24 - -- linux,ion-heap-carveout 25 - -- linux,ion-heap-chunk 26 - -- linux,ion-heap-dma 27 - -- linux,ion-heap-custom 28 - 29 - Optional properties 30 - - memory-region: A phandle to a memory region. Required for DMA heap type 31 - (see reserved-memory.txt for details on the reservation) 32 - 33 - Example: 34 - 35 - ion { 36 - compatbile = "hisilicon,ion", "linux,ion"; 37 - 38 - ion-system-heap { 39 - compatbile = "hisilicon,system-heap", "linux,ion-heap-system" 40 - }; 41 - 42 - ion-camera-region { 43 - compatible = "hisilicon,camera-heap", "linux,ion-heap-dma" 44 - memory-region = <&camera_region>; 45 - }; 46 - 47 - ion-fb-region { 48 - compatbile = "hisilicon,fb-heap", "linux,ion-heap-dma" 49 - memory-region = <&fb_region>; 50 - }; 51 - }
-1
drivers/staging/ccree/ssi_request_mgr.c
··· 376 376 rc = ssi_power_mgr_runtime_get(&drvdata->plat_dev->dev); 377 377 if (rc != 0) { 378 378 SSI_LOG_ERR("ssi_power_mgr_runtime_get returned %x\n",rc); 379 - spin_unlock_bh(&req_mgr_h->hw_lock); 380 379 return rc; 381 380 } 382 381 #endif
+1
drivers/staging/fsl-dpaa2/Kconfig
··· 12 12 config FSL_DPAA2_ETH 13 13 tristate "Freescale DPAA2 Ethernet" 14 14 depends on FSL_DPAA2 && FSL_MC_DPIO 15 + depends on NETDEVICES && ETHERNET 15 16 ---help--- 16 17 Ethernet driver for Freescale DPAA2 SoCs, using the 17 18 Freescale MC bus driver
+15 -9
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
··· 97 97 98 98 switch (variable) { 99 99 case HW_VAR_BSSID: 100 - rtl92e_writel(dev, BSSIDR, ((u32 *)(val))[0]); 101 - rtl92e_writew(dev, BSSIDR+2, ((u16 *)(val+2))[0]); 100 + /* BSSIDR 2 byte alignment */ 101 + rtl92e_writew(dev, BSSIDR, *(u16 *)val); 102 + rtl92e_writel(dev, BSSIDR + 2, *(u32 *)(val + 2)); 102 103 break; 103 104 104 105 case HW_VAR_MEDIA_STATUS: ··· 625 624 struct r8192_priv *priv = rtllib_priv(dev); 626 625 627 626 RT_TRACE(COMP_INIT, "===========>%s()\n", __func__); 628 - curCR = rtl92e_readl(dev, EPROM_CMD); 627 + curCR = rtl92e_readw(dev, EPROM_CMD); 629 628 RT_TRACE(COMP_INIT, "read from Reg Cmd9346CR(%x):%x\n", EPROM_CMD, 630 629 curCR); 631 630 priv->epromtype = (curCR & EPROM_CMD_9356SEL) ? EEPROM_93C56 : ··· 962 961 rtl92e_config_rate(dev, &rate_config); 963 962 priv->dot11CurrentPreambleMode = PREAMBLE_AUTO; 964 963 priv->basic_rate = rate_config &= 0x15f; 965 - rtl92e_writel(dev, BSSIDR, ((u32 *)net->bssid)[0]); 966 - rtl92e_writew(dev, BSSIDR+4, ((u16 *)net->bssid)[2]); 964 + rtl92e_writew(dev, BSSIDR, *(u16 *)net->bssid); 965 + rtl92e_writel(dev, BSSIDR + 2, *(u32 *)(net->bssid + 2)); 967 966 968 967 if (priv->rtllib->iw_mode == IW_MODE_ADHOC) { 969 968 rtl92e_writew(dev, ATIMWND, 2); ··· 1183 1182 struct cb_desc *cb_desc, struct sk_buff *skb) 1184 1183 { 1185 1184 struct r8192_priv *priv = rtllib_priv(dev); 1186 - dma_addr_t mapping = pci_map_single(priv->pdev, skb->data, skb->len, 1187 - PCI_DMA_TODEVICE); 1185 + dma_addr_t mapping; 1188 1186 struct tx_fwinfo_8190pci *pTxFwInfo; 1189 1187 1190 1188 pTxFwInfo = (struct tx_fwinfo_8190pci *)skb->data; ··· 1194 1194 pTxFwInfo->Short = _rtl92e_query_is_short(pTxFwInfo->TxHT, 1195 1195 pTxFwInfo->TxRate, cb_desc); 1196 1196 1197 - if (pci_dma_mapping_error(priv->pdev, mapping)) 1198 - netdev_err(dev, "%s(): DMA Mapping error\n", __func__); 1199 1197 if (cb_desc->bAMPDUEnable) { 1200 1198 pTxFwInfo->AllowAggregation = 1; 1201 1199 pTxFwInfo->RxMF = cb_desc->ampdu_factor; ··· 1228 1230 } 1229 1231 1230 1232 memset((u8 *)pdesc, 0, 12); 1233 + 1234 + mapping = pci_map_single(priv->pdev, skb->data, skb->len, 1235 + PCI_DMA_TODEVICE); 1236 + if (pci_dma_mapping_error(priv->pdev, mapping)) { 1237 + netdev_err(dev, "%s(): DMA Mapping error\n", __func__); 1238 + return; 1239 + } 1240 + 1231 1241 pdesc->LINIP = 0; 1232 1242 pdesc->CmdInit = 1; 1233 1243 pdesc->Offset = sizeof(struct tx_fwinfo_8190pci) + 8;
+4 -11
drivers/staging/rtl8192e/rtl819x_TSProc.c
··· 306 306 pTsCommonInfo->TClasNum = TCLAS_Num; 307 307 } 308 308 309 - static bool IsACValid(unsigned int tid) 310 - { 311 - return tid < 7; 312 - } 313 - 314 309 bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS, 315 310 u8 *Addr, u8 TID, enum tr_select TxRxSelect, bool bAddNewTs) 316 311 { ··· 323 328 if (ieee->current_network.qos_data.supported == 0) { 324 329 UP = 0; 325 330 } else { 326 - if (!IsACValid(TID)) { 327 - netdev_warn(ieee->dev, "%s(): TID(%d) is not valid\n", 328 - __func__, TID); 329 - return false; 330 - } 331 - 332 331 switch (TID) { 333 332 case 0: 334 333 case 3: ··· 340 351 case 7: 341 352 UP = 7; 342 353 break; 354 + default: 355 + netdev_warn(ieee->dev, "%s(): TID(%d) is not valid\n", 356 + __func__, TID); 357 + return false; 343 358 } 344 359 } 345 360
-1
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
··· 3531 3531 pwdev_priv->power_mgmt = true; 3532 3532 else 3533 3533 pwdev_priv->power_mgmt = false; 3534 - kfree((u8 *)wdev); 3535 3534 3536 3535 return ret; 3537 3536
+47 -43
drivers/staging/typec/fusb302/fusb302.c
··· 264 264 265 265 #define FUSB302_RESUME_RETRY 10 266 266 #define FUSB302_RESUME_RETRY_SLEEP 50 267 + 268 + static bool fusb302_is_suspended(struct fusb302_chip *chip) 269 + { 270 + int retry_cnt; 271 + 272 + for (retry_cnt = 0; retry_cnt < FUSB302_RESUME_RETRY; retry_cnt++) { 273 + if (atomic_read(&chip->pm_suspend)) { 274 + dev_err(chip->dev, "i2c: pm suspend, retry %d/%d\n", 275 + retry_cnt + 1, FUSB302_RESUME_RETRY); 276 + msleep(FUSB302_RESUME_RETRY_SLEEP); 277 + } else { 278 + return false; 279 + } 280 + } 281 + 282 + return true; 283 + } 284 + 267 285 static int fusb302_i2c_write(struct fusb302_chip *chip, 268 286 u8 address, u8 data) 269 287 { 270 - int retry_cnt; 271 288 int ret = 0; 272 289 273 290 atomic_set(&chip->i2c_busy, 1); 274 - for (retry_cnt = 0; retry_cnt < FUSB302_RESUME_RETRY; retry_cnt++) { 275 - if (atomic_read(&chip->pm_suspend)) { 276 - pr_err("fusb302_i2c: pm suspend, retry %d/%d\n", 277 - retry_cnt + 1, FUSB302_RESUME_RETRY); 278 - msleep(FUSB302_RESUME_RETRY_SLEEP); 279 - } else { 280 - break; 281 - } 291 + 292 + if (fusb302_is_suspended(chip)) { 293 + atomic_set(&chip->i2c_busy, 0); 294 + return -ETIMEDOUT; 282 295 } 296 + 283 297 ret = i2c_smbus_write_byte_data(chip->i2c_client, address, data); 284 298 if (ret < 0) 285 299 fusb302_log(chip, "cannot write 0x%02x to 0x%02x, ret=%d", ··· 306 292 static int fusb302_i2c_block_write(struct fusb302_chip *chip, u8 address, 307 293 u8 length, const u8 *data) 308 294 { 309 - int retry_cnt; 310 295 int ret = 0; 311 296 312 297 if (length <= 0) 313 298 return ret; 314 299 atomic_set(&chip->i2c_busy, 1); 315 - for (retry_cnt = 0; retry_cnt < FUSB302_RESUME_RETRY; retry_cnt++) { 316 - if (atomic_read(&chip->pm_suspend)) { 317 - pr_err("fusb302_i2c: pm suspend, retry %d/%d\n", 318 - retry_cnt + 1, FUSB302_RESUME_RETRY); 319 - msleep(FUSB302_RESUME_RETRY_SLEEP); 320 - } else { 321 - break; 322 - } 300 + 301 + if (fusb302_is_suspended(chip)) { 302 + atomic_set(&chip->i2c_busy, 0); 303 + return -ETIMEDOUT; 323 304 } 305 + 324 306 ret = i2c_smbus_write_i2c_block_data(chip->i2c_client, address, 325 307 length, data); 326 308 if (ret < 0) ··· 330 320 static int fusb302_i2c_read(struct fusb302_chip *chip, 331 321 u8 address, u8 *data) 332 322 { 333 - int retry_cnt; 334 323 int ret = 0; 335 324 336 325 atomic_set(&chip->i2c_busy, 1); 337 - for (retry_cnt = 0; retry_cnt < FUSB302_RESUME_RETRY; retry_cnt++) { 338 - if (atomic_read(&chip->pm_suspend)) { 339 - pr_err("fusb302_i2c: pm suspend, retry %d/%d\n", 340 - retry_cnt + 1, FUSB302_RESUME_RETRY); 341 - msleep(FUSB302_RESUME_RETRY_SLEEP); 342 - } else { 343 - break; 344 - } 326 + 327 + if (fusb302_is_suspended(chip)) { 328 + atomic_set(&chip->i2c_busy, 0); 329 + return -ETIMEDOUT; 345 330 } 331 + 346 332 ret = i2c_smbus_read_byte_data(chip->i2c_client, address); 347 333 *data = (u8)ret; 348 334 if (ret < 0) ··· 351 345 static int fusb302_i2c_block_read(struct fusb302_chip *chip, u8 address, 352 346 u8 length, u8 *data) 353 347 { 354 - int retry_cnt; 355 348 int ret = 0; 356 349 357 350 if (length <= 0) 358 351 return ret; 359 352 atomic_set(&chip->i2c_busy, 1); 360 - for (retry_cnt = 0; retry_cnt < FUSB302_RESUME_RETRY; retry_cnt++) { 361 - if (atomic_read(&chip->pm_suspend)) { 362 - pr_err("fusb302_i2c: pm suspend, retry %d/%d\n", 363 - retry_cnt + 1, FUSB302_RESUME_RETRY); 364 - msleep(FUSB302_RESUME_RETRY_SLEEP); 365 - } else { 366 - break; 367 - } 353 + 354 + if (fusb302_is_suspended(chip)) { 355 + atomic_set(&chip->i2c_busy, 0); 356 + return -ETIMEDOUT; 368 357 } 358 + 369 359 ret = i2c_smbus_read_i2c_block_data(chip->i2c_client, address, 370 360 length, data); 371 361 if (ret < 0) { 372 362 fusb302_log(chip, "cannot block read 0x%02x, len=%d, ret=%d", 373 363 address, length, ret); 374 - return ret; 364 + goto done; 375 365 } 376 366 if (ret != length) { 377 367 fusb302_log(chip, "only read %d/%d bytes from 0x%02x", 378 368 ret, length, address); 379 - return -EIO; 369 + ret = -EIO; 380 370 } 371 + 372 + done: 381 373 atomic_set(&chip->i2c_busy, 0); 382 374 383 375 return ret; ··· 493 489 ret = fusb302_i2c_read(chip, FUSB_REG_STATUS0, &data); 494 490 if (ret < 0) 495 491 return ret; 496 - chip->vbus_present = !!(FUSB_REG_STATUS0 & FUSB_REG_STATUS0_VBUSOK); 492 + chip->vbus_present = !!(data & FUSB_REG_STATUS0_VBUSOK); 497 493 ret = fusb302_i2c_read(chip, FUSB_REG_DEVICE_ID, &data); 498 494 if (ret < 0) 499 495 return ret; ··· 1029 1025 buf[pos++] = FUSB302_TKN_SYNC1; 1030 1026 buf[pos++] = FUSB302_TKN_SYNC2; 1031 1027 1032 - len = pd_header_cnt(msg->header) * 4; 1028 + len = pd_header_cnt_le(msg->header) * 4; 1033 1029 /* plug 2 for header */ 1034 1030 len += 2; 1035 1031 if (len > 0x1F) { ··· 1485 1481 (u8 *)&msg->header); 1486 1482 if (ret < 0) 1487 1483 return ret; 1488 - len = pd_header_cnt(msg->header) * 4; 1484 + len = pd_header_cnt_le(msg->header) * 4; 1489 1485 /* add 4 to length to include the CRC */ 1490 1486 if (len > PD_MAX_PAYLOAD * 4) { 1491 1487 fusb302_log(chip, "PD message too long %d", len); ··· 1667 1663 if (ret < 0) { 1668 1664 fusb302_log(chip, 1669 1665 "cannot set GPIO Int_N to input, ret=%d", ret); 1670 - gpio_free(chip->gpio_int_n); 1671 1666 return ret; 1672 1667 } 1673 1668 ret = gpio_to_irq(chip->gpio_int_n); 1674 1669 if (ret < 0) { 1675 1670 fusb302_log(chip, 1676 1671 "cannot request IRQ for GPIO Int_N, ret=%d", ret); 1677 - gpio_free(chip->gpio_int_n); 1678 1672 return ret; 1679 1673 } 1680 1674 chip->gpio_int_n_irq = ret; ··· 1789 1787 {.compatible = "fcs,fusb302"}, 1790 1788 {}, 1791 1789 }; 1790 + MODULE_DEVICE_TABLE(of, fusb302_dt_match); 1792 1791 1793 1792 static const struct i2c_device_id fusb302_i2c_device_id[] = { 1794 1793 {"typec_fusb302", 0}, 1795 1794 {}, 1796 1795 }; 1796 + MODULE_DEVICE_TABLE(i2c, fusb302_i2c_device_id); 1797 1797 1798 1798 static const struct dev_pm_ops fusb302_pm_ops = { 1799 1799 .suspend = fusb302_pm_suspend,
+10
drivers/staging/typec/pd.h
··· 92 92 return pd_header_type(le16_to_cpu(header)); 93 93 } 94 94 95 + static inline unsigned int pd_header_msgid(u16 header) 96 + { 97 + return (header >> PD_HEADER_ID_SHIFT) & PD_HEADER_ID_MASK; 98 + } 99 + 100 + static inline unsigned int pd_header_msgid_le(__le16 header) 101 + { 102 + return pd_header_msgid(le16_to_cpu(header)); 103 + } 104 + 95 105 #define PD_MAX_PAYLOAD 7 96 106 97 107 struct pd_message {
+3 -1
drivers/staging/typec/pd_vdo.h
··· 22 22 * VDM object is minimum of VDM header + 6 additional data objects. 23 23 */ 24 24 25 + #define VDO_MAX_OBJECTS 6 26 + #define VDO_MAX_SIZE (VDO_MAX_OBJECTS + 1) 27 + 25 28 /* 26 29 * VDM header 27 30 * ---------- ··· 37 34 * <5> :: reserved (SVDM), command type (UVDM) 38 35 * <4:0> :: command 39 36 */ 40 - #define VDO_MAX_SIZE 7 41 37 #define VDO(vid, type, custom) \ 42 38 (((vid) << 16) | \ 43 39 ((type) << 15) | \
+1 -1
drivers/staging/typec/tcpci.c
··· 425 425 .max_register = 0x7F, /* 0x80 .. 0xFF are vendor defined */ 426 426 }; 427 427 428 - const struct tcpc_config tcpci_tcpc_config = { 428 + static const struct tcpc_config tcpci_tcpc_config = { 429 429 .type = TYPEC_PORT_DFP, 430 430 .default_role = TYPEC_SINK, 431 431 };
+73 -4
drivers/staging/typec/tcpm.c
··· 238 238 unsigned int hard_reset_count; 239 239 bool pd_capable; 240 240 bool explicit_contract; 241 + unsigned int rx_msgid; 241 242 242 243 /* Partner capabilities/requests */ 243 244 u32 sink_request; ··· 252 251 unsigned int nr_src_pdo; 253 252 u32 snk_pdo[PDO_MAX_OBJECTS]; 254 253 unsigned int nr_snk_pdo; 254 + u32 snk_vdo[VDO_MAX_OBJECTS]; 255 + unsigned int nr_snk_vdo; 255 256 256 257 unsigned int max_snk_mv; 257 258 unsigned int max_snk_ma; ··· 1000 997 struct pd_mode_data *modep; 1001 998 int rlen = 0; 1002 999 u16 svid; 1000 + int i; 1003 1001 1004 1002 tcpm_log(port, "Rx VDM cmd 0x%x type %d cmd %d len %d", 1005 1003 p0, cmd_type, cmd, cnt); ··· 1011 1007 case CMDT_INIT: 1012 1008 switch (cmd) { 1013 1009 case CMD_DISCOVER_IDENT: 1010 + /* 6.4.4.3.1: Only respond as UFP (device) */ 1011 + if (port->data_role == TYPEC_DEVICE && 1012 + port->nr_snk_vdo) { 1013 + for (i = 0; i < port->nr_snk_vdo; i++) 1014 + response[i + 1] 1015 + = cpu_to_le32(port->snk_vdo[i]); 1016 + rlen = port->nr_snk_vdo + 1; 1017 + } 1014 1018 break; 1015 1019 case CMD_DISCOVER_SVID: 1016 1020 break; ··· 1427 1415 break; 1428 1416 case SOFT_RESET_SEND: 1429 1417 port->message_id = 0; 1418 + port->rx_msgid = -1; 1430 1419 if (port->pwr_role == TYPEC_SOURCE) 1431 1420 next_state = SRC_SEND_CAPABILITIES; 1432 1421 else ··· 1516 1503 port->attached); 1517 1504 1518 1505 if (port->attached) { 1506 + enum pd_ctrl_msg_type type = pd_header_type_le(msg->header); 1507 + unsigned int msgid = pd_header_msgid_le(msg->header); 1508 + 1509 + /* 1510 + * USB PD standard, 6.6.1.2: 1511 + * "... if MessageID value in a received Message is the 1512 + * same as the stored value, the receiver shall return a 1513 + * GoodCRC Message with that MessageID value and drop 1514 + * the Message (this is a retry of an already received 1515 + * Message). Note: this shall not apply to the Soft_Reset 1516 + * Message which always has a MessageID value of zero." 1517 + */ 1518 + if (msgid == port->rx_msgid && type != PD_CTRL_SOFT_RESET) 1519 + goto done; 1520 + port->rx_msgid = msgid; 1521 + 1519 1522 /* 1520 1523 * If both ends believe to be DFP/host, we have a data role 1521 1524 * mismatch. ··· 1549 1520 } 1550 1521 } 1551 1522 1523 + done: 1552 1524 mutex_unlock(&port->lock); 1553 1525 kfree(event); 1554 1526 } ··· 1749 1719 } 1750 1720 ma = min(ma, port->max_snk_ma); 1751 1721 1752 - /* XXX: Any other flags need to be set? */ 1753 - flags = 0; 1722 + flags = RDO_USB_COMM | RDO_NO_SUSPEND; 1754 1723 1755 1724 /* Set mismatch bit if offered power is less than operating power */ 1756 1725 mw = ma * mv / 1000; ··· 1986 1957 port->attached = false; 1987 1958 port->pd_capable = false; 1988 1959 1960 + /* 1961 + * First Rx ID should be 0; set this to a sentinel of -1 so that 1962 + * we can check tcpm_pd_rx_handler() if we had seen it before. 1963 + */ 1964 + port->rx_msgid = -1; 1965 + 1989 1966 port->tcpc->set_pd_rx(port->tcpc, false); 1990 1967 tcpm_init_vbus(port); /* also disables charging */ 1991 1968 tcpm_init_vconn(port); ··· 2205 2170 port->pwr_opmode = TYPEC_PWR_MODE_USB; 2206 2171 port->caps_count = 0; 2207 2172 port->message_id = 0; 2173 + port->rx_msgid = -1; 2208 2174 port->explicit_contract = false; 2209 2175 tcpm_set_state(port, SRC_SEND_CAPABILITIES, 0); 2210 2176 break; ··· 2365 2329 typec_set_pwr_opmode(port->typec_port, TYPEC_PWR_MODE_USB); 2366 2330 port->pwr_opmode = TYPEC_PWR_MODE_USB; 2367 2331 port->message_id = 0; 2332 + port->rx_msgid = -1; 2368 2333 port->explicit_contract = false; 2369 2334 tcpm_set_state(port, SNK_DISCOVERY, 0); 2370 2335 break; ··· 2533 2496 /* Soft_Reset states */ 2534 2497 case SOFT_RESET: 2535 2498 port->message_id = 0; 2499 + port->rx_msgid = -1; 2536 2500 tcpm_pd_send_control(port, PD_CTRL_ACCEPT); 2537 2501 if (port->pwr_role == TYPEC_SOURCE) 2538 2502 tcpm_set_state(port, SRC_SEND_CAPABILITIES, 0); ··· 2542 2504 break; 2543 2505 case SOFT_RESET_SEND: 2544 2506 port->message_id = 0; 2507 + port->rx_msgid = -1; 2545 2508 if (tcpm_pd_send_control(port, PD_CTRL_SOFT_RESET)) 2546 2509 tcpm_set_state_cond(port, hard_reset_state(port), 0); 2547 2510 else ··· 2607 2568 break; 2608 2569 case PR_SWAP_SRC_SNK_SOURCE_OFF: 2609 2570 tcpm_set_cc(port, TYPEC_CC_RD); 2571 + /* 2572 + * USB-PD standard, 6.2.1.4, Port Power Role: 2573 + * "During the Power Role Swap Sequence, for the initial Source 2574 + * Port, the Port Power Role field shall be set to Sink in the 2575 + * PS_RDY Message indicating that the initial Source’s power 2576 + * supply is turned off" 2577 + */ 2578 + tcpm_set_pwr_role(port, TYPEC_SINK); 2610 2579 if (tcpm_pd_send_control(port, PD_CTRL_PS_RDY)) { 2611 2580 tcpm_set_state(port, ERROR_RECOVERY, 0); 2612 2581 break; ··· 2622 2575 tcpm_set_state_cond(port, SNK_UNATTACHED, PD_T_PS_SOURCE_ON); 2623 2576 break; 2624 2577 case PR_SWAP_SRC_SNK_SINK_ON: 2625 - tcpm_set_pwr_role(port, TYPEC_SINK); 2626 2578 tcpm_swap_complete(port, 0); 2627 2579 tcpm_set_state(port, SNK_STARTUP, 0); 2628 2580 break; ··· 2633 2587 case PR_SWAP_SNK_SRC_SOURCE_ON: 2634 2588 tcpm_set_cc(port, tcpm_rp_cc(port)); 2635 2589 tcpm_set_vbus(port, true); 2636 - tcpm_pd_send_control(port, PD_CTRL_PS_RDY); 2590 + /* 2591 + * USB PD standard, 6.2.1.4: 2592 + * "Subsequent Messages initiated by the Policy Engine, 2593 + * such as the PS_RDY Message sent to indicate that Vbus 2594 + * is ready, will have the Port Power Role field set to 2595 + * Source." 2596 + */ 2637 2597 tcpm_set_pwr_role(port, TYPEC_SOURCE); 2598 + tcpm_pd_send_control(port, PD_CTRL_PS_RDY); 2638 2599 tcpm_swap_complete(port, 0); 2639 2600 tcpm_set_state(port, SRC_STARTUP, 0); 2640 2601 break; ··· 3345 3292 return nr_pdo; 3346 3293 } 3347 3294 3295 + static int tcpm_copy_vdos(u32 *dest_vdo, const u32 *src_vdo, 3296 + unsigned int nr_vdo) 3297 + { 3298 + unsigned int i; 3299 + 3300 + if (nr_vdo > VDO_MAX_OBJECTS) 3301 + nr_vdo = VDO_MAX_OBJECTS; 3302 + 3303 + for (i = 0; i < nr_vdo; i++) 3304 + dest_vdo[i] = src_vdo[i]; 3305 + 3306 + return nr_vdo; 3307 + } 3308 + 3348 3309 void tcpm_update_source_capabilities(struct tcpm_port *port, const u32 *pdo, 3349 3310 unsigned int nr_pdo) 3350 3311 { ··· 3449 3382 tcpc->config->nr_src_pdo); 3450 3383 port->nr_snk_pdo = tcpm_copy_pdos(port->snk_pdo, tcpc->config->snk_pdo, 3451 3384 tcpc->config->nr_snk_pdo); 3385 + port->nr_snk_vdo = tcpm_copy_vdos(port->snk_vdo, tcpc->config->snk_vdo, 3386 + tcpc->config->nr_snk_vdo); 3452 3387 3453 3388 port->max_snk_mv = tcpc->config->max_snk_mv; 3454 3389 port->max_snk_ma = tcpc->config->max_snk_ma;
+3
drivers/staging/typec/tcpm.h
··· 60 60 const u32 *snk_pdo; 61 61 unsigned int nr_snk_pdo; 62 62 63 + const u32 *snk_vdo; 64 + unsigned int nr_snk_vdo; 65 + 63 66 unsigned int max_snk_mv; 64 67 unsigned int max_snk_ma; 65 68 unsigned int max_snk_mw;
+19 -12
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
··· 502 502 */ 503 503 sg_init_table(scatterlist, num_pages); 504 504 /* Now set the pages for each scatterlist */ 505 - for (i = 0; i < num_pages; i++) 506 - sg_set_page(scatterlist + i, pages[i], PAGE_SIZE, 0); 505 + for (i = 0; i < num_pages; i++) { 506 + unsigned int len = PAGE_SIZE - offset; 507 + 508 + if (len > count) 509 + len = count; 510 + sg_set_page(scatterlist + i, pages[i], len, offset); 511 + offset = 0; 512 + count -= len; 513 + } 507 514 508 515 dma_buffers = dma_map_sg(g_dev, 509 516 scatterlist, ··· 531 524 u32 addr = sg_dma_address(sg); 532 525 533 526 /* Note: addrs is the address + page_count - 1 534 - * The firmware expects the block to be page 527 + * The firmware expects blocks after the first to be page- 535 528 * aligned and a multiple of the page size 536 529 */ 537 530 WARN_ON(len == 0); 538 - WARN_ON(len & ~PAGE_MASK); 539 - WARN_ON(addr & ~PAGE_MASK); 531 + WARN_ON(i && (i != (dma_buffers - 1)) && (len & ~PAGE_MASK)); 532 + WARN_ON(i && (addr & ~PAGE_MASK)); 540 533 if (k > 0 && 541 - ((addrs[k - 1] & PAGE_MASK) | 542 - ((addrs[k - 1] & ~PAGE_MASK) + 1) << PAGE_SHIFT) 543 - == addr) { 544 - addrs[k - 1] += (len >> PAGE_SHIFT); 545 - } else { 546 - addrs[k++] = addr | ((len >> PAGE_SHIFT) - 1); 547 - } 534 + ((addrs[k - 1] & PAGE_MASK) + 535 + (((addrs[k - 1] & ~PAGE_MASK) + 1) << PAGE_SHIFT)) 536 + == (addr & PAGE_MASK)) 537 + addrs[k - 1] += ((len + PAGE_SIZE - 1) >> PAGE_SHIFT); 538 + else 539 + addrs[k++] = (addr & PAGE_MASK) | 540 + (((len + PAGE_SIZE - 1) >> PAGE_SHIFT) - 1); 548 541 } 549 542 550 543 /* Partial cache lines (fragments) require special measures */