* [PATCH v3] sm501: Add device property @ 2016-07-04 14:26 Yoshinori Sato [not found] ` <1467642364-10316-1-git-send-email-ysato-Rn4VEauK+AKRv+LV9MX5uooqe+aC9MnS@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Yoshinori Sato @ 2016-07-04 14:26 UTC (permalink / raw) To: Rob Herring, Mark Rutland, Lee Jones Cc: Yoshinori Sato, devicetree, linux-kernel Add device proptery on enable integrated peripheral. It have platform_data. But don't have devicetree. Signed-off-by: Yoshinori Sato <ysato@users.sourceforge.jp> --- .../devicetree/bindings/display/sm501fb.txt | 11 +++++++++ drivers/mfd/sm501.c | 28 +++++++++++++--------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/Documentation/devicetree/bindings/display/sm501fb.txt b/Documentation/devicetree/bindings/display/sm501fb.txt index 9d9f009..9290094 100644 --- a/Documentation/devicetree/bindings/display/sm501fb.txt +++ b/Documentation/devicetree/bindings/display/sm501fb.txt @@ -22,6 +22,17 @@ Optional properties: set different foreign endian. - big-endian: available on little endian systems, to set different foreign endian. +- smi,devices: function block enable bitmap. + bit0: USB host + bit1: USB slave + bit2: SSP Ch0 + bit3: SSP Ch1 + bit4: UART Ch0 + bit5: UART Ch1 + bit6: Accelerator + bit7: AC97 + bit8: I2S + bit9: GPIO Example for MPC5200: display@1,0 { diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index 65cd0d2..e8c6a5e 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c @@ -21,6 +21,7 @@ #include <linux/pci.h> #include <linux/i2c-gpio.h> #include <linux/slab.h> +#include <linux/of.h> #include <linux/sm501.h> #include <linux/sm501-regs.h> @@ -1297,7 +1298,7 @@ static unsigned int sm501_mem_local[] = { * Common init code for an SM501 */ -static int sm501_init_dev(struct sm501_devdata *sm) +static int sm501_init_dev(struct sm501_devdata *sm, unsigned int devices) { struct sm501_initdata *idata; struct sm501_platdata *pdata; @@ -1342,16 +1343,15 @@ static int sm501_init_dev(struct sm501_devdata *sm) pdata = sm->platdata; idata = pdata ? pdata->init : NULL; - if (idata) { + if (idata) sm501_init_regs(sm, idata); - if (idata->devices & SM501_USE_USB_HOST) - sm501_register_usbhost(sm, &mem_avail); - if (idata->devices & (SM501_USE_UART0 | SM501_USE_UART1)) - sm501_register_uart(sm, idata->devices); - if (idata->devices & SM501_USE_GPIO) - sm501_register_gpio(sm); - } + if (devices & SM501_USE_USB_HOST) + sm501_register_usbhost(sm, &mem_avail); + if (devices & (SM501_USE_UART0 | SM501_USE_UART1)) + sm501_register_uart(sm, devices); + if (devices & SM501_USE_GPIO) + sm501_register_gpio(sm); if (pdata && pdata->gpio_i2c != NULL && pdata->gpio_i2c_nr > 0) { if (!sm501_gpio_isregistered(sm)) @@ -1377,6 +1377,7 @@ static int sm501_plat_probe(struct platform_device *dev) { struct sm501_devdata *sm; int ret; + unsigned int devices = 0; sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL); if (sm == NULL) { @@ -1415,6 +1416,11 @@ static int sm501_plat_probe(struct platform_device *dev) } platform_set_drvdata(dev, sm); + if (sm->platdata) + devices = sm->platdata->init->devices; + if (dev->dev.of_node) + of_property_read_u32(dev->dev.of_node, "smi,devices", + &devices); sm->regs = ioremap(sm->io_res->start, resource_size(sm->io_res)); @@ -1424,7 +1430,7 @@ static int sm501_plat_probe(struct platform_device *dev) goto err_claim; } - return sm501_init_dev(sm); + return sm501_init_dev(sm, devices); err_claim: release_resource(sm->regs_claim); @@ -1635,7 +1641,7 @@ static int sm501_pci_probe(struct pci_dev *dev, goto err4; } - sm501_init_dev(sm); + sm501_init_dev(sm, sm->platdata->init->devices); return 0; err4: -- 2.7.0 ^ permalink raw reply related [flat|nested] 3+ messages in thread
[parent not found: <1467642364-10316-1-git-send-email-ysato-Rn4VEauK+AKRv+LV9MX5uooqe+aC9MnS@public.gmane.org>]
* Re: [PATCH v3] sm501: Add device property [not found] ` <1467642364-10316-1-git-send-email-ysato-Rn4VEauK+AKRv+LV9MX5uooqe+aC9MnS@public.gmane.org> @ 2016-07-04 14:40 ` Mark Rutland 2016-07-06 13:12 ` Yoshinori Sato 0 siblings, 1 reply; 3+ messages in thread From: Mark Rutland @ 2016-07-04 14:40 UTC (permalink / raw) To: Yoshinori Sato Cc: Rob Herring, Lee Jones, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Mon, Jul 04, 2016 at 11:26:04PM +0900, Yoshinori Sato wrote: > Add device proptery on enable integrated peripheral. > It have platform_data. But don't have devicetree. > > Signed-off-by: Yoshinori Sato <ysato-Rn4VEauK+AKRv+LV9MX5uooqe+aC9MnS@public.gmane.org> > --- > .../devicetree/bindings/display/sm501fb.txt | 11 +++++++++ > drivers/mfd/sm501.c | 28 +++++++++++++--------- > 2 files changed, 28 insertions(+), 11 deletions(-) > > diff --git a/Documentation/devicetree/bindings/display/sm501fb.txt b/Documentation/devicetree/bindings/display/sm501fb.txt > index 9d9f009..9290094 100644 > --- a/Documentation/devicetree/bindings/display/sm501fb.txt > +++ b/Documentation/devicetree/bindings/display/sm501fb.txt > @@ -22,6 +22,17 @@ Optional properties: > set different foreign endian. > - big-endian: available on little endian systems, to > set different foreign endian. > +- smi,devices: function block enable bitmap. > + bit0: USB host > + bit1: USB slave > + bit2: SSP Ch0 > + bit3: SSP Ch1 > + bit4: UART Ch0 > + bit5: UART Ch1 > + bit6: Accelerator > + bit7: AC97 > + bit8: I2S > + bit9: GPIO Generally we don't place bitmaps like this in DT. What exactly does this property represent? Whether certain sub-blocks are present? These should probably be separate has-${FOO} proeprties. It may be better to have separate nodes, if we'e going to need to refer to sub blocks by phandle, or are liekly to have peropties specific to a sub block. Thanks, Mark. > Example for MPC5200: > display@1,0 { > diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c > index 65cd0d2..e8c6a5e 100644 > --- a/drivers/mfd/sm501.c > +++ b/drivers/mfd/sm501.c > @@ -21,6 +21,7 @@ > #include <linux/pci.h> > #include <linux/i2c-gpio.h> > #include <linux/slab.h> > +#include <linux/of.h> > > #include <linux/sm501.h> > #include <linux/sm501-regs.h> > @@ -1297,7 +1298,7 @@ static unsigned int sm501_mem_local[] = { > * Common init code for an SM501 > */ > > -static int sm501_init_dev(struct sm501_devdata *sm) > +static int sm501_init_dev(struct sm501_devdata *sm, unsigned int devices) > { > struct sm501_initdata *idata; > struct sm501_platdata *pdata; > @@ -1342,16 +1343,15 @@ static int sm501_init_dev(struct sm501_devdata *sm) > pdata = sm->platdata; > idata = pdata ? pdata->init : NULL; > > - if (idata) { > + if (idata) > sm501_init_regs(sm, idata); > > - if (idata->devices & SM501_USE_USB_HOST) > - sm501_register_usbhost(sm, &mem_avail); > - if (idata->devices & (SM501_USE_UART0 | SM501_USE_UART1)) > - sm501_register_uart(sm, idata->devices); > - if (idata->devices & SM501_USE_GPIO) > - sm501_register_gpio(sm); > - } > + if (devices & SM501_USE_USB_HOST) > + sm501_register_usbhost(sm, &mem_avail); > + if (devices & (SM501_USE_UART0 | SM501_USE_UART1)) > + sm501_register_uart(sm, devices); > + if (devices & SM501_USE_GPIO) > + sm501_register_gpio(sm); > > if (pdata && pdata->gpio_i2c != NULL && pdata->gpio_i2c_nr > 0) { > if (!sm501_gpio_isregistered(sm)) > @@ -1377,6 +1377,7 @@ static int sm501_plat_probe(struct platform_device *dev) > { > struct sm501_devdata *sm; > int ret; > + unsigned int devices = 0; > > sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL); > if (sm == NULL) { > @@ -1415,6 +1416,11 @@ static int sm501_plat_probe(struct platform_device *dev) > } > > platform_set_drvdata(dev, sm); > + if (sm->platdata) > + devices = sm->platdata->init->devices; > + if (dev->dev.of_node) > + of_property_read_u32(dev->dev.of_node, "smi,devices", > + &devices); > > sm->regs = ioremap(sm->io_res->start, resource_size(sm->io_res)); > > @@ -1424,7 +1430,7 @@ static int sm501_plat_probe(struct platform_device *dev) > goto err_claim; > } > > - return sm501_init_dev(sm); > + return sm501_init_dev(sm, devices); > > err_claim: > release_resource(sm->regs_claim); > @@ -1635,7 +1641,7 @@ static int sm501_pci_probe(struct pci_dev *dev, > goto err4; > } > > - sm501_init_dev(sm); > + sm501_init_dev(sm, sm->platdata->init->devices); > return 0; > > err4: > -- > 2.7.0 > > -- > 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 > -- 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] 3+ messages in thread
* Re: [PATCH v3] sm501: Add device property 2016-07-04 14:40 ` Mark Rutland @ 2016-07-06 13:12 ` Yoshinori Sato 0 siblings, 0 replies; 3+ messages in thread From: Yoshinori Sato @ 2016-07-06 13:12 UTC (permalink / raw) To: Mark Rutland Cc: Rob Herring, Lee Jones, devicetree-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA On Mon, 04 Jul 2016 23:40:43 +0900, Mark Rutland wrote: > > On Mon, Jul 04, 2016 at 11:26:04PM +0900, Yoshinori Sato wrote: > > Add device proptery on enable integrated peripheral. > > It have platform_data. But don't have devicetree. > > > > Signed-off-by: Yoshinori Sato <ysato-Rn4VEauK+AKRv+LV9MX5uooqe+aC9MnS@public.gmane.org> > > --- > > .../devicetree/bindings/display/sm501fb.txt | 11 +++++++++ > > drivers/mfd/sm501.c | 28 +++++++++++++--------- > > 2 files changed, 28 insertions(+), 11 deletions(-) > > > > diff --git a/Documentation/devicetree/bindings/display/sm501fb.txt b/Documentation/devicetree/bindings/display/sm501fb.txt > > index 9d9f009..9290094 100644 > > --- a/Documentation/devicetree/bindings/display/sm501fb.txt > > +++ b/Documentation/devicetree/bindings/display/sm501fb.txt > > @@ -22,6 +22,17 @@ Optional properties: > > set different foreign endian. > > - big-endian: available on little endian systems, to > > set different foreign endian. > > +- smi,devices: function block enable bitmap. > > + bit0: USB host > > + bit1: USB slave > > + bit2: SSP Ch0 > > + bit3: SSP Ch1 > > + bit4: UART Ch0 > > + bit5: UART Ch1 > > + bit6: Accelerator > > + bit7: AC97 > > + bit8: I2S > > + bit9: GPIO > > Generally we don't place bitmaps like this in DT. > > What exactly does this property represent? Whether certain sub-blocks > are present? > > These should probably be separate has-${FOO} proeprties. It may be > better to have separate nodes, if we'e going to need to refer to sub > blocks by phandle, or are liekly to have peropties specific to a sub > block. Hmm...Is it so? sm501: display@13e00000 { compatible = "smi,sm501"; <snip> devices = { has-usb-host; has-usb-target; }; }; I'll try it. > Thanks, > Mark. > > > Example for MPC5200: > > display@1,0 { > > diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c > > index 65cd0d2..e8c6a5e 100644 > > --- a/drivers/mfd/sm501.c > > +++ b/drivers/mfd/sm501.c > > @@ -21,6 +21,7 @@ > > #include <linux/pci.h> > > #include <linux/i2c-gpio.h> > > #include <linux/slab.h> > > +#include <linux/of.h> > > > > #include <linux/sm501.h> > > #include <linux/sm501-regs.h> > > @@ -1297,7 +1298,7 @@ static unsigned int sm501_mem_local[] = { > > * Common init code for an SM501 > > */ > > > > -static int sm501_init_dev(struct sm501_devdata *sm) > > +static int sm501_init_dev(struct sm501_devdata *sm, unsigned int devices) > > { > > struct sm501_initdata *idata; > > struct sm501_platdata *pdata; > > @@ -1342,16 +1343,15 @@ static int sm501_init_dev(struct sm501_devdata *sm) > > pdata = sm->platdata; > > idata = pdata ? pdata->init : NULL; > > > > - if (idata) { > > + if (idata) > > sm501_init_regs(sm, idata); > > > > - if (idata->devices & SM501_USE_USB_HOST) > > - sm501_register_usbhost(sm, &mem_avail); > > - if (idata->devices & (SM501_USE_UART0 | SM501_USE_UART1)) > > - sm501_register_uart(sm, idata->devices); > > - if (idata->devices & SM501_USE_GPIO) > > - sm501_register_gpio(sm); > > - } > > + if (devices & SM501_USE_USB_HOST) > > + sm501_register_usbhost(sm, &mem_avail); > > + if (devices & (SM501_USE_UART0 | SM501_USE_UART1)) > > + sm501_register_uart(sm, devices); > > + if (devices & SM501_USE_GPIO) > > + sm501_register_gpio(sm); > > > > if (pdata && pdata->gpio_i2c != NULL && pdata->gpio_i2c_nr > 0) { > > if (!sm501_gpio_isregistered(sm)) > > @@ -1377,6 +1377,7 @@ static int sm501_plat_probe(struct platform_device *dev) > > { > > struct sm501_devdata *sm; > > int ret; > > + unsigned int devices = 0; > > > > sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL); > > if (sm == NULL) { > > @@ -1415,6 +1416,11 @@ static int sm501_plat_probe(struct platform_device *dev) > > } > > > > platform_set_drvdata(dev, sm); > > + if (sm->platdata) > > + devices = sm->platdata->init->devices; > > + if (dev->dev.of_node) > > + of_property_read_u32(dev->dev.of_node, "smi,devices", > > + &devices); > > > > sm->regs = ioremap(sm->io_res->start, resource_size(sm->io_res)); > > > > @@ -1424,7 +1430,7 @@ static int sm501_plat_probe(struct platform_device *dev) > > goto err_claim; > > } > > > > - return sm501_init_dev(sm); > > + return sm501_init_dev(sm, devices); > > > > err_claim: > > release_resource(sm->regs_claim); > > @@ -1635,7 +1641,7 @@ static int sm501_pci_probe(struct pci_dev *dev, > > goto err4; > > } > > > > - sm501_init_dev(sm); > > + sm501_init_dev(sm, sm->platdata->init->devices); > > return 0; > > > > err4: > > -- > > 2.7.0 > > > > -- > > 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 > > -- Yoshinori Sato <ysato-Rn4VEauK+AKRv+LV9MX5uooqe+aC9MnS@public.gmane.org> -- 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] 3+ messages in thread
end of thread, other threads:[~2016-07-06 13:12 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-07-04 14:26 [PATCH v3] sm501: Add device property Yoshinori Sato [not found] ` <1467642364-10316-1-git-send-email-ysato-Rn4VEauK+AKRv+LV9MX5uooqe+aC9MnS@public.gmane.org> 2016-07-04 14:40 ` Mark Rutland 2016-07-06 13:12 ` Yoshinori Sato
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).