tree: https://kernel.googlesource.com/pub/scm/linux/kernel/git/linusw/linux-gpio.git gpio-descriptors-spi head: 6e5614b6476001adb8ce6e2859bc2ca0a4339398 commit: 6e5614b6476001adb8ce6e2859bc2ca0a4339398 [5/5] slask config: arm64-allmodconfig (attached as .config) compiler: aarch64-linux-gcc (GCC) 7.4.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross git checkout 6e5614b6476001adb8ce6e2859bc2ca0a4339398 # save the attached .config to linux build tree GCC_VERSION=7.4.0 make.cross ARCH=arm64 If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@xxxxxxxxx> All errors (new ones prefixed by >>): In file included from include/linux/bitops.h:5:0, from include/linux/kernel.h:12, from include/linux/list.h:9, from include/linux/module.h:9, from drivers/spi/spi-pl022.c:17: drivers/spi/spi-pl022.c: In function 'pl022_set_cs': drivers/spi/spi-pl022.c:442:22: error: 'struct pl022' has no member named 'cur_cs'; did you mean 'cur_msg'? tmp &= ~BIT(pl022->cur_cs); ^ include/linux/bits.h:8:30: note: in definition of macro 'BIT' #define BIT(nr) (UL(1) << (nr)) ^~ drivers/spi/spi-pl022.c:444:21: error: 'struct pl022' has no member named 'cur_cs'; did you mean 'cur_msg'? tmp |= BIT(pl022->cur_cs); ^ include/linux/bits.h:8:30: note: in definition of macro 'BIT' #define BIT(nr) (UL(1) << (nr)) ^~ drivers/spi/spi-pl022.c: In function 'giveback': drivers/spi/spi-pl022.c:493:4: error: implicit declaration of function 'pl022_cs_control'; did you mean 'pl022_set_cs'? [-Werror=implicit-function-declaration] pl022_cs_control(pl022, SSP_CHIP_DESELECT); ^~~~~~~~~~~~~~~~ pl022_set_cs drivers/spi/spi-pl022.c: In function 'pl022_transfer_one_message': drivers/spi/spi-pl022.c:1571:9: error: 'struct pl022' has no member named 'cur_cs'; did you mean 'cur_msg'? pl022->cur_cs = pl022->chipselects[msg->spi->chip_select]; ^~~~~~ cur_msg drivers/spi/spi-pl022.c:1571:23: error: 'struct pl022' has no member named 'chipselects' pl022->cur_cs = pl022->chipselects[msg->spi->chip_select]; ^~ drivers/spi/spi-pl022.c: In function 'pl022_setup': >> drivers/spi/spi-pl022.c:1852:4: error: implicit declaration of function 'of_property_read_u32'; did you mean '__percpu_read_32'? [-Werror=implicit-function-declaration] of_property_read_u32(np, "pl022,interface", ^~~~~~~~~~~~~~~~~~~~ __percpu_read_32 drivers/spi/spi-pl022.c:1914:7: error: implicit declaration of function 'gpio_is_valid'; did you mean 'uuid_is_valid'? [-Werror=implicit-function-declaration] if (!gpio_is_valid(pl022->chipselects[spi->chip_select])) ^~~~~~~~~~~~~ uuid_is_valid drivers/spi/spi-pl022.c:1914:26: error: 'struct pl022' has no member named 'chipselects' if (!gpio_is_valid(pl022->chipselects[spi->chip_select])) ^~ drivers/spi/spi-pl022.c: In function 'pl022_platform_data_dt_get': drivers/spi/spi-pl022.c:2081:11: error: implicit declaration of function 'of_property_read_bool' [-Werror=implicit-function-declaration] pd->rt = of_property_read_bool(np, "pl022,rt"); ^~~~~~~~~~~~~~~~~~~~~ drivers/spi/spi-pl022.c: In function 'pl022_probe': drivers/spi/spi-pl022.c:2125:7: error: 'struct pl022' has no member named 'chipselects' pl022->chipselects = devm_kcalloc(dev, num_cs, sizeof(int), ^~ drivers/spi/spi-pl022.c:2127:12: error: 'struct pl022' has no member named 'chipselects' if (!pl022->chipselects) { ^~ drivers/spi/spi-pl022.c:2137:8: warning: statement with no effect [-Wunused-value] master->use_gpio_descriptors; ~~~~~~^~~~~~~~~~~~~~~~~~~~~~ drivers/spi/spi-pl022.c:2150:9: error: 'struct pl022' has no member named 'chipselects' pl022->chipselects[i] = i; ^~ drivers/spi/spi-pl022.c:2153:18: error: implicit declaration of function 'of_get_named_gpio'; did you mean 'fwnode_get_named_gpiod'? [-Werror=implicit-function-declaration] int cs_gpio = of_get_named_gpio(np, "cs-gpios", i); ^~~~~~~~~~~~~~~~~ fwnode_get_named_gpiod drivers/spi/spi-pl022.c:2160:9: error: 'struct pl022' has no member named 'chipselects' pl022->chipselects[i] = cs_gpio; ^~ drivers/spi/spi-pl022.c:2163:9: error: implicit declaration of function 'devm_gpio_request'; did you mean 'devm_gpiod_put'? [-Werror=implicit-function-declaration] if (devm_gpio_request(dev, cs_gpio, "ssp-pl022")) ^~~~~~~~~~~~~~~~~ devm_gpiod_put drivers/spi/spi-pl022.c:2167:14: error: implicit declaration of function 'gpio_direction_output'; did you mean 'gpiod_direction_output'? [-Werror=implicit-function-declaration] else if (gpio_direction_output(cs_gpio, 1)) ^~~~~~~~~~~~~~~~~~~~~ gpiod_direction_output cc1: some warnings being treated as errors vim +1852 drivers/spi/spi-pl022.c f9d629c737cb668 drivers/spi/amba-pl022.c Linus Walleij 2010-10-01 1805 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1806 /** b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1807 * pl022_setup - setup function registered to SPI master framework b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1808 * @spi: spi device which is requesting setup b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1809 * b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1810 * This function is registered to the SPI framework for this SPI master b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1811 * controller. If it is the first time when setup is called by this device, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1812 * this function will initialize the runtime state for this chip and save b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1813 * the same in the device structure. Else it will update the runtime info b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1814 * with the updated chip info. Nothing is really being written to the b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1815 * controller hardware here, that is not done until the actual transfer b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1816 * commence. b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1817 */ b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1818 static int pl022_setup(struct spi_device *spi) b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1819 { f9d629c737cb668 drivers/spi/amba-pl022.c Linus Walleij 2010-10-01 1820 struct pl022_config_chip const *chip_info; 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 1821 struct pl022_config_chip chip_info_dt; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1822 struct chip_data *chip; c4a4784308f5cb8 drivers/spi/spi-pl022.c Jonas Aaberg 2011-02-28 1823 struct ssp_clock_params clk_freq = { .cpsdvsr = 0, .scr = 0}; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1824 int status = 0; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1825 struct pl022 *pl022 = spi_master_get_devdata(spi->master); bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 1826 unsigned int bits = spi->bits_per_word; bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 1827 u32 tmp; 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 1828 struct device_node *np = spi->dev.of_node; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1829 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1830 if (!spi->max_speed_hz) b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1831 return -EINVAL; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1832 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1833 /* Get controller_state if one is supplied */ b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1834 chip = spi_get_ctldata(spi); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1835 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1836 if (chip == NULL) { b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1837 chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL); 77538f4a98dc542 drivers/spi/spi-pl022.c Jingoo Han 2014-04-29 1838 if (!chip) b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1839 return -ENOMEM; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1840 dev_dbg(&spi->dev, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1841 "allocated memory for controller's runtime state\n"); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1842 } b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1843 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1844 /* Get controller data if one is supplied */ b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1845 chip_info = spi->controller_data; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1846 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1847 if (chip_info == NULL) { 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 1848 if (np) { 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 1849 chip_info_dt = pl022_default_chip_info; 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 1850 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 1851 chip_info_dt.hierarchy = SSP_MASTER; 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 @1852 of_property_read_u32(np, "pl022,interface", 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 1853 &chip_info_dt.iface); 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 1854 of_property_read_u32(np, "pl022,com-mode", 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 1855 &chip_info_dt.com_mode); 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 1856 of_property_read_u32(np, "pl022,rx-level-trig", 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 1857 &chip_info_dt.rx_lev_trig); 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 1858 of_property_read_u32(np, "pl022,tx-level-trig", 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 1859 &chip_info_dt.tx_lev_trig); 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 1860 of_property_read_u32(np, "pl022,ctrl-len", 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 1861 &chip_info_dt.ctrl_len); 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 1862 of_property_read_u32(np, "pl022,wait-state", 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 1863 &chip_info_dt.wait_state); 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 1864 of_property_read_u32(np, "pl022,duplex", 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 1865 &chip_info_dt.duplex); 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 1866 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 1867 chip_info = &chip_info_dt; 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 1868 } else { f9d629c737cb668 drivers/spi/amba-pl022.c Linus Walleij 2010-10-01 1869 chip_info = &pl022_default_chip_info; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1870 /* spi_board_info.controller_data not is supplied */ b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1871 dev_dbg(&spi->dev, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1872 "using default controller_data settings\n"); 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 1873 } f9d629c737cb668 drivers/spi/amba-pl022.c Linus Walleij 2010-10-01 1874 } else b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1875 dev_dbg(&spi->dev, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1876 "using user supplied controller_data settings\n"); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1877 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1878 /* b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1879 * We can override with custom divisors, else we use the board b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1880 * frequency setting b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1881 */ b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1882 if ((0 == chip_info->clk_freq.cpsdvsr) b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1883 && (0 == chip_info->clk_freq.scr)) { b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1884 status = calculate_effective_freq(pl022, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1885 spi->max_speed_hz, f9d629c737cb668 drivers/spi/amba-pl022.c Linus Walleij 2010-10-01 1886 &clk_freq); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1887 if (status < 0) b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1888 goto err_config_params; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1889 } else { f9d629c737cb668 drivers/spi/amba-pl022.c Linus Walleij 2010-10-01 1890 memcpy(&clk_freq, &chip_info->clk_freq, sizeof(clk_freq)); f9d629c737cb668 drivers/spi/amba-pl022.c Linus Walleij 2010-10-01 1891 if ((clk_freq.cpsdvsr % 2) != 0) f9d629c737cb668 drivers/spi/amba-pl022.c Linus Walleij 2010-10-01 1892 clk_freq.cpsdvsr = f9d629c737cb668 drivers/spi/amba-pl022.c Linus Walleij 2010-10-01 1893 clk_freq.cpsdvsr - 1; f9d629c737cb668 drivers/spi/amba-pl022.c Linus Walleij 2010-10-01 1894 } f9d629c737cb668 drivers/spi/amba-pl022.c Linus Walleij 2010-10-01 1895 if ((clk_freq.cpsdvsr < CPSDVR_MIN) f9d629c737cb668 drivers/spi/amba-pl022.c Linus Walleij 2010-10-01 1896 || (clk_freq.cpsdvsr > CPSDVR_MAX)) { e3f88ae99609205 drivers/spi/amba-pl022.c Virupax Sadashivpetimath 2011-06-13 1897 status = -EINVAL; f9d629c737cb668 drivers/spi/amba-pl022.c Linus Walleij 2010-10-01 1898 dev_err(&spi->dev, f9d629c737cb668 drivers/spi/amba-pl022.c Linus Walleij 2010-10-01 1899 "cpsdvsr is configured incorrectly\n"); f9d629c737cb668 drivers/spi/amba-pl022.c Linus Walleij 2010-10-01 1900 goto err_config_params; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1901 } f9d629c737cb668 drivers/spi/amba-pl022.c Linus Walleij 2010-10-01 1902 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1903 status = verify_controller_parameters(pl022, chip_info); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1904 if (status) { b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1905 dev_err(&spi->dev, "controller data is incorrect"); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1906 goto err_config_params; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1907 } f9d629c737cb668 drivers/spi/amba-pl022.c Linus Walleij 2010-10-01 1908 083be3f05371b8f drivers/spi/spi-pl022.c Linus Walleij 2011-06-16 1909 pl022->rx_lev_trig = chip_info->rx_lev_trig; 083be3f05371b8f drivers/spi/spi-pl022.c Linus Walleij 2011-06-16 1910 pl022->tx_lev_trig = chip_info->tx_lev_trig; 083be3f05371b8f drivers/spi/spi-pl022.c Linus Walleij 2011-06-16 1911 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1912 /* Now set controller state based on controller data */ b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1913 chip->xfer_type = chip_info->com_mode; f6f46de1063c882 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 1914 if (!gpio_is_valid(pl022->chipselects[spi->chip_select])) f9d629c737cb668 drivers/spi/amba-pl022.c Linus Walleij 2010-10-01 1915 dev_warn(&spi->dev, f6f46de1063c882 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 1916 "invalid chip select\n"); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1917 eb798c641a34ae9 drivers/spi/spi-pl022.c Vinit Shenoy 2012-04-17 1918 /* Check bits per word with vendor specific range */ eb798c641a34ae9 drivers/spi/spi-pl022.c Vinit Shenoy 2012-04-17 1919 if ((bits <= 3) || (bits > pl022->vendor->max_bpw)) { bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 1920 status = -ENOTSUPP; eb798c641a34ae9 drivers/spi/spi-pl022.c Vinit Shenoy 2012-04-17 1921 dev_err(&spi->dev, "illegal data size for this controller!\n"); eb798c641a34ae9 drivers/spi/spi-pl022.c Vinit Shenoy 2012-04-17 1922 dev_err(&spi->dev, "This controller can only handle 4 <= n <= %d bit words\n", eb798c641a34ae9 drivers/spi/spi-pl022.c Vinit Shenoy 2012-04-17 1923 pl022->vendor->max_bpw); bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 1924 goto err_config_params; bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 1925 } else if (bits <= 8) { bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 1926 dev_dbg(&spi->dev, "4 <= n <=8 bits per word\n"); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1927 chip->n_bytes = 1; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1928 chip->read = READING_U8; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1929 chip->write = WRITING_U8; bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 1930 } else if (bits <= 16) { b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1931 dev_dbg(&spi->dev, "9 <= n <= 16 bits per word\n"); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1932 chip->n_bytes = 2; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1933 chip->read = READING_U16; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1934 chip->write = WRITING_U16; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1935 } else { b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1936 dev_dbg(&spi->dev, "17 <= n <= 32 bits per word\n"); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1937 chip->n_bytes = 4; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1938 chip->read = READING_U32; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1939 chip->write = WRITING_U32; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1940 } b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1941 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1942 /* Now Initialize all register settings required for this chip */ b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1943 chip->cr0 = 0; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1944 chip->cr1 = 0; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1945 chip->dmacr = 0; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1946 chip->cpsr = 0; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1947 if ((chip_info->com_mode == DMA_TRANSFER) b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1948 && ((pl022->master_info)->enable_dma)) { b1b6b9aa6fd32db drivers/spi/amba-pl022.c Linus Walleij 2010-09-29 1949 chip->enable_dma = true; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1950 dev_dbg(&spi->dev, "DMA mode set in controller state\n"); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1951 SSP_WRITE_BITS(chip->dmacr, SSP_DMA_ENABLED, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1952 SSP_DMACR_MASK_RXDMAE, 0); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1953 SSP_WRITE_BITS(chip->dmacr, SSP_DMA_ENABLED, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1954 SSP_DMACR_MASK_TXDMAE, 1); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1955 } else { b1b6b9aa6fd32db drivers/spi/amba-pl022.c Linus Walleij 2010-09-29 1956 chip->enable_dma = false; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1957 dev_dbg(&spi->dev, "DMA mode NOT set in controller state\n"); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1958 SSP_WRITE_BITS(chip->dmacr, SSP_DMA_DISABLED, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1959 SSP_DMACR_MASK_RXDMAE, 0); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1960 SSP_WRITE_BITS(chip->dmacr, SSP_DMA_DISABLED, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1961 SSP_DMACR_MASK_TXDMAE, 1); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1962 } b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1963 f9d629c737cb668 drivers/spi/amba-pl022.c Linus Walleij 2010-10-01 1964 chip->cpsr = clk_freq.cpsdvsr; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 1965 556f4aeb7d9dfac drivers/spi/amba-pl022.c Linus Walleij 2010-05-05 1966 /* Special setup for the ST micro extended control registers */ 556f4aeb7d9dfac drivers/spi/amba-pl022.c Linus Walleij 2010-05-05 1967 if (pl022->vendor->extended_cr) { bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 1968 u32 etx; bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 1969 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 1970 if (pl022->vendor->pl023) { 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 1971 /* These bits are only in the PL023 */ 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 1972 SSP_WRITE_BITS(chip->cr1, chip_info->clkdelay, 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 1973 SSP_CR1_MASK_FBCLKDEL_ST, 13); 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 1974 } else { 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 1975 /* These bits are in the PL022 but not PL023 */ 556f4aeb7d9dfac drivers/spi/amba-pl022.c Linus Walleij 2010-05-05 1976 SSP_WRITE_BITS(chip->cr0, chip_info->duplex, 556f4aeb7d9dfac drivers/spi/amba-pl022.c Linus Walleij 2010-05-05 1977 SSP_CR0_MASK_HALFDUP_ST, 5); 556f4aeb7d9dfac drivers/spi/amba-pl022.c Linus Walleij 2010-05-05 1978 SSP_WRITE_BITS(chip->cr0, chip_info->ctrl_len, 556f4aeb7d9dfac drivers/spi/amba-pl022.c Linus Walleij 2010-05-05 1979 SSP_CR0_MASK_CSS_ST, 16); 556f4aeb7d9dfac drivers/spi/amba-pl022.c Linus Walleij 2010-05-05 1980 SSP_WRITE_BITS(chip->cr0, chip_info->iface, 556f4aeb7d9dfac drivers/spi/amba-pl022.c Linus Walleij 2010-05-05 1981 SSP_CR0_MASK_FRF_ST, 21); 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 1982 SSP_WRITE_BITS(chip->cr1, chip_info->wait_state, 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 1983 SSP_CR1_MASK_MWAIT_ST, 6); 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 1984 } bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 1985 SSP_WRITE_BITS(chip->cr0, bits - 1, 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 1986 SSP_CR0_MASK_DSS_ST, 0); bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 1987 bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 1988 if (spi->mode & SPI_LSB_FIRST) { bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 1989 tmp = SSP_RX_LSB; bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 1990 etx = SSP_TX_LSB; bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 1991 } else { bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 1992 tmp = SSP_RX_MSB; bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 1993 etx = SSP_TX_MSB; bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 1994 } bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 1995 SSP_WRITE_BITS(chip->cr1, tmp, SSP_CR1_MASK_RENDN_ST, 4); bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 1996 SSP_WRITE_BITS(chip->cr1, etx, SSP_CR1_MASK_TENDN_ST, 5); 556f4aeb7d9dfac drivers/spi/amba-pl022.c Linus Walleij 2010-05-05 1997 SSP_WRITE_BITS(chip->cr1, chip_info->rx_lev_trig, 556f4aeb7d9dfac drivers/spi/amba-pl022.c Linus Walleij 2010-05-05 1998 SSP_CR1_MASK_RXIFLSEL_ST, 7); 556f4aeb7d9dfac drivers/spi/amba-pl022.c Linus Walleij 2010-05-05 1999 SSP_WRITE_BITS(chip->cr1, chip_info->tx_lev_trig, 556f4aeb7d9dfac drivers/spi/amba-pl022.c Linus Walleij 2010-05-05 2000 SSP_CR1_MASK_TXIFLSEL_ST, 10); 556f4aeb7d9dfac drivers/spi/amba-pl022.c Linus Walleij 2010-05-05 2001 } else { bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2002 SSP_WRITE_BITS(chip->cr0, bits - 1, 556f4aeb7d9dfac drivers/spi/amba-pl022.c Linus Walleij 2010-05-05 2003 SSP_CR0_MASK_DSS, 0); 556f4aeb7d9dfac drivers/spi/amba-pl022.c Linus Walleij 2010-05-05 2004 SSP_WRITE_BITS(chip->cr0, chip_info->iface, 556f4aeb7d9dfac drivers/spi/amba-pl022.c Linus Walleij 2010-05-05 2005 SSP_CR0_MASK_FRF, 4); 556f4aeb7d9dfac drivers/spi/amba-pl022.c Linus Walleij 2010-05-05 2006 } bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2007 556f4aeb7d9dfac drivers/spi/amba-pl022.c Linus Walleij 2010-05-05 2008 /* Stuff that is common for all versions */ bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2009 if (spi->mode & SPI_CPOL) bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2010 tmp = SSP_CLK_POL_IDLE_HIGH; bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2011 else bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2012 tmp = SSP_CLK_POL_IDLE_LOW; bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2013 SSP_WRITE_BITS(chip->cr0, tmp, SSP_CR0_MASK_SPO, 6); bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2014 bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2015 if (spi->mode & SPI_CPHA) bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2016 tmp = SSP_CLK_SECOND_EDGE; bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2017 else bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2018 tmp = SSP_CLK_FIRST_EDGE; bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2019 SSP_WRITE_BITS(chip->cr0, tmp, SSP_CR0_MASK_SPH, 7); bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2020 f9d629c737cb668 drivers/spi/amba-pl022.c Linus Walleij 2010-10-01 2021 SSP_WRITE_BITS(chip->cr0, clk_freq.scr, SSP_CR0_MASK_SCR, 8); 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 2022 /* Loopback is available on all versions except PL023 */ 06fb01fd1dc624d drivers/spi/amba-pl022.c Philippe Langlais 2011-03-23 2023 if (pl022->vendor->loopback) { bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2024 if (spi->mode & SPI_LOOP) bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2025 tmp = LOOPBACK_ENABLED; bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2026 else bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2027 tmp = LOOPBACK_DISABLED; bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2028 SSP_WRITE_BITS(chip->cr1, tmp, SSP_CR1_MASK_LBM, 0); bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2029 } b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2030 SSP_WRITE_BITS(chip->cr1, SSP_DISABLED, SSP_CR1_MASK_SSE, 1); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2031 SSP_WRITE_BITS(chip->cr1, chip_info->hierarchy, SSP_CR1_MASK_MS, 2); f1e45f86ed93b9e drivers/spi/spi-pl022.c Viresh Kumar 2011-08-10 2032 SSP_WRITE_BITS(chip->cr1, chip_info->slave_tx_disable, SSP_CR1_MASK_SOD, f1e45f86ed93b9e drivers/spi/spi-pl022.c Viresh Kumar 2011-08-10 2033 3); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2034 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2035 /* Save controller_state */ b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2036 spi_set_ctldata(spi, chip); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2037 return status; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2038 err_config_params: bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2039 spi_set_ctldata(spi, NULL); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2040 kfree(chip); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2041 return status; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2042 } b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2043 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2044 /** b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2045 * pl022_cleanup - cleanup function registered to SPI master framework b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2046 * @spi: spi device which is requesting cleanup b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2047 * b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2048 * This function is registered to the SPI framework for this SPI master b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2049 * controller. It will free the runtime state of chip. b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2050 */ b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2051 static void pl022_cleanup(struct spi_device *spi) b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2052 { b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2053 struct chip_data *chip = spi_get_ctldata(spi); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2054 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2055 spi_set_ctldata(spi, NULL); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2056 kfree(chip); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2057 } b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2058 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2059 static struct pl022_ssp_controller * 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2060 pl022_platform_data_dt_get(struct device *dev) 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2061 { 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2062 struct device_node *np = dev->of_node; 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2063 struct pl022_ssp_controller *pd; 849794c50b24b93 drivers/spi/spi-pl022.c Rabin Vincent 2017-04-06 2064 u32 tmp = 0; 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2065 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2066 if (!np) { 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2067 dev_err(dev, "no dt node defined\n"); 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2068 return NULL; 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2069 } 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2070 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2071 pd = devm_kzalloc(dev, sizeof(struct pl022_ssp_controller), GFP_KERNEL); 77538f4a98dc542 drivers/spi/spi-pl022.c Jingoo Han 2014-04-29 2072 if (!pd) 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2073 return NULL; 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2074 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2075 pd->bus_id = -1; dbd897b9c6fac8b drivers/spi/spi-pl022.c Linus Walleij 2013-05-23 2076 pd->enable_dma = 1; 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2077 of_property_read_u32(np, "num-cs", &tmp); 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2078 pd->num_chipselect = tmp; 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2079 of_property_read_u32(np, "pl022,autosuspend-delay", 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2080 &pd->autosuspend_delay); 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2081 pd->rt = of_property_read_bool(np, "pl022,rt"); 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2082 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2083 return pd; 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2084 } 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2085 fd4a319bc933ae9 drivers/spi/spi-pl022.c Grant Likely 2012-12-07 2086 static int pl022_probe(struct amba_device *adev, const struct amba_id *id) b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2087 { b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2088 struct device *dev = &adev->dev; 8074cf063e410a2 drivers/spi/spi-pl022.c Jingoo Han 2013-07-30 2089 struct pl022_ssp_controller *platform_info = 8074cf063e410a2 drivers/spi/spi-pl022.c Jingoo Han 2013-07-30 2090 dev_get_platdata(&adev->dev); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2091 struct spi_master *master; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2092 struct pl022 *pl022 = NULL; /*Data for this driver */ 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2093 struct device_node *np = adev->dev.of_node; 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2094 int status = 0, i, num_cs; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2095 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2096 dev_info(&adev->dev, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2097 "ARM PL022 driver, device ID: 0x%08x\n", adev->periphid); 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2098 if (!platform_info && IS_ENABLED(CONFIG_OF)) 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2099 platform_info = pl022_platform_data_dt_get(dev); 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2100 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2101 if (!platform_info) { 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2102 dev_err(dev, "probe: no platform data defined\n"); aeef9915b9a40d2 drivers/spi/spi-pl022.c Linus Walleij 2012-09-26 2103 return -ENODEV; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2104 } b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2105 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2106 if (platform_info->num_chipselect) { 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2107 num_cs = platform_info->num_chipselect; 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2108 } else { 39a6ac11df6579d drivers/spi/spi-pl022.c Roland Stigge 2012-09-18 2109 dev_err(dev, "probe: no chip select defined\n"); aeef9915b9a40d2 drivers/spi/spi-pl022.c Linus Walleij 2012-09-26 2110 return -ENODEV; 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2111 } 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2112 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2113 /* Allocate master with space for data */ b4b8482690d97ea drivers/spi/spi-pl022.c Roland Stigge 2012-09-03 2114 master = spi_alloc_master(dev, sizeof(struct pl022)); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2115 if (master == NULL) { b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2116 dev_err(&adev->dev, "probe - cannot alloc SPI master\n"); aeef9915b9a40d2 drivers/spi/spi-pl022.c Linus Walleij 2012-09-26 2117 return -ENOMEM; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2118 } b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2119 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2120 pl022 = spi_master_get_devdata(master); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2121 pl022->master = master; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2122 pl022->master_info = platform_info; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2123 pl022->adev = adev; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2124 pl022->vendor = id->data; a86854d0c599b32 drivers/spi/spi-pl022.c Kees Cook 2018-06-12 2125 pl022->chipselects = devm_kcalloc(dev, num_cs, sizeof(int), b4b8482690d97ea drivers/spi/spi-pl022.c Roland Stigge 2012-09-03 2126 GFP_KERNEL); 73e3f1eb5188830 drivers/spi/spi-pl022.c Kiran Padwal 2014-09-18 2127 if (!pl022->chipselects) { 73e3f1eb5188830 drivers/spi/spi-pl022.c Kiran Padwal 2014-09-18 2128 status = -ENOMEM; 73e3f1eb5188830 drivers/spi/spi-pl022.c Kiran Padwal 2014-09-18 2129 goto err_no_mem; 73e3f1eb5188830 drivers/spi/spi-pl022.c Kiran Padwal 2014-09-18 2130 } b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2131 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2132 /* b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2133 * Bus Number Which has been Assigned to this SSP controller b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2134 * on this board b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2135 */ b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2136 master->bus_num = platform_info->bus_id; 6e5614b6476001a drivers/spi/spi-pl022.c Linus Walleij 2019-06-25 2137 master->use_gpio_descriptors; 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2138 master->num_chipselect = num_cs; 6e5614b6476001a drivers/spi/spi-pl022.c Linus Walleij 2019-06-25 2139 master->set_cs = pl022_set_cs; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2140 master->cleanup = pl022_cleanup; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2141 master->setup = pl022_setup; 29b6e906a70a47c drivers/spi/spi-pl022.c Mark Brown 2013-07-28 2142 master->auto_runtime_pm = true; ffbbdd21329f3e1 drivers/spi/spi-pl022.c Linus Walleij 2012-02-22 2143 master->transfer_one_message = pl022_transfer_one_message; ffbbdd21329f3e1 drivers/spi/spi-pl022.c Linus Walleij 2012-02-22 2144 master->unprepare_transfer_hardware = pl022_unprepare_transfer_hardware; ffbbdd21329f3e1 drivers/spi/spi-pl022.c Linus Walleij 2012-02-22 2145 master->rt = platform_info->rt; 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2146 master->dev.of_node = dev->of_node; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2147 516843702bb5fd8 drivers/spi/spi-pl022.c Linus Walleij 2019-04-28 2148 if (pl022->vendor->internal_cs_ctrl) { db4fa45ed3182d8 drivers/spi/spi-pl022.c Anders Berg 2014-09-17 2149 for (i = 0; i < num_cs; i++) db4fa45ed3182d8 drivers/spi/spi-pl022.c Anders Berg 2014-09-17 2150 pl022->chipselects[i] = i; 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2151 } else if (IS_ENABLED(CONFIG_OF)) { 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2152 for (i = 0; i < num_cs; i++) { 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2153 int cs_gpio = of_get_named_gpio(np, "cs-gpios", i); 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2154 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2155 if (cs_gpio == -EPROBE_DEFER) { 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2156 status = -EPROBE_DEFER; 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2157 goto err_no_gpio; 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2158 } 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2159 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2160 pl022->chipselects[i] = cs_gpio; 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2161 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2162 if (gpio_is_valid(cs_gpio)) { aeef9915b9a40d2 drivers/spi/spi-pl022.c Linus Walleij 2012-09-26 2163 if (devm_gpio_request(dev, cs_gpio, "ssp-pl022")) 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2164 dev_err(&adev->dev, 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2165 "could not request %d gpio\n", 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2166 cs_gpio); 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2167 else if (gpio_direction_output(cs_gpio, 1)) 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2168 dev_err(&adev->dev, 61e89e65e31516c drivers/spi/spi-pl022.c Roland Stigge 2014-09-09 2169 "could not set gpio %d as output\n", 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2170 cs_gpio); 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2171 } 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2172 } 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2173 } f6f46de1063c882 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2174 bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2175 /* bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2176 * Supports mode 0-3, loopback, and active low CS. Transfers are bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2177 * always MS bit first on the original pl022. bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2178 */ bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2179 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2180 if (pl022->vendor->extended_cr) bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2181 master->mode_bits |= SPI_LSB_FIRST; bde435a9ca376d0 drivers/spi/amba-pl022.c Kevin Wells 2010-09-16 2182 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2183 dev_dbg(&adev->dev, "BUSNO: %d\n", master->bus_num); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2184 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2185 status = amba_request_regions(adev, NULL); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2186 if (status) b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2187 goto err_no_ioregion; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2188 b1b6b9aa6fd32db drivers/spi/amba-pl022.c Linus Walleij 2010-09-29 2189 pl022->phybase = adev->res.start; aeef9915b9a40d2 drivers/spi/spi-pl022.c Linus Walleij 2012-09-26 2190 pl022->virtbase = devm_ioremap(dev, adev->res.start, aeef9915b9a40d2 drivers/spi/spi-pl022.c Linus Walleij 2012-09-26 2191 resource_size(&adev->res)); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2192 if (pl022->virtbase == NULL) { b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2193 status = -ENOMEM; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2194 goto err_no_ioremap; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2195 } 2c067509a1e3540 drivers/spi/spi-pl022.c Jingoo Han 2013-10-11 2196 dev_info(&adev->dev, "mapped registers from %pa to %p\n", 7085f403517615c drivers/spi/spi-pl022.c Fabio Estevam 2013-08-21 2197 &adev->res.start, pl022->virtbase); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2198 aeef9915b9a40d2 drivers/spi/spi-pl022.c Linus Walleij 2012-09-26 2199 pl022->clk = devm_clk_get(&adev->dev, NULL); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2200 if (IS_ERR(pl022->clk)) { b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2201 status = PTR_ERR(pl022->clk); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2202 dev_err(&adev->dev, "could not retrieve SSP/SPI bus clock\n"); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2203 goto err_no_clk; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2204 } 7ff6bcf048e6a98 drivers/spi/spi-pl022.c Russell King 2011-09-22 2205 6cac167b826eced drivers/spi/spi-pl022.c Ulf Hansson 2014-02-04 2206 status = clk_prepare_enable(pl022->clk); 71e63e748ee6f4b drivers/spi/spi-pl022.c Ulf Hansson 2011-11-04 2207 if (status) { 71e63e748ee6f4b drivers/spi/spi-pl022.c Ulf Hansson 2011-11-04 2208 dev_err(&adev->dev, "could not enable SSP/SPI bus clock\n"); 71e63e748ee6f4b drivers/spi/spi-pl022.c Ulf Hansson 2011-11-04 2209 goto err_no_clk_en; 71e63e748ee6f4b drivers/spi/spi-pl022.c Ulf Hansson 2011-11-04 2210 } 71e63e748ee6f4b drivers/spi/spi-pl022.c Ulf Hansson 2011-11-04 2211 ffbbdd21329f3e1 drivers/spi/spi-pl022.c Linus Walleij 2012-02-22 2212 /* Initialize transfer pump */ ffbbdd21329f3e1 drivers/spi/spi-pl022.c Linus Walleij 2012-02-22 2213 tasklet_init(&pl022->pump_transfers, pump_transfers, ffbbdd21329f3e1 drivers/spi/spi-pl022.c Linus Walleij 2012-02-22 2214 (unsigned long)pl022); ffbbdd21329f3e1 drivers/spi/spi-pl022.c Linus Walleij 2012-02-22 2215 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2216 /* Disable SSP */ b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2217 writew((readw(SSP_CR1(pl022->virtbase)) & (~SSP_CR1_MASK_SSE)), b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2218 SSP_CR1(pl022->virtbase)); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2219 load_ssp_default_config(pl022); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2220 aeef9915b9a40d2 drivers/spi/spi-pl022.c Linus Walleij 2012-09-26 2221 status = devm_request_irq(dev, adev->irq[0], pl022_interrupt_handler, aeef9915b9a40d2 drivers/spi/spi-pl022.c Linus Walleij 2012-09-26 2222 0, "pl022", pl022); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2223 if (status < 0) { b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2224 dev_err(&adev->dev, "probe - cannot get IRQ (%d)\n", status); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2225 goto err_no_irq; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2226 } b1b6b9aa6fd32db drivers/spi/amba-pl022.c Linus Walleij 2010-09-29 2227 dc715452e914515 drivers/spi/spi-pl022.c Arnd Bergmann 2013-01-28 2228 /* Get DMA channels, try autoconfiguration first */ dc715452e914515 drivers/spi/spi-pl022.c Arnd Bergmann 2013-01-28 2229 status = pl022_dma_autoprobe(pl022); f3d4bb3342630cd drivers/spi/spi-pl022.c Rabin Vincent 2015-11-23 2230 if (status == -EPROBE_DEFER) { f3d4bb3342630cd drivers/spi/spi-pl022.c Rabin Vincent 2015-11-23 2231 dev_dbg(dev, "deferring probe to get DMA channel\n"); f3d4bb3342630cd drivers/spi/spi-pl022.c Rabin Vincent 2015-11-23 2232 goto err_no_irq; f3d4bb3342630cd drivers/spi/spi-pl022.c Rabin Vincent 2015-11-23 2233 } dc715452e914515 drivers/spi/spi-pl022.c Arnd Bergmann 2013-01-28 2234 dc715452e914515 drivers/spi/spi-pl022.c Arnd Bergmann 2013-01-28 2235 /* If that failed, use channels from platform_info */ dc715452e914515 drivers/spi/spi-pl022.c Arnd Bergmann 2013-01-28 2236 if (status == 0) dc715452e914515 drivers/spi/spi-pl022.c Arnd Bergmann 2013-01-28 2237 platform_info->enable_dma = 1; dc715452e914515 drivers/spi/spi-pl022.c Arnd Bergmann 2013-01-28 2238 else if (platform_info->enable_dma) { b1b6b9aa6fd32db drivers/spi/amba-pl022.c Linus Walleij 2010-09-29 2239 status = pl022_dma_probe(pl022); b1b6b9aa6fd32db drivers/spi/amba-pl022.c Linus Walleij 2010-09-29 2240 if (status != 0) 43c640157d4366a drivers/spi/amba-pl022.c Viresh Kumar 2011-05-16 2241 platform_info->enable_dma = 0; b1b6b9aa6fd32db drivers/spi/amba-pl022.c Linus Walleij 2010-09-29 2242 } b1b6b9aa6fd32db drivers/spi/amba-pl022.c Linus Walleij 2010-09-29 2243 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2244 /* Register with the SPI framework */ b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2245 amba_set_drvdata(adev, pl022); 35794a77168b739 drivers/spi/spi-pl022.c Jingoo Han 2013-09-24 2246 status = devm_spi_register_master(&adev->dev, master); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2247 if (status != 0) { b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2248 dev_err(&adev->dev, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2249 "probe - problem registering spi master\n"); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2250 goto err_spi_register; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2251 } 25985edcedea639 drivers/spi/amba-pl022.c Lucas De Marchi 2011-03-30 2252 dev_dbg(dev, "probe succeeded\n"); 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2253 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2254 /* let runtime pm put suspend */ 53e4acea0e819a6 drivers/spi/spi-pl022.c Chris Blair 2011-11-08 2255 if (platform_info->autosuspend_delay > 0) { 53e4acea0e819a6 drivers/spi/spi-pl022.c Chris Blair 2011-11-08 2256 dev_info(&adev->dev, 53e4acea0e819a6 drivers/spi/spi-pl022.c Chris Blair 2011-11-08 2257 "will use autosuspend for runtime pm, delay %dms\n", 53e4acea0e819a6 drivers/spi/spi-pl022.c Chris Blair 2011-11-08 2258 platform_info->autosuspend_delay); 53e4acea0e819a6 drivers/spi/spi-pl022.c Chris Blair 2011-11-08 2259 pm_runtime_set_autosuspend_delay(dev, 53e4acea0e819a6 drivers/spi/spi-pl022.c Chris Blair 2011-11-08 2260 platform_info->autosuspend_delay); 53e4acea0e819a6 drivers/spi/spi-pl022.c Chris Blair 2011-11-08 2261 pm_runtime_use_autosuspend(dev); 53e4acea0e819a6 drivers/spi/spi-pl022.c Chris Blair 2011-11-08 2262 } 0df349945752bf0 drivers/spi/spi-pl022.c Ulf Hansson 2012-10-17 2263 pm_runtime_put(dev); 0df349945752bf0 drivers/spi/spi-pl022.c Ulf Hansson 2012-10-17 2264 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2265 return 0; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2266 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2267 err_spi_register: 3e3ea716270dc64 drivers/spi/spi-pl022.c Viresh Kumar 2011-08-10 2268 if (platform_info->enable_dma) b1b6b9aa6fd32db drivers/spi/amba-pl022.c Linus Walleij 2010-09-29 2269 pl022_dma_remove(pl022); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2270 err_no_irq: 6cac167b826eced drivers/spi/spi-pl022.c Ulf Hansson 2014-02-04 2271 clk_disable_unprepare(pl022->clk); 71e63e748ee6f4b drivers/spi/spi-pl022.c Ulf Hansson 2011-11-04 2272 err_no_clk_en: b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2273 err_no_clk: b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2274 err_no_ioremap: b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2275 amba_release_regions(adev); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2276 err_no_ioregion: 6d3952a7dfa8091 drivers/spi/spi-pl022.c Roland Stigge 2012-08-22 2277 err_no_gpio: 73e3f1eb5188830 drivers/spi/spi-pl022.c Kiran Padwal 2014-09-18 2278 err_no_mem: b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2279 spi_master_put(master); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2280 return status; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2281 } b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2282 fd4a319bc933ae9 drivers/spi/spi-pl022.c Grant Likely 2012-12-07 2283 static int b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2284 pl022_remove(struct amba_device *adev) b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2285 { b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2286 struct pl022 *pl022 = amba_get_drvdata(adev); 50658b6602dad6d drivers/spi/spi-pl022.c Linus Walleij 2011-08-02 2287 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2288 if (!pl022) b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2289 return 0; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2290 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2291 /* 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2292 * undo pm_runtime_put() in probe. I assume that we're not 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2293 * accessing the primecell here. 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2294 */ 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2295 pm_runtime_get_noresume(&adev->dev); 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2296 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2297 load_ssp_default_config(pl022); 3e3ea716270dc64 drivers/spi/spi-pl022.c Viresh Kumar 2011-08-10 2298 if (pl022->master_info->enable_dma) b1b6b9aa6fd32db drivers/spi/amba-pl022.c Linus Walleij 2010-09-29 2299 pl022_dma_remove(pl022); 3e3ea716270dc64 drivers/spi/spi-pl022.c Viresh Kumar 2011-08-10 2300 6cac167b826eced drivers/spi/spi-pl022.c Ulf Hansson 2014-02-04 2301 clk_disable_unprepare(pl022->clk); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2302 amba_release_regions(adev); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2303 tasklet_disable(&pl022->pump_transfers); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2304 return 0; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2305 } b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2306 84a5dc41f64faad drivers/spi/spi-pl022.c Ulf Hansson 2014-03-01 2307 #ifdef CONFIG_PM_SLEEP 6cfa6279edbffa9 drivers/spi/spi-pl022.c Peter Hüwe 2011-09-05 2308 static int pl022_suspend(struct device *dev) b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2309 { 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2310 struct pl022 *pl022 = dev_get_drvdata(dev); ffbbdd21329f3e1 drivers/spi/spi-pl022.c Linus Walleij 2012-02-22 2311 int ret; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2312 ffbbdd21329f3e1 drivers/spi/spi-pl022.c Linus Walleij 2012-02-22 2313 ret = spi_master_suspend(pl022->master); 7c5d8a249acadc3 drivers/spi/spi-pl022.c Geert Uytterhoeven 2018-09-05 2314 if (ret) ffbbdd21329f3e1 drivers/spi/spi-pl022.c Linus Walleij 2012-02-22 2315 return ret; 4964a26df72c4a8 drivers/spi/spi-pl022.c Ulf Hansson 2012-10-17 2316 84a5dc41f64faad drivers/spi/spi-pl022.c Ulf Hansson 2014-03-01 2317 ret = pm_runtime_force_suspend(dev); 84a5dc41f64faad drivers/spi/spi-pl022.c Ulf Hansson 2014-03-01 2318 if (ret) { 84a5dc41f64faad drivers/spi/spi-pl022.c Ulf Hansson 2014-03-01 2319 spi_master_resume(pl022->master); 84a5dc41f64faad drivers/spi/spi-pl022.c Ulf Hansson 2014-03-01 2320 return ret; 84a5dc41f64faad drivers/spi/spi-pl022.c Ulf Hansson 2014-03-01 2321 } 84a5dc41f64faad drivers/spi/spi-pl022.c Ulf Hansson 2014-03-01 2322 84a5dc41f64faad drivers/spi/spi-pl022.c Ulf Hansson 2014-03-01 2323 pinctrl_pm_select_sleep_state(dev); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2324 6cfa6279edbffa9 drivers/spi/spi-pl022.c Peter Hüwe 2011-09-05 2325 dev_dbg(dev, "suspended\n"); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2326 return 0; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2327 } b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2328 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2329 static int pl022_resume(struct device *dev) b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2330 { 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2331 struct pl022 *pl022 = dev_get_drvdata(dev); ffbbdd21329f3e1 drivers/spi/spi-pl022.c Linus Walleij 2012-02-22 2332 int ret; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2333 84a5dc41f64faad drivers/spi/spi-pl022.c Ulf Hansson 2014-03-01 2334 ret = pm_runtime_force_resume(dev); 84a5dc41f64faad drivers/spi/spi-pl022.c Ulf Hansson 2014-03-01 2335 if (ret) 84a5dc41f64faad drivers/spi/spi-pl022.c Ulf Hansson 2014-03-01 2336 dev_err(dev, "problem resuming\n"); ada7aec7eec0ca2 drivers/spi/spi-pl022.c Linus Walleij 2012-09-26 2337 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2338 /* Start the queue running */ ffbbdd21329f3e1 drivers/spi/spi-pl022.c Linus Walleij 2012-02-22 2339 ret = spi_master_resume(pl022->master); 7c5d8a249acadc3 drivers/spi/spi-pl022.c Geert Uytterhoeven 2018-09-05 2340 if (!ret) 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2341 dev_dbg(dev, "resumed\n"); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2342 ffbbdd21329f3e1 drivers/spi/spi-pl022.c Linus Walleij 2012-02-22 2343 return ret; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2344 } 84a5dc41f64faad drivers/spi/spi-pl022.c Ulf Hansson 2014-03-01 2345 #endif b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2346 736198b0486c8d5 drivers/spi/spi-pl022.c Ulf Hansson 2014-03-01 2347 #ifdef CONFIG_PM 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2348 static int pl022_runtime_suspend(struct device *dev) 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2349 { 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2350 struct pl022 *pl022 = dev_get_drvdata(dev); 4f5e1b370845a0a drivers/spi/spi-pl022.c Patrice Chotard 2012-09-19 2351 84a5dc41f64faad drivers/spi/spi-pl022.c Ulf Hansson 2014-03-01 2352 clk_disable_unprepare(pl022->clk); 84a5dc41f64faad drivers/spi/spi-pl022.c Ulf Hansson 2014-03-01 2353 pinctrl_pm_select_idle_state(dev); 84a5dc41f64faad drivers/spi/spi-pl022.c Ulf Hansson 2014-03-01 2354 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2355 return 0; 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2356 } 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2357 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2358 static int pl022_runtime_resume(struct device *dev) 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2359 { 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2360 struct pl022 *pl022 = dev_get_drvdata(dev); 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2361 84a5dc41f64faad drivers/spi/spi-pl022.c Ulf Hansson 2014-03-01 2362 pinctrl_pm_select_default_state(dev); 84a5dc41f64faad drivers/spi/spi-pl022.c Ulf Hansson 2014-03-01 2363 clk_prepare_enable(pl022->clk); 84a5dc41f64faad drivers/spi/spi-pl022.c Ulf Hansson 2014-03-01 2364 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2365 return 0; 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2366 } 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2367 #endif 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2368 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2369 static const struct dev_pm_ops pl022_dev_pm_ops = { 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2370 SET_SYSTEM_SLEEP_PM_OPS(pl022_suspend, pl022_resume) 6ed23b806e73bdd drivers/spi/spi-pl022.c Rafael J. Wysocki 2014-12-04 2371 SET_RUNTIME_PM_OPS(pl022_runtime_suspend, pl022_runtime_resume, NULL) 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2372 }; 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2373 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2374 static struct vendor_data vendor_arm = { b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2375 .fifodepth = 8, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2376 .max_bpw = 16, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2377 .unidir = false, 556f4aeb7d9dfac drivers/spi/amba-pl022.c Linus Walleij 2010-05-05 2378 .extended_cr = false, 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 2379 .pl023 = false, 06fb01fd1dc624d drivers/spi/amba-pl022.c Philippe Langlais 2011-03-23 2380 .loopback = true, db4fa45ed3182d8 drivers/spi/spi-pl022.c Anders Berg 2014-09-17 2381 .internal_cs_ctrl = false, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2382 }; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2383 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2384 static struct vendor_data vendor_st = { b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2385 .fifodepth = 32, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2386 .max_bpw = 32, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2387 .unidir = false, 556f4aeb7d9dfac drivers/spi/amba-pl022.c Linus Walleij 2010-05-05 2388 .extended_cr = true, 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 2389 .pl023 = false, 06fb01fd1dc624d drivers/spi/amba-pl022.c Philippe Langlais 2011-03-23 2390 .loopback = true, db4fa45ed3182d8 drivers/spi/spi-pl022.c Anders Berg 2014-09-17 2391 .internal_cs_ctrl = false, 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 2392 }; 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 2393 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 2394 static struct vendor_data vendor_st_pl023 = { 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 2395 .fifodepth = 32, 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 2396 .max_bpw = 32, 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 2397 .unidir = false, 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 2398 .extended_cr = true, 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 2399 .pl023 = true, 06fb01fd1dc624d drivers/spi/amba-pl022.c Philippe Langlais 2011-03-23 2400 .loopback = false, db4fa45ed3182d8 drivers/spi/spi-pl022.c Anders Berg 2014-09-17 2401 .internal_cs_ctrl = false, db4fa45ed3182d8 drivers/spi/spi-pl022.c Anders Berg 2014-09-17 2402 }; db4fa45ed3182d8 drivers/spi/spi-pl022.c Anders Berg 2014-09-17 2403 db4fa45ed3182d8 drivers/spi/spi-pl022.c Anders Berg 2014-09-17 2404 static struct vendor_data vendor_lsi = { db4fa45ed3182d8 drivers/spi/spi-pl022.c Anders Berg 2014-09-17 2405 .fifodepth = 8, db4fa45ed3182d8 drivers/spi/spi-pl022.c Anders Berg 2014-09-17 2406 .max_bpw = 16, db4fa45ed3182d8 drivers/spi/spi-pl022.c Anders Berg 2014-09-17 2407 .unidir = false, db4fa45ed3182d8 drivers/spi/spi-pl022.c Anders Berg 2014-09-17 2408 .extended_cr = false, db4fa45ed3182d8 drivers/spi/spi-pl022.c Anders Berg 2014-09-17 2409 .pl023 = false, db4fa45ed3182d8 drivers/spi/spi-pl022.c Anders Berg 2014-09-17 2410 .loopback = true, db4fa45ed3182d8 drivers/spi/spi-pl022.c Anders Berg 2014-09-17 2411 .internal_cs_ctrl = true, 06fb01fd1dc624d drivers/spi/amba-pl022.c Philippe Langlais 2011-03-23 2412 }; 06fb01fd1dc624d drivers/spi/amba-pl022.c Philippe Langlais 2011-03-23 2413 5b8d5ad2308d2d5 drivers/spi/spi-pl022.c Arvind Yadav 2017-08-23 2414 static const struct amba_id pl022_ids[] = { b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2415 { b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2416 /* b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2417 * ARM PL022 variant, this has a 16bit wide b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2418 * and 8 locations deep TX/RX FIFO b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2419 */ b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2420 .id = 0x00041022, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2421 .mask = 0x000fffff, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2422 .data = &vendor_arm, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2423 }, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2424 { b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2425 /* b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2426 * ST Micro derivative, this has 32bit wide b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2427 * and 32 locations deep TX/RX FIFO b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2428 */ e89e04fcdce6146 drivers/spi/amba-pl022.c Srinidhi Kasagar 2009-10-05 2429 .id = 0x01080022, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2430 .mask = 0xffffffff, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2431 .data = &vendor_st, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2432 }, 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 2433 { 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 2434 /* 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 2435 * ST-Ericsson derivative "PL023" (this is not 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 2436 * an official ARM number), this is a PL022 SSP block 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 2437 * stripped to SPI mode only, it has 32bit wide 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 2438 * and 32 locations deep TX/RX FIFO but no extended 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 2439 * CR0/CR1 register 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 2440 */ 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 2441 .id = 0x00080023, 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 2442 .mask = 0xffffffff, 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 2443 .data = &vendor_st_pl023, 781c7b129b1beb8 drivers/spi/amba-pl022.c Linus Walleij 2010-05-07 2444 }, db4fa45ed3182d8 drivers/spi/spi-pl022.c Anders Berg 2014-09-17 2445 { db4fa45ed3182d8 drivers/spi/spi-pl022.c Anders Berg 2014-09-17 2446 /* db4fa45ed3182d8 drivers/spi/spi-pl022.c Anders Berg 2014-09-17 2447 * PL022 variant that has a chip select control register whih db4fa45ed3182d8 drivers/spi/spi-pl022.c Anders Berg 2014-09-17 2448 * allows control of 5 output signals nCS[0:4]. db4fa45ed3182d8 drivers/spi/spi-pl022.c Anders Berg 2014-09-17 2449 */ db4fa45ed3182d8 drivers/spi/spi-pl022.c Anders Berg 2014-09-17 2450 .id = 0x000b6022, db4fa45ed3182d8 drivers/spi/spi-pl022.c Anders Berg 2014-09-17 2451 .mask = 0x000fffff, db4fa45ed3182d8 drivers/spi/spi-pl022.c Anders Berg 2014-09-17 2452 .data = &vendor_lsi, db4fa45ed3182d8 drivers/spi/spi-pl022.c Anders Berg 2014-09-17 2453 }, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2454 { 0, 0 }, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2455 }; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2456 7eeac71b9fc9b3d drivers/spi/spi-pl022.c Dave Martin 2011-10-05 2457 MODULE_DEVICE_TABLE(amba, pl022_ids); 7eeac71b9fc9b3d drivers/spi/spi-pl022.c Dave Martin 2011-10-05 2458 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2459 static struct amba_driver pl022_driver = { b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2460 .drv = { b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2461 .name = "ssp-pl022", 92b97f0aaccbf9d drivers/spi/spi-pl022.c Russell King 2011-08-14 2462 .pm = &pl022_dev_pm_ops, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2463 }, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2464 .id_table = pl022_ids, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2465 .probe = pl022_probe, fd4a319bc933ae9 drivers/spi/spi-pl022.c Grant Likely 2012-12-07 2466 .remove = pl022_remove, b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2467 }; b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2468 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2469 static int __init pl022_init(void) b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2470 { b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2471 return amba_driver_register(&pl022_driver); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2472 } 25c8e03bdb769df drivers/spi/amba-pl022.c Linus Walleij 2010-09-06 2473 subsys_initcall(pl022_init); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2474 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2475 static void __exit pl022_exit(void) b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2476 { b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2477 amba_driver_unregister(&pl022_driver); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2478 } b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2479 module_exit(pl022_exit); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2480 b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2481 MODULE_AUTHOR("Linus Walleij <linus.walleij@xxxxxxxxxxxxxx>"); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2482 MODULE_DESCRIPTION("PL022 SSP Controller Driver"); b43d65f7e818485 drivers/spi/amba-pl022.c Linus Walleij 2009-06-09 2483 MODULE_LICENSE("GPL"); :::::: The code at line 1852 was first introduced by commit :::::: 6d3952a7dfa80919842bbe01ac7f693d40a1eb84 spi/pl022: Add devicetree support :::::: TO: Roland Stigge <stigge@xxxxxxxxx> :::::: CC: Mark Brown <broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: application/gzip