* [PATCH 1/2] powerpc/85xx: add pixis indirect mode device tree node @ 2011-11-17 18:57 Timur Tabi 2011-11-17 18:57 ` [PATCH 2/2] powerpc/85xx: p1022ds: enable monitor switching via pixis indirect mode Timur Tabi 2011-11-17 21:50 ` [PATCH 1/2] powerpc/85xx: add pixis indirect mode device tree node Scott Wood 0 siblings, 2 replies; 15+ messages in thread From: Timur Tabi @ 2011-11-17 18:57 UTC (permalink / raw) To: kumar.gala, linuxppc-dev The Freescale P1022 has a unique pin muxing "feature" where the DIU video controller's video signals are muxed with 24 of the local bus address signals. When the DIU is enabled, the bulk of the local bus is disabled, preventing access to memory-mapped devices like NOR flash and the pixis FPGA. In this situation, the pixis supports "indirect mode", which allows access to the pixis itself by reading/writing addresses on specific local bus chip selects. CS0 is used to select which pixis register to access, and CS1 is used to read/write the value. To support this, we introduce another board-control child node of the localbus node that contains a 'reg' property for CS0 and CS1. This will produce the correct physical addresses for CS0 and CS1. Signed-off-by: Timur Tabi <timur@freescale.com> --- arch/powerpc/boot/dts/p1022ds.dts | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/arch/powerpc/boot/dts/p1022ds.dts b/arch/powerpc/boot/dts/p1022ds.dts index 24a73e9..3e85d8c 100644 --- a/arch/powerpc/boot/dts/p1022ds.dts +++ b/arch/powerpc/boot/dts/p1022ds.dts @@ -24,6 +24,20 @@ 0x2 0x0 0xf 0xffa00000 0x00040000 0x3 0x0 0xf 0xffdf0000 0x00008000>; + /* + * This node is used to access the pixis via "indirect" mode, + * which is done by writing the pixis register index to chip + * select 0 and the value to/from chip select 1. Indirect + * mode is the only way to access the pixis when DIU video + * is enabled. Note that this assumes that the first column + * of the 'ranges' property above is the chip select number. + */ + board-control@0,0 { + compatible = "fsl,p1022ds-indirect-pixis"; + reg = <0x0 0x0 1 /* CS0 */ + 0x1 0x0 1>; /* CS1 */ + }; + nor@0,0 { #address-cells = <1>; #size-cells = <1>; -- 1.7.3.4 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 2/2] powerpc/85xx: p1022ds: enable monitor switching via pixis indirect mode 2011-11-17 18:57 [PATCH 1/2] powerpc/85xx: add pixis indirect mode device tree node Timur Tabi @ 2011-11-17 18:57 ` Timur Tabi 2011-11-17 21:29 ` Stephen Rothwell 2011-11-17 21:37 ` Scott Wood 2011-11-17 21:50 ` [PATCH 1/2] powerpc/85xx: add pixis indirect mode device tree node Scott Wood 1 sibling, 2 replies; 15+ messages in thread From: Timur Tabi @ 2011-11-17 18:57 UTC (permalink / raw) To: kumar.gala, linuxppc-dev When the P1022's DIU video controller is active, the pixis must be accessed in "indirect" mode, which uses localbus chip select addresses. Switching between the DVI and LVDS monitor ports is handled by the pixis, so that switching needs to be done via indirect mode. This has the side-effect of no longer requiring U-Boot to enable the DIU. Now Linux can enable the DIU all by itself. Signed-off-by: Timur Tabi <timur@freescale.com> --- arch/powerpc/platforms/85xx/p1022_ds.c | 132 ++++++++++++++++++++++++++----- 1 files changed, 110 insertions(+), 22 deletions(-) diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c b/arch/powerpc/platforms/85xx/p1022_ds.c index fda1571..7bdb9af 100644 --- a/arch/powerpc/platforms/85xx/p1022_ds.c +++ b/arch/powerpc/platforms/85xx/p1022_ds.c @@ -29,6 +29,10 @@ #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE) +#define PMUXCR_ELBCDIU_MASK 0xc0000000 +#define PMUXCR_ELBCDIU_NOR16 0x80000000 +#define PMUXCR_ELBCDIU_DIU 0x40000000 + /* * Board-specific initialization of the DIU. This code should probably be * executed when the DIU is opened, rather than in arch code, but the DIU @@ -46,11 +50,22 @@ #define CLKDVDR_PXCLK_MASK 0x00FF0000 /* Some ngPIXIS register definitions */ +#define PX_CTL 3 +#define PX_BRDCFG0 8 +#define PX_BRDCFG1 9 + +#define PX_BRDCFG0_ELBC_SPI_MASK 0xc0 +#define PX_BRDCFG0_ELBC_SPI_ELBC 0x00 +#define PX_BRDCFG0_ELBC_SPI_NULL 0xc0 +#define PX_BRDCFG0_ELBC_DIU 0x02 + #define PX_BRDCFG1_DVIEN 0x80 #define PX_BRDCFG1_DFPEN 0x40 #define PX_BRDCFG1_BACKLIGHT 0x20 #define PX_BRDCFG1_DDCEN 0x10 +#define PX_CTL_ALTACC 0x80 + /* * DIU Area Descriptor * @@ -129,44 +144,117 @@ static void p1022ds_set_gamma_table(enum fsl_diu_monitor_port port, */ static void p1022ds_set_monitor_port(enum fsl_diu_monitor_port port) { - struct device_node *np; - void __iomem *pixis; - u8 __iomem *brdcfg1; + struct device_node *guts_node = NULL; + struct device_node *indirect_node = NULL; + struct ccsr_guts_85xx __iomem *guts = NULL; + u8 __iomem *lbc_lcs0_ba = NULL; + u8 __iomem *lbc_lcs1_ba = NULL; + u8 b; - np = of_find_compatible_node(NULL, NULL, "fsl,p1022ds-fpga"); - if (!np) - /* older device trees used "fsl,p1022ds-pixis" */ - np = of_find_compatible_node(NULL, NULL, "fsl,p1022ds-pixis"); - if (!np) { - pr_err("p1022ds: missing ngPIXIS node\n"); + /* Map the global utilities registers. */ + guts_node = of_find_compatible_node(NULL, NULL, "fsl,p1022-guts"); + if (!guts_node) { + pr_err("p1022ds: missing global utilties device node\n"); return; } - pixis = of_iomap(np, 0); - if (!pixis) { - pr_err("p1022ds: could not map ngPIXIS registers\n"); - return; + guts = of_iomap(guts_node, 0); + if (!guts) { + pr_err("p1022ds: could not map global utilties device\n"); + goto exit; } - brdcfg1 = pixis + 9; /* BRDCFG1 is at offset 9 in the ngPIXIS */ + + indirect_node = of_find_compatible_node(NULL, NULL, + "fsl,p1022ds-indirect-pixis"); + if (!indirect_node) { + pr_err("p1022ds: missing pixis indirect mode node\n"); + goto exit; + } + + lbc_lcs0_ba = of_iomap(indirect_node, 0); + if (!lbc_lcs0_ba) { + pr_err("p1022ds: could not map localbus chip select 0\n"); + goto exit; + } + + lbc_lcs1_ba = of_iomap(indirect_node, 1); + if (!lbc_lcs1_ba) { + pr_err("p1022ds: could not map localbus chip select 1\n"); + goto exit; + } + + /* Make sure we're in indirect mode first. */ + if ((in_be32(&guts->pmuxcr) & PMUXCR_ELBCDIU_MASK) != + PMUXCR_ELBCDIU_DIU) { + struct device_node *pixis_node; + void __iomem *pixis; + + pixis_node = + of_find_compatible_node(NULL, NULL, "fsl,p1022ds-fpga"); + if (!pixis_node) { + pr_err("p1022ds: missing pixis node\n"); + goto exit; + } + + pixis = of_iomap(pixis_node, 0); + of_node_put(pixis_node); + if (!pixis) { + pr_err("p1022ds: could not map pixis registers\n"); + goto exit; + } + + /* Enable indirect PIXIS mode. */ + setbits8(pixis + PX_CTL, PX_CTL_ALTACC); + iounmap(pixis); + + /* Switch the board mux to the DIU */ + out_8(lbc_lcs0_ba, PX_BRDCFG0); /* BRDCFG0 */ + b = in_8(lbc_lcs1_ba); + b |= PX_BRDCFG0_ELBC_DIU; + out_8(lbc_lcs1_ba, b); + + /* Set the chip mux to DIU mode. */ + clrsetbits_be32(&guts->pmuxcr, PMUXCR_ELBCDIU_MASK, + PMUXCR_ELBCDIU_DIU); + in_be32(&guts->pmuxcr); + } + switch (port) { case FSL_DIU_PORT_DVI: - printk(KERN_INFO "%s:%u\n", __func__, __LINE__); /* Enable the DVI port, disable the DFP and the backlight */ - clrsetbits_8(brdcfg1, PX_BRDCFG1_DFPEN | PX_BRDCFG1_BACKLIGHT, - PX_BRDCFG1_DVIEN); + out_8(lbc_lcs0_ba, PX_BRDCFG1); + b = in_8(lbc_lcs1_ba); + b &= ~(PX_BRDCFG1_DFPEN | PX_BRDCFG1_BACKLIGHT); + b |= PX_BRDCFG1_DVIEN; + out_8(lbc_lcs1_ba, b); break; case FSL_DIU_PORT_LVDS: - printk(KERN_INFO "%s:%u\n", __func__, __LINE__); + /* + * LVDS also needs backlight enabled, otherwise the display + * will be blank. + */ /* Enable the DFP port, disable the DVI and the backlight */ - clrsetbits_8(brdcfg1, PX_BRDCFG1_DVIEN | PX_BRDCFG1_BACKLIGHT, - PX_BRDCFG1_DFPEN); + out_8(lbc_lcs0_ba, PX_BRDCFG1); + b = in_8(lbc_lcs1_ba); + b &= ~PX_BRDCFG1_DVIEN; + b |= PX_BRDCFG1_DFPEN | PX_BRDCFG1_BACKLIGHT; + out_8(lbc_lcs1_ba, b); break; default: pr_err("p1022ds: unsupported monitor port %i\n", port); } - iounmap(pixis); +exit: + if (lbc_lcs1_ba) + iounmap(lbc_lcs1_ba); + if (lbc_lcs0_ba) + iounmap(lbc_lcs0_ba); + if (guts) + iounmap(guts); + + of_node_put(indirect_node); + of_node_put(guts_node); } /** -- 1.7.3.4 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 2/2] powerpc/85xx: p1022ds: enable monitor switching via pixis indirect mode 2011-11-17 18:57 ` [PATCH 2/2] powerpc/85xx: p1022ds: enable monitor switching via pixis indirect mode Timur Tabi @ 2011-11-17 21:29 ` Stephen Rothwell 2011-11-17 22:09 ` Timur Tabi 2011-11-17 21:37 ` Scott Wood 1 sibling, 1 reply; 15+ messages in thread From: Stephen Rothwell @ 2011-11-17 21:29 UTC (permalink / raw) To: Timur Tabi; +Cc: linuxppc-dev, kumar.gala [-- Attachment #1: Type: text/plain, Size: 883 bytes --] Hi Timur, On Thu, 17 Nov 2011 12:57:39 -0600 Timur Tabi <timur@freescale.com> wrote: > > @@ -129,44 +144,117 @@ static void p1022ds_set_gamma_table(enum fsl_diu_monitor_port port, > */ > static void p1022ds_set_monitor_port(enum fsl_diu_monitor_port port) > { > - struct device_node *np; > - void __iomem *pixis; > - u8 __iomem *brdcfg1; > + struct device_node *guts_node = NULL; There is no point in initialising this as it is assigned before being used. > + struct device_node *indirect_node = NULL; > + struct ccsr_guts_85xx __iomem *guts = NULL; > + u8 __iomem *lbc_lcs0_ba = NULL; > + u8 __iomem *lbc_lcs1_ba = NULL; And if you had multiple error path labels, you could avoid these others as well (and the NULL checks on the error path). -- Cheers, Stephen Rothwell sfr@canb.auug.org.au http://www.canb.auug.org.au/~sfr/ [-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/2] powerpc/85xx: p1022ds: enable monitor switching via pixis indirect mode 2011-11-17 21:29 ` Stephen Rothwell @ 2011-11-17 22:09 ` Timur Tabi 2011-11-19 1:04 ` Stephen Rothwell 0 siblings, 1 reply; 15+ messages in thread From: Timur Tabi @ 2011-11-17 22:09 UTC (permalink / raw) To: Stephen Rothwell; +Cc: linuxppc-dev, kumar.gala Stephen Rothwell wrote: >> static void p1022ds_set_monitor_port(enum fsl_diu_monitor_port port) >> { >> - struct device_node *np; >> - void __iomem *pixis; >> - u8 __iomem *brdcfg1; >> + struct device_node *guts_node = NULL; > > There is no point in initialising this as it is assigned before being > used. Ok. >> + struct device_node *indirect_node = NULL; >> + struct ccsr_guts_85xx __iomem *guts = NULL; >> + u8 __iomem *lbc_lcs0_ba = NULL; >> + u8 __iomem *lbc_lcs1_ba = NULL; > > And if you had multiple error path labels, you could avoid these others > as well (and the NULL checks on the error path). But I don't want multiple error path labels. The error path could only happen if someone passed in a broken device tree (i.e. pretty much never), so I'm not keen on complicating my code just to optimize something that will never be used. -- Timur Tabi Linux kernel developer at Freescale ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/2] powerpc/85xx: p1022ds: enable monitor switching via pixis indirect mode 2011-11-17 22:09 ` Timur Tabi @ 2011-11-19 1:04 ` Stephen Rothwell 2011-11-21 17:01 ` Timur Tabi 0 siblings, 1 reply; 15+ messages in thread From: Stephen Rothwell @ 2011-11-19 1:04 UTC (permalink / raw) To: Timur Tabi; +Cc: linuxppc-dev, kumar.gala [-- Attachment #1: Type: text/plain, Size: 4094 bytes --] Hi Timur, On Thu, 17 Nov 2011 16:09:17 -0600 Timur Tabi <timur@freescale.com> wrote: > > Stephen Rothwell wrote: > > >> + struct device_node *indirect_node = NULL; > >> + struct ccsr_guts_85xx __iomem *guts = NULL; > >> + u8 __iomem *lbc_lcs0_ba = NULL; > >> + u8 __iomem *lbc_lcs1_ba = NULL; > > > > And if you had multiple error path labels, you could avoid these others > > as well (and the NULL checks on the error path). > > But I don't want multiple error path labels. The error path could only > happen if someone passed in a broken device tree (i.e. pretty much > never), so I'm not keen on complicating my code just to optimize > something that will never be used. But you are already optimizing for the error path by doing the assignments and NULL checks that are unneeded in the non error path. What I am suggesting is adding a little more code that could end up doing less at run time. How about (not even compile tested): static void p1022ds_set_monitor_port(enum fsl_diu_monitor_port port) { struct device_node *guts_node; struct device_node *indirect_node; struct ccsr_guts_85xx __iomem *guts; u8 __iomem *lbc_lcs0_ba; u8 __iomem *lbc_lcs1_ba; u8 b; /* Map the global utilities registers. */ guts_node = of_find_compatible_node(NULL, NULL, "fsl,p1022-guts"); if (!guts_node) { pr_err("p1022ds: missing global utilties device node\n"); return; } guts = of_iomap(guts_node, 0); of_node_put(guts_node); if (!guts) { pr_err("p1022ds: could not map global utilties device\n"); return; } indirect_node = of_find_compatible_node(NULL, NULL, "fsl,p1022ds-indirect-pixis"); if (!indirect_node) { pr_err("p1022ds: missing pixis indirect mode node\n"); goto exit_guts_iounmap; } lbc_lcs0_ba = of_iomap(indirect_node, 0); if (!lbc_lcs0_ba) { pr_err("p1022ds: could not map localbus chip select 0\n"); goto exit_indirect_node; } lbc_lcs1_ba = of_iomap(indirect_node, 1); if (!lbc_lcs1_ba) { pr_err("p1022ds: could not map localbus chip select 1\n"); goto exit_lcs0_iounmap; } /* Make sure we're in indirect mode first. */ if ((in_be32(&guts->pmuxcr) & PMUXCR_ELBCDIU_MASK) != PMUXCR_ELBCDIU_DIU) { struct device_node *pixis_node; void __iomem *pixis; pixis_node = of_find_compatible_node(NULL, NULL, "fsl,p1022ds-fpga"); if (!pixis_node) { pr_err("p1022ds: missing pixis node\n"); goto exit_lcs1_iounmap; } pixis = of_iomap(pixis_node, 0); of_node_put(pixis_node); if (!pixis) { pr_err("p1022ds: could not map pixis registers\n"); goto exit_lcs1_iounmap; } /* Enable indirect PIXIS mode. */ setbits8(pixis + PX_CTL, PX_CTL_ALTACC); iounmap(pixis); /* Switch the board mux to the DIU */ out_8(lbc_lcs0_ba, PX_BRDCFG0); /* BRDCFG0 */ b = in_8(lbc_lcs1_ba); b |= PX_BRDCFG0_ELBC_DIU; out_8(lbc_lcs1_ba, b); /* Set the chip mux to DIU mode. */ clrsetbits_be32(&guts->pmuxcr, PMUXCR_ELBCDIU_MASK, PMUXCR_ELBCDIU_DIU); in_be32(&guts->pmuxcr); } switch (port) { case FSL_DIU_PORT_DVI: /* Enable the DVI port, disable the DFP and the backlight */ out_8(lbc_lcs0_ba, PX_BRDCFG1); b = in_8(lbc_lcs1_ba); b &= ~(PX_BRDCFG1_DFPEN | PX_BRDCFG1_BACKLIGHT); b |= PX_BRDCFG1_DVIEN; out_8(lbc_lcs1_ba, b); break; case FSL_DIU_PORT_LVDS: /* * LVDS also needs backlight enabled, otherwise the display * will be blank. */ /* Enable the DFP port, disable the DVI and the backlight */ out_8(lbc_lcs0_ba, PX_BRDCFG1); b = in_8(lbc_lcs1_ba); b &= ~PX_BRDCFG1_DVIEN; b |= PX_BRDCFG1_DFPEN | PX_BRDCFG1_BACKLIGHT; out_8(lbc_lcs1_ba, b); break; default: pr_err("p1022ds: unsupported monitor port %i\n", port); } exit_lcs1_iounmap: iounmap(lbc_lcs1_ba); exit_lcs0_iounmap: iounmap(lbc_lcs0_ba); exit_indirect_node: of_node_put(indirect_node); exit_guts_iounmap: iounmap(guts); } -- Cheers, Stephen Rothwell sfr@canb.auug.org.au http://www.canb.auug.org.au/~sfr/ [-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/2] powerpc/85xx: p1022ds: enable monitor switching via pixis indirect mode 2011-11-19 1:04 ` Stephen Rothwell @ 2011-11-21 17:01 ` Timur Tabi 0 siblings, 0 replies; 15+ messages in thread From: Timur Tabi @ 2011-11-21 17:01 UTC (permalink / raw) To: Stephen Rothwell; +Cc: linuxppc-dev, kumar.gala Stephen Rothwell wrote: > exit_lcs1_iounmap: > iounmap(lbc_lcs1_ba); > exit_lcs0_iounmap: > iounmap(lbc_lcs0_ba); > exit_indirect_node: > of_node_put(indirect_node); > exit_guts_iounmap: > iounmap(guts); The point I'm trying to make is that I don't want to have multiple goto exit labels. If I have to rearrange the code or add/delete code, then I probably would need to make similar changes to these labels. I just don't like that sort of thing. I appreciate your taking the time to review my code and provide suggestions. However, considering that I'm modifying my own code, I would hope that you can appreciate my personal coding style preference. And my style is to reduce the number of labels, even if it means superfluous checks in the exit code. So Kumar, if there are no further objections, please apply this patch as-is. Thank you. -- Timur Tabi Linux kernel developer at Freescale ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/2] powerpc/85xx: p1022ds: enable monitor switching via pixis indirect mode 2011-11-17 18:57 ` [PATCH 2/2] powerpc/85xx: p1022ds: enable monitor switching via pixis indirect mode Timur Tabi 2011-11-17 21:29 ` Stephen Rothwell @ 2011-11-17 21:37 ` Scott Wood 2011-11-17 22:12 ` Timur Tabi 1 sibling, 1 reply; 15+ messages in thread From: Scott Wood @ 2011-11-17 21:37 UTC (permalink / raw) To: Timur Tabi; +Cc: linuxppc-dev, kumar.gala On Thu, Nov 17, 2011 at 12:57:39PM -0600, Timur Tabi wrote: > When the P1022's DIU video controller is active, the pixis must be accessed > in "indirect" mode, which uses localbus chip select addresses. > > Switching between the DVI and LVDS monitor ports is handled by the pixis, > so that switching needs to be done via indirect mode. > > This has the side-effect of no longer requiring U-Boot to enable the DIU. > Now Linux can enable the DIU all by itself. Under what circumstances does Linux do this? How does Linux prevent the NOR flash driver from binding to the device when this mode has been or will be used? -Scott ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/2] powerpc/85xx: p1022ds: enable monitor switching via pixis indirect mode 2011-11-17 21:37 ` Scott Wood @ 2011-11-17 22:12 ` Timur Tabi 2011-11-17 22:25 ` Scott Wood 0 siblings, 1 reply; 15+ messages in thread From: Timur Tabi @ 2011-11-17 22:12 UTC (permalink / raw) To: Scott Wood; +Cc: linuxppc-dev, kumar.gala Scott Wood wrote: >> This has the side-effect of no longer requiring U-Boot to enable the DIU. >> Now Linux can enable the DIU all by itself. > > Under what circumstances does Linux do this? p1022ds_set_monitor_port() is called by the DIU driver when it enables the DIU. This happens on boot, for example, if you enable the framebuffer console. > How does Linux prevent the > NOR flash driver from binding to the device when this mode has been or > will be used? It doesn't. This isn't a simple problem to solve. On the P1022, NOR flash and the DIU are incompatible, and yet that's exactly what we ship on the P1022DS board. We could just remove the NOR flash node from the DTS. -- Timur Tabi Linux kernel developer at Freescale ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/2] powerpc/85xx: p1022ds: enable monitor switching via pixis indirect mode 2011-11-17 22:12 ` Timur Tabi @ 2011-11-17 22:25 ` Scott Wood 2011-11-17 22:28 ` Timur Tabi 0 siblings, 1 reply; 15+ messages in thread From: Scott Wood @ 2011-11-17 22:25 UTC (permalink / raw) To: Timur Tabi; +Cc: linuxppc-dev, kumar.gala On Thu, Nov 17, 2011 at 04:12:02PM -0600, Timur Tabi wrote: > Scott Wood wrote: > > >> This has the side-effect of no longer requiring U-Boot to enable the DIU. > >> Now Linux can enable the DIU all by itself. > > > > Under what circumstances does Linux do this? > > p1022ds_set_monitor_port() is called by the DIU driver when it enables > the DIU. This happens on boot, for example, if you enable the > framebuffer console. > > > How does Linux prevent the > > NOR flash driver from binding to the device when this mode has been or > > will be used? > > It doesn't. This isn't a simple problem to solve. On the P1022, NOR > flash and the DIU are incompatible, and yet that's exactly what we ship > on the P1022DS board. We could just remove the NOR flash node from the > DTS. As we discussed earlier, you could have a kernel boot parameter that indicates what mode you'd like the localbus to run in. Then, platform code could update the device tree before any drivers bind. Or, have U-boot set up the desired mode before entering the kernel, and provide an appropriate device tree. Letting the kernel bind to localbus devices such as NOR flash, and then taking the devices away without notice just because another device gets initialized, is not the way to go. We've already left "it just works" territory, might as well make the user choose explicitly. -Scott ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/2] powerpc/85xx: p1022ds: enable monitor switching via pixis indirect mode 2011-11-17 22:25 ` Scott Wood @ 2011-11-17 22:28 ` Timur Tabi 2011-11-17 22:45 ` Scott Wood 0 siblings, 1 reply; 15+ messages in thread From: Timur Tabi @ 2011-11-17 22:28 UTC (permalink / raw) To: Scott Wood; +Cc: linuxppc-dev, kumar.gala Scott Wood wrote: > As we discussed earlier, you could have a kernel boot parameter that > indicates what mode you'd like the localbus to run in. Then, platform > code could update the device tree before any drivers bind. How do I update the device tree from platform code? > Or, have U-boot set up the desired mode before entering the kernel, and > provide an appropriate device tree. I can both of these features, but not in this patch. -- Timur Tabi Linux kernel developer at Freescale ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/2] powerpc/85xx: p1022ds: enable monitor switching via pixis indirect mode 2011-11-17 22:28 ` Timur Tabi @ 2011-11-17 22:45 ` Scott Wood 2011-11-18 17:00 ` Timur Tabi 0 siblings, 1 reply; 15+ messages in thread From: Scott Wood @ 2011-11-17 22:45 UTC (permalink / raw) To: Timur Tabi; +Cc: linuxppc-dev, kumar.gala On Thu, Nov 17, 2011 at 04:28:48PM -0600, Timur Tabi wrote: > Scott Wood wrote: > > > As we discussed earlier, you could have a kernel boot parameter that > > indicates what mode you'd like the localbus to run in. Then, platform > > code could update the device tree before any drivers bind. > > How do I update the device tree from platform code? prom_update_property() Or, since you shouldn't be declaring these devices directly under a simple-bus node, selectively probe the devices that are accessible. > > Or, have U-boot set up the desired mode before entering the kernel, and > > provide an appropriate device tree. > > I can both of these features, but not in this patch. This patch is the one that is adding a switch to indirect mode. You're adding it to the wrong place (it shouldn't be in a function called by the DIU driver), so it is relevant to this patch. -Scott ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/2] powerpc/85xx: p1022ds: enable monitor switching via pixis indirect mode 2011-11-17 22:45 ` Scott Wood @ 2011-11-18 17:00 ` Timur Tabi 2011-11-18 18:06 ` Scott Wood 0 siblings, 1 reply; 15+ messages in thread From: Timur Tabi @ 2011-11-18 17:00 UTC (permalink / raw) To: Scott Wood; +Cc: linuxppc-dev, kumar.gala Scott Wood wrote: >> > How do I update the device tree from platform code? > prom_update_property() I assume this needs to be called after the DT has been unflattened, since it takes a device_node* as a parameter. Is there any way I can modify the tree before it's unflattened? I'd like to fixup the tree in an early_param() function. -- Timur Tabi Linux kernel developer at Freescale ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/2] powerpc/85xx: p1022ds: enable monitor switching via pixis indirect mode 2011-11-18 17:00 ` Timur Tabi @ 2011-11-18 18:06 ` Scott Wood 2011-11-18 18:08 ` Timur Tabi 0 siblings, 1 reply; 15+ messages in thread From: Scott Wood @ 2011-11-18 18:06 UTC (permalink / raw) To: Timur Tabi; +Cc: linuxppc-dev, kumar.gala On Fri, Nov 18, 2011 at 11:00:04AM -0600, Timur Tabi wrote: > Scott Wood wrote: > >> > How do I update the device tree from platform code? > > > prom_update_property() > > I assume this needs to be called after the DT has been unflattened, > since it takes a device_node* as a parameter. Is there any way I can > modify the tree before it's unflattened? I'd like to fixup the tree in > an early_param() function. What's wrong with doing it in setup_arch()? Modifying a flat device tree is a more complicated task, and the kernel's code is read-only. It's not worth bringing libfdt or similar complexity in for this, when there are other alternatives. If it really needs to be done early, consider doing it from U-Boot. The bootwrapper would be a decent place as well, but we probably shouldn't require its use just for this. -Scott ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/2] powerpc/85xx: p1022ds: enable monitor switching via pixis indirect mode 2011-11-18 18:06 ` Scott Wood @ 2011-11-18 18:08 ` Timur Tabi 0 siblings, 0 replies; 15+ messages in thread From: Timur Tabi @ 2011-11-18 18:08 UTC (permalink / raw) To: Scott Wood; +Cc: linuxppc-dev, kumar.gala Scott Wood wrote: > What's wrong with doing it in setup_arch()? Well, I was hoping to encapsulate everything into one function -- the early_param() callback function. But I guess that's not going to work. -- Timur Tabi Linux kernel developer at Freescale ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] powerpc/85xx: add pixis indirect mode device tree node 2011-11-17 18:57 [PATCH 1/2] powerpc/85xx: add pixis indirect mode device tree node Timur Tabi 2011-11-17 18:57 ` [PATCH 2/2] powerpc/85xx: p1022ds: enable monitor switching via pixis indirect mode Timur Tabi @ 2011-11-17 21:50 ` Scott Wood 1 sibling, 0 replies; 15+ messages in thread From: Scott Wood @ 2011-11-17 21:50 UTC (permalink / raw) To: Timur Tabi; +Cc: linuxppc-dev, kumar.gala On Thu, Nov 17, 2011 at 12:57:38PM -0600, Timur Tabi wrote: > The Freescale P1022 has a unique pin muxing "feature" where the DIU video > controller's video signals are muxed with 24 of the local bus address signals. > When the DIU is enabled, the bulk of the local bus is disabled, preventing > access to memory-mapped devices like NOR flash and the pixis FPGA. > > In this situation, the pixis supports "indirect mode", which allows access > to the pixis itself by reading/writing addresses on specific local bus > chip selects. CS0 is used to select which pixis register to access, and > CS1 is used to read/write the value. > > To support this, we introduce another board-control child node of the > localbus node that contains a 'reg' property for CS0 and CS1. This will > produce the correct physical addresses for CS0 and CS1. > > Signed-off-by: Timur Tabi <timur@freescale.com> > --- > arch/powerpc/boot/dts/p1022ds.dts | 14 ++++++++++++++ > 1 files changed, 14 insertions(+), 0 deletions(-) > > diff --git a/arch/powerpc/boot/dts/p1022ds.dts b/arch/powerpc/boot/dts/p1022ds.dts > index 24a73e9..3e85d8c 100644 > --- a/arch/powerpc/boot/dts/p1022ds.dts > +++ b/arch/powerpc/boot/dts/p1022ds.dts > @@ -24,6 +24,20 @@ > 0x2 0x0 0xf 0xffa00000 0x00040000 > 0x3 0x0 0xf 0xffdf0000 0x00008000>; > > + /* > + * This node is used to access the pixis via "indirect" mode, > + * which is done by writing the pixis register index to chip > + * select 0 and the value to/from chip select 1. Indirect > + * mode is the only way to access the pixis when DIU video > + * is enabled. Note that this assumes that the first column > + * of the 'ranges' property above is the chip select number. > + */ > + board-control@0,0 { > + compatible = "fsl,p1022ds-indirect-pixis"; > + reg = <0x0 0x0 1 /* CS0 */ > + 0x1 0x0 1>; /* CS1 */ > + }; > + > nor@0,0 { > #address-cells = <1>; > #size-cells = <1>; U-Boot should mark some of these devices as disabled, based on whether indirect mode is enabled on boot. If you're not going to do that, at least remove simple-bus from the compatible list. Something like this is probably the best way to describe it: localbus { compatible = "...", "fsl,elbc", "simple-bus"; ranges = <...>; #address-cells = <2>; #size-cells = <2>; mux { compatible = "fsl,p1022ds-localbus-mux"; // no simple-bus fsl,localbus-mux-mode = "indirect"; // inital state on boot ranges; #address-cells = <2>; #size-cells = <2>; board-control@0,0 { compatible = "fsl,p1022ds-indirect-pixis"; reg = <0 0 1 1 0 1>; fsl,localbus-mux-avail = "indirect"; }; flash@0,0 { ... fsl,localbus-mux-avail = "direct"; }; ... }; }; Or encode the mode as part of reg, as I suggested for someone else here: http://lists.ozlabs.org/pipermail/devicetree-discuss/2011-November/009378.html -Scott ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2011-11-21 17:01 UTC | newest] Thread overview: 15+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-11-17 18:57 [PATCH 1/2] powerpc/85xx: add pixis indirect mode device tree node Timur Tabi 2011-11-17 18:57 ` [PATCH 2/2] powerpc/85xx: p1022ds: enable monitor switching via pixis indirect mode Timur Tabi 2011-11-17 21:29 ` Stephen Rothwell 2011-11-17 22:09 ` Timur Tabi 2011-11-19 1:04 ` Stephen Rothwell 2011-11-21 17:01 ` Timur Tabi 2011-11-17 21:37 ` Scott Wood 2011-11-17 22:12 ` Timur Tabi 2011-11-17 22:25 ` Scott Wood 2011-11-17 22:28 ` Timur Tabi 2011-11-17 22:45 ` Scott Wood 2011-11-18 17:00 ` Timur Tabi 2011-11-18 18:06 ` Scott Wood 2011-11-18 18:08 ` Timur Tabi 2011-11-17 21:50 ` [PATCH 1/2] powerpc/85xx: add pixis indirect mode device tree node Scott Wood
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).