This makes keyboard/touchpad work on a DT MMP2 platform.
I believe that it would be a good idea if this, once reviewed, went in
via the input tree. The DT and CLK parts got reviews/acks.
Changes from v1:
- Basically none, just re-send, including Ack and Review tags in patches
that received them. Plus an extra Cc.
I'd be very thankful for reviews.
Lubi
This is the clock for the "security processor" core.
Reviewed-by: Rob Herring <[email protected]>
Acked-by: Stephen Boyd <[email protected]>
Signed-off-by: Lubomir Rintel <[email protected]>
---
include/dt-bindings/clock/marvell,mmp2.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/dt-bindings/clock/marvell,mmp2.h b/include/dt-bindings/clock/marvell,mmp2.h
index 228a5e234af0..7b24fc791146 100644
--- a/include/dt-bindings/clock/marvell,mmp2.h
+++ b/include/dt-bindings/clock/marvell,mmp2.h
@@ -71,6 +71,7 @@
#define MMP2_CLK_CCIC1_MIX 117
#define MMP2_CLK_CCIC1_PHY 118
#define MMP2_CLK_CCIC1_SPHY 119
+#define MMP2_CLK_SP 120
#define MMP2_NR_CLKS 200
#endif
--
2.19.0
Without the clock, the keyboard controller won't operate.
Tested on an OLPC XO 1.75.
Signed-off-by: Lubomir Rintel <[email protected]>
---
drivers/input/serio/olpc_apsp.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/input/serio/olpc_apsp.c b/drivers/input/serio/olpc_apsp.c
index 8b19a47dfa46..fe9e19014e70 100644
--- a/drivers/input/serio/olpc_apsp.c
+++ b/drivers/input/serio/olpc_apsp.c
@@ -23,6 +23,7 @@
#include <linux/of.h>
#include <linux/slab.h>
#include <linux/delay.h>
+#include <linux/clk.h>
/*
* The OLPC XO-1.75 and XO-4 laptops do not have a hardware PS/2 controller.
@@ -74,6 +75,7 @@ struct olpc_apsp {
struct serio *kbio;
struct serio *padio;
void __iomem *base;
+ struct clk *clk;
int open_count;
int irq;
};
@@ -146,8 +148,13 @@ static int olpc_apsp_open(struct serio *port)
struct olpc_apsp *priv = port->port_data;
unsigned int tmp;
unsigned long l;
+ int error;
if (priv->open_count++ == 0) {
+ error = clk_prepare_enable(priv->clk);
+ if (error)
+ return error;
+
l = readl(priv->base + COMMAND_FIFO_STATUS);
if (!(l & CMD_STS_MASK)) {
dev_err(priv->dev, "SP cannot accept commands.\n");
@@ -171,6 +178,8 @@ static void olpc_apsp_close(struct serio *port)
/* Disable interrupt 0 */
tmp = readl(priv->base + PJ_INTERRUPT_MASK);
writel(tmp | INT_0, priv->base + PJ_INTERRUPT_MASK);
+
+ clk_disable_unprepare(priv->clk);
}
}
@@ -198,6 +207,10 @@ static int olpc_apsp_probe(struct platform_device *pdev)
if (priv->irq < 0)
return priv->irq;
+ priv->clk = devm_clk_get(&pdev->dev, "sp");
+ if (IS_ERR(priv->clk))
+ return PTR_ERR(priv->clk);
+
/* KEYBOARD */
kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
if (!kb_serio)
--
2.19.0
The "security processor", sometimes referred to as "wireless trusted
module" or "generic encrypt unit" is a low-power core present on MMP2,
that has nothing to do with security, wireless, trust or encryption.
On an OLPC machine it runs CForth and serves as a keyboard controller:
http://dev.laptop.org/git/users/wmb/cforth/tree/src/app/arm-xo-1.75/ps2.fth
The register address was obtained from the OLPC kernel, since the
datasheet seems to be the Marvell's most important business secret.
Acked-by: Stephen Boyd <[email protected]>
Signed-off-by: Lubomir Rintel <[email protected]>
---
drivers/clk/mmp/clk-of-mmp2.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/clk/mmp/clk-of-mmp2.c b/drivers/clk/mmp/clk-of-mmp2.c
index 0fc75c395957..1da50f827a15 100644
--- a/drivers/clk/mmp/clk-of-mmp2.c
+++ b/drivers/clk/mmp/clk-of-mmp2.c
@@ -53,6 +53,7 @@
#define APMU_DISP1 0x110
#define APMU_CCIC0 0x50
#define APMU_CCIC1 0xf4
+#define APMU_SP 0x68
#define MPMU_UART_PLL 0x14
struct mmp2_clk_unit {
@@ -209,6 +210,8 @@ static struct mmp_clk_mix_config ccic1_mix_config = {
.reg_info = DEFINE_MIX_REG_INFO(4, 16, 2, 6, 32),
};
+static DEFINE_SPINLOCK(sp_lock);
+
static struct mmp_param_mux_clk apmu_mux_clks[] = {
{MMP2_CLK_DISP0_MUX, "disp0_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP0, 6, 2, 0, &disp0_lock},
{MMP2_CLK_DISP1_MUX, "disp1_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP1, 6, 2, 0, &disp1_lock},
@@ -239,6 +242,7 @@ static struct mmp_param_gate_clk apmu_gate_clks[] = {
{MMP2_CLK_CCIC1, "ccic1_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x1b, 0x1b, 0x0, 0, &ccic1_lock},
{MMP2_CLK_CCIC1_PHY, "ccic1_phy_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x24, 0x24, 0x0, 0, &ccic1_lock},
{MMP2_CLK_CCIC1_SPHY, "ccic1_sphy_clk", "ccic1_sphy_div", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x300, 0x300, 0x0, 0, &ccic1_lock},
+ {MMP2_CLK_SP, "sp_clk", NULL, CLK_SET_RATE_PARENT, APMU_SP, 0x1b, 0x1b, 0x0, 0, &sp_lock},
};
static void mmp2_axi_periph_clk_init(struct mmp2_clk_unit *pxa_unit)
--
2.19.0
This is a device-tree enabled driver. Moreover CONFIG_OLPC is specific
to the x86 platform code, while the driver is for an ARM-based laptop.
Signed-off-by: Lubomir Rintel <[email protected]>
---
drivers/input/serio/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig
index d90d9f1098ff..a4f70021b53e 100644
--- a/drivers/input/serio/Kconfig
+++ b/drivers/input/serio/Kconfig
@@ -254,7 +254,7 @@ config SERIO_APBPS2
config SERIO_OLPC_APSP
tristate "OLPC AP-SP input support"
- depends on OLPC || COMPILE_TEST
+ depends on OF
help
Say Y here if you want support for the keyboard and touchpad included
in the OLPC XO-1.75 and XO-4 laptops.
--
2.19.0
Let's defer the FIFO status checking until open().
When we'll get a clk handle, this will allow us to defer clock enablement
until the device is actually used.
Signed-off-by: Lubomir Rintel <[email protected]>
---
drivers/input/serio/olpc_apsp.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/input/serio/olpc_apsp.c b/drivers/input/serio/olpc_apsp.c
index 8e9a4209fcad..8b19a47dfa46 100644
--- a/drivers/input/serio/olpc_apsp.c
+++ b/drivers/input/serio/olpc_apsp.c
@@ -145,8 +145,15 @@ static int olpc_apsp_open(struct serio *port)
{
struct olpc_apsp *priv = port->port_data;
unsigned int tmp;
+ unsigned long l;
if (priv->open_count++ == 0) {
+ l = readl(priv->base + COMMAND_FIFO_STATUS);
+ if (!(l & CMD_STS_MASK)) {
+ dev_err(priv->dev, "SP cannot accept commands.\n");
+ return -EIO;
+ }
+
/* Enable interrupt 0 by clearing its bit */
tmp = readl(priv->base + PJ_INTERRUPT_MASK);
writel(tmp & ~INT_0, priv->base + PJ_INTERRUPT_MASK);
@@ -173,7 +180,6 @@ static int olpc_apsp_probe(struct platform_device *pdev)
struct olpc_apsp *priv;
struct resource *res;
struct device_node *np;
- unsigned long l;
int error;
priv = devm_kzalloc(&pdev->dev, sizeof(struct olpc_apsp), GFP_KERNEL);
@@ -192,12 +198,6 @@ static int olpc_apsp_probe(struct platform_device *pdev)
if (priv->irq < 0)
return priv->irq;
- l = readl(priv->base + COMMAND_FIFO_STATUS);
- if (!(l & CMD_STS_MASK)) {
- dev_err(&pdev->dev, "SP cannot accept commands.\n");
- return -EIO;
- }
-
/* KEYBOARD */
kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
if (!kb_serio)
--
2.19.0
Take the GPIO lines are used by the SP. The driver doesn't touch the
lines -- this is done to disallow anything else from fiddling with
them because that would confuse the SP firmware.
Also, the lines are now nicely visible in /sys/kernel/debug/gpio.
Signed-off-by: Lubomir Rintel <[email protected]>
---
drivers/input/serio/olpc_apsp.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/input/serio/olpc_apsp.c b/drivers/input/serio/olpc_apsp.c
index fe9e19014e70..287759c5f36d 100644
--- a/drivers/input/serio/olpc_apsp.c
+++ b/drivers/input/serio/olpc_apsp.c
@@ -24,6 +24,7 @@
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/clk.h>
+#include <linux/gpio/consumer.h>
/*
* The OLPC XO-1.75 and XO-4 laptops do not have a hardware PS/2 controller.
@@ -76,6 +77,8 @@ struct olpc_apsp {
struct serio *padio;
void __iomem *base;
struct clk *clk;
+ struct gpio_desc *clk_gpio;
+ struct gpio_desc *data_gpio;
int open_count;
int irq;
};
@@ -211,6 +214,16 @@ static int olpc_apsp_probe(struct platform_device *pdev)
if (IS_ERR(priv->clk))
return PTR_ERR(priv->clk);
+ priv->clk_gpio = devm_gpiod_get_optional(&pdev->dev, "clk",
+ GPIOD_ASIS);
+ if (IS_ERR(priv->clk_gpio))
+ return PTR_ERR(priv->clk_gpio);
+
+ priv->data_gpio = devm_gpiod_get_optional(&pdev->dev, "data",
+ GPIOD_ASIS);
+ if (IS_ERR(priv->data_gpio))
+ return PTR_ERR(priv->data_gpio);
+
/* KEYBOARD */
kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
if (!kb_serio)
--
2.19.0
Add properties describing the GPIO lines used by the keyboard controller.
The olpc-apsp driver will do happily without them, but they are still part
of the hardware description. The driver could still reserve the lines,
so that nothing else touches them.
This makes the device node almost compatible with "ps2-gpio". I'm not
adding a compatible property, because ps2-gpio would use a different
interrupt, so that we'd need to name it. And I haven't actually tried it.
Reviewed-by: Rob Herring <[email protected]>
Signed-off-by: Lubomir Rintel <[email protected]>
---
Documentation/devicetree/bindings/serio/olpc,ap-sp.txt | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Documentation/devicetree/bindings/serio/olpc,ap-sp.txt b/Documentation/devicetree/bindings/serio/olpc,ap-sp.txt
index 36603419d6f8..2b1b1dbb54c1 100644
--- a/Documentation/devicetree/bindings/serio/olpc,ap-sp.txt
+++ b/Documentation/devicetree/bindings/serio/olpc,ap-sp.txt
@@ -7,6 +7,10 @@ Required properties:
- clocks : phandle + clock-specifier for the clock that drives the WTM
- clock-names: should be "sp"
+Optional properties:
+- data-gpios : GPIO line used for PS/2 interface data
+- clk-gpios : GPIO line used for PS/2 interface clock
+
Example:
ap-sp@d4290000 {
compatible = "olpc,ap-sp";
@@ -14,4 +18,6 @@ Example:
interrupts = <40>;
clocks = <&soc_clocks MMP2_CLK_SP>;
clock-names = "sp";
+ data-gpios = <&gpio 72 GPIO_ACTIVE_HIGH>;
+ clk-gpios = <&gpio 71 GPIO_ACTIVE_HIGH>;
}
--
2.19.0
The clock is necessary for the device operation, hence it's required.
Its name, "sp", stands for "Security Processor". It is one of several
names that are used for the processor that serves as the keyboard
controller on an OLPC and is consistent with the node name.
Reviewed-by: Rob Herring <[email protected]>
Signed-off-by: Lubomir Rintel <[email protected]>
---
Documentation/devicetree/bindings/serio/olpc,ap-sp.txt | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Documentation/devicetree/bindings/serio/olpc,ap-sp.txt b/Documentation/devicetree/bindings/serio/olpc,ap-sp.txt
index 0e72183f52bc..36603419d6f8 100644
--- a/Documentation/devicetree/bindings/serio/olpc,ap-sp.txt
+++ b/Documentation/devicetree/bindings/serio/olpc,ap-sp.txt
@@ -4,10 +4,14 @@ Required properties:
- compatible : "olpc,ap-sp"
- reg : base address and length of SoC's WTM registers
- interrupts : SP-AP interrupt
+- clocks : phandle + clock-specifier for the clock that drives the WTM
+- clock-names: should be "sp"
Example:
ap-sp@d4290000 {
compatible = "olpc,ap-sp";
reg = <0xd4290000 0x1000>;
interrupts = <40>;
+ clocks = <&soc_clocks MMP2_CLK_SP>;
+ clock-names = "sp";
}
--
2.19.0
On Wed, Oct 10, 2018 at 04:25:03PM +0200, Lubomir Rintel wrote:
> Without the clock, the keyboard controller won't operate.
> Tested on an OLPC XO 1.75.
>
> Signed-off-by: Lubomir Rintel <[email protected]>
> ---
> drivers/input/serio/olpc_apsp.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/drivers/input/serio/olpc_apsp.c b/drivers/input/serio/olpc_apsp.c
> index 8b19a47dfa46..fe9e19014e70 100644
> --- a/drivers/input/serio/olpc_apsp.c
> +++ b/drivers/input/serio/olpc_apsp.c
> @@ -23,6 +23,7 @@
> #include <linux/of.h>
> #include <linux/slab.h>
> #include <linux/delay.h>
> +#include <linux/clk.h>
>
> /*
> * The OLPC XO-1.75 and XO-4 laptops do not have a hardware PS/2 controller.
> @@ -74,6 +75,7 @@ struct olpc_apsp {
> struct serio *kbio;
> struct serio *padio;
> void __iomem *base;
> + struct clk *clk;
> int open_count;
> int irq;
> };
> @@ -146,8 +148,13 @@ static int olpc_apsp_open(struct serio *port)
> struct olpc_apsp *priv = port->port_data;
> unsigned int tmp;
> unsigned long l;
> + int error;
>
> if (priv->open_count++ == 0) {
> + error = clk_prepare_enable(priv->clk);
> + if (error)
> + return error;
> +
> l = readl(priv->base + COMMAND_FIFO_STATUS);
> if (!(l & CMD_STS_MASK)) {
> dev_err(priv->dev, "SP cannot accept commands.\n");
I think you need to disable clock here.
> @@ -171,6 +178,8 @@ static void olpc_apsp_close(struct serio *port)
> /* Disable interrupt 0 */
> tmp = readl(priv->base + PJ_INTERRUPT_MASK);
> writel(tmp | INT_0, priv->base + PJ_INTERRUPT_MASK);
> +
> + clk_disable_unprepare(priv->clk);
> }
> }
>
> @@ -198,6 +207,10 @@ static int olpc_apsp_probe(struct platform_device *pdev)
> if (priv->irq < 0)
> return priv->irq;
>
> + priv->clk = devm_clk_get(&pdev->dev, "sp");
> + if (IS_ERR(priv->clk))
> + return PTR_ERR(priv->clk);
> +
> /* KEYBOARD */
> kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
> if (!kb_serio)
> --
> 2.19.0
>
--
Dmitry
On Wed, Oct 10, 2018 at 04:25:04PM +0200, Lubomir Rintel wrote:
> Take the GPIO lines are used by the SP. The driver doesn't touch the
> lines -- this is done to disallow anything else from fiddling with
> them because that would confuse the SP firmware.
>
> Also, the lines are now nicely visible in /sys/kernel/debug/gpio.
Linus, is this something that should be handled by GPIO "hogs"?
>
> Signed-off-by: Lubomir Rintel <[email protected]>
> ---
> drivers/input/serio/olpc_apsp.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/drivers/input/serio/olpc_apsp.c b/drivers/input/serio/olpc_apsp.c
> index fe9e19014e70..287759c5f36d 100644
> --- a/drivers/input/serio/olpc_apsp.c
> +++ b/drivers/input/serio/olpc_apsp.c
> @@ -24,6 +24,7 @@
> #include <linux/slab.h>
> #include <linux/delay.h>
> #include <linux/clk.h>
> +#include <linux/gpio/consumer.h>
>
> /*
> * The OLPC XO-1.75 and XO-4 laptops do not have a hardware PS/2 controller.
> @@ -76,6 +77,8 @@ struct olpc_apsp {
> struct serio *padio;
> void __iomem *base;
> struct clk *clk;
> + struct gpio_desc *clk_gpio;
> + struct gpio_desc *data_gpio;
> int open_count;
> int irq;
> };
> @@ -211,6 +214,16 @@ static int olpc_apsp_probe(struct platform_device *pdev)
> if (IS_ERR(priv->clk))
> return PTR_ERR(priv->clk);
>
> + priv->clk_gpio = devm_gpiod_get_optional(&pdev->dev, "clk",
> + GPIOD_ASIS);
> + if (IS_ERR(priv->clk_gpio))
> + return PTR_ERR(priv->clk_gpio);
> +
> + priv->data_gpio = devm_gpiod_get_optional(&pdev->dev, "data",
> + GPIOD_ASIS);
> + if (IS_ERR(priv->data_gpio))
> + return PTR_ERR(priv->data_gpio);
> +
> /* KEYBOARD */
> kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
> if (!kb_serio)
> --
> 2.19.0
>
--
Dmitry
On Wed, Oct 10, 2018 at 10:10:13AM -0700, Dmitry Torokhov wrote:
> On Wed, Oct 10, 2018 at 04:25:04PM +0200, Lubomir Rintel wrote:
> > Take the GPIO lines are used by the SP. The driver doesn't touch the
> > lines -- this is done to disallow anything else from fiddling with
> > them because that would confuse the SP firmware.
> >
> > Also, the lines are now nicely visible in /sys/kernel/debug/gpio.
>
> Linus, is this something that should be handled by GPIO "hogs"?
Argh, meant to add Linus Walleij here.
>
> >
> > Signed-off-by: Lubomir Rintel <[email protected]>
> > ---
> > drivers/input/serio/olpc_apsp.c | 13 +++++++++++++
> > 1 file changed, 13 insertions(+)
> >
> > diff --git a/drivers/input/serio/olpc_apsp.c b/drivers/input/serio/olpc_apsp.c
> > index fe9e19014e70..287759c5f36d 100644
> > --- a/drivers/input/serio/olpc_apsp.c
> > +++ b/drivers/input/serio/olpc_apsp.c
> > @@ -24,6 +24,7 @@
> > #include <linux/slab.h>
> > #include <linux/delay.h>
> > #include <linux/clk.h>
> > +#include <linux/gpio/consumer.h>
> >
> > /*
> > * The OLPC XO-1.75 and XO-4 laptops do not have a hardware PS/2 controller.
> > @@ -76,6 +77,8 @@ struct olpc_apsp {
> > struct serio *padio;
> > void __iomem *base;
> > struct clk *clk;
> > + struct gpio_desc *clk_gpio;
> > + struct gpio_desc *data_gpio;
> > int open_count;
> > int irq;
> > };
> > @@ -211,6 +214,16 @@ static int olpc_apsp_probe(struct platform_device *pdev)
> > if (IS_ERR(priv->clk))
> > return PTR_ERR(priv->clk);
> >
> > + priv->clk_gpio = devm_gpiod_get_optional(&pdev->dev, "clk",
> > + GPIOD_ASIS);
> > + if (IS_ERR(priv->clk_gpio))
> > + return PTR_ERR(priv->clk_gpio);
> > +
> > + priv->data_gpio = devm_gpiod_get_optional(&pdev->dev, "data",
> > + GPIOD_ASIS);
> > + if (IS_ERR(priv->data_gpio))
> > + return PTR_ERR(priv->data_gpio);
> > +
> > /* KEYBOARD */
> > kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
> > if (!kb_serio)
> > --
> > 2.19.0
> >
>
> --
> Dmitry
--
Dmitry
On Wed, Oct 10, 2018 at 04:25:01PM +0200, Lubomir Rintel wrote:
> This is a device-tree enabled driver. Moreover CONFIG_OLPC is specific
> to the x86 platform code, while the driver is for an ARM-based laptop.
>
> Signed-off-by: Lubomir Rintel <[email protected]>
> ---
> drivers/input/serio/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig
> index d90d9f1098ff..a4f70021b53e 100644
> --- a/drivers/input/serio/Kconfig
> +++ b/drivers/input/serio/Kconfig
> @@ -254,7 +254,7 @@ config SERIO_APBPS2
>
> config SERIO_OLPC_APSP
> tristate "OLPC AP-SP input support"
> - depends on OLPC || COMPILE_TEST
> + depends on OF
I do not see anything in the driver that depends on OF. If OLPC is not
right dependency, then let's drop the whole depends.
Are you going to be submitting DTS files for the platform?
Thanks.
--
Dmitry
Hi Lubomir,
thanks for your patch!
On Wed, Oct 10, 2018 at 4:26 PM Lubomir Rintel <[email protected]> wrote:
> Take the GPIO lines are used by the SP. The driver doesn't touch the
> lines -- this is done to disallow anything else from fiddling with
> them because that would confuse the SP firmware.
>
> Also, the lines are now nicely visible in /sys/kernel/debug/gpio.
>
> Signed-off-by: Lubomir Rintel <[email protected]>
Sadly I do not think this is the right way to do this these days.
In the past I would have agreed.
A few months back, Qualcomm engineers working on ACPI
support ran into similar issues: there were GPIO lines that
could not be touched by the kernel because they were used
by firmware (BIOS).
The solution we devised can be seen in
commit 726cb3ba49692bdae6caff457755e7cdb432efa4
"gpiolib: Support 'gpio-reserved-ranges' property"
which adds a "valid mask" to struct gpio_chip.
It is further refined in the lates working kernel code to make
it easy for users to set up a custom valid_mask.
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git/commit/?h=devel&id=f8ec92a9f63b3b11e399409141b7868bb405e6b5
So what you should do is modify the platform set-up for
the OLPC to mask off these GPIO lines as invalid since
they are used by the firmware and Linux should not touch
them.
Sadly I don't know which GPIO driver the XO1 is using,
but if you tell us I bet me or Andy will be able to help you
out in finding the right spot to patch.
Yours,
Linus Walleij
Hi!
> This makes keyboard/touchpad work on a DT MMP2 platform.
>
> I believe that it would be a good idea if this, once reviewed, went in
> via the input tree. The DT and CLK parts got reviews/acks.
>
> Changes from v1:
> - Basically none, just re-send, including Ack and Review tags in patches
> that received them. Plus an extra Cc.
> I'd be very thankful for reviews.
Ok, I believe I have OLPC 1.75, and it is actually a nice
machine. Can I get recent kernel working there in useful fashion? (Is
there docs somewhere)?
Thanks,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hello Pavel,
On Mon, 2018-10-15 at 21:56 +0200, Pavel Machek wrote:
> Hi!
>
> > This makes keyboard/touchpad work on a DT MMP2 platform.
> >
> > I believe that it would be a good idea if this, once reviewed, went
> > in
> > via the input tree. The DT and CLK parts got reviews/acks.
> >
> > Changes from v1:
> > - Basically none, just re-send, including Ack and Review tags in
> > patches
> > that received them. Plus an extra Cc.
> > I'd be very thankful for reviews.
>
> Ok, I believe I have OLPC 1.75, and it is actually a nice
> machine. Can I get recent kernel working there in useful fashion? (Is
> there docs somewhere)?
A lovely machine indeed. I've written this now:
https://github.com/hackerspace/olpc-xo175-linux/wiki/How-to-run-an-up-to-date-Linux-on-a-XO-1.75
I didn't test it yet -- will do when I get home in the evening. But
chances are it's good enough and I guess you'd be able to get it
working even if I messed up some details.
Please let me know if it works for you -- I'm having trouble getting
reviews/acks/tested-bys for the XO-1.75 patch sets [1] and will be
super thankful if I get some feedback from you.
[1] https://lore.kernel.org/patchwork/bundle/lkundrak/OLPC%20XO%201.75/
>
> Thanks,
>
> Pavel
Cheers,
Lubo
Hi!
> > > This makes keyboard/touchpad work on a DT MMP2 platform.
> > >
> > > I believe that it would be a good idea if this, once reviewed, went
> > > in
> > > via the input tree. The DT and CLK parts got reviews/acks.
> > >
> > > Changes from v1:
> > > - Basically none, just re-send, including Ack and Review tags in
> > > patches
> > > that received them. Plus an extra Cc.
> > > I'd be very thankful for reviews.
> >
> > Ok, I believe I have OLPC 1.75, and it is actually a nice
> > machine. Can I get recent kernel working there in useful fashion? (Is
> > there docs somewhere)?
>
> A lovely machine indeed. I've written this now:
>
> https://github.com/hackerspace/olpc-xo175-linux/wiki/How-to-run-an-up-to-date-Linux-on-a-XO-1.75
>
> I didn't test it yet -- will do when I get home in the evening. But
> chances are it's good enough and I guess you'd be able to get it
> working even if I messed up some details.
Ok, let me check. I went to this branch:
commit f99b274084d320814f4b035a7e3455af424229ea
Author: Lubomir Rintel <[email protected]>
Date: Sun Aug 5 23:11:27 2018 +0200
First comment: the zImage size adjusting hack should really be
somewhere in tools/ and preferably in python. This is way beyond
reasonable use of shell.
> Please let me know if it works for you -- I'm having trouble getting
> reviews/acks/tested-bys for the XO-1.75 patch sets [1] and will be
> super thankful if I get some feedback from you.
>
> [1] https://lore.kernel.org/patchwork/bundle/lkundrak/OLPC%20XO%201.75/
You want to just continue without them :-). As long as you don't
change the core code, you should be ok.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi!
> > https://github.com/hackerspace/olpc-xo175-linux/wiki/How-to-run-an-up-to-date-Linux-on-a-XO-1.75
> >
> > I didn't test it yet -- will do when I get home in the evening. But
> > chances are it's good enough and I guess you'd be able to get it
> > working even if I messed up some details.
Instruction say make, but you really need to do make zImage and make
mmp2-olpc-xo-1-75.dtb .
Instructions say "make -j", which is nice way to crash a machine. I
suggest "make -j 8" :-).
Ok, I think I followed the instructions. I am using empty root
filesystem, just with /boot -- want to see kernel messages first
before I mess with the userland.
But I don't get kernel messages during boot:
OLPC 1B1, 512 MiB memory...
OpenFirmware Q4C02 EC Frimware 0.3.02
Type any key to interrupt...
(but keys do not interrupt anything, ouch).
Warning... partition type is 0xb...
Boot device: /usb/disk:\boot\olpc.fth Arguments:
Boot device ....
Warning... partition type is 0xb...
And that's it, cursor and no kernel messages.
Any ideas?
Could I get prepared binary zImage for testing?
Thanks,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hello Pavel,
On Tue, 2018-10-30 at 11:26 +0100, Pavel Machek wrote:
> Hi!
>
> > > https://github.com/hackerspace/olpc-xo175-linux/wiki/How-to-run-an-up-to-date-Linux-on-a-XO-1.75
> > >
> > > I didn't test it yet -- will do when I get home in the evening.
> > > But
> > > chances are it's good enough and I guess you'd be able to get it
> > > working even if I messed up some details.
>
> Instruction say make, but you really need to do make zImage and make
> mmp2-olpc-xo-1-75.dtb .
Have you tried? I'm typically doing just a plain "make".
According to "make help", a plain "make" (assuming it's equivalent to
"make all") includes "zImage" and "dtbs" targets.
>
> Instructions say "make -j", which is nice way to crash a machine. I
> suggest "make -j 8" :-).
Holy... what sort of a machine do you have?
> Ok, I think I followed the instructions. I am using empty root
> filesystem, just with /boot -- want to see kernel messages first
> before I mess with the userland.
>
> But I don't get kernel messages during boot:
>
> OLPC 1B1, 512 MiB memory...
> OpenFirmware Q4C02 EC Frimware 0.3.02
"Frimware" -- I assume you don't have a serial console hooked on? :)
Doesn't matter though, your OF doesn't seem to even get to load the
kernel anyways. And the framebuffer console (though only by the means
of a hacked pxa168fb for the time being, no armada drm yet) works.
Here's my bootup banner:
OLPC 1B1, 800 MHz, 512 MiB memory, 4 GB internal storage...
OpenFirmware Q4D38 EC Firmware 1.0.01 2018-10-30 19:11:36 UTC
I seem to have a bit newer OF.
> Type any key to interrupt...
> (but keys do not interrupt anything, ouch).
In my version of the OLPC OF the routine is replaced with one that only
accepts the Escape key, because kids like to press random keys without
really wanting a shell. Maybe try that one?
Although my prompt is also a bit different: "Type the Esc key to
interrupt automatic startup"
> Warning... partition type is 0xb...
> Boot device: /usb/disk:\boot\olpc.fth Arguments:
> Boot device ....
> Warning... partition type is 0xb...
Maybe the older version wouldn't support a VFAT volume, hence the
complains about the id=0xb volume? Try ext3?
>
> And that's it, cursor and no kernel messages.
>
> Any ideas?
>
> Could I get prepared binary zImage for testing?
https://github.com/hackerspace/olpc-xo175-buildroot/releases
Here's a SD card image that works for me. The topmost commit in the
same repository is the build configuration that was used to generate
it:
https://github.com/hackerspace/olpc-xo175-buildroot/commit/71783d599.patch
Note it is only going to boot off the SD card, because the root=
argument is hardwired in the devicetree. Sorry about that -- I built
the image before I noticed you're booting off an USB stick and I don't
have the resources to regenerate the image at the moment.
If this won't boot for you, we may need fixes for older FW. Until then
it might be a good idea if you just update to the latest one (it is as
easy as booting the last version of the stock distro with a charged
battery pack).
> Thanks.
>
>
> Pavel
Take care
Lubo
G'day Pavel,
On Tue, Oct 30, 2018 at 11:26:10AM +0100, Pavel Machek wrote:
> Hi!
>
> > > https://github.com/hackerspace/olpc-xo175-linux/wiki/How-to-run-an-up-to-date-Linux-on-a-XO-1.75
> > >
> > > I didn't test it yet -- will do when I get home in the evening. But
> > > chances are it's good enough and I guess you'd be able to get it
> > > working even if I messed up some details.
>
> Instruction say make, but you really need to do make zImage and make
> mmp2-olpc-xo-1-75.dtb .
>
> Instructions say "make -j", which is nice way to crash a machine. I
> suggest "make -j 8" :-).
>
> Ok, I think I followed the instructions. I am using empty root
> filesystem, just with /boot -- want to see kernel messages first
> before I mess with the userland.
>
> But I don't get kernel messages during boot:
>
> OLPC 1B1, 512 MiB memory...
> OpenFirmware Q4C02 EC Frimware 0.3.02
>
> Type any key to interrupt...
> (but keys do not interrupt anything, ouch).
> Warning... partition type is 0xb...
> Boot device: /usb/disk:\boot\olpc.fth Arguments:
> Boot device ....
> Warning... partition type is 0xb...
That firmware has problems with USB drives. Please upgrade to Q4D38.
Quickest tested method is http://wiki.laptop.org/go/Upgrading_firmware
I'm firmware releaser and signer.
> And that's it, cursor and no kernel messages.
>
> Any ideas?
>
> Could I get prepared binary zImage for testing?
>
> Thanks,
> Pavel
> --
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
James Cameron
http://quozl.netrek.org/
G'day,
Success, see below.
On Tue, Oct 30, 2018 at 08:40:38PM +0100, Lubomir Rintel wrote:
> Hello Pavel,
>
> On Tue, 2018-10-30 at 11:26 +0100, Pavel Machek wrote:
> > Hi!
> >
> > > > https://github.com/hackerspace/olpc-xo175-linux/wiki/How-to-run-an-up-to-date-Linux-on-a-XO-1.75
> > > >
> > > > I didn't test it yet -- will do when I get home in the evening.
> > > > But
> > > > chances are it's good enough and I guess you'd be able to get it
> > > > working even if I messed up some details.
> >
> > [...]
> > Could I get prepared binary zImage for testing?
>
> https://github.com/hackerspace/olpc-xo175-buildroot/releases
>
> Here's a SD card image that works for me. The topmost commit in the
> same repository is the build configuration that was used to generate
> it:
>
> https://github.com/hackerspace/olpc-xo175-buildroot/commit/71783d599.patch
>
> Note it is only going to boot off the SD card, because the root=
> argument is hardwired in the devicetree. Sorry about that -- I built
> the image before I noticed you're booting off an USB stick and I don't
> have the resources to regenerate the image at the moment.
Your image does boot for me - after changing features on
filesystem.
http://dev.laptop.org/~quozl/y/1gHh5m.txt (dmesg)
dumpe2fs of your image filesystem features; has_journal ext_attr
resize_inode dir_index filetype flex_bg sparse_super large_file
huge_file dir_nlink extra_isize metadata_csum, and flags;
signed_directory_hash.
dumpe2fs of my image filesystem features; has_journal ext_attr
resize_inode dir_index filetype extent flex_bg sparse_super uninit_bg
dir_nlink extra_isize, and flags; unsigned_directory_hash.
Our OLPC OS builder uses "mkfs.ext4 -O dir_index,^huge_file", from
e2fsprogs 1.42.5.
I'll look at the microSD card errors; by trying another one.
Fantastic progress though, thanks! Wish I were a full time kernel
developer, but so much else to do now.
> If this won't boot for you, we may need fixes for older FW.
Let me know what you need there; with a patch, and if it isn't too
extensive I could spin a new build. We're not producing these models,
so I don't _have_ to keep the factory test code working.
https://github.com/quozl/openfirmware
--
James Cameron
http://quozl.netrek.org/
Hi!
> > > > https://github.com/hackerspace/olpc-xo175-linux/wiki/How-to-run-an-up-to-date-Linux-on-a-XO-1.75
> > > >
> > > > I didn't test it yet -- will do when I get home in the evening.
> > > > But
> > > > chances are it's good enough and I guess you'd be able to get it
> > > > working even if I messed up some details.
> >
> > Instruction say make, but you really need to do make zImage and make
> > mmp2-olpc-xo-1-75.dtb .
>
> Have you tried? I'm typically doing just a plain "make".
>
> According to "make help", a plain "make" (assuming it's equivalent to
> "make all") includes "zImage" and "dtbs" targets.
I believe I did, but not 100% sure.
> > Instructions say "make -j", which is nice way to crash a machine. I
> > suggest "make -j 8" :-).
>
> Holy... what sort of a machine do you have?
Thinkpad X220. Is it too big or too small? :-). 4 threads, so I
usually use -j 5, but -j 8 should be for my notebook and also bigger
servers.
> > Ok, I think I followed the instructions. I am using empty root
> > filesystem, just with /boot -- want to see kernel messages first
> > before I mess with the userland.
> >
> > But I don't get kernel messages during boot:
> >
> > OLPC 1B1, 512 MiB memory...
> > OpenFirmware Q4C02 EC Frimware 0.3.02
>
> "Frimware" -- I assume you don't have a serial console hooked on? :)
Not :-(. Altrough.. maybe I do have that cable somewhere, I just never
used it.
> > Type any key to interrupt...
> > (but keys do not interrupt anything, ouch).
>
> In my version of the OLPC OF the routine is replaced with one that only
> accepts the Escape key, because kids like to press random keys without
> really wanting a shell. Maybe try that one?
Ok, will try.
> > And that's it, cursor and no kernel messages.
> >
> > Any ideas?
> >
> > Could I get prepared binary zImage for testing?
>
> https://github.com/hackerspace/olpc-xo175-buildroot/releases
>
> Here's a SD card image that works for me. The topmost commit in the
> same repository is the build configuration that was used to generate
> it:
Kernel works for me with this one. (First boot userland boots, then
blinking cursor; next boot filesystem is corrupted. Hmm.) Feel free to
add "Tested-by:" to patches this uses.
> Note it is only going to boot off the SD card, because the root=
> argument is hardwired in the devicetree. Sorry about that -- I built
> the image before I noticed you're booting off an USB stick and I don't
> have the resources to regenerate the image at the moment.
No problem, I have SD cards here, too.
> If this won't boot for you, we may need fixes for older FW. Until then
> it might be a good idea if you just update to the latest one (it is as
> easy as booting the last version of the stock distro with a charged
> battery pack).
I'd need more instructions for firmware update. Or maybe ... lets
ignore that. SD card is fine, and I don't want to brick it.
I already broken it enough that keys need to be held during boot (or
it does not boot).
Best regards,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi!
> > But I don't get kernel messages during boot:
> >
> > OLPC 1B1, 512 MiB memory...
> > OpenFirmware Q4C02 EC Frimware 0.3.02
> >
> > Type any key to interrupt...
> > (but keys do not interrupt anything, ouch).
> > Warning... partition type is 0xb...
> > Boot device: /usb/disk:\boot\olpc.fth Arguments:
> > Boot device ....
> > Warning... partition type is 0xb...
>
> That firmware has problems with USB drives. Please upgrade to Q4D38.
> Quickest tested method is http://wiki.laptop.org/go/Upgrading_firmware
Let me try that... Upgrading firmware said "USB drive" so I placed
bootfw.zip on usb drive. It did quite a show, but I believe it said
that my firmware is up to date?
It all ended with "activation lease not found" message. Let me retry?
Same result.
Let me try "upgrading firmware" with SD card. It seems to work with SD
card. Holding down both "yes" and "no" keys during boot results in
more useful messages... good. I have now updated firmware, and it even
fixed my previous boot problem. Good.
Thanks!
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi!
> > https://github.com/hackerspace/olpc-xo175-buildroot/releases
> >
> > Here's a SD card image that works for me. The topmost commit in the
> > same repository is the build configuration that was used to generate
> > it:
> >
> > https://github.com/hackerspace/olpc-xo175-buildroot/commit/71783d599.patch
> >
> > Note it is only going to boot off the SD card, because the root=
> > argument is hardwired in the devicetree. Sorry about that -- I built
> > the image before I noticed you're booting off an USB stick and I don't
> > have the resources to regenerate the image at the moment.
>
> Your image does boot for me - after changing features on
> filesystem.
>
> http://dev.laptop.org/~quozl/y/1gHh5m.txt (dmesg)
>
> dumpe2fs of your image filesystem features; has_journal ext_attr
> resize_inode dir_index filetype flex_bg sparse_super large_file
> huge_file dir_nlink extra_isize metadata_csum, and flags;
> signed_directory_hash.
>
> dumpe2fs of my image filesystem features; has_journal ext_attr
> resize_inode dir_index filetype extent flex_bg sparse_super uninit_bg
> dir_nlink extra_isize, and flags; unsigned_directory_hash.
>
> Our OLPC OS builder uses "mkfs.ext4 -O dir_index,^huge_file", from
> e2fsprogs 1.42.5.
>
> I'll look at the microSD card errors; by trying another one.
Success, too... after re-doing the filesystem with local mkfs.
One thing I noticed: olpc-battery/voltage_max_design is lower than
voltage normally reported by voltage_now.
I'll play with it some more
Best regards,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Hi!
> > > > https://github.com/hackerspace/olpc-xo175-linux/wiki/How-to-run-an-up-to-date-Linux-on-a-XO-1.75
> > > >
Huh. You see that crazy sed magic script?
sed "s/^\(0*20: .... .... .... .... .... ....\) $BEFORE/\1 $AFTER/" |
Do this with the regular expression. My xxd actually has different
number of leading zeros, and so fails...
And with that fixed, I have self-compiled kernel that actually
boots. Yuppie!
Thanks!
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
On Wed 2018-10-10 16:24:57, Lubomir Rintel wrote:
> The clock is necessary for the device operation, hence it's required.
> Its name, "sp", stands for "Security Processor". It is one of several
> names that are used for the processor that serves as the keyboard
> controller on an OLPC and is consistent with the node name.
>
> Reviewed-by: Rob Herring <[email protected]>
> Signed-off-by: Lubomir Rintel <[email protected]>
Acked-by: Pavel Machek <[email protected]>
One thing that surprise me... Rob maintains these files, so he should
apply it?
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
On Wed 2018-10-10 16:25:01, Lubomir Rintel wrote:
> This is a device-tree enabled driver. Moreover CONFIG_OLPC is specific
> to the x86 platform code, while the driver is for an ARM-based laptop.
>
> Signed-off-by: Lubomir Rintel <[email protected]>
> ---
> drivers/input/serio/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig
> index d90d9f1098ff..a4f70021b53e 100644
> --- a/drivers/input/serio/Kconfig
> +++ b/drivers/input/serio/Kconfig
> @@ -254,7 +254,7 @@ config SERIO_APBPS2
>
> config SERIO_OLPC_APSP
> tristate "OLPC AP-SP input support"
> - depends on OLPC || COMPILE_TEST
> + depends on OF
I'd keep "|| COMPILE_TEST".
Otherwise
Acked-by: Pavel Machek <[email protected]>
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
On Wed 2018-10-10 16:24:59, Lubomir Rintel wrote:
> This is the clock for the "security processor" core.
>
> Reviewed-by: Rob Herring <[email protected]>
> Acked-by: Stephen Boyd <[email protected]>
> Signed-off-by: Lubomir Rintel <[email protected]>
Acked-by: Pavel Machek <[email protected]>
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
On Wed 2018-10-10 16:25:00, Lubomir Rintel wrote:
> The "security processor", sometimes referred to as "wireless trusted
> module" or "generic encrypt unit" is a low-power core present on MMP2,
> that has nothing to do with security, wireless, trust or encryption.
>
> On an OLPC machine it runs CForth and serves as a keyboard controller:
> http://dev.laptop.org/git/users/wmb/cforth/tree/src/app/arm-xo-1.75/ps2.fth
>
> The register address was obtained from the OLPC kernel, since the
> datasheet seems to be the Marvell's most important business secret.
>
> Acked-by: Stephen Boyd <[email protected]>
> Signed-off-by: Lubomir Rintel <[email protected]>
Acked-by: Pavel Machek <[email protected]>
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
On Wed 2018-10-10 16:24:58, Lubomir Rintel wrote:
> Add properties describing the GPIO lines used by the keyboard controller.
> The olpc-apsp driver will do happily without them, but they are still part
> of the hardware description. The driver could still reserve the lines,
> so that nothing else touches them.
>
> This makes the device node almost compatible with "ps2-gpio". I'm not
> adding a compatible property, because ps2-gpio would use a different
> interrupt, so that we'd need to name it. And I haven't actually tried it.
>
> Reviewed-by: Rob Herring <[email protected]>
> Signed-off-by: Lubomir Rintel <[email protected]>
Acked-by: Pavel Machek <[email protected]>
Again, Rob, could you apply this one?
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
On Wed 2018-10-10 16:25:03, Lubomir Rintel wrote:
> Without the clock, the keyboard controller won't operate.
> Tested on an OLPC XO 1.75.
>
> Signed-off-by: Lubomir Rintel <[email protected]>
Acked-by: Pavel Machek <[email protected]>
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
On Wed 2018-10-10 16:25:04, Lubomir Rintel wrote:
> Take the GPIO lines are used by the SP. The driver doesn't touch the
> lines -- this is done to disallow anything else from fiddling with
> them because that would confuse the SP firmware.
>
> Also, the lines are now nicely visible in /sys/kernel/debug/gpio.
>
> Signed-off-by: Lubomir Rintel <[email protected]>
Acked-by: Pavel Machek <[email protected]>
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html