* [PATCH v6 0/2] mmc: host: s3cmci: add device tree support @ 2017-03-31 23:50 ` Sergio Prado 0 siblings, 0 replies; 13+ messages in thread From: Sergio Prado @ 2017-03-31 23:50 UTC (permalink / raw) To: ulf.hansson, robh+dt, mark.rutland, linux-mmc, devicetree, linux-kernel, ben-linux, linux-arm-kernel Cc: Sergio Prado This series adds support for configuring Samsung's S3C24XX MMC/SD/SDIO controller via device tree. Tested on FriendlyARM mini2440, based on s3c2440 SoC. Changes since v5 (as reported by Arnd Bergmann) - fix module device table name that was causing an error when building the driver as a module Changes since v4 (as suggested by Jaehoon Chung): - using just a flag as a data structure for the driver to check for s3c2400 compatibility Changes since v3 (as suggested by Rob Herring): - describing properties that wasn't documented and removing unnecessary comment in the device tree binding Changes since v2: - struct "s3cmci_drv_data" and flag "is2440" renamed - copying the whole driver data struct instead of only its member so it will be easier to extend the information in the future - using mmc_of_parse() to read "cd-gpios" and "wp-gpios" properties from device tree Changes since v1: - pinctrl description removed from DT binding - unit and label on DT binding renamed to mmc Sergio Prado (2): dt-bindings: mmc: add DT binding for S3C24XX MMC/SD/SDIO controller mmc: host: s3cmci: allow probing from device tree .../devicetree/bindings/mmc/samsung,s3cmci.txt | 42 ++++ drivers/mmc/host/s3cmci.c | 257 ++++++++++----------- 2 files changed, 168 insertions(+), 131 deletions(-) create mode 100644 Documentation/devicetree/bindings/mmc/samsung,s3cmci.txt -- 1.9.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v6 0/2] mmc: host: s3cmci: add device tree support @ 2017-03-31 23:50 ` Sergio Prado 0 siblings, 0 replies; 13+ messages in thread From: Sergio Prado @ 2017-03-31 23:50 UTC (permalink / raw) To: linux-arm-kernel This series adds support for configuring Samsung's S3C24XX MMC/SD/SDIO controller via device tree. Tested on FriendlyARM mini2440, based on s3c2440 SoC. Changes since v5 (as reported by Arnd Bergmann) - fix module device table name that was causing an error when building the driver as a module Changes since v4 (as suggested by Jaehoon Chung): - using just a flag as a data structure for the driver to check for s3c2400 compatibility Changes since v3 (as suggested by Rob Herring): - describing properties that wasn't documented and removing unnecessary comment in the device tree binding Changes since v2: - struct "s3cmci_drv_data" and flag "is2440" renamed - copying the whole driver data struct instead of only its member so it will be easier to extend the information in the future - using mmc_of_parse() to read "cd-gpios" and "wp-gpios" properties from device tree Changes since v1: - pinctrl description removed from DT binding - unit and label on DT binding renamed to mmc Sergio Prado (2): dt-bindings: mmc: add DT binding for S3C24XX MMC/SD/SDIO controller mmc: host: s3cmci: allow probing from device tree .../devicetree/bindings/mmc/samsung,s3cmci.txt | 42 ++++ drivers/mmc/host/s3cmci.c | 257 ++++++++++----------- 2 files changed, 168 insertions(+), 131 deletions(-) create mode 100644 Documentation/devicetree/bindings/mmc/samsung,s3cmci.txt -- 1.9.1 ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v6 0/2] mmc: host: s3cmci: add device tree support @ 2017-03-31 23:50 ` Sergio Prado 0 siblings, 0 replies; 13+ messages in thread From: Sergio Prado @ 2017-03-31 23:50 UTC (permalink / raw) To: ulf.hansson-QSEj5FYQhm4dnm+yROfE0A, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8, linux-mmc-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, ben-linux-elnMNo+KYs3YtjvyW6yDsg, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r Cc: Sergio Prado This series adds support for configuring Samsung's S3C24XX MMC/SD/SDIO controller via device tree. Tested on FriendlyARM mini2440, based on s3c2440 SoC. Changes since v5 (as reported by Arnd Bergmann) - fix module device table name that was causing an error when building the driver as a module Changes since v4 (as suggested by Jaehoon Chung): - using just a flag as a data structure for the driver to check for s3c2400 compatibility Changes since v3 (as suggested by Rob Herring): - describing properties that wasn't documented and removing unnecessary comment in the device tree binding Changes since v2: - struct "s3cmci_drv_data" and flag "is2440" renamed - copying the whole driver data struct instead of only its member so it will be easier to extend the information in the future - using mmc_of_parse() to read "cd-gpios" and "wp-gpios" properties from device tree Changes since v1: - pinctrl description removed from DT binding - unit and label on DT binding renamed to mmc Sergio Prado (2): dt-bindings: mmc: add DT binding for S3C24XX MMC/SD/SDIO controller mmc: host: s3cmci: allow probing from device tree .../devicetree/bindings/mmc/samsung,s3cmci.txt | 42 ++++ drivers/mmc/host/s3cmci.c | 257 ++++++++++----------- 2 files changed, 168 insertions(+), 131 deletions(-) create mode 100644 Documentation/devicetree/bindings/mmc/samsung,s3cmci.txt -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v6 1/2] dt-bindings: mmc: add DT binding for S3C24XX MMC/SD/SDIO controller 2017-03-31 23:50 ` Sergio Prado @ 2017-03-31 23:50 ` Sergio Prado -1 siblings, 0 replies; 13+ messages in thread From: Sergio Prado @ 2017-03-31 23:50 UTC (permalink / raw) To: ulf.hansson, robh+dt, mark.rutland, linux-mmc, devicetree, linux-kernel, ben-linux, linux-arm-kernel Cc: Sergio Prado Adds the device tree bindings description for Samsung S3C24XX MMC/SD/SDIO controller, used as a connectivity interface with external MMC, SD and SDIO storage mediums. Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Sergio Prado <sergio.prado@e-labworks.com> --- .../devicetree/bindings/mmc/samsung,s3cmci.txt | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Documentation/devicetree/bindings/mmc/samsung,s3cmci.txt diff --git a/Documentation/devicetree/bindings/mmc/samsung,s3cmci.txt b/Documentation/devicetree/bindings/mmc/samsung,s3cmci.txt new file mode 100644 index 000000000000..5f68feb9f9d6 --- /dev/null +++ b/Documentation/devicetree/bindings/mmc/samsung,s3cmci.txt @@ -0,0 +1,42 @@ +* Samsung's S3C24XX MMC/SD/SDIO controller device tree bindings + +Samsung's S3C24XX MMC/SD/SDIO controller is used as a connectivity interface +with external MMC, SD and SDIO storage mediums. + +This file documents differences between the core mmc properties described by +mmc.txt and the properties used by the Samsung S3C24XX MMC/SD/SDIO controller +implementation. + +Required SoC Specific Properties: +- compatible: should be one of the following + - "samsung,s3c2410-sdi": for controllers compatible with s3c2410 + - "samsung,s3c2412-sdi": for controllers compatible with s3c2412 + - "samsung,s3c2440-sdi": for controllers compatible with s3c2440 +- reg: register location and length +- interrupts: mmc controller interrupt +- clocks: Should reference the controller clock +- clock-names: Should contain "sdi" + +Required Board Specific Properties: +- pinctrl-0: Should specify pin control groups used for this controller. +- pinctrl-names: Should contain only one value - "default". + +Optional Properties: +- bus-width: number of data lines (see mmc.txt) +- cd-gpios: gpio for card detection (see mmc.txt) +- wp-gpios: gpio for write protection (see mmc.txt) + +Example: + + mmc0: mmc@5a000000 { + compatible = "samsung,s3c2440-sdi"; + pinctrl-names = "default"; + pinctrl-0 = <&sdi_pins>; + reg = <0x5a000000 0x100000>; + interrupts = <0 0 21 3>; + clocks = <&clocks PCLK_SDI>; + clock-names = "sdi"; + bus-width = <4>; + cd-gpios = <&gpg 8 GPIO_ACTIVE_LOW>; + wp-gpios = <&gph 8 GPIO_ACTIVE_LOW>; + }; -- 1.9.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v6 1/2] dt-bindings: mmc: add DT binding for S3C24XX MMC/SD/SDIO controller @ 2017-03-31 23:50 ` Sergio Prado 0 siblings, 0 replies; 13+ messages in thread From: Sergio Prado @ 2017-03-31 23:50 UTC (permalink / raw) To: linux-arm-kernel Adds the device tree bindings description for Samsung S3C24XX MMC/SD/SDIO controller, used as a connectivity interface with external MMC, SD and SDIO storage mediums. Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Sergio Prado <sergio.prado@e-labworks.com> --- .../devicetree/bindings/mmc/samsung,s3cmci.txt | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Documentation/devicetree/bindings/mmc/samsung,s3cmci.txt diff --git a/Documentation/devicetree/bindings/mmc/samsung,s3cmci.txt b/Documentation/devicetree/bindings/mmc/samsung,s3cmci.txt new file mode 100644 index 000000000000..5f68feb9f9d6 --- /dev/null +++ b/Documentation/devicetree/bindings/mmc/samsung,s3cmci.txt @@ -0,0 +1,42 @@ +* Samsung's S3C24XX MMC/SD/SDIO controller device tree bindings + +Samsung's S3C24XX MMC/SD/SDIO controller is used as a connectivity interface +with external MMC, SD and SDIO storage mediums. + +This file documents differences between the core mmc properties described by +mmc.txt and the properties used by the Samsung S3C24XX MMC/SD/SDIO controller +implementation. + +Required SoC Specific Properties: +- compatible: should be one of the following + - "samsung,s3c2410-sdi": for controllers compatible with s3c2410 + - "samsung,s3c2412-sdi": for controllers compatible with s3c2412 + - "samsung,s3c2440-sdi": for controllers compatible with s3c2440 +- reg: register location and length +- interrupts: mmc controller interrupt +- clocks: Should reference the controller clock +- clock-names: Should contain "sdi" + +Required Board Specific Properties: +- pinctrl-0: Should specify pin control groups used for this controller. +- pinctrl-names: Should contain only one value - "default". + +Optional Properties: +- bus-width: number of data lines (see mmc.txt) +- cd-gpios: gpio for card detection (see mmc.txt) +- wp-gpios: gpio for write protection (see mmc.txt) + +Example: + + mmc0: mmc at 5a000000 { + compatible = "samsung,s3c2440-sdi"; + pinctrl-names = "default"; + pinctrl-0 = <&sdi_pins>; + reg = <0x5a000000 0x100000>; + interrupts = <0 0 21 3>; + clocks = <&clocks PCLK_SDI>; + clock-names = "sdi"; + bus-width = <4>; + cd-gpios = <&gpg 8 GPIO_ACTIVE_LOW>; + wp-gpios = <&gph 8 GPIO_ACTIVE_LOW>; + }; -- 1.9.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v6 1/2] dt-bindings: mmc: add DT binding for S3C24XX MMC/SD/SDIO controller @ 2017-04-10 13:52 ` Ulf Hansson 0 siblings, 0 replies; 13+ messages in thread From: Ulf Hansson @ 2017-04-10 13:52 UTC (permalink / raw) To: Sergio Prado Cc: Rob Herring, Mark Rutland, linux-mmc, devicetree, linux-kernel, Ben Dooks, linux-arm-kernel On 1 April 2017 at 01:50, Sergio Prado <sergio.prado@e-labworks.com> wrote: > Adds the device tree bindings description for Samsung S3C24XX > MMC/SD/SDIO controller, used as a connectivity interface with external > MMC, SD and SDIO storage mediums. > > Acked-by: Rob Herring <robh@kernel.org> > Signed-off-by: Sergio Prado <sergio.prado@e-labworks.com> Thanks, applied for next! Kind regards Uffe > --- > .../devicetree/bindings/mmc/samsung,s3cmci.txt | 42 ++++++++++++++++++++++ > 1 file changed, 42 insertions(+) > create mode 100644 Documentation/devicetree/bindings/mmc/samsung,s3cmci.txt > > diff --git a/Documentation/devicetree/bindings/mmc/samsung,s3cmci.txt b/Documentation/devicetree/bindings/mmc/samsung,s3cmci.txt > new file mode 100644 > index 000000000000..5f68feb9f9d6 > --- /dev/null > +++ b/Documentation/devicetree/bindings/mmc/samsung,s3cmci.txt > @@ -0,0 +1,42 @@ > +* Samsung's S3C24XX MMC/SD/SDIO controller device tree bindings > + > +Samsung's S3C24XX MMC/SD/SDIO controller is used as a connectivity interface > +with external MMC, SD and SDIO storage mediums. > + > +This file documents differences between the core mmc properties described by > +mmc.txt and the properties used by the Samsung S3C24XX MMC/SD/SDIO controller > +implementation. > + > +Required SoC Specific Properties: > +- compatible: should be one of the following > + - "samsung,s3c2410-sdi": for controllers compatible with s3c2410 > + - "samsung,s3c2412-sdi": for controllers compatible with s3c2412 > + - "samsung,s3c2440-sdi": for controllers compatible with s3c2440 > +- reg: register location and length > +- interrupts: mmc controller interrupt > +- clocks: Should reference the controller clock > +- clock-names: Should contain "sdi" > + > +Required Board Specific Properties: > +- pinctrl-0: Should specify pin control groups used for this controller. > +- pinctrl-names: Should contain only one value - "default". > + > +Optional Properties: > +- bus-width: number of data lines (see mmc.txt) > +- cd-gpios: gpio for card detection (see mmc.txt) > +- wp-gpios: gpio for write protection (see mmc.txt) > + > +Example: > + > + mmc0: mmc@5a000000 { > + compatible = "samsung,s3c2440-sdi"; > + pinctrl-names = "default"; > + pinctrl-0 = <&sdi_pins>; > + reg = <0x5a000000 0x100000>; > + interrupts = <0 0 21 3>; > + clocks = <&clocks PCLK_SDI>; > + clock-names = "sdi"; > + bus-width = <4>; > + cd-gpios = <&gpg 8 GPIO_ACTIVE_LOW>; > + wp-gpios = <&gph 8 GPIO_ACTIVE_LOW>; > + }; > -- > 1.9.1 > ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v6 1/2] dt-bindings: mmc: add DT binding for S3C24XX MMC/SD/SDIO controller @ 2017-04-10 13:52 ` Ulf Hansson 0 siblings, 0 replies; 13+ messages in thread From: Ulf Hansson @ 2017-04-10 13:52 UTC (permalink / raw) To: linux-arm-kernel On 1 April 2017 at 01:50, Sergio Prado <sergio.prado@e-labworks.com> wrote: > Adds the device tree bindings description for Samsung S3C24XX > MMC/SD/SDIO controller, used as a connectivity interface with external > MMC, SD and SDIO storage mediums. > > Acked-by: Rob Herring <robh@kernel.org> > Signed-off-by: Sergio Prado <sergio.prado@e-labworks.com> Thanks, applied for next! Kind regards Uffe > --- > .../devicetree/bindings/mmc/samsung,s3cmci.txt | 42 ++++++++++++++++++++++ > 1 file changed, 42 insertions(+) > create mode 100644 Documentation/devicetree/bindings/mmc/samsung,s3cmci.txt > > diff --git a/Documentation/devicetree/bindings/mmc/samsung,s3cmci.txt b/Documentation/devicetree/bindings/mmc/samsung,s3cmci.txt > new file mode 100644 > index 000000000000..5f68feb9f9d6 > --- /dev/null > +++ b/Documentation/devicetree/bindings/mmc/samsung,s3cmci.txt > @@ -0,0 +1,42 @@ > +* Samsung's S3C24XX MMC/SD/SDIO controller device tree bindings > + > +Samsung's S3C24XX MMC/SD/SDIO controller is used as a connectivity interface > +with external MMC, SD and SDIO storage mediums. > + > +This file documents differences between the core mmc properties described by > +mmc.txt and the properties used by the Samsung S3C24XX MMC/SD/SDIO controller > +implementation. > + > +Required SoC Specific Properties: > +- compatible: should be one of the following > + - "samsung,s3c2410-sdi": for controllers compatible with s3c2410 > + - "samsung,s3c2412-sdi": for controllers compatible with s3c2412 > + - "samsung,s3c2440-sdi": for controllers compatible with s3c2440 > +- reg: register location and length > +- interrupts: mmc controller interrupt > +- clocks: Should reference the controller clock > +- clock-names: Should contain "sdi" > + > +Required Board Specific Properties: > +- pinctrl-0: Should specify pin control groups used for this controller. > +- pinctrl-names: Should contain only one value - "default". > + > +Optional Properties: > +- bus-width: number of data lines (see mmc.txt) > +- cd-gpios: gpio for card detection (see mmc.txt) > +- wp-gpios: gpio for write protection (see mmc.txt) > + > +Example: > + > + mmc0: mmc at 5a000000 { > + compatible = "samsung,s3c2440-sdi"; > + pinctrl-names = "default"; > + pinctrl-0 = <&sdi_pins>; > + reg = <0x5a000000 0x100000>; > + interrupts = <0 0 21 3>; > + clocks = <&clocks PCLK_SDI>; > + clock-names = "sdi"; > + bus-width = <4>; > + cd-gpios = <&gpg 8 GPIO_ACTIVE_LOW>; > + wp-gpios = <&gph 8 GPIO_ACTIVE_LOW>; > + }; > -- > 1.9.1 > ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v6 1/2] dt-bindings: mmc: add DT binding for S3C24XX MMC/SD/SDIO controller @ 2017-04-10 13:52 ` Ulf Hansson 0 siblings, 0 replies; 13+ messages in thread From: Ulf Hansson @ 2017-04-10 13:52 UTC (permalink / raw) To: Sergio Prado Cc: Rob Herring, Mark Rutland, linux-mmc-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Ben Dooks, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r On 1 April 2017 at 01:50, Sergio Prado <sergio.prado-1e4yhPs3/ABSwrhanM7KvQ@public.gmane.org> wrote: > Adds the device tree bindings description for Samsung S3C24XX > MMC/SD/SDIO controller, used as a connectivity interface with external > MMC, SD and SDIO storage mediums. > > Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> > Signed-off-by: Sergio Prado <sergio.prado-1e4yhPs3/ABSwrhanM7KvQ@public.gmane.org> Thanks, applied for next! Kind regards Uffe > --- > .../devicetree/bindings/mmc/samsung,s3cmci.txt | 42 ++++++++++++++++++++++ > 1 file changed, 42 insertions(+) > create mode 100644 Documentation/devicetree/bindings/mmc/samsung,s3cmci.txt > > diff --git a/Documentation/devicetree/bindings/mmc/samsung,s3cmci.txt b/Documentation/devicetree/bindings/mmc/samsung,s3cmci.txt > new file mode 100644 > index 000000000000..5f68feb9f9d6 > --- /dev/null > +++ b/Documentation/devicetree/bindings/mmc/samsung,s3cmci.txt > @@ -0,0 +1,42 @@ > +* Samsung's S3C24XX MMC/SD/SDIO controller device tree bindings > + > +Samsung's S3C24XX MMC/SD/SDIO controller is used as a connectivity interface > +with external MMC, SD and SDIO storage mediums. > + > +This file documents differences between the core mmc properties described by > +mmc.txt and the properties used by the Samsung S3C24XX MMC/SD/SDIO controller > +implementation. > + > +Required SoC Specific Properties: > +- compatible: should be one of the following > + - "samsung,s3c2410-sdi": for controllers compatible with s3c2410 > + - "samsung,s3c2412-sdi": for controllers compatible with s3c2412 > + - "samsung,s3c2440-sdi": for controllers compatible with s3c2440 > +- reg: register location and length > +- interrupts: mmc controller interrupt > +- clocks: Should reference the controller clock > +- clock-names: Should contain "sdi" > + > +Required Board Specific Properties: > +- pinctrl-0: Should specify pin control groups used for this controller. > +- pinctrl-names: Should contain only one value - "default". > + > +Optional Properties: > +- bus-width: number of data lines (see mmc.txt) > +- cd-gpios: gpio for card detection (see mmc.txt) > +- wp-gpios: gpio for write protection (see mmc.txt) > + > +Example: > + > + mmc0: mmc@5a000000 { > + compatible = "samsung,s3c2440-sdi"; > + pinctrl-names = "default"; > + pinctrl-0 = <&sdi_pins>; > + reg = <0x5a000000 0x100000>; > + interrupts = <0 0 21 3>; > + clocks = <&clocks PCLK_SDI>; > + clock-names = "sdi"; > + bus-width = <4>; > + cd-gpios = <&gpg 8 GPIO_ACTIVE_LOW>; > + wp-gpios = <&gph 8 GPIO_ACTIVE_LOW>; > + }; > -- > 1.9.1 > -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v6 2/2] mmc: host: s3cmci: allow probing from device tree 2017-03-31 23:50 ` Sergio Prado @ 2017-03-31 23:50 ` Sergio Prado -1 siblings, 0 replies; 13+ messages in thread From: Sergio Prado @ 2017-03-31 23:50 UTC (permalink / raw) To: ulf.hansson, robh+dt, mark.rutland, linux-mmc, devicetree, linux-kernel, ben-linux, linux-arm-kernel Cc: Sergio Prado Allows configuring Samsung S3C24XX MMC/SD/SDIO controller using a device tree. Signed-off-by: Sergio Prado <sergio.prado@e-labworks.com> --- drivers/mmc/host/s3cmci.c | 257 +++++++++++++++++++++++----------------------- 1 file changed, 126 insertions(+), 131 deletions(-) diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c index 7a173f8c455b..c101f7e178f7 100644 --- a/drivers/mmc/host/s3cmci.c +++ b/drivers/mmc/host/s3cmci.c @@ -24,6 +24,10 @@ #include <linux/interrupt.h> #include <linux/irq.h> #include <linux/io.h> +#include <linux/of.h> +#include <linux/of_device.h> +#include <linux/of_gpio.h> +#include <linux/mmc/slot-gpio.h> #include <plat/gpio-cfg.h> #include <mach/dma.h> @@ -807,21 +811,6 @@ static irqreturn_t s3cmci_irq(int irq, void *dev_id) } -/* - * ISR for the CardDetect Pin -*/ - -static irqreturn_t s3cmci_irq_cd(int irq, void *dev_id) -{ - struct s3cmci_host *host = (struct s3cmci_host *)dev_id; - - dbg(host, dbg_irq, "card detect\n"); - - mmc_detect_change(host->mmc, msecs_to_jiffies(500)); - - return IRQ_HANDLED; -} - static void s3cmci_dma_done_callback(void *arg) { struct s3cmci_host *host = arg; @@ -1177,19 +1166,6 @@ static void s3cmci_send_request(struct mmc_host *mmc) s3cmci_enable_irq(host, true); } -static int s3cmci_card_present(struct mmc_host *mmc) -{ - struct s3cmci_host *host = mmc_priv(mmc); - struct s3c24xx_mci_pdata *pdata = host->pdata; - int ret; - - if (pdata->no_detect) - return -ENOSYS; - - ret = gpio_get_value(pdata->gpio_detect) ? 0 : 1; - return ret ^ pdata->detect_invert; -} - static void s3cmci_request(struct mmc_host *mmc, struct mmc_request *mrq) { struct s3cmci_host *host = mmc_priv(mmc); @@ -1198,7 +1174,7 @@ static void s3cmci_request(struct mmc_host *mmc, struct mmc_request *mrq) host->cmd_is_stop = 0; host->mrq = mrq; - if (s3cmci_card_present(mmc) == 0) { + if (mmc_gpio_get_cd(mmc) == 0) { dbg(host, dbg_err, "%s: no medium present\n", __func__); host->mrq->cmd->error = -ENOMEDIUM; mmc_request_done(mmc, mrq); @@ -1242,8 +1218,9 @@ static void s3cmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) case MMC_POWER_ON: case MMC_POWER_UP: /* Configure GPE5...GPE10 pins in SD mode */ - s3c_gpio_cfgall_range(S3C2410_GPE(5), 6, S3C_GPIO_SFN(2), - S3C_GPIO_PULL_NONE); + if (!host->pdev->dev.of_node) + s3c_gpio_cfgall_range(S3C2410_GPE(5), 6, S3C_GPIO_SFN(2), + S3C_GPIO_PULL_NONE); if (host->pdata->set_power) host->pdata->set_power(ios->power_mode, ios->vdd); @@ -1255,7 +1232,8 @@ static void s3cmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) case MMC_POWER_OFF: default: - gpio_direction_output(S3C2410_GPE(5), 0); + if (!host->pdev->dev.of_node) + gpio_direction_output(S3C2410_GPE(5), 0); if (host->is2440) mci_con |= S3C2440_SDICON_SDRESET; @@ -1295,21 +1273,6 @@ static void s3cmci_reset(struct s3cmci_host *host) writel(con, host->base + S3C2410_SDICON); } -static int s3cmci_get_ro(struct mmc_host *mmc) -{ - struct s3cmci_host *host = mmc_priv(mmc); - struct s3c24xx_mci_pdata *pdata = host->pdata; - int ret; - - if (pdata->no_wprotect) - return 0; - - ret = gpio_get_value(pdata->gpio_wprotect) ? 1 : 0; - ret ^= pdata->wprotect_invert; - - return ret; -} - static void s3cmci_enable_sdio_irq(struct mmc_host *mmc, int enable) { struct s3cmci_host *host = mmc_priv(mmc); @@ -1353,8 +1316,8 @@ static void s3cmci_enable_sdio_irq(struct mmc_host *mmc, int enable) static struct mmc_host_ops s3cmci_ops = { .request = s3cmci_request, .set_ios = s3cmci_set_ios, - .get_ro = s3cmci_get_ro, - .get_cd = s3cmci_card_present, + .get_ro = mmc_gpio_get_ro, + .get_cd = mmc_gpio_get_cd, .enable_sdio_irq = s3cmci_enable_sdio_irq, }; @@ -1545,21 +1508,14 @@ static inline void s3cmci_debugfs_remove(struct s3cmci_host *host) { } #endif /* CONFIG_DEBUG_FS */ -static int s3cmci_probe(struct platform_device *pdev) +static int s3cmci_probe_pdata(struct s3cmci_host *host) { - struct s3cmci_host *host; - struct mmc_host *mmc; - int ret; - int is2440; - int i; + struct platform_device *pdev = host->pdev; + struct mmc_host *mmc = host->mmc; + struct s3c24xx_mci_pdata *pdata; + int i, ret; - is2440 = platform_get_device_id(pdev)->driver_data; - - mmc = mmc_alloc_host(sizeof(struct s3cmci_host), &pdev->dev); - if (!mmc) { - ret = -ENOMEM; - goto probe_out; - } + host->is2440 = platform_get_device_id(pdev)->driver_data; for (i = S3C2410_GPE(5); i <= S3C2410_GPE(10); i++) { ret = gpio_request(i, dev_name(&pdev->dev)); @@ -1569,25 +1525,101 @@ static int s3cmci_probe(struct platform_device *pdev) for (i--; i >= S3C2410_GPE(5); i--) gpio_free(i); - goto probe_free_host; + return ret; + } + } + + if (!pdev->dev.platform_data) + pdev->dev.platform_data = &s3cmci_def_pdata; + + pdata = pdev->dev.platform_data; + + if (pdata->no_wprotect) + mmc->caps2 |= MMC_CAP2_NO_WRITE_PROTECT; + + if (pdata->no_detect) + mmc->caps |= MMC_CAP_NEEDS_POLL; + + if (pdata->wprotect_invert); + mmc->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH; + + if (pdata->detect_invert) + mmc->caps2 |= MMC_CAP2_CD_ACTIVE_HIGH; + + if (gpio_is_valid(pdata->gpio_detect)) { + ret = mmc_gpio_request_cd(mmc, pdata->gpio_detect, 0); + if (ret) { + dev_err(&pdev->dev, "error requesting GPIO for CD %d\n", + ret); + return ret; } } + if (gpio_is_valid(pdata->gpio_wprotect)) { + ret = mmc_gpio_request_ro(mmc, pdata->gpio_wprotect); + if (ret) { + dev_err(&pdev->dev, "error requesting GPIO for WP %d\n", + ret); + return ret; + } + } + + return 0; +} + +static int s3cmci_probe_dt(struct s3cmci_host *host) +{ + struct platform_device *pdev = host->pdev; + struct s3c24xx_mci_pdata *pdata; + struct mmc_host *mmc = host->mmc; + int ret; + + host->is2440 = (int) of_device_get_match_data(&pdev->dev); + + ret = mmc_of_parse(mmc); + if (ret) + return ret; + + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return -ENOMEM; + + pdev->dev.platform_data = pdata; + + return 0; +} + +static int s3cmci_probe(struct platform_device *pdev) +{ + struct s3cmci_host *host; + struct mmc_host *mmc; + int ret; + int i; + + mmc = mmc_alloc_host(sizeof(struct s3cmci_host), &pdev->dev); + if (!mmc) { + ret = -ENOMEM; + goto probe_out; + } + host = mmc_priv(mmc); host->mmc = mmc; host->pdev = pdev; - host->is2440 = is2440; + + if (pdev->dev.of_node) + ret = s3cmci_probe_dt(host); + else + ret = s3cmci_probe_pdata(host); + + if (ret) + goto probe_free_host; host->pdata = pdev->dev.platform_data; - if (!host->pdata) { - pdev->dev.platform_data = &s3cmci_def_pdata; - host->pdata = &s3cmci_def_pdata; - } spin_lock_init(&host->complete_lock); tasklet_init(&host->pio_tasklet, pio_tasklet, (unsigned long) host); - if (is2440) { + if (host->is2440) { host->sdiimsk = S3C2440_SDIIMSK; host->sdidata = S3C2440_SDIDATA; host->clk_div = 1; @@ -1645,43 +1677,6 @@ static int s3cmci_probe(struct platform_device *pdev) disable_irq(host->irq); host->irq_state = false; - if (!host->pdata->no_detect) { - ret = gpio_request(host->pdata->gpio_detect, "s3cmci detect"); - if (ret) { - dev_err(&pdev->dev, "failed to get detect gpio\n"); - goto probe_free_irq; - } - - host->irq_cd = gpio_to_irq(host->pdata->gpio_detect); - - if (host->irq_cd >= 0) { - if (request_irq(host->irq_cd, s3cmci_irq_cd, - IRQF_TRIGGER_RISING | - IRQF_TRIGGER_FALLING, - DRIVER_NAME, host)) { - dev_err(&pdev->dev, - "can't get card detect irq.\n"); - ret = -ENOENT; - goto probe_free_gpio_cd; - } - } else { - dev_warn(&pdev->dev, - "host detect has no irq available\n"); - gpio_direction_input(host->pdata->gpio_detect); - } - } else - host->irq_cd = -1; - - if (!host->pdata->no_wprotect) { - ret = gpio_request(host->pdata->gpio_wprotect, "s3cmci wp"); - if (ret) { - dev_err(&pdev->dev, "failed to get writeprotect\n"); - goto probe_free_irq_cd; - } - - gpio_direction_input(host->pdata->gpio_wprotect); - } - /* Depending on the dma state, get a DMA channel to use. */ if (s3cmci_host_usedma(host)) { @@ -1689,7 +1684,7 @@ static int s3cmci_probe(struct platform_device *pdev) ret = PTR_ERR_OR_ZERO(host->dma); if (ret) { dev_err(&pdev->dev, "cannot get DMA channel.\n"); - goto probe_free_gpio_wp; + goto probe_free_irq; } } @@ -1768,18 +1763,6 @@ static int s3cmci_probe(struct platform_device *pdev) if (s3cmci_host_usedma(host)) dma_release_channel(host->dma); - probe_free_gpio_wp: - if (!host->pdata->no_wprotect) - gpio_free(host->pdata->gpio_wprotect); - - probe_free_gpio_cd: - if (!host->pdata->no_detect) - gpio_free(host->pdata->gpio_detect); - - probe_free_irq_cd: - if (host->irq_cd >= 0) - free_irq(host->irq_cd, host); - probe_free_irq: free_irq(host->irq, host); @@ -1790,8 +1773,9 @@ static int s3cmci_probe(struct platform_device *pdev) release_mem_region(host->mem->start, resource_size(host->mem)); probe_free_gpio: - for (i = S3C2410_GPE(5); i <= S3C2410_GPE(10); i++) - gpio_free(i); + if (!pdev->dev.of_node) + for (i = S3C2410_GPE(5); i <= S3C2410_GPE(10); i++) + gpio_free(i); probe_free_host: mmc_free_host(mmc); @@ -1818,7 +1802,6 @@ static int s3cmci_remove(struct platform_device *pdev) { struct mmc_host *mmc = platform_get_drvdata(pdev); struct s3cmci_host *host = mmc_priv(mmc); - struct s3c24xx_mci_pdata *pd = host->pdata; int i; s3cmci_shutdown(pdev); @@ -1832,15 +1815,9 @@ static int s3cmci_remove(struct platform_device *pdev) free_irq(host->irq, host); - if (!pd->no_wprotect) - gpio_free(pd->gpio_wprotect); - - if (!pd->no_detect) - gpio_free(pd->gpio_detect); - - for (i = S3C2410_GPE(5); i <= S3C2410_GPE(10); i++) - gpio_free(i); - + if (!pdev->dev.of_node) + for (i = S3C2410_GPE(5); i <= S3C2410_GPE(10); i++) + gpio_free(i); iounmap(host->base); release_mem_region(host->mem->start, resource_size(host->mem)); @@ -1849,6 +1826,23 @@ static int s3cmci_remove(struct platform_device *pdev) return 0; } +static const struct of_device_id s3cmci_dt_match[] = { + { + .compatible = "samsung,s3c2410-sdi", + .data = (void *)0, + }, + { + .compatible = "samsung,s3c2412-sdi", + .data = (void *)1, + }, + { + .compatible = "samsung,s3c2440-sdi", + .data = (void *)1, + }, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, s3cmci_dt_match); + static const struct platform_device_id s3cmci_driver_ids[] = { { .name = "s3c2410-sdi", @@ -1868,6 +1862,7 @@ static int s3cmci_remove(struct platform_device *pdev) static struct platform_driver s3cmci_driver = { .driver = { .name = "s3c-sdi", + .of_match_table = s3cmci_dt_match, }, .id_table = s3cmci_driver_ids, .probe = s3cmci_probe, -- 1.9.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v6 2/2] mmc: host: s3cmci: allow probing from device tree @ 2017-03-31 23:50 ` Sergio Prado 0 siblings, 0 replies; 13+ messages in thread From: Sergio Prado @ 2017-03-31 23:50 UTC (permalink / raw) To: linux-arm-kernel Allows configuring Samsung S3C24XX MMC/SD/SDIO controller using a device tree. Signed-off-by: Sergio Prado <sergio.prado@e-labworks.com> --- drivers/mmc/host/s3cmci.c | 257 +++++++++++++++++++++++----------------------- 1 file changed, 126 insertions(+), 131 deletions(-) diff --git a/drivers/mmc/host/s3cmci.c b/drivers/mmc/host/s3cmci.c index 7a173f8c455b..c101f7e178f7 100644 --- a/drivers/mmc/host/s3cmci.c +++ b/drivers/mmc/host/s3cmci.c @@ -24,6 +24,10 @@ #include <linux/interrupt.h> #include <linux/irq.h> #include <linux/io.h> +#include <linux/of.h> +#include <linux/of_device.h> +#include <linux/of_gpio.h> +#include <linux/mmc/slot-gpio.h> #include <plat/gpio-cfg.h> #include <mach/dma.h> @@ -807,21 +811,6 @@ static irqreturn_t s3cmci_irq(int irq, void *dev_id) } -/* - * ISR for the CardDetect Pin -*/ - -static irqreturn_t s3cmci_irq_cd(int irq, void *dev_id) -{ - struct s3cmci_host *host = (struct s3cmci_host *)dev_id; - - dbg(host, dbg_irq, "card detect\n"); - - mmc_detect_change(host->mmc, msecs_to_jiffies(500)); - - return IRQ_HANDLED; -} - static void s3cmci_dma_done_callback(void *arg) { struct s3cmci_host *host = arg; @@ -1177,19 +1166,6 @@ static void s3cmci_send_request(struct mmc_host *mmc) s3cmci_enable_irq(host, true); } -static int s3cmci_card_present(struct mmc_host *mmc) -{ - struct s3cmci_host *host = mmc_priv(mmc); - struct s3c24xx_mci_pdata *pdata = host->pdata; - int ret; - - if (pdata->no_detect) - return -ENOSYS; - - ret = gpio_get_value(pdata->gpio_detect) ? 0 : 1; - return ret ^ pdata->detect_invert; -} - static void s3cmci_request(struct mmc_host *mmc, struct mmc_request *mrq) { struct s3cmci_host *host = mmc_priv(mmc); @@ -1198,7 +1174,7 @@ static void s3cmci_request(struct mmc_host *mmc, struct mmc_request *mrq) host->cmd_is_stop = 0; host->mrq = mrq; - if (s3cmci_card_present(mmc) == 0) { + if (mmc_gpio_get_cd(mmc) == 0) { dbg(host, dbg_err, "%s: no medium present\n", __func__); host->mrq->cmd->error = -ENOMEDIUM; mmc_request_done(mmc, mrq); @@ -1242,8 +1218,9 @@ static void s3cmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) case MMC_POWER_ON: case MMC_POWER_UP: /* Configure GPE5...GPE10 pins in SD mode */ - s3c_gpio_cfgall_range(S3C2410_GPE(5), 6, S3C_GPIO_SFN(2), - S3C_GPIO_PULL_NONE); + if (!host->pdev->dev.of_node) + s3c_gpio_cfgall_range(S3C2410_GPE(5), 6, S3C_GPIO_SFN(2), + S3C_GPIO_PULL_NONE); if (host->pdata->set_power) host->pdata->set_power(ios->power_mode, ios->vdd); @@ -1255,7 +1232,8 @@ static void s3cmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) case MMC_POWER_OFF: default: - gpio_direction_output(S3C2410_GPE(5), 0); + if (!host->pdev->dev.of_node) + gpio_direction_output(S3C2410_GPE(5), 0); if (host->is2440) mci_con |= S3C2440_SDICON_SDRESET; @@ -1295,21 +1273,6 @@ static void s3cmci_reset(struct s3cmci_host *host) writel(con, host->base + S3C2410_SDICON); } -static int s3cmci_get_ro(struct mmc_host *mmc) -{ - struct s3cmci_host *host = mmc_priv(mmc); - struct s3c24xx_mci_pdata *pdata = host->pdata; - int ret; - - if (pdata->no_wprotect) - return 0; - - ret = gpio_get_value(pdata->gpio_wprotect) ? 1 : 0; - ret ^= pdata->wprotect_invert; - - return ret; -} - static void s3cmci_enable_sdio_irq(struct mmc_host *mmc, int enable) { struct s3cmci_host *host = mmc_priv(mmc); @@ -1353,8 +1316,8 @@ static void s3cmci_enable_sdio_irq(struct mmc_host *mmc, int enable) static struct mmc_host_ops s3cmci_ops = { .request = s3cmci_request, .set_ios = s3cmci_set_ios, - .get_ro = s3cmci_get_ro, - .get_cd = s3cmci_card_present, + .get_ro = mmc_gpio_get_ro, + .get_cd = mmc_gpio_get_cd, .enable_sdio_irq = s3cmci_enable_sdio_irq, }; @@ -1545,21 +1508,14 @@ static inline void s3cmci_debugfs_remove(struct s3cmci_host *host) { } #endif /* CONFIG_DEBUG_FS */ -static int s3cmci_probe(struct platform_device *pdev) +static int s3cmci_probe_pdata(struct s3cmci_host *host) { - struct s3cmci_host *host; - struct mmc_host *mmc; - int ret; - int is2440; - int i; + struct platform_device *pdev = host->pdev; + struct mmc_host *mmc = host->mmc; + struct s3c24xx_mci_pdata *pdata; + int i, ret; - is2440 = platform_get_device_id(pdev)->driver_data; - - mmc = mmc_alloc_host(sizeof(struct s3cmci_host), &pdev->dev); - if (!mmc) { - ret = -ENOMEM; - goto probe_out; - } + host->is2440 = platform_get_device_id(pdev)->driver_data; for (i = S3C2410_GPE(5); i <= S3C2410_GPE(10); i++) { ret = gpio_request(i, dev_name(&pdev->dev)); @@ -1569,25 +1525,101 @@ static int s3cmci_probe(struct platform_device *pdev) for (i--; i >= S3C2410_GPE(5); i--) gpio_free(i); - goto probe_free_host; + return ret; + } + } + + if (!pdev->dev.platform_data) + pdev->dev.platform_data = &s3cmci_def_pdata; + + pdata = pdev->dev.platform_data; + + if (pdata->no_wprotect) + mmc->caps2 |= MMC_CAP2_NO_WRITE_PROTECT; + + if (pdata->no_detect) + mmc->caps |= MMC_CAP_NEEDS_POLL; + + if (pdata->wprotect_invert); + mmc->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH; + + if (pdata->detect_invert) + mmc->caps2 |= MMC_CAP2_CD_ACTIVE_HIGH; + + if (gpio_is_valid(pdata->gpio_detect)) { + ret = mmc_gpio_request_cd(mmc, pdata->gpio_detect, 0); + if (ret) { + dev_err(&pdev->dev, "error requesting GPIO for CD %d\n", + ret); + return ret; } } + if (gpio_is_valid(pdata->gpio_wprotect)) { + ret = mmc_gpio_request_ro(mmc, pdata->gpio_wprotect); + if (ret) { + dev_err(&pdev->dev, "error requesting GPIO for WP %d\n", + ret); + return ret; + } + } + + return 0; +} + +static int s3cmci_probe_dt(struct s3cmci_host *host) +{ + struct platform_device *pdev = host->pdev; + struct s3c24xx_mci_pdata *pdata; + struct mmc_host *mmc = host->mmc; + int ret; + + host->is2440 = (int) of_device_get_match_data(&pdev->dev); + + ret = mmc_of_parse(mmc); + if (ret) + return ret; + + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return -ENOMEM; + + pdev->dev.platform_data = pdata; + + return 0; +} + +static int s3cmci_probe(struct platform_device *pdev) +{ + struct s3cmci_host *host; + struct mmc_host *mmc; + int ret; + int i; + + mmc = mmc_alloc_host(sizeof(struct s3cmci_host), &pdev->dev); + if (!mmc) { + ret = -ENOMEM; + goto probe_out; + } + host = mmc_priv(mmc); host->mmc = mmc; host->pdev = pdev; - host->is2440 = is2440; + + if (pdev->dev.of_node) + ret = s3cmci_probe_dt(host); + else + ret = s3cmci_probe_pdata(host); + + if (ret) + goto probe_free_host; host->pdata = pdev->dev.platform_data; - if (!host->pdata) { - pdev->dev.platform_data = &s3cmci_def_pdata; - host->pdata = &s3cmci_def_pdata; - } spin_lock_init(&host->complete_lock); tasklet_init(&host->pio_tasklet, pio_tasklet, (unsigned long) host); - if (is2440) { + if (host->is2440) { host->sdiimsk = S3C2440_SDIIMSK; host->sdidata = S3C2440_SDIDATA; host->clk_div = 1; @@ -1645,43 +1677,6 @@ static int s3cmci_probe(struct platform_device *pdev) disable_irq(host->irq); host->irq_state = false; - if (!host->pdata->no_detect) { - ret = gpio_request(host->pdata->gpio_detect, "s3cmci detect"); - if (ret) { - dev_err(&pdev->dev, "failed to get detect gpio\n"); - goto probe_free_irq; - } - - host->irq_cd = gpio_to_irq(host->pdata->gpio_detect); - - if (host->irq_cd >= 0) { - if (request_irq(host->irq_cd, s3cmci_irq_cd, - IRQF_TRIGGER_RISING | - IRQF_TRIGGER_FALLING, - DRIVER_NAME, host)) { - dev_err(&pdev->dev, - "can't get card detect irq.\n"); - ret = -ENOENT; - goto probe_free_gpio_cd; - } - } else { - dev_warn(&pdev->dev, - "host detect has no irq available\n"); - gpio_direction_input(host->pdata->gpio_detect); - } - } else - host->irq_cd = -1; - - if (!host->pdata->no_wprotect) { - ret = gpio_request(host->pdata->gpio_wprotect, "s3cmci wp"); - if (ret) { - dev_err(&pdev->dev, "failed to get writeprotect\n"); - goto probe_free_irq_cd; - } - - gpio_direction_input(host->pdata->gpio_wprotect); - } - /* Depending on the dma state, get a DMA channel to use. */ if (s3cmci_host_usedma(host)) { @@ -1689,7 +1684,7 @@ static int s3cmci_probe(struct platform_device *pdev) ret = PTR_ERR_OR_ZERO(host->dma); if (ret) { dev_err(&pdev->dev, "cannot get DMA channel.\n"); - goto probe_free_gpio_wp; + goto probe_free_irq; } } @@ -1768,18 +1763,6 @@ static int s3cmci_probe(struct platform_device *pdev) if (s3cmci_host_usedma(host)) dma_release_channel(host->dma); - probe_free_gpio_wp: - if (!host->pdata->no_wprotect) - gpio_free(host->pdata->gpio_wprotect); - - probe_free_gpio_cd: - if (!host->pdata->no_detect) - gpio_free(host->pdata->gpio_detect); - - probe_free_irq_cd: - if (host->irq_cd >= 0) - free_irq(host->irq_cd, host); - probe_free_irq: free_irq(host->irq, host); @@ -1790,8 +1773,9 @@ static int s3cmci_probe(struct platform_device *pdev) release_mem_region(host->mem->start, resource_size(host->mem)); probe_free_gpio: - for (i = S3C2410_GPE(5); i <= S3C2410_GPE(10); i++) - gpio_free(i); + if (!pdev->dev.of_node) + for (i = S3C2410_GPE(5); i <= S3C2410_GPE(10); i++) + gpio_free(i); probe_free_host: mmc_free_host(mmc); @@ -1818,7 +1802,6 @@ static int s3cmci_remove(struct platform_device *pdev) { struct mmc_host *mmc = platform_get_drvdata(pdev); struct s3cmci_host *host = mmc_priv(mmc); - struct s3c24xx_mci_pdata *pd = host->pdata; int i; s3cmci_shutdown(pdev); @@ -1832,15 +1815,9 @@ static int s3cmci_remove(struct platform_device *pdev) free_irq(host->irq, host); - if (!pd->no_wprotect) - gpio_free(pd->gpio_wprotect); - - if (!pd->no_detect) - gpio_free(pd->gpio_detect); - - for (i = S3C2410_GPE(5); i <= S3C2410_GPE(10); i++) - gpio_free(i); - + if (!pdev->dev.of_node) + for (i = S3C2410_GPE(5); i <= S3C2410_GPE(10); i++) + gpio_free(i); iounmap(host->base); release_mem_region(host->mem->start, resource_size(host->mem)); @@ -1849,6 +1826,23 @@ static int s3cmci_remove(struct platform_device *pdev) return 0; } +static const struct of_device_id s3cmci_dt_match[] = { + { + .compatible = "samsung,s3c2410-sdi", + .data = (void *)0, + }, + { + .compatible = "samsung,s3c2412-sdi", + .data = (void *)1, + }, + { + .compatible = "samsung,s3c2440-sdi", + .data = (void *)1, + }, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, s3cmci_dt_match); + static const struct platform_device_id s3cmci_driver_ids[] = { { .name = "s3c2410-sdi", @@ -1868,6 +1862,7 @@ static int s3cmci_remove(struct platform_device *pdev) static struct platform_driver s3cmci_driver = { .driver = { .name = "s3c-sdi", + .of_match_table = s3cmci_dt_match, }, .id_table = s3cmci_driver_ids, .probe = s3cmci_probe, -- 1.9.1 ^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v6 2/2] mmc: host: s3cmci: allow probing from device tree @ 2017-04-10 13:53 ` Ulf Hansson 0 siblings, 0 replies; 13+ messages in thread From: Ulf Hansson @ 2017-04-10 13:53 UTC (permalink / raw) To: Sergio Prado Cc: Rob Herring, Mark Rutland, linux-mmc, devicetree, linux-kernel, Ben Dooks, linux-arm-kernel On 1 April 2017 at 01:50, Sergio Prado <sergio.prado@e-labworks.com> wrote: > Allows configuring Samsung S3C24XX MMC/SD/SDIO controller using a device > tree. > > Signed-off-by: Sergio Prado <sergio.prado@e-labworks.com> Thanks, applied for next - however, by amending the change with the fix from Arnd. See more below. [...] > + > + if (pdata->wprotect_invert); The above semicolon is removed to fix the expression. > + mmc->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH; > + [...] Kind regards Uffe ^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v6 2/2] mmc: host: s3cmci: allow probing from device tree @ 2017-04-10 13:53 ` Ulf Hansson 0 siblings, 0 replies; 13+ messages in thread From: Ulf Hansson @ 2017-04-10 13:53 UTC (permalink / raw) To: linux-arm-kernel On 1 April 2017 at 01:50, Sergio Prado <sergio.prado@e-labworks.com> wrote: > Allows configuring Samsung S3C24XX MMC/SD/SDIO controller using a device > tree. > > Signed-off-by: Sergio Prado <sergio.prado@e-labworks.com> Thanks, applied for next - however, by amending the change with the fix from Arnd. See more below. [...] > + > + if (pdata->wprotect_invert); The above semicolon is removed to fix the expression. > + mmc->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH; > + [...] Kind regards Uffe ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v6 2/2] mmc: host: s3cmci: allow probing from device tree @ 2017-04-10 13:53 ` Ulf Hansson 0 siblings, 0 replies; 13+ messages in thread From: Ulf Hansson @ 2017-04-10 13:53 UTC (permalink / raw) To: Sergio Prado Cc: Rob Herring, Mark Rutland, linux-mmc-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Ben Dooks, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r On 1 April 2017 at 01:50, Sergio Prado <sergio.prado-1e4yhPs3/ABSwrhanM7KvQ@public.gmane.org> wrote: > Allows configuring Samsung S3C24XX MMC/SD/SDIO controller using a device > tree. > > Signed-off-by: Sergio Prado <sergio.prado-1e4yhPs3/ABSwrhanM7KvQ@public.gmane.org> Thanks, applied for next - however, by amending the change with the fix from Arnd. See more below. [...] > + > + if (pdata->wprotect_invert); The above semicolon is removed to fix the expression. > + mmc->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH; > + [...] Kind regards Uffe -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2017-04-10 13:53 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2017-03-31 23:50 [PATCH v6 0/2] mmc: host: s3cmci: add device tree support Sergio Prado 2017-03-31 23:50 ` Sergio Prado 2017-03-31 23:50 ` Sergio Prado 2017-03-31 23:50 ` [PATCH v6 1/2] dt-bindings: mmc: add DT binding for S3C24XX MMC/SD/SDIO controller Sergio Prado 2017-03-31 23:50 ` Sergio Prado 2017-04-10 13:52 ` Ulf Hansson 2017-04-10 13:52 ` Ulf Hansson 2017-04-10 13:52 ` Ulf Hansson 2017-03-31 23:50 ` [PATCH v6 2/2] mmc: host: s3cmci: allow probing from device tree Sergio Prado 2017-03-31 23:50 ` Sergio Prado 2017-04-10 13:53 ` Ulf Hansson 2017-04-10 13:53 ` Ulf Hansson 2017-04-10 13:53 ` Ulf Hansson
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.