* [PATCH 0/2] i2c: tegra: allow compiling out support for Tegra's special constrollers
@ 2022-01-16 16:02 Michał Mirosław
2022-01-16 16:02 ` [PATCH 2/2] i2c: tegra: allow VI support to be compiled out Michał Mirosław
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Michał Mirosław @ 2022-01-16 16:02 UTC (permalink / raw)
To: Dmitry Osipenko, Jonathan Hunter, Laxman Dewangan, Thierry Reding
Cc: linux-i2c, linux-kernel, linux-tegra
To patches that, combined, reduce I2C driver's code by ~2kB and a bit
from runtime overhead for non-Tegra20 or non-Tegra210 builds.
Michał Mirosław (2):
i2c: tegra: allow DVC support to be compiled out
i2c: tegra: allow VI support to be compiled out
drivers/i2c/busses/Kconfig | 16 ++++++++++++++++
drivers/i2c/busses/i2c-tegra.c | 35 +++++++++++++++++++++-------------
2 files changed, 38 insertions(+), 13 deletions(-)
--
2.30.2
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/2] i2c: tegra: allow VI support to be compiled out
2022-01-16 16:02 [PATCH 0/2] i2c: tegra: allow compiling out support for Tegra's special constrollers Michał Mirosław
@ 2022-01-16 16:02 ` Michał Mirosław
2022-01-16 16:02 ` [PATCH 1/2] i2c: tegra: allow DVC " Michał Mirosław
2022-01-16 17:54 ` [PATCH 0/2] i2c: tegra: allow compiling out support for Tegra's special constrollers Dmitry Osipenko
2 siblings, 0 replies; 11+ messages in thread
From: Michał Mirosław @ 2022-01-16 16:02 UTC (permalink / raw)
To: Laxman Dewangan, Dmitry Osipenko, Thierry Reding, Jonathan Hunter
Cc: linux-i2c, linux-kernel, linux-tegra
Save a bit of code for older Tegra platforms by compiling out
VI's I2C mode support that's used only for Tegra210.
$ size i2c-tegra.o
text data bss dec hex filename
10385 240 8 10633 2989 i2c-tegra.o (full)
9617 240 8 9865 2689 i2c-tegra.o (no-dvc)
9389 240 8 9637 25a5 i2c-tegra.o (no-vi)
8617 240 8 8865 22a1 i2c-tegra.o (no-vi,no-dvc)
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
drivers/i2c/busses/Kconfig | 8 ++++++++
drivers/i2c/busses/i2c-tegra.c | 20 ++++++++++++--------
2 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index b557b832bfec..2dd5974acc14 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -1087,6 +1087,14 @@ config I2C_TEGRA_DVC
If you say yes to this option, tegra-i2c will also support
I2C controller that is part of DVC in Tegra20 SoCs.
+config I2C_TEGRA_VI
+ bool "NVIDIA Tegra VI I2C controller"
+ depends on I2C_TEGRA
+ default y if ARCH_TEGRA_210_SOC
+ help
+ If you say yes to this option, tegra-i2c will also support
+ I2C controller that is part of VI in Tegra210 SoCs.
+
config I2C_TEGRA_BPMP
tristate "NVIDIA Tegra BPMP I2C controller"
depends on TEGRA_BPMP || COMPILE_TEST
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 60ecf6c9f649..140fbce203cb 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -295,6 +295,7 @@ struct tegra_i2c_dev {
};
#define IS_DVC(dev) (IS_ENABLED(CONFIG_I2C_TEGRA_DVC) && dev->is_dvc)
+#define IS_VI(dev) (IS_ENABLED(CONFIG_I2C_TEGRA_VI) && dev->is_vi)
static void dvc_writel(struct tegra_i2c_dev *i2c_dev, u32 val,
unsigned int reg)
@@ -315,7 +316,7 @@ static u32 tegra_i2c_reg_addr(struct tegra_i2c_dev *i2c_dev, unsigned int reg)
{
if (IS_DVC(i2c_dev))
reg += (reg >= I2C_TX_FIFO) ? 0x10 : 0x40;
- else if (i2c_dev->is_vi)
+ else if (IS_VI(i2c_dev))
reg = 0xc00 + (reg << 2);
return reg;
@@ -444,7 +445,7 @@ static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev)
u32 *dma_buf;
int err;
- if (!i2c_dev->hw->has_apb_dma || i2c_dev->is_vi)
+ if (!i2c_dev->hw->has_apb_dma || IS_VI(i2c_dev))
return 0;
if (!IS_ENABLED(CONFIG_TEGRA20_APB_DMA)) {
@@ -635,7 +636,7 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
i2c_writel(i2c_dev, val, I2C_CNFG);
i2c_writel(i2c_dev, 0, I2C_INT_MASK);
- if (i2c_dev->is_vi)
+ if (IS_VI(i2c_dev))
tegra_i2c_vi_init(i2c_dev);
switch (i2c_dev->bus_clk_rate) {
@@ -687,7 +688,7 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
return err;
}
- if (!IS_DVC(i2c_dev) && !i2c_dev->is_vi) {
+ if (!IS_DVC(i2c_dev) && !IS_VI(i2c_dev)) {
u32 sl_cfg = i2c_readl(i2c_dev, I2C_SL_CNFG);
sl_cfg |= I2C_SL_CNFG_NACK | I2C_SL_CNFG_NEWSL;
@@ -1612,7 +1613,9 @@ static const struct tegra_i2c_hw_feature tegra194_i2c_hw = {
static const struct of_device_id tegra_i2c_of_match[] = {
{ .compatible = "nvidia,tegra194-i2c", .data = &tegra194_i2c_hw, },
{ .compatible = "nvidia,tegra186-i2c", .data = &tegra186_i2c_hw, },
+#if IS_ENABLED(CONFIG_I2C_TEGRA_VI)
{ .compatible = "nvidia,tegra210-i2c-vi", .data = &tegra210_i2c_hw, },
+#endif
{ .compatible = "nvidia,tegra210-i2c", .data = &tegra210_i2c_hw, },
{ .compatible = "nvidia,tegra124-i2c", .data = &tegra124_i2c_hw, },
{ .compatible = "nvidia,tegra114-i2c", .data = &tegra114_i2c_hw, },
@@ -1643,7 +1646,8 @@ static void tegra_i2c_parse_dt(struct tegra_i2c_dev *i2c_dev)
of_device_is_compatible(np, "nvidia,tegra20-i2c-dvc"))
i2c_dev->is_dvc = true;
- if (of_device_is_compatible(np, "nvidia,tegra210-i2c-vi"))
+ if (IS_ENABLED(CONFIG_I2C_TEGRA_VI) &&
+ of_device_is_compatible(np, "nvidia,tegra210-i2c-vi"))
i2c_dev->is_vi = true;
}
@@ -1656,7 +1660,7 @@ static int tegra_i2c_init_clocks(struct tegra_i2c_dev *i2c_dev)
if (i2c_dev->hw == &tegra20_i2c_hw || i2c_dev->hw == &tegra30_i2c_hw)
i2c_dev->clocks[i2c_dev->nclocks++].id = "fast-clk";
- if (i2c_dev->is_vi)
+ if (IS_VI(i2c_dev))
i2c_dev->clocks[i2c_dev->nclocks++].id = "slow";
err = devm_clk_bulk_get(i2c_dev->dev, i2c_dev->nclocks,
@@ -1777,7 +1781,7 @@ static int tegra_i2c_probe(struct platform_device *pdev)
* VI I2C device shouldn't be marked as IRQ-safe because VI I2C won't
* be used for atomic transfers.
*/
- if (!i2c_dev->is_vi)
+ if (!IS_VI(i2c_dev))
pm_runtime_irq_safe(i2c_dev->dev);
pm_runtime_enable(i2c_dev->dev);
@@ -1850,7 +1854,7 @@ static int __maybe_unused tegra_i2c_runtime_resume(struct device *dev)
* power ON/OFF during runtime PM resume/suspend, meaning that
* controller needs to be re-initialized after power ON.
*/
- if (i2c_dev->is_vi) {
+ if (IS_VI(i2c_dev)) {
err = tegra_i2c_init(i2c_dev);
if (err)
goto disable_clocks;
--
2.30.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 1/2] i2c: tegra: allow DVC support to be compiled out
2022-01-16 16:02 [PATCH 0/2] i2c: tegra: allow compiling out support for Tegra's special constrollers Michał Mirosław
2022-01-16 16:02 ` [PATCH 2/2] i2c: tegra: allow VI support to be compiled out Michał Mirosław
@ 2022-01-16 16:02 ` Michał Mirosław
2022-01-18 9:46 ` Dmitry Osipenko
2022-01-16 17:54 ` [PATCH 0/2] i2c: tegra: allow compiling out support for Tegra's special constrollers Dmitry Osipenko
2 siblings, 1 reply; 11+ messages in thread
From: Michał Mirosław @ 2022-01-16 16:02 UTC (permalink / raw)
To: Laxman Dewangan, Dmitry Osipenko, Thierry Reding, Jonathan Hunter
Cc: linux-i2c, linux-kernel, linux-tegra
Save a bit of code for newer Tegra platforms by compiling out
DVC's I2C mode support that's used only for Tegra2.
$ size i2c-tegra.o
text data bss dec hex filename
- 10385 240 8 10633 2989 i2c-tegra.o
+ 9617 240 8 9865 2689 i2c-tegra.o
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
drivers/i2c/busses/Kconfig | 8 ++++++++
drivers/i2c/busses/i2c-tegra.c | 17 +++++++++++------
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index dce392839017..b557b832bfec 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -1079,6 +1079,14 @@ config I2C_TEGRA
If you say yes to this option, support will be included for the
I2C controller embedded in NVIDIA Tegra SOCs
+config I2C_TEGRA_DVC
+ bool "NVIDIA Tegra DVC I2C controller"
+ depends on I2C_TEGRA
+ default y if ARCH_TEGRA_2x_SOC
+ help
+ If you say yes to this option, tegra-i2c will also support
+ I2C controller that is part of DVC in Tegra20 SoCs.
+
config I2C_TEGRA_BPMP
tristate "NVIDIA Tegra BPMP I2C controller"
depends on TEGRA_BPMP || COMPILE_TEST
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index b3184c422826..60ecf6c9f649 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -294,6 +294,8 @@ struct tegra_i2c_dev {
bool is_vi;
};
+#define IS_DVC(dev) (IS_ENABLED(CONFIG_I2C_TEGRA_DVC) && dev->is_dvc)
+
static void dvc_writel(struct tegra_i2c_dev *i2c_dev, u32 val,
unsigned int reg)
{
@@ -311,7 +313,7 @@ static u32 dvc_readl(struct tegra_i2c_dev *i2c_dev, unsigned int reg)
*/
static u32 tegra_i2c_reg_addr(struct tegra_i2c_dev *i2c_dev, unsigned int reg)
{
- if (i2c_dev->is_dvc)
+ if (IS_DVC(i2c_dev))
reg += (reg >= I2C_TX_FIFO) ? 0x10 : 0x40;
else if (i2c_dev->is_vi)
reg = 0xc00 + (reg << 2);
@@ -621,7 +623,7 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
err = reset_control_reset(i2c_dev->rst);
WARN_ON_ONCE(err);
- if (i2c_dev->is_dvc)
+ if (IS_DVC(i2c_dev))
tegra_dvc_init(i2c_dev);
val = I2C_CNFG_NEW_MASTER_FSM | I2C_CNFG_PACKET_MODE_EN |
@@ -685,7 +687,7 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
return err;
}
- if (!i2c_dev->is_dvc && !i2c_dev->is_vi) {
+ if (!IS_DVC(i2c_dev) && !i2c_dev->is_vi) {
u32 sl_cfg = i2c_readl(i2c_dev, I2C_SL_CNFG);
sl_cfg |= I2C_SL_CNFG_NACK | I2C_SL_CNFG_NEWSL;
@@ -915,7 +917,7 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id)
}
i2c_writel(i2c_dev, status, I2C_INT_STATUS);
- if (i2c_dev->is_dvc)
+ if (IS_DVC(i2c_dev))
dvc_writel(i2c_dev, DVC_STATUS_I2C_DONE_INTR, DVC_STATUS);
/*
@@ -954,7 +956,7 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id)
i2c_writel(i2c_dev, status, I2C_INT_STATUS);
- if (i2c_dev->is_dvc)
+ if (IS_DVC(i2c_dev))
dvc_writel(i2c_dev, DVC_STATUS_I2C_DONE_INTR, DVC_STATUS);
if (i2c_dev->dma_mode) {
@@ -1616,7 +1618,9 @@ static const struct of_device_id tegra_i2c_of_match[] = {
{ .compatible = "nvidia,tegra114-i2c", .data = &tegra114_i2c_hw, },
{ .compatible = "nvidia,tegra30-i2c", .data = &tegra30_i2c_hw, },
{ .compatible = "nvidia,tegra20-i2c", .data = &tegra20_i2c_hw, },
+#if IS_ENABLED(CONFIG_I2C_TEGRA_DVC)
{ .compatible = "nvidia,tegra20-i2c-dvc", .data = &tegra20_i2c_hw, },
+#endif
{},
};
MODULE_DEVICE_TABLE(of, tegra_i2c_of_match);
@@ -1635,7 +1639,8 @@ static void tegra_i2c_parse_dt(struct tegra_i2c_dev *i2c_dev)
multi_mode = of_property_read_bool(np, "multi-master");
i2c_dev->multimaster_mode = multi_mode;
- if (of_device_is_compatible(np, "nvidia,tegra20-i2c-dvc"))
+ if (IS_ENABLED(CONFIG_I2C_TEGRA_DVC) &&
+ of_device_is_compatible(np, "nvidia,tegra20-i2c-dvc"))
i2c_dev->is_dvc = true;
if (of_device_is_compatible(np, "nvidia,tegra210-i2c-vi"))
--
2.30.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 0/2] i2c: tegra: allow compiling out support for Tegra's special constrollers
2022-01-16 16:02 [PATCH 0/2] i2c: tegra: allow compiling out support for Tegra's special constrollers Michał Mirosław
2022-01-16 16:02 ` [PATCH 2/2] i2c: tegra: allow VI support to be compiled out Michał Mirosław
2022-01-16 16:02 ` [PATCH 1/2] i2c: tegra: allow DVC " Michał Mirosław
@ 2022-01-16 17:54 ` Dmitry Osipenko
2022-01-16 18:03 ` Michał Mirosław
2 siblings, 1 reply; 11+ messages in thread
From: Dmitry Osipenko @ 2022-01-16 17:54 UTC (permalink / raw)
To: Michał Mirosław, Jonathan Hunter, Laxman Dewangan,
Thierry Reding
Cc: linux-i2c, linux-kernel, linux-tegra
16.01.2022 19:02, Michał Mirosław пишет:
> To patches that, combined, reduce I2C driver's code by ~2kB and a bit
> from runtime overhead for non-Tegra20 or non-Tegra210 builds.
>
> Michał Mirosław (2):
> i2c: tegra: allow DVC support to be compiled out
> i2c: tegra: allow VI support to be compiled out
>
> drivers/i2c/busses/Kconfig | 16 ++++++++++++++++
> drivers/i2c/busses/i2c-tegra.c | 35 +++++++++++++++++++++-------------
> 2 files changed, 38 insertions(+), 13 deletions(-)
>
2KB is a too small difference to justify the ifdefs and Kconfig entries,
IMO.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/2] i2c: tegra: allow compiling out support for Tegra's special constrollers
2022-01-16 17:54 ` [PATCH 0/2] i2c: tegra: allow compiling out support for Tegra's special constrollers Dmitry Osipenko
@ 2022-01-16 18:03 ` Michał Mirosław
2022-01-16 18:34 ` Dmitry Osipenko
0 siblings, 1 reply; 11+ messages in thread
From: Michał Mirosław @ 2022-01-16 18:03 UTC (permalink / raw)
To: Dmitry Osipenko
Cc: Jonathan Hunter, Laxman Dewangan, Thierry Reding, linux-i2c,
linux-kernel, linux-tegra
On Sun, Jan 16, 2022 at 08:54:08PM +0300, Dmitry Osipenko wrote:
> 16.01.2022 19:02, Michał Mirosław пишет:
> > To patches that, combined, reduce I2C driver's code by ~2kB and a bit
> > from runtime overhead for non-Tegra20 or non-Tegra210 builds.
> >
> > Michał Mirosław (2):
> > i2c: tegra: allow DVC support to be compiled out
> > i2c: tegra: allow VI support to be compiled out
> >
> > drivers/i2c/busses/Kconfig | 16 ++++++++++++++++
> > drivers/i2c/busses/i2c-tegra.c | 35 +++++++++++++++++++++-------------
> > 2 files changed, 38 insertions(+), 13 deletions(-)
> >
>
> 2KB is a too small difference to justify the ifdefs and Kconfig entries,
> IMO.
Maybe I should have mentioned that it's ~20%? With my "embedded" hat on:
I think it might be small, but sometimes it is the difference between
bootable kernel or one too big.
Best Regards
Michał Mirosław
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/2] i2c: tegra: allow compiling out support for Tegra's special constrollers
2022-01-16 18:03 ` Michał Mirosław
@ 2022-01-16 18:34 ` Dmitry Osipenko
2022-01-16 21:39 ` Michał Mirosław
0 siblings, 1 reply; 11+ messages in thread
From: Dmitry Osipenko @ 2022-01-16 18:34 UTC (permalink / raw)
To: Michał Mirosław
Cc: Jonathan Hunter, Laxman Dewangan, Thierry Reding, linux-i2c,
linux-kernel, linux-tegra
16.01.2022 21:03, Michał Mirosław пишет:
> On Sun, Jan 16, 2022 at 08:54:08PM +0300, Dmitry Osipenko wrote:
>> 16.01.2022 19:02, Michał Mirosław пишет:
>>> To patches that, combined, reduce I2C driver's code by ~2kB and a bit
>>> from runtime overhead for non-Tegra20 or non-Tegra210 builds.
>>>
>>> Michał Mirosław (2):
>>> i2c: tegra: allow DVC support to be compiled out
>>> i2c: tegra: allow VI support to be compiled out
>>>
>>> drivers/i2c/busses/Kconfig | 16 ++++++++++++++++
>>> drivers/i2c/busses/i2c-tegra.c | 35 +++++++++++++++++++++-------------
>>> 2 files changed, 38 insertions(+), 13 deletions(-)
>>>
>>
>> 2KB is a too small difference to justify the ifdefs and Kconfig entries,
>> IMO.
>
> Maybe I should have mentioned that it's ~20%? With my "embedded" hat on:
> I think it might be small, but sometimes it is the difference between
> bootable kernel or one too big.
10KB is a small size too. I'm very doubtful that such changes make any
real difference in practice.
Much more practical should be to modularize more kernel code. You should
be able to squeeze zImage down to 3MB without any code changes by
toggling more kernel config options to =m. Try to use grate_defconfig
[1] for the base, that is what postmarketOS kernel build uses.
[1]
https://github.com/grate-driver/linux/blob/master/arch/arm/configs/grate_defconfig
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/2] i2c: tegra: allow compiling out support for Tegra's special constrollers
2022-01-16 18:34 ` Dmitry Osipenko
@ 2022-01-16 21:39 ` Michał Mirosław
2022-01-17 15:37 ` Dmitry Osipenko
0 siblings, 1 reply; 11+ messages in thread
From: Michał Mirosław @ 2022-01-16 21:39 UTC (permalink / raw)
To: Dmitry Osipenko
Cc: Jonathan Hunter, Laxman Dewangan, Thierry Reding, linux-i2c,
linux-kernel, linux-tegra
On Sun, Jan 16, 2022 at 09:34:42PM +0300, Dmitry Osipenko wrote:
> 16.01.2022 21:03, Michał Mirosław пишет:
> > On Sun, Jan 16, 2022 at 08:54:08PM +0300, Dmitry Osipenko wrote:
> >> 16.01.2022 19:02, Michał Mirosław пишет:
> >>> To patches that, combined, reduce I2C driver's code by ~2kB and a bit
> >>> from runtime overhead for non-Tegra20 or non-Tegra210 builds.
> >>>
> >>> Michał Mirosław (2):
> >>> i2c: tegra: allow DVC support to be compiled out
> >>> i2c: tegra: allow VI support to be compiled out
> >>>
> >>> drivers/i2c/busses/Kconfig | 16 ++++++++++++++++
> >>> drivers/i2c/busses/i2c-tegra.c | 35 +++++++++++++++++++++-------------
> >>> 2 files changed, 38 insertions(+), 13 deletions(-)
> >>>
> >>
> >> 2KB is a too small difference to justify the ifdefs and Kconfig entries,
> >> IMO.
> >
> > Maybe I should have mentioned that it's ~20%? With my "embedded" hat on:
> > I think it might be small, but sometimes it is the difference between
> > bootable kernel or one too big.
>
> 10KB is a small size too. I'm very doubtful that such changes make any
> real difference in practice.
>
> Much more practical should be to modularize more kernel code. You should
> be able to squeeze zImage down to 3MB without any code changes by
> toggling more kernel config options to =m. Try to use grate_defconfig
> [1] for the base, that is what postmarketOS kernel build uses.
For normal system this solution is workable. But for recovery, where you
have to fit kernel+initrd in whatever small partition is provided (like
eg. in Transformers 8MiB), it becomes a problem from time to time.
(In this case, modules make it worse due to additional overhead in
kernel and userspace).
Best Regards
Michał Mirosław
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/2] i2c: tegra: allow compiling out support for Tegra's special constrollers
2022-01-16 21:39 ` Michał Mirosław
@ 2022-01-17 15:37 ` Dmitry Osipenko
2022-01-17 16:10 ` Michał Mirosław
0 siblings, 1 reply; 11+ messages in thread
From: Dmitry Osipenko @ 2022-01-17 15:37 UTC (permalink / raw)
To: Michał Mirosław
Cc: Jonathan Hunter, Laxman Dewangan, Thierry Reding, linux-i2c,
linux-kernel, linux-tegra
17.01.2022 00:39, Michał Mirosław пишет:
> On Sun, Jan 16, 2022 at 09:34:42PM +0300, Dmitry Osipenko wrote:
>> 16.01.2022 21:03, Michał Mirosław пишет:
>>> On Sun, Jan 16, 2022 at 08:54:08PM +0300, Dmitry Osipenko wrote:
>>>> 16.01.2022 19:02, Michał Mirosław пишет:
>>>>> To patches that, combined, reduce I2C driver's code by ~2kB and a bit
>>>>> from runtime overhead for non-Tegra20 or non-Tegra210 builds.
>>>>>
>>>>> Michał Mirosław (2):
>>>>> i2c: tegra: allow DVC support to be compiled out
>>>>> i2c: tegra: allow VI support to be compiled out
>>>>>
>>>>> drivers/i2c/busses/Kconfig | 16 ++++++++++++++++
>>>>> drivers/i2c/busses/i2c-tegra.c | 35 +++++++++++++++++++++-------------
>>>>> 2 files changed, 38 insertions(+), 13 deletions(-)
>>>>>
>>>>
>>>> 2KB is a too small difference to justify the ifdefs and Kconfig entries,
>>>> IMO.
>>>
>>> Maybe I should have mentioned that it's ~20%? With my "embedded" hat on:
>>> I think it might be small, but sometimes it is the difference between
>>> bootable kernel or one too big.
>>
>> 10KB is a small size too. I'm very doubtful that such changes make any
>> real difference in practice.
>>
>> Much more practical should be to modularize more kernel code. You should
>> be able to squeeze zImage down to 3MB without any code changes by
>> toggling more kernel config options to =m. Try to use grate_defconfig
>> [1] for the base, that is what postmarketOS kernel build uses.
>
> For normal system this solution is workable. But for recovery, where you
> have to fit kernel+initrd in whatever small partition is provided (like
> eg. in Transformers 8MiB), it becomes a problem from time to time.
> (In this case, modules make it worse due to additional overhead in
> kernel and userspace).
My point is that 2KB very likely won't change anything for you. I'd
suggest to take a look at a more "fat" drivers, like DRM/host1x for
example. I suppose it should be possible to save at least couple
hundreds KB by trimming those fat drivers.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 0/2] i2c: tegra: allow compiling out support for Tegra's special constrollers
2022-01-17 15:37 ` Dmitry Osipenko
@ 2022-01-17 16:10 ` Michał Mirosław
0 siblings, 0 replies; 11+ messages in thread
From: Michał Mirosław @ 2022-01-17 16:10 UTC (permalink / raw)
To: Dmitry Osipenko
Cc: Jonathan Hunter, Laxman Dewangan, Thierry Reding, linux-i2c,
linux-kernel, linux-tegra
On Mon, Jan 17, 2022 at 06:37:12PM +0300, Dmitry Osipenko wrote:
> 17.01.2022 00:39, Michał Mirosław пишет:
> > On Sun, Jan 16, 2022 at 09:34:42PM +0300, Dmitry Osipenko wrote:
> >> 16.01.2022 21:03, Michał Mirosław пишет:
> >>> On Sun, Jan 16, 2022 at 08:54:08PM +0300, Dmitry Osipenko wrote:
> >>>> 16.01.2022 19:02, Michał Mirosław пишет:
> >>>>> To patches that, combined, reduce I2C driver's code by ~2kB and a bit
> >>>>> from runtime overhead for non-Tegra20 or non-Tegra210 builds.
> >>>>>
> >>>>> Michał Mirosław (2):
> >>>>> i2c: tegra: allow DVC support to be compiled out
> >>>>> i2c: tegra: allow VI support to be compiled out
> >>>>>
> >>>>> drivers/i2c/busses/Kconfig | 16 ++++++++++++++++
> >>>>> drivers/i2c/busses/i2c-tegra.c | 35 +++++++++++++++++++++-------------
> >>>>> 2 files changed, 38 insertions(+), 13 deletions(-)
> >>>>>
> >>>>
> >>>> 2KB is a too small difference to justify the ifdefs and Kconfig entries,
> >>>> IMO.
> >>>
> >>> Maybe I should have mentioned that it's ~20%? With my "embedded" hat on:
> >>> I think it might be small, but sometimes it is the difference between
> >>> bootable kernel or one too big.
> >>
> >> 10KB is a small size too. I'm very doubtful that such changes make any
> >> real difference in practice.
> >>
> >> Much more practical should be to modularize more kernel code. You should
> >> be able to squeeze zImage down to 3MB without any code changes by
> >> toggling more kernel config options to =m. Try to use grate_defconfig
> >> [1] for the base, that is what postmarketOS kernel build uses.
> >
> > For normal system this solution is workable. But for recovery, where you
> > have to fit kernel+initrd in whatever small partition is provided (like
> > eg. in Transformers 8MiB), it becomes a problem from time to time.
> > (In this case, modules make it worse due to additional overhead in
> > kernel and userspace).
>
> My point is that 2KB very likely won't change anything for you. I'd
> suggest to take a look at a more "fat" drivers, like DRM/host1x for
> example. I suppose it should be possible to save at least couple
> hundreds KB by trimming those fat drivers.
No doubt we can find more code to trim. :-) This one was cheap and easy,
though. BTW, I worked around host1x size by using simpledrmfb instead,
so I'm not sure there will be much benefit to digging there.
Best Regards
Michał Mirosław
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] i2c: tegra: allow DVC support to be compiled out
2022-01-16 16:02 ` [PATCH 1/2] i2c: tegra: allow DVC " Michał Mirosław
@ 2022-01-18 9:46 ` Dmitry Osipenko
2022-01-18 19:48 ` Michał Mirosław
0 siblings, 1 reply; 11+ messages in thread
From: Dmitry Osipenko @ 2022-01-18 9:46 UTC (permalink / raw)
To: Michał Mirosław, Laxman Dewangan, Thierry Reding,
Jonathan Hunter
Cc: linux-i2c, linux-kernel, linux-tegra
16.01.2022 19:02, Michał Mirosław пишет:
> {
> { .compatible = "nvidia,tegra114-i2c", .data = &tegra114_i2c_hw, },
> { .compatible = "nvidia,tegra30-i2c", .data = &tegra30_i2c_hw, },
> { .compatible = "nvidia,tegra20-i2c", .data = &tegra20_i2c_hw, },
> +#if IS_ENABLED(CONFIG_I2C_TEGRA_DVC)
> { .compatible = "nvidia,tegra20-i2c-dvc", .data = &tegra20_i2c_hw, },
> +#endif
You can use IS_ENABLED(ARCH_TEGRA_2x_SOC), and similar for T210. Then
you won't need to add new Kconfig entries.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] i2c: tegra: allow DVC support to be compiled out
2022-01-18 9:46 ` Dmitry Osipenko
@ 2022-01-18 19:48 ` Michał Mirosław
0 siblings, 0 replies; 11+ messages in thread
From: Michał Mirosław @ 2022-01-18 19:48 UTC (permalink / raw)
To: Dmitry Osipenko
Cc: Laxman Dewangan, Thierry Reding, Jonathan Hunter, linux-i2c,
linux-kernel, linux-tegra
On Tue, Jan 18, 2022 at 12:46:39PM +0300, Dmitry Osipenko wrote:
> 16.01.2022 19:02, Michał Mirosław пишет:
> > {
> > { .compatible = "nvidia,tegra114-i2c", .data = &tegra114_i2c_hw, },
> > { .compatible = "nvidia,tegra30-i2c", .data = &tegra30_i2c_hw, },
> > { .compatible = "nvidia,tegra20-i2c", .data = &tegra20_i2c_hw, },
> > +#if IS_ENABLED(CONFIG_I2C_TEGRA_DVC)
> > { .compatible = "nvidia,tegra20-i2c-dvc", .data = &tegra20_i2c_hw, },
> > +#endif
>
> You can use IS_ENABLED(ARCH_TEGRA_2x_SOC), and similar for T210. Then
> you won't need to add new Kconfig entries.
I can do that, thanks! Indeed, the drivers won't be useful with the
specific SoC support disabled anyway.
Best Regards
Michał Mirosław
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2022-01-18 19:49 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-16 16:02 [PATCH 0/2] i2c: tegra: allow compiling out support for Tegra's special constrollers Michał Mirosław
2022-01-16 16:02 ` [PATCH 2/2] i2c: tegra: allow VI support to be compiled out Michał Mirosław
2022-01-16 16:02 ` [PATCH 1/2] i2c: tegra: allow DVC " Michał Mirosław
2022-01-18 9:46 ` Dmitry Osipenko
2022-01-18 19:48 ` Michał Mirosław
2022-01-16 17:54 ` [PATCH 0/2] i2c: tegra: allow compiling out support for Tegra's special constrollers Dmitry Osipenko
2022-01-16 18:03 ` Michał Mirosław
2022-01-16 18:34 ` Dmitry Osipenko
2022-01-16 21:39 ` Michał Mirosław
2022-01-17 15:37 ` Dmitry Osipenko
2022-01-17 16:10 ` Michał Mirosław
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).