[PATCH 1/1] nvmem: sunxi_sid: fix A64 SID controller support
Like in H3, A64 SID controller doesn't return correct data when using direct access. It appears that on A64, SID needs 8 bytes of word_size. Workaround is to enable read by registers. Signed-off-by: Stefan Mavrodiev --- drivers/nvmem/sunxi_sid.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/nvmem/sunxi_sid.c b/drivers/nvmem/sunxi_sid.c index a079a80ddf2c..e26ef1bbf198 100644 --- a/drivers/nvmem/sunxi_sid.c +++ b/drivers/nvmem/sunxi_sid.c @@ -186,6 +186,7 @@ static const struct sunxi_sid_cfg sun8i_h3_cfg = { static const struct sunxi_sid_cfg sun50i_a64_cfg = { .value_offset = 0x200, .size = 0x100, + .need_register_readout = true, }; static const struct sunxi_sid_cfg sun50i_h6_cfg = { -- 2.17.1
[PATCH 0/1] nvmem: sunxi_sid: fix A64 SID controller support
A64 SID controller has some issues when readind data, To exampine the problem I've done the following steps. When reading the whole nvmem memory in one chunk the returned bytes are valid: dd if=/sys/bus/nvmem/devices/sunxi-sid0/nvmem 2>/dev/null | hexdump -C ba 00 c0 92 20 46 10 84 00 45 34 50 0e 04 26 48 | F...E4P..&H| 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 || * 0030 00 00 00 00 87 07 8d 07 8e 07 00 00 00 00 00 00 || 0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 || * 0100 When bs is set to 4 bytes the data is no longer valid: dd if=/sys/bus/nvmem/devices/sunxi-sid0/nvmem bs=4 2>/dev/null | hexdump -C ba 00 c0 92 20 46 10 84 00 45 34 50 0e 04 26 48 | F...E4P..&H| 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 || * 0030 00 00 00 00 87 00 00 00 8e 00 00 00 00 00 00 00 || 0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 || * 0100 You can see that only the data at 0x34 and 0x38 is corrupted. It appears that A64 needs minimun 8 bytes block size; dd if=/sys/bus/nvmem/devices/sunxi-sid0/nvmem bs=8 2>/dev/null | hexdump -C ba 00 c0 92 20 46 10 84 00 45 34 50 0e 04 26 48 | F...E4P..&H| 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 || * 0030 00 00 00 00 87 07 8d 07 8e 07 00 00 00 00 00 00 || 0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 || * 0100 In the driver stride is set to 4 and word_size to 1. When you're using nvmem as thermal calibration data in the dts you write something like this: sid: eeprom@1c14000 { compatible = "allwinner,sun50i-a64-sid"; . thermal_calibration: calib@34 { reg = <0x34 0x08>; }; }; This will return incorrect data. One way to fix this is to set stride/word_size to 8, but this will be inconvenient for the dts. Other is to enable reading data via register access. After the fix: dd if=/sys/bus/nvmem/devices/sunxi-sid0/nvmem bs=4 2>/dev/null | hexdump -C ba 00 c0 92 20 46 10 84 00 45 34 50 0e 04 26 48 | F...E4P..&H| 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 || * 0030 00 00 00 00 87 07 8d 07 8e 07 00 00 00 00 00 00 || 0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 || * 0100 Stefan Mavrodiev (1): nvmem: sunxi_sid: fix A64 SID controller support drivers/nvmem/sunxi_sid.c | 1 + 1 file changed, 1 insertion(+) -- 2.17.1
[PATCH 1/1] thermal_hwmon: Sanitize thermal_zone type
When calling thermal_add_hwmon_sysfs(), the device type is sanitized by replacing '-' with '_'. However tz->type remains unsanitized. Thus calling thermal_hwmon_lookup_by_type() returns no device. And if there is no device, thermal_remove_hwmon_sysfs() fails with "hwmon device lookup failed!". The result is unregisted hwmon devices in the sysfs. Fixes: 409ef0bacacf ("thermal_hwmon: Sanitize attribute name passed to hwmon") Signed-off-by: Stefan Mavrodiev --- drivers/thermal/thermal_hwmon.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c index 40c69a533b24..dd5d8ee37928 100644 --- a/drivers/thermal/thermal_hwmon.c +++ b/drivers/thermal/thermal_hwmon.c @@ -87,13 +87,17 @@ static struct thermal_hwmon_device * thermal_hwmon_lookup_by_type(const struct thermal_zone_device *tz) { struct thermal_hwmon_device *hwmon; + char type[THERMAL_NAME_LENGTH]; mutex_lock(&thermal_hwmon_list_lock); - list_for_each_entry(hwmon, &thermal_hwmon_list, node) - if (!strcmp(hwmon->type, tz->type)) { + list_for_each_entry(hwmon, &thermal_hwmon_list, node) { + strcpy(type, tz->type); + strreplace(type, '-', '_'); + if (!strcmp(hwmon->type, type)) { mutex_unlock(&thermal_hwmon_list_lock); return hwmon; } + } mutex_unlock(&thermal_hwmon_list_lock); return NULL; -- 2.17.1
[PATCH v3 1/2] mfd: rk808: Check pm_power_off pointer
The function pointer pm_power_off may point to function from other module (PSCI for example). If rk808 is removed, pm_power_off is overwritten to NULL and the system cannot be powered off. This patch checks if pm_power_off points to a module function. Signed-off-by: Stefan Mavrodiev --- Changes is v3: - Add explanation comments Changes in v2: - Initial release actually drivers/mfd/rk808.c | 17 +++-- include/linux/mfd/rk808.h | 1 + 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index 94377782d208..46d26e141cc4 100644 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -438,7 +438,6 @@ static int rk808_probe(struct i2c_client *client, struct rk808 *rk808; const struct rk808_reg_data *pre_init_reg; const struct mfd_cell *cells; - void (*pm_pwroff_fn)(void); int nr_pre_init_regs; int nr_cells; int pm_off = 0, msb, lsb; @@ -475,7 +474,7 @@ static int rk808_probe(struct i2c_client *client, nr_pre_init_regs = ARRAY_SIZE(rk805_pre_init_reg); cells = rk805s; nr_cells = ARRAY_SIZE(rk805s); - pm_pwroff_fn = rk805_device_shutdown; + rk808->pm_pwroff_fn = rk805_device_shutdown; break; case RK808_ID: rk808->regmap_cfg = &rk808_regmap_config; @@ -484,7 +483,7 @@ static int rk808_probe(struct i2c_client *client, nr_pre_init_regs = ARRAY_SIZE(rk808_pre_init_reg); cells = rk808s; nr_cells = ARRAY_SIZE(rk808s); - pm_pwroff_fn = rk808_device_shutdown; + rk808->pm_pwroff_fn = rk808_device_shutdown; break; case RK818_ID: rk808->regmap_cfg = &rk818_regmap_config; @@ -493,7 +492,7 @@ static int rk808_probe(struct i2c_client *client, nr_pre_init_regs = ARRAY_SIZE(rk818_pre_init_reg); cells = rk818s; nr_cells = ARRAY_SIZE(rk818s); - pm_pwroff_fn = rk818_device_shutdown; + rk808->pm_pwroff_fn = rk818_device_shutdown; break; default: dev_err(&client->dev, "Unsupported RK8XX ID %lu\n", @@ -548,7 +547,7 @@ static int rk808_probe(struct i2c_client *client, "rockchip,system-power-controller"); if (pm_off && !pm_power_off) { rk808_i2c_client = client; - pm_power_off = pm_pwroff_fn; + pm_power_off = rk808->pm_pwroff_fn; } return 0; @@ -563,7 +562,13 @@ static int rk808_remove(struct i2c_client *client) struct rk808 *rk808 = i2c_get_clientdata(client); regmap_del_irq_chip(client->irq, rk808->irq_data); - pm_power_off = NULL; + + /** +* pm_power_off may points to a function from another module. +* Check if the pointer is set by us and only then overwrite it. +*/ + if (rk808->pm_pwroff_fn && pm_power_off == rk808->pm_pwroff_fn) + pm_power_off = NULL; return 0; } diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h index d3156594674c..8b5d68a7bb9c 100644 --- a/include/linux/mfd/rk808.h +++ b/include/linux/mfd/rk808.h @@ -453,5 +453,6 @@ struct rk808 { longvariant; const struct regmap_config *regmap_cfg; const struct regmap_irq_chip*regmap_irq_chip; + void(*pm_pwroff_fn)(void); }; #endif /* __LINUX_REGULATOR_RK808_H */ -- 2.17.1
[PATCH v3 2/2] mfd: rk808: Prepare rk805 for poweroff
RK805 has SLEEP signal, which can put the device into SLEEP or OFF mode. The default is SLEEP mode. However, when the kernel performs power-off (actually the ATF) the device will not go fully off and this will result in higher power consumption and inability to wake the device with RTC alarm. The solution is to enable pm_power_off_prepare function, which will configure SLEEP pin for OFF function. Signed-off-by: Stefan Mavrodiev --- Change for v3: - Remove useless warning messages - Change poweroff error messages - Add explanation comments Changes for v2: - Move pm_pwroff_prep_fn to header - Check pm_power_off_prepare before make it NULL drivers/mfd/rk808.c | 50 +++ include/linux/mfd/rk808.h | 1 + 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index 46d26e141cc4..416575343b4d 100644 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -374,17 +374,29 @@ static void rk805_device_shutdown(void) int ret; struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client); - if (!rk808) { - dev_warn(&rk808_i2c_client->dev, -"have no rk805, so do nothing here\n"); + if (!rk808) return; - } ret = regmap_update_bits(rk808->regmap, RK805_DEV_CTRL_REG, DEV_OFF, DEV_OFF); if (ret) - dev_err(&rk808_i2c_client->dev, "power off error!\n"); + dev_err(&rk808_i2c_client->dev, "Failed to shutdown device!\n"); +} + +static void rk805_device_shutdown_prepare(void) +{ + int ret; + struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client); + + if (!rk808) + return; + + ret = regmap_update_bits(rk808->regmap, +RK805_GPIO_IO_POL_REG, +SLP_SD_MSK, SHUTDOWN_FUN); + if (ret) + dev_err(&rk808_i2c_client->dev, "Failed to shutdown device!\n"); } static void rk808_device_shutdown(void) @@ -392,17 +404,14 @@ static void rk808_device_shutdown(void) int ret; struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client); - if (!rk808) { - dev_warn(&rk808_i2c_client->dev, -"have no rk808, so do nothing here\n"); + if (!rk808) return; - } ret = regmap_update_bits(rk808->regmap, RK808_DEVCTRL_REG, DEV_OFF_RST, DEV_OFF_RST); if (ret) - dev_err(&rk808_i2c_client->dev, "power off error!\n"); + dev_err(&rk808_i2c_client->dev, "Failed to shutdown device!\n"); } static void rk818_device_shutdown(void) @@ -410,17 +419,14 @@ static void rk818_device_shutdown(void) int ret; struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client); - if (!rk808) { - dev_warn(&rk808_i2c_client->dev, -"have no rk818, so do nothing here\n"); + if (!rk808) return; - } ret = regmap_update_bits(rk808->regmap, RK818_DEVCTRL_REG, DEV_OFF, DEV_OFF); if (ret) - dev_err(&rk808_i2c_client->dev, "power off error!\n"); + dev_err(&rk808_i2c_client->dev, "Failed to shutdown device!\n"); } static const struct of_device_id rk808_of_match[] = { @@ -475,6 +481,7 @@ static int rk808_probe(struct i2c_client *client, cells = rk805s; nr_cells = ARRAY_SIZE(rk805s); rk808->pm_pwroff_fn = rk805_device_shutdown; + rk808->pm_pwroff_prep_fn = rk805_device_shutdown_prepare; break; case RK808_ID: rk808->regmap_cfg = &rk808_regmap_config; @@ -550,6 +557,12 @@ static int rk808_probe(struct i2c_client *client, pm_power_off = rk808->pm_pwroff_fn; } + if (pm_off && !pm_power_off_prepare) { + if (!rk808_i2c_client) + rk808_i2c_client = client; + pm_power_off_prepare = rk808->pm_pwroff_prep_fn; + } + return 0; err_irq: @@ -570,6 +583,13 @@ static int rk808_remove(struct i2c_client *client) if (rk808->pm_pwroff_fn && pm_power_off == rk808->pm_pwroff_fn) pm_power_off = NULL; + /** +* As above, check if the pointer is set by us before overwrite. +*/ + if (rk808->pm_pwroff_prep_fn && + pm_power_off_prepare == rk808->pm_pwroff_prep_fn) + pm_power_off_prepare = NULL; +
[PATCH v3 0/2] mfd: rk808: Fix pointers and poweroff
This patch is actually follow-up to: [PATCH 1/1] mfd: rk808: Prepare rk8085 for poweroff The patchset fixes poweroff function for boards with RK8085 PMU. During the preparation of v2 possible wrong pointer access was spot (pm_power_off), so one more patch was introduced in the series. Stefan Mavrodiev (2): mfd: rk808: Check pm_power_off pointer mfd: rk808: Prepare rk805 for poweroff drivers/mfd/rk808.c | 67 +++ include/linux/mfd/rk808.h | 2 ++ 2 files changed, 48 insertions(+), 21 deletions(-) -- 2.17.1
[PATCH v2 1/2] mfd: rk808: Check pm_power_off pointer
The function pointer pm_power_off may point to function from other module (PSCI for example). If rk808 is removed, pm_power_off is overwritten to NULL and the system cannot be powered off. This patch checks if pm_power_off points to a module function. Signed-off-by: Stefan Mavrodiev --- Changes in v2: - Initial release actually drivers/mfd/rk808.c | 13 +++-- include/linux/mfd/rk808.h | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index 94377782d208..c0b179792bbf 100644 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -438,7 +438,6 @@ static int rk808_probe(struct i2c_client *client, struct rk808 *rk808; const struct rk808_reg_data *pre_init_reg; const struct mfd_cell *cells; - void (*pm_pwroff_fn)(void); int nr_pre_init_regs; int nr_cells; int pm_off = 0, msb, lsb; @@ -475,7 +474,7 @@ static int rk808_probe(struct i2c_client *client, nr_pre_init_regs = ARRAY_SIZE(rk805_pre_init_reg); cells = rk805s; nr_cells = ARRAY_SIZE(rk805s); - pm_pwroff_fn = rk805_device_shutdown; + rk808->pm_pwroff_fn = rk805_device_shutdown; break; case RK808_ID: rk808->regmap_cfg = &rk808_regmap_config; @@ -484,7 +483,7 @@ static int rk808_probe(struct i2c_client *client, nr_pre_init_regs = ARRAY_SIZE(rk808_pre_init_reg); cells = rk808s; nr_cells = ARRAY_SIZE(rk808s); - pm_pwroff_fn = rk808_device_shutdown; + rk808->pm_pwroff_fn = rk808_device_shutdown; break; case RK818_ID: rk808->regmap_cfg = &rk818_regmap_config; @@ -493,7 +492,7 @@ static int rk808_probe(struct i2c_client *client, nr_pre_init_regs = ARRAY_SIZE(rk818_pre_init_reg); cells = rk818s; nr_cells = ARRAY_SIZE(rk818s); - pm_pwroff_fn = rk818_device_shutdown; + rk808->pm_pwroff_fn = rk818_device_shutdown; break; default: dev_err(&client->dev, "Unsupported RK8XX ID %lu\n", @@ -548,7 +547,7 @@ static int rk808_probe(struct i2c_client *client, "rockchip,system-power-controller"); if (pm_off && !pm_power_off) { rk808_i2c_client = client; - pm_power_off = pm_pwroff_fn; + pm_power_off = rk808->pm_pwroff_fn; } return 0; @@ -563,7 +562,9 @@ static int rk808_remove(struct i2c_client *client) struct rk808 *rk808 = i2c_get_clientdata(client); regmap_del_irq_chip(client->irq, rk808->irq_data); - pm_power_off = NULL; + + if (rk808->pm_pwroff_fn && pm_power_off == rk808->pm_pwroff_fn) + pm_power_off = NULL; return 0; } diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h index d3156594674c..8b5d68a7bb9c 100644 --- a/include/linux/mfd/rk808.h +++ b/include/linux/mfd/rk808.h @@ -453,5 +453,6 @@ struct rk808 { longvariant; const struct regmap_config *regmap_cfg; const struct regmap_irq_chip*regmap_irq_chip; + void(*pm_pwroff_fn)(void); }; #endif /* __LINUX_REGULATOR_RK808_H */ -- 2.17.1
[PATCH v2 0/2] mfd: rk808: Fix pointers and poweroff
This patch is actually follow-up to: [PATCH 1/1] mfd: rk808: Prepare rk8085 for poweroff The patchset fixes poweroff function for boards with RK8085 PMU. During the preparation of v2 possible wrong pointer access was spot (pm_power_off), so one more patch was introduced in the series. Stefan Mavrodiev (2): mfd: rk808: Check pm_power_off pointer mfd: rk808: Prepare rk805 for poweroff drivers/mfd/rk808.c | 42 +-- include/linux/mfd/rk808.h | 2 ++ 2 files changed, 38 insertions(+), 6 deletions(-) -- 2.17.1
[PATCH v2 2/2] mfd: rk808: Prepare rk805 for poweroff
RK805 has SLEEP signal, which can put the device into SLEEP or OFF mode. The default is SLEEP mode. However, when the kernel performs power-off (actually the ATF) the device will not go fully off and this will result in higher power consumption and inability to wake the device with RTC alarm. The solution is to enable pm_power_off_prepare function, which will configure SLEEP pin for OFF function. Signed-off-by: Stefan Mavrodiev --- Changes for v2: - Move pm_pwroff_prep_fn to header - Check pm_power_off_prepare before make it NULL drivers/mfd/rk808.c | 29 + include/linux/mfd/rk808.h | 1 + 2 files changed, 30 insertions(+) diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index c0b179792bbf..fb6cdf900899 100644 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -387,6 +387,24 @@ static void rk805_device_shutdown(void) dev_err(&rk808_i2c_client->dev, "power off error!\n"); } +static void rk805_device_shutdown_prepare(void) +{ + int ret; + struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client); + + if (!rk808) { + dev_warn(&rk808_i2c_client->dev, +"have no rk805, so do nothing here\n"); + return; + } + + ret = regmap_update_bits(rk808->regmap, +RK805_GPIO_IO_POL_REG, +SLP_SD_MSK, SHUTDOWN_FUN); + if (ret) + dev_err(&rk808_i2c_client->dev, "power off error!\n"); +} + static void rk808_device_shutdown(void) { int ret; @@ -475,6 +493,7 @@ static int rk808_probe(struct i2c_client *client, cells = rk805s; nr_cells = ARRAY_SIZE(rk805s); rk808->pm_pwroff_fn = rk805_device_shutdown; + rk808->pm_pwroff_prep_fn = rk805_device_shutdown_prepare; break; case RK808_ID: rk808->regmap_cfg = &rk808_regmap_config; @@ -550,6 +569,12 @@ static int rk808_probe(struct i2c_client *client, pm_power_off = rk808->pm_pwroff_fn; } + if (pm_off && !pm_power_off_prepare) { + if (!rk808_i2c_client) + rk808_i2c_client = client; + pm_power_off_prepare = rk808->pm_pwroff_prep_fn; + } + return 0; err_irq: @@ -566,6 +591,10 @@ static int rk808_remove(struct i2c_client *client) if (rk808->pm_pwroff_fn && pm_power_off == rk808->pm_pwroff_fn) pm_power_off = NULL; + if (rk808->pm_pwroff_prep_fn && + pm_power_off_prepare == rk808->pm_pwroff_prep_fn) + pm_power_off_prepare = NULL; + return 0; } diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h index 8b5d68a7bb9c..ec928173e507 100644 --- a/include/linux/mfd/rk808.h +++ b/include/linux/mfd/rk808.h @@ -454,5 +454,6 @@ struct rk808 { const struct regmap_config *regmap_cfg; const struct regmap_irq_chip*regmap_irq_chip; void(*pm_pwroff_fn)(void); + void(*pm_pwroff_prep_fn)(void); }; #endif /* __LINUX_REGULATOR_RK808_H */ -- 2.17.1
Re: [PATCH v2 5/8] arm64: dts: allwinner: Enable AXP803 CHGLED for Olimex boards
On 2/15/19 8:49 PM, Pavel Machek wrote: On Fri 2019-02-15 13:50:10, Stefan Mavrodiev wrote: Teres-I and A64-OLinuXino commes with populated LED connected to AXP803. So to be used as battery indication, pass the LED control to the charger itself in mode 0 ( FULL while charging, OFF no battery or completed). Signed-off-by: Stefan Mavrodiev --- arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts | 6 ++ arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts | 6 ++ 2 files changed, 12 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts index f7a4bccaa5d4..7d6930319fba 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts @@ -177,6 +177,12 @@ #include "axp803.dtsi" +&axp_led { + label = "a64-olinuxino:yellow:chgled"; There's little chance userspace will recognize this led. Can you make it "platform:yellow:charging" and fix it for other boards, too? Sure. Best regards, Stefan Mavrodiev Pavel
Re: [PATCH v2 1/8] leds: Add support for AXP20X CHGLED
On 2/15/19 8:32 PM, Pavel Machek wrote: Hi! On Fri, Feb 15, 2019 at 01:50:06PM +0200, Stefan Mavrodiev wrote: +static ssize_t control_store(struct device *dev, struct device_attribute *attr, +const char *buf, size_t size) +{ + struct led_classdev *cdev = dev_get_drvdata(dev); + struct axp20x_led *priv = to_axp20x_led(cdev); + unsigned long val; + int ret; + + ret = kstrtoul(buf, 0, &val); + if (ret) + return ret; + + /** +* Supported values are: +* - 0 : Manual control +* - 1 : Charger control +*/ ... +static struct attribute *axp20x_led_attrs[] = { + &dev_attr_control.attr, + &dev_attr_mode.attr, + NULL, +}; +ATTRIBUTE_GROUPS(axp20x_led); I can't really say whether adding sysfs handles for this is the right thing to do, but if it is you should document the interface. It is not. See "Add Intel Cherry Trail Whiskey Cove PMIC LEDs" thread in the last few days. What I understood is that there will be changes in the LED core, exporting a new sysfs entry "hw_control". Then I should set HW_CONTROL flag for the device and add hw_control_get/set callback functions. And this can happen when the LED core is updated. Right? However I didn't understand how (in my case) hardware controlled pattern will be selected? Best regards, Stefan Mavrodiev + if (!of_property_read_u8(np, "x-powers,charger-mode", &value)) { + priv->ctrl = AXP20X_CHGLED_CTRL_CHARGER; + priv->mode = (value < 2) ? value : 0; + } else { + priv->ctrl = AXP20X_CHGLED_CTRL_MANUAL; + } I'm not sure we want to make this a property of the device tree. Changing the device tree isn't an option for some users, so we need to make sure we can change it even if we can't change the device tree. We want this to be configurable at run time. It can get default from the device tree. If we go for the "hardware" trigger, you'll get it for free. Best regards, Pavel
Re: [PATCH v2 1/8] leds: Add support for AXP20X CHGLED
On 2/15/19 1:50 PM, Stefan Mavrodiev wrote: Most of AXP20x PMIC chips have built-in battery charger with LED indicator. The LED can be controlled ether by the charger or manually by a register. The default is (except for AXP209) manual control, which makes this LED useless, since there is no device driver. The driver rely on AXP20X MFD driver. Signed-off-by: Stefan Mavrodiev --- drivers/leds/Kconfig | 10 ++ drivers/leds/Makefile | 1 + drivers/leds/leds-axp20x.c | 291 + 3 files changed, 302 insertions(+) create mode 100644 drivers/leds/leds-axp20x.c diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index a72f97fca57b..82dce9063d41 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -766,6 +766,16 @@ config LEDS_NIC78BX To compile this driver as a module, choose M here: the module will be called leds-nic78bx. +config LEDS_AXP20X + tristate "LED support for X-Powers PMICs" + depends on MFD_AXP20X + help + This option enables support for CHGLED found on most of X-Powers + PMICs. + + To compile this driver as a module, choose M here: the module + will be called leds-axp20x. + comment "LED Triggers" source "drivers/leds/trigger/Kconfig" diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index 4c1b0054f379..d3fb76e119d8 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile @@ -79,6 +79,7 @@ obj-$(CONFIG_LEDS_MT6323) += leds-mt6323.o obj-$(CONFIG_LEDS_LM3692X)+= leds-lm3692x.o obj-$(CONFIG_LEDS_SC27XX_BLTC)+= leds-sc27xx-bltc.o obj-$(CONFIG_LEDS_LM3601X)+= leds-lm3601x.o +obj-$(CONFIG_LEDS_AXP20X) += leds-axp20x.o # LED SPI Drivers obj-$(CONFIG_LEDS_CR0014114) += leds-cr0014114.o diff --git a/drivers/leds/leds-axp20x.c b/drivers/leds/leds-axp20x.c new file mode 100644 index ..2d5ae1c085f0 --- /dev/null +++ b/drivers/leds/leds-axp20x.c @@ -0,0 +1,291 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// Copyright 2019 Stefan Mavrodiev + The copyright header is wrong. It should be "Copyright 2019 Olimex Ltd.". I'd like to fix it before the patchis merged (eventually). Regards, Stefan Mavrodiev +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define AXP20X_CHGLED_CTRL_REG AXP20X_OFF_CTRL +#define AXP20X_CHGLED_FUNC_MASKGENMASK(5, 4) +#define AXP20X_CHGLED_FUNC_OFF (0 << 4) +#define AXP20X_CHGLED_FUNC_1HZ (1 << 4) +#define AXP20X_CHGLED_FUNC_4HZ (2 << 4) +#define AXP20X_CHGLED_FUNC_FULL(3 << 4) +#define AXP20X_CHGLED_CTRL_MASKBIT(3) +#define AXP20X_CHGLED_CTRL_MANUAL 0 +#define AXP20X_CHGLED_CTRL_CHARGER 1 +#define AXP20X_CHGLED_CTRL(_ctrl) (_ctrl << 3) + +#define AXP20X_CHGLED_MODE_REG AXP20X_CHRG_CTRL2 +#define AXP20X_CHGLED_MODE_MASKBIT(4) +#define AXP20X_CHGLED_MODE_A 0 +#define AXP20X_CHGLED_MODE_B 1 +#define AXP20X_CHGLED_MODE(_mode) (_mode << 4) + +struct axp20x_led { + charname[LED_MAX_NAME_SIZE]; + struct led_classdev cdev; + struct mutexlock; + u8 mode : 1; + u8 ctrl : 1; + u8 ctrl_inverted : 1; + struct axp20x_dev *axp20x; +}; + +static inline struct axp20x_led *to_axp20x_led(struct led_classdev *cdev) +{ + return container_of(cdev, struct axp20x_led, cdev); +} + +static int axp20x_led_setup(struct axp20x_led *priv) +{ + int ret; + u8 val; + + /* Invert the logic, if necessary */ + val = priv->ctrl ^ priv->ctrl_inverted; + + mutex_lock(&priv->lock); + ret = regmap_update_bits(priv->axp20x->regmap, AXP20X_CHGLED_CTRL_REG, +AXP20X_CHGLED_CTRL_MASK, +AXP20X_CHGLED_CTRL(val)); + if (ret < 0) + goto out; + + ret = regmap_update_bits(priv->axp20x->regmap, AXP20X_CHGLED_MODE_REG, +AXP20X_CHGLED_MODE_MASK, +AXP20X_CHGLED_MODE(priv->mode)); +out: + mutex_unlock(&priv->lock); + return ret; +} + +static ssize_t control_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct led_classdev *cdev = dev_get_drvdata(dev); + struct axp20x_led *priv = to_axp20x_led(cdev); + + return sprintf(buf, "%u\n", priv->ctrl); +} + +static ssize_t control_store(struct device *dev, struct device_at
[PATCH v2 6/8] arm: dts: axpxx: add charge led node
Add dt node for axp20x-led driver controlling CHGLED. Default status is disabled, since it may be not used. Signed-off-by: Stefan Mavrodiev --- arch/arm/boot/dts/axp209.dtsi | 5 + arch/arm/boot/dts/axp22x.dtsi | 5 + arch/arm/boot/dts/axp81x.dtsi | 5 + 3 files changed, 15 insertions(+) diff --git a/arch/arm/boot/dts/axp209.dtsi b/arch/arm/boot/dts/axp209.dtsi index 0d9ff12bdf28..f972b6f3ecd0 100644 --- a/arch/arm/boot/dts/axp209.dtsi +++ b/arch/arm/boot/dts/axp209.dtsi @@ -69,6 +69,11 @@ #gpio-cells = <2>; }; + axp_led: led { + compatible = "x-powers,axp20x-led"; + status = "disabled"; + }; + battery_power_supply: battery-power-supply { compatible = "x-powers,axp209-battery-power-supply"; status = "disabled"; diff --git a/arch/arm/boot/dts/axp22x.dtsi b/arch/arm/boot/dts/axp22x.dtsi index 65a07a67aca9..92a0b64252b1 100644 --- a/arch/arm/boot/dts/axp22x.dtsi +++ b/arch/arm/boot/dts/axp22x.dtsi @@ -62,6 +62,11 @@ #io-channel-cells = <1>; }; + axp_led: led { + compatible = "x-powers,axp20x-led"; + status = "disabled"; + }; + battery_power_supply: battery-power-supply { compatible = "x-powers,axp221-battery-power-supply"; status = "disabled"; diff --git a/arch/arm/boot/dts/axp81x.dtsi b/arch/arm/boot/dts/axp81x.dtsi index bd83962d3627..22e243cc40d5 100644 --- a/arch/arm/boot/dts/axp81x.dtsi +++ b/arch/arm/boot/dts/axp81x.dtsi @@ -74,6 +74,11 @@ }; }; + axp_led: led { + compatible = "x-powers,axp20x-led"; + status = "disabled"; + }; + battery_power_supply: battery-power-supply { compatible = "x-powers,axp813-battery-power-supply"; status = "disabled"; -- 2.17.1
[PATCH v2 3/8] dt-bindings: leds: Add binding for axp20x-led device driver
This adds the devicetree bindings for charge led indicator found on most of X-Powers AXP20X PMICs. Signed-off-by: Stefan Mavrodiev --- .../devicetree/bindings/leds/leds-axp20x.txt | 74 +++ 1 file changed, 74 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-axp20x.txt diff --git a/Documentation/devicetree/bindings/leds/leds-axp20x.txt b/Documentation/devicetree/bindings/leds/leds-axp20x.txt new file mode 100644 index ..5a83ad06796d --- /dev/null +++ b/Documentation/devicetree/bindings/leds/leds-axp20x.txt @@ -0,0 +1,74 @@ +Device Tree Bindings for LED support on X-Powers PMIC + +Most of the X-Powers PMICs have integrated battery charger with LED indicator. +The output is open-drain, so the state is either high-Z or output-low. The +driver is a subnode of AXP20X MFD driver, since it uses shared bus with all +other cells. +The LED can be controlled either manually or automatically. Then in automatic +(controlled by the charger) there are two indication modes: + +Mode-A +== +- output-low: Charging +- high-Z Not charging +- 1Hz flashing:Abnormal alarm +- 4Hz flashing Overvoltage alarm + +Mode-B +== +- output-low: Battery full +- high-Z Not charging +- 1Hz flashing:Charging +- 4Hz flashing Overvoltage or abnormal alarm + +The control and the mode can be changed from sysfs. + +For AXP20X MFD bindings see: +Documentation/devicetree/bindings/mfd/axp20x.txt + +Required properties: +- compatible : Must be "x-powers,axp20x-led" + +Supported common LED properties, see ./common.txt for more informationn +- label : See Documentation/devicetree/bindings/leds/common.txt +- linux,default-trigger : See Documentation/devicetree/bindings/leds/common.txt +- default-state: See Documentation/devicetree/bindings/leds/common.txt + +Optional properties: +- x-powers,charger-mode: 0 for Mode-A, 1 for Mode-B +If omitted, then the control is set to manual mode. +On invalid value, Mode-A is used. + + +Example: + + axp803: pmic@3a3 { + compatible = "x-powers,axp803"; + + ... + + led@0 { + compatible = "x-powers,axp20x-led"; + status = "okay"; + + label = "axp20x:yellow:chgled"; + linux,default-trigger = "timer"; + default-state = "on"; + }; + }; + +or + + axp803: pmic@3a3 { + compatible = "x-powers,axp803"; + + ... + + led@0 { + compatible = "x-powers,axp20x-led"; + status = "okay"; + + label = "axp20x:yellow:chgled"; + x-powers,charger-mode = <1>; + }; + }; -- 2.17.1
[PATCH v2 5/8] arm64: dts: allwinner: Enable AXP803 CHGLED for Olimex boards
Teres-I and A64-OLinuXino commes with populated LED connected to AXP803. So to be used as battery indication, pass the LED control to the charger itself in mode 0 ( FULL while charging, OFF no battery or completed). Signed-off-by: Stefan Mavrodiev --- arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts | 6 ++ arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts | 6 ++ 2 files changed, 12 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts index f7a4bccaa5d4..7d6930319fba 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts @@ -177,6 +177,12 @@ #include "axp803.dtsi" +&axp_led { + label = "a64-olinuxino:yellow:chgled"; + status = "okay"; + x-powers,charger-mode = <0>; +}; + ®_aldo1 { regulator-always-on; regulator-min-microvolt = <280>; diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts index c455b24dd079..cdffdd4e4561 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts @@ -145,6 +145,12 @@ #include "axp803.dtsi" +&axp_led { + label = "teres-i:yellow:chgled"; + status = "okay"; + x-powers,charger-mode = <0>; +}; + ®_aldo1 { regulator-always-on; regulator-min-microvolt = <280>; -- 2.17.1
[PATCH v2 7/8] ARM: dts: sun7i: Enable AXP209 CHGLED for Olimex boards
Olimex A20-OLinuXino based boards (MICRO, SOM, SOM204, LIME2) commes with populated LED connected to AXP209. By default the LED is controlled by AXP209, so this binding actually doesn't modify any registers. However this can can be used as general purpose LED, if the control mode is overridden. Also this binding is enabled only for OLIMEX boards, since I have no knowlegde if the other manifactures are populating this LED. Signed-off-by: Stefan Mavrodiev --- arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts| 6 ++ arch/arm/boot/dts/sun7i-a20-olimex-som204-evb.dts | 6 ++ arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts | 6 ++ arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 6 ++ 4 files changed, 24 insertions(+) diff --git a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts index f0e6a96e5785..677ee1c2795a 100644 --- a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts +++ b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts @@ -243,6 +243,12 @@ #include "axp209.dtsi" +&axp_led { + label = "a20-olimex-som-evb:yellow:chgled"; + status = "okay"; + x-powers,charger-mode = <0>; +}; + ®_dcdc2 { regulator-always-on; regulator-min-microvolt = <100>; diff --git a/arch/arm/boot/dts/sun7i-a20-olimex-som204-evb.dts b/arch/arm/boot/dts/sun7i-a20-olimex-som204-evb.dts index 823aabce0462..31a3ab5ad4e3 100644 --- a/arch/arm/boot/dts/sun7i-a20-olimex-som204-evb.dts +++ b/arch/arm/boot/dts/sun7i-a20-olimex-som204-evb.dts @@ -205,6 +205,12 @@ status = "okay"; }; +&axp_led { + label = "a20-som204-evb:yellow:chgled"; + status = "okay"; + x-powers,charger-mode = <0>; +}; + &battery_power_supply { status = "okay"; }; diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts index 4e1c590eb098..66dd80ced1fa 100644 --- a/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts +++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts @@ -200,6 +200,12 @@ #include "axp209.dtsi" +&axp_led { + label = "a20-olinuxino-lime2:yellow:chgled"; + status = "okay"; + x-powers,charger-mode = <0>; +}; + ®_dcdc2 { regulator-always-on; regulator-min-microvolt = <100>; diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts index 840ae1194a66..700de909eb49 100644 --- a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts +++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts @@ -272,6 +272,12 @@ status = "okay"; }; +&axp_led { + label = "a20-olinuxino-micro:yellow:chgled"; + status = "okay"; + x-powers,charger-mode = <0>; +}; + &battery_power_supply { status = "okay"; }; -- 2.17.1
[PATCH v2 1/8] leds: Add support for AXP20X CHGLED
Most of AXP20x PMIC chips have built-in battery charger with LED indicator. The LED can be controlled ether by the charger or manually by a register. The default is (except for AXP209) manual control, which makes this LED useless, since there is no device driver. The driver rely on AXP20X MFD driver. Signed-off-by: Stefan Mavrodiev --- drivers/leds/Kconfig | 10 ++ drivers/leds/Makefile | 1 + drivers/leds/leds-axp20x.c | 291 + 3 files changed, 302 insertions(+) create mode 100644 drivers/leds/leds-axp20x.c diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index a72f97fca57b..82dce9063d41 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -766,6 +766,16 @@ config LEDS_NIC78BX To compile this driver as a module, choose M here: the module will be called leds-nic78bx. +config LEDS_AXP20X + tristate "LED support for X-Powers PMICs" + depends on MFD_AXP20X + help + This option enables support for CHGLED found on most of X-Powers + PMICs. + + To compile this driver as a module, choose M here: the module + will be called leds-axp20x. + comment "LED Triggers" source "drivers/leds/trigger/Kconfig" diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index 4c1b0054f379..d3fb76e119d8 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile @@ -79,6 +79,7 @@ obj-$(CONFIG_LEDS_MT6323) += leds-mt6323.o obj-$(CONFIG_LEDS_LM3692X) += leds-lm3692x.o obj-$(CONFIG_LEDS_SC27XX_BLTC) += leds-sc27xx-bltc.o obj-$(CONFIG_LEDS_LM3601X) += leds-lm3601x.o +obj-$(CONFIG_LEDS_AXP20X) += leds-axp20x.o # LED SPI Drivers obj-$(CONFIG_LEDS_CR0014114) += leds-cr0014114.o diff --git a/drivers/leds/leds-axp20x.c b/drivers/leds/leds-axp20x.c new file mode 100644 index ..2d5ae1c085f0 --- /dev/null +++ b/drivers/leds/leds-axp20x.c @@ -0,0 +1,291 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// Copyright 2019 Stefan Mavrodiev + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#define AXP20X_CHGLED_CTRL_REG AXP20X_OFF_CTRL +#define AXP20X_CHGLED_FUNC_MASKGENMASK(5, 4) +#define AXP20X_CHGLED_FUNC_OFF (0 << 4) +#define AXP20X_CHGLED_FUNC_1HZ (1 << 4) +#define AXP20X_CHGLED_FUNC_4HZ (2 << 4) +#define AXP20X_CHGLED_FUNC_FULL(3 << 4) +#define AXP20X_CHGLED_CTRL_MASKBIT(3) +#define AXP20X_CHGLED_CTRL_MANUAL 0 +#define AXP20X_CHGLED_CTRL_CHARGER 1 +#define AXP20X_CHGLED_CTRL(_ctrl) (_ctrl << 3) + +#define AXP20X_CHGLED_MODE_REG AXP20X_CHRG_CTRL2 +#define AXP20X_CHGLED_MODE_MASKBIT(4) +#define AXP20X_CHGLED_MODE_A 0 +#define AXP20X_CHGLED_MODE_B 1 +#define AXP20X_CHGLED_MODE(_mode) (_mode << 4) + +struct axp20x_led { + charname[LED_MAX_NAME_SIZE]; + struct led_classdev cdev; + struct mutexlock; + u8 mode : 1; + u8 ctrl : 1; + u8 ctrl_inverted : 1; + struct axp20x_dev *axp20x; +}; + +static inline struct axp20x_led *to_axp20x_led(struct led_classdev *cdev) +{ + return container_of(cdev, struct axp20x_led, cdev); +} + +static int axp20x_led_setup(struct axp20x_led *priv) +{ + int ret; + u8 val; + + /* Invert the logic, if necessary */ + val = priv->ctrl ^ priv->ctrl_inverted; + + mutex_lock(&priv->lock); + ret = regmap_update_bits(priv->axp20x->regmap, AXP20X_CHGLED_CTRL_REG, +AXP20X_CHGLED_CTRL_MASK, +AXP20X_CHGLED_CTRL(val)); + if (ret < 0) + goto out; + + ret = regmap_update_bits(priv->axp20x->regmap, AXP20X_CHGLED_MODE_REG, +AXP20X_CHGLED_MODE_MASK, +AXP20X_CHGLED_MODE(priv->mode)); +out: + mutex_unlock(&priv->lock); + return ret; +} + +static ssize_t control_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct led_classdev *cdev = dev_get_drvdata(dev); + struct axp20x_led *priv = to_axp20x_led(cdev); + + return sprintf(buf, "%u\n", priv->ctrl); +} + +static ssize_t control_store(struct device *dev, struct device_attribute *attr, +const char *buf, size_t size) +{ + struct led_classdev *cdev = dev_get_drvdata(dev); + struct axp20x_led *priv = to_axp20x_led(cdev); + unsigned long val; + int ret; + + ret
[PATCH v2 2/8] mfd: axp20x: Add axp20x-led cell
Add axp20x-led cell for AXP20x, AXP221, AXP223, AXP228, AXP803, AXP809 and AXP813. Signed-off-by: Stefan Mavrodiev --- drivers/mfd/axp20x.c | 24 +++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c index 3c97f2c0fdfe..e6ab078f0462 100644 --- a/drivers/mfd/axp20x.c +++ b/drivers/mfd/axp20x.c @@ -610,6 +610,9 @@ static const struct mfd_cell axp20x_cells[] = { .of_compatible = "x-powers,axp202-usb-power-supply", .num_resources = ARRAY_SIZE(axp20x_usb_power_supply_resources), .resources = axp20x_usb_power_supply_resources, + }, { + .name = "axp20x-led", + .of_compatible = "x-powers,axp20x-led", }, }; @@ -636,6 +639,9 @@ static const struct mfd_cell axp221_cells[] = { .of_compatible = "x-powers,axp221-usb-power-supply", .num_resources = ARRAY_SIZE(axp22x_usb_power_supply_resources), .resources = axp22x_usb_power_supply_resources, + }, { + .name = "axp20x-led", + .of_compatible = "x-powers,axp20x-led", }, }; @@ -662,6 +668,9 @@ static const struct mfd_cell axp223_cells[] = { .of_compatible = "x-powers,axp223-usb-power-supply", .num_resources = ARRAY_SIZE(axp22x_usb_power_supply_resources), .resources = axp22x_usb_power_supply_resources, + }, { + .name = "axp20x-led", + .of_compatible = "x-powers,axp20x-led", }, }; @@ -719,6 +728,9 @@ static const struct mfd_cell axp288_cells[] = { .resources = axp288_power_button_resources, }, { .name = "axp288_pmic_acpi", + }, { + .name = "axp20x-led", + .of_compatible = "x-powers,axp20x-led", }, }; @@ -741,8 +753,12 @@ static const struct mfd_cell axp803_cells[] = { .of_compatible = "x-powers,axp813-ac-power-supply", .num_resources = ARRAY_SIZE(axp20x_ac_power_supply_resources), .resources = axp20x_ac_power_supply_resources, + }, { + .name = "axp20x-regulator" + }, { + .name = "axp20x-led", + .of_compatible = "x-powers,axp20x-led", }, - { .name = "axp20x-regulator" }, }; static const struct mfd_cell axp806_self_working_cells[] = { @@ -769,6 +785,9 @@ static const struct mfd_cell axp809_cells[] = { }, { .id = 1, .name = "axp20x-regulator", + }, { + .name = "axp20x-led", + .of_compatible = "x-powers,axp20x-led", }, }; @@ -793,6 +812,9 @@ static const struct mfd_cell axp813_cells[] = { .of_compatible = "x-powers,axp813-ac-power-supply", .num_resources = ARRAY_SIZE(axp20x_ac_power_supply_resources), .resources = axp20x_ac_power_supply_resources, + }, { + .name = "axp20x-led", + .of_compatible = "x-powers,axp20x-led", }, }; -- 2.17.1
[PATCH v2 4/8] arm64: dts: allwinner: axp803: add charge led node
Add dt node for axp20x-led driver controlling CHGLED. Default status is disabled, since it may be not used. Signed-off-by: Stefan Mavrodiev --- arch/arm64/boot/dts/allwinner/axp803.dtsi | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/axp803.dtsi b/arch/arm64/boot/dts/allwinner/axp803.dtsi index c3a618e1279a..af4898602b34 100644 --- a/arch/arm64/boot/dts/allwinner/axp803.dtsi +++ b/arch/arm64/boot/dts/allwinner/axp803.dtsi @@ -76,6 +76,11 @@ }; }; + axp_led: led { + compatible = "x-powers,axp20x-led"; + status = "disabled"; + }; + battery_power_supply: battery-power-supply { compatible = "x-powers,axp803-battery-power-supply", "x-powers,axp813-battery-power-supply"; -- 2.17.1
[PATCH v2 8/8] ARM: dts: sun8i: a33: Enable AXP223 CHGLED for A33-OLinuXino
A33-OLinuXino comes with populated CHGLED LED indicating battery charging status. By default the control is set to manual mode, which doesn't indicate battery status. So it makes sense to set the control to automatic mode 0 ( FULL - charging, OFF - no battery or battery full). Signed-off-by: Stefan Mavrodiev --- arch/arm/boot/dts/sun8i-a33-olinuxino.dts | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/sun8i-a33-olinuxino.dts b/arch/arm/boot/dts/sun8i-a33-olinuxino.dts index 3d78169cdeed..a1e36ee51bbb 100644 --- a/arch/arm/boot/dts/sun8i-a33-olinuxino.dts +++ b/arch/arm/boot/dts/sun8i-a33-olinuxino.dts @@ -111,6 +111,12 @@ status = "okay"; }; +&axp_led { + label = "a33-olinuxino:yellow:chgled"; + status = "okay"; + x-powers,charger-mode = <0>; +}; + &battery_power_supply { status = "okay"; }; -- 2.17.1
[PATCH v2 0/8] leds: Add AXP20X CHGLED
This series add support for CHGLED pin found on most of X-Powers PMICs. Changes for v2: - use mutex when accessing hardware registers - fixed LED naming style - fixed some typos - fix variable types when showing attributes - remove useless private data - fix binding documentation - add device consumers Stefan Mavrodiev (8): leds: Add support for AXP20X CHGLED mfd: axp20x: Add axp20x-led cell dt-bindings: leds: Add binding for axp20x-led device driver arm64: dts: allwinner: axp803: add charge led node arm64: dts: allwinner: Enable AXP803 CHGLED for Olimex boards arm: dts: axpxx: add charge led node ARM: dts: sun7i: Enable AXP209 CHGLED for Olimex boards ARM: dts: sun8i: a33: Enable AXP223 CHGLED for A33-OLinuXino .../devicetree/bindings/leds/leds-axp20x.txt | 74 + arch/arm/boot/dts/axp209.dtsi | 5 + arch/arm/boot/dts/axp22x.dtsi | 5 + arch/arm/boot/dts/axp81x.dtsi | 5 + .../arm/boot/dts/sun7i-a20-olimex-som-evb.dts | 6 + .../boot/dts/sun7i-a20-olimex-som204-evb.dts | 6 + .../boot/dts/sun7i-a20-olinuxino-lime2.dts| 6 + .../boot/dts/sun7i-a20-olinuxino-micro.dts| 6 + arch/arm/boot/dts/sun8i-a33-olinuxino.dts | 6 + arch/arm64/boot/dts/allwinner/axp803.dtsi | 5 + .../dts/allwinner/sun50i-a64-olinuxino.dts| 6 + .../boot/dts/allwinner/sun50i-a64-teres-i.dts | 6 + drivers/leds/Kconfig | 10 + drivers/leds/Makefile | 1 + drivers/leds/leds-axp20x.c| 291 ++ drivers/mfd/axp20x.c | 24 +- 16 files changed, 461 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/leds/leds-axp20x.txt create mode 100644 drivers/leds/leds-axp20x.c -- 2.17.1
Re: [PATCH 5/5] arm: dts: axpxx: add charge led node
On 2/5/19 6:16 PM, Chen-Yu Tsai wrote: On Thu, Jan 31, 2019 at 4:25 PM Stefan Mavrodiev wrote: Add dt node for axp20x-led driver controlling CHGLED. Default status is disabled, since it may be not used. Signed-off-by: Stefan Mavrodiev Please include a cover letter for such a patch series. Sorry, I will. Also, do any boards actually use this? I know the Pine64 does, but the LED is left to the user to populate. I would really like to have an in kernel user of this function, so that we can verify it. All boards made by Olimex has this led populated. The development and the testing of the driver was done on A64-OLinuXino board. Should I make another patch, enabling the LED for the mention board? Best regards, Stefan Mavrodiev ChenYu --- arch/arm/boot/dts/axp209.dtsi | 5 + arch/arm/boot/dts/axp22x.dtsi | 5 + arch/arm/boot/dts/axp81x.dtsi | 5 + 3 files changed, 15 insertions(+) diff --git a/arch/arm/boot/dts/axp209.dtsi b/arch/arm/boot/dts/axp209.dtsi index 0d9ff12bdf28..f972b6f3ecd0 100644 --- a/arch/arm/boot/dts/axp209.dtsi +++ b/arch/arm/boot/dts/axp209.dtsi @@ -69,6 +69,11 @@ #gpio-cells = <2>; }; + axp_led: led { + compatible = "x-powers,axp20x-led"; + status = "disabled"; + }; + battery_power_supply: battery-power-supply { compatible = "x-powers,axp209-battery-power-supply"; status = "disabled"; diff --git a/arch/arm/boot/dts/axp22x.dtsi b/arch/arm/boot/dts/axp22x.dtsi index 65a07a67aca9..92a0b64252b1 100644 --- a/arch/arm/boot/dts/axp22x.dtsi +++ b/arch/arm/boot/dts/axp22x.dtsi @@ -62,6 +62,11 @@ #io-channel-cells = <1>; }; + axp_led: led { + compatible = "x-powers,axp20x-led"; + status = "disabled"; + }; + battery_power_supply: battery-power-supply { compatible = "x-powers,axp221-battery-power-supply"; status = "disabled"; diff --git a/arch/arm/boot/dts/axp81x.dtsi b/arch/arm/boot/dts/axp81x.dtsi index bd83962d3627..22e243cc40d5 100644 --- a/arch/arm/boot/dts/axp81x.dtsi +++ b/arch/arm/boot/dts/axp81x.dtsi @@ -74,6 +74,11 @@ }; }; + axp_led: led { + compatible = "x-powers,axp20x-led"; + status = "disabled"; + }; + battery_power_supply: battery-power-supply { compatible = "x-powers,axp813-battery-power-supply"; status = "disabled"; -- 2.17.1
[PATCH 5/5] arm: dts: axpxx: add charge led node
Add dt node for axp20x-led driver controlling CHGLED. Default status is disabled, since it may be not used. Signed-off-by: Stefan Mavrodiev --- arch/arm/boot/dts/axp209.dtsi | 5 + arch/arm/boot/dts/axp22x.dtsi | 5 + arch/arm/boot/dts/axp81x.dtsi | 5 + 3 files changed, 15 insertions(+) diff --git a/arch/arm/boot/dts/axp209.dtsi b/arch/arm/boot/dts/axp209.dtsi index 0d9ff12bdf28..f972b6f3ecd0 100644 --- a/arch/arm/boot/dts/axp209.dtsi +++ b/arch/arm/boot/dts/axp209.dtsi @@ -69,6 +69,11 @@ #gpio-cells = <2>; }; + axp_led: led { + compatible = "x-powers,axp20x-led"; + status = "disabled"; + }; + battery_power_supply: battery-power-supply { compatible = "x-powers,axp209-battery-power-supply"; status = "disabled"; diff --git a/arch/arm/boot/dts/axp22x.dtsi b/arch/arm/boot/dts/axp22x.dtsi index 65a07a67aca9..92a0b64252b1 100644 --- a/arch/arm/boot/dts/axp22x.dtsi +++ b/arch/arm/boot/dts/axp22x.dtsi @@ -62,6 +62,11 @@ #io-channel-cells = <1>; }; + axp_led: led { + compatible = "x-powers,axp20x-led"; + status = "disabled"; + }; + battery_power_supply: battery-power-supply { compatible = "x-powers,axp221-battery-power-supply"; status = "disabled"; diff --git a/arch/arm/boot/dts/axp81x.dtsi b/arch/arm/boot/dts/axp81x.dtsi index bd83962d3627..22e243cc40d5 100644 --- a/arch/arm/boot/dts/axp81x.dtsi +++ b/arch/arm/boot/dts/axp81x.dtsi @@ -74,6 +74,11 @@ }; }; + axp_led: led { + compatible = "x-powers,axp20x-led"; + status = "disabled"; + }; + battery_power_supply: battery-power-supply { compatible = "x-powers,axp813-battery-power-supply"; status = "disabled"; -- 2.17.1
[PATCH 4/5] arm64: dts: allwinner: axp803: add charge led node
Add dt node for axp20x-led driver controlling CHGLED. Default status is disabled, since it may be not used. Signed-off-by: Stefan Mavrodiev --- arch/arm64/boot/dts/allwinner/axp803.dtsi | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/axp803.dtsi b/arch/arm64/boot/dts/allwinner/axp803.dtsi index c3a618e1279a..af4898602b34 100644 --- a/arch/arm64/boot/dts/allwinner/axp803.dtsi +++ b/arch/arm64/boot/dts/allwinner/axp803.dtsi @@ -76,6 +76,11 @@ }; }; + axp_led: led { + compatible = "x-powers,axp20x-led"; + status = "disabled"; + }; + battery_power_supply: battery-power-supply { compatible = "x-powers,axp803-battery-power-supply", "x-powers,axp813-battery-power-supply"; -- 2.17.1
[PATCH 3/5] dt-bindings: leds: Add binding for axp20x-led device driver
This adds the devicetree bindings for charge led indicator found on most of X-Powers AXP20X PMICs. Signed-off-by: Stefan Mavrodiev --- .../devicetree/bindings/leds/leds-axp20x.txt | 74 +++ 1 file changed, 74 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-axp20x.txt diff --git a/Documentation/devicetree/bindings/leds/leds-axp20x.txt b/Documentation/devicetree/bindings/leds/leds-axp20x.txt new file mode 100644 index ..73fae22ffe29 --- /dev/null +++ b/Documentation/devicetree/bindings/leds/leds-axp20x.txt @@ -0,0 +1,74 @@ +Device Tree Bindings for LED support on X-Powers PMIC + +Most of the X-Powers PMICs have integrated battery charger with LED indicator. +The output is open-drain, so the state is either high-Z or output-low. The +driver is subnode of AXP20X MFD driver, since it uses shared bus with all +other cells. +The LED can be controlled either manually or automatic. Then in automatic +(controlled by the charger) there are two indication modes: + +Mode-A +== +- output-low: Charging +- high-Z Not charging +- 1Hz flashing:Abnormal alarm +- 4Hz flashing Overvoltage alarm + +Mode-B +== +- output-low: Battery full +- high-Z Not charging +- 1Hz flashing:Charging +- 4Hz flashing Overvoltage or abnormal alarm + +The control and the mode can be changed from sysfs. + +For AXP20X MFD bindings see: +Documentation/devicetree/bindings/mfd/axp20x.txt + +Required properties: +- compatible : Must be "x-powers,axp20x-led" + +Supported common leds properties, see ./common.txt for more information: +- label : sets LED label. If omitted, dt device node is used +- linux,default-trigger : See +- default-state: + +Optional properties: +- x-powers,charger-mode: 0 for Mode-A, 1 for Mode-B +If omitted, then the control is set to manual mode. +On invalid value, Mode-A is used. + + +Example: + + axp803: pmic@3a3 { + compatible = "x-powers,axp803"; + + ... + + axp20x-led { + compatible = "x-powers,axp20x-led"; + status = "okay"; + + label = "axp20x:yellow:chgled"; + linux,default-trigger = "timer"; + default-state = "on"; + }; + }; + +or + + axp803: pmic@3a3 { + compatible = "x-powers,axp803"; + + ... + + axp20x-led { + compatible = "x-powers,axp20x-led"; + status = "okay"; + + label = "axp20x:yellow:chgled"; + x-powers,charger-mode = "mode-b"; + }; + }; -- 2.17.1
[PATCH 2/5] mfd: axp20x: Add axp20x-led cell
Add axp20x-led cell for AXP20x, AXP221, AXP223, AXP228, AXP803, AXP809 and AXP813. Signed-off-by: Stefan Mavrodiev --- drivers/mfd/axp20x.c | 24 +++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c index 3c97f2c0fdfe..e6ab078f0462 100644 --- a/drivers/mfd/axp20x.c +++ b/drivers/mfd/axp20x.c @@ -610,6 +610,9 @@ static const struct mfd_cell axp20x_cells[] = { .of_compatible = "x-powers,axp202-usb-power-supply", .num_resources = ARRAY_SIZE(axp20x_usb_power_supply_resources), .resources = axp20x_usb_power_supply_resources, + }, { + .name = "axp20x-led", + .of_compatible = "x-powers,axp20x-led", }, }; @@ -636,6 +639,9 @@ static const struct mfd_cell axp221_cells[] = { .of_compatible = "x-powers,axp221-usb-power-supply", .num_resources = ARRAY_SIZE(axp22x_usb_power_supply_resources), .resources = axp22x_usb_power_supply_resources, + }, { + .name = "axp20x-led", + .of_compatible = "x-powers,axp20x-led", }, }; @@ -662,6 +668,9 @@ static const struct mfd_cell axp223_cells[] = { .of_compatible = "x-powers,axp223-usb-power-supply", .num_resources = ARRAY_SIZE(axp22x_usb_power_supply_resources), .resources = axp22x_usb_power_supply_resources, + }, { + .name = "axp20x-led", + .of_compatible = "x-powers,axp20x-led", }, }; @@ -719,6 +728,9 @@ static const struct mfd_cell axp288_cells[] = { .resources = axp288_power_button_resources, }, { .name = "axp288_pmic_acpi", + }, { + .name = "axp20x-led", + .of_compatible = "x-powers,axp20x-led", }, }; @@ -741,8 +753,12 @@ static const struct mfd_cell axp803_cells[] = { .of_compatible = "x-powers,axp813-ac-power-supply", .num_resources = ARRAY_SIZE(axp20x_ac_power_supply_resources), .resources = axp20x_ac_power_supply_resources, + }, { + .name = "axp20x-regulator" + }, { + .name = "axp20x-led", + .of_compatible = "x-powers,axp20x-led", }, - { .name = "axp20x-regulator" }, }; static const struct mfd_cell axp806_self_working_cells[] = { @@ -769,6 +785,9 @@ static const struct mfd_cell axp809_cells[] = { }, { .id = 1, .name = "axp20x-regulator", + }, { + .name = "axp20x-led", + .of_compatible = "x-powers,axp20x-led", }, }; @@ -793,6 +812,9 @@ static const struct mfd_cell axp813_cells[] = { .of_compatible = "x-powers,axp813-ac-power-supply", .num_resources = ARRAY_SIZE(axp20x_ac_power_supply_resources), .resources = axp20x_ac_power_supply_resources, + }, { + .name = "axp20x-led", + .of_compatible = "x-powers,axp20x-led", }, }; -- 2.17.1
[PATCH 1/5] leds: Add support for AXP20X CHGLED
Most of AXP20x PMIC chips have built-in battery charger with LED indicator. The LED can be controlled ether by the charger or manually by a register. The default is (except for AXP209) manual control, which makes this LED useless, since there is no device driver. The driver rely on AXP20X MFD driver. Signed-off-by: Stefan Mavrodiev --- drivers/leds/Kconfig | 10 ++ drivers/leds/Makefile | 1 + drivers/leds/leds-axp20x.c | 283 + 3 files changed, 294 insertions(+) create mode 100644 drivers/leds/leds-axp20x.c diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index a72f97fca57b..82dce9063d41 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -766,6 +766,16 @@ config LEDS_NIC78BX To compile this driver as a module, choose M here: the module will be called leds-nic78bx. +config LEDS_AXP20X + tristate "LED support for X-Powers PMICs" + depends on MFD_AXP20X + help + This option enables support for CHGLED found on most of X-Powers + PMICs. + + To compile this driver as a module, choose M here: the module + will be called leds-axp20x. + comment "LED Triggers" source "drivers/leds/trigger/Kconfig" diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index 4c1b0054f379..d3fb76e119d8 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile @@ -79,6 +79,7 @@ obj-$(CONFIG_LEDS_MT6323) += leds-mt6323.o obj-$(CONFIG_LEDS_LM3692X) += leds-lm3692x.o obj-$(CONFIG_LEDS_SC27XX_BLTC) += leds-sc27xx-bltc.o obj-$(CONFIG_LEDS_LM3601X) += leds-lm3601x.o +obj-$(CONFIG_LEDS_AXP20X) += leds-axp20x.o # LED SPI Drivers obj-$(CONFIG_LEDS_CR0014114) += leds-cr0014114.o diff --git a/drivers/leds/leds-axp20x.c b/drivers/leds/leds-axp20x.c new file mode 100644 index ..9c03410833a3 --- /dev/null +++ b/drivers/leds/leds-axp20x.c @@ -0,0 +1,283 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// Copyright 2019 Stefan Mavrodiev + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define AXP20X_CHGLED_CTRL_REG AXP20X_OFF_CTRL +#define AXP20X_CHGLED_FUNC_MASKGENMASK(5, 4) +#define AXP20X_CHGLED_FUNC_OFF (0 << 4) +#define AXP20X_CHGLED_FUNC_1HZ (1 << 4) +#define AXP20X_CHGLED_FUNC_4HZ (2 << 4) +#define AXP20X_CHGLED_FUNC_FULL(3 << 4) +#define AXP20X_CHGLED_CTRL_MASKBIT(3) +#define AXP20X_CHGLED_CTRL_MANUAL 0 +#define AXP20X_CHGLED_CTRL_CHARGER 1 +#define AXP20X_CHGLED_CTRL(_ctrl) (_ctrl << 3) + +#define AXP20X_CHGLED_MODE_REG AXP20X_CHRG_CTRL2 +#define AXP20X_CHGLED_MODE_MASKBIT(4) +#define AXP20X_CHGLED_MODE_A 0 +#define AXP20X_CHGLED_MODE_B 1 +#define AXP20X_CHGLED_MODE(_mode) (_mode << 4) + +struct axp20x_led { + struct led_classdev cdev; + enum led_brightness current_brightness; + u8 mode : 1; + u8 ctrl : 1; + u8 ctrl_inverted : 1; + struct axp20x_dev *axp20x; +}; + +static inline struct axp20x_led *to_axp20x_led(struct led_classdev *cdev) +{ + return container_of(cdev, struct axp20x_led, cdev); +} + +static int axp20x_led_setup(struct axp20x_led *priv) +{ + int ret; + u8 val; + + /* Invert the logic, if necessary */ + val = priv->ctrl ^ priv->ctrl_inverted; + + ret = regmap_update_bits(priv->axp20x->regmap, AXP20X_CHGLED_CTRL_REG, +AXP20X_CHGLED_CTRL_MASK, +AXP20X_CHGLED_CTRL(val)); + if (ret < 0) + return ret; + + return regmap_update_bits(priv->axp20x->regmap, AXP20X_CHGLED_MODE_REG, + AXP20X_CHGLED_MODE_MASK, + AXP20X_CHGLED_MODE(priv->mode)); +} + +static ssize_t control_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + struct led_classdev *cdev = dev_get_drvdata(dev); + struct axp20x_led *priv = to_axp20x_led(cdev); + + return sprintf(buf, "%d\n", priv->ctrl); +} + +static ssize_t control_store(struct device *dev, struct device_attribute *attr, +const char *buf, size_t size) +{ + struct led_classdev *cdev = dev_get_drvdata(dev); + struct axp20x_led *priv = to_axp20x_led(cdev); + unsigned long val; + int ret; + + ret = kstrtoul(buf, 0, &val); + if (ret) + return ret; + + /** +* Supported values are: +* - 0 : Manual control +* - 1 : Charger control +*/ + if (val > 1) +
Re: [PATCH 1/1] mfd: rk808: Prepare rk805 for poweroff
On 1/9/19 3:11 PM, Heiko Stübner wrote: Am Mittwoch, 9. Januar 2019, 14:10:34 CET schrieb Stefan Mavrodiev: On 1/9/19 3:07 PM, Heiko Stübner wrote: Hi Stefan, Lee, Am Dienstag, 2. Oktober 2018, 09:38:29 CET schrieb Stefan Mavrodiev: RK805 has SLEEP signal, which can put the device into SLEEP or OFF mode. The default is SLEEP mode. However, when the kernel performs power-off (actually the ATF) the device will not go fully off and this will result in higher power consumption and inability to wake the device with RTC alarm. The solution is to enable pm_power_off_prepare function, which will configure SLEEP pin for OFF function. Signed-off-by: Stefan Mavrodiev just found this while cleaning my inbox and this change looks significant and it seems hasn't been applied yet. I guess this is still relevant, right? Yes, but I guess it's out-of-sync with the latest kernel. you could rebase and resend it :-) I would like to test it first. I'll resend the patch in couple of days (I hope so). PS: The previous email was from different mail address. Sorry about that. Stefan Mavrodiev --- drivers/mfd/rk808.c | 24 1 file changed, 24 insertions(+) diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index 216fbf6..50f3f78 100644 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -387,6 +387,25 @@ static void rk805_device_shutdown(void) dev_err(&rk808_i2c_client->dev, "power off error!\n"); } +static void rk805_device_shutdown_prepare(void) +{ + int ret; + struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client); + + if (!rk808) { + dev_warn(&rk808_i2c_client->dev, +"have no rk805, so do nothing here\n"); + + return; + } + + ret = regmap_update_bits(rk808->regmap, +RK805_GPIO_IO_POL_REG, +SLP_SD_MSK, SHUTDOWN_FUN); + if (ret) + dev_err(&rk808_i2c_client->dev, "power off error!\n"); +} + static void rk808_device_shutdown(void) { int ret; @@ -549,6 +568,10 @@ static int rk808_probe(struct i2c_client *client, if (pm_off && !pm_power_off) { rk808_i2c_client = client; pm_power_off = pm_pwroff_fn; + } else if (pm_off && !pm_power_off_prepare && + rk808->variant == RK805_ID) { + rk808_i2c_client = client; + pm_power_off_prepare = rk805_device_shutdown_prepare; } return 0; @@ -564,6 +587,7 @@ static int rk808_remove(struct i2c_client *client) regmap_del_irq_chip(client->irq, rk808->irq_data); pm_power_off = NULL; + pm_power_off_prepare = NULL; return 0; }
Re: [PATCH 1/1] mfd: rk808: Prepare rk805 for poweroff
On 1/9/19 3:07 PM, Heiko Stübner wrote: Hi Stefan, Lee, Am Dienstag, 2. Oktober 2018, 09:38:29 CET schrieb Stefan Mavrodiev: RK805 has SLEEP signal, which can put the device into SLEEP or OFF mode. The default is SLEEP mode. However, when the kernel performs power-off (actually the ATF) the device will not go fully off and this will result in higher power consumption and inability to wake the device with RTC alarm. The solution is to enable pm_power_off_prepare function, which will configure SLEEP pin for OFF function. Signed-off-by: Stefan Mavrodiev just found this while cleaning my inbox and this change looks significant and it seems hasn't been applied yet. I guess this is still relevant, right? Yes, but I guess it's out-of-sync with the latest kernel. Heiko --- drivers/mfd/rk808.c | 24 1 file changed, 24 insertions(+) diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index 216fbf6..50f3f78 100644 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -387,6 +387,25 @@ static void rk805_device_shutdown(void) dev_err(&rk808_i2c_client->dev, "power off error!\n"); } +static void rk805_device_shutdown_prepare(void) +{ + int ret; + struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client); + + if (!rk808) { + dev_warn(&rk808_i2c_client->dev, +"have no rk805, so do nothing here\n"); + + return; + } + + ret = regmap_update_bits(rk808->regmap, +RK805_GPIO_IO_POL_REG, +SLP_SD_MSK, SHUTDOWN_FUN); + if (ret) + dev_err(&rk808_i2c_client->dev, "power off error!\n"); +} + static void rk808_device_shutdown(void) { int ret; @@ -549,6 +568,10 @@ static int rk808_probe(struct i2c_client *client, if (pm_off && !pm_power_off) { rk808_i2c_client = client; pm_power_off = pm_pwroff_fn; + } else if (pm_off && !pm_power_off_prepare && + rk808->variant == RK805_ID) { + rk808_i2c_client = client; + pm_power_off_prepare = rk805_device_shutdown_prepare; } return 0; @@ -564,6 +587,7 @@ static int rk808_remove(struct i2c_client *client) regmap_del_irq_chip(client->irq, rk808->irq_data); pm_power_off = NULL; + pm_power_off_prepare = NULL; return 0; }
[PATCH 1/1] mfd: rk808: Prepare rk805 for poweroff
RK805 has SLEEP signal, which can put the device into SLEEP or OFF mode. The default is SLEEP mode. However, when the kernel performs power-off (actually the ATF) the device will not go fully off and this will result in higher power consumption and inability to wake the device with RTC alarm. The solution is to enable pm_power_off_prepare function, which will configure SLEEP pin for OFF function. Signed-off-by: Stefan Mavrodiev --- drivers/mfd/rk808.c | 24 1 file changed, 24 insertions(+) diff --git a/drivers/mfd/rk808.c b/drivers/mfd/rk808.c index 216fbf6..50f3f78 100644 --- a/drivers/mfd/rk808.c +++ b/drivers/mfd/rk808.c @@ -387,6 +387,25 @@ static void rk805_device_shutdown(void) dev_err(&rk808_i2c_client->dev, "power off error!\n"); } +static void rk805_device_shutdown_prepare(void) +{ + int ret; + struct rk808 *rk808 = i2c_get_clientdata(rk808_i2c_client); + + if (!rk808) { + dev_warn(&rk808_i2c_client->dev, +"have no rk805, so do nothing here\n"); + + return; + } + + ret = regmap_update_bits(rk808->regmap, +RK805_GPIO_IO_POL_REG, +SLP_SD_MSK, SHUTDOWN_FUN); + if (ret) + dev_err(&rk808_i2c_client->dev, "power off error!\n"); +} + static void rk808_device_shutdown(void) { int ret; @@ -549,6 +568,10 @@ static int rk808_probe(struct i2c_client *client, if (pm_off && !pm_power_off) { rk808_i2c_client = client; pm_power_off = pm_pwroff_fn; + } else if (pm_off && !pm_power_off_prepare && + rk808->variant == RK805_ID) { + rk808_i2c_client = client; + pm_power_off_prepare = rk805_device_shutdown_prepare; } return 0; @@ -564,6 +587,7 @@ static int rk808_remove(struct i2c_client *client) regmap_del_irq_chip(client->irq, rk808->irq_data); pm_power_off = NULL; + pm_power_off_prepare = NULL; return 0; } -- 2.7.4
[PATCH v2 1/1] mmc: sunxi: Disable irq during pm_suspend
When mmc host controller enters suspend state, the clocks are disabled, but irqs are not. For some reason the irqchip emits false interrupts, which causes system lock loop. Debug log is: ... sunxi-mmc 1c11000.mmc: setting clk to 5200, rounded 5120 sunxi-mmc 1c11000.mmc: enabling the clock sunxi-mmc 1c11000.mmc: cmd 13(814d) arg 1 ie 0xbbc6 len 0 sunxi-mmc 1c11000.mmc: irq: rq (ptrval) mi 0004 idi sunxi-mmc 1c11000.mmc: cmd 6(8146) arg 3210101 ie 0xbbc6 len 0 sunxi-mmc 1c11000.mmc: irq: rq (ptrval) mi 0004 idi sunxi-mmc 1c11000.mmc: cmd 13(814d) arg 1 ie 0xbbc6 len 0 sunxi-mmc 1c11000.mmc: irq: rq (ptrval) mi 0004 idi mmc1: new DDR MMC card at address 0001 mmcblk1: mmc1:0001 AGND3R 14.6 GiB mmcblk1boot0: mmc1:0001 AGND3R partition 1 4.00 MiB mmcblk1boot1: mmc1:0001 AGND3R partition 2 4.00 MiB sunxi-mmc 1c11000.mmc: cmd 18(80003352) arg 0 ie 0xfbc2 len 409 sunxi-mmc 1c11000.mmc: irq: rq (ptrval) mi 4000 idi 0002 mmcblk1: p1 sunxi-mmc 1c11000.mmc: irq: rq (null) mi idi sunxi-mmc 1c11000.mmc: irq: rq (null) mi idi sunxi-mmc 1c11000.mmc: irq: rq (null) mi idi sunxi-mmc 1c11000.mmc: irq: rq (null) mi idi and so on... This issue apears on eMMC cards, routed on MMC2 slot. The patch is tested with A20-OLinuXino-MICRO/LIME/LIME2 boards. Fixes: 9a8e1e8cc2c0 ("mmc: sunxi: Add runtime_pm support") Signed-off-by: Stefan Mavrodiev --- Changes in v2: - Add comment why disable_irq() is necessary --- drivers/mmc/host/sunxi-mmc.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c index e747259..8e7f3e3 100644 --- a/drivers/mmc/host/sunxi-mmc.c +++ b/drivers/mmc/host/sunxi-mmc.c @@ -1446,6 +1446,7 @@ static int sunxi_mmc_runtime_resume(struct device *dev) sunxi_mmc_init_host(host); sunxi_mmc_set_bus_width(host, mmc->ios.bus_width); sunxi_mmc_set_clk(host, &mmc->ios); + enable_irq(host->irq); return 0; } @@ -1455,6 +1456,12 @@ static int sunxi_mmc_runtime_suspend(struct device *dev) struct mmc_host *mmc = dev_get_drvdata(dev); struct sunxi_mmc_host *host = mmc_priv(mmc); + /* +* When clocks are off, it's possible receiving +* fake interrupts, which will stall the system. +* Disabling the irq will prevent this. +*/ + disable_irq(host->irq); sunxi_mmc_reset_host(host); sunxi_mmc_disable(host); -- 2.7.4
[PATCH 1/1] mmc: sunxi: Disable irq during pm_suspend
When mmc host controller enters suspend state, the clocks are disabled, but irqs are not. For some reason the irqchip emmits false interrupts, which causes system lock loop. Debug log is: ... sunxi-mmc 1c11000.mmc: setting clk to 5200, rounded 5120 sunxi-mmc 1c11000.mmc: enabling the clock sunxi-mmc 1c11000.mmc: cmd 13(814d) arg 1 ie 0xbbc6 len 0 sunxi-mmc 1c11000.mmc: irq: rq (ptrval) mi 0004 idi sunxi-mmc 1c11000.mmc: cmd 6(8146) arg 3210101 ie 0xbbc6 len 0 sunxi-mmc 1c11000.mmc: irq: rq (ptrval) mi 0004 idi sunxi-mmc 1c11000.mmc: cmd 13(814d) arg 1 ie 0xbbc6 len 0 sunxi-mmc 1c11000.mmc: irq: rq (ptrval) mi 0004 idi mmc1: new DDR MMC card at address 0001 mmcblk1: mmc1:0001 AGND3R 14.6 GiB mmcblk1boot0: mmc1:0001 AGND3R partition 1 4.00 MiB mmcblk1boot1: mmc1:0001 AGND3R partition 2 4.00 MiB sunxi-mmc 1c11000.mmc: cmd 18(80003352) arg 0 ie 0xfbc2 len 409 sunxi-mmc 1c11000.mmc: irq: rq (ptrval) mi 4000 idi 0002 mmcblk1: p1 sunxi-mmc 1c11000.mmc: irq: rq (null) mi idi sunxi-mmc 1c11000.mmc: irq: rq (null) mi idi sunxi-mmc 1c11000.mmc: irq: rq (null) mi idi sunxi-mmc 1c11000.mmc: irq: rq (null) mi idi and so on... This issue apears on eMMC cards, routed on MMC2 slot. The patch is tested with A20-OLinuXino-MICRO/LIME/LIME2 boards. Fixes: 9a8e1e8cc2c0 ("mmc: sunxi: Add runtime_pm support") Signed-off-by: Stefan Mavrodiev --- drivers/mmc/host/sunxi-mmc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c index e747259..acae7a8 100644 --- a/drivers/mmc/host/sunxi-mmc.c +++ b/drivers/mmc/host/sunxi-mmc.c @@ -1446,6 +1446,7 @@ static int sunxi_mmc_runtime_resume(struct device *dev) sunxi_mmc_init_host(host); sunxi_mmc_set_bus_width(host, mmc->ios.bus_width); sunxi_mmc_set_clk(host, &mmc->ios); + enable_irq(host->irq); return 0; } @@ -1455,6 +1456,7 @@ static int sunxi_mmc_runtime_suspend(struct device *dev) struct mmc_host *mmc = dev_get_drvdata(dev); struct sunxi_mmc_host *host = mmc_priv(mmc); + disable_irq(host->irq); sunxi_mmc_reset_host(host); sunxi_mmc_disable(host); -- 2.7.4
Re: [PATCH 1/1] ARM:dts:sunxi: Add Olimex A20-SOM-EVB-eMMC board
On 05/17/2018 10:25 AM, Stefan Wahren wrote: Hi Stefan, Stefan Mavrodiev hat am 16. Mai 2018 um 13:38 geschrieben: With the new rev.E of A20-SOM-EVB, there is option for 16GB eMMC. Currently used card is KLMAG2GEND, wired to MMC2 slot. Signed-off-by: Stefan Mavrodiev --- arch/arm/boot/dts/Makefile | 1 + .../arm/boot/dts/sun7i-a20-olimex-som-evb-emmc.dts | 37 ++ 2 files changed, 38 insertions(+) create mode 100644 arch/arm/boot/dts/sun7i-a20-olimex-som-evb-emmc.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 1db91ec..7f1ee65 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -959,6 +959,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \ sun7i-a20-m3.dtb \ sun7i-a20-mk808c.dtb \ sun7i-a20-olimex-som-evb.dtb \ + sun7i-a20-olimex-som-evb-emmc.dtb \ sun7i-a20-olimex-som204-evb.dtb \ sun7i-a20-olimex-som204-evb-emmc.dtb \ sun7i-a20-olinuxino-lime.dtb \ diff --git a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb-emmc.dts b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb-emmc.dts new file mode 100644 index 000..81ebc97 --- /dev/null +++ b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb-emmc.dts @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Device Tree Source for A20-Olimex-SOM-EVB-eMMC Board + * + * Copyright (C) 2018 Olimex Ltd. + * Author: Stefan Mavrodiev + */ + +/dts-v1/; +#include "sun7i-a20-olimex-som-evb.dts" + +/ { + + model = "Olimex A20-Olimex-SOM-EVB-eMMC"; + compatible = "olimex,a20-olimex-som-evb-emmc", "allwinner,sun7i-a20"; the file Documentation/devicetree/bindings/arm/olimex.txt seems to be out of date. I cannot find any recent board compatible. Didn't checkpatch complain about it? Yes it did. I didn't get is seriously because neither Olimex A20 based board is documented in the binding. Regards Stefan Regards, Stefan Mavrodiev
[PATCH 1/1] ARM:dts:sunxi: Add Olimex A20-SOM-EVB-eMMC board
With the new rev.E of A20-SOM-EVB, there is option for 16GB eMMC. Currently used card is KLMAG2GEND, wired to MMC2 slot. Signed-off-by: Stefan Mavrodiev --- arch/arm/boot/dts/Makefile | 1 + .../arm/boot/dts/sun7i-a20-olimex-som-evb-emmc.dts | 37 ++ 2 files changed, 38 insertions(+) create mode 100644 arch/arm/boot/dts/sun7i-a20-olimex-som-evb-emmc.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 1db91ec..7f1ee65 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -959,6 +959,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \ sun7i-a20-m3.dtb \ sun7i-a20-mk808c.dtb \ sun7i-a20-olimex-som-evb.dtb \ + sun7i-a20-olimex-som-evb-emmc.dtb \ sun7i-a20-olimex-som204-evb.dtb \ sun7i-a20-olimex-som204-evb-emmc.dtb \ sun7i-a20-olinuxino-lime.dtb \ diff --git a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb-emmc.dts b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb-emmc.dts new file mode 100644 index 000..81ebc97 --- /dev/null +++ b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb-emmc.dts @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Device Tree Source for A20-Olimex-SOM-EVB-eMMC Board + * + * Copyright (C) 2018 Olimex Ltd. + * Author: Stefan Mavrodiev + */ + +/dts-v1/; +#include "sun7i-a20-olimex-som-evb.dts" + +/ { + + model = "Olimex A20-Olimex-SOM-EVB-eMMC"; + compatible = "olimex,a20-olimex-som-evb-emmc", "allwinner,sun7i-a20"; + + mmc2_pwrseq: mmc2_pwrseq { + compatible = "mmc-pwrseq-emmc"; + reset-gpios = <&pio 2 18 GPIO_ACTIVE_LOW>; + }; +}; + +&mmc2 { + pinctrl-names = "default"; + pinctrl-0 = <&mmc2_pins_a>; + vmmc-supply = <®_vcc3v3>; + mmc-pwrseq = <&mmc2_pwrseq>; + bus-width = <4>; + non-removable; + status = "okay"; + + emmc: emmc@0 { + reg = <0>; + compatible = "mmc-card"; + broken-hpi; + }; +}; -- 2.7.4
[PATCH v2 2/2] ARM: dts: sunxi: Add Olimex A20-SOM204-EVB-eMMC board
A20-SOM204 board has option with onboard 16GB eMMC. The chip is wired to MMC2 slot. Signed-off-by: Stefan Mavrodiev --- Changes for v2: - Replaced license header with SPDX-License-Identifier arch/arm/boot/dts/Makefile | 1 + .../boot/dts/sun7i-a20-olimex-som204-evb-emmc.dts | 36 ++ 2 files changed, 37 insertions(+) create mode 100644 arch/arm/boot/dts/sun7i-a20-olimex-som204-evb-emmc.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index d88f04d..c890042 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -919,6 +919,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \ sun7i-a20-mk808c.dtb \ sun7i-a20-olimex-som-evb.dtb \ sun7i-a20-olimex-som204-evb.dtb \ + sun7i-a20-olimex-som204-evb-emmc.dtb \ sun7i-a20-olinuxino-lime.dtb \ sun7i-a20-olinuxino-lime2.dtb \ sun7i-a20-olinuxino-lime2-emmc.dtb \ diff --git a/arch/arm/boot/dts/sun7i-a20-olimex-som204-evb-emmc.dts b/arch/arm/boot/dts/sun7i-a20-olimex-som204-evb-emmc.dts new file mode 100644 index 000..c56620a --- /dev/null +++ b/arch/arm/boot/dts/sun7i-a20-olimex-som204-evb-emmc.dts @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Device Tree Source for A20-SOM204-EVB-eMMC Board + * + * Copyright (C) 2018 Olimex Ltd. + * Author: Stefan Mavrodiev + */ + +/dts-v1/; +#include "sun7i-a20-olimex-som204-evb.dts" + +/ { + model = "Olimex A20-SOM204-EVB-eMMC"; + compatible = "olimex,a20-olimex-som204-evb-emmc", "allwinner,sun7i-a20"; + + mmc2_pwrseq: mmc2_pwrseq { + compatible = "mmc-pwrseq-emmc"; + reset-gpios = <&pio 2 16 GPIO_ACTIVE_LOW>; + }; +}; + +&mmc2 { + pinctrl-names = "default"; + pinctrl-0 = <&mmc2_pins_a>; + vmmc-supply = <®_vcc3v3>; + mmc-pwrseq = <&mmc2_pwrseq>; + bus-width = <4>; + non-removable; + status = "okay"; + + emmc: emmc@0 { + reg = <0>; + compatible = "mmc-card"; + broken-hpi; + }; +}; -- 2.7.4
[PATCH v2 1/2] ARM: dts: sunxi: Add Olimex A20-SOM204-EVB board
This is new System-On-Module platform with universal dimm socket for easy insertation. The EVB board is designed to be universal with future modules. Product page is located here [1]. There are two dts files - one for base model and another for eMMC variant. Base features of A20-SOM204 board includes: * 1GB DDR3 RAM * AXP209 PMU * KSZ9031 Gigabit PHY * AT24C16 EEPROM * Status LED * LCD connector * GPIO connector There will be variants with the following options: * Second LAN8710A Megabit PHY * 16MB SPI Flash memory * eMMC card * ATECC508 crypto device The EVB board has: * Debug UART * MicroSD card connector * USB-OTG connector * Two USB host * RTL8723BS WiFi/BT combo * IrDA transceiver/receiver * HDMI connector * VGA connector * Megabit ethernet transceiver * Gigabit ethernet transceiver * SATA connector * CAN driver * CSI camera * MIC and HP connectors * PCIe x4 connector * USB3 connector * Two UEXT connectors * Two user LEDs Some of the features are multiplexed and cannot be used the same time: CAN and Megabit PHY. Others are not usable with A20 SoC: PCIe and USB3. [1] https://www.olimex.com/Products/SOM204/ Signed-off-by: Stefan Mavrodiev --- Changes for v2: - Replace license header with SPDX-License-Identifier - Removed useless pinctrl child nodes - Removed dual reset for RTL8723BS: Bluetooth reset will be performed in userspace - Renamed all leds with same prefix - Removed duplicate nodes with eMMC dts - Removed IR_TX pin - Add some comm arch/arm/boot/dts/Makefile| 1 + arch/arm/boot/dts/sun7i-a20-olimex-som204-evb.dts | 335 ++ 2 files changed, 336 insertions(+) create mode 100644 arch/arm/boot/dts/sun7i-a20-olimex-som204-evb.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index d0381e9..d88f04d 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -918,6 +918,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \ sun7i-a20-m3.dtb \ sun7i-a20-mk808c.dtb \ sun7i-a20-olimex-som-evb.dtb \ + sun7i-a20-olimex-som204-evb.dtb \ sun7i-a20-olinuxino-lime.dtb \ sun7i-a20-olinuxino-lime2.dtb \ sun7i-a20-olinuxino-lime2-emmc.dtb \ diff --git a/arch/arm/boot/dts/sun7i-a20-olimex-som204-evb.dts b/arch/arm/boot/dts/sun7i-a20-olimex-som204-evb.dts new file mode 100644 index 000..eae8e26 --- /dev/null +++ b/arch/arm/boot/dts/sun7i-a20-olimex-som204-evb.dts @@ -0,0 +1,335 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/* + * Device Tree Source for A20-SOM204-EVB Board + * + * Copyright (C) 2018 Olimex Ltd. + * Author: Stefan Mavrodiev + */ + +/dts-v1/; +#include "sun7i-a20.dtsi" +#include "sunxi-common-regulators.dtsi" + + +#include +#include +#include + +/ { + model = "Olimex A20-SOM204-EVB"; + compatible = "olimex,a20-olimex-som204-evb", "allwinner,sun7i-a20"; + + aliases { + serial0 = &uart0; + serial1 = &uart4; + serial2 = &uart7; + spi0 = &spi1; + spi1 = &spi2; + ethernet1 = &rtl8723bs; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + hdmi-connector { + compatible = "hdmi-connector"; + type = "a"; + + port { + hdmi_con_in: endpoint { + remote-endpoint = <&hdmi_out_con>; + }; + }; + }; + + leds { + compatible = "gpio-leds"; + + stat { + label = "a20-som204-evb:green:stat"; + gpios = <&pio 8 0 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + led1 { + label = "a20-som204-evb:green:led1"; + gpios = <&pio 8 10 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + led2 { + label = "a20-som204-evb:yellow:led2"; + gpios = <&pio 8 11 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + }; + + rtl_pwrseq: rtl_pwrseq { + compatible = "mmc-pwrseq-simple"; + reset-gpios = <&pio 6 9 GPIO_ACTIVE_LOW>; + }; +}; + +&ahci { + target-supply = <®_ahci_5v>; + status = "okay"; +}; + +&can0 { + pinctrl-names = "default"
Re: [PATCH 1/1] ARM: dts: sunxi: Add Olimex A20-SOM204-EVB board
On 01/20/2018 08:08 AM, Chen-Yu Tsai wrote: On Fri, Jan 19, 2018 at 9:27 PM, Stefan Mavrodiev wrote: On 01/18/2018 04:28 PM, Chen-Yu Tsai wrote: On Thu, Jan 18, 2018 at 6:07 PM, Maxime Ripard wrote: Hi! On Mon, Jan 15, 2018 at 12:07:34PM +0200, Stefan Mavrodiev wrote: +/dts-v1/; +#include "sun7i-a20.dtsi" +#include "sunxi-common-regulators.dtsi" + + +#include +#include +#include + +/ { + model = "Olimex A20-SOM204-EVB"; + compatible = "olimex,a20-olimex-som204-evb", "allwinner,sun7i-a20"; + + aliases { + serial0 = &uart0; + serial1 = &uart4; + serial2 = &uart7; + spi0 = &spi1; + spi1 = &spi2; + ethernet1 = &rtl8723bs; ethernet1? if there's a single network interface, it should be ethernet0. I think this will conflict the gmac alias defined in sun7i-a20.dtsi: aliases { ethernet0 = &gmac; }; We have that? That's bad, but you're right :) + stat { + label = "a20-som204:green:stat"; + gpios = <&pio 8 0 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + led1 { + label = "a20-som204-evb:green:led1"; + gpios = <&pio 8 10 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + led2 { + label = "a20-som204-evb:yellow:led2"; + gpios = <&pio 8 11 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; You don't have the same prefix between stat and led1/led2. I'm fine with both, but you should be consistent :) STAT led is on the SOM204 module, while led1/2 on the EVB. Thats why they have different prefix. Still, the user and the system will see it as a single board, and the documentation states that it should be the board name. I'm not quite sure what a good rule would be here. Have you looked at how other boards dealt with it? Chen-Yu, any opinion on this? Follow the bindings, I guess? I don't think we (sunxi) have dealt with modules that have LEDs or anything that needs to be named after the board. On a related topic, I don't know if you (Stefan / Olimex) want to split this into a .dtsi file for the SoM, and a .dts file for the EVB. It might help your customers? I'm not sure this will be good ideal. We will have one EVB with all possible peripheries. On the other hand, we are planning 3-4 different SOM204 modules (A20, A64, RK). I think this will make the dtsi incompatible. Yes. That was what I mentioned in the second half of my reply. Maybe if there is one dtsi for the base SOM204 module (one for each arch) and multiple dts for boards with additional features. But this will generate 10-20 dts files. I think this will be better handled using overlays in the uboot. OK. I'm guessing there's the possibility that some pins or GPIOs get muxed to different functions depending on what base board is used? How would you list them, if you only had one .dts file, say for the EVB? Clearly the SoM cannot work by itself, so it probably doesn't get its own .dts file. Yes, the SoM cannot work by itself. I'm thinking to follow the current practice: - One dts for base board + evb - One dts for the above + eMMC. There is also possibility (a real one) some periphery to work with one SoM, and other - not. For example A20-SOM204 or A64-SOM204 doesn't have PCIe support, but RK-SOM204 will. On second re-read of the comments: +}; + +&ahci { + target-supply = <®_ahci_5v>; You should use the regulators you defined in your PMIC there. The power comes from the DC jack not from PCIM. In this case, is this OK? +&usb_otg { + dr_mode = "otg"; + status = "okay"; +}; + +&usb_power_supply { + status = "okay"; +}; + +&usbphy { + pinctrl-names = "default"; + pinctrl-0 = <&usb0_id_detect_pin>, + <&usb0_vbus_detect_pin>; + usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */ + usb0_vbus_det-gpio = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */ + usb0_vbus_power-supply = <&usb_power_supply>; + usb0_vbus-supply = <®_usb0_vbus>; + usb1_vbus-supply = <®_usb1_vbus>; + usb2_vbus-supply = <®_usb2_vbus>; You should also use one of the PMIC regulators here. Same here. Power comes from DC jack, not PMIC. Regards, Stefan Mavrodiev About the leds, I'm ok to be named after full board name (a20-som204-evb). Cool. ChenYu I've tried it previously, and it helps in some ways when you're matching the files to the schematics. But it is confusing when you want the big picture. On the other hand, this is not going to help with supporting different modules on the same baseboard, as the routing, peripherals and labels likely won't match up. Just my two cents. ChenYu Regards, Stefan Mavrodiev
Re: [PATCH 1/1] ARM: dts: sunxi: Add Olimex A20-SOM204-EVB board
On 01/18/2018 04:28 PM, Chen-Yu Tsai wrote: On Thu, Jan 18, 2018 at 6:07 PM, Maxime Ripard wrote: Hi! On Mon, Jan 15, 2018 at 12:07:34PM +0200, Stefan Mavrodiev wrote: +/dts-v1/; +#include "sun7i-a20.dtsi" +#include "sunxi-common-regulators.dtsi" + + +#include +#include +#include + +/ { + model = "Olimex A20-SOM204-EVB"; + compatible = "olimex,a20-olimex-som204-evb", "allwinner,sun7i-a20"; + + aliases { + serial0 = &uart0; + serial1 = &uart4; + serial2 = &uart7; + spi0 = &spi1; + spi1 = &spi2; + ethernet1 = &rtl8723bs; ethernet1? if there's a single network interface, it should be ethernet0. I think this will conflict the gmac alias defined in sun7i-a20.dtsi: aliases { ethernet0 = &gmac; }; We have that? That's bad, but you're right :) + stat { + label = "a20-som204:green:stat"; + gpios = <&pio 8 0 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + led1 { + label = "a20-som204-evb:green:led1"; + gpios = <&pio 8 10 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; + + led2 { + label = "a20-som204-evb:yellow:led2"; + gpios = <&pio 8 11 GPIO_ACTIVE_HIGH>; + default-state = "on"; + }; You don't have the same prefix between stat and led1/led2. I'm fine with both, but you should be consistent :) STAT led is on the SOM204 module, while led1/2 on the EVB. Thats why they have different prefix. Still, the user and the system will see it as a single board, and the documentation states that it should be the board name. I'm not quite sure what a good rule would be here. Have you looked at how other boards dealt with it? Chen-Yu, any opinion on this? Follow the bindings, I guess? I don't think we (sunxi) have dealt with modules that have LEDs or anything that needs to be named after the board. On a related topic, I don't know if you (Stefan / Olimex) want to split this into a .dtsi file for the SoM, and a .dts file for the EVB. It might help your customers? I'm not sure this will be good ideal. We will have one EVB with all possible peripheries. On the other hand, we are planning 3-4 different SOM204 modules (A20, A64, RK). I think this will make the dtsi incompatible. Maybe if there is one dtsi for the base SOM204 module (one for each arch) and multiple dts for boards with additional features. But this will generate 10-20 dts files. I think this will be better handled using overlays in the uboot. About the leds, I'm ok to be named after full board name (a20-som204-evb). I've tried it previously, and it helps in some ways when you're matching the files to the schematics. But it is confusing when you want the big picture. On the other hand, this is not going to help with supporting different modules on the same baseboard, as the routing, peripherals and labels likely won't match up. Just my two cents. ChenYu Regards, Stefan Mavrodiev
Re: [PATCH 1/1] ARM: dts: sunxi: Add Olimex A20-SOM204-EVB board
On 01/15/2018 11:50 AM, Maxime Ripard wrote: Hi Stefan, On Fri, Jan 12, 2018 at 11:01:05AM +0200, Stefan Mavrodiev wrote: This is new System-On-Module platform with universal dimm socket for easy insertation. The EVB board is designed to be universal with future modules. Product page is located here [1]. There are two dts files - one for base model and another for eMMC variant. Base features of A20-SOM204 board includes: * 1GB DDR3 RAM * AXP209 PMU * KSZ9031 Gigabit PHY * AT24C16 EEPROM * Status LED * LCD connector * GPIO connector There will be variants with the following options: * Second LAN8710A Megabit PHY * 16MB SPI Flash memory * eMMC card * ATECC508 crypto device The EVB board has: * Debug UART * MicroSD card connector * USB-OTG connector * Two USB host * RTL8723BS WiFi/BT combo * IrDA transceiver/receiver * HDMI connector * VGA connector * Megabit ethernet transceiver * Gigabit ethernet transceiver * SATA connector * CAN driver * CSI camera * MIC and HP connectors * PCIe x4 connector * USB3 connector * Two UEXT connectors * Two user LEDs Some of the features are multiplexed and cannot be used the same time: CAN and Megabit PHY. Others are not usable with A20 SoC: PCIe and USB3. [1] https://www.olimex.com/Products/SOM204/ Signed-off-by: Stefan Mavrodiev --- arch/arm/boot/dts/Makefile | 2 + .../boot/dts/sun7i-a20-olimex-som204-evb-emmc.dts | 70 arch/arm/boot/dts/sun7i-a20-olimex-som204-evb.dts | 392 + 3 files changed, 464 insertions(+) create mode 100644 arch/arm/boot/dts/sun7i-a20-olimex-som204-evb-emmc.dts create mode 100644 arch/arm/boot/dts/sun7i-a20-olimex-som204-evb.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index d0381e9..c890042 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -918,6 +918,8 @@ dtb-$(CONFIG_MACH_SUN7I) += \ sun7i-a20-m3.dtb \ sun7i-a20-mk808c.dtb \ sun7i-a20-olimex-som-evb.dtb \ + sun7i-a20-olimex-som204-evb.dtb \ + sun7i-a20-olimex-som204-evb-emmc.dtb \ Ideally, you should split that patch into two, one to introduce the base board and the second one for the emmc. sun7i-a20-olinuxino-lime.dtb \ sun7i-a20-olinuxino-lime2.dtb \ sun7i-a20-olinuxino-lime2-emmc.dtb \ diff --git a/arch/arm/boot/dts/sun7i-a20-olimex-som204-evb-emmc.dts b/arch/arm/boot/dts/sun7i-a20-olimex-som204-evb-emmc.dts new file mode 100644 index 000..97c4824 --- /dev/null +++ b/arch/arm/boot/dts/sun7i-a20-olimex-som204-evb-emmc.dts @@ -0,0 +1,70 @@ +/* + * Copyright 2018 - Stefan Mavrodiev + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This file is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ Could you use the SPDX header, as the first line, // SPDX-License-Identifier: (GPL-2.0+ OR MIT) instead? And then, you can drop the l
[PATCH 1/1] ARM: dts: sunxi: Add Olimex A20-SOM204-EVB board
This is new System-On-Module platform with universal dimm socket for easy insertation. The EVB board is designed to be universal with future modules. Product page is located here [1]. There are two dts files - one for base model and another for eMMC variant. Base features of A20-SOM204 board includes: * 1GB DDR3 RAM * AXP209 PMU * KSZ9031 Gigabit PHY * AT24C16 EEPROM * Status LED * LCD connector * GPIO connector There will be variants with the following options: * Second LAN8710A Megabit PHY * 16MB SPI Flash memory * eMMC card * ATECC508 crypto device The EVB board has: * Debug UART * MicroSD card connector * USB-OTG connector * Two USB host * RTL8723BS WiFi/BT combo * IrDA transceiver/receiver * HDMI connector * VGA connector * Megabit ethernet transceiver * Gigabit ethernet transceiver * SATA connector * CAN driver * CSI camera * MIC and HP connectors * PCIe x4 connector * USB3 connector * Two UEXT connectors * Two user LEDs Some of the features are multiplexed and cannot be used the same time: CAN and Megabit PHY. Others are not usable with A20 SoC: PCIe and USB3. [1] https://www.olimex.com/Products/SOM204/ Signed-off-by: Stefan Mavrodiev --- arch/arm/boot/dts/Makefile | 2 + .../boot/dts/sun7i-a20-olimex-som204-evb-emmc.dts | 70 arch/arm/boot/dts/sun7i-a20-olimex-som204-evb.dts | 392 + 3 files changed, 464 insertions(+) create mode 100644 arch/arm/boot/dts/sun7i-a20-olimex-som204-evb-emmc.dts create mode 100644 arch/arm/boot/dts/sun7i-a20-olimex-som204-evb.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index d0381e9..c890042 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -918,6 +918,8 @@ dtb-$(CONFIG_MACH_SUN7I) += \ sun7i-a20-m3.dtb \ sun7i-a20-mk808c.dtb \ sun7i-a20-olimex-som-evb.dtb \ + sun7i-a20-olimex-som204-evb.dtb \ + sun7i-a20-olimex-som204-evb-emmc.dtb \ sun7i-a20-olinuxino-lime.dtb \ sun7i-a20-olinuxino-lime2.dtb \ sun7i-a20-olinuxino-lime2-emmc.dtb \ diff --git a/arch/arm/boot/dts/sun7i-a20-olimex-som204-evb-emmc.dts b/arch/arm/boot/dts/sun7i-a20-olimex-som204-evb-emmc.dts new file mode 100644 index 000..97c4824 --- /dev/null +++ b/arch/arm/boot/dts/sun7i-a20-olimex-som204-evb-emmc.dts @@ -0,0 +1,70 @@ +/* + * Copyright 2018 - Stefan Mavrodiev + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This file is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/dts-v1/; +#include "sun7i-a20-olimex-som204-evb.dts" + +/ { + model = "Olimex A20-SOM204-EVB-eMMC"; + compatible = "olimex,a20-olimex-som204-evb-emmc", "allwinner,sun7i-a20"; + + mmc2_pwrseq: mmc2_pwrseq { + compatible = "mmc-pwrseq-emmc"; + reset-gpios = <&pio 2 16
Re: [PATCH 1/1] arm: sunxi: Add alternative pins for spi0
On 12/18/2017 11:28 AM, Maxime Ripard wrote: On Mon, Dec 18, 2017 at 08:24:21AM +0200, Stefan Mavrodiev wrote: On 12/15/2017 05:08 PM, Maxime Ripard wrote: Hi, On Thu, Dec 14, 2017 at 08:24:54AM +0200, Stefan Mavrodiev wrote: On 12/13/2017 05:40 PM, Maxime Ripard wrote: Hi, On Wed, Dec 13, 2017 at 09:44:34AM +0200, Stefan Mavrodiev wrote: Allwinner A10/A13/A20 SoCs have pinmux for spi0 on port C. The patch adds these pins in the respective dts includes. Signed-off-by: Stefan Mavrodiev Do you have any boards that are using these? We won't merge that patch if there's no users for it. A20-OLinuXino-Lime/Lime2 and A10-OLinuXino-Lime with spi flash. For A13 we still doesn't have that option. If this bus is exposed on the headers, you can add those to the DT but leave them disabled if you want. Buf if there's no users of those nodes, our policy is not to merge them. So basically I should resend the patch, enabling the those pins only for sun4i and sun7i platform? I'm not quite sure what you mean, but you should do something like 77df9d66b0b1ad01c685fd6341ce501493899658 Maxime I guess, since this patch actually supports optional component, it shouldn't be applied. (This is already commented here: https://patchwork.kernel.org/patch/10076721/ ) Thanks, Stefan Mavrodiev
Re: [PATCH 1/1] arm: sunxi: Add alternative pins for spi0
On 12/15/2017 05:08 PM, Maxime Ripard wrote: Hi, On Thu, Dec 14, 2017 at 08:24:54AM +0200, Stefan Mavrodiev wrote: On 12/13/2017 05:40 PM, Maxime Ripard wrote: Hi, On Wed, Dec 13, 2017 at 09:44:34AM +0200, Stefan Mavrodiev wrote: Allwinner A10/A13/A20 SoCs have pinmux for spi0 on port C. The patch adds these pins in the respective dts includes. Signed-off-by: Stefan Mavrodiev Do you have any boards that are using these? We won't merge that patch if there's no users for it. A20-OLinuXino-Lime/Lime2 and A10-OLinuXino-Lime with spi flash. For A13 we still doesn't have that option. If this bus is exposed on the headers, you can add those to the DT but leave them disabled if you want. Buf if there's no users of those nodes, our policy is not to merge them. So basically I should resend the patch, enabling the those pins only for sun4i and sun7i platform? Thanks! Maxime Regards, Stefan Mavrodiev
Re: [PATCH 1/1] arm: sunxi: Add alternative pins for spi0
On 12/13/2017 05:40 PM, Maxime Ripard wrote: Hi, On Wed, Dec 13, 2017 at 09:44:34AM +0200, Stefan Mavrodiev wrote: Allwinner A10/A13/A20 SoCs have pinmux for spi0 on port C. The patch adds these pins in the respective dts includes. Signed-off-by: Stefan Mavrodiev Do you have any boards that are using these? We won't merge that patch if there's no users for it. Maxime A20-OLinuXino-Lime/Lime2 and A10-OLinuXino-Lime with spi flash. For A13 we still doesn't have that option.
[PATCH 1/1] arm: sunxi: Add alternative pins for spi0
Allwinner A10/A13/A20 SoCs have pinmux for spi0 on port C. The patch adds these pins in the respective dts includes. Signed-off-by: Stefan Mavrodiev --- arch/arm/boot/dts/sun4i-a10.dtsi | 10 ++ arch/arm/boot/dts/sun5i.dtsi | 10 ++ arch/arm/boot/dts/sun7i-a20.dtsi | 10 ++ 3 files changed, 30 insertions(+) diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi index 5840f5c..d835741 100644 --- a/arch/arm/boot/dts/sun4i-a10.dtsi +++ b/arch/arm/boot/dts/sun4i-a10.dtsi @@ -705,11 +705,21 @@ bias-pull-up; }; + spi0_pc_pins: spi0-pc-pins { + pins = "PC0", "PC1", "PC2"; + function = "spi0"; + }; + spi0_pi_pins: spi0-pi-pins { pins = "PI11", "PI12", "PI13"; function = "spi0"; }; + spi0_cs0_pc_pin: spi0-cs0-pc-pin { + pins = "PC23"; + function = "spi0"; + }; + spi0_cs0_pi_pin: spi0-cs0-pi-pin { pins = "PI10"; function = "spi0"; diff --git a/arch/arm/boot/dts/sun5i.dtsi b/arch/arm/boot/dts/sun5i.dtsi index 07f2248..9290e26 100644 --- a/arch/arm/boot/dts/sun5i.dtsi +++ b/arch/arm/boot/dts/sun5i.dtsi @@ -492,6 +492,16 @@ function = "nand0"; }; + spi0_pins_a: spi0@0 { + pins = "PC0", "PC1", "PC2"; + function = "spi0"; + }; + + spi0_cs0_pins_a: spi0-cs0@0 { + pins = "PC3"; + function = "spi0"; + }; + spi2_pins_a: spi2@0 { pins = "PE1", "PE2", "PE3"; function = "spi2"; diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi index 59655e4..6930527 100644 --- a/arch/arm/boot/dts/sun7i-a20.dtsi +++ b/arch/arm/boot/dts/sun7i-a20.dtsi @@ -838,11 +838,21 @@ function = "spi0"; }; + spi0_pins_b: spi0@1 { + pins = "PC0", "PC1", "PC2"; + function = "spi0"; + }; + spi0_cs0_pins_a: spi0_cs0@0 { pins = "PI10"; function = "spi0"; }; + spi0_cs0_pins_b: spi0_cs0@1 { + pins = "PC23"; + function = "spi0"; + }; + spi0_cs1_pins_a: spi0_cs1@0 { pins = "PI14"; function = "spi0"; -- 2.7.4
[PATCH 1/1] ARM: dts: sunxi: Update dts for A20-OLinuXino boards
There will be option with 16MB flash for the following boards: * A20-OLinuXino-MICRO Rev.K * A20-OLinuXino-LIME Rev.J * A20-OLinuXino-LIME2 Rev.J * A20-SOM-EVB Rev.E The used flash chip is Winbond W25Q128FV, which is connected to SPI0 port. Since this is optional feature, spi0 node is dissabled by default. Also this option is incompatible with NAND flash, so they shouldn't be enabled at the same time. Signed-off-by: Stefan Mavrodiev --- arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts | 14 ++ arch/arm/boot/dts/sun7i-a20-olinuxino-lime.dts | 14 ++ arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts | 14 ++ arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 14 ++ 4 files changed, 56 insertions(+) diff --git a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts index 64c8ef9..98b7697 100644 --- a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts +++ b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts @@ -291,6 +291,20 @@ status = "okay"; }; +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins_b>,<&spi0_cs0_pins_b>; + status = "disabled"; + + flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "winbond,w25q128","jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <4000>; + }; +}; + &spi1 { pinctrl-names = "default"; pinctrl-0 = <&spi1_pins_a>, diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-lime.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime.dts index edf9c3c..354af5d 100644 --- a/arch/arm/boot/dts/sun7i-a20-olinuxino-lime.dts +++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime.dts @@ -218,6 +218,20 @@ status = "okay"; }; +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins_b>,<&spi0_cs0_pins_b>; + status = "disabled"; + + flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "winbond,w25q128","jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <4000>; + }; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pins_a>; diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts index ba25018..6fcdd6e 100644 --- a/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts +++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2.dts @@ -268,6 +268,20 @@ status = "okay"; }; +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins_b>,<&spi0_cs0_pins_b>; + status = "disabled"; + + flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "winbond,w25q128","jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <4000>; + }; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pins_a>; diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts index dffbaa2..db85895 100644 --- a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts +++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts @@ -331,6 +331,20 @@ status = "okay"; }; +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins_b>,<&spi0_cs0_pins_b>; + status = "disabled"; + + flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "winbond,w25q128","jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <4000>; + }; +}; + &spi1 { pinctrl-names = "default"; pinctrl-0 = <&spi1_pins_a>, -- 2.7.4
Re: [PATCH v2 1/2] ARM: dts: sun7i: Fix A20-OLinuXino-MICRO dts for LAN8710
On 08/30/2017 05:37 PM, Maxime Ripard wrote: Hi, On Mon, Aug 28, 2017 at 09:32:42AM +0300, Stefan Mavrodiev wrote: From revision J the board uses new phy chip LAN8710. Compared with RTL8201, RA17 pin is TXERR. It has pullup which causes phy not to work. To fix this PA17 is muxed with GMAC function. This makes the pin output-low. This patch is compatible with earlier board revisions, since this pin wasn't connected to phy. Signed-off-by: Stefan Mavrodiev --- arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts index 0b7403e..cb1b081 100644 --- a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts +++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts @@ -102,7 +102,7 @@ &gmac { pinctrl-names = "default"; - pinctrl-0 = <&gmac_pins_mii_a>; + pinctrl-0 = <&gmac_pins_mii_a>,<&gmac_txerr>; phy = <&phy1>; phy-mode = "mii"; status = "okay"; @@ -229,6 +229,11 @@ }; &pio { + gmac_txerr: gmac_txerr@0 { + pins = "PA17"; + function = "gmac"; + }; + The patch looks fine, I still have one question though. Can a PHY operate without this signal? My real question is, would it make sense to mux that pin for all the users, or is it an optional signal that each board designer can choose to use or not? Thanks! Maxime This phy (LAN8710) cannot work without this pin. Part of the problem is in that we've replaced without paying attention to this signal. RTL8201 has no TXERR pin. The pin PA17 is used as reset signal and therefore is pulled up with resistor. However on old revisions this option (there is jumper pad between SOC and PHY). As I said, LAN8710 cannot work without this signal. In the datasheet is written: ... The controller drives TXER high when a transmit error is detected. ... In the current variant of the dts, all data is threated as error. So to answer you question. This is feature only on our board and highly depends on the chosen PHY. I don't think this should be muxed for all users. Best regards, Stefan Mavrodiev, Olimex Ltd.
[PATCH v2 2/2] ARM: dts: sun7i: Add dts file for A20-OLinuXino-MICRO-eMMC
A20-OLinuXino-MICRO has option with onboard eMMC chip. For now it's only shipped with 4BG chip, but in the future this may change. Signed-off-by: Stefan Mavrodiev --- arch/arm/boot/dts/Makefile | 1 + .../boot/dts/sun7i-a20-olinuxino-micro-emmc.dts| 70 ++ 2 files changed, 71 insertions(+) create mode 100644 arch/arm/boot/dts/sun7i-a20-olinuxino-micro-emmc.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 4b17f35..e1d1e93 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -880,6 +880,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \ sun7i-a20-olinuxino-lime2.dtb \ sun7i-a20-olinuxino-lime2-emmc.dtb \ sun7i-a20-olinuxino-micro.dtb \ + sun7i-a20-olinuxino-micro-emmc.dtb \ sun7i-a20-orangepi.dtb \ sun7i-a20-orangepi-mini.dtb \ sun7i-a20-pcduino3.dtb \ diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro-emmc.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro-emmc.dts new file mode 100644 index 000..d99e7b1 --- /dev/null +++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro-emmc.dts @@ -0,0 +1,70 @@ + /* + * Copyright 2017 Olimex Ltd. + * Stefan Mavrodiev + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This file is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "sun7i-a20-olinuxino-micro.dts" + +/ { + model = "Olimex A20-OLinuXino-MICRO-eMMC"; + compatible = "olimex,a20-olinuxino-micro-emmc", "allwinner,sun7i-a20"; + + mmc2_pwrseq: pwrseq { + compatible = "mmc-pwrseq-emmc"; + reset-gpios = <&pio 2 16 GPIO_ACTIVE_LOW>; + }; +}; + +&mmc2 { + pinctrl-names = "default"; + pinctrl-0 = <&mmc2_pins_a>; + vmmc-supply = <®_vcc3v3>; + bus-width = <4>; + non-removable; + mmc-pwrseq = <&mmc2_pwrseq>; + status = "okay"; + + emmc: emmc@0 { + reg = <0>; + compatible = "mmc-card"; + broken-hpi; + }; +}; -- 2.7.4
[PATCH v2 1/2] ARM: dts: sun7i: Fix A20-OLinuXino-MICRO dts for LAN8710
>From revision J the board uses new phy chip LAN8710. Compared with RTL8201, RA17 pin is TXERR. It has pullup which causes phy not to work. To fix this PA17 is muxed with GMAC function. This makes the pin output-low. This patch is compatible with earlier board revisions, since this pin wasn't connected to phy. Signed-off-by: Stefan Mavrodiev --- arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts index 0b7403e..cb1b081 100644 --- a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts +++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts @@ -102,7 +102,7 @@ &gmac { pinctrl-names = "default"; - pinctrl-0 = <&gmac_pins_mii_a>; + pinctrl-0 = <&gmac_pins_mii_a>,<&gmac_txerr>; phy = <&phy1>; phy-mode = "mii"; status = "okay"; @@ -229,6 +229,11 @@ }; &pio { + gmac_txerr: gmac_txerr@0 { + pins = "PA17"; + function = "gmac"; + }; + mmc3_cd_pin_olinuxinom: mmc3_cd_pin@0 { pins = "PH11"; function = "gpio_in"; -- 2.7.4
[PATCH v2 0/2] Update board support for A20-OLinuXino-MICRO
>From rev.J of A20-OLinuXino-MICRO, the board has new PHY chip (LAN8710) which replace RTL8201. Also there is option for 4GB eMMC chip. Changes in v2: * Remove pinctrl request for eMMC reset pin * Dump the idea of renaming boards with emmc * Using txerr as gmac function Stefan Mavrodiev (2): ARM: dts: sun7i: Fix A20-OLinuXino-MICRO dts for LAN8710 ARM: dts: sun7i: Add dts file for A20-OLinuXino-MICRO-eMMC arch/arm/boot/dts/Makefile | 1 + .../boot/dts/sun7i-a20-olinuxino-micro-emmc.dts| 70 ++ arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts| 7 ++- 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 arch/arm/boot/dts/sun7i-a20-olinuxino-micro-emmc.dts -- 2.7.4
[PATCH 3/3] ARM: dts: sun7i: Rename sun7i-a20-olinuxino-lime2-emmc
Rename dts file for A20-OLinuXino-LIME2-eMMC to match Olimex Ltd. naming convention. -exGB - option with GB eMMC chip -nxGB - option with GB NAND chip -sxMB - option with MB SPI FLASH chip For example: A20-OLinuXino-LIME2-e4GB - 4GB eMMC A20-OLinuXIno-LIME2-n4GB - 4GB NAND A20-OLinuXIno-LIME2-n8GB - 8GB NAND Signed-off-by: Stefan Mavrodiev --- arch/arm/boot/dts/Makefile| 2 +- ...20-olinuxino-lime2-emmc.dts => sun7i-a20-olinuxino-lime2-exgb.dts} | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename arch/arm/boot/dts/{sun7i-a20-olinuxino-lime2-emmc.dts => sun7i-a20-olinuxino-lime2-exgb.dts} (96%) diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 90cbfc57948e..d37e93175fbf 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -878,7 +878,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \ sun7i-a20-olimex-som-evb.dtb \ sun7i-a20-olinuxino-lime.dtb \ sun7i-a20-olinuxino-lime2.dtb \ - sun7i-a20-olinuxino-lime2-emmc.dtb \ + sun7i-a20-olinuxino-lime2-exgb.dtb \ sun7i-a20-olinuxino-micro.dtb \ sun7i-a20-olinuxino-micro-exgb.dtb \ sun7i-a20-orangepi.dtb \ diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2-emmc.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2-exgb.dts similarity index 96% rename from arch/arm/boot/dts/sun7i-a20-olinuxino-lime2-emmc.dts rename to arch/arm/boot/dts/sun7i-a20-olinuxino-lime2-exgb.dts index 81f376f2a44d..38d95eaaa224 100644 --- a/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2-emmc.dts +++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2-exgb.dts @@ -44,8 +44,8 @@ #include "sun7i-a20-olinuxino-lime2.dts" / { - model = "Olimex A20-OLinuXino-LIME2-eMMC"; - compatible = "olimex,a20-olinuxino-lime2-emmc", "allwinner,sun7i-a20"; + model = "Olimex A20-OLinuXino-LIME2-exGB"; + compatible = "olimex,a20-olinuxino-lime2-exgb", "allwinner,sun7i-a20"; mmc2_pwrseq: pwrseq { pinctrl-0 = <&mmc2_pins_nrst>; -- 2.11.0
[PATCH 1/3] ARM: dts: sun7i: Fix A20-OLinuXino-MICRO dts for use with LAN8710
>From revision J the board uses new phy chip LAN8710. Compared with RTL8201, RA17 pin is TXERR. It has pullup which causes phy not to work. To fix this, PA17 must be configured output-low. This patch is compatible with earlier board revisions, since this pin wasn't connected to phy. Signed-off-by: Stefan Mavrodiev --- arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts index 0b7403e4d687..578c761b551a 100644 --- a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts +++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts @@ -102,7 +102,7 @@ &gmac { pinctrl-names = "default"; - pinctrl-0 = <&gmac_pins_mii_a>; + pinctrl-0 = <&gmac_pins_mii_a>,<&gmac_txerr_pin>; phy = <&phy1>; phy-mode = "mii"; status = "okay"; @@ -229,6 +229,11 @@ }; &pio { + gmac_txerr_pin: gmac_txerr_pin@0 { + pins = "PA17"; + function = "gpio_out" + }; + mmc3_cd_pin_olinuxinom: mmc3_cd_pin@0 { pins = "PH11"; function = "gpio_in"; -- 2.11.0
[PATCH 2/3] ARM: dts: sun7i: Add dts file for A20-OLinuXino-MICRO-exGB
A20-OLinuXino-MICRO has option with onboard eMMC chip. For now it's only shipped with 4BG chip, but in the future this may change. Currently the board is called "A20-OLinuXino-MICRO-e4GB". The dts is named "-exGB" to represent all eMMC configurations - e4GB, e8GB, etc. Signed-off-by: Stefan Mavrodiev --- arch/arm/boot/dts/Makefile | 1 + .../boot/dts/sun7i-a20-olinuxino-micro-exgb.dts| 81 ++ 2 files changed, 82 insertions(+) create mode 100644 arch/arm/boot/dts/sun7i-a20-olinuxino-micro-exgb.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 4b17f35dc9a7..90cbfc57948e 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -880,6 +880,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \ sun7i-a20-olinuxino-lime2.dtb \ sun7i-a20-olinuxino-lime2-emmc.dtb \ sun7i-a20-olinuxino-micro.dtb \ + sun7i-a20-olinuxino-micro-exgb.dtb \ sun7i-a20-orangepi.dtb \ sun7i-a20-orangepi-mini.dtb \ sun7i-a20-pcduino3.dtb \ diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-micro-exgb.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro-exgb.dts new file mode 100644 index ..2c592748e474 --- /dev/null +++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-micro-exgb.dts @@ -0,0 +1,81 @@ +/* + * Copyright 2017 Olimex Ltd. + * + * Stefan Mavrodiev + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This file is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include "sun7i-a20-olinuxino-micro.dts" + +/ { + model = "Olimex A20-OLinuXino-MICRO-exGB"; + compatible = "olimex,a20-olinuxino-micro-exgb", "allwinner,sun7i-a20"; + + mmc2_pwrseq: pwrseq { + pinctrl-0 = <&mmc2_pins_nrst>; + pinctrl-names = "default"; + compatible = "mmc-pwrseq-emmc"; + reset-gpios = <&pio 2 16 GPIO_ACTIVE_LOW>; + }; +}; + +&pio { + mmc2_pins_nrst: mmc2-rst-pin { + pins = "PC16"; + function = "gpio_out"; + }; +}; + +&mmc2 { + pinctrl-names = "default"; + pinctrl-0 = <&mmc2_pins_a>; + vmmc-supply = <®_vcc3v3>; + vqmmc-supply = <®_vcc3v3>; + bus-width = <4>; + non-removable; + mmc-pwrseq = <&mmc2_pwrseq>; + status = "okay"; + + emmc: emmc@0 { + reg = <0>; + compatible = "mmc-card"; + broken-hpi; + }; +}; -- 2.11.0
[PATCH 0/3] Update board support for OLinuXino boards
Based of increased number of boards with their shipping options, there is new board naming convention. Along with that, A20-OLinuXino-MICRO has new revision(rev.J), which introduce new PHY chip (LAN8710) and eMMC option. The new dts file is based on the already existing one for lime2-emmc. Stefan Mavrodiev (3): ARM: dts: sun7i: Fix A20-OLinuXino-MICRO dts for use with LAN8710 ARM: dts: sun7i: Add dts file for A20-OLinuXino-MICRO-exGB ARM: dts: sun7i: Rename sun7i-a20-olinuxino-lime2-emmc arch/arm/boot/dts/Makefile | 3 +- ...emmc.dts => sun7i-a20-olinuxino-lime2-exgb.dts} | 4 +- .../boot/dts/sun7i-a20-olinuxino-micro-exgb.dts| 81 ++ arch/arm/boot/dts/sun7i-a20-olinuxino-micro.dts| 7 +- 4 files changed, 91 insertions(+), 4 deletions(-) rename arch/arm/boot/dts/{sun7i-a20-olinuxino-lime2-emmc.dts => sun7i-a20-olinuxino-lime2-exgb.dts} (96%) create mode 100644 arch/arm/boot/dts/sun7i-a20-olinuxino-micro-exgb.dts -- 2.11.0
[PATCH v5] ARM: dts: sun8i: Add dts file for Olimex A33-OLinuXino
A33-OLinuXino is A33 development board designed by Olimex LTD. It has AXP233 PMU, 1GB DRAM, a micro SD card, one USB-OTG connector, headphone and mic jacks, connector for LiPo battery and optional 4GB NAND Flash. It has two 40-pin headers. One for LCD panel, and one for additional modules. Also there is CSI/DSI connector. Signed-off-by: Stefan Mavrodiev --- Changes for v2: - Removed unused power nodes - Removed default-trigger for green led - Removed "always-on" option for LCD power Changes for v3: - Nodes are sorted alphabetically Changes for v4: - Green led renamed - Added OTG support Changes for v5: - Renamed dcdc1 regulator - indentation fixes arch/arm/boot/dts/Makefile| 1 + arch/arm/boot/dts/sun8i-a33-olinuxino.dts | 226 ++ 2 files changed, 227 insertions(+) create mode 100644 arch/arm/boot/dts/sun8i-a33-olinuxino.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 6b3bdb6..75cd98a 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -783,6 +783,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \ sun8i-a33-et-q8-v1.6.dtb \ sun8i-a33-ga10h-v1.1.dtb \ sun8i-a33-ippo-q8h-v1.2.dtb \ + sun8i-a33-olinuxino.dtb \ sun8i-a33-q8-tablet.dtb \ sun8i-a33-sinlinx-sina33.dtb \ sun8i-a83t-allwinner-h8homlet-v2.dtb \ diff --git a/arch/arm/boot/dts/sun8i-a33-olinuxino.dts b/arch/arm/boot/dts/sun8i-a33-olinuxino.dts new file mode 100644 index 000..9ea637e --- /dev/null +++ b/arch/arm/boot/dts/sun8i-a33-olinuxino.dts @@ -0,0 +1,226 @@ +/* + * Copyright 2016 - Stefan Mavrodiev + * Olimex LTD. + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This file is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/dts-v1/; +#include "sun8i-a33.dtsi" +#include "sunxi-common-regulators.dtsi" + +#include +#include + +/ { + model = "Olimex A33-OLinuXino"; + compatible = "olimex,a33-olinuxino","allwinner,sun8i-a33"; + + aliases { + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&led_pin_olinuxino>; + + green { + label = "a33-olinuxino:green:usr"; + gpios = <&pio 1 7 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&ehci0 { + status = "okay"; +}; + +&mmc0 { + pinctrl-names = "default"; + pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_olinuxino>; + vmmc-supply = <®_dcdc1>; + bus-width = <4>; + cd-gpios = <&pio 1 4 GPIO_ACTIVE_HIGH>; /* PB4 */ + cd-inverted; + status = "okay"; +}; + +&ohci0 { +
Re: [PATCH v4] ARM: dts: sun8i: Add dts file for Olimex A33-OLinuXino
On Wednesday, July 27, 2016 8:21:46 AM EEST Maxime Ripard wrote: > On Wed, Jul 27, 2016 at 08:12:29AM +0300, stefan.mavrod...@gmail.com wrote: > > > > +®_dcdc1 { > > > > + regulator-always-on; > > > > + regulator-min-microvolt = <330>; > > > > + regulator-max-microvolt = <330>; > > > > + regulator-name = "vcc-dsi"; > > > > +}; > > > > > > What is it used for? Is it really necessary to keep it on at all time? > > > > I think so. > > This is the supply for the MMC. > > Then it's poorly named, and you should tie it to the MMC, and remove > the always-on if it's only used by the mmc. always-on is supposed to > be for regulators that shouldn't but turned off for the system to stay > running. Some MMC regulator doesn't fit that description. > It's named upon the A33 power pin - "VCC-DSI". If I remove "always-on" the board still will work, since dcdc1 is tied to mmc0. vmmc-supply = <®_dcdc1>; We assume this voltage will be always present and there are some pullups that are tied to it (on i2c0 and i2c1 bus). In this case should I remove "always- on" from the regulator node? > Maxime Best regards, Stefan Mavrodiev
Re: [PATCH v4] ARM: dts: sun8i: Add dts file for Olimex A33-OLinuXino
On Tuesday, July 26, 2016 5:33:52 PM EEST Maxime Ripard wrote: > Hi Stefan, > > On Mon, Jul 25, 2016 at 03:37:23PM +0300, Stefan Mavrodiev wrote: > > A33-OLinuXino is A33 development board designed by Olimex LTD. > > > > It has AXP233 PMU, 1GB DRAM, a micro SD card, one USB-OTG connector, > > headphone and mic jacks, connector for LiPo battery and optional > > 4GB NAND Flash. > > > > It has two 40-pin headers. One for LCD panel, and one for > > additional modules. Also there is CSI/DSI connector. > > > > Signed-off-by: Stefan Mavrodiev > > It looks mostly good, a few comments though. > > > +&pio { > > + led_pin_olinuxino: led_pins@0 { > > + allwinner,pins = "PB7"; > > +allwinner,function = "gpio_out"; > > This line is not properly indented. > > > + allwinner,drive = ; > > + allwinner,pull = ; > > +}; > > And this one too. > > > +®_dc1sw { > > + regulator-name = "vcc-lcd"; > > +}; > > No constraints on this one? > > > +®_dcdc1 { > > + regulator-always-on; > > + regulator-min-microvolt = <330>; > > + regulator-max-microvolt = <330>; > > + regulator-name = "vcc-dsi"; > > +}; > > What is it used for? Is it really necessary to keep it on at all time? I think so. This is the supply for the MMC. > > Thanks, > Maxime Best regards, Stefan Mavrodiev
[PATCH v4] ARM: dts: sun8i: Add dts file for Olimex A33-OLinuXino
A33-OLinuXino is A33 development board designed by Olimex LTD. It has AXP233 PMU, 1GB DRAM, a micro SD card, one USB-OTG connector, headphone and mic jacks, connector for LiPo battery and optional 4GB NAND Flash. It has two 40-pin headers. One for LCD panel, and one for additional modules. Also there is CSI/DSI connector. Signed-off-by: Stefan Mavrodiev --- Changes for v2: - Removed unused power nodes - Removed default-trigger for green led - Removed "always-on" option for LCD power Changes for v3: - Nodes are sorted alphabetically Changes for v4: - Green led renamed - Added OTG support arch/arm/boot/dts/Makefile| 1 + arch/arm/boot/dts/sun8i-a33-olinuxino.dts | 226 ++ 2 files changed, 227 insertions(+) create mode 100644 arch/arm/boot/dts/sun8i-a33-olinuxino.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 016611d..e02a97e 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -759,6 +759,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \ sun8i-a33-et-q8-v1.6.dtb \ sun8i-a33-ga10h-v1.1.dtb \ sun8i-a33-ippo-q8h-v1.2.dtb \ + sun8i-a33-olinuxino.dtb \ sun8i-a33-q8-tablet.dtb \ sun8i-a33-sinlinx-sina33.dtb \ sun8i-a83t-allwinner-h8homlet-v2.dtb \ diff --git a/arch/arm/boot/dts/sun8i-a33-olinuxino.dts b/arch/arm/boot/dts/sun8i-a33-olinuxino.dts new file mode 100644 index 000..3882aa1 --- /dev/null +++ b/arch/arm/boot/dts/sun8i-a33-olinuxino.dts @@ -0,0 +1,226 @@ +/* + * Copyright 2016 - Stefan Mavrodiev + * Olimex LTD. + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This file is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/dts-v1/; +#include "sun8i-a33.dtsi" +#include "sunxi-common-regulators.dtsi" + +#include +#include + +/ { + model = "Olimex A33-OLinuXino"; + compatible = "olimex,a33-olinuxino","allwinner,sun8i-a33"; + + aliases { + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&led_pin_olinuxino>; + + green { + label = "a33-olinuxino:green:usr"; + gpios = <&pio 1 7 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&ehci0 { + status = "okay"; +}; + +&mmc0 { + pinctrl-names = "default"; + pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_olinuxino>; + vmmc-supply = <®_dcdc1>; + bus-width = <4>; + cd-gpios = <&pio 1 4 GPIO_ACTIVE_HIGH>; /* PB4 */ + cd-inverted; + status = "okay"; +}; + +&ohci0 { + status = "okay"; +}; + +&pio { + led_pin_olinuxino: led_pins@0 { +
Re: [PATCH 1/1] ARM: dts: sunxi: Add a olinuxino-lime2-emmc
Hi Olliver, Why are you using nRST signal? What I mean is this pin is inactive on this eMMC chip. To use the signal byte 162 of ECSD registers should be written. On my board, this "reset" signal causes eMMC not to work. Best regards, Stefan Mavrodiev
Re: [PATCH v3] ARM: dts: sun8i: Add dts file for Olimex A33-OLinuXino
сряда, 22 юни 2016 г., 16:22:34 UTC+3, Maxime Ripard написа: > Hi, > > On Mon, Jun 20, 2016 at 01:32:49PM +0300, Stefan Mavrodiev wrote: > > A33-OLinuXino is A33 development board designed by Olimex LTD. > > > > It has AXP233 PMU, 1GB DRAM, a micro SD card, one USB-OTG connector, > > headphone and mic jacks, connector for LiPo battery and optional > > 4GB NAND Flash. > > > > It has two 40-pin headers. One for LCD panel, and one for > > additional modules. Also there is CSI/DSI connector. > > Oh? So it ships already? Nice! Not yet, but very soon will. > > > Signed-off-by: Stefan Mavrodiev > > --- > > Changes for v2: > > - Removed unused power nodes > > - Removed default-trigger for green led > > - Removed "always-on" option for LCD power > > > > Changes for v3: > > - Nodes are sorted alphabetically > > > > arch/arm/boot/dts/Makefile| 1 + > > arch/arm/boot/dts/sun8i-a33-olinuxino.dts | 207 > > ++ > > 2 files changed, 208 insertions(+) > > create mode 100644 arch/arm/boot/dts/sun8i-a33-olinuxino.dts > > > > diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile > > index 970e906..b78f363 100644 > > --- a/arch/arm/boot/dts/Makefile > > +++ b/arch/arm/boot/dts/Makefile > > @@ -760,6 +760,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \ > > sun8i-a33-ippo-q8h-v1.2.dtb \ > > sun8i-a33-q8-tablet.dtb \ > > sun8i-a33-sinlinx-sina33.dtb \ > > + sun8i-a33-olinuxino.dtb \ > > This should be ordered alphabetically. > > > sun8i-a83t-allwinner-h8homlet-v2.dtb \ > > sun8i-a83t-cubietruck-plus.dtb \ > > sun8i-h3-orangepi-2.dtb \ > > diff --git a/arch/arm/boot/dts/sun8i-a33-olinuxino.dts > > b/arch/arm/boot/dts/sun8i-a33-olinuxino.dts > > new file mode 100644 > > index 000..586ffd3 > > --- /dev/null > > +++ b/arch/arm/boot/dts/sun8i-a33-olinuxino.dts > > @@ -0,0 +1,207 @@ > > +/* > > + * Copyright 2016 - Stefan Mavrodiev > > + * Olimex LTD. > > + * > > + * This file is dual-licensed: you can use it either under the terms > > + * of the GPL or the X11 license, at your option. Note that this dual > > + * licensing only applies to this file, and not this project as a > > + * whole. > > + * > > + * a) This file is free software; you can redistribute it and/or > > + * modify it under the terms of the GNU General Public License as > > + * published by the Free Software Foundation; either version 2 of the > > + * License, or (at your option) any later version. > > + * > > + * This file is distributed in the hope that it will be useful, > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > > + * GNU General Public License for more details. > > + * > > + * Or, alternatively, > > + * > > + * b) Permission is hereby granted, free of charge, to any person > > + * obtaining a copy of this software and associated documentation > > + * files (the "Software"), to deal in the Software without > > + * restriction, including without limitation the rights to use, > > + * copy, modify, merge, publish, distribute, sublicense, and/or > > + * sell copies of the Software, and to permit persons to whom the > > + * Software is furnished to do so, subject to the following > > + * conditions: > > + * > > + * The above copyright notice and this permission notice shall be > > + * included in all copies or substantial portions of the Software. > > + * > > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, > > + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES > > + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND > > + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT > > + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, > > + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING > > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR > > + * OTHER DEALINGS IN THE SOFTWARE. > > + */ > > + > > +/dts-v1/; > > +#include "sun8i-a33.dtsi" > > +#include "sunxi-common-regulators.dtsi" > > + > > +#include > > +#include > > +#include > > + > > +/ { > > + model = "A33-OLinuXino"; > > Olimex A33-Ol
[PATCH v3] ARM: dts: sun8i: Add dts file for Olimex A33-OLinuXino
A33-OLinuXino is A33 development board designed by Olimex LTD. It has AXP233 PMU, 1GB DRAM, a micro SD card, one USB-OTG connector, headphone and mic jacks, connector for LiPo battery and optional 4GB NAND Flash. It has two 40-pin headers. One for LCD panel, and one for additional modules. Also there is CSI/DSI connector. Signed-off-by: Stefan Mavrodiev --- Changes for v2: - Removed unused power nodes - Removed default-trigger for green led - Removed "always-on" option for LCD power Changes for v3: - Nodes are sorted alphabetically arch/arm/boot/dts/Makefile| 1 + arch/arm/boot/dts/sun8i-a33-olinuxino.dts | 207 ++ 2 files changed, 208 insertions(+) create mode 100644 arch/arm/boot/dts/sun8i-a33-olinuxino.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 970e906..b78f363 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -760,6 +760,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \ sun8i-a33-ippo-q8h-v1.2.dtb \ sun8i-a33-q8-tablet.dtb \ sun8i-a33-sinlinx-sina33.dtb \ + sun8i-a33-olinuxino.dtb \ sun8i-a83t-allwinner-h8homlet-v2.dtb \ sun8i-a83t-cubietruck-plus.dtb \ sun8i-h3-orangepi-2.dtb \ diff --git a/arch/arm/boot/dts/sun8i-a33-olinuxino.dts b/arch/arm/boot/dts/sun8i-a33-olinuxino.dts new file mode 100644 index 000..586ffd3 --- /dev/null +++ b/arch/arm/boot/dts/sun8i-a33-olinuxino.dts @@ -0,0 +1,207 @@ +/* + * Copyright 2016 - Stefan Mavrodiev + * Olimex LTD. + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This file is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/dts-v1/; +#include "sun8i-a33.dtsi" +#include "sunxi-common-regulators.dtsi" + +#include +#include +#include + +/ { + model = "A33-OLinuXino"; + compatible = "allwinner,sun8i-a33"; + + aliases { + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&led_pin_olinuxino>; + + green { + label = "olinuxino:green:usr"; + gpios = <&pio 1 7 GPIO_ACTIVE_HIGH>; /* LED2 */ + }; + }; +}; + +&ehci0 { + status = "okay"; +}; + +&mmc0 { + pinctrl-names = "default"; + pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_olinuxino>; + vmmc-supply = <®_dcdc1>; + bus-width = <4>; + cd-gpios = <&pio 1 4 GPIO_ACTIVE_HIGH>; /* PB4 */ + cd-inverted; + status = "okay"; +}; + +&ohci0 { + status = "okay"; +}; + +&pio { + led_pin_olinuxino: led_pins@0 { + allwinner,pins = "PB7"; + allwinner,function = "gpio_out&qu
[PATCH v2] ARM: dts: sun8i: Add dts file for Olimex A33-OLinuXino
A33-OLinuXino is A33 development board designed by Olimex LTD. It has AXP233 PMU, 1GB DRAM, a micro SD card, one USB-OTG connector, headphone and mic jacks, connector for LiPo battery and optional 4GB NAND Flash. It has two 40-pin headers. One for LCD panel, and one for additional modules. Also there is CSI/DSI connector. Signed-off-by: Stefan Mavrodiev --- Changes for v2: - Removed unused power nodes - Removed default-trigger for green led - Removed "always-on" option for LCD power arch/arm/boot/dts/Makefile| 1 + arch/arm/boot/dts/sun8i-a33-olinuxino.dts | 207 ++ 2 files changed, 208 insertions(+) create mode 100644 arch/arm/boot/dts/sun8i-a33-olinuxino.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 970e906..b78f363 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -760,6 +760,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \ sun8i-a33-ippo-q8h-v1.2.dtb \ sun8i-a33-q8-tablet.dtb \ sun8i-a33-sinlinx-sina33.dtb \ + sun8i-a33-olinuxino.dtb \ sun8i-a83t-allwinner-h8homlet-v2.dtb \ sun8i-a83t-cubietruck-plus.dtb \ sun8i-h3-orangepi-2.dtb \ diff --git a/arch/arm/boot/dts/sun8i-a33-olinuxino.dts b/arch/arm/boot/dts/sun8i-a33-olinuxino.dts new file mode 100644 index 000..14fa801 --- /dev/null +++ b/arch/arm/boot/dts/sun8i-a33-olinuxino.dts @@ -0,0 +1,207 @@ +/* + * Copyright 2016 - Stefan Mavrodiev + * Olimex LTD. + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This file is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/dts-v1/; +#include "sun8i-a33.dtsi" +#include "sunxi-common-regulators.dtsi" + +#include +#include +#include + +/ { + model = "A33-OLinuXino"; + compatible = "allwinner,sun8i-a33"; + + aliases { + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&led_pin_olinuxino>; + + green { + label = "olinuxino:green:usr"; + gpios = <&pio 1 7 GPIO_ACTIVE_HIGH>; /* LED2 */ + }; + }; +}; + +&ehci0 { + status = "okay"; +}; + +&ohci0 { + status = "okay"; +}; + +&mmc0 { + pinctrl-names = "default"; + pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_olinuxino>; + vmmc-supply = <®_dcdc1>; + bus-width = <4>; + cd-gpios = <&pio 1 4 GPIO_ACTIVE_HIGH>; /* PB4 */ + cd-inverted; + status = "okay"; +}; + +&pio { + mmc0_cd_pin_olinuxino: mmc0_cd_pin@0 { + allwinner,pins = "PB4"; + allwinner,function = "gpio_in"; + allwinner,drive = ; + allw
[PATCH] ARM: dts: sun8i: Add dts file for Olimex A33-OLinuXino
A33-OLinuXino is A33 development board designed by Olimex LTD. It has AXP233 PMU, 1GB DRAM, a micro SD card, one USB-OTG connector, headphone and mic jacks, connector for LiPo battery and optional 4GB NAND Flash. It has two 40-pin headers. One for LCD panel, and one for additional modules. Also there is CSI/DSI connector. Signed-off-by: Stefan Mavrodiev --- arch/arm/boot/dts/Makefile| 1 + arch/arm/boot/dts/sun8i-a33-olinuxino.dts | 223 ++ 2 files changed, 224 insertions(+) create mode 100644 arch/arm/boot/dts/sun8i-a33-olinuxino.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 970e906..b78f363 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -760,6 +760,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \ sun8i-a33-ippo-q8h-v1.2.dtb \ sun8i-a33-q8-tablet.dtb \ sun8i-a33-sinlinx-sina33.dtb \ + sun8i-a33-olinuxino.dtb \ sun8i-a83t-allwinner-h8homlet-v2.dtb \ sun8i-a83t-cubietruck-plus.dtb \ sun8i-h3-orangepi-2.dtb \ diff --git a/arch/arm/boot/dts/sun8i-a33-olinuxino.dts b/arch/arm/boot/dts/sun8i-a33-olinuxino.dts new file mode 100644 index 000..2eaeb55 --- /dev/null +++ b/arch/arm/boot/dts/sun8i-a33-olinuxino.dts @@ -0,0 +1,223 @@ +/* + * Copyright 2016 - Stefan Mavrodiev + * Olimex LTD. + * + * This file is dual-licensed: you can use it either under the terms + * of the GPL or the X11 license, at your option. Note that this dual + * licensing only applies to this file, and not this project as a + * whole. + * + * a) This file is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * Or, alternatively, + * + * b) Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/dts-v1/; +#include "sun8i-a33.dtsi" +#include "sunxi-common-regulators.dtsi" + +#include +#include +#include + +/ { + model = "A33-OLinuXino"; + compatible = "allwinner,sun8i-a33"; + + aliases { + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&led_pin_olinuxino>; + + green { + label = "olinuxino:green:usr"; + gpios = <&pio 1 7 GPIO_ACTIVE_HIGH>; /* LED2 */ + linux,default-trigger = "heartbeat"; + }; + }; +}; + +&ehci0 { + status = "okay"; +}; + +&ohci0 { + status = "okay"; +}; + +&mmc0 { + pinctrl-names = "default"; + pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_olinuxino>; + vmmc-supply = <®_dcdc1>; + bus-width = <4>; + cd-gpios = <&pio 1 4 GPIO_ACTIVE_HIGH>; /* PB4 */ + cd-inverted; + status = "okay"; +}; + +&pio { + mmc0_cd_pin_olinuxino: mmc0_cd_pin@0 { + allwinner,pins = "PB4"; + allwinner,function = "gpio_in"; + allwinner,drive = ; + allwinner,pull = ; + }; + + led_pin_olinuxino: led_pins@0 { + allwinner,p