Skip to content

CONFIG_TEGRA_PARTITION with tegra132 #9

Open

Description

@MartijnBraam

I'm trying to make mainline linux work on the nexus 9, continueing on the work already done on https://wiki.postmarketos.org/wiki/Google_Nexus_9_(htc-flounder)

I managed to make the eMMC recognized in the kernel by adding it to the dts but I'm having issues making it recognize the gpt partitions. It seems like the tegra partitions thing doesn't work at all yet on tegra132, the bootloader does pass the gpt and gpt_sector= but not tegraboot=sdmmc. Worked around that by manually adding tegraboot to the cmdline in boot.img

This is the changes I made so far: MartijnBraam@ab0d237

The current issue I have is that nvidia,tegra124-sdhci doesn't have the memory address as only value so just duplicating the code doesn't work.

Activity

  1. digetx commented on Aug 24, 2020

    @digetx
    Member

    Hello @MartijnBraam! Nice work on getting TegraPT to work on Nexus 9! I didn't even know that TegraPT is needed for Nexus 9. The code change looks good to me, I can incorporate it into grate-kernel on next update. I suppose you may add tegraboot=sdmmc to the bootargs in the device-tree in order to avoid changing cmdline of the bootimg, couldn't you? The kernel needs to know whether it's okay to check eMMC for the TegraPT and the cmdline parameter is the best option for now. It's a bit unfortunate that Tegra bootloaders are inconsistent, but that's what we have and need to deal with it :)

  2. digetx commented on Aug 24, 2020

    @digetx
    Member

    Oh, wait! Seems you haven't got it to work yet. Could you please clarify what do you mean by the memory address as only value?

  3. digetx commented on Aug 24, 2020

    @digetx
    Member

    Ah, I see now. Could you please try this change:

    diff --git a/block/partitions/tegra.c b/block/partitions/tegra.c
    index a2ccd644e377..e754159d91e8 100644
    --- a/block/partitions/tegra.c
    +++ b/block/partitions/tegra.c
    @@ -21,6 +21,7 @@
     #include <linux/init.h>
     #include <linux/kernel.h>
     #include <linux/of.h>
    +#include <linux/of_address.h>
     #include <linux/sizes.h>
     #include <linux/slab.h>
     #include <linux/string.h>
    @@ -456,9 +457,9 @@ tegra_partition_table_emmc_boot_offset(struct tegra_partition_table_parser *ptp)
     	struct mmc_card *card = mmc_bdev_to_card(ptp->state->bdev);
     	const struct of_device_id *matched;
     	const u32 *sdhci_bases;
    +	const __be32 *addrp;
     	u32 sdhci_base;
     	unsigned int i;
    -	int err;
     
     	/* filter out unexpected/untested boot sources */
     	if (!card || card->ext_csd.rev < 3 ||
    @@ -477,11 +478,12 @@ tegra_partition_table_emmc_boot_offset(struct tegra_partition_table_parser *ptp)
     	sdhci_bases = matched->data;
     
     	/* figure out SDHCI instance ID by the base address */
    -	err = of_property_read_u32_index(card->host->parent->of_node,
    -					 "reg", 0, &sdhci_base);
    -	if (err)
    +	addrp = of_get_address(card->host->parent->of_node, 0, NULL, NULL);
    +	if (!addrp)
     		return -1;
     
    +	sdhci_base = of_translate_address(card->host->parent->of_node, addrp);
    +
     	for (i = 0; i < TEGRA_PT_SDHCI_DEVICE_INSTANCES; i++) {
     		if (sdhci_base == sdhci_bases[i])
     			break;
    
  4. MartijnBraam commented on Aug 24, 2020

    @MartijnBraam
    Author

    Yep that seems to work great, combined the changes in here: MartijnBraam@c87728d

    Now I'm out of the initramfs at least :)

    This is in my kernel log with the change:

    [    2.269896] Primary GPT is invalid, using alternate GPT
    [    2.278858]  mmcblk0: p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 p18 p19 p20 p21 p22 p23 p24 p25 p26 p27 p28 p29 p30 p31 p32 p33
    
  5. digetx commented on Aug 25, 2020

    @digetx
    Member

    Awesome!

    Wow, Nexus 9 has 33 partitions? Crazy :)

  6. added a commit that references this issue on Sep 12, 2020
  7. 81 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions