Loading Documentation/devicetree/bindings/usb/ice40-hcd.txt +0 −3 Original line number Diff line number Diff line Loading @@ -12,8 +12,6 @@ Required properties: - <supply-name>-supply: handle to the regulator device tree node Required "supply-name" is "core-vcc" and "spi-vcc" - reset-gpio: gpio used to assert the bridge chip reset - slave-select-gpio: gpio used to select the slave during configuration loading - config-done-gpio: gpio used to indicate the configuration status - vcc-en-gpio: gpio used to enable the chip power supply - pinctrl-names : List of pin configuration strings. "default" and "sleep" Loading Loading @@ -45,7 +43,6 @@ Optional properties: core-vcc-supply = <&pm8226_l2>; spi-vcc-supply = <&pm8226_l5>; lattice,reset-gpio = <&msmgpio 114 0>; lattice,slave-select-gpio = <&msmgpio 118 0>; lattice,config-done-gpio = <&msmgpio 115 0>; lattice,vcc-en-gpio = <&msmgpio 117 0>; Loading arch/arm/boot/dts/qcom/msm8610.dtsi +0 −1 Original line number Diff line number Diff line Loading @@ -646,7 +646,6 @@ spi-vcc-supply = <&pm8110_l6>; gpio-supply = <&pm8110_l22>; lattice,reset-gpio = <&msmgpio 95 0>; lattice,slave-select-gpio = <&msmgpio 85 0>; lattice,config-done-gpio = <&msmgpio 94 0>; lattice,vcc-en-gpio = <&msmgpio 96 0>; }; Loading arch/arm/boot/dts/qcom/msm8916.dtsi +0 −1 Original line number Diff line number Diff line Loading @@ -1303,7 +1303,6 @@ core-vcc-supply = <&pm8916_l2>; spi-vcc-supply = <&pm8916_l5>; lattice,reset-gpio = <&msm_gpio 3 0>; lattice,slave-select-gpio = <&msm_gpio 10 0>; lattice,config-done-gpio = <&msm_gpio 1 0>; lattice,vcc-en-gpio = <&msm_gpio 114 0>; lattice,clk-en-gpio = <&msm_gpio 0 0>; Loading drivers/usb/host/ice40-hcd.c +23 −41 Original line number Diff line number Diff line Loading @@ -156,7 +156,6 @@ struct ice40_hcd { struct pinctrl *pinctrl; int reset_gpio; int slave_select_gpio; int config_done_gpio; int vcc_en_gpio; int clk_en_gpio; Loading Loading @@ -1341,14 +1340,6 @@ static int ice40_spi_parse_dt(struct ice40_hcd *ihcd) goto out; } ihcd->slave_select_gpio = of_get_named_gpio(node, "lattice,slave-select-gpio", 0); if (ihcd->slave_select_gpio < 0) { pr_err("slave select gpio is missing\n"); ret = ihcd->slave_select_gpio; goto out; } ihcd->config_done_gpio = of_get_named_gpio(node, "lattice,config-done-gpio", 0); if (ihcd->config_done_gpio < 0) { Loading Loading @@ -1547,8 +1538,6 @@ out: static int ice40_spi_load_fw(struct ice40_hcd *ihcd) { int ret, i; struct pinctrl *p; char pin_state[16]; ret = gpio_direction_output(ihcd->reset_gpio, 0); if (ret < 0) { Loading @@ -1566,30 +1555,30 @@ static int ice40_spi_load_fw(struct ice40_hcd *ihcd) * The bridge chip samples the chip select signal during * power-up. If it is low, it enters SPI slave mode and * accepts the configuration data from us. The chip * select signal is managed by the SPI controller driver. * We temporarily override the chip select config to * drive it low. The SPI bus needs to be locked down during * this period to avoid other slave data going to our * bridge chip. Disable the SPI runtime suspend for * exclusive chip select access. * select signal is managed by the SPI controller driver * as it is part of the SPI protocol. * * Call spi_setup() with inverted active cs setting before * the powering up the bridge chip. The SPI controller drives * the chip select low as the slave is idle and bridge chip * enters slave mode. Call spi_setup() with correct active * cs setting after the bridge is powered up and before * starting the transfers. * * The SPI bus needs to be locked down during this period to * avoid other slave data going to our bridge chip. Disable the * SPI runtime suspend to keep the spi controller active to drive * the chip select correctly. * */ pm_runtime_get_sync(ihcd->spi->master->dev.parent); spi_bus_lock(ihcd->spi->master); ret = gpio_request(ihcd->slave_select_gpio, "ice40_spi_cs"); if (ret < 0) { pr_err("fail to request slave select gpio %d\n", ret); spi_bus_unlock(ihcd->spi->master); pm_runtime_put_noidle(ihcd->spi->master->dev.parent); goto out; } ret = gpio_direction_output(ihcd->slave_select_gpio, 0); if (ret < 0) { pr_err("fail to drive slave select gpio %d\n", ret); gpio_free(ihcd->slave_select_gpio); ihcd->spi->mode |= SPI_CS_HIGH; ret = spi_setup(ihcd->spi); if (ret) { pr_err("fail to setup SPI with high cs setting %d\n", ret); spi_bus_unlock(ihcd->spi->master); pm_runtime_put_noidle(ihcd->spi->master->dev.parent); goto out; Loading @@ -1598,7 +1587,6 @@ static int ice40_spi_load_fw(struct ice40_hcd *ihcd) ret = ice40_spi_power_up(ihcd); if (ret < 0) { pr_err("fail to power up the chip\n"); gpio_free(ihcd->slave_select_gpio); spi_bus_unlock(ihcd->spi->master); pm_runtime_put_noidle(ihcd->spi->master->dev.parent); goto out; Loading @@ -1610,20 +1598,14 @@ static int ice40_spi_load_fw(struct ice40_hcd *ihcd) */ usleep_range(1200, 1250); gpio_direction_output(ihcd->slave_select_gpio, 1); gpio_free(ihcd->slave_select_gpio); snprintf(pin_state, sizeof(pin_state), "cs%d_sleep", ihcd->spi->chip_select); p = pinctrl_get_select(ihcd->spi->master->dev.parent, pin_state); if (IS_ERR(p)) { ret = PTR_ERR(p); pr_err("fail to select cs sleep state\n"); ihcd->spi->mode &= ~SPI_CS_HIGH; ret = spi_setup(ihcd->spi); if (ret) { pr_err("fail to setup SPI with low cs setting %d\n", ret); spi_bus_unlock(ihcd->spi->master); pm_runtime_put_noidle(ihcd->spi->master->dev.parent); goto power_off; } pinctrl_put(p); pm_runtime_put_noidle(ihcd->spi->master->dev.parent); ret = spi_sync_locked(ihcd->spi, ihcd->fmsg); Loading Loading
Documentation/devicetree/bindings/usb/ice40-hcd.txt +0 −3 Original line number Diff line number Diff line Loading @@ -12,8 +12,6 @@ Required properties: - <supply-name>-supply: handle to the regulator device tree node Required "supply-name" is "core-vcc" and "spi-vcc" - reset-gpio: gpio used to assert the bridge chip reset - slave-select-gpio: gpio used to select the slave during configuration loading - config-done-gpio: gpio used to indicate the configuration status - vcc-en-gpio: gpio used to enable the chip power supply - pinctrl-names : List of pin configuration strings. "default" and "sleep" Loading Loading @@ -45,7 +43,6 @@ Optional properties: core-vcc-supply = <&pm8226_l2>; spi-vcc-supply = <&pm8226_l5>; lattice,reset-gpio = <&msmgpio 114 0>; lattice,slave-select-gpio = <&msmgpio 118 0>; lattice,config-done-gpio = <&msmgpio 115 0>; lattice,vcc-en-gpio = <&msmgpio 117 0>; Loading
arch/arm/boot/dts/qcom/msm8610.dtsi +0 −1 Original line number Diff line number Diff line Loading @@ -646,7 +646,6 @@ spi-vcc-supply = <&pm8110_l6>; gpio-supply = <&pm8110_l22>; lattice,reset-gpio = <&msmgpio 95 0>; lattice,slave-select-gpio = <&msmgpio 85 0>; lattice,config-done-gpio = <&msmgpio 94 0>; lattice,vcc-en-gpio = <&msmgpio 96 0>; }; Loading
arch/arm/boot/dts/qcom/msm8916.dtsi +0 −1 Original line number Diff line number Diff line Loading @@ -1303,7 +1303,6 @@ core-vcc-supply = <&pm8916_l2>; spi-vcc-supply = <&pm8916_l5>; lattice,reset-gpio = <&msm_gpio 3 0>; lattice,slave-select-gpio = <&msm_gpio 10 0>; lattice,config-done-gpio = <&msm_gpio 1 0>; lattice,vcc-en-gpio = <&msm_gpio 114 0>; lattice,clk-en-gpio = <&msm_gpio 0 0>; Loading
drivers/usb/host/ice40-hcd.c +23 −41 Original line number Diff line number Diff line Loading @@ -156,7 +156,6 @@ struct ice40_hcd { struct pinctrl *pinctrl; int reset_gpio; int slave_select_gpio; int config_done_gpio; int vcc_en_gpio; int clk_en_gpio; Loading Loading @@ -1341,14 +1340,6 @@ static int ice40_spi_parse_dt(struct ice40_hcd *ihcd) goto out; } ihcd->slave_select_gpio = of_get_named_gpio(node, "lattice,slave-select-gpio", 0); if (ihcd->slave_select_gpio < 0) { pr_err("slave select gpio is missing\n"); ret = ihcd->slave_select_gpio; goto out; } ihcd->config_done_gpio = of_get_named_gpio(node, "lattice,config-done-gpio", 0); if (ihcd->config_done_gpio < 0) { Loading Loading @@ -1547,8 +1538,6 @@ out: static int ice40_spi_load_fw(struct ice40_hcd *ihcd) { int ret, i; struct pinctrl *p; char pin_state[16]; ret = gpio_direction_output(ihcd->reset_gpio, 0); if (ret < 0) { Loading @@ -1566,30 +1555,30 @@ static int ice40_spi_load_fw(struct ice40_hcd *ihcd) * The bridge chip samples the chip select signal during * power-up. If it is low, it enters SPI slave mode and * accepts the configuration data from us. The chip * select signal is managed by the SPI controller driver. * We temporarily override the chip select config to * drive it low. The SPI bus needs to be locked down during * this period to avoid other slave data going to our * bridge chip. Disable the SPI runtime suspend for * exclusive chip select access. * select signal is managed by the SPI controller driver * as it is part of the SPI protocol. * * Call spi_setup() with inverted active cs setting before * the powering up the bridge chip. The SPI controller drives * the chip select low as the slave is idle and bridge chip * enters slave mode. Call spi_setup() with correct active * cs setting after the bridge is powered up and before * starting the transfers. * * The SPI bus needs to be locked down during this period to * avoid other slave data going to our bridge chip. Disable the * SPI runtime suspend to keep the spi controller active to drive * the chip select correctly. * */ pm_runtime_get_sync(ihcd->spi->master->dev.parent); spi_bus_lock(ihcd->spi->master); ret = gpio_request(ihcd->slave_select_gpio, "ice40_spi_cs"); if (ret < 0) { pr_err("fail to request slave select gpio %d\n", ret); spi_bus_unlock(ihcd->spi->master); pm_runtime_put_noidle(ihcd->spi->master->dev.parent); goto out; } ret = gpio_direction_output(ihcd->slave_select_gpio, 0); if (ret < 0) { pr_err("fail to drive slave select gpio %d\n", ret); gpio_free(ihcd->slave_select_gpio); ihcd->spi->mode |= SPI_CS_HIGH; ret = spi_setup(ihcd->spi); if (ret) { pr_err("fail to setup SPI with high cs setting %d\n", ret); spi_bus_unlock(ihcd->spi->master); pm_runtime_put_noidle(ihcd->spi->master->dev.parent); goto out; Loading @@ -1598,7 +1587,6 @@ static int ice40_spi_load_fw(struct ice40_hcd *ihcd) ret = ice40_spi_power_up(ihcd); if (ret < 0) { pr_err("fail to power up the chip\n"); gpio_free(ihcd->slave_select_gpio); spi_bus_unlock(ihcd->spi->master); pm_runtime_put_noidle(ihcd->spi->master->dev.parent); goto out; Loading @@ -1610,20 +1598,14 @@ static int ice40_spi_load_fw(struct ice40_hcd *ihcd) */ usleep_range(1200, 1250); gpio_direction_output(ihcd->slave_select_gpio, 1); gpio_free(ihcd->slave_select_gpio); snprintf(pin_state, sizeof(pin_state), "cs%d_sleep", ihcd->spi->chip_select); p = pinctrl_get_select(ihcd->spi->master->dev.parent, pin_state); if (IS_ERR(p)) { ret = PTR_ERR(p); pr_err("fail to select cs sleep state\n"); ihcd->spi->mode &= ~SPI_CS_HIGH; ret = spi_setup(ihcd->spi); if (ret) { pr_err("fail to setup SPI with low cs setting %d\n", ret); spi_bus_unlock(ihcd->spi->master); pm_runtime_put_noidle(ihcd->spi->master->dev.parent); goto power_off; } pinctrl_put(p); pm_runtime_put_noidle(ihcd->spi->master->dev.parent); ret = spi_sync_locked(ihcd->spi, ihcd->fmsg); Loading