* [PATCH 2/3] powerpc/85xx: add pixis indirect mode device tree node
2011-11-18 17:49 [PATCH 1/3] powerpc/85xx: p1022ds: disable the NOR flash node if video is enabled Timur Tabi
@ 2011-11-18 17:50 ` Timur Tabi
2011-11-24 5:16 ` Kumar Gala
2011-11-18 17:50 ` [PATCH 3/3] [v2] powerpc/85xx: p1022ds: enable monitor switching via pixis indirect mode Timur Tabi
2011-11-24 5:12 ` [PATCH 1/3] powerpc/85xx: p1022ds: disable the NOR flash node if video is enabled Kumar Gala
2 siblings, 1 reply; 6+ messages in thread
From: Timur Tabi @ 2011-11-18 17:50 UTC (permalink / raw)
To: kumar.gala, scottwood, 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] 6+ messages in thread
* Re: [PATCH 2/3] powerpc/85xx: add pixis indirect mode device tree node
2011-11-18 17:50 ` [PATCH 2/3] powerpc/85xx: add pixis indirect mode device tree node Timur Tabi
@ 2011-11-24 5:16 ` Kumar Gala
0 siblings, 0 replies; 6+ messages in thread
From: Kumar Gala @ 2011-11-24 5:16 UTC (permalink / raw)
To: Timur Tabi; +Cc: scottwood, linuxppc-dev
On Nov 18, 2011, at 11:50 AM, 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.
>=20
> 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.
>=20
> 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.
>=20
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---
> arch/powerpc/boot/dts/p1022ds.dts | 14 ++++++++++++++
> 1 files changed, 14 insertions(+), 0 deletions(-)
applied to next
- k=
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/3] [v2] powerpc/85xx: p1022ds: enable monitor switching via pixis indirect mode
2011-11-18 17:49 [PATCH 1/3] powerpc/85xx: p1022ds: disable the NOR flash node if video is enabled Timur Tabi
2011-11-18 17:50 ` [PATCH 2/3] powerpc/85xx: add pixis indirect mode device tree node Timur Tabi
@ 2011-11-18 17:50 ` Timur Tabi
2012-03-16 16:20 ` Kumar Gala
2011-11-24 5:12 ` [PATCH 1/3] powerpc/85xx: p1022ds: disable the NOR flash node if video is enabled Kumar Gala
2 siblings, 1 reply; 6+ messages in thread
From: Timur Tabi @ 2011-11-18 17:50 UTC (permalink / raw)
To: kumar.gala, scottwood, 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 e0280e2..948f7ae 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;
+ struct device_node *indirect_node = NULL;
+ struct ccsr_guts_85xx __iomem *guts;
+ 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;
+ }
+
+ 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;
}
- brdcfg1 = pixis + 9; /* BRDCFG1 is at offset 9 in the ngPIXIS */
+
+ 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] 6+ messages in thread
* Re: [PATCH 3/3] [v2] powerpc/85xx: p1022ds: enable monitor switching via pixis indirect mode
2011-11-18 17:50 ` [PATCH 3/3] [v2] powerpc/85xx: p1022ds: enable monitor switching via pixis indirect mode Timur Tabi
@ 2012-03-16 16:20 ` Kumar Gala
0 siblings, 0 replies; 6+ messages in thread
From: Kumar Gala @ 2012-03-16 16:20 UTC (permalink / raw)
To: Timur Tabi; +Cc: scottwood, linuxppc-dev
On Nov 18, 2011, at 11:50 AM, 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.
>=20
> Switching between the DVI and LVDS monitor ports is handled by the =
pixis,
> so that switching needs to be done via indirect mode.
>=20
> This has the side-effect of no longer requiring U-Boot to enable the =
DIU.
> Now Linux can enable the DIU all by itself.
>=20
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---
> arch/powerpc/platforms/85xx/p1022_ds.c | 132 =
++++++++++++++++++++++++++-----
> 1 files changed, 110 insertions(+), 22 deletions(-)
applied
- k=
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] powerpc/85xx: p1022ds: disable the NOR flash node if video is enabled
2011-11-18 17:49 [PATCH 1/3] powerpc/85xx: p1022ds: disable the NOR flash node if video is enabled Timur Tabi
2011-11-18 17:50 ` [PATCH 2/3] powerpc/85xx: add pixis indirect mode device tree node Timur Tabi
2011-11-18 17:50 ` [PATCH 3/3] [v2] powerpc/85xx: p1022ds: enable monitor switching via pixis indirect mode Timur Tabi
@ 2011-11-24 5:12 ` Kumar Gala
2 siblings, 0 replies; 6+ messages in thread
From: Kumar Gala @ 2011-11-24 5:12 UTC (permalink / raw)
To: Timur Tabi; +Cc: scottwood, linuxppc-dev
On Nov 18, 2011, at 11:49 AM, 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.
>=20
> Therefore, if the DIU is going to be enabled, then memory-mapped =
devices on
> the localbus, like NOR flash, need to be disabled.
>=20
> Signed-off-by: Timur Tabi <timur@freescale.com>
> ---
> arch/powerpc/platforms/85xx/p1022_ds.c | 70 =
++++++++++++++++++++++++++++++++
> 1 files changed, 70 insertions(+), 0 deletions(-)
>=20
> diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c =
b/arch/powerpc/platforms/85xx/p1022_ds.c
> index fda1571..e0280e2 100644
> --- a/arch/powerpc/platforms/85xx/p1022_ds.c
> +++ b/arch/powerpc/platforms/85xx/p1022_ds.c
> @@ -270,6 +270,54 @@ void __init p1022_ds_pic_init(void)
> void __init mpc85xx_smp_init(void);
> #endif
>=20
> +#if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
> +
> +/*
> + * Disables a node in the device tree.
> + *
> + * This function is called before kmalloc() is available, and it's =
only called
> + * once, so we instead of allocating the new property object via the =
bootmem
> + * allocator, we just create a static local variable.
> + */
> +static void __init disable_one_node(struct device_node *np)
> +{
> + struct property *old;
> + static struct property new =3D {
> + .name =3D "status",
> + .value =3D "disabled",
> + .length =3D sizeof("disabled"),
> + };
> +
> + old =3D of_find_property(np, new.name, NULL);
> + if (old)
> + prom_update_property(np, &new, old);
> + else
> + prom_add_property(np, &new);
> +}
> +
> +/* TRUE if there is a "video=3Dfslfb" command-line parameter. */
> +static bool fslfb;
> +
> +/*
> + * Search for a "video=3Dfslfb" command-line parameter, and set =
'fslfb' to
> + * true if we find it.
> + *
> + * We need to use early_param() instead of __setup() because the =
normal
> + * __setup() gets called to late. However, early_param() gets called =
very
> + * early, before the device tree is unflattened, so all we can do now =
is set a
> + * global variable. Later on, p1022_ds_setup_arch() will use that =
variable
> + * to determine if we need to update the device tree.
> + */
> +static int __init early_video_setup(char *options)
> +{
> + fslfb =3D (strncmp(options, "fslfb:", 6) =3D=3D 0);
> +
> + return 0;
> +}
> +early_param("video", early_video_setup);
> +
> +#endif
> +
> /*
> * Setup the architecture
> */
> @@ -307,6 +355,28 @@ static void __init p1022_ds_setup_arch(void)
> diu_ops.set_monitor_port =3D p1022ds_set_monitor_port;
> diu_ops.set_pixel_clock =3D p1022ds_set_pixel_clock;
> diu_ops.valid_monitor_port =3D p1022ds_valid_monitor_port;
> +
> + /*
> + * Delete the NOR flash node if there is video=3Dfslfb... =
command-line
> + * parameter. When the DIU is active, NOR flash is unavailable, =
so we
> + * have to delete the node before the MTD driver loads.
> + */
Fix comment, you aren't deleting the node, your marked it disabled.
> + if (fslfb) {
> + struct device_node *np =3D
> + of_find_compatible_node(NULL, NULL, =
"fsl,p1022-elbc");
> +
> + if (np) {
> + np =3D of_find_compatible_node(np, NULL, =
"cfi-flash");
> + if (np) {
> + pr_info("p1022ds: disabling %s node",
> + np->full_name);
> + disable_one_node(np);
> + of_node_put(np);
> + }
> + }
> +
> + }
> +
> #endif
>=20
> #ifdef CONFIG_SMP
> --=20
> 1.7.3.4
>=20
>=20
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
^ permalink raw reply [flat|nested] 6+ messages in thread