diff options
| -rw-r--r-- | arch/arm/boot/dts/qcom/sdm630-regulator.dtsi | 53 | ||||
| -rw-r--r-- | arch/arm/boot/dts/qcom/sdm660.dtsi | 1 | ||||
| -rw-r--r-- | arch/arm/boot/dts/qcom/vplatform-lfv-msm8996-ivi-la.dts | 17 | ||||
| -rw-r--r-- | drivers/gpu/drm/msm-hyp/msm_drv_hyp.h | 14 | ||||
| -rw-r--r-- | drivers/net/phy/mdio_device.c | 171 | ||||
| -rw-r--r-- | drivers/regulator/cprh-kbss-regulator.c | 2 | ||||
| -rw-r--r-- | drivers/soc/qcom/glink_spi_xprt.c | 33 | ||||
| -rw-r--r-- | fs/aio.c | 2 | ||||
| -rw-r--r-- | include/linux/mdio.h | 47 | ||||
| -rw-r--r-- | include/linux/phy.h | 3 |
10 files changed, 323 insertions, 20 deletions
diff --git a/arch/arm/boot/dts/qcom/sdm630-regulator.dtsi b/arch/arm/boot/dts/qcom/sdm630-regulator.dtsi index c4adcfe1bdfb..19b0b6a43a1e 100644 --- a/arch/arm/boot/dts/qcom/sdm630-regulator.dtsi +++ b/arch/arm/boot/dts/qcom/sdm630-regulator.dtsi @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -687,9 +687,9 @@ regulator-max-microvolt = <8>; qcom,cpr-fuse-corners = <3>; - qcom,cpr-fuse-combos = <24>; - qcom,cpr-speed-bins = <3>; - qcom,cpr-speed-bin-corners = <8 8 8>; + qcom,cpr-fuse-combos = <32>; + qcom,cpr-speed-bins = <4>; + qcom,cpr-speed-bin-corners = <8 8 8 8>; qcom,cpr-corners = <8>; qcom,cpr-corner-fmax-map = <2 4 8>; @@ -783,9 +783,9 @@ regulator-max-microvolt = <11>; qcom,cpr-fuse-corners = <5>; - qcom,cpr-fuse-combos = <24>; - qcom,cpr-speed-bins = <3>; - qcom,cpr-speed-bin-corners = <10 10 11>; + qcom,cpr-fuse-combos = <32>; + qcom,cpr-speed-bins = <4>; + qcom,cpr-speed-bin-corners = <10 10 11 10>; qcom,cpr-corners = /* Speed bin 0 */ <10 10 10 10 10 10 10 10>, @@ -794,7 +794,10 @@ <10 10 10 10 10 10 10 10>, /* Speed bin 2 */ - <11 11 11 11 11 11 11 11>; + <11 11 11 11 11 11 11 11>, + + /* Speed bin 3 */ + <10 10 10 10 10 10 10 10>; qcom,cpr-corner-fmax-map = /* Speed bin 0 */ @@ -804,7 +807,10 @@ <2 4 6 9 10>, /* Speed bin 2 */ - <2 4 6 9 11>; + <2 4 6 9 11>, + + /* Speed bin 3 */ + <2 4 6 9 10>; qcom,cpr-voltage-ceiling = /* Speed bin 0 */ @@ -820,7 +826,12 @@ /* Speed bin 2 */ <724000 724000 724000 788000 868000 868000 988000 988000 - 988000 1140000 1140000>; + 988000 1140000 1140000>, + + /* Speed bin 3 */ + <724000 724000 724000 788000 + 868000 868000 988000 988000 + 988000 1068000>; qcom,cpr-voltage-floor = /* Speed bin 0 */ @@ -836,7 +847,12 @@ /* Speed bin 2 */ <588000 588000 596000 652000 712000 712000 744000 784000 - 784000 844000 900000>; + 784000 844000 900000>, + + /* Speed bin 3 */ + <588000 588000 596000 652000 + 712000 712000 744000 784000 + 784000 844000>; qcom,corner-frequencies = /* Speed bin 0 */ @@ -855,7 +871,13 @@ <300000000 787200000 1113600000 1344000000 1516800000 1670400000 1881600000 2016000000 2150400000 - 2380800000 2515200000>; + 2380800000 2515200000>, + + /* Speed bin 3 */ + <300000000 787200000 1113600000 + 1344000000 1516800000 1670400000 + 1881600000 2016000000 2150400000 + 2208000000>; qcom,allow-voltage-interpolation; qcom,allow-quotient-interpolation; @@ -899,7 +921,12 @@ /* Speed bin 2 */ <40000 40000 40000 40000 40000 40000 40000 66000 - 66000 40000 40000>; + 66000 40000 40000>, + + /* Speed bin 3 */ + <40000 40000 40000 40000 + 40000 40000 40000 66000 + 66000 40000>; }; }; }; diff --git a/arch/arm/boot/dts/qcom/sdm660.dtsi b/arch/arm/boot/dts/qcom/sdm660.dtsi index 89763eb720e2..5161a9ef6d10 100644 --- a/arch/arm/boot/dts/qcom/sdm660.dtsi +++ b/arch/arm/boot/dts/qcom/sdm660.dtsi @@ -2101,6 +2101,7 @@ qcom,qdsp6v62-1-5; memory-region = <&modem_fw_mem>; qcom,mem-protect-id = <0xF>; + qcom,complete-ramdump; qcom,cx-ipeak-vote; /* GPIO inputs from mss */ diff --git a/arch/arm/boot/dts/qcom/vplatform-lfv-msm8996-ivi-la.dts b/arch/arm/boot/dts/qcom/vplatform-lfv-msm8996-ivi-la.dts index 6f16168e975c..40595275b63a 100644 --- a/arch/arm/boot/dts/qcom/vplatform-lfv-msm8996-ivi-la.dts +++ b/arch/arm/boot/dts/qcom/vplatform-lfv-msm8996-ivi-la.dts @@ -155,14 +155,27 @@ <45 512 207108 14432000>; }; + subsys_notif_virt: qcom,subsys_notif_virt@2d000000 { compatible = "qcom,subsys-notif-virt"; - reg = <0x2d000000 0x18>; + reg = <0x2d000000 0x400>; reg-names = "vdev_base"; + + adsp { + subsys-name = "adsp"; + interrupts = <0 43 0>; + interrupt-names = "state-irq"; + type = "virtual"; + offset = <0>; + }; wlan { subsys-name = "AR6320"; - offset = <16>; + interrupts = <0 43 0>; + interrupt-names = "state-irq"; + type = "virtual"; + offset = <512>; }; + }; }; diff --git a/drivers/gpu/drm/msm-hyp/msm_drv_hyp.h b/drivers/gpu/drm/msm-hyp/msm_drv_hyp.h index 8c8db226bd5b..b47cf7bd1683 100644 --- a/drivers/gpu/drm/msm-hyp/msm_drv_hyp.h +++ b/drivers/gpu/drm/msm-hyp/msm_drv_hyp.h @@ -2,7 +2,7 @@ * Copyright (C) 2013 Red Hat * Author: Rob Clark <robdclark@gmail.com> * - * Copyright (c) 2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by @@ -48,6 +48,10 @@ enum msm_mdp_display_id { DISPLAY_ID_SECONDARY, DISPLAY_ID_TERTIARY, DISPLAY_ID_QUATERNARY, + DISPLAY_ID_QUINARY, + DISPLAY_ID_SENARY, + DISPLAY_ID_SEPTENARY, + DISPLAY_ID_OCTONARY, DISPLAY_ID_MAX }; @@ -71,6 +75,14 @@ static inline enum msm_mdp_display_id msm_get_display_id( return DISPLAY_ID_TERTIARY; else if (!strcmp(display_type, "quaternary")) return DISPLAY_ID_QUATERNARY; + else if (!strcmp(display_type, "quinary")) + return DISPLAY_ID_QUINARY; + else if (!strcmp(display_type, "senary")) + return DISPLAY_ID_SENARY; + else if (!strcmp(display_type, "septenary")) + return DISPLAY_ID_SEPTENARY; + else if (!strcmp(display_type, "octonary")) + return DISPLAY_ID_OCTONARY; else return DISPLAY_ID_NONE; }; diff --git a/drivers/net/phy/mdio_device.c b/drivers/net/phy/mdio_device.c new file mode 100644 index 000000000000..9c88e6749b9a --- /dev/null +++ b/drivers/net/phy/mdio_device.c @@ -0,0 +1,171 @@ +/* Framework for MDIO devices, other than PHYs. + * + * Copyright (c) 2016 Andrew Lunn <andrew@lunn.ch> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include <linux/errno.h> +#include <linux/init.h> +#include <linux/interrupt.h> +#include <linux/kernel.h> +#include <linux/mdio.h> +#include <linux/mii.h> +#include <linux/module.h> +#include <linux/phy.h> +#include <linux/slab.h> +#include <linux/string.h> +#include <linux/unistd.h> + +void mdio_device_free(struct mdio_device *mdiodev) +{ + put_device(&mdiodev->dev); +} +EXPORT_SYMBOL(mdio_device_free); + +static void mdio_device_release(struct device *dev) +{ + kfree(to_mdio_device(dev)); +} + +struct mdio_device *mdio_device_create(struct mii_bus *bus, int addr) +{ + struct mdio_device *mdiodev; + + /* We allocate the device, and initialize the default values */ + mdiodev = kzalloc(sizeof(*mdiodev), GFP_KERNEL); + if (!mdiodev) + return ERR_PTR(-ENOMEM); + + mdiodev->dev.release = mdio_device_release; + mdiodev->dev.parent = &bus->dev; + mdiodev->dev.bus = &mdio_bus_type; + mdiodev->device_free = mdio_device_free; + mdiodev->device_remove = mdio_device_remove; + mdiodev->bus = bus; + mdiodev->addr = addr; + + dev_set_name(&mdiodev->dev, PHY_ID_FMT, bus->id, addr); + + device_initialize(&mdiodev->dev); + + return mdiodev; +} +EXPORT_SYMBOL(mdio_device_create); + +/** + * mdio_device_register - Register the mdio device on the MDIO bus + * @mdiodev: mdio_device structure to be added to the MDIO bus + */ +int mdio_device_register(struct mdio_device *mdiodev) +{ + int err; + + dev_info(&mdiodev->dev, "mdio_device_register\n"); + + err = mdiobus_register_device(mdiodev); + if (err) + return err; + + err = device_add(&mdiodev->dev); + if (err) { + pr_err("MDIO %d failed to add\n", mdiodev->addr); + goto out; + } + + return 0; + + out: + mdiobus_unregister_device(mdiodev); + return err; +} +EXPORT_SYMBOL(mdio_device_register); + +/** + * mdio_device_remove - Remove a previously registered mdio device from the + * MDIO bus + * @mdiodev: mdio_device structure to remove + * + * This doesn't free the mdio_device itself, it merely reverses the effects + * of mdio_device_register(). Use mdio_device_free() to free the device + * after calling this function. + */ +void mdio_device_remove(struct mdio_device *mdiodev) +{ + device_del(&mdiodev->dev); + mdiobus_unregister_device(mdiodev); +} +EXPORT_SYMBOL(mdio_device_remove); + +/** + * mdio_probe - probe an MDIO device + * @dev: device to probe + * + * Description: Take care of setting up the mdio_device structure + * and calling the driver to probe the device. + */ +static int mdio_probe(struct device *dev) +{ + struct mdio_device *mdiodev = to_mdio_device(dev); + struct device_driver *drv = mdiodev->dev.driver; + struct mdio_driver *mdiodrv = to_mdio_driver(drv); + int err = 0; + + if (mdiodrv->probe) + err = mdiodrv->probe(mdiodev); + + return err; +} + +static int mdio_remove(struct device *dev) +{ + struct mdio_device *mdiodev = to_mdio_device(dev); + struct device_driver *drv = mdiodev->dev.driver; + struct mdio_driver *mdiodrv = to_mdio_driver(drv); + + if (mdiodrv->remove) + mdiodrv->remove(mdiodev); + + return 0; +} + +/** + * mdio_driver_register - register an mdio_driver with the MDIO layer + * @new_driver: new mdio_driver to register + */ +int mdio_driver_register(struct mdio_driver *drv) +{ + struct mdio_driver_common *mdiodrv = &drv->mdiodrv; + int retval; + + pr_info("mdio_driver_register: %s\n", mdiodrv->driver.name); + + mdiodrv->driver.bus = &mdio_bus_type; + mdiodrv->driver.probe = mdio_probe; + mdiodrv->driver.remove = mdio_remove; + + retval = driver_register(&mdiodrv->driver); + if (retval) { + pr_err("%s: Error %d in registering driver\n", + mdiodrv->driver.name, retval); + + return retval; + } + + return 0; +} +EXPORT_SYMBOL(mdio_driver_register); + +void mdio_driver_unregister(struct mdio_driver *drv) +{ + struct mdio_driver_common *mdiodrv = &drv->mdiodrv; + + driver_unregister(&mdiodrv->driver); +} +EXPORT_SYMBOL(mdio_driver_unregister); diff --git a/drivers/regulator/cprh-kbss-regulator.c b/drivers/regulator/cprh-kbss-regulator.c index f7a18611b5d2..7320f8066aef 100644 --- a/drivers/regulator/cprh-kbss-regulator.c +++ b/drivers/regulator/cprh-kbss-regulator.c @@ -82,7 +82,7 @@ struct cprh_kbss_fuses { */ #define CPRH_MSM8998_KBSS_FUSE_COMBO_COUNT 32 #define CPRH_SDM660_KBSS_FUSE_COMBO_COUNT 40 -#define CPRH_SDM630_KBSS_FUSE_COMBO_COUNT 24 +#define CPRH_SDM630_KBSS_FUSE_COMBO_COUNT 32 /* * Constants which define the name of each fuse corner. diff --git a/drivers/soc/qcom/glink_spi_xprt.c b/drivers/soc/qcom/glink_spi_xprt.c index a94c4c909a40..ade731cf3251 100644 --- a/drivers/soc/qcom/glink_spi_xprt.c +++ b/drivers/soc/qcom/glink_spi_xprt.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. +/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -478,6 +478,13 @@ static int glink_spi_xprt_rx_cmd(struct edge_info *einfo, void *dst, int ret; read_id = einfo->rx_fifo_read; + if ((read_id > (einfo->rx_fifo_start + einfo->fifo_size)) || + (read_id < einfo->rx_fifo_start)) { + pr_err("%s: Invalid rx_fifo_read: %d, start: %d, size: %d\n", + __func__, read_id, einfo->rx_fifo_start, + einfo->fifo_size); + return -EINVAL; + } do { if ((read_id + size_to_read) >= (einfo->rx_fifo_start + einfo->fifo_size)) @@ -716,11 +723,11 @@ static void process_rx_cmd(struct edge_info *einfo, struct rx_short_data_desc { unsigned char data[SHORT_PKT_SIZE]; }; - struct command *cmd; + struct command *cmd = NULL; struct intent_desc *intents; struct rx_desc *rx_descp; struct rx_short_data_desc *rx_sd_descp; - int offset = 0; + uint64_t offset = 0; int rcu_id; uint16_t rcid; uint16_t name_len; @@ -736,6 +743,8 @@ static void process_rx_cmd(struct edge_info *einfo, } while (offset < rx_size) { + if (offset + sizeof(*cmd) > rx_size) + goto err; cmd = (struct command *)(rx_data + offset); offset += sizeof(*cmd); switch (cmd->id) { @@ -754,7 +763,12 @@ static void process_rx_cmd(struct edge_info *einfo, case OPEN_CMD: rcid = cmd->param1; name_len = (uint16_t)(cmd->param2 & 0xFFFF); + if (name_len > GLINK_NAME_SIZE) + goto err; prio = (uint16_t)((cmd->param2 & 0xFFFF0000) >> 16); + if (offset + ALIGN(name_len, FIFO_ALIGNMENT) > + rx_size) + goto err; name = (char *)(rx_data + offset); offset += ALIGN(name_len, FIFO_ALIGNMENT); einfo->xprt_if.glink_core_if_ptr->rx_cmd_ch_remote_open( @@ -780,6 +794,8 @@ static void process_rx_cmd(struct edge_info *einfo, case RX_INTENT_CMD: for (i = 0; i < cmd->param2; i++) { + if (offset + sizeof(*intents) > rx_size) + goto err; intents = (struct intent_desc *) (rx_data + offset); offset += sizeof(*intents); @@ -815,6 +831,8 @@ static void process_rx_cmd(struct edge_info *einfo, case TX_DATA_CONT_CMD: case TRACER_PKT_CMD: case TRACER_PKT_CONT_CMD: + if (offset + sizeof(*rx_descp) > rx_size) + goto err; rx_descp = (struct rx_desc *)(rx_data + offset); offset += sizeof(*rx_descp); process_rx_data(einfo, cmd->id, cmd->param1, @@ -824,6 +842,8 @@ static void process_rx_cmd(struct edge_info *einfo, break; case TX_SHORT_DATA_CMD: + if (offset + sizeof(*rx_sd_descp) > rx_size) + goto err; rx_sd_descp = (struct rx_short_data_desc *) (rx_data + offset); offset += sizeof(*rx_sd_descp); @@ -852,6 +872,13 @@ static void process_rx_cmd(struct edge_info *einfo, } } srcu_read_unlock(&einfo->use_ref, rcu_id); + return; +err: + srcu_read_unlock(&einfo->use_ref, rcu_id); + if (cmd) + pr_err("%s: invalid size of rx_data: %d, cmd : %d\n", + __func__, rx_size, cmd->id); + return; } /** @@ -1470,6 +1470,7 @@ rw_common: len = ret; + get_file(file); if (rw == WRITE) file_start_write(file); @@ -1477,6 +1478,7 @@ rw_common: if (rw == WRITE) file_end_write(file); + fput(file); kfree(iovec); break; diff --git a/include/linux/mdio.h b/include/linux/mdio.h index b42963bc81dd..a0d6dadd787e 100644 --- a/include/linux/mdio.h +++ b/include/linux/mdio.h @@ -11,6 +11,53 @@ #include <uapi/linux/mdio.h> +struct mdio_device { + struct device dev; + + const struct dev_pm_ops *pm_ops; + struct mii_bus *bus; + + int (*bus_match)(struct device *dev, struct device_driver *drv); + void (*device_free)(struct mdio_device *mdiodev); + void (*device_remove)(struct mdio_device *mdiodev); + + /* Bus address of the MDIO device (0-31) */ + int addr; + int flags; +}; +#define to_mdio_device(d) container_of(d, struct mdio_device, dev) + +/* struct mdio_driver_common: Common to all MDIO drivers */ +struct mdio_driver_common { + struct device_driver driver; + int flags; +}; +#define MDIO_DEVICE_FLAG_PHY 1 +#define to_mdio_common_driver(d) \ + container_of(d, struct mdio_driver_common, driver) + +/* struct mdio_driver: Generic MDIO driver */ +struct mdio_driver { + struct mdio_driver_common mdiodrv; + + /* + * Called during discovery. Used to set + * up device-specific structures, if any + */ + int (*probe)(struct mdio_device *mdiodev); + + /* Clears up any memory if needed */ + void (*remove)(struct mdio_device *mdiodev); +}; +#define to_mdio_driver(d) \ + container_of(to_mdio_common_driver(d), struct mdio_driver, mdiodrv) + +void mdio_device_free(struct mdio_device *mdiodev); +struct mdio_device *mdio_device_create(struct mii_bus *bus, int addr); +int mdio_device_register(struct mdio_device *mdiodev); +void mdio_device_remove(struct mdio_device *mdiodev); +int mdio_driver_register(struct mdio_driver *drv); +void mdio_driver_unregister(struct mdio_driver *drv); static inline bool mdio_phy_id_is_c45(int phy_id) { diff --git a/include/linux/phy.h b/include/linux/phy.h index dbfd5ce9350f..c175610c8fdb 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -18,6 +18,7 @@ #include <linux/spinlock.h> #include <linux/ethtool.h> +#include <linux/mdio.h> #include <linux/mii.h> #include <linux/module.h> #include <linux/timer.h> @@ -357,6 +358,8 @@ struct phy_c45_device_ids { * handling, as well as handling shifts in PHY hardware state */ struct phy_device { + struct mdio_device mdio; + /* Information about the PHY type */ /* And management functions */ struct phy_driver *drv; |
