spi-fsl-spi.c (ee3e542fec6e69bc9fb668698889a37d93950ddf) spi-fsl-spi.c (8074cf063e410a2c0cf1704c3b31002e21f5df7c)
1/*
2 * Freescale SPI controller driver.
3 *
4 * Maintainer: Kumar Gala
5 *
6 * Copyright (C) 2006 Polycom, Inc.
7 * Copyright 2010 Freescale Semiconductor, Inc.
8 *

--- 560 unchanged lines hidden (view full) ---

569 slvsel = mpc8xxx_spi_read_reg(&reg_base->slvsel);
570 slvsel = on ? (slvsel | (1 << cs)) : (slvsel & ~(1 << cs));
571 mpc8xxx_spi_write_reg(&reg_base->slvsel, slvsel);
572 }
573}
574
575static void fsl_spi_grlib_probe(struct device *dev)
576{
1/*
2 * Freescale SPI controller driver.
3 *
4 * Maintainer: Kumar Gala
5 *
6 * Copyright (C) 2006 Polycom, Inc.
7 * Copyright 2010 Freescale Semiconductor, Inc.
8 *

--- 560 unchanged lines hidden (view full) ---

569 slvsel = mpc8xxx_spi_read_reg(&reg_base->slvsel);
570 slvsel = on ? (slvsel | (1 << cs)) : (slvsel & ~(1 << cs));
571 mpc8xxx_spi_write_reg(&reg_base->slvsel, slvsel);
572 }
573}
574
575static void fsl_spi_grlib_probe(struct device *dev)
576{
577 struct fsl_spi_platform_data *pdata = dev->platform_data;
577 struct fsl_spi_platform_data *pdata = dev_get_platdata(dev);
578 struct spi_master *master = dev_get_drvdata(dev);
579 struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(master);
580 struct fsl_spi_reg *reg_base = mpc8xxx_spi->reg_base;
581 int mbits;
582 u32 capabilities;
583
584 capabilities = mpc8xxx_spi_read_reg(&reg_base->cap);
585

--- 9 unchanged lines hidden (view full) ---

595 }
596 master->num_chipselect = mpc8xxx_spi->native_chipselects;
597 pdata->cs_control = fsl_spi_grlib_cs_control;
598}
599
600static struct spi_master * fsl_spi_probe(struct device *dev,
601 struct resource *mem, unsigned int irq)
602{
578 struct spi_master *master = dev_get_drvdata(dev);
579 struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(master);
580 struct fsl_spi_reg *reg_base = mpc8xxx_spi->reg_base;
581 int mbits;
582 u32 capabilities;
583
584 capabilities = mpc8xxx_spi_read_reg(&reg_base->cap);
585

--- 9 unchanged lines hidden (view full) ---

595 }
596 master->num_chipselect = mpc8xxx_spi->native_chipselects;
597 pdata->cs_control = fsl_spi_grlib_cs_control;
598}
599
600static struct spi_master * fsl_spi_probe(struct device *dev,
601 struct resource *mem, unsigned int irq)
602{
603 struct fsl_spi_platform_data *pdata = dev->platform_data;
603 struct fsl_spi_platform_data *pdata = dev_get_platdata(dev);
604 struct spi_master *master;
605 struct mpc8xxx_spi *mpc8xxx_spi;
606 struct fsl_spi_reg *reg_base;
607 u32 regval;
608 int ret = 0;
609
610 master = spi_alloc_master(dev, sizeof(struct mpc8xxx_spi));
611 if (master == NULL) {

--- 83 unchanged lines hidden (view full) ---

695 spi_master_put(master);
696err:
697 return ERR_PTR(ret);
698}
699
700static void fsl_spi_cs_control(struct spi_device *spi, bool on)
701{
702 struct device *dev = spi->dev.parent->parent;
604 struct spi_master *master;
605 struct mpc8xxx_spi *mpc8xxx_spi;
606 struct fsl_spi_reg *reg_base;
607 u32 regval;
608 int ret = 0;
609
610 master = spi_alloc_master(dev, sizeof(struct mpc8xxx_spi));
611 if (master == NULL) {

--- 83 unchanged lines hidden (view full) ---

695 spi_master_put(master);
696err:
697 return ERR_PTR(ret);
698}
699
700static void fsl_spi_cs_control(struct spi_device *spi, bool on)
701{
702 struct device *dev = spi->dev.parent->parent;
703 struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(dev->platform_data);
703 struct fsl_spi_platform_data *pdata = dev_get_platdata(dev);
704 struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata);
704 u16 cs = spi->chip_select;
705 int gpio = pinfo->gpios[cs];
706 bool alow = pinfo->alow_flags[cs];
707
708 gpio_set_value(gpio, on ^ alow);
709}
710
711static int of_fsl_spi_get_chipselects(struct device *dev)
712{
713 struct device_node *np = dev->of_node;
705 u16 cs = spi->chip_select;
706 int gpio = pinfo->gpios[cs];
707 bool alow = pinfo->alow_flags[cs];
708
709 gpio_set_value(gpio, on ^ alow);
710}
711
712static int of_fsl_spi_get_chipselects(struct device *dev)
713{
714 struct device_node *np = dev->of_node;
714 struct fsl_spi_platform_data *pdata = dev->platform_data;
715 struct fsl_spi_platform_data *pdata = dev_get_platdata(dev);
715 struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata);
716 int ngpios;
717 int i = 0;
718 int ret;
719
720 ngpios = of_gpio_count(np);
721 if (ngpios <= 0) {
722 /*

--- 62 unchanged lines hidden (view full) ---

785err_alloc_flags:
786 kfree(pinfo->gpios);
787 pinfo->gpios = NULL;
788 return ret;
789}
790
791static int of_fsl_spi_free_chipselects(struct device *dev)
792{
716 struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata);
717 int ngpios;
718 int i = 0;
719 int ret;
720
721 ngpios = of_gpio_count(np);
722 if (ngpios <= 0) {
723 /*

--- 62 unchanged lines hidden (view full) ---

786err_alloc_flags:
787 kfree(pinfo->gpios);
788 pinfo->gpios = NULL;
789 return ret;
790}
791
792static int of_fsl_spi_free_chipselects(struct device *dev)
793{
793 struct fsl_spi_platform_data *pdata = dev->platform_data;
794 struct fsl_spi_platform_data *pdata = dev_get_platdata(dev);
794 struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata);
795 int i;
796
797 if (!pinfo->gpios)
798 return 0;
799
800 for (i = 0; i < pdata->max_chipselect; i++) {
801 if (gpio_is_valid(pinfo->gpios[i]))

--- 82 unchanged lines hidden (view full) ---

884 * as well.
885 */
886static int plat_mpc8xxx_spi_probe(struct platform_device *pdev)
887{
888 struct resource *mem;
889 int irq;
890 struct spi_master *master;
891
795 struct mpc8xxx_spi_probe_info *pinfo = to_of_pinfo(pdata);
796 int i;
797
798 if (!pinfo->gpios)
799 return 0;
800
801 for (i = 0; i < pdata->max_chipselect; i++) {
802 if (gpio_is_valid(pinfo->gpios[i]))

--- 82 unchanged lines hidden (view full) ---

885 * as well.
886 */
887static int plat_mpc8xxx_spi_probe(struct platform_device *pdev)
888{
889 struct resource *mem;
890 int irq;
891 struct spi_master *master;
892
892 if (!pdev->dev.platform_data)
893 if (!dev_get_platdata(&pdev->dev))
893 return -EINVAL;
894
895 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
896 if (!mem)
897 return -EINVAL;
898
899 irq = platform_get_irq(pdev, 0);
900 if (irq <= 0)

--- 56 unchanged lines hidden ---
894 return -EINVAL;
895
896 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
897 if (!mem)
898 return -EINVAL;
899
900 irq = platform_get_irq(pdev, 0);
901 if (irq <= 0)

--- 56 unchanged lines hidden ---