[linux-sunxi] Re: [PATCH] clk: sunxi: Extend the simple gates and handle the Allwinner H3
Hi Jean-Francois, On Tue, Dec 08, 2015 at 07:42:26AM +0100, Jean-Francois Moine wrote: > On Mon, 7 Dec 2015 08:31:02 -0600 > Rob Herring wrote: > > > On Sun, Dec 06, 2015 at 10:04:12AM +0100, Jean-Francois Moine wrote: > > > The H3 has a clock gate definition similar to the other Allwinner SoCs, > > > but with a different parent clock for each single gate. > > > > > > Adding the names of the parent clocks in both the source and output clocks > > > permits the use of the simple-gates driver to define the bus gates > > > of all known Allwinner SoCs. > > > > > > Signed-off-by: Jean-Francois Moine > > > --- > > > This patch replaces a part of Jens Kuske's patch > > > [PATCH v5 1/4] clk: sunxi: Add H3 clocks support > > > --- > > > Documentation/devicetree/bindings/clock/sunxi.txt | 25 > > > +++ > > > drivers/clk/sunxi/clk-simple-gates.c | 14 - > > > 2 files changed, 38 insertions(+), 1 deletion(-) > > > > > > diff --git a/Documentation/devicetree/bindings/clock/sunxi.txt > > > b/Documentation/devicetree/bindings/clock/sunxi.txt > > > index 8a47b77..5736e6d 100644 > > > --- a/Documentation/devicetree/bindings/clock/sunxi.txt > > > +++ b/Documentation/devicetree/bindings/clock/sunxi.txt > > > @@ -70,6 +70,7 @@ Required properties: > > > "allwinner,sun8i-a23-usb-clk" - for usb gates + resets on A23 > > > "allwinner,sun9i-a80-usb-mod-clk" - for usb gates + resets on A80 > > > "allwinner,sun9i-a80-usb-phy-clk" - for usb phy gates + resets on A80 > > > + "allwinner,sunxi-gates-clk" - simple gates > > > > > > Required properties for all clocks: > > > - reg : shall be the control register address for the clock. > > > @@ -93,6 +94,12 @@ The "allwinner,sun9i-a80-mmc-config-clk" clock also > > > requires: > > > - #reset-cells : shall be set to 1 > > > - resets : shall be the reset control phandle for the mmc block. > > > > > > +The "allwinner,sunxi-gates-clk" clock also requires: > > > +- clock-names : corresponding names of the parent clocks > > > +when the output clocks have different parents. > > > +These names must be 4 characters long and must appear as a prefix in > > > +the names of the output clocks. See example. > > > + > > > > I don't think you should be encoding relationships of clocks using the > > name strings. We describe relationships in DT via parent/child or > > phandles. > > As you know, in the H3, each of the 49 output clock has one of the 4 > main clocks as its source. > There are 3 options for defining the source of each clock: > 1- all definitions are in the DT, > 2- some definitions are in the DT, some other ones are hard-coded, > 3- all definitions are hard-coded. Look, we all agreed on a solution that raised all objections, but yours. I'm going to take Jens patch. Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. signature.asc Description: Digital signature
Re: [linux-sunxi] [PATCH 01/23] mtd: kill the ecclayout->oobavail field
On Mon, 2015-12-07 at 23:25 +0100, Boris Brezillon wrote: > ecclayout->oobavail is just redundant with the mtd->oobavail field. > Moreover, it prevents static const definition of ecc layouts since > the > NAND framework is calculating this value based on the ecclayout- > >oobfree > field. > > Signed-off-by: Boris Brezillon > --- > drivers/mtd/devices/docg3.c | 5 ++- > drivers/mtd/mtdswap.c | 16 - > drivers/mtd/nand/brcmnand/brcmnand.c | 3 -- > drivers/mtd/nand/docg4.c | 1 - > drivers/mtd/nand/hisi504_nand.c | 1 - > drivers/mtd/nand/nand_base.c | 12 +++ > drivers/mtd/onenand/onenand_base.c| 16 - > drivers/mtd/tests/oobtest.c | 49 +-- > > drivers/staging/mt29f_spinand/mt29f_spinand.c | 1 - > fs/jffs2/wbuf.c | 6 ++-- > include/linux/mtd/mtd.h | 1 - > 11 files changed, 48 insertions(+), 63 deletions(-) > [..] > > diff --git a/drivers/mtd/nand/brcmnand/brcmnand.c > b/drivers/mtd/nand/brcmnand/brcmnand.c > index 35d78f7..a906ec2 100644 > --- a/drivers/mtd/nand/brcmnand/brcmnand.c > +++ b/drivers/mtd/nand/brcmnand/brcmnand.c > @@ -845,9 +845,6 @@ static struct nand_ecclayout *brcmnand_create_layout(int > ecc_level, > break; > } > out: > - /* Sum available OOB */ > - for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES_LARGE; i++) > - layout->oobavail += layout->oobfree[i].length; > return layout; > } You can get rid of the 'out' label and replace the single goto in this function with 'return layout'. [...] > > diff --git a/drivers/mtd/nand/nand_base.c > b/drivers/mtd/nand/nand_base.c > index 0748a13..1107f5c1 100644 > --- a/drivers/mtd/nand/nand_base.c > +++ b/drivers/mtd/nand/nand_base.c > @@ -2037,7 +2037,7 @@ static int nand_do_read_oob(struct mtd_info > *mtd, loff_t from, > stats = mtd->ecc_stats; > > if (ops->mode == MTD_OPS_AUTO_OOB) > - len = chip->ecc.layout->oobavail; > + len = mtd->oobavail; > else > len = mtd->oobsize; > > @@ -2728,7 +2728,7 @@ static int nand_do_write_oob(struct mtd_info > *mtd, loff_t to, > __func__, (unsigned int)to, (int)ops- > >ooblen); > > if (ops->mode == MTD_OPS_AUTO_OOB) > - len = chip->ecc.layout->oobavail; > + len = mtd->oobavail; > else > len = mtd->oobsize; > [...] > diff --git a/drivers/mtd/onenand/onenand_base.c > b/drivers/mtd/onenand/onenand_base.c > index 43b3392..d70bbfd 100644 > --- a/drivers/mtd/onenand/onenand_base.c > +++ b/drivers/mtd/onenand/onenand_base.c > @@ -1125,7 +1125,7 @@ static int onenand_mlc_read_ops_nolock(struct > mtd_info *mtd, loff_t from, > (int)len); > > if (ops->mode == MTD_OPS_AUTO_OOB) > - oobsize = this->ecclayout->oobavail; > + oobsize = mtd->oobavail; > else > oobsize = mtd->oobsize; > > @@ -1230,7 +1230,7 @@ static int onenand_read_ops_nolock(struct > mtd_info *mtd, loff_t from, > (int)len); > > if (ops->mode == MTD_OPS_AUTO_OOB) > - oobsize = this->ecclayout->oobavail; > + oobsize = mtd->oobavail; > else > oobsize = mtd->oobsize; > > @@ -1365,7 +1365,7 @@ static int onenand_read_oob_nolock(struct > mtd_info *mtd, loff_t from, > ops->oobretlen = 0; > > if (mode == MTD_OPS_AUTO_OOB) > - oobsize = this->ecclayout->oobavail; > + oobsize = mtd->oobavail; > else > oobsize = mtd->oobsize; > > @@ -1887,7 +1887,7 @@ static int onenand_write_ops_nolock(struct > mtd_info *mtd, loff_t to, > return 0; > > if (ops->mode == MTD_OPS_AUTO_OOB) > - oobsize = this->ecclayout->oobavail; > + oobsize = mtd->oobavail; > else > oobsize = mtd->oobsize; > > @@ -2063,7 +2063,7 @@ static int onenand_write_oob_nolock(struct > mtd_info *mtd, loff_t to, > ops->oobretlen = 0; > > if (mode == MTD_OPS_AUTO_OOB) > - oobsize = this->ecclayout->oobavail; > + oobsize = mtd->oobavail; > else > oobsize = mtd->oobsize; This identical construction seems to occur multiple times in multiple files. Would it make sense to create a macro for it? Päikest, Priit Laes :) -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] Re: [PATCH] clk: sunxi: Extend the simple gates and handle the Allwinner H3
On Mon, 7 Dec 2015 08:31:02 -0600 Rob Herring wrote: > On Sun, Dec 06, 2015 at 10:04:12AM +0100, Jean-Francois Moine wrote: > > The H3 has a clock gate definition similar to the other Allwinner SoCs, > > but with a different parent clock for each single gate. > > > > Adding the names of the parent clocks in both the source and output clocks > > permits the use of the simple-gates driver to define the bus gates > > of all known Allwinner SoCs. > > > > Signed-off-by: Jean-Francois Moine > > --- > > This patch replaces a part of Jens Kuske's patch > > [PATCH v5 1/4] clk: sunxi: Add H3 clocks support > > --- > > Documentation/devicetree/bindings/clock/sunxi.txt | 25 > > +++ > > drivers/clk/sunxi/clk-simple-gates.c | 14 - > > 2 files changed, 38 insertions(+), 1 deletion(-) > > > > diff --git a/Documentation/devicetree/bindings/clock/sunxi.txt > > b/Documentation/devicetree/bindings/clock/sunxi.txt > > index 8a47b77..5736e6d 100644 > > --- a/Documentation/devicetree/bindings/clock/sunxi.txt > > +++ b/Documentation/devicetree/bindings/clock/sunxi.txt > > @@ -70,6 +70,7 @@ Required properties: > > "allwinner,sun8i-a23-usb-clk" - for usb gates + resets on A23 > > "allwinner,sun9i-a80-usb-mod-clk" - for usb gates + resets on A80 > > "allwinner,sun9i-a80-usb-phy-clk" - for usb phy gates + resets on A80 > > + "allwinner,sunxi-gates-clk" - simple gates > > > > Required properties for all clocks: > > - reg : shall be the control register address for the clock. > > @@ -93,6 +94,12 @@ The "allwinner,sun9i-a80-mmc-config-clk" clock also > > requires: > > - #reset-cells : shall be set to 1 > > - resets : shall be the reset control phandle for the mmc block. > > > > +The "allwinner,sunxi-gates-clk" clock also requires: > > +- clock-names : corresponding names of the parent clocks > > +when the output clocks have different parents. > > +These names must be 4 characters long and must appear as a prefix in > > +the names of the output clocks. See example. > > + > > I don't think you should be encoding relationships of clocks using the > name strings. We describe relationships in DT via parent/child or > phandles. As you know, in the H3, each of the 49 output clock has one of the 4 main clocks as its source. There are 3 options for defining the source of each clock: 1- all definitions are in the DT, 2- some definitions are in the DT, some other ones are hard-coded, 3- all definitions are hard-coded. The 2nd option is the one proposed by Jens https://lkml.org/lkml/2015/12/4/689 In the code, the clock index gives the source clock. This means that this code is H3 specific and that it cannot be reused for an other SoC. So, instead of putting some information in the DT, the 3rd option could be done without too much overhead with a DT: bus_gates: clk@01c20060 { #clock-cells = <1>; compatible = "allwinner,sun8i-h3-bus-gates-clk"; reg = <0x01c20060 0x14>; clocks = <&ahb1>, <&ahb2>, <&apb1>, <&apb2>; clock-names = "ahb1", "ahb2", "apb1", "apb2"; /* no clock-indices, nor clock-output-names, * these ones are hard-coded */ }; But, this option, as the previous one, implies new code for each new SoC. I better like the 1st option (reusable/generic code). This one may be done in many ways: 1.1- define a source phandle of each output clock. There were many proposals for such definitions, the simplest being mine: https://lkml.org/lkml/2015/10/22/109 but this asked for a long list in 'clocks', and Maxime did not like that. 1.2- use a container per source clock https://lkml.org/lkml/2015/10/23/?663 1.3- use a part of the name of the output clock as the source reference. Current proposal, which seemed to suit Maxime https://lkml.org/lkml/2015/10/26/647 1.4- have you any other idea? -- Ken ar c'hentañ | ** Breizh ha Linux atav! ** Jef | http://moinejf.free.fr/ -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [linux-sunxi] [PATCH v5] sun4i-codec: add inputs
Hi Danny, You commit message needs some work. Firstly the title should be a little more descriptive, maybe something like sun4i-codec: Add FM, Line and Mic inputs On Tue, Dec 8, 2015 at 2:48 PM, Danny Milosavljevic wrote: > Hi, > > this is the fifth version of the patch that adds inputs to sun4i-codec. > (Previous versions have been on the linux-sunxi mailing list only, > but this one went to the maintainers as well, > Message-Id: 20151208042013.11d31f09 () dayas) The salutation and info about previous versions being sunxi mailing list only should go beneath the three dashes. > The inputs added are: > - FM-In Left and Right > - Line-In Left and Right > - Mic1-In > - Mic2-In This needs to be reformatted to better describe what's happening in tht > Changes compared to v4 are: > - Mic preamplifier controls have more common names now. > - Mic preamplifier scale has a 0 dB entry as well now, as documented in the > A20 user manual. > - Mic preamplifier has special cases for A20 and A10 now. > - Gain controls have "Gain" in the name now. > > I successfully tested it on an A20 board using alsamixer, headphones, a radio > and > my ears. > Note that because of missing capturing support I tested only the mixing, > for Mic, Line, and FM. > > The patches are on top of > , > branch "sunxi/for-next". > > Regards, >Danny > > Danny (1): > b/sound/soc/sunxi/sun4i-codec.c | 153 > +++- > 1 file changed, 150 insertions(+), 3 deletions(-) The changelog, testing notes, source info and diffstat should also be below the three dashes. > Signed-off-by: Danny Milosavljevic > --- So reformatting it, you'd get something like this: -->8-- Subject: [PATCH v6] sun4i-codec: Add FM, Line and Mic inputs Add inputs to sun4i-codec: - FM-in Left and Right - Line-in Left and Right - Mic1-in - Mic2-in Signed-off-by: Danny ... --- Hi, this is the fifth version of the patch that adds inputs to sun4i-codec. (Previous versions have been on the linux-sunxi mailing list only, but this one went to the maintainers as well, Message-Id: 20151208042013.11d31f09 () dayas) Changes compared to v4 are: - Mic preamplifier controls have more common names now. - Mic preamplifier scale has a 0 dB entry as well now, as documented in the A20 user manual. - Mic preamplifier has special cases for A20 and A10 now. - Gain controls have "Gain" in the name now. I successfully tested it on an A20 board using alsamixer, headphones, a radio and my ears. Note that because of missing capturing support I tested only the mixing, for Mic, Line, and FM. The patches are on top of , branch "sunxi/for-next". Regards, Danny Danny (1): b/sound/soc/sunxi/sun4i-codec.c | 153 +++- 1 file changed, 150 insertions(+), 3 deletions(-) -->8-- Thanks, -- Julian Calaby Email: julian.cal...@gmail.com Profile: http://www.google.com/profiles/julian.calaby/ -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] [PATCH v5] sun4i-codec: add inputs
Hi, this is the fifth version of the patch that adds inputs to sun4i-codec. (Previous versions have been on the linux-sunxi mailing list only, but this one went to the maintainers as well, Message-Id: 20151208042013.11d31f09 () dayas) The inputs added are: - FM-In Left and Right - Line-In Left and Right - Mic1-In - Mic2-In Changes compared to v4 are: - Mic preamplifier controls have more common names now. - Mic preamplifier scale has a 0 dB entry as well now, as documented in the A20 user manual. - Mic preamplifier has special cases for A20 and A10 now. - Gain controls have "Gain" in the name now. I successfully tested it on an A20 board using alsamixer, headphones, a radio and my ears. Note that because of missing capturing support I tested only the mixing, for Mic, Line, and FM. The patches are on top of , branch "sunxi/for-next". Regards, Danny Danny (1): b/sound/soc/sunxi/sun4i-codec.c | 153 +++- 1 file changed, 150 insertions(+), 3 deletions(-) Signed-off-by: Danny Milosavljevic --- diff --git a/sound/soc/sunxi/sun4i-codec.c b/sound/soc/sunxi/sun4i-codec.c index bcbf4da..106b568 100644 --- a/sound/soc/sunxi/sun4i-codec.c +++ b/sound/soc/sunxi/sun4i-codec.c @@ -57,9 +57,20 @@ #define SUN4I_CODEC_DAC_ACTL_DACAENR (31) #define SUN4I_CODEC_DAC_ACTL_DACAENL (30) #define SUN4I_CODEC_DAC_ACTL_MIXEN (29) +#define SUN4I_CODEC_DAC_ACTL_LNG (26) +#define SUN4I_CODEC_DAC_ACTL_FMG (23) +#define SUN4I_CODEC_DAC_ACTL_MICG (20) +#define SUN4I_CODEC_DAC_ACTL_LLNS (19) +#define SUN4I_CODEC_DAC_ACTL_RLNS (18) +#define SUN4I_CODEC_DAC_ACTL_LFMS (17) +#define SUN4I_CODEC_DAC_ACTL_RFMS (16) #define SUN4I_CODEC_DAC_ACTL_LDACLMIXS (15) #define SUN4I_CODEC_DAC_ACTL_RDACRMIXS (14) #define SUN4I_CODEC_DAC_ACTL_LDACRMIXS (13) +#define SUN4I_CODEC_DAC_ACTL_MIC1LS(12) +#define SUN4I_CODEC_DAC_ACTL_MIC1RS(11) +#define SUN4I_CODEC_DAC_ACTL_MIC2LS(10) +#define SUN4I_CODEC_DAC_ACTL_MIC2RS(9) #define SUN4I_CODEC_DAC_ACTL_DACPAS(8) #define SUN4I_CODEC_DAC_ACTL_MIXPAS(7) #define SUN4I_CODEC_DAC_ACTL_PA_MUTE (6) @@ -84,8 +95,11 @@ #define SUN4I_CODEC_ADC_ACTL_PREG1EN (29) #define SUN4I_CODEC_ADC_ACTL_PREG2EN (28) #define SUN4I_CODEC_ADC_ACTL_VMICEN(27) +#define SUN4I_CODEC_ADC_ACTL_PREG1_A10 (25) +#define SUN4I_CODEC_ADC_ACTL_PREG2_A10 (23) #define SUN4I_CODEC_ADC_ACTL_VADCG (20) #define SUN4I_CODEC_ADC_ACTL_ADCIS (17) +#define SUN4I_CODEC_ADC_ACTL_LNRDF (16) #define SUN4I_CODEC_ADC_ACTL_PA_EN (4) #define SUN4I_CODEC_ADC_ACTL_DDE (3) #define SUN4I_CODEC_ADC_DEBUG (0x2c) @@ -94,7 +108,18 @@ #define SUN4I_CODEC_DAC_TXCNT (0x30) #define SUN4I_CODEC_ADC_RXCNT (0x34) #define SUN4I_CODEC_AC_SYS_VERI(0x38) -#define SUN4I_CODEC_AC_MIC_PHONE_CAL (0x3c) + +/* MIC_PHONE_CAL register offsets and bit fields (A20 only) */ +#define SUN7I_CODEC_AC_MIC_PHONE_CAL (0x3c) +#define SUN7I_CODEC_AC_MIC_PHONE_CAL_PREG1 (29) +#define SUN7I_CODEC_AC_MIC_PHONE_CAL_PREG2 (26) +/* note: no idea where the output pins for the following are. */ +#define SUN7I_CODEC_AC_MIC_PHONE_CAL_PHONEOUTG (5) +#define SUN7I_CODEC_AC_MIC_PHONE_CAL_PHONEOUTEN (4) +#define SUN7I_CODEC_AC_MIC_PHONE_CAL_PHONEOUTS3 (3) +#define SUN7I_CODEC_AC_MIC_PHONE_CAL_PHONEOUTS2 (2) +#define SUN7I_CODEC_AC_MIC_PHONE_CAL_PHONEOUTS1 (1) +#define SUN7I_CODEC_AC_MIC_PHONE_CAL_PHONEOUTS0 (0) struct sun4i_codec { struct device *dev; @@ -402,16 +427,94 @@ static const struct snd_kcontrol_new sun4i_codec_pa_mute = SUN4I_CODEC_DAC_ACTL_PA_MUTE, 1, 0); static DECLARE_TLV_DB_SCALE(sun4i_codec_pa_volume_scale, -6300, 100, 1); +static DECLARE_TLV_DB_SCALE(sun4i_codec_linein_loopback_gain_scale, -150, 150, 0); +static DECLARE_TLV_DB_SCALE(sun4i_codec_fmin_loopback_gain_scale, -450, 150, 0); +static DECLARE_TLV_DB_SCALE(sun4i_codec_micin_loopback_gain_scale, -450, 150, 0); +static DECLARE_TLV_DB_RANGE(sun7i_codec_micin_preamp_gain_scale, + 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0), + 1, 7, TLV_DB_SCALE_ITEM(2400, 300, 0) +); +static DECLARE_TLV_DB_RANGE(sun4i_codec_micin_preamp_gain_scale_a10, + 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0), + 1, 7, TLV_DB_SCALE_ITEM(3500, 300, 0) +); + +struct snd_kcontrol_new sun7ionly_codec_widgets[] = { + SOC_SINGLE_TLV("Mic1-In Boost Gain", + SUN7I_COD
[linux-sunxi] Re: [PATCH 04/23] mtd: nand: s3c2410: kill the ->ecc_layout field
On 08.12.2015 07:25, Boris Brezillon wrote: > The s3c2410 is allowing board data to overload the default ECC layout > defined inside the driver, but this feature is not used by board > specific definitions. > Kill this field so that we can easily move to a model where ecclayout > are dynamically allocated by the NAND controller driver. > > Signed-off-by: Boris Brezillon > --- > arch/arm/plat-samsung/devs.c | 9 - > drivers/mtd/nand/s3c2410.c | 3 --- > include/linux/platform_data/mtd-nand-s3c2410.h | 1 - > 3 files changed, 13 deletions(-) Acked-by: Krzysztof Kozlowski Best regards, Krzysztof -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [linux-sunxi] [PATCH 21/23] staging: mt29f_spinand: switch to mtd_ooblayout_ops
Hi Boris, On Tue, Dec 8, 2015 at 9:26 AM, Boris Brezillon wrote: > Signed-off-by: Boris Brezillon > --- > drivers/staging/mt29f_spinand/mt29f_spinand.c | 44 > --- > 1 file changed, 26 insertions(+), 18 deletions(-) > > diff --git a/drivers/staging/mt29f_spinand/mt29f_spinand.c > b/drivers/staging/mt29f_spinand/mt29f_spinand.c > index cb9d5ab..967d50a 100644 > --- a/drivers/staging/mt29f_spinand/mt29f_spinand.c > +++ b/drivers/staging/mt29f_spinand/mt29f_spinand.c > @@ -42,23 +42,29 @@ static inline struct spinand_state *mtd_to_state(struct > mtd_info *mtd) > static int enable_hw_ecc; > static int enable_read_hw_ecc; > > -static struct nand_ecclayout spinand_oob_64 = { > - .eccbytes = 24, > - .eccpos = { > - 1, 2, 3, 4, 5, 6, > - 17, 18, 19, 20, 21, 22, > - 33, 34, 35, 36, 37, 38, > - 49, 50, 51, 52, 53, 54, }, > - .oobfree = { > - {.offset = 8, > - .length = 8}, > - {.offset = 24, > - .length = 8}, > - {.offset = 40, > - .length = 8}, > - {.offset = 56, > - .length = 8}, > - } > +static int spinand_oob_64_eccpos(struct mtd_info *mtd, int eccbyte) > +{ > + if (eccbyte > 23) > + return -ERANGE; > + > + return ((eccbyte / 6) * 16) + 1; Are you sure this is correct? My reading of this is that we'd get 1 for eccbytes 0 through 5. Would ((eccbyte / 6) * 16) + (eccbyte % 6) + 1 be more correct? Thanks, -- Julian Calaby Email: julian.cal...@gmail.com Profile: http://www.google.com/profiles/julian.calaby/ -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] Re: [PATCH 12/23] mtd: use mtd_eccpos() and mtd_oobfree() where appropriate
Hi Boris, [auto build test WARNING on next-20151207] [cannot apply to staging/staging-testing v4.4-rc4 v4.4-rc3 v4.4-rc2 v4.4-rc4] url: https://github.com/0day-ci/linux/commits/Boris-Brezillon/mtd-rework-ECC-layout-definition/20151208-063127 reproduce: make htmldocs All warnings (new ones prefixed by >>): >> drivers/mtd/nand/nand_base.c:1607: warning: No description found for >> parameter 'mtd' >> drivers/mtd/nand/nand_base.c:1607: warning: Excess function parameter 'chip' >> description in 'nand_transfer_oob' >> drivers/mtd/nand/nand_base.c:1607: warning: No description found for >> parameter 'mtd' >> drivers/mtd/nand/nand_base.c:1607: warning: Excess function parameter 'chip' >> description in 'nand_transfer_oob' vim +/mtd +1607 drivers/mtd/nand/nand_base.c 7e4178f9 Vitaly Wool 2006-06-07 1591 i = mtd->oobsize - (oob - chip->oob_poi); f5bbdacc Thomas Gleixner 2006-05-25 1592 if (i) f5bbdacc Thomas Gleixner 2006-05-25 1593 chip->read_buf(mtd, oob, i); f5bbdacc Thomas Gleixner 2006-05-25 1594 3f91e94f Mike Dunn 2012-04-25 1595 return max_bitflips; ^1da177e Linus Torvalds 2005-04-16 1596 } ^1da177e Linus Torvalds 2005-04-16 1597 f5bbdacc Thomas Gleixner 2006-05-25 1598 /** 7854d3f7 Brian Norris2011-06-23 1599 * nand_transfer_oob - [INTERN] Transfer oob to client buffer 8593fbc6 Thomas Gleixner 2006-05-29 1600 * @chip: nand chip structure 844d3b42 Randy Dunlap2006-06-28 1601 * @oob: oob destination address 8593fbc6 Thomas Gleixner 2006-05-29 1602 * @ops: oob ops structure 7014568b Vitaly Wool 2006-11-03 1603 * @len: size of oob to transfer 8593fbc6 Thomas Gleixner 2006-05-29 1604 */ 64456fac Boris Brezillon 2015-12-07 1605 static uint8_t *nand_transfer_oob(struct mtd_info *mtd, uint8_t *oob, 7014568b Vitaly Wool 2006-11-03 1606 struct mtd_oob_ops *ops, size_t len) 8593fbc6 Thomas Gleixner 2006-05-29 @1607 { 64456fac Boris Brezillon 2015-12-07 1608 struct nand_chip *chip = mtd->priv; 64456fac Boris Brezillon 2015-12-07 1609 8593fbc6 Thomas Gleixner 2006-05-29 1610 switch (ops->mode) { 8593fbc6 Thomas Gleixner 2006-05-29 1611 0612b9dd Brian Norris2011-08-30 1612 case MTD_OPS_PLACE_OOB: 0612b9dd Brian Norris2011-08-30 1613 case MTD_OPS_RAW: 8593fbc6 Thomas Gleixner 2006-05-29 1614 memcpy(oob, chip->oob_poi + ops->ooboffs, len); 8593fbc6 Thomas Gleixner 2006-05-29 1615 return oob + len; :: The code at line 1607 was first introduced by commit :: 8593fbc68b0df1168995de76d1af38eb62fd6b62 [MTD] Rework the out of band handling completely :: TO: Thomas Gleixner :: CC: Thomas Gleixner --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. .config.gz Description: Binary data
[linux-sunxi] Re: [PATCH 22/23] mtd: nand: kill layout field
Hi Boris, [auto build test ERROR on next-20151207] [cannot apply to staging/staging-testing v4.4-rc4 v4.4-rc3 v4.4-rc2 v4.4-rc4] url: https://github.com/0day-ci/linux/commits/Boris-Brezillon/mtd-rework-ECC-layout-definition/20151208-063127 config: powerpc-allyesconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=powerpc All error/warnings (new ones prefixed by >>): In file included from include/linux/printk.h:277:0, from include/linux/kernel.h:13, from include/linux/list.h:8, from include/linux/module.h:9, from drivers/mtd/nand/fsl_elbc_nand.c:25: drivers/mtd/nand/fsl_elbc_nand.c: In function 'fsl_elbc_chip_init_tail': >> drivers/mtd/nand/fsl_elbc_nand.c:683:19: error: 'struct nand_ecc_ctrl' has >> no member named 'layout' chip->ecc.layout); ^ include/linux/dynamic_debug.h:87:9: note: in definition of macro 'dynamic_dev_dbg' ##__VA_ARGS__); \ ^ >> drivers/mtd/nand/fsl_elbc_nand.c:682:2: note: in expansion of macro 'dev_dbg' dev_dbg(priv->dev, "fsl_elbc_init: nand->ecc.layout = %p\n", ^ drivers/mtd/nand/fsl_elbc_nand.c: In function 'fsl_elbc_chip_init': drivers/mtd/nand/fsl_elbc_nand.c:797:34: error: 'fsl_elbc_ooblayout_op' undeclared (first use in this function) mtd_set_ooblayout(&priv->mtd, &fsl_elbc_ooblayout_op); ^ drivers/mtd/nand/fsl_elbc_nand.c:797:34: note: each undeclared identifier is reported only once for each function it appears in vim +683 drivers/mtd/nand/fsl_elbc_nand.c 3ab8f2a2 Roy Zang 2010-10-18 676 dev_dbg(priv->dev, "fsl_elbc_init: nand->ecc.steps = %d\n", 76b10467 Scott Wood 2008-02-06 677 chip->ecc.steps); 3ab8f2a2 Roy Zang 2010-10-18 678 dev_dbg(priv->dev, "fsl_elbc_init: nand->ecc.bytes = %d\n", 76b10467 Scott Wood 2008-02-06 679 chip->ecc.bytes); 3ab8f2a2 Roy Zang 2010-10-18 680 dev_dbg(priv->dev, "fsl_elbc_init: nand->ecc.total = %d\n", 76b10467 Scott Wood 2008-02-06 681 chip->ecc.total); 3ab8f2a2 Roy Zang 2010-10-18 @682 dev_dbg(priv->dev, "fsl_elbc_init: nand->ecc.layout = %p\n", 76b10467 Scott Wood 2008-02-06 @683 chip->ecc.layout); 3ab8f2a2 Roy Zang 2010-10-18 684 dev_dbg(priv->dev, "fsl_elbc_init: mtd->flags = %08x\n", mtd->flags); 3ab8f2a2 Roy Zang 2010-10-18 685 dev_dbg(priv->dev, "fsl_elbc_init: mtd->size = %lld\n", mtd->size); 3ab8f2a2 Roy Zang 2010-10-18 686 dev_dbg(priv->dev, "fsl_elbc_init: mtd->erasesize = %d\n", :: The code at line 683 was first introduced by commit :: 76b104671632c225ad594a50f9e26ada67bc0a74 [MTD] [NAND] Freescale enhanced Local Bus Controller FCM NAND support. :: TO: Scott Wood :: CC: David Woodhouse --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. .config.gz Description: Binary data
[linux-sunxi] Re: [PATCH 12/23] mtd: use mtd_eccpos() and mtd_oobfree() where appropriate
Hi Boris, [auto build test ERROR on next-20151207] [cannot apply to staging/staging-testing v4.4-rc4 v4.4-rc3 v4.4-rc2 v4.4-rc4] url: https://github.com/0day-ci/linux/commits/Boris-Brezillon/mtd-rework-ECC-layout-definition/20151208-063127 config: i386-randconfig-x006-12070758 (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=i386 All error/warnings (new ones prefixed by >>): In file included from include/linux/linkage.h:4:0, from include/linux/kernel.h:6, from drivers/mtd/mtdswap.c:27: drivers/mtd/mtdswap.c: In function 'mtdswap_add_mtd': >> drivers/mtd/mtdswap.c:1449:6: error: too few arguments to function >> 'mtd_oobfree' if (mtd_oobfree(mtd, 0) < 0) { ^ include/linux/compiler.h:147:28: note: in definition of macro '__trace_if' if (__builtin_constant_p((cond)) ? !!(cond) : \ ^ >> drivers/mtd/mtdswap.c:1449:2: note: in expansion of macro 'if' if (mtd_oobfree(mtd, 0) < 0) { ^ In file included from drivers/mtd/mtdswap.c:29:0: include/linux/mtd/mtd.h:267:19: note: declared here static inline int mtd_oobfree(struct mtd_info *mtd, int section, ^ In file included from include/linux/linkage.h:4:0, from include/linux/kernel.h:6, from drivers/mtd/mtdswap.c:27: >> drivers/mtd/mtdswap.c:1449:6: error: too few arguments to function >> 'mtd_oobfree' if (mtd_oobfree(mtd, 0) < 0) { ^ include/linux/compiler.h:147:40: note: in definition of macro '__trace_if' if (__builtin_constant_p((cond)) ? !!(cond) : \ ^ >> drivers/mtd/mtdswap.c:1449:2: note: in expansion of macro 'if' if (mtd_oobfree(mtd, 0) < 0) { ^ In file included from drivers/mtd/mtdswap.c:29:0: include/linux/mtd/mtd.h:267:19: note: declared here static inline int mtd_oobfree(struct mtd_info *mtd, int section, ^ In file included from include/linux/linkage.h:4:0, from include/linux/kernel.h:6, from drivers/mtd/mtdswap.c:27: >> drivers/mtd/mtdswap.c:1449:6: error: too few arguments to function >> 'mtd_oobfree' if (mtd_oobfree(mtd, 0) < 0) { ^ include/linux/compiler.h:158:16: note: in definition of macro '__trace_if' __r = !!(cond); \ ^ >> drivers/mtd/mtdswap.c:1449:2: note: in expansion of macro 'if' if (mtd_oobfree(mtd, 0) < 0) { ^ In file included from drivers/mtd/mtdswap.c:29:0: include/linux/mtd/mtd.h:267:19: note: declared here static inline int mtd_oobfree(struct mtd_info *mtd, int section, ^ vim +/mtd_oobfree +1449 drivers/mtd/mtdswap.c 1443 if (PAGE_SIZE % mtd->writesize || mtd->writesize > PAGE_SIZE) { 1444 printk(KERN_ERR "%s: PAGE_SIZE %lu not multiple of write size" 1445 " %u\n", MTDSWAP_PREFIX, PAGE_SIZE, mtd->writesize); 1446 return; 1447 } 1448 > 1449 if (mtd_oobfree(mtd, 0) < 0) { 1450 printk(KERN_ERR "%s: mtd%d does not have OOB\n", 1451 MTDSWAP_PREFIX, mtd->index); 1452 return; --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. .config.gz Description: Binary data
[linux-sunxi] [PATCH 23/23] mtd: kill the nand_ecclayout struct
Now that all mtd drivers have moved to the mtd_ooblayout_ops model we can safely remove the struct nand_ecclayout definition, and all the remaining places where it was still used. Signed-off-by: Boris Brezillon --- drivers/mtd/mtdchar.c | 12 ++-- drivers/mtd/mtdcore.c | 44 include/linux/mtd/mtd.h| 20 include/uapi/mtd/mtd-abi.h | 2 +- 4 files changed, 7 insertions(+), 71 deletions(-) diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index c03b678..322e838 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c @@ -465,12 +465,12 @@ static int mtdchar_readoob(struct file *file, struct mtd_info *mtd, } /* - * Copies (and truncates, if necessary) data from the larger struct, - * nand_ecclayout, to the smaller, deprecated layout struct, - * nand_ecclayout_user. This is necessary only to support the deprecated - * API ioctl ECCGETLAYOUT while allowing all new functionality to use - * nand_ecclayout flexibly (i.e. the struct may change size in new - * releases without requiring major rewrites). + * Copies (and truncates, if necessary) OOB layout information to the + * deprecated layout struct, nand_ecclayout_user. This is necessary only to + * support the deprecated API ioctl ECCGETLAYOUT while allowing all new + * functionality to use mtd_ooblayout_ops flexibly (i.e. mtd_ooblayout_ops + * can describe any kind of OOB layout with almost zero overhead from a + * memory usage point of view). */ static int shrink_ecclayout(struct mtd_info *mtd, struct nand_ecclayout_user *to) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index d87f3621..62f83b0 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -833,50 +833,6 @@ void __put_mtd_device(struct mtd_info *mtd) } EXPORT_SYMBOL_GPL(__put_mtd_device); -static int nand_ecclayout_eccpos(struct mtd_info *mtd, int eccbyte) -{ - struct nand_ecclayout *layout = mtd->ecclayout; - - if (!layout) - return -ENOTSUPP; - - if (eccbyte >= layout->eccbytes) - return -ERANGE; - - return layout->eccpos[eccbyte]; -} - -static int nand_ecclayout_oobfree(struct mtd_info *mtd, int section, - struct nand_oobfree *oobfree) -{ - struct nand_ecclayout *layout = mtd->ecclayout; - - if (!layout) - return -ENOTSUPP; - - if (section >= MTD_MAX_OOBFREE_ENTRIES_LARGE) - return -ERANGE; - - *oobfree = layout->oobfree[section]; - - return 0; -} - -static const struct mtd_ooblayout_ops nand_ecclayout_ops = { - .eccpos = nand_ecclayout_eccpos, - .oobfree = nand_ecclayout_oobfree, -}; - -void mtd_set_ecclayout(struct mtd_info *mtd, struct nand_ecclayout *ecclayout) -{ - if (!mtd || !ecclayout) - return; - - mtd->ecclayout = ecclayout; - mtd_set_ooblayout(mtd, &nand_ecclayout_ops); -} -EXPORT_SYMBOL_GPL(mtd_set_ecclayout); - /* * Erase is an asynchronous operation. Device drivers are supposed * to call instr->callback() whenever the operation completes, even diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 9c3699b..3a4bab7 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -96,21 +96,6 @@ struct mtd_oob_ops { #define MTD_MAX_OOBFREE_ENTRIES_LARGE 32 #define MTD_MAX_ECCPOS_ENTRIES_LARGE 640 -/* - * Internal ECC layout control structure. For historical reasons, there is a - * similar, smaller struct nand_ecclayout_user (in mtd-abi.h) that is retained - * for export to user-space via the ECCGETLAYOUT ioctl. - * nand_ecclayout should be expandable in the future simply by the above macros. - * - * This structure is now deprecated, you should use struct nand_ecclayout_ops - * to describe your OOB layout. - */ -struct nand_ecclayout { - __u32 eccbytes; - __u32 eccpos[MTD_MAX_ECCPOS_ENTRIES_LARGE]; - struct nand_oobfree oobfree[MTD_MAX_OOBFREE_ENTRIES_LARGE]; -}; - /** * struct mtd_ooblayout_ops - NAND OOB layout operations. * @@ -183,9 +168,6 @@ struct mtd_info { const char *name; int index; - /* [Deprecated] ECC layout structure pointer - read only! */ - struct nand_ecclayout *ecclayout; - /* OOB layout description */ const struct mtd_ooblayout_ops *ooblayout; @@ -279,8 +261,6 @@ static inline void mtd_set_ooblayout(struct mtd_info *mtd, mtd->ooblayout = ooblayout; } -void mtd_set_ecclayout(struct mtd_info *mtd, struct nand_ecclayout *ecclayout); - static inline int mtd_eccpos(struct mtd_info *mtd, int eccbyte) { if (!mtd->ooblayout || !mtd->ooblayout->eccpos) diff --git a/include/uapi/mtd/mtd-abi.h b/include/uapi/mtd/mtd-abi.h index 763bb69..0ec1da2 100644 --- a/include/uapi/mtd/mtd-abi.h +++ b/include/uapi/mtd/mtd-abi.h @@ -228,7 +228,7 @@ struct nand_oobfree { * complete set of ECC information. The ioctl tru
[linux-sunxi] [PATCH 15/23] mtd: create an mtd_ooblayout_ops struct to ease ECC layout definition
ECC layout definitions are currently exposed using the nand_ecclayout struct which embeds oobfree and eccpos arrays with predefined size. This approach was acceptable when the NAND were providing relatively small OOB regions, but MLC and TLC now provide OOB regions of several hundreds of bytes, which implies a non negigible size penalty for everybody even those who only need to support legacy NANDs. Create an mtd_ooblayout_ops interface providing the same functionality (expose the ECC and OOBFREE layout) without the need for this huge structure. The mtd->ecclayout is now deprecated and should be replaced by the equivalent mtd_ooblayout_ops. In the meantime we provide a wrapper around the ->ecclayout field to ease migration to this new model. Signed-off-by: Boris Brezillon --- drivers/mtd/mtdchar.c | 4 ++-- drivers/mtd/mtdconcat.c | 2 +- drivers/mtd/mtdcore.c | 44 drivers/mtd/mtdpart.c | 22 +++- include/linux/mtd/mtd.h | 53 + 5 files changed, 104 insertions(+), 21 deletions(-) diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 66d0898..c03b678 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c @@ -862,7 +862,7 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg) { struct nand_oobinfo oi; - if (!mtd->ecclayout) + if (!mtd->ooblayout) return -EOPNOTSUPP; ret = get_oobinfo(mtd, &oi); @@ -956,7 +956,7 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg) { struct nand_ecclayout_user *usrlay; - if (!mtd->ecclayout) + if (!mtd->ooblayout) return -EOPNOTSUPP; usrlay = kmalloc(sizeof(*usrlay), GFP_KERNEL); diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index 481565e..d573606 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c @@ -777,7 +777,7 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to c } - mtd_set_ecclayout(&concat->mtd, subdev[0]->ecclayout); + mtd_set_ooblayout(&concat->mtd, subdev[0]->ooblayout); concat->num_subdev = num_devs; concat->mtd.name = name; diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 62f83b0..d87f3621 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -833,6 +833,50 @@ void __put_mtd_device(struct mtd_info *mtd) } EXPORT_SYMBOL_GPL(__put_mtd_device); +static int nand_ecclayout_eccpos(struct mtd_info *mtd, int eccbyte) +{ + struct nand_ecclayout *layout = mtd->ecclayout; + + if (!layout) + return -ENOTSUPP; + + if (eccbyte >= layout->eccbytes) + return -ERANGE; + + return layout->eccpos[eccbyte]; +} + +static int nand_ecclayout_oobfree(struct mtd_info *mtd, int section, + struct nand_oobfree *oobfree) +{ + struct nand_ecclayout *layout = mtd->ecclayout; + + if (!layout) + return -ENOTSUPP; + + if (section >= MTD_MAX_OOBFREE_ENTRIES_LARGE) + return -ERANGE; + + *oobfree = layout->oobfree[section]; + + return 0; +} + +static const struct mtd_ooblayout_ops nand_ecclayout_ops = { + .eccpos = nand_ecclayout_eccpos, + .oobfree = nand_ecclayout_oobfree, +}; + +void mtd_set_ecclayout(struct mtd_info *mtd, struct nand_ecclayout *ecclayout) +{ + if (!mtd || !ecclayout) + return; + + mtd->ecclayout = ecclayout; + mtd_set_ooblayout(mtd, &nand_ecclayout_ops); +} +EXPORT_SYMBOL_GPL(mtd_set_ecclayout); + /* * Erase is an asynchronous operation. Device drivers are supposed * to call instr->callback() whenever the operation completes, even diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 244faa8..2b5c8ca 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c @@ -320,6 +320,26 @@ static int part_block_markbad(struct mtd_info *mtd, loff_t ofs) return res; } +static int part_ooblayout_eccpos(struct mtd_info *mtd, int eccbyte) +{ + struct mtd_part *part = mtd_to_part(mtd); + + return mtd_eccpos(part->master, eccbyte); +} + +static int part_ooblayout_oobfree(struct mtd_info *mtd, int section, + struct nand_oobfree *oobfree) +{ + struct mtd_part *part = mtd_to_part(mtd); + + return mtd_oobfree(part->master, section, oobfree); +} + +static const struct mtd_ooblayout_ops part_ooblayout_ops = { + .eccpos = part_ooblayout_eccpos, + .oobfree = part_ooblayout_oobfree, +}; + static inline void free_partition(struct mtd_part *p) { kfree(p->mtd.name); @@ -536,7 +556,7 @@ static struct mtd_part *allocate_partition(struct mtd_info *master, part->name); } - mtd_set_eccl
[linux-sunxi] [PATCH 11/23] mtd: add mtd_eccpos(), mtd_oobfree() and mtd_eccbytes() helper functions
In order to make the ecclayout definition completely dynamic we need to rework the way these different ECC layouts are defined and iterated. Create the mtd_eccpos(), mtd_oobfree() and mtd_eccbytes() helpers to hide ecclayout definition internals to their users. Signed-off-by: Boris Brezillon --- include/linux/mtd/mtd.h | 32 1 file changed, 32 insertions(+) diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 9cf13c4..25e3d0f 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -253,6 +253,38 @@ struct mtd_info { int usecount; }; +static inline int mtd_eccpos(struct mtd_info *mtd, int eccbyte) +{ + if (!mtd->ecclayout) + return -ENOTSUPP; + + if (eccbyte >= mtd->ecclayout->eccbytes) + return -ERANGE; + + return mtd->ecclayout->eccpos[eccbyte]; +} + +static inline int mtd_oobfree(struct mtd_info *mtd, int section, + struct nand_oobfree *oobfree) +{ + memset(oobfree, 0, sizeof(*oobfree)); + + if (!mtd->ecclayout) + return -ENOTSUPP; + + if (section >= MTD_MAX_OOBFREE_ENTRIES_LARGE) + return -ERANGE; + + *oobfree = mtd->ecclayout->oobfree[section]; + + return 0; +} + +static inline int mtd_eccbytes(struct mtd_info *mtd) +{ + return mtd->ecclayout ? mtd->ecclayout->eccbytes : 0; +} + static inline void mtd_set_of_node(struct mtd_info *mtd, struct device_node *np) { -- 2.1.4 -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] [PATCH 18/23] mtd: nand: bch: switch to nand_ecclayout_pos
Signed-off-by: Boris Brezillon --- drivers/mtd/nand/nand_bch.c | 33 +++-- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/drivers/mtd/nand/nand_bch.c b/drivers/mtd/nand/nand_bch.c index 9cff544..2937b49 100644 --- a/drivers/mtd/nand/nand_bch.c +++ b/drivers/mtd/nand/nand_bch.c @@ -32,13 +32,11 @@ /** * struct nand_bch_control - private NAND BCH control structure * @bch: BCH control structure - * @ecclayout: private ecc layout for this BCH configuration * @errloc:error location array * @eccmask: XOR ecc mask, allows erased pages to be decoded as valid */ struct nand_bch_control { struct bch_control *bch; - struct nand_ecclayout ecclayout; unsigned int *errloc; unsigned char*eccmask; }; @@ -124,7 +122,6 @@ struct nand_bch_control *nand_bch_init(struct mtd_info *mtd) { struct nand_chip *nand = mtd_to_nand(mtd); unsigned int m, t, eccsteps, i; - struct nand_ecclayout *layout = nand->ecc.layout; struct nand_bch_control *nbc = NULL; unsigned char *erased_page; unsigned int eccsize = nand->ecc.size; @@ -161,8 +158,17 @@ struct nand_bch_control *nand_bch_init(struct mtd_info *mtd) eccsteps = mtd->writesize/eccsize; + /* +* Rely on the default ecclayout to ooblayout wrapper provided by MTD +* core if ecc.layout is not NULL. +* FIXME: this should be removed when all callers have moved to the +* mtd_ooblayout_ops approach. +*/ + if (nand->ecc.layout) + mtd_set_ecclayout(mtd, nand->ecc.layout); + /* if no ecc placement scheme was provided, build one */ - if (!layout) { + if (!mtd->ooblayout) { /* handle large page devices only */ if (mtd->oobsize < 64) { @@ -171,24 +177,7 @@ struct nand_bch_control *nand_bch_init(struct mtd_info *mtd) goto fail; } - layout = &nbc->ecclayout; - layout->eccbytes = eccsteps*eccbytes; - - /* reserve 2 bytes for bad block marker */ - if (layout->eccbytes+2 > mtd->oobsize) { - printk(KERN_WARNING "no suitable oob scheme available " - "for oobsize %d eccbytes %u\n", mtd->oobsize, - eccbytes); - goto fail; - } - /* put ecc bytes at oob tail */ - for (i = 0; i < layout->eccbytes; i++) - layout->eccpos[i] = mtd->oobsize-layout->eccbytes+i; - - layout->oobfree[0].offset = 2; - layout->oobfree[0].length = mtd->oobsize-2-layout->eccbytes; - - nand->ecc.layout = layout; + mtd_set_ooblayout(mtd, &nand_ooblayout_lp_ops); } /* sanity checks */ -- 2.1.4 -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] [PATCH 20/23] mtd: onenand: switch to mtd_ooblayout_ops
Implementing the mtd_ooblayout_ops interface is the new way of exposing ECC/OOB layout to MTD users. Modify the onenand drivers to switch to this approach. Signed-off-by: Boris Brezillon --- drivers/mtd/onenand/onenand_base.c | 144 + include/linux/mtd/onenand.h| 2 - 2 files changed, 82 insertions(+), 64 deletions(-) diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index b5937b7..5c7ff9f 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/drivers/mtd/onenand/onenand_base.c @@ -68,21 +68,29 @@ MODULE_PARM_DESC(otp, "Corresponding behaviour of OneNAND in OTP" * flexonenand_oob_128 - oob info for Flex-Onenand with 4KB page * For now, we expose only 64 out of 80 ecc bytes */ -static struct nand_ecclayout flexonenand_oob_128 = { - .eccbytes = 64, - .eccpos = { - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 102, 103, 104, 105 - }, - .oobfree= { - {2, 4}, {18, 4}, {34, 4}, {50, 4}, - {66, 4}, {82, 4}, {98, 4}, {114, 4} - } +static int flexonenand_eccpos(struct mtd_info *mtd, int eccbyte) +{ + if (eccbyte > 79) + return -ERANGE; + + return ((eccbyte / 10) * 16) + 6 + (eccbyte % 10); +} + +static int flexonenand_oobfree(struct mtd_info *mtd, int section, + struct nand_oobfree *oobfree) +{ + if (section > 7) + return -ERANGE; + + oobfree->offset = (section * 16) + 2; + oobfree->length = 4; + + return 0; +} + +const struct mtd_ooblayout_ops flexonenand_ooblayout_ops = { + .eccpos = flexonenand_eccpos, + .oobfree = flexonenand_oobfree, }; /* @@ -91,56 +99,69 @@ static struct nand_ecclayout flexonenand_oob_128 = { * Based on specification: * 4Gb M-die OneNAND Flash (KFM4G16Q4M, KFN8G16Q4M). Rev. 1.3, Apr. 2010 * - * For eccpos we expose only 64 bytes out of 72 (see struct nand_ecclayout) - * * oobfree uses the spare area fields marked as * "Managed by internal ECC logic for Logical Sector Number area" */ -static struct nand_ecclayout onenand_oob_128 = { - .eccbytes = 64, - .eccpos = { - 7, 8, 9, 10, 11, 12, 13, 14, 15, - 23, 24, 25, 26, 27, 28, 29, 30, 31, - 39, 40, 41, 42, 43, 44, 45, 46, 47, - 55, 56, 57, 58, 59, 60, 61, 62, 63, - 71, 72, 73, 74, 75, 76, 77, 78, 79, - 87, 88, 89, 90, 91, 92, 93, 94, 95, - 103, 104, 105, 106, 107, 108, 109, 110, 111, - 119 - }, - .oobfree= { - {2, 3}, {18, 3}, {34, 3}, {50, 3}, - {66, 3}, {82, 3}, {98, 3}, {114, 3} - } +static int onenand_oob_128_eccpos(struct mtd_info *mtd, int eccbyte) +{ + if (eccbyte >= 72) + return -ERANGE; + + return ((eccbyte / 9) * 16) + 7 + (eccbyte % 9); +} + +static int onenand_oob_128_oobfree(struct mtd_info *mtd, int section, + struct nand_oobfree *oobfree) +{ + if (section >= 8) + return -ERANGE; + + oobfree->offset = (section * 16) + 2; + oobfree->length = 3; + + return 0; +} + +const struct mtd_ooblayout_ops onenand_oob_128_ooblayout_ops = { + .eccpos = onenand_oob_128_eccpos, + .oobfree = onenand_oob_128_oobfree, }; /** - * onenand_oob_64 - oob info for large (2KB) page + * onenand_oob_32_64 - oob info for large (2KB) page */ -static struct nand_ecclayout onenand_oob_64 = { - .eccbytes = 20, - .eccpos = { - 8, 9, 10, 11, 12, - 24, 25, 26, 27, 28, - 40, 41, 42, 43, 44, - 56, 57, 58, 59, 60, - }, - .oobfree= { - {2, 3}, {14, 2}, {18, 3}, {30, 2}, - {34, 3}, {46, 2}, {50, 3}, {62, 2} +static int onenand_oob_32_64_eccpos(struct mtd_info *mtd, int eccbyte) +{ + int eccbytes = (mtd->oobsize / 32) * 10; + + if (eccbyte >= eccbytes) + return -ERANGE; + + return ((eccbyte / 5) * 16) + 8 + (eccbyte % 5); +} + +static int onenand_oob_32_64_oobfree(struct mtd_info *mtd, int section, +struct nand_oobfree *oobfree) +{ + int sections = (mtd->oobsize / 32) * 2; + + if (section >= sections) + return -ERANGE; + + if (section & 1) { + oobfree->offset = ((section - 1) * 16) + 14; + oobfree->length = 2; + } else { + oobfree->offset = (section * 16) + 2; + oobfree->length = 3
[linux-sunxi] [PATCH 21/23] staging: mt29f_spinand: switch to mtd_ooblayout_ops
Signed-off-by: Boris Brezillon --- drivers/staging/mt29f_spinand/mt29f_spinand.c | 44 --- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/drivers/staging/mt29f_spinand/mt29f_spinand.c b/drivers/staging/mt29f_spinand/mt29f_spinand.c index cb9d5ab..967d50a 100644 --- a/drivers/staging/mt29f_spinand/mt29f_spinand.c +++ b/drivers/staging/mt29f_spinand/mt29f_spinand.c @@ -42,23 +42,29 @@ static inline struct spinand_state *mtd_to_state(struct mtd_info *mtd) static int enable_hw_ecc; static int enable_read_hw_ecc; -static struct nand_ecclayout spinand_oob_64 = { - .eccbytes = 24, - .eccpos = { - 1, 2, 3, 4, 5, 6, - 17, 18, 19, 20, 21, 22, - 33, 34, 35, 36, 37, 38, - 49, 50, 51, 52, 53, 54, }, - .oobfree = { - {.offset = 8, - .length = 8}, - {.offset = 24, - .length = 8}, - {.offset = 40, - .length = 8}, - {.offset = 56, - .length = 8}, - } +static int spinand_oob_64_eccpos(struct mtd_info *mtd, int eccbyte) +{ + if (eccbyte > 23) + return -ERANGE; + + return ((eccbyte / 6) * 16) + 1; +} + +static int spinand_oob_64_oobfree(struct mtd_info *mtd, int section, + struct nand_oobfree *oobfree) +{ + if (section > 3) + return -ERANGE; + + oobfree->offset = (section * 16) + 8; + oobfree->length = 8; + + return 0; +} + +const struct mtd_ooblayout_ops spinand_oob_64_ops = { + .eccpos = spinand_oob_64_eccpos, + .oobfree = spinand_oob_64_oobfree, }; #endif @@ -883,7 +889,6 @@ static int spinand_probe(struct spi_device *spi_nand) chip->ecc.strength = 1; chip->ecc.total = chip->ecc.steps * chip->ecc.bytes; - chip->ecc.layout = &spinand_oob_64; chip->ecc.read_page = spinand_read_page_hwecc; chip->ecc.write_page = spinand_write_page_hwecc; #else @@ -911,6 +916,9 @@ static int spinand_probe(struct spi_device *spi_nand) mtd->priv = chip; mtd->dev.parent = &spi_nand->dev; mtd->oobsize = 64; +#ifdef CONFIG_MTD_SPINAND_ONDIEECC + mtd_set_ooblayout(mtd, &spinand_oob_64_ops); +#endif if (nand_scan(mtd, 1)) return -ENXIO; -- 2.1.4 -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] [PATCH 14/23] mtd: use mtd_set_ecclayout() where appropriate
Use the mtd_set_ecclayout() helper instead of directly assigning the mtd->ecclayout field. Signed-off-by: Boris Brezillon --- drivers/mtd/devices/docg3.c| 2 +- drivers/mtd/mtdconcat.c| 2 +- drivers/mtd/mtdpart.c | 2 +- drivers/mtd/nand/nand_base.c | 2 +- drivers/mtd/onenand/onenand_base.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c index e7b2e43..6b516e1 100644 --- a/drivers/mtd/devices/docg3.c +++ b/drivers/mtd/devices/docg3.c @@ -1857,7 +1857,7 @@ static int __init doc_set_driver_info(int chip_id, struct mtd_info *mtd) mtd->_read_oob = doc_read_oob; mtd->_write_oob = doc_write_oob; mtd->_block_isbad = doc_block_isbad; - mtd->ecclayout = &docg3_oobinfo; + mtd_set_ecclayout(mtd, &docg3_oobinfo); mtd->oobavail = 8; mtd->ecc_strength = DOC_ECC_BCH_T; diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index 239a8c8..481565e 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c @@ -777,7 +777,7 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to c } - concat->mtd.ecclayout = subdev[0]->ecclayout; + mtd_set_ecclayout(&concat->mtd, subdev[0]->ecclayout); concat->num_subdev = num_devs; concat->mtd.name = name; diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index c32b127..244faa8 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c @@ -536,7 +536,7 @@ static struct mtd_part *allocate_partition(struct mtd_info *master, part->name); } - slave->mtd.ecclayout = master->ecclayout; + mtd_set_ecclayout(&slave->mtd, master->ecclayout); slave->mtd.ecc_step_size = master->ecc_step_size; slave->mtd.ecc_strength = master->ecc_strength; slave->mtd.bitflip_threshold = master->bitflip_threshold; diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 30a0721..2b334cf 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -4365,7 +4365,7 @@ int nand_scan_tail(struct mtd_info *mtd) mtd->writebufsize = mtd->writesize; /* propagate ecc info to mtd_info */ - mtd->ecclayout = ecc->layout; + mtd_set_ecclayout(mtd, ecc->layout); mtd->ecc_strength = ecc->strength; mtd->ecc_step_size = ecc->size; /* diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index 25e6bf2..b5937b7 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/drivers/mtd/onenand/onenand_base.c @@ -4059,7 +4059,7 @@ int onenand_scan(struct mtd_info *mtd, int maxchips) mtd_oobfree(mtd, i++, &oobfree)) mtd->oobavail += oobfree.length; - mtd->ecclayout = this->ecclayout; + mtd_set_ecclayout(mtd, this->ecclayout); mtd->ecc_strength = 1; /* Fill in remaining MTD driver data */ -- 2.1.4 -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] [PATCH 13/23] mtd: add mtd_set_ecclayout() helper function
Add an mtd_set_ecclayout() helper function to avoid direct accesses to the mtd->ecclayout field. This will ease future refactor of ECC layout definition. Signed-off-by: Boris Brezillon --- include/linux/mtd/mtd.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 25e3d0f..80e32fa 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -253,6 +253,12 @@ struct mtd_info { int usecount; }; +static inline void mtd_set_ecclayout(struct mtd_info *mtd, +struct nand_ecclayout *ecclayout) +{ + mtd->ecclayout = ecclayout; +} + static inline int mtd_eccpos(struct mtd_info *mtd, int eccbyte) { if (!mtd->ecclayout) -- 2.1.4 -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] [PATCH 12/23] mtd: use mtd_eccpos() and mtd_oobfree() where appropriate
The mtd_eccpos(), mtd_oobfree() and mtd_eccbytes() helper functions have been added to avoid direct accesses to the ecclayout, and thus allow for future rework. Use these helpers in all places where the oobfree[] and eccpos[] arrays are referenced. Signed-off-by: Boris Brezillon --- drivers/mtd/mtdchar.c | 79 drivers/mtd/mtdswap.c | 4 +- drivers/mtd/nand/atmel_nand.c | 21 - drivers/mtd/nand/fsl_ifc_nand.c| 2 +- drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 9 ++-- drivers/mtd/nand/lpc32xx_slc.c | 4 +- drivers/mtd/nand/nand_base.c | 83 ++ drivers/mtd/nand/nand_bch.c| 2 +- drivers/mtd/nand/omap2.c | 11 ++--- drivers/mtd/onenand/onenand_base.c | 61 + 10 files changed, 163 insertions(+), 113 deletions(-) diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 6d19835..66d0898 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c @@ -472,31 +472,78 @@ static int mtdchar_readoob(struct file *file, struct mtd_info *mtd, * nand_ecclayout flexibly (i.e. the struct may change size in new * releases without requiring major rewrites). */ -static int shrink_ecclayout(const struct nand_ecclayout *from, - struct nand_ecclayout_user *to) +static int shrink_ecclayout(struct mtd_info *mtd, + struct nand_ecclayout_user *to) { int i; - if (!from || !to) + if (!mtd || !to) return -EINVAL; memset(to, 0, sizeof(*to)); - to->eccbytes = min((int)from->eccbytes, MTD_MAX_ECCPOS_ENTRIES); - for (i = 0; i < to->eccbytes; i++) - to->eccpos[i] = from->eccpos[i]; + to->eccbytes = 0; + for (i = 0; i < MTD_MAX_ECCPOS_ENTRIES; i++) { + int pos = mtd_eccpos(mtd, i); + + if (pos < 0) + break; + + to->eccpos[i] = pos; + to->eccbytes++; + } for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES; i++) { - if (from->oobfree[i].length == 0 && - from->oobfree[i].offset == 0) + mtd_oobfree(mtd, i, &to->oobfree[i]); + if (to->oobfree[i].length == 0 && + to->oobfree[i].offset == 0) break; - to->oobavail += from->oobfree[i].length; - to->oobfree[i] = from->oobfree[i]; + to->oobavail += to->oobfree[i].length; } return 0; } +static int get_oobinfo(struct mtd_info *mtd, struct nand_oobinfo *to) +{ + int i; + + if (!mtd || !to) + return -EINVAL; + + memset(to, 0, sizeof(*to)); + + to->eccbytes = 0; + for (i = 0; i < ARRAY_SIZE(to->eccpos); i++) { + int pos = mtd_eccpos(mtd, i); + + if (pos < 0) + break; + + to->eccpos[i] = pos; + to->eccbytes++; + } + + if (i == ARRAY_SIZE(to->eccpos)) + return -EINVAL; + + for (i = 0; i < 8; i++) { + struct nand_oobfree oobfree; + + mtd_oobfree(mtd, i, &oobfree); + if (oobfree.length == 0 && + oobfree.offset == 0) + break; + + to->oobfree[i][0] = oobfree.offset; + to->oobfree[i][1] = oobfree.length; + } + + to->useecc = MTD_NANDECC_AUTOPLACE; + + return 0; +} + static int mtdchar_blkpg_ioctl(struct mtd_info *mtd, struct blkpg_ioctl_arg *arg) { @@ -817,14 +864,10 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg) if (!mtd->ecclayout) return -EOPNOTSUPP; - if (mtd->ecclayout->eccbytes > ARRAY_SIZE(oi.eccpos)) - return -EINVAL; - oi.useecc = MTD_NANDECC_AUTOPLACE; - memcpy(&oi.eccpos, mtd->ecclayout->eccpos, sizeof(oi.eccpos)); - memcpy(&oi.oobfree, mtd->ecclayout->oobfree, - sizeof(oi.oobfree)); - oi.eccbytes = mtd->ecclayout->eccbytes; + ret = get_oobinfo(mtd, &oi); + if (ret) + return ret; if (copy_to_user(argp, &oi, sizeof(struct nand_oobinfo))) return -EFAULT; @@ -920,7 +963,7 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg) if (!usrlay) return -ENOMEM; - shrink_ecclayout(mtd->ecclayout, usrlay); + shrink_ecclayout(mtd, usrlay); if (copy_to_user(argp, usrlay, sizeof(*usrlay))) ret = -EFAULT; diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c index d330eb1..6fe47b0 100644 --- a/drivers/mtd/mtdswap.c ++
[linux-sunxi] [PATCH 19/23] mtd: nand: switch all drivers to mtd_ooblayout_ops
Implementing the mtd_ooblayout_ops interface is the new way of exposing ECC/OOB layout to MTD users. Modify all NAND drivers to switch to this approach. Signed-off-by: Boris Brezillon --- This commit is a collection of commits that have been squashed to into a single one to limit the size of the patchset. If you want to have separate commit for each of the NAND drivers you can have a look at this branch [1]. [1]https://github.com/bbrezillon/linux-sunxi/commits/nand/ecclayout2 --- arch/arm/mach-pxa/spitz.c | 41 +++- arch/mips/include/asm/mach-jz4740/jz4740_nand.h | 2 +- arch/mips/jz4740/board-qi_lb60.c| 83 --- drivers/mtd/nand/atmel_nand.c | 81 +++ drivers/mtd/nand/bf5xx_nand.c | 47 ++-- drivers/mtd/nand/brcmnand/brcmnand.c| 255 drivers/mtd/nand/cafe_nand.c| 42 +++- drivers/mtd/nand/davinci_nand.c | 114 - drivers/mtd/nand/denali.c | 48 ++-- drivers/mtd/nand/diskonchip.c | 34 ++- drivers/mtd/nand/docg4.c| 29 ++- drivers/mtd/nand/fsl_elbc_nand.c| 79 --- drivers/mtd/nand/fsl_ifc_nand.c | 224 +- drivers/mtd/nand/fsmc_nand.c| 294 +++- drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 48 +++- drivers/mtd/nand/hisi504_nand.c | 26 ++- drivers/mtd/nand/jz4740_nand.c | 2 +- drivers/mtd/nand/lpc32xx_mlc.c | 49 ++-- drivers/mtd/nand/lpc32xx_slc.c | 37 ++- drivers/mtd/nand/mxc_nand.c | 206 - drivers/mtd/nand/omap2.c| 184 --- drivers/mtd/nand/pxa3xx_nand.c | 101 drivers/mtd/nand/s3c2410.c | 28 ++- drivers/mtd/nand/sh_flctl.c | 80 +-- drivers/mtd/nand/sharpsl.c | 2 +- drivers/mtd/nand/sm_common.c| 88 +-- drivers/mtd/nand/sunxi_nand.c | 112 - drivers/mtd/nand/vf610_nfc.c| 34 +-- include/linux/mtd/sharpsl.h | 2 +- 29 files changed, 1226 insertions(+), 1146 deletions(-) diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index f4e2e27..13ed4e3 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -763,14 +763,35 @@ static struct nand_bbt_descr spitz_nand_bbt = { .pattern= scan_ff_pattern }; -static struct nand_ecclayout akita_oobinfo = { - .oobfree= { {0x08, 0x09} }, - .eccbytes = 24, - .eccpos = { - 0x05, 0x01, 0x02, 0x03, 0x06, 0x07, 0x15, 0x11, - 0x12, 0x13, 0x16, 0x17, 0x25, 0x21, 0x22, 0x23, - 0x26, 0x27, 0x35, 0x31, 0x32, 0x33, 0x36, 0x37, - }, +static int akita_eccpos(struct mtd_info *mtd, int eccbyte) +{ + static int eccpos[] = { + 0x05, 0x01, 0x02, 0x03, 0x06, 0x07, 0x15, 0x11, + 0x12, 0x13, 0x16, 0x17, 0x25, 0x21, 0x22, 0x23, + 0x26, 0x27, 0x35, 0x31, 0x32, 0x33, 0x36, 0x37, + }; + + if (eccbyte >= ARRAY_SIZE(eccpos)) + return -ERANGE; + + return eccpos[eccbyte]; +} + +static int akita_oobfree(struct mtd_info *mtd, int section, +struct nand_oobfree *oobfree) +{ + if (section) + return -ERANGE; + + oobfree->offset = 8; + oobfree->length = 9; + + return 0; +} + +static const struct mtd_ooblayout_ops akita_ooblayout_ops = { + .eccpos = akita_eccpos, + .oobfree = akita_oobfree, }; static struct sharpsl_nand_platform_data spitz_nand_pdata = { @@ -804,11 +825,11 @@ static void __init spitz_nand_init(void) } else if (machine_is_akita()) { spitz_nand_partitions[1].size = 58 * 1024 * 1024; spitz_nand_bbt.len = 1; - spitz_nand_pdata.ecc_layout = &akita_oobinfo; + spitz_nand_pdata.ecc_layout = &akita_ooblayout_ops; } else if (machine_is_borzoi()) { spitz_nand_partitions[1].size = 32 * 1024 * 1024; spitz_nand_bbt.len = 1; - spitz_nand_pdata.ecc_layout = &akita_oobinfo; + spitz_nand_pdata.ecc_layout = &akita_ooblayout_ops; } platform_device_register(&spitz_nand_device); diff --git a/arch/mips/include/asm/mach-jz4740/jz4740_nand.h b/arch/mips/include/asm/mach-jz4740/jz4740_nand.h index 398733e..7f7b0fc 100644 --- a/arch/mips/include/asm/mach-jz4740/jz4740_nand.h +++ b/arch/mips/include/asm/mach-jz4740/jz4740_nand.h @@ -27,7 +27,7 @@ struct jz_nand_platform_data { unsigned char banks[JZ_NAND_NUM_BANKS]; - void (*ident_callback)(struct platform_device *, struct
[linux-sunxi] [PATCH 22/23] mtd: nand: kill layout field
Signed-off-by: Boris Brezillon --- drivers/mtd/nand/nand_base.c | 8 drivers/mtd/nand/nand_bch.c | 9 - include/linux/mtd/nand.h | 1 - 3 files changed, 18 deletions(-) diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 6440c5d..85deacb 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -4148,13 +4148,6 @@ int nand_scan_tail(struct mtd_info *mtd) chip->oob_poi = chip->buffers->databuf + mtd->writesize; /* -* Set the provided ECC layout. If ecc->layout is NULL, the MTD core -* will just leave mtd->ooblayout to NULL, if it's not NULL, it will -* set ->ooblayout to the default ecclayout wrapper. -*/ - mtd_set_ecclayout(mtd, ecc->layout); - - /* * If no default placement scheme is given, select an appropriate one. */ if (!mtd->ooblayout && (ecc->mode != NAND_ECC_SOFT_BCH)) { @@ -4401,7 +4394,6 @@ int nand_scan_tail(struct mtd_info *mtd) mtd->writebufsize = mtd->writesize; /* propagate ecc info to mtd_info */ - mtd_set_ecclayout(mtd, ecc->layout); mtd->ecc_strength = ecc->strength; mtd->ecc_step_size = ecc->size; /* diff --git a/drivers/mtd/nand/nand_bch.c b/drivers/mtd/nand/nand_bch.c index 2937b49..3b90643 100644 --- a/drivers/mtd/nand/nand_bch.c +++ b/drivers/mtd/nand/nand_bch.c @@ -158,15 +158,6 @@ struct nand_bch_control *nand_bch_init(struct mtd_info *mtd) eccsteps = mtd->writesize/eccsize; - /* -* Rely on the default ecclayout to ooblayout wrapper provided by MTD -* core if ecc.layout is not NULL. -* FIXME: this should be removed when all callers have moved to the -* mtd_ooblayout_ops approach. -*/ - if (nand->ecc.layout) - mtd_set_ecclayout(mtd, nand->ecc.layout); - /* if no ecc placement scheme was provided, build one */ if (!mtd->ooblayout) { diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 9ba9daba..f4ba147 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h @@ -494,7 +494,6 @@ struct nand_ecc_ctrl { int strength; int prepad; int postpad; - struct nand_ecclayout *layout; void *priv; void (*hwctl)(struct mtd_info *mtd, int mode); int (*calculate)(struct mtd_info *mtd, const uint8_t *dat, -- 2.1.4 -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] [PATCH 16/23] mtd: docg3: switch to mtd_ooblayout_ops
Signed-off-by: Boris Brezillon --- drivers/mtd/devices/docg3.c | 34 +- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c index 6b516e1..7463dd8 100644 --- a/drivers/mtd/devices/docg3.c +++ b/drivers/mtd/devices/docg3.c @@ -73,10 +73,34 @@ MODULE_PARM_DESC(reliable_mode, "Set the docg3 mode (0=normal MLC, 1=fast, " * @eccpos: ecc positions (byte 7 is Hamming ECC, byte 8-14 are BCH ECC) * @oobfree: free pageinfo bytes (byte 0 until byte 6, byte 15 */ -static struct nand_ecclayout docg3_oobinfo = { - .eccbytes = 8, - .eccpos = {7, 8, 9, 10, 11, 12, 13, 14}, - .oobfree = {{0, 7}, {15, 1} }, +static int docg3_eccpos(struct mtd_info *mtd, int eccbyte) +{ + if (eccbyte >= 8) + return -ERANGE; + + return eccbyte + 7; +} + +static int docg3_oobfree(struct mtd_info *mtd, int section, +struct nand_oobfree *oobfree) +{ + if (section > 1) + return -ERANGE; + + if (!section) { + oobfree->offset = 0; + oobfree->length = 7; + } else { + oobfree->offset = 15; + oobfree->length = 1; + } + + return 0; +} + +static const struct nand_ooblayout_ops nand_ooblayout_docg3_ops = { + .eccpos = docg3_eccpos, + .oobfree = docg3_oobfree, }; static inline u8 doc_readb(struct docg3 *docg3, u16 reg) @@ -1857,7 +1881,7 @@ static int __init doc_set_driver_info(int chip_id, struct mtd_info *mtd) mtd->_read_oob = doc_read_oob; mtd->_write_oob = doc_write_oob; mtd->_block_isbad = doc_block_isbad; - mtd_set_ecclayout(mtd, &docg3_oobinfo); + mtd_set_ooblayout_ops(mtd, &nand_ooblayout_docg3_ops); mtd->oobavail = 8; mtd->ecc_strength = DOC_ECC_BCH_T; -- 2.1.4 -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] [PATCH 17/23] mtd: nand: implement the default mtd_ooblayout_ops
Replace the default nand_ecclayout definitions for large and small page devices with the equivalent mtd_ooblayout_ops. Signed-off-by: Boris Brezillon --- drivers/mtd/nand/nand_base.c | 138 +++ include/linux/mtd/nand.h | 3 + 2 files changed, 90 insertions(+), 51 deletions(-) diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 2b334cf..6440c5d 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -48,50 +48,6 @@ #include #include -/* Define default oob placement schemes for large and small page devices */ -static struct nand_ecclayout nand_oob_8 = { - .eccbytes = 3, - .eccpos = {0, 1, 2}, - .oobfree = { - {.offset = 3, -.length = 2}, - {.offset = 6, -.length = 2} } -}; - -static struct nand_ecclayout nand_oob_16 = { - .eccbytes = 6, - .eccpos = {0, 1, 2, 3, 6, 7}, - .oobfree = { - {.offset = 8, -. length = 8} } -}; - -static struct nand_ecclayout nand_oob_64 = { - .eccbytes = 24, - .eccpos = { - 40, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63}, - .oobfree = { - {.offset = 2, -.length = 38} } -}; - -static struct nand_ecclayout nand_oob_128 = { - .eccbytes = 48, - .eccpos = { - 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, - 120, 121, 122, 123, 124, 125, 126, 127}, - .oobfree = { - {.offset = 2, -.length = 78} } -}; - static int nand_get_device(struct mtd_info *mtd, int new_state); static int nand_do_write_oob(struct mtd_info *mtd, loff_t to, @@ -103,6 +59,83 @@ static int nand_do_write_oob(struct mtd_info *mtd, loff_t to, */ DEFINE_LED_TRIGGER(nand_led_trigger); +/* Define default oob placement schemes for large and small page devices */ +static int nand_ooblayout_eccpos_sp(struct mtd_info *mtd, int eccbyte) +{ + struct nand_chip *chip = mtd->priv; + struct nand_ecc_ctrl *ecc = &chip->ecc; + + if (eccbyte >= ecc->bytes * ecc->steps) + return -ERANGE; + + if (eccbyte < 4) + return eccbyte; + + return eccbyte + 2; +} + +static int nand_ooblayout_oobfree_sp(struct mtd_info *mtd, int section, +struct nand_oobfree *oobfree) +{ + if (section > 1) + return -ERANGE; + + if (mtd->oobsize == 16) { + if (section) + return -ERANGE; + + oobfree->length = 8; + oobfree->offset = 8; + } else { + oobfree->length = 2; + if (!section) + oobfree->offset = 3; + else + oobfree->offset = 6; + } + + return 0; +} + +const struct mtd_ooblayout_ops nand_ooblayout_sp_ops = { + .eccpos = nand_ooblayout_eccpos_sp, + .oobfree = nand_ooblayout_oobfree_sp, +}; +EXPORT_SYMBOL_GPL(nand_ooblayout_sp_ops); + +static int nand_ooblayout_eccpos_lp(struct mtd_info *mtd, int eccbyte) +{ + struct nand_chip *chip = mtd->priv; + struct nand_ecc_ctrl *ecc = &chip->ecc; + int eccbytes = ecc->bytes * ecc->steps; + + if (eccbyte >= eccbytes) + return -ERANGE; + + return mtd->oobsize - eccbytes + eccbyte; +} + +static int nand_ooblayout_oobfree_lp(struct mtd_info *mtd, int section, +struct nand_oobfree *oobfree) +{ + struct nand_chip *chip = mtd->priv; + struct nand_ecc_ctrl *ecc = &chip->ecc; + + if (section) + return -ERANGE; + + oobfree->length = mtd->oobsize - (ecc->bytes * ecc->steps) - 2; + oobfree->offset = 2; + + return 0; +} + +const struct mtd_ooblayout_ops nand_ooblayout_lp_ops = { + .eccpos = nand_ooblayout_eccpos_lp, + .oobfree = nand_ooblayout_oobfree_lp, +}; +EXPORT_SYMBOL_GPL(nand_ooblayout_lp_ops); + static int check_offs_len(struct mtd_info *mtd, loff_t ofs, uint64_t len) { @@ -4115,21 +4148,24 @@ int nand_scan_tail(struct mtd_info *mtd) chip->oob_poi = chip->buffers->databuf + mtd->writesize; /* +* Set the provided ECC layout. If ecc->layout is NULL, the MTD core +* will just leave mtd->ooblayout to NULL, if it's not NULL, it will +* set ->ooblayout to the default ecclayout wrapper. +*/ + mtd_set_ecclayout(mtd, ecc->layout); + + /* * If no default placement scheme is given, select an appropriate one. */ -
[linux-sunxi] [PATCH 05/23] mtd: nand: jz4770: kill the ->ecc_layout field
->ecc_layout is not used by any board file. Kill this field to avoid any confusion. New boards are encouraged to use the default ECC layout defined in NAND core. Signed-off-by: Boris Brezillon --- arch/mips/include/asm/mach-jz4740/jz4740_nand.h | 2 -- drivers/mtd/nand/jz4740_nand.c | 3 --- 2 files changed, 5 deletions(-) diff --git a/arch/mips/include/asm/mach-jz4740/jz4740_nand.h b/arch/mips/include/asm/mach-jz4740/jz4740_nand.h index 79cff26..398733e 100644 --- a/arch/mips/include/asm/mach-jz4740/jz4740_nand.h +++ b/arch/mips/include/asm/mach-jz4740/jz4740_nand.h @@ -25,8 +25,6 @@ struct jz_nand_platform_data { int num_partitions; struct mtd_partition*partitions; - struct nand_ecclayout *ecc_layout; - unsigned char banks[JZ_NAND_NUM_BANKS]; void (*ident_callback)(struct platform_device *, struct nand_chip *, diff --git a/drivers/mtd/nand/jz4740_nand.c b/drivers/mtd/nand/jz4740_nand.c index 5a99a93..c4fe446 100644 --- a/drivers/mtd/nand/jz4740_nand.c +++ b/drivers/mtd/nand/jz4740_nand.c @@ -446,9 +446,6 @@ static int jz_nand_probe(struct platform_device *pdev) chip->ecc.bytes = 9; chip->ecc.strength = 4; - if (pdata) - chip->ecc.layout = pdata->ecc_layout; - chip->chip_delay = 50; chip->cmd_ctrl = jz_nand_cmd_ctrl; chip->select_chip = jz_nand_select_chip; -- 2.1.4 -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] [PATCH 08/23] mtd: nand: lpc32xx_mlc: fix ecc.size
According to the ECC layout description the actual ecc.size is 512 bytes and not mtd->writesize. Signed-off-by: Boris Brezillon --- drivers/mtd/nand/lpc32xx_mlc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/nand/lpc32xx_mlc.c b/drivers/mtd/nand/lpc32xx_mlc.c index 57c4b71..0ee81a0 100644 --- a/drivers/mtd/nand/lpc32xx_mlc.c +++ b/drivers/mtd/nand/lpc32xx_mlc.c @@ -751,7 +751,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev) } nand_chip->ecc.mode = NAND_ECC_HW; - nand_chip->ecc.size = mtd->writesize; + nand_chip->ecc.size = 512; nand_chip->ecc.layout = &lpc32xx_nand_oob; host->mlcsubpages = mtd->writesize / 512; -- 2.1.4 -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] [PATCH 06/23] mtd: nand: kill unused ->ecclayout field in platform_nand_chip struct
This field is not set in any board file and can thus be dropped. Signed-off-by: Boris Brezillon --- drivers/mtd/nand/plat_nand.c | 1 - include/linux/mtd/nand.h | 2 -- 2 files changed, 3 deletions(-) diff --git a/drivers/mtd/nand/plat_nand.c b/drivers/mtd/nand/plat_nand.c index 06ac6c6..71aaa09 100644 --- a/drivers/mtd/nand/plat_nand.c +++ b/drivers/mtd/nand/plat_nand.c @@ -74,7 +74,6 @@ static int plat_nand_probe(struct platform_device *pdev) data->chip.bbt_options |= pdata->chip.bbt_options; data->chip.ecc.hwctl = pdata->ctrl.hwcontrol; - data->chip.ecc.layout = pdata->chip.ecclayout; data->chip.ecc.mode = NAND_ECC_SOFT; platform_set_drvdata(pdev, data); diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index fad634e..cbedcb0 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h @@ -866,7 +866,6 @@ extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len, * @chip_delay:R/B delay value in us * @options: Option flags, e.g. 16bit buswidth * @bbt_options: BBT option flags, e.g. NAND_BBT_USE_FLASH - * @ecclayout: ECC layout info structure * @part_probe_types: NULL-terminated array of probe types */ struct platform_nand_chip { @@ -874,7 +873,6 @@ struct platform_nand_chip { int chip_offset; int nr_partitions; struct mtd_partition *partitions; - struct nand_ecclayout *ecclayout; int chip_delay; unsigned int options; unsigned int bbt_options; -- 2.1.4 -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] [PATCH 09/23] mtd: nand: vf610: remove useless mtd->ecclayout assignment
The NAND core layer is already taking care of ecclayout propagation. Remove this useless assignment. Signed-off-by: Boris Brezillon --- drivers/mtd/nand/vf610_nfc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/mtd/nand/vf610_nfc.c b/drivers/mtd/nand/vf610_nfc.c index 1c86c6b..0413e24 100644 --- a/drivers/mtd/nand/vf610_nfc.c +++ b/drivers/mtd/nand/vf610_nfc.c @@ -794,8 +794,6 @@ static int vf610_nfc_probe(struct platform_device *pdev) goto error; } - /* propagate ecc.layout to mtd_info */ - mtd->ecclayout = chip->ecc.layout; chip->ecc.read_page = vf610_nfc_read_page; chip->ecc.write_page = vf610_nfc_write_page; -- 2.1.4 -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] [PATCH 10/23] mtd: nand: simplify nand_bch_init() usage
nand_bch_init() requires several arguments which could directly be deduced from the mtd device. Get rid of those useless parameters. nand_bch_init() is also requiring the caller to provide a proper eccbytes value, while this value could be deduced from the ecc.size and ecc.strength value. Fallback to eccbytes calculation when it is set to 0. Signed-off-by: Boris Brezillon --- drivers/mtd/nand/nand_base.c | 6 ++ drivers/mtd/nand/nand_bch.c | 27 +-- drivers/mtd/nand/omap2.c | 28 include/linux/mtd/nand_bch.h | 8 ++-- 4 files changed, 33 insertions(+), 36 deletions(-) diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 1107f5c1..b99b442 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -4247,10 +4247,8 @@ int nand_scan_tail(struct mtd_info *mtd) } /* See nand_bch_init() for details. */ - ecc->bytes = DIV_ROUND_UP( - ecc->strength * fls(8 * ecc->size), 8); - ecc->priv = nand_bch_init(mtd, ecc->size, ecc->bytes, - &ecc->layout); + ecc->bytes = 0; + ecc->priv = nand_bch_init(mtd); if (!ecc->priv) { pr_warn("BCH ECC initialization failed!\n"); BUG(); diff --git a/drivers/mtd/nand/nand_bch.c b/drivers/mtd/nand/nand_bch.c index 3803e0b..3456c20 100644 --- a/drivers/mtd/nand/nand_bch.c +++ b/drivers/mtd/nand/nand_bch.c @@ -107,9 +107,6 @@ EXPORT_SYMBOL(nand_bch_correct_data); /** * nand_bch_init - [NAND Interface] Initialize NAND BCH error correction * @mtd: MTD block structure - * @eccsize: ecc block size in bytes - * @eccbytes: ecc length in bytes - * @ecclayout: output default layout * * Returns: * a pointer to a new NAND BCH control structure, or NULL upon failure @@ -123,14 +120,21 @@ EXPORT_SYMBOL(nand_bch_correct_data); * @eccsize = 512 (thus, m=13 is the smallest integer such that 2^m-1 > 512*8) * @eccbytes = 7 (7 bytes are required to store m*t = 13*4 = 52 bits) */ -struct nand_bch_control * -nand_bch_init(struct mtd_info *mtd, unsigned int eccsize, unsigned int eccbytes, - struct nand_ecclayout **ecclayout) +struct nand_bch_control *nand_bch_init(struct mtd_info *mtd) { + struct nand_chip *nand = mtd_to_nand(mtd); unsigned int m, t, eccsteps, i; - struct nand_ecclayout *layout; + struct nand_ecclayout *layout = nand->ecc.layout; struct nand_bch_control *nbc = NULL; unsigned char *erased_page; + unsigned int eccsize = nand->ecc.size; + unsigned int eccbytes = nand->ecc.bytes; + unsigned int eccstrength = nand->ecc.strength; + + if (!eccbytes && eccstrength) { + eccbytes = DIV_ROUND_UP(eccstrength * fls(8 * eccsize), 8); + nand->ecc.bytes = eccbytes; + } if (!eccsize || !eccbytes) { printk(KERN_WARNING "ecc parameters not supplied\n"); @@ -158,7 +162,7 @@ nand_bch_init(struct mtd_info *mtd, unsigned int eccsize, unsigned int eccbytes, eccsteps = mtd->writesize/eccsize; /* if no ecc placement scheme was provided, build one */ - if (!*ecclayout) { + if (!layout) { /* handle large page devices only */ if (mtd->oobsize < 64) { @@ -184,7 +188,7 @@ nand_bch_init(struct mtd_info *mtd, unsigned int eccsize, unsigned int eccbytes, layout->oobfree[0].offset = 2; layout->oobfree[0].length = mtd->oobsize-2-layout->eccbytes; - *ecclayout = layout; + nand->ecc.layout = layout; } /* sanity checks */ @@ -192,7 +196,7 @@ nand_bch_init(struct mtd_info *mtd, unsigned int eccsize, unsigned int eccbytes, printk(KERN_WARNING "eccsize %u is too large\n", eccsize); goto fail; } - if ((*ecclayout)->eccbytes != (eccsteps*eccbytes)) { + if (layout->eccbytes != (eccsteps*eccbytes)) { printk(KERN_WARNING "invalid ecc layout\n"); goto fail; } @@ -216,6 +220,9 @@ nand_bch_init(struct mtd_info *mtd, unsigned int eccsize, unsigned int eccbytes, for (i = 0; i < eccbytes; i++) nbc->eccmask[i] ^= 0xff; + if (!eccstrength) + nand->ecc.strength = (eccbytes * 8) / fls(8 * eccsize); + return nbc; fail: nand_bch_free(nbc); diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index e307576..a2f015d 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c @@ -1820,13 +1820,19 @@ static int omap_nand_probe(struct platform_device *pdev) goto return_error; } + /* +* Bail out earlier to let NAND_ECC_SOFT code create its own +* ecclayout instead of using ours. +
[linux-sunxi] [PATCH 07/23] staging: mt29f_spinand: kill unused ecclayout field
The spinand_info struct embeds a pointer to an ecclayout definition, but this field is never used in the mt29f driver. Signed-off-by: Boris Brezillon --- drivers/staging/mt29f_spinand/mt29f_spinand.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/mt29f_spinand/mt29f_spinand.h b/drivers/staging/mt29f_spinand/mt29f_spinand.h index ae62975..457dc7f 100644 --- a/drivers/staging/mt29f_spinand/mt29f_spinand.h +++ b/drivers/staging/mt29f_spinand/mt29f_spinand.h @@ -78,7 +78,6 @@ #define BL_ALL_UNLOCKED0 struct spinand_info { - struct nand_ecclayout *ecclayout; struct spi_device *spi; void *priv; }; -- 2.1.4 -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] [PATCH 03/23] mtd: nftl: kill unused oobinfo field
Signed-off-by: Boris Brezillon --- include/linux/mtd/nftl.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/linux/mtd/nftl.h b/include/linux/mtd/nftl.h index b059629..044daa0 100644 --- a/include/linux/mtd/nftl.h +++ b/include/linux/mtd/nftl.h @@ -50,7 +50,6 @@ struct NFTLrecord { unsigned int nb_blocks;/* number of physical blocks */ unsigned int nb_boot_blocks; /* number of blocks used by the bios */ struct erase_info instr; - struct nand_ecclayout oobinfo; }; int NFTL_mount(struct NFTLrecord *s); -- 2.1.4 -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] [PATCH 00/23] mtd: rework ECC layout definition
Hello, This patchset aims at getting rid of the nand_ecclayout limitations. struct nand_ecclayout is defining fixed eccpos and oobfree arrays which can only be increased by modifying the MTD_MAX_ECCPOS_ENTRIES_LARGE and MTD_MAX_OOBFREE_ENTRIES_LARGE macros. This approach forces us to modify the macro values each time we add a new NAND chip with a bigger OOB area, and increasing these arrays also penalize all platforms, even those who only support small NAND devices (with small OOB area). The idea to overcome this limitation, is to define the ECC/OOB layout by the mean of two functions: ->eccpos() and ->oobfree(), which will basically return the same information has those stored in the nand_ecclayout struct. Another advantage of this solution is that ECC layouts are usually following a repetitive pattern (i.e. leave X bytes free and put Y bytes of ECC per ECC chunk), which allows one to implement the ->eccpos() and ->oobfree() functions with a simple logic that can be applied to any size of OOB. Patches 1 to 10 are just cleanups or trivial fixes that can be taken independently. Patch 19 is just an aggregate of several smaller commits (one per driver), and has been submitted this way to limit the size of the series. If everybody agrees on this approach, I'll resubmit the series will those changes separated in different commits (as done here [1]). Also note that the last two commits are removing the nand_ecclayout definition, thus preventing any new driver to use this structure. Of course, this step can be delayed if some of the previous patches are not accepted. Best Regards, Boris [1]https://github.com/bbrezillon/linux-sunxi/commits/nand/ecclayout2 Boris Brezillon (23): mtd: kill the ecclayout->oobavail field mtd: inftl: kill unused oobinfo field mtd: nftl: kill unused oobinfo field mtd: nand: s3c2410: kill the ->ecc_layout field mtd: nand: jz4770: kill the ->ecc_layout field mtd: nand: kill unused ->ecclayout field in platform_nand_chip struct staging: mt29f_spinand: kill unused ecclayout field mtd: nand: lpc32xx_mlc: fix ecc.size mtd: nand: vf610: remove useless mtd->ecclayout assignment mtd: nand: simplify nand_bch_init() usage mtd: add mtd_eccpos(), mtd_oobfree() and mtd_eccbytes() helper functions mtd: use mtd_eccpos() and mtd_oobfree() where appropriate mtd: add mtd_set_ecclayout() helper function mtd: use mtd_set_ecclayout() where appropriate mtd: create an mtd_ooblayout_ops struct to ease ECC layout definition mtd: docg3: switch to mtd_ooblayout_ops mtd: nand: implement the default mtd_ooblayout_ops mtd: nand: bch: switch to nand_ecclayout_pos mtd: nand: switch all drivers to mtd_ooblayout_ops mtd: onenand: switch to mtd_ooblayout_ops staging: mt29f_spinand: switch to mtd_ooblayout_ops mtd: nand: kill layout field mtd: kill the nand_ecclayout struct arch/arm/mach-pxa/spitz.c | 41 +++- arch/arm/plat-samsung/devs.c| 9 - arch/mips/include/asm/mach-jz4740/jz4740_nand.h | 4 +- arch/mips/jz4740/board-qi_lb60.c| 83 --- drivers/mtd/devices/docg3.c | 39 +++- drivers/mtd/mtdchar.c | 95 +--- drivers/mtd/mtdconcat.c | 2 +- drivers/mtd/mtdpart.c | 22 +- drivers/mtd/mtdswap.c | 20 +- drivers/mtd/nand/atmel_nand.c | 100 drivers/mtd/nand/bf5xx_nand.c | 47 ++-- drivers/mtd/nand/brcmnand/brcmnand.c| 258 - drivers/mtd/nand/cafe_nand.c| 42 +++- drivers/mtd/nand/davinci_nand.c | 114 - drivers/mtd/nand/denali.c | 48 ++-- drivers/mtd/nand/diskonchip.c | 34 ++- drivers/mtd/nand/docg4.c| 30 ++- drivers/mtd/nand/fsl_elbc_nand.c| 79 --- drivers/mtd/nand/fsl_ifc_nand.c | 226 +- drivers/mtd/nand/fsmc_nand.c| 294 +++- drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 57 +++-- drivers/mtd/nand/hisi504_nand.c | 27 ++- drivers/mtd/nand/jz4740_nand.c | 5 +- drivers/mtd/nand/lpc32xx_mlc.c | 51 ++-- drivers/mtd/nand/lpc32xx_slc.c | 41 +++- drivers/mtd/nand/mxc_nand.c | 206 - drivers/mtd/nand/nand_base.c| 229 ++ drivers/mtd/nand/nand_bch.c | 45 ++-- drivers/mtd/nand/omap2.c| 219 ++ drivers/mtd/nand/plat_nand.c| 1 - drivers/mtd/nand/pxa3xx_nand.c | 101 drivers/mtd/nand/s3c2410.c | 31 ++- drivers/mtd/nand/sh_flctl.c | 80 +-- drivers/mtd/nand/sharpsl.c |
[linux-sunxi] [PATCH 04/23] mtd: nand: s3c2410: kill the ->ecc_layout field
The s3c2410 is allowing board data to overload the default ECC layout defined inside the driver, but this feature is not used by board specific definitions. Kill this field so that we can easily move to a model where ecclayout are dynamically allocated by the NAND controller driver. Signed-off-by: Boris Brezillon --- arch/arm/plat-samsung/devs.c | 9 - drivers/mtd/nand/s3c2410.c | 3 --- include/linux/platform_data/mtd-nand-s3c2410.h | 1 - 3 files changed, 13 deletions(-) diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c index 8207462..a903ee8 100644 --- a/arch/arm/plat-samsung/devs.c +++ b/arch/arm/plat-samsung/devs.c @@ -710,15 +710,6 @@ static int __init s3c_nand_copy_set(struct s3c2410_nand_set *set) return -ENOMEM; } - if (set->ecc_layout) { - ptr = kmemdup(set->ecc_layout, - sizeof(struct nand_ecclayout), GFP_KERNEL); - set->ecc_layout = ptr; - - if (!ptr) - return -ENOMEM; - } - return 0; } diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c index 05105ca..b569200 100644 --- a/drivers/mtd/nand/s3c2410.c +++ b/drivers/mtd/nand/s3c2410.c @@ -860,9 +860,6 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info, chip->ecc.mode = NAND_ECC_SOFT; #endif - if (set->ecc_layout != NULL) - chip->ecc.layout = set->ecc_layout; - if (set->disable_ecc) chip->ecc.mode = NAND_ECC_NONE; diff --git a/include/linux/platform_data/mtd-nand-s3c2410.h b/include/linux/platform_data/mtd-nand-s3c2410.h index 36bb921..c55e42ee 100644 --- a/include/linux/platform_data/mtd-nand-s3c2410.h +++ b/include/linux/platform_data/mtd-nand-s3c2410.h @@ -40,7 +40,6 @@ struct s3c2410_nand_set { char*name; int *nr_map; struct mtd_partition*partitions; - struct nand_ecclayout *ecc_layout; }; struct s3c2410_platform_nand { -- 2.1.4 -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] [PATCH 01/23] mtd: kill the ecclayout->oobavail field
ecclayout->oobavail is just redundant with the mtd->oobavail field. Moreover, it prevents static const definition of ecc layouts since the NAND framework is calculating this value based on the ecclayout->oobfree field. Signed-off-by: Boris Brezillon --- drivers/mtd/devices/docg3.c | 5 ++- drivers/mtd/mtdswap.c | 16 - drivers/mtd/nand/brcmnand/brcmnand.c | 3 -- drivers/mtd/nand/docg4.c | 1 - drivers/mtd/nand/hisi504_nand.c | 1 - drivers/mtd/nand/nand_base.c | 12 +++ drivers/mtd/onenand/onenand_base.c| 16 - drivers/mtd/tests/oobtest.c | 49 +-- drivers/staging/mt29f_spinand/mt29f_spinand.c | 1 - fs/jffs2/wbuf.c | 6 ++-- include/linux/mtd/mtd.h | 1 - 11 files changed, 48 insertions(+), 63 deletions(-) diff --git a/drivers/mtd/devices/docg3.c b/drivers/mtd/devices/docg3.c index c3a2695..e7b2e43 100644 --- a/drivers/mtd/devices/docg3.c +++ b/drivers/mtd/devices/docg3.c @@ -72,13 +72,11 @@ MODULE_PARM_DESC(reliable_mode, "Set the docg3 mode (0=normal MLC, 1=fast, " * @eccbytes: 8 bytes are used (1 for Hamming ECC, 7 for BCH ECC) * @eccpos: ecc positions (byte 7 is Hamming ECC, byte 8-14 are BCH ECC) * @oobfree: free pageinfo bytes (byte 0 until byte 6, byte 15 - * @oobavail: 8 available bytes remaining after ECC toll */ static struct nand_ecclayout docg3_oobinfo = { .eccbytes = 8, .eccpos = {7, 8, 9, 10, 11, 12, 13, 14}, .oobfree = {{0, 7}, {15, 1} }, - .oobavail = 8, }; static inline u8 doc_readb(struct docg3 *docg3, u16 reg) @@ -1438,7 +1436,7 @@ static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, oobdelta = mtd->oobsize; break; case MTD_OPS_AUTO_OOB: - oobdelta = mtd->ecclayout->oobavail; + oobdelta = mtd->oobavail; break; default: return -EINVAL; @@ -1860,6 +1858,7 @@ static int __init doc_set_driver_info(int chip_id, struct mtd_info *mtd) mtd->_write_oob = doc_write_oob; mtd->_block_isbad = doc_block_isbad; mtd->ecclayout = &docg3_oobinfo; + mtd->oobavail = 8; mtd->ecc_strength = DOC_ECC_BCH_T; return 0; diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c index fc8b3d1..d330eb1 100644 --- a/drivers/mtd/mtdswap.c +++ b/drivers/mtd/mtdswap.c @@ -346,7 +346,7 @@ static int mtdswap_read_markers(struct mtdswap_dev *d, struct swap_eb *eb) if (mtd_can_have_bb(d->mtd) && mtd_block_isbad(d->mtd, offset)) return MTDSWAP_SCANNED_BAD; - ops.ooblen = 2 * d->mtd->ecclayout->oobavail; + ops.ooblen = 2 * d->mtd->oobavail; ops.oobbuf = d->oob_buf; ops.ooboffs = 0; ops.datbuf = NULL; @@ -359,7 +359,7 @@ static int mtdswap_read_markers(struct mtdswap_dev *d, struct swap_eb *eb) data = (struct mtdswap_oobdata *)d->oob_buf; data2 = (struct mtdswap_oobdata *) - (d->oob_buf + d->mtd->ecclayout->oobavail); + (d->oob_buf + d->mtd->oobavail); if (le16_to_cpu(data->magic) == MTDSWAP_MAGIC_CLEAN) { eb->erase_count = le32_to_cpu(data->count); @@ -933,7 +933,7 @@ static unsigned int mtdswap_eblk_passes(struct mtdswap_dev *d, ops.mode = MTD_OPS_AUTO_OOB; ops.len = mtd->writesize; - ops.ooblen = mtd->ecclayout->oobavail; + ops.ooblen = mtd->oobavail; ops.ooboffs = 0; ops.datbuf = d->page_buf; ops.oobbuf = d->oob_buf; @@ -945,7 +945,7 @@ static unsigned int mtdswap_eblk_passes(struct mtdswap_dev *d, for (i = 0; i < mtd_pages; i++) { patt = mtdswap_test_patt(test + i); memset(d->page_buf, patt, mtd->writesize); - memset(d->oob_buf, patt, mtd->ecclayout->oobavail); + memset(d->oob_buf, patt, mtd->oobavail); ret = mtd_write_oob(mtd, pos, &ops); if (ret) goto error; @@ -964,7 +964,7 @@ static unsigned int mtdswap_eblk_passes(struct mtdswap_dev *d, if (p1[j] != patt) goto error; - for (j = 0; j < mtd->ecclayout->oobavail; j++) + for (j = 0; j < mtd->oobavail; j++) if (p2[j] != (unsigned char)patt) goto error; @@ -1387,7 +1387,7 @@ static int mtdswap_init(struct mtdswap_dev *d, unsigned int eblocks, if (!d->page_buf) goto page_buf_fail; - d->oob_buf = kmalloc(2 * mtd->ecclayout->oobavail, GFP_KERNEL); + d->oob_buf = kmalloc(2 * mtd->oobavail, GFP_KERNEL); if (!d->oob_buf)
[linux-sunxi] [PATCH 02/23] mtd: inftl: kill unused oobinfo field
Signed-off-by: Boris Brezillon --- include/linux/mtd/inftl.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/linux/mtd/inftl.h b/include/linux/mtd/inftl.h index 02cd5f9..8255118 100644 --- a/include/linux/mtd/inftl.h +++ b/include/linux/mtd/inftl.h @@ -44,7 +44,6 @@ struct INFTLrecord { unsigned int nb_blocks; /* number of physical blocks */ unsigned int nb_boot_blocks;/* number of blocks used by the bios */ struct erase_info instr; - struct nand_ecclayout oobinfo; }; int INFTL_mount(struct INFTLrecord *s); -- 2.1.4 -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [linux-sunxi] [PATCH resend 2/6] clk: sunxi: Add VE (Video Engine) module clock driver for sun[457]i
On 05/12/15 14:16, Chen-Yu Tsai wrote: > The video engine has its own special module clock, consisting of a clock > gate, configurable dividers, and a reset control. > Hi, I've tested these patches on A20, everything works so far. I only read some bits from a random bitstream, so nothing fancy yet, but it shows that both dram and module clock are working. One small indentation error below, otherwise it looks good. > On later (sun[68]i) families, the reset control is moved out of this > piece of hardware and grouped with reset controls of other peripherals. > > Signed-off-by: Chen-Yu Tsai > --- > Documentation/devicetree/bindings/clock/sunxi.txt | 4 + > drivers/clk/sunxi/Makefile| 1 + > drivers/clk/sunxi/clk-a10-ve.c| 171 > ++ > 3 files changed, 176 insertions(+) > create mode 100644 drivers/clk/sunxi/clk-a10-ve.c > > diff --git a/Documentation/devicetree/bindings/clock/sunxi.txt > b/Documentation/devicetree/bindings/clock/sunxi.txt > index ef0b452806b1..14496056319f 100644 > --- a/Documentation/devicetree/bindings/clock/sunxi.txt > +++ b/Documentation/devicetree/bindings/clock/sunxi.txt > @@ -74,6 +74,7 @@ Required properties: > "allwinner,sun8i-h3-usb-clk" - for usb gates + resets on H3 > "allwinner,sun9i-a80-usb-mod-clk" - for usb gates + resets on A80 > "allwinner,sun9i-a80-usb-phy-clk" - for usb phy gates + resets on A80 > + "allwinner,sun4i-a10-ve-clk" - for the Video Engine clock > > Required properties for all clocks: > - reg : shall be the control register address for the clock. > @@ -93,6 +94,9 @@ Required properties for all clocks: > And "allwinner,*-usb-clk" clocks also require: > - reset-cells : shall be set to 1 > > +The "allwinner,sun4i-a10-ve-clk" clock also requires: > +- reset-cells : shall be set to 0 > + > The "allwinner,sun9i-a80-mmc-config-clk" clock also requires: > - #reset-cells : shall be set to 1 > - resets : shall be the reset control phandle for the mmc block. > diff --git a/drivers/clk/sunxi/Makefile b/drivers/clk/sunxi/Makefile > index 103efab05ca8..78db91ad5af6 100644 > --- a/drivers/clk/sunxi/Makefile > +++ b/drivers/clk/sunxi/Makefile > @@ -7,6 +7,7 @@ obj-y += clk-a10-codec.o > obj-y += clk-a10-hosc.o > obj-y += clk-a10-mod1.o > obj-y += clk-a10-pll2.o > +obj-y += clk-a10-ve.o > obj-y += clk-a20-gmac.o > obj-y += clk-mod0.o > obj-y += clk-simple-gates.o > diff --git a/drivers/clk/sunxi/clk-a10-ve.c b/drivers/clk/sunxi/clk-a10-ve.c > new file mode 100644 > index ..de0fdb656150 > --- /dev/null > +++ b/drivers/clk/sunxi/clk-a10-ve.c > @@ -0,0 +1,171 @@ > +/* > + * Copyright 2015 Chen-Yu Tsai > + * > + * Chen-Yu Tsai > + * > + * This program 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 program 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. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +static DEFINE_SPINLOCK(ve_lock); > + > +#define SUN4I_VE_ENABLE 31 > +#define SUN4I_VE_DIVIDER_SHIFT 16 > +#define SUN4I_VE_DIVIDER_WIDTH 3 > +#define SUN4I_VE_RESET 0 > + > +/** > + * sunxi_ve_reset... - reset bit in ve clk registers handling > + */ > + > +struct ve_reset_data { > + void __iomem*reg; > + spinlock_t *lock; > + struct reset_controller_dev rcdev; > +}; > + > +static int sunxi_ve_reset_assert(struct reset_controller_dev *rcdev, > + unsigned long id) > +{ > + struct ve_reset_data *data = container_of(rcdev, > + struct ve_reset_data, > + rcdev); > + unsigned long flags; > + u32 reg; > + > + spin_lock_irqsave(data->lock, flags); > + > + reg = readl(data->reg); > + writel(reg & ~BIT(SUN4I_VE_RESET), data->reg); > + > + spin_unlock_irqrestore(data->lock, flags); > + > + return 0; > +} > + > +static int sunxi_ve_reset_deassert(struct reset_controller_dev *rcdev, > +unsigned long id) > +{ > + struct ve_reset_data *data = container_of(rcdev, > + struct ve_reset_data, > + rcdev); > + unsigned long flags; > + u32 reg; > + > + spin_lock_irqsave(data->lock, flags); > + > + reg = readl(data->reg); > + writel(reg | BIT(SUN4I_VE_RESET), data->reg); > + > + spin_unlock_irqrestore(data->lock, flags); > + > + return 0; >
[linux-sunxi] Re: [PATCH v5 3/4] ARM: dts: sunxi: Add Allwinner H3 DTSI
On 07/12/15 09:12, Jean-Francois Moine wrote: > On Fri, 4 Dec 2015 22:24:42 +0100 > Jens Kuske wrote: > >> The Allwinner H3 is a home entertainment system oriented SoC with >> four Cortex-A7 cores and a Mali-400MP2 GPU. >> >> Signed-off-by: Jens Kuske >> --- >> arch/arm/boot/dts/sun8i-h3.dtsi | 497 >> >> 1 file changed, 497 insertions(+) >> create mode 100644 arch/arm/boot/dts/sun8i-h3.dtsi >> >> diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi >> b/arch/arm/boot/dts/sun8i-h3.dtsi >> new file mode 100644 >> index 000..1524130e >> --- /dev/null >> +++ b/arch/arm/boot/dts/sun8i-h3.dtsi >> @@ -0,0 +1,497 @@ > [snip] >> +bus_gates: clk@01c20060 { >> +#clock-cells = <1>; >> +compatible = "allwinner,sun8i-h3-bus-gates-clk"; >> +reg = <0x01c20060 0x14>; >> +clocks = <&ahb1>, <&ahb2>, <&apb1>, <&apb2>; >> +clock-names = "ahb1", "ahb2", "apb1", "apb2"; >> +clock-indices = <5>, <6>, <8>, >> +<9>, <10>, <13>, >> +<14>, <17>, <18>, >> +<19>, <20>, >> +<21>, <23>, >> +<24>, <25>, >> +<26>, <27>, >> +<28>, <29>, >> +<30>, <31>, <32>, >> +<35>, <36>, <37>, >> +<40>, <41>, <43>, >> +<44>, <52>, <53>, >> +<54>, <64>, >> +<65>, <69>, <72>, >> +<76>, <77>, <78>, >> +<96>, <97>, <98>, >> +<112>, <113>, >> +<114>, <115>, >> +<116>, <128>, <135>; >> +clock-output-names = "bus_ce", "bus_dma", "bus_mmc0", >> + "bus_mmc1", "bus_mmc2", "bus_nand", >> + "bus_sdram", "bus_gmac", "bus_ts", >> + "bus_hstimer", "bus_spi0", >> + "bus_spi1", "bus_otg", >> + "bus_otg_ehci0", "bus_ehci1", >> + "bus_ehci2", "bus_ehci3", >> + "bus_otg_ohci0", "bus_ohci1", >> + "bus_ohci2", "bus_ohci3", "bus_ve", >> + "bus_lcd0", "bus_lcd1", >> "bus_deint", > > The tcon1 clock is used by both lcd0 and lcd1, while the tcon0 clock is used > for TV output from lcd1, so, this should be: > > "bus_tcon0", "bus_tcon1", "bus_deint", > > (the tcon1 clock is used by both lcd0 and lcd1, while > the tcon0 clock is used for TV output from lcd1) Hi, These are only the ahb bus gates, not the module clocks. Naming them lcd might be a bit confusing, but it follows the naming we used since sun4i. And the tcon modules are still called lcd0 and lcd1 module in the manual too. Interestingly there is only a tcon0 module clock in the manual and no tcon1, but that is not part of this patch. Jens > >> + "bus_csi", "bus_tve", "bus_hdmi", >> + "bus_de", "bus_gpu", "bus_msgbox", >> + "bus_spinlock", "bus_codec", >> + "bus_spdif", "bus_pio", "bus_ths", >> + "bus_i2s0", "bus_i2s1", "bus_i2s2", >> + "bus_i2c0", "bus_i2c1", "bus_i2c2", >> + "bus_uart0", "bus_uart1", >> + "bus_uart2", "bus_uart3", >> + "bus_scr", "bus_ephy", "bus_dbg"; >> +}; > [snip] > -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [linux-sunxi] [PATCH 1/2] spi: sun4i: add DMA support
On 7 December 2015 at 16:46, Maxime Ripard wrote: > Hi, > > On Sat, Dec 05, 2015 at 07:01:36PM +0100, Michal Suchanek wrote: >> Hello, >> >> On 30 May 2014 at 22:27, Emilio López wrote: >> > This patch adds support for 64 byte or bigger transfers on the >> > sun4i SPI controller. Said transfers will be performed via DMA. >> > >> > Signed-off-by: Emilio López >> > Tested-by: Michal Suchanek >> >> looks like this patch was dropped. >> >> sun4i still does not have SPI DMA. >> >> anyone picking it up or should I try to refresh it? > > If you don't send it to the relevant maintainers, no one will pick it > up. > I am posting here to get some idea if somebody is working on including this patch in the kernel. If not I can send it to relevant maintainers. Thanks Michal -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [linux-sunxi] [PATCH v4] sun4i-codec: add inputs
Hi Danny, On Sun, Dec 06, 2015 at 07:53:07PM +0100, Danny Milosavljevic wrote: > Hi, > > this is the fourth version of the patch that adds inputs to sun4i-codec. > > The inputs added are: > - FM-In Left and Right > - Line-In Left and Right > - Mic1-In > - Mic2-In > > Changes compared to v3 are: > - Names of the input are not uppercase anymore. > - bit index constants are now named as in the A20 user manual v1.4 > - added Mic1-In, Mac2-In > - added Mic1 and Mic2 Pre-Amplifiers. > > I successfully tested it using alsamixer, headphones, a radio and my ears. > Note that because of missing capturing support I tested only the mixing. > > Still TODO are: > - sun4i_codec_micin_gain_scale should have an entry for 0 dB at 0. > How? > - maybe the Mic Preamps should be listed in the routes. > It works as it is now, though. > - right now when I press F4 in alsamixer, the Mic1-In Pre-Amplifier Gain > is missing its muting switch. WTF... > How does ALSA (or alsamixer) know which controls are "Capture"? Thanks for your patch. Please send it to the relevant recipients (you can have the list using scripts/get_maintainer.pl) so that the review process can get started. Otherwise, your patch will never be picked. Thanks! Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. signature.asc Description: Digital signature
Re: [linux-sunxi] [PATCH 1/2] spi: sun4i: add DMA support
Hi, On Sat, Dec 05, 2015 at 07:01:36PM +0100, Michal Suchanek wrote: > Hello, > > On 30 May 2014 at 22:27, Emilio López wrote: > > This patch adds support for 64 byte or bigger transfers on the > > sun4i SPI controller. Said transfers will be performed via DMA. > > > > Signed-off-by: Emilio López > > Tested-by: Michal Suchanek > > looks like this patch was dropped. > > sun4i still does not have SPI DMA. > > anyone picking it up or should I try to refresh it? If you don't send it to the relevant maintainers, no one will pick it up. Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. signature.asc Description: Digital signature
[linux-sunxi] Re: [PATCH] clk: sunxi: Extend the simple gates and handle the Allwinner H3
On Sun, Dec 06, 2015 at 10:04:12AM +0100, Jean-Francois Moine wrote: > The H3 has a clock gate definition similar to the other Allwinner SoCs, > but with a different parent clock for each single gate. > > Adding the names of the parent clocks in both the source and output clocks > permits the use of the simple-gates driver to define the bus gates > of all known Allwinner SoCs. > > Signed-off-by: Jean-Francois Moine > --- > This patch replaces a part of Jens Kuske's patch > [PATCH v5 1/4] clk: sunxi: Add H3 clocks support > --- > Documentation/devicetree/bindings/clock/sunxi.txt | 25 > +++ > drivers/clk/sunxi/clk-simple-gates.c | 14 - > 2 files changed, 38 insertions(+), 1 deletion(-) > > diff --git a/Documentation/devicetree/bindings/clock/sunxi.txt > b/Documentation/devicetree/bindings/clock/sunxi.txt > index 8a47b77..5736e6d 100644 > --- a/Documentation/devicetree/bindings/clock/sunxi.txt > +++ b/Documentation/devicetree/bindings/clock/sunxi.txt > @@ -70,6 +70,7 @@ Required properties: > "allwinner,sun8i-a23-usb-clk" - for usb gates + resets on A23 > "allwinner,sun9i-a80-usb-mod-clk" - for usb gates + resets on A80 > "allwinner,sun9i-a80-usb-phy-clk" - for usb phy gates + resets on A80 > + "allwinner,sunxi-gates-clk" - simple gates > > Required properties for all clocks: > - reg : shall be the control register address for the clock. > @@ -93,6 +94,12 @@ The "allwinner,sun9i-a80-mmc-config-clk" clock also > requires: > - #reset-cells : shall be set to 1 > - resets : shall be the reset control phandle for the mmc block. > > +The "allwinner,sunxi-gates-clk" clock also requires: > +- clock-names : corresponding names of the parent clocks > +when the output clocks have different parents. > +These names must be 4 characters long and must appear as a prefix in > +the names of the output clocks. See example. > + I don't think you should be encoding relationships of clocks using the name strings. We describe relationships in DT via parent/child or phandles. Rob -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] Re: [PATCH 2/6] clk: sunxi: Add VE (Video Engine) module clock driver for sun[457]i
On Sat, Dec 05, 2015 at 05:00:05PM +0800, Chen-Yu Tsai wrote: > The video engine has its own special module clock, consisting of a clock > gate, configurable dividers, and a reset control. > > On later (sun[68]i) families, the reset control is moved out of this > piece of hardware and grouped with reset controls of other peripherals. > > Signed-off-by: Chen-Yu Tsai Acked-by: Rob Herring > --- > Documentation/devicetree/bindings/clock/sunxi.txt | 4 + > drivers/clk/sunxi/Makefile| 1 + > drivers/clk/sunxi/clk-a10-ve.c| 171 > ++ > 3 files changed, 176 insertions(+) > create mode 100644 drivers/clk/sunxi/clk-a10-ve.c > > diff --git a/Documentation/devicetree/bindings/clock/sunxi.txt > b/Documentation/devicetree/bindings/clock/sunxi.txt > index ef0b452806b1..14496056319f 100644 > --- a/Documentation/devicetree/bindings/clock/sunxi.txt > +++ b/Documentation/devicetree/bindings/clock/sunxi.txt > @@ -74,6 +74,7 @@ Required properties: > "allwinner,sun8i-h3-usb-clk" - for usb gates + resets on H3 > "allwinner,sun9i-a80-usb-mod-clk" - for usb gates + resets on A80 > "allwinner,sun9i-a80-usb-phy-clk" - for usb phy gates + resets on A80 > + "allwinner,sun4i-a10-ve-clk" - for the Video Engine clock > > Required properties for all clocks: > - reg : shall be the control register address for the clock. > @@ -93,6 +94,9 @@ Required properties for all clocks: > And "allwinner,*-usb-clk" clocks also require: > - reset-cells : shall be set to 1 > > +The "allwinner,sun4i-a10-ve-clk" clock also requires: > +- reset-cells : shall be set to 0 > + > The "allwinner,sun9i-a80-mmc-config-clk" clock also requires: > - #reset-cells : shall be set to 1 > - resets : shall be the reset control phandle for the mmc block. > diff --git a/drivers/clk/sunxi/Makefile b/drivers/clk/sunxi/Makefile > index 103efab05ca8..78db91ad5af6 100644 > --- a/drivers/clk/sunxi/Makefile > +++ b/drivers/clk/sunxi/Makefile > @@ -7,6 +7,7 @@ obj-y += clk-a10-codec.o > obj-y += clk-a10-hosc.o > obj-y += clk-a10-mod1.o > obj-y += clk-a10-pll2.o > +obj-y += clk-a10-ve.o > obj-y += clk-a20-gmac.o > obj-y += clk-mod0.o > obj-y += clk-simple-gates.o > diff --git a/drivers/clk/sunxi/clk-a10-ve.c b/drivers/clk/sunxi/clk-a10-ve.c > new file mode 100644 > index ..de0fdb656150 > --- /dev/null > +++ b/drivers/clk/sunxi/clk-a10-ve.c > @@ -0,0 +1,171 @@ > +/* > + * Copyright 2015 Chen-Yu Tsai > + * > + * Chen-Yu Tsai > + * > + * This program 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 program 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. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +static DEFINE_SPINLOCK(ve_lock); > + > +#define SUN4I_VE_ENABLE 31 > +#define SUN4I_VE_DIVIDER_SHIFT 16 > +#define SUN4I_VE_DIVIDER_WIDTH 3 > +#define SUN4I_VE_RESET 0 > + > +/** > + * sunxi_ve_reset... - reset bit in ve clk registers handling > + */ > + > +struct ve_reset_data { > + void __iomem*reg; > + spinlock_t *lock; > + struct reset_controller_dev rcdev; > +}; > + > +static int sunxi_ve_reset_assert(struct reset_controller_dev *rcdev, > + unsigned long id) > +{ > + struct ve_reset_data *data = container_of(rcdev, > + struct ve_reset_data, > + rcdev); > + unsigned long flags; > + u32 reg; > + > + spin_lock_irqsave(data->lock, flags); > + > + reg = readl(data->reg); > + writel(reg & ~BIT(SUN4I_VE_RESET), data->reg); > + > + spin_unlock_irqrestore(data->lock, flags); > + > + return 0; > +} > + > +static int sunxi_ve_reset_deassert(struct reset_controller_dev *rcdev, > +unsigned long id) > +{ > + struct ve_reset_data *data = container_of(rcdev, > + struct ve_reset_data, > + rcdev); > + unsigned long flags; > + u32 reg; > + > + spin_lock_irqsave(data->lock, flags); > + > + reg = readl(data->reg); > + writel(reg | BIT(SUN4I_VE_RESET), data->reg); > + > + spin_unlock_irqrestore(data->lock, flags); > + > + return 0; > +} > + > +static int sunxi_ve_of_xlate(struct reset_controller_dev *rcdev, > + const struct of_phandle_args *reset_spec) > +{ > +if (WARN_ON(reset_spec->args_count != 0)) > +
[linux-sunxi] Re: [PATCH 1/6] clk: sunxi: Add DRAM gates support for sun4i-a10
On Sat, Dec 05, 2015 at 05:00:04PM +0800, Chen-Yu Tsai wrote: > The A10/A20 share the same set of DRAM clock gates, which controls > direct memory access for some peripherals. > > On the A10, bit 15 controls the system's DRAM clock output (possibly > to the DRAM chips), which we need to keep on. > > On the A20 this has been moved to the DRAM controller, becoming a no-op. > However it is still listed in the user manual, so add it anyway. > > Signed-off-by: Chen-Yu Tsai Acked-by: Rob Herring Perhaps someone should go and add all the compatible strings you need here. You don't have to have a user in the kernel. These oneline binding changes are getting old... Rob > --- > Documentation/devicetree/bindings/clock/sunxi.txt | 1 + > drivers/clk/sunxi/clk-simple-gates.c | 12 > 2 files changed, 13 insertions(+) > > diff --git a/Documentation/devicetree/bindings/clock/sunxi.txt > b/Documentation/devicetree/bindings/clock/sunxi.txt > index 153ac72869e8..ef0b452806b1 100644 > --- a/Documentation/devicetree/bindings/clock/sunxi.txt > +++ b/Documentation/devicetree/bindings/clock/sunxi.txt > @@ -57,6 +57,7 @@ Required properties: > "allwinner,sun6i-a31-apb2-gates-clk" - for the APB2 gates on A31 > "allwinner,sun8i-a23-apb2-gates-clk" - for the APB2 gates on A23 > "allwinner,sun9i-a80-apbs-gates-clk" - for the APBS gates on A80 > + "allwinner,sun4i-a10-dram-gates-clk" - for the DRAM gates on A10 > "allwinner,sun5i-a13-mbus-clk" - for the MBUS clock on A13 > "allwinner,sun4i-a10-mmc-clk" - for the MMC clock > "allwinner,sun9i-a80-mmc-clk" - for mmc module clocks on A80 > diff --git a/drivers/clk/sunxi/clk-simple-gates.c > b/drivers/clk/sunxi/clk-simple-gates.c > index c8acc0612c15..f4da52b5ca0e 100644 > --- a/drivers/clk/sunxi/clk-simple-gates.c > +++ b/drivers/clk/sunxi/clk-simple-gates.c > @@ -160,3 +160,15 @@ CLK_OF_DECLARE(sun5i_a13_ahb, > "allwinner,sun5i-a13-ahb-gates-clk", > sun4i_a10_ahb_init); > CLK_OF_DECLARE(sun7i_a20_ahb, "allwinner,sun7i-a20-ahb-gates-clk", > sun4i_a10_ahb_init); > + > +static const int sun4i_a10_dram_critical_clocks[] __initconst = { > + 15, /* dram_output */ > +}; > + > +static void __init sun4i_a10_dram_init(struct device_node *node) > +{ > + sunxi_simple_gates_setup(node, sun4i_a10_dram_critical_clocks, > + ARRAY_SIZE(sun4i_a10_dram_critical_clocks)); > +} > +CLK_OF_DECLARE(sun4i_a10_dram, "allwinner,sun4i-a10-dram-gates-clk", > +sun4i_a10_dram_init); > -- > 2.6.2 > -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] Re: [PATCH v5] clk: sunxi: Add CLK_OF_DECLARE support for sun8i-a23-apb0-clk driver
On Mon, Dec 7, 2015 at 5:36 PM, Maxime Ripard wrote: > Hi, > > On Thu, Dec 03, 2015 at 03:05:30PM +0800, Chen-Yu Tsai wrote: >> The APBS clock on sun9i is the same as the APB0 clock on sun8i. With >> sun9i we are supporting the PRCM clocks by using CLK_OF_DECLARE, >> instead of through a PRCM mfd device and subdevices for each clock >> and reset control. As such we need a CLK_OF_DECLARE version of >> the sun8i-a23-apb0-clk driver. >> >> Also, build it for sun9i/A80, and not just for configurations with >> MFD_SUN6I_PRCM enabled. >> >> Signed-off-by: Chen-Yu Tsai >> --- >> >> Changes since v4: >> >> - Keep building clk-sun8i-apb0 for SUN6I_MFD_PRCM. >> >> - Add an error message and comment for when of_io_request_and_map() >> fails. of_io_request_and_map() merges a bunch of errors into -EINVAL, >> so this might not be the best approach. But I think having an error >> message when we know something is wrong (-EBUSY, -ENOMEM) is better. >> >> --- >> drivers/clk/sunxi/Makefile | 1 + >> drivers/clk/sunxi/clk-sun8i-apb0.c | 80 >> -- >> 2 files changed, 69 insertions(+), 12 deletions(-) >> >> diff --git a/drivers/clk/sunxi/Makefile b/drivers/clk/sunxi/Makefile >> index 103efab05ca8..ccf21ba3b6b0 100644 >> --- a/drivers/clk/sunxi/Makefile >> +++ b/drivers/clk/sunxi/Makefile >> @@ -15,6 +15,7 @@ obj-y += clk-sun9i-core.o >> obj-y += clk-sun9i-mmc.o >> obj-y += clk-usb.o >> >> +obj-$(CONFIG_MACH_SUN9I) += clk-sun8i-apb0.o >> obj-$(CONFIG_MACH_SUN9I) += clk-sun9i-cpus.o >> >> obj-$(CONFIG_MFD_SUN6I_PRCM) += \ >> diff --git a/drivers/clk/sunxi/clk-sun8i-apb0.c >> b/drivers/clk/sunxi/clk-sun8i-apb0.c >> index 7ae5d2c2cde1..7ba61103a6f5 100644 >> --- a/drivers/clk/sunxi/clk-sun8i-apb0.c >> +++ b/drivers/clk/sunxi/clk-sun8i-apb0.c >> @@ -17,13 +17,77 @@ >> #include >> #include >> #include >> +#include >> #include >> >> +static struct clk *sun8i_a23_apb0_register(struct device_node *node, >> +void __iomem *reg) >> +{ >> + const char *clk_name = node->name; >> + const char *clk_parent; >> + struct clk *clk; >> + int ret; >> + >> + clk_parent = of_clk_get_parent_name(node, 0); >> + if (!clk_parent) >> + return ERR_PTR(-EINVAL); >> + >> + of_property_read_string(node, "clock-output-names", &clk_name); >> + >> + /* The A23 APB0 clock is a standard 2 bit wide divider clock */ >> + clk = clk_register_divider(NULL, clk_name, clk_parent, 0, reg, >> +0, 2, CLK_DIVIDER_POWER_OF_TWO, NULL); >> + if (IS_ERR(clk)) >> + return clk; >> + >> + ret = of_clk_add_provider(node, of_clk_src_simple_get, clk); >> + if (ret) >> + goto err_unregister; >> + >> + return clk; >> + >> +err_unregister: >> + clk_unregister_divider(clk); >> + >> + return ERR_PTR(ret); >> +} >> + >> +static void sun8i_a23_apb0_setup(struct device_node *node) >> +{ >> + void __iomem *reg; >> + struct resource res; >> + struct clk *clk; >> + >> + reg = of_io_request_and_map(node, 0, of_node_full_name(node)); >> + if (IS_ERR(reg)) { >> + /* >> + * This happens with clk nodes instantiated through mfd, >> + * as those do not have their resources assigned in the >> + * device tree. Do not print an error in this case. >> + */ >> + if (PTR_ERR(reg) != -EINVAL) >> + pr_err("Could not get registers for a23-apb0-clk\n"); > > This is not the only case you have to take into account. > > There's also the case when you have a regular clock (and by regular I > mean that is not in the PRCM) that will be probed by the > CLK_OF_DECLARE mechanism and then later by the device model. > > In such a case, the second of_io_request_and_map will fail, and you > will have an error returned that you do not ignore at the moment. Right. It will return -EBUSY. But ignoring it and returning 0 is telling the driver core that the device successfully binded. I think this is wrong. Normal clocks should be in the "clocks" node, and wouldn't be probed a second time through the device model, would it? Am I missing something? ChenYu -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [linux-sunxi] clk_out_a usage in mainline
Hi, On Mon, Dec 07, 2015 at 12:49:42AM +0100, Danny Milosavljevic wrote: > Hi Chen-Yu, > > indeed, it works now. > > In case someone else wants to use it, it works like this: > > in the dts file I put: > > / { > tss463aa { > compatible = "atmel,tss463aa"; > clocks = <&clk_out_a>; > pinctrl-0 = <&clk_out_a_pins_a>; > pinctrl-names = "default"; > }; That one is not needed. > }; > > &spi2 { > status = "okay"; > pinctrl-names = "default"; > pinctrl-0 = <&spi2_pins_a>; > tss463aax { > compatible = "atmel,tss463aa"; > reg = <0>; > spi-max-frequency = <400>; > spi-cpol; > spi-cpha; > }; > }; > > Note the differing pinctrl. > Also note that it doesn't work if I put clk_out_a in the spi slave node. Yes, because you created a platform driver and not an SPI driver in this case. Convert your driver to it and you'll see that everything works as expected :) Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. signature.asc Description: Digital signature
[linux-sunxi] Re: [PATCH v5 0/8] sunxi-tools: support progress display for FEL utility
Hi Siarhei! Am 30.11.2015 um 12:44 schrieb Siarhei Siamashka: Hello, I think that patches 1-5 can be pushed to github, even though I'm not completely happy about certain aspects of them. The patches 6-9 may need some additional fixes. Oh, by the way. The "sunxi-tools:" prefix in the commit summaries is redundant in the github repository (because we already know that the whole thing is "sunxi-tools"). A better prefix would be "fel:". This minor commit summary tweak can be done when pushing patches. Thanks for working on this. Looks like we are now very close to having a perfect progress bar implementation in sunxi-fel. I'll take that as your "ACK" and push those first five commits to the sunxi-tools repo then (with the suggested fixes applied). Thanks for reviewing it all! Regards, B. Nortmann -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] Re: [PATCH v5 9/9] sunxi-tools: support updating the caption for "dialog --gauge"
Am 30.11.2015 um 12:32 schrieb Siarhei Siamashka: Thanks, this looks good. Just the description of this new command is missing in the help message text (when the sunxi-fel tool is run without any arguments). -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. >From 73d7989148f32f5183cbce2c49081f89203a3254 Mon Sep 17 00:00:00 2001 From: Bernhard Nortmann Date: Fri, 27 Nov 2015 15:13:48 +0100 Subject: [PATCH v6 9/9] fel: support updating the caption for "dialog --gauge" This patch adds an "echo-gauge" command that is intended for use with sunxi-fel's output piped into the dialog utility. "echo-gauge" will output its string argument in a way that updates (i.e. overwrites) the prompt text that dialog displays, so it's possible to change that inbetween file transfers from sunxi-fel. Example: sunxi-fel uboot ${UBOOT} \ echo-gauge "Uploading kernel (1/2)" \ write-with-gauge 0x4200 ${KERNEL} \ write 0x4310 ${SCRIPT} \ echo-gauge "Uploading rootfs (2/2)" \ write-with-gauge 0x4400 ${ROOTFS} \ | dialog --gauge "" 6 70 Signed-off-by: Bernhard Nortmann Reviewed-by: Siarhei Siamashka --- fel.c | 5 + 1 file changed, 5 insertions(+) diff --git a/fel.c b/fel.c index cdb34c7..df96f4d 100644 --- a/fel.c +++ b/fel.c @@ -1306,6 +1306,7 @@ int main(int argc, char **argv) " multi[write]-with-gauge ... like their \"write-with-*\" counterpart,\n" " multi[write]-with-xgauge ... but following the 'multi' syntax:\n" " <#> addr file [addr file [...]]\n" + " echo-gauge \"some text\"Update prompt/caption for gauge output\n" " ver[sion] Show BROM version\n" " clear address lengthClear memory\n" " fill address length value Fill memory\n" @@ -1393,6 +1394,10 @@ int main(int argc, char **argv) size_t count = strtoul(argv[2], NULL, 0); /* file count */ skip = 2 + 2 * file_upload(handle, count, argc - 3, argv + 3, progress_gauge_xxx); + } else if ((strcmp(argv[1], "echo-gauge") == 0) && argc > 2) { + skip = 2; + printf("XXX\n0\n%s\nXXX\n", argv[2]); + fflush(stdout); } else if (strcmp(argv[1], "read") == 0 && argc > 4) { size_t size = strtoul(argv[3], NULL, 0); void *buf = malloc(size); -- 2.4.6
[linux-sunxi] Re: [PATCH v5 8/9] sunxi-tools: support FEL progress gauge via dialog utility
Am 30.11.2015 um 12:32 schrieb Siarhei Siamashka: Don't we have a redundant code duplication here (copied from the "multiwrite" command implementation)? If I understand it correctly, only the progress callback function is different in all these implementations. Yup. That's what the new file_upload() function accounted for, so the various "write" command cases are now much more streamlined. Regards, B. Nortmann -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. >From a875406070f69c8bf77625fa91c46a166519c4e0 Mon Sep 17 00:00:00 2001 From: Bernhard Nortmann Date: Thu, 26 Nov 2015 16:46:01 +0100 Subject: [PATCH v6 8/9] fel: support FEL progress gauge via dialog utility This patch adds some additional commands, and implements corresponding progress callbacks that produce output for the 'dialog' utility: http://invisible-island.net/dialog/dialog.html The simple "*-with-gauge" just emits percentage numbers, line by line, while "*-with-xgauge" outputs extended information to update the dialog prompt. Both are meant for directly piping the output: sunxi-fel write-with-gauge <...> | dialog --gauge "FEL upload" 6 70 Signed-off-by: Bernhard Nortmann --- fel.c | 21 + progress.c | 44 progress.h | 2 ++ 3 files changed, 67 insertions(+) diff --git a/fel.c b/fel.c index 36fb544..cdb34c7 100644 --- a/fel.c +++ b/fel.c @@ -1299,8 +1299,13 @@ int main(int argc, char **argv) " read address length fileWrite memory contents into file\n" " write address file Store file contents into memory\n" " write-with-progress addr file \"write\" with progress bar\n" + " write-with-gauge addr file Output progress for \"dialog --gauge\"\n" + " write-with-xgauge addr file Extended gauge output (updates prompt)\n" " multi[write] # addr file ... \"write-with-progress\" multiple files,\n" " sharing a common progress status\n" + " multi[write]-with-gauge ... like their \"write-with-*\" counterpart,\n" + " multi[write]-with-xgauge ... but following the 'multi' syntax:\n" + " <#> addr file [addr file [...]]\n" " ver[sion] Show BROM version\n" " clear address lengthClear memory\n" " fill address length value Fill memory\n" @@ -1367,11 +1372,27 @@ int main(int argc, char **argv) } else if (strcmp(argv[1], "write-with-progress") == 0 && argc > 3) { skip += 2 * file_upload(handle, 1, argc - 2, argv + 2, progress_bar); + } else if (strcmp(argv[1], "write-with-gauge") == 0 && argc > 3) { + skip += 2 * file_upload(handle, 1, argc - 2, argv + 2, + progress_gauge); + } else if (strcmp(argv[1], "write-with-xgauge") == 0 && argc > 3) { + skip += 2 * file_upload(handle, 1, argc - 2, argv + 2, + progress_gauge_xxx); } else if ((strcmp(argv[1], "multiwrite") == 0 || strcmp(argv[1], "multi") == 0) && argc > 4) { size_t count = strtoul(argv[2], NULL, 0); /* file count */ skip = 2 + 2 * file_upload(handle, count, argc - 3, argv + 3, progress_bar); + } else if ((strcmp(argv[1], "multiwrite-with-gauge") == 0 || + strcmp(argv[1], "multi-with-gauge") == 0) && argc > 4) { + size_t count = strtoul(argv[2], NULL, 0); /* file count */ + skip = 2 + 2 * file_upload(handle, count, argc - 3, + argv + 3, progress_gauge); + } else if ((strcmp(argv[1], "multiwrite-with-xgauge") == 0 || + strcmp(argv[1], "multi-with-xgauge") == 0) && argc > 4) { + size_t count = strtoul(argv[2], NULL, 0); /* file count */ + skip = 2 + 2 * file_upload(handle, count, argc - 3, + argv + 3, progress_gauge_xxx); } else if (strcmp(argv[1], "read") == 0 && argc > 4) {
[linux-sunxi] Re: [PATCH v5 7/9] sunxi-tools: implement "write-with-progress" and "multiwrite"
Am 30.11.2015 um 12:31 schrieb Siarhei Siamashka: What if 'count' is much larger than 'argc' here? The revised file_upload() now takes care of it, and will error out in that case. Regards, B. Nortmann -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. >From b6966d19269d33baaa79a7af5548ba79f0505673 Mon Sep 17 00:00:00 2001 From: Bernhard Nortmann Date: Thu, 26 Nov 2015 16:16:58 +0100 Subject: [PATCH v6 7/9] fel: implement "write-with-progress" and "multiwrite" The two new commands both imply that a (simple) progress bar display is requested. "multi[write]" allows to upload a group of files with a single command, resulting in their transfer showing a common, 'overall' progress status. Signed-off-by: Bernhard Nortmann --- fel.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/fel.c b/fel.c index bbad5fe..36fb544 100644 --- a/fel.c +++ b/fel.c @@ -1298,6 +1298,9 @@ int main(int argc, char **argv) " exe[cute] address Call function address\n" " read address length fileWrite memory contents into file\n" " write address file Store file contents into memory\n" + " write-with-progress addr file \"write\" with progress bar\n" + " multi[write] # addr file ... \"write-with-progress\" multiple files,\n" + " sharing a common progress status\n" " ver[sion] Show BROM version\n" " clear address lengthClear memory\n" " fill address length value Fill memory\n" @@ -1361,6 +1364,14 @@ int main(int argc, char **argv) } else if (strcmp(argv[1], "write") == 0 && argc > 3) { skip += 2 * file_upload(handle, 1, argc - 2, argv + 2, pflag_active ? progress_bar : NULL); + } else if (strcmp(argv[1], "write-with-progress") == 0 && argc > 3) { + skip += 2 * file_upload(handle, 1, argc - 2, argv + 2, + progress_bar); + } else if ((strcmp(argv[1], "multiwrite") == 0 || + strcmp(argv[1], "multi") == 0) && argc > 4) { + size_t count = strtoul(argv[2], NULL, 0); /* file count */ + skip = 2 + 2 * file_upload(handle, count, argc - 3, + argv + 3, progress_bar); } else if (strcmp(argv[1], "read") == 0 && argc > 4) { size_t size = strtoul(argv[3], NULL, 0); void *buf = malloc(size); -- 2.4.6
[linux-sunxi] Re: [PATCH v5 6/9] sunxi-tools: Add file_size() and factor out a reusable file_upload()
Am 30.11.2015 um 12:30 schrieb Siarhei Siamashka: What if "name" is, for example, a directory instead of a file? [...] If the file does not exist, what is the "sunxi-fel" tool supposed to do? Do we want to silently ignore this? Agreed. That was too much on the "quick and dirty side". I've reworked file_size() to give proper error messages, requiring to specify a regular file. It's size may be 0 (no error). Considering your other comments for the patches that build on file_upload(), I had to rethink that one too. What we actually want is a "multi_upload", where the file count is possibly 1 (for the single-file commands), and the ability to specify the progress callback routine to use. I've now chosen an implementation of file_upload() that works on multiple file arguments (each being an offset + filename pair), while accessing the command line arguments as needed. Regards, B. Nortmann -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. >From 3bf01420a4dabc1894af84bbaa829325f22d97ad Mon Sep 17 00:00:00 2001 From: Bernhard Nortmann Date: Thu, 26 Nov 2015 15:36:43 +0100 Subject: [PATCH v6 6/9] fel: Add file_size() and factor out a reusable file_upload() This patch moves some code out of the "write" handler, with the intention to reuse it later for similar commands. At the same time, it also discards the previous transfer rate output when using "-v", as that has become redundant with the 'progress bar' display available by "-p". Signed-off-by: Bernhard Nortmann --- fel.c | 70 ++- 1 file changed, 53 insertions(+), 17 deletions(-) diff --git a/fel.c b/fel.c index 595b682..bbad5fe 100644 --- a/fel.c +++ b/fel.c @@ -32,6 +32,7 @@ #include #include #include +#include #include "endian_compat.h" #include "progress.h" @@ -333,6 +334,21 @@ void hexdump(void *data, uint32_t offset, size_t size) } } +unsigned int file_size(const char *filename) +{ + struct stat st; + if (stat(filename, &st) != 0) { + fprintf(stderr, "stat() error on file \"%s\": %s\n", filename, + strerror(errno)); + exit(1); + } + if (!S_ISREG(st.st_mode)) { + fprintf(stderr, "error: \"%s\" is not a regular file\n", filename); + exit(1); + } + return st.st_size; +} + int save_file(const char *name, void *data, size_t size) { FILE *out = fopen(name, "wb"); @@ -1218,6 +1234,41 @@ static int aw_fel_get_endpoint(libusb_device_handle *usb) return 0; } +/* private helper function, gets used for "write*" and "multi*" transfers */ +static unsigned int file_upload(libusb_device_handle *handle, size_t count, + size_t argc, char **argv, progress_cb_t progress) +{ + if (argc < count * 2) { + fprintf(stderr, "error: too few arguments for uploading %zu files\n", + count); + exit(1); + } + + /* get all file sizes, keeping track of total bytes */ + size_t size = 0; + unsigned int i; + for (i = 0; i < count; i++) + size += file_size(argv[i * 2 + 1]); + + progress_start(progress, size); // set total size and progress callback + + /* now transfer each file in turn */ + for (i = 0; i < count; i++) { + void *buf = load_file(argv[i * 2 + 1], &size); + if (size > 0) { + uint32_t offset = strtoul(argv[i * 2], NULL, 0); + aw_write_buffer(handle, buf, offset, size, true); + + // If we transferred a script, try to inform U-Boot about its address. + if (get_image_type(buf, size) == IH_TYPE_SCRIPT) + pass_fel_information(handle, offset); + } + free(buf); + } + + return i; // return number of files that were processed +} + int main(int argc, char **argv) { bool pflag_active = false; /* -p switch, causing "write" to output progress */ @@ -1308,23 +1359,8 @@ int main(int argc, char **argv) aw_fel_print_version(handle); skip=1; } else if (strcmp(argv[1], "write") == 0 && argc > 3) { - size_t size; - void *buf = load_file(argv[3], &size); - uint32_t offset = strtoul(argv[2], NULL, 0); - progress_start(pflag_active ? progress_bar : NULL, size); - double elapsed = aw_write_buffer(handle, buf, offset, size, true); - if (elapsed > 0) - pr_info("%.1f kB written in
[linux-sunxi] Re: [PATCH v5] clk: sunxi: Add CLK_OF_DECLARE support for sun8i-a23-apb0-clk driver
Hi, On Thu, Dec 03, 2015 at 03:05:30PM +0800, Chen-Yu Tsai wrote: > The APBS clock on sun9i is the same as the APB0 clock on sun8i. With > sun9i we are supporting the PRCM clocks by using CLK_OF_DECLARE, > instead of through a PRCM mfd device and subdevices for each clock > and reset control. As such we need a CLK_OF_DECLARE version of > the sun8i-a23-apb0-clk driver. > > Also, build it for sun9i/A80, and not just for configurations with > MFD_SUN6I_PRCM enabled. > > Signed-off-by: Chen-Yu Tsai > --- > > Changes since v4: > > - Keep building clk-sun8i-apb0 for SUN6I_MFD_PRCM. > > - Add an error message and comment for when of_io_request_and_map() > fails. of_io_request_and_map() merges a bunch of errors into -EINVAL, > so this might not be the best approach. But I think having an error > message when we know something is wrong (-EBUSY, -ENOMEM) is better. > > --- > drivers/clk/sunxi/Makefile | 1 + > drivers/clk/sunxi/clk-sun8i-apb0.c | 80 > -- > 2 files changed, 69 insertions(+), 12 deletions(-) > > diff --git a/drivers/clk/sunxi/Makefile b/drivers/clk/sunxi/Makefile > index 103efab05ca8..ccf21ba3b6b0 100644 > --- a/drivers/clk/sunxi/Makefile > +++ b/drivers/clk/sunxi/Makefile > @@ -15,6 +15,7 @@ obj-y += clk-sun9i-core.o > obj-y += clk-sun9i-mmc.o > obj-y += clk-usb.o > > +obj-$(CONFIG_MACH_SUN9I) += clk-sun8i-apb0.o > obj-$(CONFIG_MACH_SUN9I) += clk-sun9i-cpus.o > > obj-$(CONFIG_MFD_SUN6I_PRCM) += \ > diff --git a/drivers/clk/sunxi/clk-sun8i-apb0.c > b/drivers/clk/sunxi/clk-sun8i-apb0.c > index 7ae5d2c2cde1..7ba61103a6f5 100644 > --- a/drivers/clk/sunxi/clk-sun8i-apb0.c > +++ b/drivers/clk/sunxi/clk-sun8i-apb0.c > @@ -17,13 +17,77 @@ > #include > #include > #include > +#include > #include > > +static struct clk *sun8i_a23_apb0_register(struct device_node *node, > +void __iomem *reg) > +{ > + const char *clk_name = node->name; > + const char *clk_parent; > + struct clk *clk; > + int ret; > + > + clk_parent = of_clk_get_parent_name(node, 0); > + if (!clk_parent) > + return ERR_PTR(-EINVAL); > + > + of_property_read_string(node, "clock-output-names", &clk_name); > + > + /* The A23 APB0 clock is a standard 2 bit wide divider clock */ > + clk = clk_register_divider(NULL, clk_name, clk_parent, 0, reg, > +0, 2, CLK_DIVIDER_POWER_OF_TWO, NULL); > + if (IS_ERR(clk)) > + return clk; > + > + ret = of_clk_add_provider(node, of_clk_src_simple_get, clk); > + if (ret) > + goto err_unregister; > + > + return clk; > + > +err_unregister: > + clk_unregister_divider(clk); > + > + return ERR_PTR(ret); > +} > + > +static void sun8i_a23_apb0_setup(struct device_node *node) > +{ > + void __iomem *reg; > + struct resource res; > + struct clk *clk; > + > + reg = of_io_request_and_map(node, 0, of_node_full_name(node)); > + if (IS_ERR(reg)) { > + /* > + * This happens with clk nodes instantiated through mfd, > + * as those do not have their resources assigned in the > + * device tree. Do not print an error in this case. > + */ > + if (PTR_ERR(reg) != -EINVAL) > + pr_err("Could not get registers for a23-apb0-clk\n"); This is not the only case you have to take into account. There's also the case when you have a regular clock (and by regular I mean that is not in the PRCM) that will be probed by the CLK_OF_DECLARE mechanism and then later by the device model. In such a case, the second of_io_request_and_map will fail, and you will have an error returned that you do not ignore at the moment. Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. signature.asc Description: Digital signature
Re: [linux-sunxi] Requesting Help on a USD15, Allwinner Quadcore 1.2Ghz 64-bit A53 Hardware
Hi KH: I think what Luc said is very true. The efficiency and power of open source community in helping developing a new thing depends on how open the hardware upstream is toward to the spec of the hardware. I am not currently working on Ubuntu arm port, but I am woring on other Linux (e.g., Mageia) to an Arm SBC board, (r.g., Banana Pi M1 using allwinner A20). Once you have more developing boards available, I'd like to see whether I can also install Linux bootlaoder to your pine64. Let me know once you have it. Regards Shelandy KH Goh於 2015年12月2日星期三 UTC-6上午12時35分49秒寫道: > Hi Priit Laes, > Thank for the info. Currently we are in the process of sorting out our > documentation. Will update in the http://linux-sunxi.org/New_Device_howto > once it is ready. > > > Anyway, the regulator used in Pine64 is AXP803 and the Wifi/BT is Realtek > RTL-8273. > > > Regards, > KH Goh > > On Sunday, November 29, 2015 at 3:12:21 PM UTC+8, Priit Laes wrote:On Sat, > 2015-11-28 at 17:43 -0800, KH Goh wrote: > > > > [...] > > > In terms of the hardware, at the moment we are having 2 unit of > > > Pine64 Engineering board (Please refer here for the > > > spec http://pine64.com/product ), and would like to donate it to the > > > community for further evaluation and testing. Since we are a newcomer > > > in this community, we would like you to advise us on who and where > > > should we send the 2 board to. > > > > You can already start with the new device howto - http://linux-sunxi.or > > g/New_Device_howto > > > > This would be a nice second step to working together with community. > > > > Do you also have access and/or permission to "publish" the datasheets > > (A53, AXP??? and Wifi/BT) and BSP? > > > > Also, on http://pine64.com/product#intro could you label all the ports > > and expansion headers (I can see from the board that there are > > headers/sockets for TP, CSI, DSI, RTC, VBAT, POWER, UART). And what > > regulator chip (AXP???) and wifi/bluetooth chip does it use? > > > > And a typo "muti-channel" on that page. > > > > > > > > > Thanks for your advise and appreciate your kind assistance. > > > Regards, > > > KH Goh > > > > > > > > > On Saturday, November 28, 2015 at 9:01:31 PM UTC+8, Luc Verhaegen > > > wrote: > > > > On Sat, Nov 28, 2015 at 12:38:16AM -0800, khg...@gmail.com wrote: > > > > > Hi, > > > > > We are a group of people currently trying to come out with a very > > > > low > > > > > cost single board computer, by making use of Allwinner Quadcore > > > > 1.2Ghz > > > > > 64-bit A53 CPU. The target costing for the single board computer > > > > is > > > > > USD15. The hardware will have a 4K HDMI video output and on board > > > > > ethernet connection. Further more, each board will has its own > > > > unique > > > > > MAC address. The objective for this project is to allow > > > > individual, > > > > > having the opportunity to learn IT knowledge with a friction of > > > > the > > > > > cost. Please refer to pine64.com for more detail on the hardware > > > > > specification. > > > > > > > > > > Currently, the hardware development on the board is almost ready. > > > > And > > > > > with us, is the full Linux BSP with the true 64bit compiler. Due > > > > to > > > > > budget constrain and our limited know-how in Linux, We would like > > > > to > > > > > request the help from this community to bring up the Linux into a > > > > full > > > > > function Ubuntu desktop, thus allow the user to truly owning a > > > > fully > > > > > function open source computer with just a friction of the cost. > > > > > > > > > > As for the hardware itself, currently we are in the mist of > > > > building > > > > > some sample board to allow any interested developer to work on > > > > it. > > > > > > > > > > Thanks and Regard, > > > > > KH Goh > > > > > > > > Hi, > > > > > > > > Thanks for contacting the canonical source of most things > > > > sunxi/allwinner before actually launching your kickstarter > > > > campaign. > > > > > > > > This is the first time since the original cubieboard that such a > > > > thing > > > > has happened. Many companies with similar products only afterwards > > > > find > > > > out to what extent they do depend on the linux-sunxi community, and > > > > then > > > > change their story in either direction. Often the work done by the > > > > people of the linux-sunxi community gets used directly, > > > > cloned/forked, > > > > and nothing is ever given back. > > > > > > > > As you can see, we (and while i do not speak for all of us, i know > > > > that > > > > i am not alone here) are sceptical about whoever approaches us like > > > > this, especially when one of the first statements is "budget > > > > constraints". You cannot expect the linux-sunxi community to do > > > > your > > > > work for you for free. > > > > > > > > You should how
[linux-sunxi] Re: [PATCH v5 2/4] pinctrl: sunxi: Add H3 PIO controller support
On Fri, Dec 04, 2015 at 10:24:41PM +0100, Jens Kuske wrote: > The H3 uses the same pin controller as previous SoC's from Allwinner. > Add support for the pins controlled by the main PIO controller. > > Signed-off-by: Jens Kuske Acked-by: Maxime Ripard Thanks! Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. signature.asc Description: Digital signature
[linux-sunxi] Re: [PATCH resend 5/6] ARM: dts: sun7i: Add DRAM gates
On Sat, Dec 05, 2015 at 09:16:46PM +0800, Chen-Yu Tsai wrote: > The DRAM gates controls direct memory access for some peripherals. > These peripherals include the display pipeline, so add the required > gates to the simplefb nodes as well. > > Signed-off-by: Chen-Yu Tsai Applied, thanks! Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. signature.asc Description: Digital signature
[linux-sunxi] Re: [PATCH 2/2] input: gt801_2plus1 - Add initial support for Goodix GT801 2+1
On Mon, 2015-12-07 at 09:34 +0100, Julia Lawall wrote: > It looks like braces may be mising. Please check. Thanks, nice catch! It's actually messed up indenting. Code works as intended. > > julia > > On Mon, 7 Dec 2015, kbuild test robot wrote: > > > Hi Priit, > > > > [auto build test WARNING on mripard/sunxi/for-next] > > [also build test WARNING on next-20151203] > > [cannot apply to input/next v4.4-rc4] > > > > url: https://github.com/0day-ci/linux/commits/Priit-Laes/input-D > river-for-Goodix-GT801-2-1-touchscreen/20151207-152831 > > base: https://git.kernel.org/pub/scm/linux/kernel/git/mripard/lin > ux.git sunxi/for-next > > :: branch date: 46 minutes ago > > :: commit date: 46 minutes ago > > > > >> drivers/input/touchscreen/gt801_2plus1.c:119:3-30: code aligned > with following code on line 120 > > > > git remote add linux-review https://github.com/0day-ci/linux > > git remote update linux-review > > git checkout d66df313f96e04572821e49cada65cb5c1bea9e2 > > vim +119 drivers/input/touchscreen/gt801_2plus1.c > > > > d66df313 Priit Laes 2015-12-07 113 return; > > d66df313 Priit Laes 2015-12-07 114 > > d66df313 Priit Laes 2015-12-07 115 /* Build touch map */ > > d66df313 Priit Laes 2015-12-07 116 touch_num = 0; > > d66df313 Priit Laes 2015-12-07 117 for (i = 0; (touch_raw != 0) > && (i < ts->max_touch_num); i++) { > > d66df313 Priit Laes 2015-12-07 118 if (touch_raw & 1) > > d66df313 Priit Laes 2015-12-07 > @119 touch_map[touch_num++] = i; > > d66df313 Priit Laes 2015-12-07 @120 touch_raw >>= > 1; > > d66df313 Priit Laes 2015-12-07 121 } > > d66df313 Priit Laes 2015-12-07 122 > > d66df313 Priit Laes 2015-12-07 123 /* Calculate checksum */ > > > > --- > > 0-DAY kernel test infrastructure Open Source > Technology Center > > https://lists.01.org/pipermail/kbuild-all ; Intel > Corporation > > -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] Re: [PATCH resend 3/6] ARM: dts: sun4i: Add DRAM gates
On Sat, Dec 05, 2015 at 09:16:44PM +0800, Chen-Yu Tsai wrote: > The DRAM gates controls direct memory access for some peripherals. > These peripherals include the display pipeline, so add the required > gates to the simplefb nodes as well. > > Signed-off-by: Chen-Yu Tsai Applied, thanks! Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. signature.asc Description: Digital signature
[linux-sunxi] Re: [PATCH resend 1/6] clk: sunxi: Add DRAM gates support for sun4i-a10
On Sat, Dec 05, 2015 at 09:16:42PM +0800, Chen-Yu Tsai wrote: > The A10/A20 share the same set of DRAM clock gates, which controls > direct memory access for some peripherals. > > On the A10, bit 15 controls the system's DRAM clock output (possibly > to the DRAM chips), which we need to keep on. > > On the A20 this has been moved to the DRAM controller, becoming a no-op. > However it is still listed in the user manual, so add it anyway. > > Signed-off-by: Chen-Yu Tsai Applied, thanks! Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. signature.asc Description: Digital signature
[linux-sunxi] Re: [PATCH 2/2] input: gt801_2plus1 - Add initial support for Goodix GT801 2+1
It looks like braces may be mising. Please check. julia On Mon, 7 Dec 2015, kbuild test robot wrote: > Hi Priit, > > [auto build test WARNING on mripard/sunxi/for-next] > [also build test WARNING on next-20151203] > [cannot apply to input/next v4.4-rc4] > > url: > https://github.com/0day-ci/linux/commits/Priit-Laes/input-Driver-for-Goodix-GT801-2-1-touchscreen/20151207-152831 > base: https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux.git > sunxi/for-next > :: branch date: 46 minutes ago > :: commit date: 46 minutes ago > > >> drivers/input/touchscreen/gt801_2plus1.c:119:3-30: code aligned with > >> following code on line 120 > > git remote add linux-review https://github.com/0day-ci/linux > git remote update linux-review > git checkout d66df313f96e04572821e49cada65cb5c1bea9e2 > vim +119 drivers/input/touchscreen/gt801_2plus1.c > > d66df313 Priit Laes 2015-12-07 113 return; > d66df313 Priit Laes 2015-12-07 114 > d66df313 Priit Laes 2015-12-07 115 /* Build touch map */ > d66df313 Priit Laes 2015-12-07 116 touch_num = 0; > d66df313 Priit Laes 2015-12-07 117 for (i = 0; (touch_raw != 0) && (i < > ts->max_touch_num); i++) { > d66df313 Priit Laes 2015-12-07 118 if (touch_raw & 1) > d66df313 Priit Laes 2015-12-07 @119 touch_map[touch_num++] > = i; > d66df313 Priit Laes 2015-12-07 @120 touch_raw >>= 1; > d66df313 Priit Laes 2015-12-07 121 } > d66df313 Priit Laes 2015-12-07 122 > d66df313 Priit Laes 2015-12-07 123 /* Calculate checksum */ > > --- > 0-DAY kernel test infrastructureOpen Source Technology Center > https://lists.01.org/pipermail/kbuild-all Intel Corporation >
[linux-sunxi] Re: [PATCH v5 3/4] ARM: dts: sunxi: Add Allwinner H3 DTSI
On Fri, 4 Dec 2015 22:24:42 +0100 Jens Kuske wrote: > The Allwinner H3 is a home entertainment system oriented SoC with > four Cortex-A7 cores and a Mali-400MP2 GPU. > > Signed-off-by: Jens Kuske > --- > arch/arm/boot/dts/sun8i-h3.dtsi | 497 > > 1 file changed, 497 insertions(+) > create mode 100644 arch/arm/boot/dts/sun8i-h3.dtsi > > diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi > new file mode 100644 > index 000..1524130e > --- /dev/null > +++ b/arch/arm/boot/dts/sun8i-h3.dtsi > @@ -0,0 +1,497 @@ [snip] > + bus_gates: clk@01c20060 { > + #clock-cells = <1>; > + compatible = "allwinner,sun8i-h3-bus-gates-clk"; > + reg = <0x01c20060 0x14>; > + clocks = <&ahb1>, <&ahb2>, <&apb1>, <&apb2>; > + clock-names = "ahb1", "ahb2", "apb1", "apb2"; > + clock-indices = <5>, <6>, <8>, > + <9>, <10>, <13>, > + <14>, <17>, <18>, > + <19>, <20>, > + <21>, <23>, > + <24>, <25>, > + <26>, <27>, > + <28>, <29>, > + <30>, <31>, <32>, > + <35>, <36>, <37>, > + <40>, <41>, <43>, > + <44>, <52>, <53>, > + <54>, <64>, > + <65>, <69>, <72>, > + <76>, <77>, <78>, > + <96>, <97>, <98>, > + <112>, <113>, > + <114>, <115>, > + <116>, <128>, <135>; > + clock-output-names = "bus_ce", "bus_dma", "bus_mmc0", > + "bus_mmc1", "bus_mmc2", "bus_nand", > + "bus_sdram", "bus_gmac", "bus_ts", > + "bus_hstimer", "bus_spi0", > + "bus_spi1", "bus_otg", > + "bus_otg_ehci0", "bus_ehci1", > + "bus_ehci2", "bus_ehci3", > + "bus_otg_ohci0", "bus_ohci1", > + "bus_ohci2", "bus_ohci3", "bus_ve", > + "bus_lcd0", "bus_lcd1", > "bus_deint", The tcon1 clock is used by both lcd0 and lcd1, while the tcon0 clock is used for TV output from lcd1, so, this should be: "bus_tcon0", "bus_tcon1", "bus_deint", (the tcon1 clock is used by both lcd0 and lcd1, while the tcon0 clock is used for TV output from lcd1) > + "bus_csi", "bus_tve", "bus_hdmi", > + "bus_de", "bus_gpu", "bus_msgbox", > + "bus_spinlock", "bus_codec", > + "bus_spdif", "bus_pio", "bus_ths", > + "bus_i2s0", "bus_i2s1", "bus_i2s2", > + "bus_i2c0", "bus_i2c1", "bus_i2c2", > + "bus_uart0", "bus_uart1", > + "bus_uart2", "bus_uart3", > + "bus_scr", "bus_ephy", "bus_dbg"; > + }; [snip] -- Ken ar c'hentañ | ** Breizh ha Linux atav! ** Jef | http://moinejf.free.fr/ -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.